Documentation
¶
Index ¶
- Variables
- func CreateKvStore(retainBlocks int64) *kvstore.Application
- func Init(path string) (err error)
- func IsInit(path string) bool
- func SaveConfig(path string, cfg *Config) error
- func StartMockNode(app types.Application) *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) GetBlockInfo(ctx context.Context, height *int64) (*types.Commit, *types.ValidatorSet, 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 Store
Constants ¶
This section is empty.
Variables ¶
var ErrNotInited = errors.New("core: store is not initialized")
ErrNotInited is used to signal when core is intended to be started without being initialized.
Functions ¶
func CreateKvStore ¶ added in v0.2.0
func CreateKvStore(retainBlocks int64) *kvstore.Application
CreateKvStore creates a simple kv store app and gives the user ability to set desired amount of blocks to be retained.
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 ¶
func StartMockNode(app types.Application) *node.Node
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) GetBlockInfo ¶ added in v0.2.0
func (f *BlockFetcher) GetBlockInfo(ctx context.Context, height *int64) (*types.Commit, *types.ValidatorSet, error)
GetBlockInfo queries Core for additional block information, like Commit and ValidatorSet.
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 EphemeralMockEmbeddedClient ¶ added in v0.2.0
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 Store ¶ added in v0.2.0
type Store 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 NewMemStore ¶ added in v0.2.0
func NewMemStore() Store
NewMemStore creates in memory implementation of Store