fsrepo

package
v0.4.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2016 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

package fsrepo

TODO explain the package roadmap...

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

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoVersion = errors.New("no version file found, please run 0-to-1 migration tool.\n" + migrationInstructions)
	ErrOldRepo   = errors.New("ipfs repo found in old '~/.go-ipfs' location, please run migration tool.\n" + migrationInstructions)
)
View Source
var RepoVersion = "3"

version number that we are currently expecting to see

Functions

func APIAddr

func APIAddr(repoPath string) (string, error)

APIAddr returns the registered API addr, according to the api file in the fsrepo. This is a concurrent operation, meaning that any process may read this file. modifying this file, therefore, should use "mv" to replace the whole file and avoid interleaved read/writes.

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(repoPath 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, error)

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

func Open

func Open(repoPath string) (repo.Repo, error)

Open the FSRepo at path. Returns an error if the repo is not initialized.

func Remove added in v0.2.2

func Remove(repoPath string) error

Remove recursively removes the FSRepo at |path|.

Types

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 (*FSRepo) Close

func (r *FSRepo) Close() error

Close closes the FSRepo, releasing held resources.

func (*FSRepo) Config

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

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

func (*FSRepo) Datastore

func (r *FSRepo) Datastore() repo.Datastore

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) GetStorageUsage

func (r *FSRepo) GetStorageUsage() (uint64, error)

GetStorageUsage computes the storage space taken by the repo in bytes

func (*FSRepo) SetAPIAddr

func (r *FSRepo) SetAPIAddr(addr string) error

SetAPIAddr writes the API Addr to the /api file.

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.

type NoRepoError

type NoRepoError struct {
	Path string
}

func (NoRepoError) Error

func (err NoRepoError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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