Documentation ¶
Index ¶
- Constants
- func APIAddrFromRepoPath(repoPath string) (string, error)
- func APITokenFromRepoPath(repoPath string) (string, error)
- func Exists(repoPath string) (bool, error)
- func InitFSRepo(targetPath string, version uint, cfg *config.Config) error
- func InitFSRepoDirect(targetPath string, version uint, cfg *config.Config) error
- func MakeRepoDirName(prefix string, ts time.Time, version uint, uniqueifier uint) string
- func ReadVersion(repoPath string) (uint, error)
- func RequireMakeTempDir(t *testing.T, dirname string) string
- func RequireOpenTempFile(t *testing.T, suffix string) (*os.File, string)
- func RequireReadLink(t *testing.T, path string) string
- func RequireRemoveAll(t *testing.T, path string)
- func WriteVersion(p string, version uint) error
- type Datastore
- type FSRepo
- func (r *FSRepo) APIAddr() (string, error)
- func (r *FSRepo) APIToken() (string, error)
- func (r *FSRepo) ChainDatastore() Datastore
- func (r *FSRepo) Close() error
- func (r *FSRepo) Config() *config.Config
- func (r *FSRepo) Datastore() blockstoreutil.Blockstore
- func (r *FSRepo) JournalPath() string
- func (r *FSRepo) Keystore() fskeystore.Keystore
- func (r *FSRepo) MetaDatastore() Datastore
- func (r *FSRepo) Path() (string, error)
- func (r *FSRepo) PaychDatastore() Datastore
- func (r *FSRepo) ReplaceConfig(cfg *config.Config) error
- func (r *FSRepo) Repo() Repo
- func (r *FSRepo) SetAPIAddr(maddr string) error
- func (r *FSRepo) SetAPIToken(token []byte) error
- func (r *FSRepo) SnapshotConfig(cfg *config.Config) error
- func (r *FSRepo) Version() uint
- func (r *FSRepo) WalletDatastore() Datastore
- type MemRepo
- func (mr *MemRepo) APIAddr() (string, error)
- func (mr *MemRepo) APIToken() (string, error)
- func (mr *MemRepo) ChainDatastore() Datastore
- func (mr *MemRepo) Close() error
- func (mr *MemRepo) Config() *config.Config
- func (mr *MemRepo) Datastore() blockstoreutil.Blockstore
- func (mr *MemRepo) JournalPath() string
- func (mr *MemRepo) Keystore() fskeystore.Keystore
- func (mr *MemRepo) MetaDatastore() Datastore
- func (mr *MemRepo) Path() (string, error)
- func (mr *MemRepo) PaychDatastore() Datastore
- func (mr *MemRepo) ReplaceConfig(cfg *config.Config) error
- func (mr *MemRepo) Repo() Repo
- func (mr *MemRepo) SetAPIAddr(addr string) error
- func (mr *MemRepo) SetAPIToken(token []byte) error
- func (mr *MemRepo) Version() uint
- func (mr *MemRepo) WalletDatastore() Datastore
- type Repo
Constants ¶
const LatestVersion uint = 8
Version is the version of repo schema that this code understands.
Variables ¶
This section is empty.
Functions ¶
func APIAddrFromRepoPath ¶
APIAddrFromRepoPath returns the api addr from the filecoin repo
func APITokenFromRepoPath ¶ added in v0.9.7
APIAddrFromRepoPath returns the token from the filecoin repo
func InitFSRepo ¶
InitFSRepo initializes a new repo at the target path with the provided configuration. The successful result creates a symlink at targetPath pointing to a sibling directory named with a timestamp and repo version number. The link path must be empty prior. If the computed actual directory exists, it must be empty.
func InitFSRepoDirect ¶
InitFSRepoDirect initializes a new repo at a target path, establishing a provided configuration. The target path must not exist, or must reference an empty, read/writable directory.
func MakeRepoDirName ¶
MakeRepoDirName constructs a name for a concrete repo directory, which includes its version number and a timestamp. The name will begin with prefix and, if uniqueifier is non-zero, end with that (intended as an ordinal for finding a free name). E.g. ".filecoin-20190102-140425-012-1 This is exported for use by migrations.
func ReadVersion ¶
ReadVersion returns the unparsed (string) version from the version file in the specified repo.
func RequireMakeTempDir ¶
RequireMakeTempDir ensures that a temporary directory is created
func RequireOpenTempFile ¶
RequireOpenTempFile is a shortcut for opening a given temp file with a given suffix, then returning both a filename and a file pointer.
func RequireReadLink ¶
RequireReadLink reads a symlink that is expected to resolve successfully.
func RequireRemoveAll ¶
RequireRemoveAll ensures that the error condition is checked when we clean up after creating a temporary directory.
func WriteVersion ¶
WriteVersion writes the given version to the repo version file.
Types ¶
type Datastore ¶
type Datastore 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 OpenFSRepo ¶
OpenFSRepo opens an initialized fsrepo, expecting a specific version. The provided path may be to a directory, or a symbolic link pointing at a directory, which will be resolved just once at open.
func (*FSRepo) ChainDatastore ¶
ChainDatastore returns the chain datastore.
func (*FSRepo) Datastore ¶
func (r *FSRepo) Datastore() blockstoreutil.Blockstore
Datastore returns the datastore.
func (*FSRepo) JournalPath ¶
JournalPath returns the path the journal is at.
func (*FSRepo) Keystore ¶
func (r *FSRepo) Keystore() fskeystore.Keystore
Keystore returns the keystore
func (*FSRepo) MetaDatastore ¶
func (*FSRepo) PaychDatastore ¶ added in v0.9.1
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) SetAPIToken ¶
func (*FSRepo) SnapshotConfig ¶
SnapshotConfig stores a copy `cfg` in <repo_path>/snapshots/ appending the time of snapshot to the filename.
func (*FSRepo) WalletDatastore ¶
WalletDatastore returns the wallet datastore.
type MemRepo ¶
type MemRepo struct { C *config.Config D blockstoreutil.Blockstore Ks fskeystore.Keystore W Datastore Chain Datastore Meta Datastore Paych Datastore // contains filtered or unexported fields }
MemRepo is an in-memory implementation of the repo interface.
func NewInMemoryRepo ¶
func NewInMemoryRepo() *MemRepo
NewInMemoryRepo makes a new instance of MemRepo
func (*MemRepo) ChainDatastore ¶
ChainDatastore returns the chain datastore.
func (*MemRepo) Close ¶
Close deletes the temporary directories which hold staged piece data and sealed sectors.
func (*MemRepo) Datastore ¶
func (mr *MemRepo) Datastore() blockstoreutil.Blockstore
Datastore returns the datastore.
func (*MemRepo) JournalPath ¶
JournalPath returns a string to satisfy the repo interface.
func (*MemRepo) Keystore ¶
func (mr *MemRepo) Keystore() fskeystore.Keystore
Keystore returns the keystore.
func (*MemRepo) MetaDatastore ¶
// ChainDatastore returns the chain datastore.
func (mr *MemRepo) MarketDatastore() Datastore { return mr.Market }
ChainDatastore returns the chain datastore.
func (*MemRepo) PaychDatastore ¶ added in v0.9.1
ChainDatastore returns the chain datastore.
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) SetAPIToken ¶
func (*MemRepo) WalletDatastore ¶
WalletDatastore returns the wallet datastore.
type Repo ¶
type Repo interface { 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() blockstoreutil.Blockstore Keystore() fskeystore.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 // MetaDatastore is a specific storage solution, only used to store mpool data. MetaDatastore() Datastore PaychDatastore() Datastore // SetJsonrpcAPIAddr sets the address of the running jsonrpc API. SetAPIAddr(maddr string) error // APIAddr returns the address of the running API. APIAddr() (string, error) // SetAPIToken set api token SetAPIToken(token []byte) error // APIToken get api token APIToken() (string, error) // Version returns the current repo version. Version() uint // Path returns the repo path. Path() (string, error) // JournalPath returns the journal path. JournalPath() string // Close shuts down the repo. Close() error // repo return the repo Repo() Repo }
repo is a representation of all persistent data in a filecoin node.