go-ipfs: github.com/ipfs/go-ipfs/repo Index | Files | Directories

package repo

import "github.com/ipfs/go-ipfs/repo"

Index

Package Files

mock.go onlyone.go repo.go

Variables

var (
    ErrApiNotRunning = errors.New("api not running")
)

type Datastore Uses

type Datastore interface {
    ds.Batching // must be thread-safe
}

Datastore is the interface required from a datastore to be acceptable to FSRepo.

type Mock Uses

type Mock struct {
    C   config.Config
    D   Datastore
    K   keystore.Keystore
    F   *filestore.FileManager
}

Mock is not thread-safe

func (*Mock) BackupConfig Uses

func (m *Mock) BackupConfig(prefix string) (string, error)

func (*Mock) Close Uses

func (m *Mock) Close() error

func (*Mock) Config Uses

func (m *Mock) Config() (*config.Config, error)

func (*Mock) Datastore Uses

func (m *Mock) Datastore() Datastore

func (*Mock) FileManager Uses

func (m *Mock) FileManager() *filestore.FileManager

func (*Mock) GetConfigKey Uses

func (m *Mock) GetConfigKey(key string) (interface{}, error)

func (*Mock) GetStorageUsage Uses

func (m *Mock) GetStorageUsage() (uint64, error)

func (*Mock) Keystore Uses

func (m *Mock) Keystore() keystore.Keystore

func (*Mock) SetAPIAddr Uses

func (m *Mock) SetAPIAddr(addr ma.Multiaddr) error

func (*Mock) SetConfig Uses

func (m *Mock) SetConfig(updated *config.Config) error

func (*Mock) SetConfigKey Uses

func (m *Mock) SetConfigKey(key string, value interface{}) error

func (*Mock) SwarmKey Uses

func (m *Mock) SwarmKey() ([]byte, error)

type OnlyOne Uses

type OnlyOne struct {
    // contains filtered or unexported fields
}

OnlyOne tracks open Repos by arbitrary key and returns the already open one.

func (*OnlyOne) Open Uses

func (o *OnlyOne) Open(key interface{}, open func() (Repo, error)) (Repo, error)

Open a Repo identified by key. If Repo is not already open, the open function is called, and the result is remember for further use.

Key must be comparable, or Open will panic. Make sure to pick keys that are unique across different concrete Repo implementations, e.g. by creating a local type:

type repoKey string
r, err := o.Open(repoKey(path), open)

Call Repo.Close when done.

type Repo Uses

type Repo interface {
    // Config returns the ipfs configuration file from the repo. Changes made
    // to the returned config are not automatically persisted.
    Config() (*config.Config, error)

    // BackupConfig creates a backup of the current configuration file using
    // the given prefix for naming.
    BackupConfig(prefix string) (string, error)

    // SetConfig persists the given configuration struct to storage.
    SetConfig(*config.Config) error

    // SetConfigKey sets the given key-value pair within the config and persists it to storage.
    SetConfigKey(key string, value interface{}) error

    // GetConfigKey reads the value for the given key from the configuration in storage.
    GetConfigKey(key string) (interface{}, error)

    // Datastore returns a reference to the configured data storage backend.
    Datastore() Datastore

    // GetStorageUsage returns the number of bytes stored.
    GetStorageUsage() (uint64, error)

    // Keystore returns a reference to the key management interface.
    Keystore() keystore.Keystore

    // FileManager returns a reference to the filestore file manager.
    FileManager() *filestore.FileManager

    // SetAPIAddr sets the API address in the repo.
    SetAPIAddr(addr ma.Multiaddr) error

    // SwarmKey returns the configured shared symmetric key for the private networks feature.
    SwarmKey() ([]byte, error)

    io.Closer
}

Repo represents all persistent data of a given ipfs node.

Directories

PathSynopsis
common
fsrepopackage fsrepo
fsrepo/migrations

Package repo imports 8 packages (graph) and is imported by 343 packages. Updated 2019-09-01. Refresh now. Tools for package owners.