Documentation
¶
Index ¶
- type MetricsCollector
- type Network
- type Option
- func WithBoostMultiplier(m uint32) Option
- func WithHeadTimeout(v time.Duration) Option
- func WithLocalStorage(v *engine.StorageEngine) Option
- func WithLogger(v *zap.Logger) Option
- func WithMetrics(v MetricsCollector) Option
- func WithNetwork(n Network) Option
- func WithObjectBatchSize(s uint32) Option
- func WithRemoteHeader(v *headsvc.RemoteHeader) Option
- func WithReplicationCooldown(d time.Duration) Option
- func WithReplicator(v *replicator.Replicator) Option
- type Policer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricsCollector ¶ added in v0.51.1
type MetricsCollector interface {
// SetPolicerConsistency must update [Policer] consistency metric
// based on background check progress. `true` is for the consistent
// state, `false` for the opposite one.
SetPolicerConsistency(bool)
// SetPolicerOptimalPlacement must update [Policer] optimal placement
// metric based on background check progress. `true` is for the
// optimal placement, `false` for the opposite one.
SetPolicerOptimalPlacement(bool)
// IncPolicerCycleCount increments number of completed policer cycles.
IncPolicerCycleCount()
// IncPolicerObjectProcessed increments processed objects counter.
IncPolicerObjectProcessed(isEC bool)
// IncPolicerObjectReplicated increments replicated objects counter.
IncPolicerObjectReplicated(isEC bool)
// IncPolicerObjectDeleted increments deleted objects counter.
IncPolicerObjectDeleted(isEC bool)
}
MetricsCollector describes Policer's state metrics collector.
type Network ¶ added in v0.36.0
type Network interface {
// IsLocalNodeInNetmap checks whether the local node belongs to the current
// network map. If it is impossible to check this fact, IsLocalNodeInNetmap
// returns false.
IsLocalNodeInNetmap() bool
// GetNodesForObject returns descriptors of storage nodes matching storage
// policy of the referenced object for now. Nodes are identified by their public
// keys and can be repeated in different lists. First len(repRules) lists relate
// to replication, the rest len(ecRules) - to EC.
//
// repRules specifies replication rules: the number (N) of primary object
// holders for each list (L) so:
// - size of each L >= N;
// - first N nodes of each L are primary data holders while others (if any)
// are backup.
//
// ecRules specifies erasure coding rules for all objects in the container: each
// object is split into [iec.Rule.DataPartNum] data and [iec.Rule.ParityPartNum]
// parity parts. Each i-th part most expected to be located on SN described by
// i-th list element. In general, list len is a multiple of CBF, and the part is
// expected on N with index M*i, M in [0,CBF). Then part is expected on SN
// for i+1-th part and so on.
//
// GetNodesForObject callers do not change resulting slices and their elements.
//
// Returns [apistatus.ErrContainerNotFound] if requested container is missing in
// the network.
GetNodesForObject(oid.Address) (nodeLists [][]netmapsdk.NodeInfo, repRules []uint, ecRules []iec.Rule, err error)
// IsLocalNodePublicKey checks whether given binary-encoded public key is
// assigned in the network map to a local storage node running [Policer].
IsLocalNodePublicKey([]byte) bool
}
Network provides information about the NeoFS network to Policer for work.
type Option ¶
type Option func(*cfg)
Option is an option for Policer constructor.
func WithBoostMultiplier ¶ added in v0.52.0
WithBoostMultiplier returns option to set the boost multiplier for the object batch size. When the policer detects and recovers missing replicas, it will multiply the batch size by this value for the next cycle to speed up recovery.
func WithHeadTimeout ¶
WithHeadTimeout returns option to set Head timeout of Policer.
func WithLocalStorage ¶
func WithLocalStorage(v *engine.StorageEngine) Option
WithLocalStorage returns option to set local object storage of Policer.
func WithLogger ¶
WithLogger returns option to set Logger of Policer.
func WithMetrics ¶ added in v0.51.1
func WithMetrics(v MetricsCollector) Option
WithMetrics returns option to set metrics of Policer.
func WithNetwork ¶ added in v0.36.0
WithNetwork provides Network component.
func WithObjectBatchSize ¶ added in v0.39.0
WithObjectBatchSize returns option to set maximum objects read from the Storage at once.
func WithRemoteHeader ¶
func WithRemoteHeader(v *headsvc.RemoteHeader) Option
WithRemoteHeader returns option to set object header receiver of Policer.
func WithReplicationCooldown ¶ added in v0.39.0
WithReplicationCooldown returns option to set replication cooldown: the Policer will not submit more than one task per a provided time duration.
func WithReplicator ¶
func WithReplicator(v *replicator.Replicator) Option
WithReplicator returns option to set object replicator of Policer.
type Policer ¶
type Policer struct {
// contains filtered or unexported fields
}
Policer represents the utility that verifies compliance with the object storage policy.
func New ¶
func New(signer neofscrypto.Signer, opts ...Option) *Policer
New creates, initializes and returns Policer instance.
func (*Policer) Reload ¶ added in v0.39.0
Reload allows runtime reconfiguration for the following parameters: - WithHeadTimeout; - [WithObjectCacheTime]; - WithReplicationCooldown; - WithObjectBatchSize; - [WithObjectCacheSize]; - WithBoostMultiplier.