本文整理匯總了Golang中github.com/ipfs/go-ipfs/repo/fsrepo.IsInitialized函數的典型用法代碼示例。如果您正苦於以下問題:Golang IsInitialized函數的具體用法?Golang IsInitialized怎麽用?Golang IsInitialized使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了IsInitialized函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: doInit
func doInit(out io.Writer, repoRoot string, force bool, nBitsForKeypair int) error {
if _, err := fmt.Fprintf(out, "initializing ipfs node at %s\n", repoRoot); err != nil {
return err
}
if err := checkWriteable(repoRoot); err != nil {
return err
}
if fsrepo.IsInitialized(repoRoot) && !force {
return errRepoExists
}
conf, err := config.Init(out, nBitsForKeypair)
if err != nil {
return err
}
if fsrepo.IsInitialized(repoRoot) {
if err := fsrepo.Remove(repoRoot); err != nil {
return err
}
}
if err := fsrepo.Init(repoRoot, conf); err != nil {
return err
}
if err := addDefaultAssets(out, repoRoot); err != nil {
return err
}
return initializeIpnsKeyspace(repoRoot)
}
示例2: doInit
func doInit(out io.Writer, repoRoot string, force bool, empty bool, nBitsForKeypair int) error {
log.Println("initializing ipfs node at ", repoRoot)
if err := checkWriteable(repoRoot); err != nil {
return err
}
if fsrepo.IsInitialized(repoRoot) && !force {
log.Println("repo already exists")
return nil
}
conf, err := config.Init(out, nBitsForKeypair)
if err != nil {
return err
}
if fsrepo.IsInitialized(repoRoot) {
if err := fsrepo.Remove(repoRoot); err != nil {
return err
}
}
if err := fsrepo.Init(repoRoot, conf); err != nil {
return err
}
if !empty {
if err := addDefaultAssets(out, repoRoot); err != nil {
return err
}
}
return initializeIpnsKeyspace(repoRoot)
}
示例3: doInit
func doInit(out io.Writer, repoRoot string, empty bool, nBitsForKeypair int, conf *config.Config) error {
if _, err := fmt.Fprintf(out, "initializing ipfs node at %s\n", repoRoot); err != nil {
return err
}
if err := checkWriteable(repoRoot); err != nil {
return err
}
if fsrepo.IsInitialized(repoRoot) {
return errRepoExists
}
if conf == nil {
var err error
conf, err = config.Init(out, nBitsForKeypair)
if err != nil {
return err
}
}
if err := fsrepo.Init(repoRoot, conf); err != nil {
return err
}
if !empty {
if err := addDefaultAssets(out, repoRoot); err != nil {
return err
}
}
return initializeIpnsKeyspace(repoRoot)
}
示例4: ensureRepoInitialized
func ensureRepoInitialized(path string) error {
if !fsrepo.IsInitialized(path) {
conf, err := config.Init(ioutil.Discard, *nBitsForKeypair)
if err != nil {
return err
}
if err := fsrepo.Init(path, conf); err != nil {
return err
}
}
return nil
}