v0.2.3 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2015 License: MIT Imports: 17 Imported by: 0



package fsrepo

TODO explain the package roadmap...

├── client/
|   ├── client.lock          <------ protects client/ + signals its own pid
│   ├── ipfs-client.cpuprof
│   ├── ipfs-client.memprof
│   └── logs/
├── config
├── daemon/
│   ├── daemon.lock          <------ protects daemon/ + signals its own address
│   ├── ipfs-daemon.cpuprof
│   ├── ipfs-daemon.memprof
│   └── logs/
├── datastore/
├── repo.lock                <------ protects datastore/ and config
└── version



This section is empty.


This section is empty.


func BestKnownPath

func BestKnownPath() (string, error)

BestKnownPath returns the best known fsrepo path. If the ENV override is present, this function returns that value. Otherwise, it returns the default repo path.

func ConfigAt

func ConfigAt(repoPath string) (*config.Config, error)

ConfigAt returns an error if the FSRepo at the given path is not initialized. This function allows callers to read the config file even when another process is running and holding the lock.

func Init

func Init(path string, conf *config.Config) error

Init initializes a new FSRepo at the given path with the provided config. TODO add support for custom datastores.

func IsInitialized

func IsInitialized(path string) bool

IsInitialized returns true if the repo is initialized at provided |path|.

func LockedByOtherProcess

func LockedByOtherProcess(repoPath string) bool

LockedByOtherProcess returns true if the FSRepo is locked by another process. If true, then the repo cannot be opened by this process.

func Remove

func Remove(repoPath string) error

Remove recursively removes the FSRepo at |path|.


type FSRepo

type FSRepo struct {
	// contains filtered or unexported fields

FSRepo represents an IPFS FileSystem Repo. It is safe for use by multiple callers.

func At

func At(repoPath string) *FSRepo

At returns a handle to an FSRepo at the provided |path|.

func (*FSRepo) Close

func (r *FSRepo) Close() error

Close closes the FSRepo, releasing held resources.

func (*FSRepo) Config

func (r *FSRepo) Config() *config.Config

Config returns the FSRepo's config. This method must not be called if the repo is not open.

Result when not Open is undefined. The method may panic if it pleases.

func (*FSRepo) Datastore

func (r *FSRepo) Datastore() ds.ThreadSafeDatastore

Datastore returns a repo-owned datastore. If FSRepo is Closed, return value is undefined.

func (*FSRepo) GetConfigKey

func (r *FSRepo) GetConfigKey(key string) (interface{}, error)

GetConfigKey retrieves only the value of a particular key.

func (*FSRepo) Open

func (r *FSRepo) Open() error

Open returns an error if the repo is not initialized.

func (*FSRepo) SetConfig

func (r *FSRepo) SetConfig(updated *config.Config) error

SetConfig updates the FSRepo's config.

func (*FSRepo) SetConfigKey

func (r *FSRepo) SetConfigKey(key string, value interface{}) error

SetConfigKey writes the value of a particular key.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL