Documentation ¶
Index ¶
- Constants
- Variables
- func DebugForceAllowUnroutableAddresses()
- func GetRegistrationSigner(logger *logging.Logger, dataDir string, identity *identity.Identity) (signature.PublicKey, signature.Signer, error)
- func SetForcedDeregister(store *persistent.ServiceStore, deregister bool) error
- type Delegate
- type RegisterNodeCallback
- type RegisterNodeHook
- type RoleProvider
- type Worker
- func (w *Worker) Cleanup()
- func (w *Worker) GetRegistrationStatus(ctx context.Context) (*control.RegistrationStatus, error)
- func (w *Worker) InitialRegistrationCh() chan struct{}
- func (w *Worker) Name() string
- func (w *Worker) NewRoleProvider(role node.RolesMask) (RoleProvider, error)
- func (w *Worker) NewRuntimeRoleProvider(role node.RolesMask, runtimeID common.Namespace) (RoleProvider, error)
- func (w *Worker) Quit() <-chan struct{}
- func (w *Worker) RequestDeregistration() error
- func (w *Worker) Start() error
- func (w *Worker) Stop()
- func (w *Worker) WillNeverRegister() bool
Constants ¶
const ( // DBBucketName is the name of the database bucket for the registration // worker's service store. DBBucketName = "worker/registration" // CfgRegistrationEntity configures the registration worker entity. CfgRegistrationEntity = "worker.registration.entity" // CfgRegistrationForceRegister overrides a previously saved deregistration // request. // // Note: This flag is deprecated and `oasis-node control clear-deregister` // should be used instead. CfgRegistrationForceRegister = "worker.registration.force_register" // CfgRegistrationRotateCerts sets the number of epochs that a node's TLS // certificate should be valid for. CfgRegistrationRotateCerts = "worker.registration.rotate_certs" )
Variables ¶
var ( // Flags has the configuration flags. Flags = flag.NewFlagSet("", flag.ContinueOnError) )
Functions ¶
func DebugForceAllowUnroutableAddresses ¶
func DebugForceAllowUnroutableAddresses()
DebugForceAllowUnroutableAddresses allows unroutable addresses.
func GetRegistrationSigner ¶
func GetRegistrationSigner(logger *logging.Logger, dataDir string, identity *identity.Identity) (signature.PublicKey, signature.Signer, error)
GetRegistrationSigner loads the signing credentials as configured by this package's flags.
func SetForcedDeregister ¶ added in v0.2200.3
func SetForcedDeregister(store *persistent.ServiceStore, deregister bool) error
Types ¶
type Delegate ¶
type Delegate interface {
// RegistrationStopped is called by the worker when the registration loop exits cleanly.
RegistrationStopped()
}
Delegate is the interface for objects that wish to know about the worker's events.
type RegisterNodeCallback ¶
RegisterNodeCallback is a function that is called after a successful registration.
type RegisterNodeHook ¶
RegisterNodeHook is a function that is used to update the node descriptor.
type RoleProvider ¶
type RoleProvider interface { // IsAvailable returns true if the role provider is available. IsAvailable() bool // SetAvailable signals that the role provider is available and that node registration can // thus proceed. SetAvailable(hook RegisterNodeHook) // SetAvailableWithCallback signals that the role provider is available and that node // registration can thus proceed. // // If the passed cb is non-nil, it will be called once after the next successful registration // that includes the node descriptor updated by the passed hook. SetAvailableWithCallback(hook RegisterNodeHook, cb RegisterNodeCallback) // should be blocked until the role provider becomes available. SetUnavailable() }
RoleProvider is the node descriptor role provider interface.
It is used to reserve a slot in the node descriptor that will be filled when the role provider decides that it is available. This is used so that the registration worker knows when certain roles are ready to be serviced by the node.
An unavailable role provider will prevent the node from being (re-)registered.
type Worker ¶
Worker is a service handling worker node registration.
func New ¶
func New( dataDir string, beacon beacon.Backend, registry registry.Backend, identity *identity.Identity, consensus consensus.Backend, p2p p2p.Service, workerCommonCfg *workerCommon.Config, store *persistent.CommonStore, delegate Delegate, runtimeRegistry runtimeRegistry.Registry, ) (*Worker, error)
New constructs a new worker node registration service.
func (*Worker) Cleanup ¶
func (w *Worker) Cleanup()
Cleanup performs the service specific post-termination cleanup.
func (*Worker) GetRegistrationStatus ¶
GetRegistrationStatus returns the node's current registration status.
func (*Worker) InitialRegistrationCh ¶
func (w *Worker) InitialRegistrationCh() chan struct{}
InitialRegistrationCh returns the initial registration channel.
func (*Worker) NewRoleProvider ¶
func (w *Worker) NewRoleProvider(role node.RolesMask) (RoleProvider, error)
NewRoleProvider creates a new role provider slot.
Each part of the code that wishes to contribute something to the node descriptor can use this method to ask the registration worker to create a slot. The slot can (later) be toggled to be either available or unavailable. An unavailable slot will prevent the node registration from taking place.
The returned role provider is in unavailable state.
func (*Worker) NewRuntimeRoleProvider ¶
func (w *Worker) NewRuntimeRoleProvider(role node.RolesMask, runtimeID common.Namespace) (RoleProvider, error)
NewRuntimeRoleProvider creates a new runtime role provider slot.
Each part of the code that wishes to contribute something to the node descriptor can use this method to ask the registration worker to create a slot. The slot can (later) be toggled to be either available or unavailable. An unavailable slot will prevent the node registration from taking place.
The returned role provider is in unavailable state.
func (*Worker) Quit ¶
func (w *Worker) Quit() <-chan struct{}
Quit returns a channel that will be closed when the service terminates.
func (*Worker) RequestDeregistration ¶
RequestDeregistration requests that the node not register itself in the next epoch.
func (*Worker) WillNeverRegister ¶ added in v0.2200.1
WillNeverRegister returns true iff the worker will never register.