Documentation ¶
Overview ¶
Package service defines the bootstrap service implementation.
Index ¶
- Constants
- Variables
- type Config
- type Host
- type Service
- func (s *Service) AddToGRPCServer(gs *grpc.Server)
- func (s *Service) Config() interface{}
- func (s *Service) Desc() string
- func (s *Service) Expose() interface{}
- func (s *Service) ID() string
- func (s *Service) Name() string
- func (s *Service) Needs() map[string]struct{}
- func (s *Service) Plug(exposed map[string]interface{}) error
- func (s *Service) Run(ctx context.Context, running, stopping func()) error
- func (s *Service) SetConfig(config interface{}) error
- type StoreConfig
Constants ¶
View Source
const ( InMemoryStore = "in-memory" FileStore = "file" )
Types of store supported.
View Source
const (
DefaultStorePath = "data/network/proposals.json"
)
Default config values.
View Source
const (
// ServiceID used by the bootstrap service.
ServiceID = "bootstrap"
)
Variables ¶
View Source
var ( // ErrNotEnoughPeers is returned when not enough peers are connected. ErrNotEnoughPeers = errors.New("number of connected peers is under configuration threshold") // available. ErrUnavailable = errors.New("the service is not available") // ErrNotAllowed is return from gRPC methods when the command is not allowed // in the current configuration. ErrNotAllowed = errors.New("operation not allowed") )
View Source
var ( ErrNotHost = errors.New("connected service is not a host") ErrNotSwarm = errors.New("connected service is not a swarm") ErrInvalidStoreType = errors.New("invalid store type") )
Configuration errors.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Host is the name of the host service. Host string `toml:"host" comment:"The name of the host service."` // Swarm is the name of the swarm service. Swarm string `toml:"swarm" comment:"The name of the swarm service."` // Needs are services that should be started in addition to the host // before bootstrapping. Needs []string `toml:"needs" comment:"Services that should be started in addition to the host before bootstrapping."` // Addresses is a list of known peer addresses. Addresses []string `toml:"addresses" comment:"A list of known peer addresses."` // MinPeerThreshold is the number of peers under which to bootstrap // connections. MinPeerThreshold int `toml:"min_peer_threshold" comment:"The number of peers under which to bootstrap connections."` // Interval is the duration of the interval between bootstrap jobs. Interval string `toml:"interval" comment:"Interval between bootstrap jobs."` // ConnectionTimeout is the connection timeout. It should be less than // the interval. ConnectionTimeout string `toml:"connection_timeout" comment:"The connection timeout. It should be less than the interval."` // StoreConfig configures the store used for network update proposals. StoreConfig *StoreConfig `toml:"store_config" comment:"Configure the store used for network update proposals."` }
Config contains configuration options for the Bootstrap service.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the Bootstrap service.
func (*Service) AddToGRPCServer ¶
AddToGRPCServer adds the service to a gRPC server.
func (*Service) Config ¶
func (s *Service) Config() interface{}
Config returns the current service configuration or creates one with good default values.
func (*Service) Expose ¶
func (s *Service) Expose() interface{}
Expose exposes an empty struct, so that other services know it is ready.
type StoreConfig ¶
type StoreConfig struct { // Type is the type of store used. Type string `toml:"type" comment:"Type of store to use.\n Supported values: in-memory and file."` // Path to the store files (when applicable). Path string `toml:"path" comment:"Path to the store files (when applicable)."` }
StoreConfig configures the store used for network update proposals.
Directories ¶
Path | Synopsis |
---|---|
Package mockservice is a generated GoMock package.
|
Package mockservice is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.