repo

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UniversalBlockstore represents the blockstore domain for all data.
	// Right now, this includes chain objects (tipsets, blocks, messages), as
	// well as state. In the future, they may get segregated into different
	// domains.
	UniversalBlockstore = BlockstoreDomain("universal")
	HotBlockstore       = BlockstoreDomain("hot")
)
View Source
const KTrashPrefix = "trash-"

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 (titan daemon already running)")
	ErrClosedRepo        = errors.New("repo is no longer open")

	// ErrInvalidBlockstoreDomain is returned by LockedRepo#Blockstore() when
	// an unrecognized domain is requested.
	ErrInvalidBlockstoreDomain = errors.New("invalid blockstore domain")

	ErrPrivateKeyNotExist = errors.New("private key not exist")
	ErrNodeIDNotExist     = errors.New("node id not exist")
	ErrServerAPINotExist  = errors.New("server api not exist")
)
View Source
var Candidate candidate
View Source
var Edge edge
View Source
var ErrRepoExists = xerrors.New("repo exists")
View Source
var Locator locator
View Source
var Scheduler scheduler
View Source
var Wallet wallet

Functions

This section is empty.

Types

type BlockstoreDomain

type BlockstoreDomain string

BlockstoreDomain represents the domain of a blockstore.

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

func (*FsRepo) LockRO

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

Like Lock, except datastores will work in read-only mode

func (*FsRepo) NodeID added in v0.1.11

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

func (*FsRepo) PrivateKey

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

func (*FsRepo) ServerID

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

func (*FsRepo) SetConfigPath

func (fsr *FsRepo) SetConfigPath(cfgPath string)

type LockedRepo

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

	// returns the type of this repo
	RepoType() RepoType

	// Returns datastore defined in this repo.
	// The supplied context must only be used to initialize the datastore.
	// The implementation should not retain the context for usage throughout
	// the lifecycle.
	Datastore(ctx context.Context, namespace string) (datastore.Batching, error)

	// SplitstorePath returns the path for the SplitStore
	SplitstorePath() (string, error)

	// Returns config in this repo
	Config() (interface{}, error)
	SetConfig(func(interface{})) 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

	// SetServerID sets server id for CLI
	SetServerID([]byte) error

	// set node private key
	SetPrivateKey([]byte) error

	// set node id
	SetNodeID([]byte) error

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

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

	// Readonly returns true if the repo is readonly
	Readonly() bool
}

type Repo

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

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

	// ServerID returns server id
	ServerID() ([]byte, error)

	// PrivateKey returns private key
	PrivateKey() ([]byte, error)

	// NodeID returns node id
	NodeID() ([]byte, error)

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

type RepoType

type RepoType interface {
	Type() string
	Config() interface{}

	// APIFlags returns flags passed on the command line with the listen address
	// of the API server (only used by the tests), in the order of precedence they
	// should be applied for the requested kind of node.
	APIFlags() []string

	RepoFlags() []string

	// APIInfoEnvVars returns the environment variables to use in order of precedence
	// to determine the API endpoint of the specified node type.
	//
	// It returns the current variables and deprecated ones separately, so that
	// the user can log a warning when deprecated ones are found to be in use.
	APIInfoEnvVars() (string, []string, []string)
}

func NewRepoTypeFromString

func NewRepoTypeFromString(t string) RepoType

Jump to

Keyboard shortcuts

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