Documentation ¶
Index ¶
- Constants
- Variables
- func ConstructModule(tp node.Type, network p2p.Network, cfg *Config, store Store) fx.Option
- func Init(cfg Config, path string, tp node.Type) error
- func IsInit(path string) bool
- func SaveConfig(path string, cfg *Config) error
- func TestKeyringSigner(t *testing.T) *apptypes.KeyringSigner
- func WithBlackboxMetrics() fx.Option
- func WithBootstrappers(peers p2p.Bootstrappers) fx.Option
- func WithMetrics(metricOpts []otlpmetrichttp.Option, nodeType node.Type) fx.Option
- func WithNetwork(net p2p.Network) fx.Option
- type Config
- type ConfigLoader
- type Node
- func New(tp node.Type, network p2p.Network, store Store, options ...fx.Option) (*Node, error)
- func NewWithConfig(tp node.Type, network p2p.Network, store Store, cfg *Config, ...) (*Node, error)
- func TestNode(t *testing.T, tp node.Type, opts ...fx.Option) *Node
- func TestNodeWithConfig(t *testing.T, tp node.Type, cfg *Config, opts ...fx.Option) *Node
- type Store
Constants ¶
const Timeout = time.Second * 15
Variables ¶
var ( // ErrOpened is thrown on attempt to open already open/in-use Store. ErrOpened = errors.New("node: store is in use") // ErrNotInited is thrown on attempt to open Store without initialization. ErrNotInited = errors.New("node: store is not initialized") )
var PackageToAPI = map[string]interface{}{ "fraud": &fraud.API{}, "state": &state.API{}, "share": &share.API{}, "header": &header.API{}, "daser": &das.API{}, "p2p": &p2p.API{}, "node": &node.API{}, }
PackageToAPI maps a package to its API struct. Currently only used for method discovery for openrpc spec generation
Functions ¶
func ConstructModule ¶
func Init ¶
Init initializes the Node FileSystem Store for the given Node Type 'tp' in the directory under 'path'.
func IsInit ¶
IsInit checks whether FileSystem Store was setup under given 'path'. If any required file/subdirectory does not exist, then false is reported.
func SaveConfig ¶
SaveConfig saves Config 'cfg' under the given 'path'.
func TestKeyringSigner ¶
func TestKeyringSigner(t *testing.T) *apptypes.KeyringSigner
func WithBlackboxMetrics ¶
WithBlackboxMetrics enables blackbox metrics for the node. Blackbox metrics are metrics that are recorded for the node's components through a proxy that records metrics for the node's components on each method call.
func WithBootstrappers ¶
func WithBootstrappers(peers p2p.Bootstrappers) fx.Option
WithBootstrappers sets custom bootstrap peers.
func WithMetrics ¶
WithMetrics enables metrics exporting for the node.
Types ¶
type Config ¶
type Config struct { Core core.Config State state.Config P2P p2p.Config RPC rpc.Config Gateway gateway.Config Header header.Config DASer das.Config `toml:",omitempty"` }
Config is main configuration structure for a Node. It combines configuration units for all Node subsystems.
func DefaultConfig ¶
DefaultConfig provides a default Config for a given Node Type 'tp'. NOTE: Currently, configs are identical, but this will change.
func LoadConfig ¶
LoadConfig loads Config from the given 'path'.
type ConfigLoader ¶
ConfigLoader defines a function that loads a config from any source.
type Node ¶
type Node struct { fx.In `ignore-unexported:"true"` Type node.Type Network p2p.Network Bootstrappers p2p.Bootstrappers Config *Config // rpc components RPCServer *rpc.Server // not optional GatewayServer *gateway.Server `optional:"true"` // p2p components Host host.Host ConnGater *conngater.BasicConnectionGater Routing routing.PeerRouting DataExchange exchange.Interface BlockService blockservice.BlockService // p2p protocols PubSub *pubsub.PubSub // services HeaderServ header.Module // not optional StateServ state.Module // not optional FraudServ fraud.Module // not optional DASer das.Module // not optional // contains filtered or unexported fields }
Node represents the core structure of a Celestia node. It keeps references to all Celestia-specific components and services in one place and provides flexibility to run a Celestia node in different modes. Currently supported modes: * Bridge * Light * Full
func NewWithConfig ¶
func NewWithConfig(tp node.Type, network p2p.Network, store Store, cfg *Config, options ...fx.Option) (*Node, error)
NewWithConfig assembles a new Node with the given type 'tp' over Store 'store' and a custom config.
func TestNodeWithConfig ¶
func (*Node) Run ¶
Run is a Start which blocks on the given context 'ctx' until it is canceled. If canceled, the Node is still in the running state and should be gracefully stopped via Stop.
type Store ¶
type Store interface { // Path reports the FileSystem path of Store. Path() string // Keystore provides a Keystore to access keys. Keystore() (keystore.Keystore, error) // Datastore provides a Datastore - a KV store for arbitrary data to be stored on disk. Datastore() (datastore.Batching, error) // Config loads the stored Node config. Config() (*Config, error) // PutConfig alters the stored Node config. PutConfig(*Config) error // Close closes the Store freeing up acquired resources and locks. Close() error }
Store encapsulates storage for the Node. Basically, it is the Store of all Stores. It provides access for the Node data stored in root directory e.g. '~/.celestia'.
func NewMemStore ¶
func NewMemStore() Store
NewMemStore creates an in-memory Store for Node. Useful for testing.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
This file contains the definition of blackbox metrics for the header pkg under nodebuilder We adopt as a pattern the definition of a metrics.go file under nodebuidler/<pkg>/metrics.go to be the definition of the blackbox metrics only.
|
This file contains the definition of blackbox metrics for the header pkg under nodebuilder We adopt as a pattern the definition of a metrics.go file under nodebuidler/<pkg>/metrics.go to be the definition of the blackbox metrics only. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
tests
|
|