2023-05-18 14:19:41 +00:00
|
|
|
package writecache
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
|
|
|
|
)
|
|
|
|
|
2023-05-19 08:17:19 +00:00
|
|
|
type StorageType string
|
|
|
|
|
|
|
|
func (t StorageType) String() string {
|
|
|
|
return string(t)
|
|
|
|
}
|
2023-05-18 14:19:41 +00:00
|
|
|
|
|
|
|
const (
|
2023-05-19 08:17:19 +00:00
|
|
|
StorageTypeUndefined StorageType = "null"
|
|
|
|
StorageTypeDB StorageType = "db"
|
|
|
|
StorageTypeFSTree StorageType = "fstree"
|
2023-05-18 14:19:41 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Metrics interface {
|
2024-02-13 06:09:47 +00:00
|
|
|
SetShardID(string)
|
2023-05-19 08:17:19 +00:00
|
|
|
Get(d time.Duration, success bool, st StorageType)
|
|
|
|
Delete(d time.Duration, success bool, st StorageType)
|
|
|
|
Put(d time.Duration, success bool, st StorageType)
|
|
|
|
Flush(success bool, st StorageType)
|
|
|
|
Evict(st StorageType)
|
2023-05-18 14:19:41 +00:00
|
|
|
|
2024-09-11 06:55:08 +00:00
|
|
|
SetEstimateSize(uint64)
|
2024-06-04 13:28:47 +00:00
|
|
|
SetMode(m mode.ComponentMode)
|
2024-09-11 06:55:08 +00:00
|
|
|
SetActualCounters(uint64)
|
2024-04-27 12:49:07 +00:00
|
|
|
SetPath(path string)
|
2023-06-13 12:14:28 +00:00
|
|
|
Close()
|
2023-05-18 14:19:41 +00:00
|
|
|
}
|
|
|
|
|
2023-06-22 11:55:30 +00:00
|
|
|
func DefaultMetrics() Metrics { return metricsStub{} }
|
|
|
|
|
2023-05-18 14:19:41 +00:00
|
|
|
type metricsStub struct{}
|
|
|
|
|
2024-02-13 06:09:47 +00:00
|
|
|
func (metricsStub) SetShardID(string) {}
|
|
|
|
|
2024-04-27 12:49:07 +00:00
|
|
|
func (metricsStub) SetPath(string) {}
|
|
|
|
|
2023-06-22 11:55:30 +00:00
|
|
|
func (metricsStub) Get(time.Duration, bool, StorageType) {}
|
2023-05-18 14:19:41 +00:00
|
|
|
|
2023-06-22 11:55:30 +00:00
|
|
|
func (metricsStub) Delete(time.Duration, bool, StorageType) {}
|
2023-05-18 14:19:41 +00:00
|
|
|
|
2023-06-22 11:55:30 +00:00
|
|
|
func (metricsStub) Put(time.Duration, bool, StorageType) {}
|
2023-05-18 14:19:41 +00:00
|
|
|
|
2024-09-11 06:55:08 +00:00
|
|
|
func (metricsStub) SetEstimateSize(uint64) {}
|
2023-05-18 14:19:41 +00:00
|
|
|
|
2024-06-04 13:28:47 +00:00
|
|
|
func (metricsStub) SetMode(mode.ComponentMode) {}
|
2023-05-18 14:19:41 +00:00
|
|
|
|
2024-09-11 06:55:08 +00:00
|
|
|
func (metricsStub) SetActualCounters(uint64) {}
|
2023-05-19 08:17:19 +00:00
|
|
|
|
2023-06-22 11:55:30 +00:00
|
|
|
func (metricsStub) Flush(bool, StorageType) {}
|
2023-05-18 14:19:41 +00:00
|
|
|
|
2023-06-22 11:55:30 +00:00
|
|
|
func (metricsStub) Evict(StorageType) {}
|
2023-06-13 12:14:28 +00:00
|
|
|
|
2023-06-22 11:55:30 +00:00
|
|
|
func (metricsStub) Close() {}
|