Documentation ¶
Index ¶
- func NewAuditService(next *Server, log *logger.Logger, enabled *atomic.Bool) control.ControlServiceServer
- func SignMessage(key *ecdsa.PrivateKey, msg SignedMessage) error
- type HealthChecker
- type Option
- type Prm
- type Server
- func (s *Server) HealthCheck(_ context.Context, req *control.HealthCheckRequest) (*control.HealthCheckResponse, error)
- func (s *Server) RemoveContainer(_ context.Context, req *control.RemoveContainerRequest) (*control.RemoveContainerResponse, error)
- func (s *Server) RemoveNode(_ context.Context, req *control.RemoveNodeRequest) (*control.RemoveNodeResponse, error)
- func (s *Server) TickEpoch(_ context.Context, req *control.TickEpochRequest) (*control.TickEpochResponse, error)
- type SignedMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAuditService ¶ added in v0.42.0
func SignMessage ¶
func SignMessage(key *ecdsa.PrivateKey, msg SignedMessage) error
SignMessage signs Control service message with private key.
Types ¶
type HealthChecker ¶
type HealthChecker interface { // HealthStatus must calculate and return current health status of the IR application. // // If status can not be calculated for any reason, // control.HealthStatus_HEALTH_STATUS_UNDEFINED should be returned. HealthStatus() control.HealthStatus }
HealthChecker is component interface for calculating the current health status of a node.
type Option ¶
type Option func(*options)
Option specifies Server's optional parameter.
func WithAllowedKeys ¶
WithAllowedKeys returns option to add public keys to white list of the Control service.
type Prm ¶
type Prm struct {
// contains filtered or unexported fields
}
Prm groups required parameters of Server's constructor.
func (*Prm) SetHealthChecker ¶
func (x *Prm) SetHealthChecker(hc HealthChecker)
SetHealthChecker sets HealthChecker to calculate health status.
func (*Prm) SetPrivateKey ¶
func (x *Prm) SetPrivateKey(key keys.PrivateKey)
SetPrivateKey sets private key to sign responses.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an entity that serves Control service on IR node.
To gain access to the service, any request must be signed with a key from the white list.
func New ¶
func New(prm Prm, netmapClient *netmap.Client, containerClient *container.Client, opts ...Option) *Server
New creates a new instance of the Server.
Panics if:
- parameterized private key is nil;
- parameterized HealthChecker is nil.
Forms white list from all keys specified via WithAllowedKeys option and a public key of the parameterized private key.
func (*Server) HealthCheck ¶
func (s *Server) HealthCheck(_ context.Context, req *control.HealthCheckRequest) (*control.HealthCheckResponse, error)
HealthCheck returns health status of the local IR node.
If request is not signed with a key from white list, permission error returns.
func (*Server) RemoveContainer ¶ added in v0.37.0
func (s *Server) RemoveContainer(_ context.Context, req *control.RemoveContainerRequest) (*control.RemoveContainerResponse, error)
RemoveContainer forces a container removal.
func (*Server) RemoveNode ¶ added in v0.37.0
func (s *Server) RemoveNode(_ context.Context, req *control.RemoveNodeRequest) (*control.RemoveNodeResponse, error)
RemoveNode forces a node removal.
If request is not signed with a key from white list, permission error returns.
func (*Server) TickEpoch ¶ added in v0.37.0
func (s *Server) TickEpoch(_ context.Context, req *control.TickEpochRequest) (*control.TickEpochResponse, error)
TickEpoch forces a new epoch.
If request is not signed with a key from white list, permission error returns.