Documentation ¶
Index ¶
Constants ¶
const LifecycleTimeout = 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") )
Functions ¶
func Init ¶
Init initializes the Node FileSystem Store for the given Node Type 'tp' in the directory under 'path' with default Config. Options are applied over default Config and persisted on disk.
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'.
Types ¶
type Config ¶
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 { Type Type Host core.Host PubSub *pubsub.PubSub Datastore datastore.Batching ConnGater connmgr.ConnectionGater Routing routing.PeerRouting DataExchange exchange.Interface DAG format.DAGService Wordle *wordle.Service // contains filtered or unexported fields }
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. '~/.wordle'.