Documentation
¶
Index ¶
- Variables
- func Init(path string) (err error)
- func IsInit(path string) bool
- func SaveConfig(path string, cfg *Config) error
- func StartMockNode() *node.Node
- func StartRemoteCore() (*node.Node, string, string)
- type BlockFetcher
- func (f *BlockFetcher) Commit(ctx context.Context, height *int64) (*types.Commit, error)
- func (f *BlockFetcher) GetBlock(ctx context.Context, height *int64) (*types.Block, error)
- func (f *BlockFetcher) GetBlockByHash(ctx context.Context, hash tmbytes.HexBytes) (*types.Block, error)
- func (f *BlockFetcher) SubscribeNewBlockEvent(ctx context.Context) (<-chan *types.Block, error)
- func (f *BlockFetcher) UnsubscribeNewBlockEvent(ctx context.Context) error
- func (f *BlockFetcher) ValidatorSet(ctx context.Context, height *int64) (*types.ValidatorSet, error)
- type Client
- type Config
- type RepoLoader
- type Repository
Constants ¶
This section is empty.
Variables ¶
var ErrNotInited = errors.New("core: repository is not initialized")
ErrNotInited is used to signal when core is intended to be started without being initialized.
Functions ¶
func Init ¶
Init checks each item of the list(below) for existence in the path. If latter(item) is not existing, then it(func Init) creates them by default settings List of items: * Config * Private validator key * P2P comms private key * Stub genesis doc file
func IsInit ¶
IsInit checks whether the Core is initialized under the given 'path'. It requires Config, Private Validator Key, Private P2P Key and genesis doc.
func SaveConfig ¶
SaveConfig saves config in a file under the given 'path'.
func StartMockNode ¶
StartMockNode starts a mock Core node background process and returns it.
Types ¶
type BlockFetcher ¶
type BlockFetcher struct {
// contains filtered or unexported fields
}
func NewBlockFetcher ¶
func NewBlockFetcher(client Client) *BlockFetcher
NewBlockFetcher returns a new `BlockFetcher`.
func (*BlockFetcher) Commit ¶
Commit queries Core for a `Commit` from the block at the given height.
func (*BlockFetcher) GetBlockByHash ¶
func (*BlockFetcher) SubscribeNewBlockEvent ¶
SubscribeNewBlockEvent subscribes to new block events from Core, returning a new block event channel on success.
func (*BlockFetcher) UnsubscribeNewBlockEvent ¶
func (f *BlockFetcher) UnsubscribeNewBlockEvent(ctx context.Context) error
UnsubscribeNewBlockEvent stops the subscription to new block events from Core.
func (*BlockFetcher) ValidatorSet ¶
func (f *BlockFetcher) ValidatorSet(ctx context.Context, height *int64) (*types.ValidatorSet, error)
ValidatorSet queries Core for the ValidatorSet from the block at the given height.
type Client ¶
Client is an alias to Core Client.
func MockEmbeddedClient ¶
func MockEmbeddedClient() Client
MockEmbeddedClient returns a started mock Core Client.
func NewEmbedded ¶
NewEmbedded returns a new Client from an embedded Core node process.
func NewEmbeddedFromNode ¶
NewEmbeddedFromNode wraps a given Core node process to be able to control its lifecycle.
type Config ¶
Config is an alias for Core config. For the simplicity of future config changes, the alias should be used throughout celestia-node codebase/repo
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a modified default config of Core node.
func LoadConfig ¶
LoadConfig loads the config from the file under the given 'path'. NOTE: Unfortunately, Core(Tendermint) does not provide us with convenient function to load the Config, so we have to do our own. Furthermore, we have to make own SaveConfig, as the one the Core provides has incompatibility issues with our toml parser version.
func MockConfig ¶
MockConfig provides a testing configuration for embedded Core Client.
type Repository ¶
type Repository interface {
// Config loads a Config.
Config() (*Config, error)
// PutConfig saves given config.
PutConfig(*Config) error
}
TODO(@Wondertan):
- This should expose GenesisDoc and others. We can add them ad-hoc.
- Ideally, add private keys to Keystore to unify access pattern.
func NewMemRepository ¶
func NewMemRepository() Repository
NewMemRepository creates in memory implementation of Repository
func Open ¶
func Open(path string) (Repository, error)
Open instantiates FileSystem(FS) Repository from a given 'path'.