Documentation ¶
Index ¶
- Constants
- func APIAddrFromFile(apiFilePath string) (string, error)
- func FSRepoDir() string
- func GetRepoDir(repoDir string) string
- func InitFSRepo(p string, cfg *config.Config) error
- type Datastore
- type FSRepo
- func (r *FSRepo) APIAddr() (string, error)
- func (r *FSRepo) ChainDatastore() Datastore
- func (r *FSRepo) Close() error
- func (r *FSRepo) Config() *config.Config
- func (r *FSRepo) Datastore() Datastore
- func (r *FSRepo) DealsDatastore() Datastore
- func (r *FSRepo) Keystore() keystore.Keystore
- func (r *FSRepo) NewFunc() string
- func (r *FSRepo) ReplaceConfig(cfg *config.Config) error
- func (r *FSRepo) SealedDir() string
- func (r *FSRepo) SetAPIAddr(maddr string) error
- func (r *FSRepo) SnapshotConfig(cfg *config.Config) error
- func (r *FSRepo) StagingDir() string
- func (r *FSRepo) Version() uint
- func (r *FSRepo) WalletDatastore() Datastore
- type MemRepo
- func (mr *MemRepo) APIAddr() (string, error)
- func (mr *MemRepo) ChainDatastore() Datastore
- func (mr *MemRepo) CleanupSectorDirs()
- func (mr *MemRepo) Close() error
- func (mr *MemRepo) Config() *config.Config
- func (mr *MemRepo) Datastore() Datastore
- func (mr *MemRepo) DealsDatastore() Datastore
- func (mr *MemRepo) Keystore() keystore.Keystore
- func (mr *MemRepo) NewFunc() string
- func (mr *MemRepo) ReplaceConfig(cfg *config.Config) error
- func (mr *MemRepo) SealedDir() string
- func (mr *MemRepo) SetAPIAddr(addr string) error
- func (mr *MemRepo) StagingDir() string
- func (mr *MemRepo) Version() uint
- func (mr *MemRepo) WalletDatastore() Datastore
- type NoRepoError
- type Repo
Constants ¶
const (
// APIFile is the filename containing the filecoin node's api address.
APIFile = "api"
)
const Version uint = 1
Version is the current repo version that we require for a valid repo.
Variables ¶
This section is empty.
Functions ¶
func APIAddrFromFile ¶
APIAddrFromFile reads the address from the API file at the given path. A relevant comment from a similar function at go-ipfs/repo/fsrepo/fsrepo.go: 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 GetRepoDir ¶
GetRepoDir is a helper for either using a user provided repoDir or fetching the repoDir from FSRepoDir
Types ¶
type Datastore ¶
type Datastore interface { // NB: there are other more featureful interfaces we could require here, we // can either force it, or just do hopeful type checks. Not all datastores // implement every feature. datastore.Batching }
Datastore is the datastore interface provided by the repo
type FSRepo ¶
type FSRepo struct {
// contains filtered or unexported fields
}
FSRepo is a repo implementation backed by a filesystem.
func CreateRepo ¶
CreateRepo provides a quick shorthand for initializing and opening a repo
func OpenFSRepo ¶
OpenFSRepo opens an already initialized fsrepo at the given path
func (*FSRepo) ChainDatastore ¶
ChainDatastore returns the chain datastore.
func (*FSRepo) DealsDatastore ¶
DealsDatastore returns the deals datastore.
func (*FSRepo) ReplaceConfig ¶
ReplaceConfig replaces the current config with the newly passed in one.
func (*FSRepo) SetAPIAddr ¶
SetAPIAddr writes the address to the API file. SetAPIAddr expects parameter `port` to be of the form `:<port>`.
func (*FSRepo) SnapshotConfig ¶
SnapshotConfig stores a copy `cfg` in <repo_path>/snapshots/ appending the time of snapshot to the filename.
func (*FSRepo) StagingDir ¶
StagingDir satisfies node.SectorDirs
func (*FSRepo) WalletDatastore ¶
WalletDatastore returns the wallet datastore.
type MemRepo ¶
type MemRepo struct { C *config.Config D Datastore Ks keystore.Keystore W Datastore Chain Datastore DealsDs Datastore // contains filtered or unexported fields }
MemRepo is a mostly (see `stagingDir` and `sealedDir`) in-memory implementation of the Repo interface.
func NewInMemoryRepo ¶
func NewInMemoryRepo() *MemRepo
NewInMemoryRepo makes a new instance of MemRepo
func NewInMemoryRepoWithSectorDirectories ¶
NewInMemoryRepoWithSectorDirectories makes a new instance of MemRepo configured to use the provided directories as sealed and staged sector-storage.
func (*MemRepo) ChainDatastore ¶
ChainDatastore returns the chain datastore.
func (*MemRepo) CleanupSectorDirs ¶
func (mr *MemRepo) CleanupSectorDirs()
CleanupSectorDirs removes all sector directories and their contents.
func (*MemRepo) Close ¶
Close deletes the temporary directories which hold staged piece data and sealed sectors.
func (*MemRepo) DealsDatastore ¶
DealsDatastore returns the deals datastore for miners.
func (*MemRepo) Keystore ¶
func (mr *MemRepo) Keystore() keystore.Keystore
Keystore returns the keystore.
func (*MemRepo) ReplaceConfig ¶
ReplaceConfig replaces the current config with the newly passed in one.
func (*MemRepo) SetAPIAddr ¶
SetAPIAddr writes the address of the running API to memory.
func (*MemRepo) StagingDir ¶
StagingDir implements node.StagingDir.
func (*MemRepo) WalletDatastore ¶
WalletDatastore returns the wallet datastore.
type NoRepoError ¶
type NoRepoError struct {
Path string
}
NoRepoError is returned when trying to open a repo where one does not exist
func (NoRepoError) Error ¶
func (err NoRepoError) Error() string
type Repo ¶
type Repo interface { NewFunc() string Config() *config.Config // ReplaceConfig replaces the current config, with the newly passed in one. ReplaceConfig(cfg *config.Config) error // Datastore is a general storage solution for things like blocks. Datastore() Datastore Keystore() keystore.Keystore // WalletDatastore is a specific storage solution, only used to store sensitive wallet information. WalletDatastore() Datastore // ChainDatastore is a specific storage solution, only used to store already validated chain data. ChainDatastore() Datastore // DealsDatastore holds deals data. DealsDatastore() Datastore // SetAPIAddr sets the address of the running API. SetAPIAddr(string) error // APIAddr returns the address of the running API. APIAddr() (string, error) Version() uint // StagingDir is used to store staged sectors. StagingDir() string // SealedDir is used to store sealed sectors. SealedDir() string Close() error }
Repo is a representation of all persistent data in a filecoin node.