2024-10-03 07:19:26 +00:00
|
|
|
package shard
|
|
|
|
|
|
|
|
import "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
|
|
|
|
|
|
|
|
// MetricsWriter is an interface that must store shard's metrics.
|
|
|
|
type MetricsWriter interface {
|
|
|
|
// SetObjectCounter must set object counter taking into account object type.
|
|
|
|
SetObjectCounter(objectType string, v uint64)
|
|
|
|
// AddToObjectCounter must update object counter taking into account object
|
|
|
|
// type.
|
|
|
|
// Negative parameter must decrease the counter.
|
|
|
|
AddToObjectCounter(objectType string, delta int)
|
|
|
|
// AddToContainerSize must add a value to the container size.
|
|
|
|
// Value can be negative.
|
|
|
|
AddToContainerSize(cnr string, value int64)
|
|
|
|
// AddToPayloadSize must add a value to the payload size.
|
|
|
|
// Value can be negative.
|
|
|
|
AddToPayloadSize(value int64)
|
|
|
|
// IncObjectCounter must increment shard's object counter taking into account
|
|
|
|
// object type.
|
|
|
|
IncObjectCounter(objectType string)
|
|
|
|
// SetShardID must set (update) the shard identifier that will be used in
|
|
|
|
// metrics.
|
|
|
|
SetShardID(id string)
|
2024-10-14 15:05:55 +00:00
|
|
|
// SetMode set mode of shard.
|
2024-10-03 07:19:26 +00:00
|
|
|
SetMode(mode mode.Mode)
|
|
|
|
// SetContainerObjectsCount sets container object count.
|
|
|
|
SetContainerObjectsCount(cnrID string, objectType string, value uint64)
|
|
|
|
// IncContainerObjectsCount increments container object count.
|
|
|
|
IncContainerObjectsCount(cnrID string, objectType string)
|
|
|
|
// SubContainerObjectsCount subtracts container object count.
|
|
|
|
SubContainerObjectsCount(cnrID string, objectType string, value uint64)
|
|
|
|
// IncRefillObjectsCount increments refill objects count.
|
|
|
|
IncRefillObjectsCount(path string, size int, success bool)
|
|
|
|
// SetRefillPercent sets refill percent.
|
|
|
|
SetRefillPercent(path string, percent uint32)
|
|
|
|
// SetRefillStatus sets refill status.
|
|
|
|
SetRefillStatus(path string, status string)
|
|
|
|
// SetEvacuationInProgress sets evacuation status
|
|
|
|
SetEvacuationInProgress(value bool)
|
|
|
|
}
|
2024-10-03 07:23:59 +00:00
|
|
|
|
|
|
|
type noopMetrics struct{}
|
|
|
|
|
|
|
|
var _ MetricsWriter = noopMetrics{}
|
|
|
|
|
|
|
|
func (noopMetrics) SetObjectCounter(string, uint64) {}
|
|
|
|
func (noopMetrics) AddToObjectCounter(string, int) {}
|
|
|
|
func (noopMetrics) AddToContainerSize(string, int64) {}
|
|
|
|
func (noopMetrics) AddToPayloadSize(int64) {}
|
|
|
|
func (noopMetrics) IncObjectCounter(string) {}
|
|
|
|
func (noopMetrics) SetShardID(string) {}
|
|
|
|
func (noopMetrics) SetMode(mode.Mode) {}
|
|
|
|
func (noopMetrics) SetContainerObjectsCount(string, string, uint64) {}
|
|
|
|
func (noopMetrics) IncContainerObjectsCount(string, string) {}
|
|
|
|
func (noopMetrics) SubContainerObjectsCount(string, string, uint64) {}
|
|
|
|
func (noopMetrics) IncRefillObjectsCount(string, int, bool) {}
|
|
|
|
func (noopMetrics) SetRefillPercent(string, uint32) {}
|
|
|
|
func (noopMetrics) SetRefillStatus(string, string) {}
|
|
|
|
func (noopMetrics) SetEvacuationInProgress(bool) {}
|