Documentation ¶
Index ¶
- Constants
- func NewMulti(cfgProvider ConfigurationProvider, appFn AppFactoryFunc, ...) (*Server, MultiController)
- type AppComponent
- type AppComponents
- type AppFactoryFunc
- type AppInitializer
- type CertManagerFactoryFunc
- type ConfigurationProvider
- type KeyStoreFactoryFunc
- type LoggerInitFunc
- type MultiController
- type MultiNodeConfigFunc
- type NetworkInitFunc
- type NetworkSupport
- type PreComponents
- type PulseManager
- func (m *PulseManager) AddDispatcher(d beat.Dispatcher)
- func (m *PulseManager) CancelNodeState()
- func (m *PulseManager) CommitFirstPulseChange(pulseChange beat.Beat) error
- func (m *PulseManager) CommitPulseChange(pulseChange beat.Beat) error
- func (m *PulseManager) RequestNodeState(stateFunc chorus.NodeStateFunc)
- func (m *PulseManager) Start(context.Context) error
- func (m *PulseManager) Stop(context.Context) error
- type Server
Constants ¶
const LocalNodeRefInjectionID = "LocalNodeRef"
Variables ¶
This section is empty.
Functions ¶
func NewMulti ¶
func NewMulti(cfgProvider ConfigurationProvider, appFn AppFactoryFunc, multiFn MultiNodeConfigFunc, extraComponents ...interface{}, ) (*Server, MultiController)
Types ¶
type AppComponent ¶
type AppComponent interface { // GetBeatDispatcher provides a handler to receive pulse beats. GetBeatDispatcher() beat.Dispatcher }
AppComponent is an interface for a component that wraps an application compartment. This component will be managed by ComponentManager.
type AppComponents ¶
type AppComponents struct { AffinityHelper affinity.Helper BeatHistory beat.History MessageSender messagesender.Service CryptoScheme crypto.PlatformScheme Certificate nodeinfo.Certificate LocalNodeRef reference.Holder LocalNodeRole member.PrimaryRole }
func (AppComponents) AddAsDependencies ¶
func (v AppComponents) AddAsDependencies(container injector.DependencyContainer)
AddAsDependencies is a convenience method to add non-nil references into a injector.DependencyContainer.
type AppFactoryFunc ¶
type AppFactoryFunc = func(context.Context, configuration.Configuration, AppComponents) (AppComponent, error)
AppFactoryFunc is a factory method to create an app component with the given configuration and dependencies.
type AppInitializer ¶
type AppInitializer struct {
// contains filtered or unexported fields
}
func (*AppInitializer) StartComponents ¶
func (s *AppInitializer) StartComponents(ctx context.Context, cfg configuration.Configuration, networkFn NetworkInitFunc, loggerFn LoggerInitFunc, ) (*component.Manager, func())
type CertManagerFactoryFunc ¶
type CertManagerFactoryFunc = func(crypto.PublicKey, cryptography.KeyProcessor, string) (*mandates.CertificateManager, error)
type ConfigurationProvider ¶
type ConfigurationProvider interface { GetDefaultConfig() configuration.Configuration GetNamedConfig(string) configuration.Configuration GetKeyStoreFactory() KeyStoreFactoryFunc GetCertManagerFactory() CertManagerFactoryFunc }
type KeyStoreFactoryFunc ¶
type KeyStoreFactoryFunc = func(string) (cryptography.KeyStore, error)
type LoggerInitFunc ¶
type MultiController ¶
type MultiNodeConfigFunc ¶
type MultiNodeConfigFunc = func(baseCfg ConfigurationProvider) ([]configuration.Configuration, NetworkInitFunc)
MultiNodeConfigFunc provides support for multi-node process initialization. For the given config path and base config this handler should return a list of configurations (one per node). And NetworkInitFunc to initialize instantiate a network support for each app compartment (one per node). A default implementation is applied when NetworkInitFunc is nil.
type NetworkInitFunc ¶
type NetworkInitFunc = func(configuration.Configuration, *component.Manager) (NetworkSupport, network.Status, error)
NetworkInitFunc should instantiate a network support for app compartment by the given configuration and root component manager. Returned NetworkSupport will be registered as a component and used to run app compartment. Returned network.Status will not be registered as a component, it can be nil, then monitoring/admin APIs will not be waitStart.
type NetworkSupport ¶
type NetworkSupport interface { beat.NodeNetwork nodeinfo.CertificateGetter CreateMessagesRouter(context.Context) messagesender.MessageRouter AddDispatcher(beat.Dispatcher) GetBeatHistory() beat.History }
NetworkSupport provides network-related functions to an app compartment
type PreComponents ¶
type PreComponents struct { CryptographyService cryptography.Service PlatformCryptographyScheme cryptography.PlatformCryptographyScheme KeyStore cryptography.KeyStore KeyProcessor cryptography.KeyProcessor CryptoScheme inscrypto.PlatformScheme CertificateManager nodeinfo.CertificateManager }
type PulseManager ¶
type PulseManager struct { PulseAppender beat.Appender `inject:""` // contains filtered or unexported fields }
func NewPulseManager ¶
func NewPulseManager() *PulseManager
func (*PulseManager) AddDispatcher ¶
func (m *PulseManager) AddDispatcher(d beat.Dispatcher)
func (*PulseManager) CancelNodeState ¶
func (m *PulseManager) CancelNodeState()
func (*PulseManager) CommitFirstPulseChange ¶
func (m *PulseManager) CommitFirstPulseChange(pulseChange beat.Beat) error
func (*PulseManager) CommitPulseChange ¶
func (m *PulseManager) CommitPulseChange(pulseChange beat.Beat) error
func (*PulseManager) RequestNodeState ¶
func (m *PulseManager) RequestNodeState(stateFunc chorus.NodeStateFunc)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfg configuration.Configuration, appFn AppFactoryFunc, extraComponents ...interface{}) *Server
New creates a one-node process.
func (*Server) GetInitializerForTest ¶
func (s *Server) GetInitializerForTest() *AppInitializer
func (*Server) WaitStarted ¶
func (s *Server) WaitStarted()