control

package
v0.0.0-...-79ba347 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignMessage

func SignMessage(key *ecdsa.PrivateKey, msg SignedMessage) error

SignMessage signs Control service message with private key.

Types

type HealthChecker

type HealthChecker interface {
	// Must calculate and return current status of the node in FrostFS network map.
	//
	// If status can not be calculated for any reason,
	// control.netmapStatus_STATUS_UNDEFINED should be returned.
	NetmapStatus() control.NetmapStatus

	// Must calculate and return current health status of the node 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 NodeState

type NodeState interface {
	// SetNetmapStatus switches the storage node to the given network status.
	//
	// If status is control.NetmapStatus_MAINTENANCE and maintenance is allowed
	// in the network settings, the node additionally starts local maintenance.
	SetNetmapStatus(st control.NetmapStatus) error

	// ForceMaintenance works like SetNetmapStatus(control.NetmapStatus_MAINTENANCE)
	// but starts local maintenance regardless of the network settings.
	ForceMaintenance() error
}

NodeState is an interface of storage node network state.

type Option

type Option func(*cfg)

Option of the Server's constructor.

func WithAuthorizedKeys

func WithAuthorizedKeys(keys [][]byte) Option

WithAuthorizedKeys returns option to add list of public keys that have rights to use Control service.

func WithContainerSource

func WithContainerSource(cnrSrc container.Source) Option

WithContainerSource returns option to set container storage.

func WithHealthChecker

func WithHealthChecker(hc HealthChecker) Option

WithHealthChecker returns option to set component to calculate node health status.

func WithKey

func WithKey(key *ecdsa.PrivateKey) Option

WithKey returns option to set private key used for signing responses.

func WithLocalStorage

func WithLocalStorage(engine *engine.StorageEngine) Option

WithLocalStorage returns option to set local storage engine that contains information about shards.

func WithNetMapSource

func WithNetMapSource(netMapSrc netmap.Source) Option

WithNetMapSource returns option to set network map storage.

func WithNodeState

func WithNodeState(state NodeState) Option

WithNodeState returns option to set node network state component.

func WithReplicator

func WithReplicator(r *replicator.Replicator) Option

WithReplicator returns option to set network map storage.

func WithTreeService

func WithTreeService(s TreeService) Option

WithTreeService returns an option to set tree service.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is an entity that serves Control service on storage node.

func New

func New(opts ...Option) *Server

New creates, initializes and returns new Server instance.

func (*Server) DropObjects

DropObjects marks objects to be removed from the local node.

Objects are marked via garbage collector's callback.

If some address is not a valid object address in a binary format, an error returns. If request is unsigned or signed by disallowed key, permission error returns.

func (*Server) DumpShard

func (*Server) FlushCache

func (*Server) HealthCheck

HealthCheck returns health status of the local node.

If request is unsigned or signed by disallowed key, permission error returns.

func (*Server) ListShards

func (*Server) RestoreShard

func (*Server) SetNetmapStatus

SetNetmapStatus sets node status in FrostFS network.

If request is unsigned or signed by disallowed key, permission error returns.

func (*Server) SetShardMode

type SignedMessage

type SignedMessage interface {
	ReadSignedData([]byte) ([]byte, error)
	GetSignature() *control.Signature
	SetSignature(*control.Signature)
}

SignedMessage is an interface of Control service message.

type TreeService

type TreeService interface {
	Synchronize(ctx context.Context, cnr cid.ID, treeID string) error
}

TreeService represents a tree service instance.

Jump to

Keyboard shortcuts

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