insapp

package
v0.0.0-...-05bc493 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
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

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 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 LoggerInitFunc = func(ctx context.Context, cfg configuration.Log, nodeRef, nodeRole string) context.Context

type MultiController

type MultiController interface {
	AppStop(string) (bool, error)
	AppStopGraceful(string) (bool, error)
	AppStart(string) (bool, error)
}

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)

func (*PulseManager) Start

func (m *PulseManager) Start(context.Context) error

func (*PulseManager) Stop

func (m *PulseManager) Stop(context.Context) error

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) Serve

func (s *Server) Serve()

func (*Server) Stop

func (s *Server) Stop()

func (*Server) WaitStarted

func (s *Server) WaitStarted()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL