[#602] node: Fix blobovnicza typos

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-08-18 11:14:10 +03:00
parent 10e63537b2
commit c4e1d8eb07
10 changed files with 58 additions and 58 deletions

View file

@ -14,7 +14,7 @@ import (
// Open opens an internal database at the configured path with the configured permissions. // Open opens an internal database at the configured path with the configured permissions.
// //
// If the database file does not exist, it will be created automatically. // If the database file does not exist, it will be created automatically.
// If blobovnizca is already open, does nothing. // If blobovnicza is already open, does nothing.
func (b *Blobovnicza) Open() error { func (b *Blobovnicza) Open() error {
b.controlMtx.Lock() b.controlMtx.Lock()
defer b.controlMtx.Unlock() defer b.controlMtx.Unlock()
@ -45,7 +45,7 @@ func (b *Blobovnicza) Open() error {
b.boltDB, err = bbolt.Open(b.path, b.perm, b.boltOptions) b.boltDB, err = bbolt.Open(b.path, b.perm, b.boltOptions)
if err == nil { if err == nil {
b.opened = true b.opened = true
b.metrics.IncOpenBlobovnizcaCount() b.metrics.IncOpenBlobovniczaCount()
} }
return err return err
@ -54,13 +54,13 @@ func (b *Blobovnicza) Open() error {
// Init initializes internal database structure. // Init initializes internal database structure.
// //
// If Blobovnicza is already initialized, no action is taken. // If Blobovnicza is already initialized, no action is taken.
// Blobovnizca must be open, otherwise an error will return. // Blobovnicza must be open, otherwise an error will return.
func (b *Blobovnicza) Init() error { func (b *Blobovnicza) Init() error {
b.controlMtx.Lock() b.controlMtx.Lock()
defer b.controlMtx.Unlock() defer b.controlMtx.Unlock()
if !b.opened { if !b.opened {
return errors.New("blobovnizca is not open") return errors.New("blobovnicza is not open")
} }
b.log.Debug(logs.BlobovniczaInitializing, b.log.Debug(logs.BlobovniczaInitializing,
@ -111,13 +111,13 @@ func (b *Blobovnicza) initializeSize() error {
return fmt.Errorf("can't determine DB size: %w", err) return fmt.Errorf("can't determine DB size: %w", err)
} }
b.dataSize.Store(size) b.dataSize.Store(size)
b.metrics.AddOpenBlobovnizcaSize(size) b.metrics.AddOpenBlobovniczaSize(size)
return nil return nil
} }
// Close releases all internal database resources. // Close releases all internal database resources.
// //
// If blobovnizca is already closed, does nothing. // If blobovnicza is already closed, does nothing.
func (b *Blobovnicza) Close() error { func (b *Blobovnicza) Close() error {
b.controlMtx.Lock() b.controlMtx.Lock()
defer b.controlMtx.Unlock() defer b.controlMtx.Unlock()
@ -134,8 +134,8 @@ func (b *Blobovnicza) Close() error {
return err return err
} }
b.metrics.DecOpenBlobovnizcaCount() b.metrics.DecOpenBlobovniczaCount()
b.metrics.SubOpenBlobovnizcaSize(b.dataSize.Load()) b.metrics.SubOpenBlobovniczaSize(b.dataSize.Load())
b.dataSize.Store(0) b.dataSize.Store(0)
b.opened = false b.opened = false

View file

@ -1,16 +1,16 @@
package blobovnicza package blobovnicza
type Metrics interface { type Metrics interface {
IncOpenBlobovnizcaCount() IncOpenBlobovniczaCount()
DecOpenBlobovnizcaCount() DecOpenBlobovniczaCount()
AddOpenBlobovnizcaSize(size uint64) AddOpenBlobovniczaSize(size uint64)
SubOpenBlobovnizcaSize(size uint64) SubOpenBlobovniczaSize(size uint64)
} }
type NoopMetrics struct{} type NoopMetrics struct{}
func (m *NoopMetrics) IncOpenBlobovnizcaCount() {} func (m *NoopMetrics) IncOpenBlobovniczaCount() {}
func (m *NoopMetrics) DecOpenBlobovnizcaCount() {} func (m *NoopMetrics) DecOpenBlobovniczaCount() {}
func (m *NoopMetrics) AddOpenBlobovnizcaSize(uint64) {} func (m *NoopMetrics) AddOpenBlobovniczaSize(uint64) {}
func (m *NoopMetrics) SubOpenBlobovnizcaSize(uint64) {} func (m *NoopMetrics) SubOpenBlobovniczaSize(uint64) {}

View file

@ -42,12 +42,12 @@ func upperPowerOfTwo(v uint64) uint64 {
func (b *Blobovnicza) incSize(sz uint64) { func (b *Blobovnicza) incSize(sz uint64) {
b.dataSize.Add(sz) b.dataSize.Add(sz)
b.metrics.AddOpenBlobovnizcaSize(sz) b.metrics.AddOpenBlobovniczaSize(sz)
} }
func (b *Blobovnicza) decSize(sz uint64) { func (b *Blobovnicza) decSize(sz uint64) {
b.dataSize.Add(^(sz - 1)) b.dataSize.Add(^(sz - 1))
b.metrics.SubOpenBlobovnizcaSize(sz) b.metrics.SubOpenBlobovniczaSize(sz)
} }
func (b *Blobovnicza) full() bool { func (b *Blobovnicza) full() bool {

View file

@ -89,7 +89,7 @@ var _ common.Storage = (*Blobovniczas)(nil)
var errPutFailed = errors.New("could not save the object in any blobovnicza") var errPutFailed = errors.New("could not save the object in any blobovnicza")
// NewBlobovniczaTree returns new instance of blobovnizas tree. // NewBlobovniczaTree returns new instance of blobovniczas tree.
func NewBlobovniczaTree(opts ...Option) (blz *Blobovniczas) { func NewBlobovniczaTree(opts ...Option) (blz *Blobovniczas) {
blz = new(Blobovniczas) blz = new(Blobovniczas)
initConfig(&blz.cfg) initConfig(&blz.cfg)

View file

@ -130,7 +130,7 @@ func (b *Blobovniczas) openBlobovniczaNoCache(p string) (*blobovnicza.Blobovnicz
blz := blobovnicza.New(append(b.blzOpts, blz := blobovnicza.New(append(b.blzOpts,
blobovnicza.WithReadOnly(b.readOnly), blobovnicza.WithReadOnly(b.readOnly),
blobovnicza.WithPath(path), blobovnicza.WithPath(path),
blobovnicza.WithMetrics(b.metrics.Blobovnizca()), blobovnicza.WithMetrics(b.metrics.Blobovnicza()),
)...) )...)
if err := blz.Open(); err != nil { if err := blz.Open(); err != nil {

View file

@ -7,7 +7,7 @@ import (
) )
type Metrics interface { type Metrics interface {
Blobovnizca() blobovnicza.Metrics Blobovnicza() blobovnicza.Metrics
SetParentID(parentID string) SetParentID(parentID string)
@ -33,6 +33,6 @@ func (m *noopMetrics) GetRange(time.Duration, int, bool, bool) {}
func (m *noopMetrics) Get(time.Duration, int, bool, bool) {} func (m *noopMetrics) Get(time.Duration, int, bool, bool) {}
func (m *noopMetrics) Iterate(time.Duration, bool) {} func (m *noopMetrics) Iterate(time.Duration, bool) {}
func (m *noopMetrics) Put(time.Duration, int, bool) {} func (m *noopMetrics) Put(time.Duration, int, bool) {}
func (m *noopMetrics) Blobovnizca() blobovnicza.Metrics { func (m *noopMetrics) Blobovnicza() blobovnicza.Metrics {
return &blobovnicza.NoopMetrics{} return &blobovnicza.NoopMetrics{}
} }

View file

@ -80,7 +80,7 @@ func BenchmarkPut(b *testing.B) {
}) })
} }
func TestDB_PutBlobovnicaUpdate(t *testing.T) { func TestDB_PutBlobovniczaUpdate(t *testing.T) {
db := newDB(t) db := newDB(t)
raw1 := testutil.GenerateObject() raw1 := testutil.GenerateObject()

View file

@ -22,7 +22,7 @@ type blobovniczaTreeMetrics struct {
m metrics_impl.BlobobvnizcaMetrics m metrics_impl.BlobobvnizcaMetrics
} }
func (m *blobovniczaTreeMetrics) Blobovnizca() blobovnicza.Metrics { func (m *blobovniczaTreeMetrics) Blobovnicza() blobovnicza.Metrics {
return &blobovniczaMetrics{ return &blobovniczaMetrics{
shardID: func() string { return m.shardID }, shardID: func() string { return m.shardID },
path: m.path, path: m.path,
@ -81,18 +81,18 @@ type blobovniczaMetrics struct {
path string path string
} }
func (m *blobovniczaMetrics) AddOpenBlobovnizcaSize(size uint64) { func (m *blobovniczaMetrics) AddOpenBlobovniczaSize(size uint64) {
m.m.AddOpenBlobovnizcaSize(m.shardID(), m.path, size) m.m.AddOpenBlobovniczaSize(m.shardID(), m.path, size)
} }
func (m *blobovniczaMetrics) SubOpenBlobovnizcaSize(size uint64) { func (m *blobovniczaMetrics) SubOpenBlobovniczaSize(size uint64) {
m.m.SubOpenBlobovnizcaSize(m.shardID(), m.path, size) m.m.SubOpenBlobovniczaSize(m.shardID(), m.path, size)
} }
func (m *blobovniczaMetrics) IncOpenBlobovnizcaCount() { func (m *blobovniczaMetrics) IncOpenBlobovniczaCount() {
m.m.IncOpenBlobovnizcaCount(m.shardID(), m.path) m.m.IncOpenBlobovniczaCount(m.shardID(), m.path)
} }
func (m *blobovniczaMetrics) DecOpenBlobovnizcaCount() { func (m *blobovniczaMetrics) DecOpenBlobovniczaCount() {
m.m.DecOpenBlobovnizcaCount(m.shardID(), m.path) m.m.DecOpenBlobovniczaCount(m.shardID(), m.path)
} }

View file

@ -15,14 +15,14 @@ type BlobobvnizcaMetrics interface {
AddBlobobvnizcaTreePut(shardID, path string, size int) AddBlobobvnizcaTreePut(shardID, path string, size int)
AddBlobobvnizcaTreeGet(shardID, path string, size int) AddBlobobvnizcaTreeGet(shardID, path string, size int)
AddOpenBlobovnizcaSize(shardID, path string, size uint64) AddOpenBlobovniczaSize(shardID, path string, size uint64)
SubOpenBlobovnizcaSize(shardID, path string, size uint64) SubOpenBlobovniczaSize(shardID, path string, size uint64)
IncOpenBlobovnizcaCount(shardID, path string) IncOpenBlobovniczaCount(shardID, path string)
DecOpenBlobovnizcaCount(shardID, path string) DecOpenBlobovniczaCount(shardID, path string)
} }
type blobovnizca struct { type blobovnicza struct {
treeMode *shardIDPathModeValue treeMode *shardIDPathModeValue
treeReqDuration *prometheus.HistogramVec treeReqDuration *prometheus.HistogramVec
treePut *prometheus.CounterVec treePut *prometheus.CounterVec
@ -31,48 +31,48 @@ type blobovnizca struct {
treeOpenCounter *prometheus.GaugeVec treeOpenCounter *prometheus.GaugeVec
} }
func newBlobovnizca() *blobovnizca { func newBlobovnicza() *blobovnicza {
return &blobovnizca{ return &blobovnicza{
treeMode: newShardIDPathMode(blobovniczaTreeSubSystem, "mode", "Blobovnizca tree mode"), treeMode: newShardIDPathMode(blobovniczaTreeSubSystem, "mode", "Blobovnicza tree mode"),
treeReqDuration: metrics.NewHistogramVec(prometheus.HistogramOpts{ treeReqDuration: metrics.NewHistogramVec(prometheus.HistogramOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: blobovniczaTreeSubSystem, Subsystem: blobovniczaTreeSubSystem,
Name: "request_duration_seconds", Name: "request_duration_seconds",
Help: "Accumulated Blobovnizca tree request process duration", Help: "Accumulated Blobovnicza tree request process duration",
}, []string{shardIDLabel, pathLabel, successLabel, methodLabel, withStorageIDLabel}), }, []string{shardIDLabel, pathLabel, successLabel, methodLabel, withStorageIDLabel}),
treePut: metrics.NewCounterVec(prometheus.CounterOpts{ treePut: metrics.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: blobovniczaTreeSubSystem, Subsystem: blobovniczaTreeSubSystem,
Name: "put_bytes", Name: "put_bytes",
Help: "Accumulated payload size written to Blobovnizca tree", Help: "Accumulated payload size written to Blobovnicza tree",
}, []string{shardIDLabel, pathLabel}), }, []string{shardIDLabel, pathLabel}),
treeGet: metrics.NewCounterVec(prometheus.CounterOpts{ treeGet: metrics.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: blobovniczaTreeSubSystem, Subsystem: blobovniczaTreeSubSystem,
Name: "get_bytes", Name: "get_bytes",
Help: "Accumulated payload size read from Blobovnizca tree", Help: "Accumulated payload size read from Blobovnicza tree",
}, []string{shardIDLabel, pathLabel}), }, []string{shardIDLabel, pathLabel}),
treeOpenSize: metrics.NewGaugeVec(prometheus.GaugeOpts{ treeOpenSize: metrics.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: blobovniczaTreeSubSystem, Subsystem: blobovniczaTreeSubSystem,
Name: "open_blobovnizca_size_bytes", Name: "open_blobovnicza_size_bytes",
Help: "Size of opened blobovnizcas of Blobovnizca tree", Help: "Size of opened blobovniczas of Blobovnicza tree",
}, []string{shardIDLabel, pathLabel}), }, []string{shardIDLabel, pathLabel}),
treeOpenCounter: metrics.NewGaugeVec(prometheus.GaugeOpts{ treeOpenCounter: metrics.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: blobovniczaTreeSubSystem, Subsystem: blobovniczaTreeSubSystem,
Name: "open_blobovnizca_count", Name: "open_blobovnicza_count",
Help: "Count of opened blobovnizcas of Blobovnizca tree", Help: "Count of opened blobovniczas of Blobovnicza tree",
}, []string{shardIDLabel, pathLabel}), }, []string{shardIDLabel, pathLabel}),
} }
} }
func (b *blobovnizca) SetBlobobvnizcaTreeMode(shardID, path string, readOnly bool) { func (b *blobovnicza) SetBlobobvnizcaTreeMode(shardID, path string, readOnly bool) {
b.treeMode.SetMode(shardID, path, modeFromBool(readOnly)) b.treeMode.SetMode(shardID, path, modeFromBool(readOnly))
} }
func (b *blobovnizca) CloseBlobobvnizcaTree(shardID, path string) { func (b *blobovnicza) CloseBlobobvnizcaTree(shardID, path string) {
b.treeMode.SetMode(shardID, path, closedMode) b.treeMode.SetMode(shardID, path, closedMode)
b.treeReqDuration.DeletePartialMatch(prometheus.Labels{ b.treeReqDuration.DeletePartialMatch(prometheus.Labels{
shardIDLabel: shardID, shardIDLabel: shardID,
@ -88,7 +88,7 @@ func (b *blobovnizca) CloseBlobobvnizcaTree(shardID, path string) {
}) })
} }
func (b *blobovnizca) BlobobvnizcaTreeMethodDuration(shardID, path string, method string, d time.Duration, success bool, withStorageID NullBool) { func (b *blobovnicza) BlobobvnizcaTreeMethodDuration(shardID, path string, method string, d time.Duration, success bool, withStorageID NullBool) {
b.treeReqDuration.With(prometheus.Labels{ b.treeReqDuration.With(prometheus.Labels{
shardIDLabel: shardID, shardIDLabel: shardID,
pathLabel: path, pathLabel: path,
@ -98,42 +98,42 @@ func (b *blobovnizca) BlobobvnizcaTreeMethodDuration(shardID, path string, metho
}).Observe(d.Seconds()) }).Observe(d.Seconds())
} }
func (b *blobovnizca) AddBlobobvnizcaTreePut(shardID, path string, size int) { func (b *blobovnicza) AddBlobobvnizcaTreePut(shardID, path string, size int) {
b.treePut.With(prometheus.Labels{ b.treePut.With(prometheus.Labels{
shardIDLabel: shardID, shardIDLabel: shardID,
pathLabel: path, pathLabel: path,
}).Add(float64(size)) }).Add(float64(size))
} }
func (b *blobovnizca) AddBlobobvnizcaTreeGet(shardID, path string, size int) { func (b *blobovnicza) AddBlobobvnizcaTreeGet(shardID, path string, size int) {
b.treeGet.With(prometheus.Labels{ b.treeGet.With(prometheus.Labels{
shardIDLabel: shardID, shardIDLabel: shardID,
pathLabel: path, pathLabel: path,
}).Add(float64(size)) }).Add(float64(size))
} }
func (b *blobovnizca) AddOpenBlobovnizcaSize(shardID, path string, size uint64) { func (b *blobovnicza) AddOpenBlobovniczaSize(shardID, path string, size uint64) {
b.treeOpenSize.With(prometheus.Labels{ b.treeOpenSize.With(prometheus.Labels{
shardIDLabel: shardID, shardIDLabel: shardID,
pathLabel: path, pathLabel: path,
}).Add(float64(size)) }).Add(float64(size))
} }
func (b *blobovnizca) SubOpenBlobovnizcaSize(shardID, path string, size uint64) { func (b *blobovnicza) SubOpenBlobovniczaSize(shardID, path string, size uint64) {
b.treeOpenSize.With(prometheus.Labels{ b.treeOpenSize.With(prometheus.Labels{
shardIDLabel: shardID, shardIDLabel: shardID,
pathLabel: path, pathLabel: path,
}).Sub(float64(size)) }).Sub(float64(size))
} }
func (b *blobovnizca) IncOpenBlobovnizcaCount(shardID, path string) { func (b *blobovnicza) IncOpenBlobovniczaCount(shardID, path string) {
b.treeOpenCounter.With(prometheus.Labels{ b.treeOpenCounter.With(prometheus.Labels{
shardIDLabel: shardID, shardIDLabel: shardID,
pathLabel: path, pathLabel: path,
}).Inc() }).Inc()
} }
func (b *blobovnizca) DecOpenBlobovnizcaCount(shardID, path string) { func (b *blobovnicza) DecOpenBlobovniczaCount(shardID, path string) {
b.treeOpenCounter.With(prometheus.Labels{ b.treeOpenCounter.With(prometheus.Labels{
shardIDLabel: shardID, shardIDLabel: shardID,
pathLabel: path, pathLabel: path,

View file

@ -14,7 +14,7 @@ type NodeMetrics struct {
epoch prometheus.Gauge epoch prometheus.Gauge
fstree *fstreeMetrics fstree *fstreeMetrics
blobstore *blobstoreMetrics blobstore *blobstoreMetrics
blobobvnizca *blobovnizca blobobvnizca *blobovnicza
metabase *metabaseMetrics metabase *metabaseMetrics
pilorama *piloramaMetrics pilorama *piloramaMetrics
grpc *grpcServerMetrics grpc *grpcServerMetrics
@ -35,7 +35,7 @@ func NewNodeMetrics() *NodeMetrics {
}), }),
fstree: newFSTreeMetrics(), fstree: newFSTreeMetrics(),
blobstore: newBlobstoreMetrics(), blobstore: newBlobstoreMetrics(),
blobobvnizca: newBlobovnizca(), blobobvnizca: newBlobovnicza(),
metabase: newMetabaseMetrics(), metabase: newMetabaseMetrics(),
pilorama: newPiloramaMetrics(), pilorama: newPiloramaMetrics(),
grpc: newGrpcServerMetrics(), grpc: newGrpcServerMetrics(),