repo

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: Apache-2.0, MIT Imports: 30 Imported by: 66

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAPIEndpoint     = errors.New("API not running (no endpoint)")
	ErrNoAPIToken        = errors.New("API token not set")
	ErrRepoAlreadyLocked = errors.New("repo is already locked (lotus daemon already running)")
	ErrClosedRepo        = errors.New("repo is no longer open")
)
View Source
var ErrRepoExists = xerrors.New("repo exists")

Functions

This section is empty.

Types

type FsRepo

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

FsRepo is struct for repo, use NewFS to create

func NewFS

func NewFS(path string) (*FsRepo, error)

NewFS creates a repo instance based on a path on file system

func (*FsRepo) APIEndpoint

func (fsr *FsRepo) APIEndpoint() (multiaddr.Multiaddr, error)

APIEndpoint returns endpoint of API in this repo

func (*FsRepo) APIToken

func (fsr *FsRepo) APIToken() ([]byte, error)

func (*FsRepo) Exists

func (fsr *FsRepo) Exists() (bool, error)

func (*FsRepo) Init

func (fsr *FsRepo) Init(t RepoType) error

func (*FsRepo) Lock

func (fsr *FsRepo) Lock(repoType RepoType) (LockedRepo, error)

Lock acquires exclusive lock on this repo

type LockedRepo

type LockedRepo interface {
	// Close closes repo and removes lock.
	Close() error

	// Returns datastore defined in this repo.
	Datastore(namespace string) (datastore.Batching, error)

	// Returns config in this repo
	Config() (interface{}, error)
	SetConfig(func(interface{})) error

	GetStorage() (stores.StorageConfig, error)
	SetStorage(func(*stores.StorageConfig)) error
	Stat(path string) (fsutil.FsStat, error)
	DiskUsage(path string) (int64, error)

	// SetAPIEndpoint sets the endpoint of the current API
	// so it can be read by API clients
	SetAPIEndpoint(multiaddr.Multiaddr) error

	// SetAPIToken sets JWT API Token for CLI
	SetAPIToken([]byte) error

	// KeyStore returns store of private keys for Filecoin transactions
	KeyStore() (types.KeyStore, error)

	// Path returns absolute path of the repo
	Path() string
}

type MemRepo

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

func NewMemory

func NewMemory(opts *MemRepoOptions) *MemRepo

NewMemory creates new memory based repo with provided options. opts can be nil, it will be replaced with defaults. Any field in opts can be nil, they will be replaced by defaults.

func (*MemRepo) APIEndpoint

func (mem *MemRepo) APIEndpoint() (multiaddr.Multiaddr, error)

func (*MemRepo) APIToken

func (mem *MemRepo) APIToken() ([]byte, error)

func (*MemRepo) Lock

func (mem *MemRepo) Lock(t RepoType) (LockedRepo, error)

type MemRepoOptions

type MemRepoOptions struct {
	Ds       datastore.Datastore
	ConfigF  func(RepoType) interface{}
	KeyStore map[string]types.KeyInfo
}

MemRepoOptions contains options for memory repo

type Repo

type Repo interface {
	// APIEndpoint returns multiaddress for communication with Lotus API
	APIEndpoint() (multiaddr.Multiaddr, error)

	// APIToken returns JWT API Token for use in operations that require auth
	APIToken() ([]byte, error)

	// Lock locks the repo for exclusive use.
	Lock(RepoType) (LockedRepo, error)
}

type RepoType

type RepoType int
const (
	FullNode RepoType = iota
	StorageMiner
	Worker
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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