From c4e1d8eb07dc91b588cb46db0021dbf95e4db121 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 18 Aug 2023 11:14:10 +0300 Subject: [PATCH] [#602] node: Fix blobovnicza typos Signed-off-by: Dmitrii Stepanov --- .../blobovnicza/control.go | 16 +++---- .../blobovnicza/metrics.go | 16 +++---- pkg/local_object_storage/blobovnicza/sizes.go | 4 +- .../blobstor/blobovniczatree/blobovnicza.go | 2 +- .../blobstor/blobovniczatree/control.go | 2 +- .../blobstor/blobovniczatree/metrics.go | 4 +- pkg/local_object_storage/metabase/put_test.go | 2 +- .../{blobovnizca.go => blobovnicza.go} | 18 +++---- .../{blobovnizca.go => blobovnicza.go} | 48 +++++++++---------- pkg/metrics/node.go | 4 +- 10 files changed, 58 insertions(+), 58 deletions(-) rename pkg/local_object_storage/metrics/{blobovnizca.go => blobovnicza.go} (83%) rename pkg/metrics/{blobovnizca.go => blobovnicza.go} (72%) diff --git a/pkg/local_object_storage/blobovnicza/control.go b/pkg/local_object_storage/blobovnicza/control.go index 0e320496..aa6be602 100644 --- a/pkg/local_object_storage/blobovnicza/control.go +++ b/pkg/local_object_storage/blobovnicza/control.go @@ -14,7 +14,7 @@ import ( // 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 blobovnizca is already open, does nothing. +// If blobovnicza is already open, does nothing. func (b *Blobovnicza) Open() error { b.controlMtx.Lock() defer b.controlMtx.Unlock() @@ -45,7 +45,7 @@ func (b *Blobovnicza) Open() error { b.boltDB, err = bbolt.Open(b.path, b.perm, b.boltOptions) if err == nil { b.opened = true - b.metrics.IncOpenBlobovnizcaCount() + b.metrics.IncOpenBlobovniczaCount() } return err @@ -54,13 +54,13 @@ func (b *Blobovnicza) Open() error { // Init initializes internal database structure. // // 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 { b.controlMtx.Lock() defer b.controlMtx.Unlock() if !b.opened { - return errors.New("blobovnizca is not open") + return errors.New("blobovnicza is not open") } b.log.Debug(logs.BlobovniczaInitializing, @@ -111,13 +111,13 @@ func (b *Blobovnicza) initializeSize() error { return fmt.Errorf("can't determine DB size: %w", err) } b.dataSize.Store(size) - b.metrics.AddOpenBlobovnizcaSize(size) + b.metrics.AddOpenBlobovniczaSize(size) return nil } // 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 { b.controlMtx.Lock() defer b.controlMtx.Unlock() @@ -134,8 +134,8 @@ func (b *Blobovnicza) Close() error { return err } - b.metrics.DecOpenBlobovnizcaCount() - b.metrics.SubOpenBlobovnizcaSize(b.dataSize.Load()) + b.metrics.DecOpenBlobovniczaCount() + b.metrics.SubOpenBlobovniczaSize(b.dataSize.Load()) b.dataSize.Store(0) b.opened = false diff --git a/pkg/local_object_storage/blobovnicza/metrics.go b/pkg/local_object_storage/blobovnicza/metrics.go index 5f4f94cb..9ce70320 100644 --- a/pkg/local_object_storage/blobovnicza/metrics.go +++ b/pkg/local_object_storage/blobovnicza/metrics.go @@ -1,16 +1,16 @@ package blobovnicza type Metrics interface { - IncOpenBlobovnizcaCount() - DecOpenBlobovnizcaCount() + IncOpenBlobovniczaCount() + DecOpenBlobovniczaCount() - AddOpenBlobovnizcaSize(size uint64) - SubOpenBlobovnizcaSize(size uint64) + AddOpenBlobovniczaSize(size uint64) + SubOpenBlobovniczaSize(size uint64) } type NoopMetrics struct{} -func (m *NoopMetrics) IncOpenBlobovnizcaCount() {} -func (m *NoopMetrics) DecOpenBlobovnizcaCount() {} -func (m *NoopMetrics) AddOpenBlobovnizcaSize(uint64) {} -func (m *NoopMetrics) SubOpenBlobovnizcaSize(uint64) {} +func (m *NoopMetrics) IncOpenBlobovniczaCount() {} +func (m *NoopMetrics) DecOpenBlobovniczaCount() {} +func (m *NoopMetrics) AddOpenBlobovniczaSize(uint64) {} +func (m *NoopMetrics) SubOpenBlobovniczaSize(uint64) {} diff --git a/pkg/local_object_storage/blobovnicza/sizes.go b/pkg/local_object_storage/blobovnicza/sizes.go index d4ac1920..a2f558f5 100644 --- a/pkg/local_object_storage/blobovnicza/sizes.go +++ b/pkg/local_object_storage/blobovnicza/sizes.go @@ -42,12 +42,12 @@ func upperPowerOfTwo(v uint64) uint64 { func (b *Blobovnicza) incSize(sz uint64) { b.dataSize.Add(sz) - b.metrics.AddOpenBlobovnizcaSize(sz) + b.metrics.AddOpenBlobovniczaSize(sz) } func (b *Blobovnicza) decSize(sz uint64) { b.dataSize.Add(^(sz - 1)) - b.metrics.SubOpenBlobovnizcaSize(sz) + b.metrics.SubOpenBlobovniczaSize(sz) } func (b *Blobovnicza) full() bool { diff --git a/pkg/local_object_storage/blobstor/blobovniczatree/blobovnicza.go b/pkg/local_object_storage/blobstor/blobovniczatree/blobovnicza.go index a23bba42..d4fedb14 100644 --- a/pkg/local_object_storage/blobstor/blobovniczatree/blobovnicza.go +++ b/pkg/local_object_storage/blobstor/blobovniczatree/blobovnicza.go @@ -89,7 +89,7 @@ var _ common.Storage = (*Blobovniczas)(nil) 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) { blz = new(Blobovniczas) initConfig(&blz.cfg) diff --git a/pkg/local_object_storage/blobstor/blobovniczatree/control.go b/pkg/local_object_storage/blobstor/blobovniczatree/control.go index 3a06310f..d7b0799c 100644 --- a/pkg/local_object_storage/blobstor/blobovniczatree/control.go +++ b/pkg/local_object_storage/blobstor/blobovniczatree/control.go @@ -130,7 +130,7 @@ func (b *Blobovniczas) openBlobovniczaNoCache(p string) (*blobovnicza.Blobovnicz blz := blobovnicza.New(append(b.blzOpts, blobovnicza.WithReadOnly(b.readOnly), blobovnicza.WithPath(path), - blobovnicza.WithMetrics(b.metrics.Blobovnizca()), + blobovnicza.WithMetrics(b.metrics.Blobovnicza()), )...) if err := blz.Open(); err != nil { diff --git a/pkg/local_object_storage/blobstor/blobovniczatree/metrics.go b/pkg/local_object_storage/blobstor/blobovniczatree/metrics.go index 6c9b600c..032d8cf7 100644 --- a/pkg/local_object_storage/blobstor/blobovniczatree/metrics.go +++ b/pkg/local_object_storage/blobstor/blobovniczatree/metrics.go @@ -7,7 +7,7 @@ import ( ) type Metrics interface { - Blobovnizca() blobovnicza.Metrics + Blobovnicza() blobovnicza.Metrics 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) Iterate(time.Duration, bool) {} func (m *noopMetrics) Put(time.Duration, int, bool) {} -func (m *noopMetrics) Blobovnizca() blobovnicza.Metrics { +func (m *noopMetrics) Blobovnicza() blobovnicza.Metrics { return &blobovnicza.NoopMetrics{} } diff --git a/pkg/local_object_storage/metabase/put_test.go b/pkg/local_object_storage/metabase/put_test.go index dbf89c9c..a4cb2edc 100644 --- a/pkg/local_object_storage/metabase/put_test.go +++ b/pkg/local_object_storage/metabase/put_test.go @@ -80,7 +80,7 @@ func BenchmarkPut(b *testing.B) { }) } -func TestDB_PutBlobovnicaUpdate(t *testing.T) { +func TestDB_PutBlobovniczaUpdate(t *testing.T) { db := newDB(t) raw1 := testutil.GenerateObject() diff --git a/pkg/local_object_storage/metrics/blobovnizca.go b/pkg/local_object_storage/metrics/blobovnicza.go similarity index 83% rename from pkg/local_object_storage/metrics/blobovnizca.go rename to pkg/local_object_storage/metrics/blobovnicza.go index 72c45c31..5261f408 100644 --- a/pkg/local_object_storage/metrics/blobovnizca.go +++ b/pkg/local_object_storage/metrics/blobovnicza.go @@ -22,7 +22,7 @@ type blobovniczaTreeMetrics struct { m metrics_impl.BlobobvnizcaMetrics } -func (m *blobovniczaTreeMetrics) Blobovnizca() blobovnicza.Metrics { +func (m *blobovniczaTreeMetrics) Blobovnicza() blobovnicza.Metrics { return &blobovniczaMetrics{ shardID: func() string { return m.shardID }, path: m.path, @@ -81,18 +81,18 @@ type blobovniczaMetrics struct { path string } -func (m *blobovniczaMetrics) AddOpenBlobovnizcaSize(size uint64) { - m.m.AddOpenBlobovnizcaSize(m.shardID(), m.path, size) +func (m *blobovniczaMetrics) AddOpenBlobovniczaSize(size uint64) { + m.m.AddOpenBlobovniczaSize(m.shardID(), m.path, size) } -func (m *blobovniczaMetrics) SubOpenBlobovnizcaSize(size uint64) { - m.m.SubOpenBlobovnizcaSize(m.shardID(), m.path, size) +func (m *blobovniczaMetrics) SubOpenBlobovniczaSize(size uint64) { + m.m.SubOpenBlobovniczaSize(m.shardID(), m.path, size) } -func (m *blobovniczaMetrics) IncOpenBlobovnizcaCount() { - m.m.IncOpenBlobovnizcaCount(m.shardID(), m.path) +func (m *blobovniczaMetrics) IncOpenBlobovniczaCount() { + m.m.IncOpenBlobovniczaCount(m.shardID(), m.path) } -func (m *blobovniczaMetrics) DecOpenBlobovnizcaCount() { - m.m.DecOpenBlobovnizcaCount(m.shardID(), m.path) +func (m *blobovniczaMetrics) DecOpenBlobovniczaCount() { + m.m.DecOpenBlobovniczaCount(m.shardID(), m.path) } diff --git a/pkg/metrics/blobovnizca.go b/pkg/metrics/blobovnicza.go similarity index 72% rename from pkg/metrics/blobovnizca.go rename to pkg/metrics/blobovnicza.go index b80ec5fc..9c5e1752 100644 --- a/pkg/metrics/blobovnizca.go +++ b/pkg/metrics/blobovnicza.go @@ -15,14 +15,14 @@ type BlobobvnizcaMetrics interface { AddBlobobvnizcaTreePut(shardID, path string, size int) AddBlobobvnizcaTreeGet(shardID, path string, size int) - AddOpenBlobovnizcaSize(shardID, path string, size uint64) - SubOpenBlobovnizcaSize(shardID, path string, size uint64) + AddOpenBlobovniczaSize(shardID, path string, size uint64) + SubOpenBlobovniczaSize(shardID, path string, size uint64) - IncOpenBlobovnizcaCount(shardID, path string) - DecOpenBlobovnizcaCount(shardID, path string) + IncOpenBlobovniczaCount(shardID, path string) + DecOpenBlobovniczaCount(shardID, path string) } -type blobovnizca struct { +type blobovnicza struct { treeMode *shardIDPathModeValue treeReqDuration *prometheus.HistogramVec treePut *prometheus.CounterVec @@ -31,48 +31,48 @@ type blobovnizca struct { treeOpenCounter *prometheus.GaugeVec } -func newBlobovnizca() *blobovnizca { - return &blobovnizca{ - treeMode: newShardIDPathMode(blobovniczaTreeSubSystem, "mode", "Blobovnizca tree mode"), +func newBlobovnicza() *blobovnicza { + return &blobovnicza{ + treeMode: newShardIDPathMode(blobovniczaTreeSubSystem, "mode", "Blobovnicza tree mode"), treeReqDuration: metrics.NewHistogramVec(prometheus.HistogramOpts{ Namespace: namespace, Subsystem: blobovniczaTreeSubSystem, Name: "request_duration_seconds", - Help: "Accumulated Blobovnizca tree request process duration", + Help: "Accumulated Blobovnicza tree request process duration", }, []string{shardIDLabel, pathLabel, successLabel, methodLabel, withStorageIDLabel}), treePut: metrics.NewCounterVec(prometheus.CounterOpts{ Namespace: namespace, Subsystem: blobovniczaTreeSubSystem, Name: "put_bytes", - Help: "Accumulated payload size written to Blobovnizca tree", + Help: "Accumulated payload size written to Blobovnicza tree", }, []string{shardIDLabel, pathLabel}), treeGet: metrics.NewCounterVec(prometheus.CounterOpts{ Namespace: namespace, Subsystem: blobovniczaTreeSubSystem, Name: "get_bytes", - Help: "Accumulated payload size read from Blobovnizca tree", + Help: "Accumulated payload size read from Blobovnicza tree", }, []string{shardIDLabel, pathLabel}), treeOpenSize: metrics.NewGaugeVec(prometheus.GaugeOpts{ Namespace: namespace, Subsystem: blobovniczaTreeSubSystem, - Name: "open_blobovnizca_size_bytes", - Help: "Size of opened blobovnizcas of Blobovnizca tree", + Name: "open_blobovnicza_size_bytes", + Help: "Size of opened blobovniczas of Blobovnicza tree", }, []string{shardIDLabel, pathLabel}), treeOpenCounter: metrics.NewGaugeVec(prometheus.GaugeOpts{ Namespace: namespace, Subsystem: blobovniczaTreeSubSystem, - Name: "open_blobovnizca_count", - Help: "Count of opened blobovnizcas of Blobovnizca tree", + Name: "open_blobovnicza_count", + Help: "Count of opened blobovniczas of Blobovnicza tree", }, []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)) } -func (b *blobovnizca) CloseBlobobvnizcaTree(shardID, path string) { +func (b *blobovnicza) CloseBlobobvnizcaTree(shardID, path string) { b.treeMode.SetMode(shardID, path, closedMode) b.treeReqDuration.DeletePartialMatch(prometheus.Labels{ 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{ shardIDLabel: shardID, pathLabel: path, @@ -98,42 +98,42 @@ func (b *blobovnizca) BlobobvnizcaTreeMethodDuration(shardID, path string, metho }).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{ shardIDLabel: shardID, pathLabel: path, }).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{ shardIDLabel: shardID, pathLabel: path, }).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{ shardIDLabel: shardID, pathLabel: path, }).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{ shardIDLabel: shardID, pathLabel: path, }).Sub(float64(size)) } -func (b *blobovnizca) IncOpenBlobovnizcaCount(shardID, path string) { +func (b *blobovnicza) IncOpenBlobovniczaCount(shardID, path string) { b.treeOpenCounter.With(prometheus.Labels{ shardIDLabel: shardID, pathLabel: path, }).Inc() } -func (b *blobovnizca) DecOpenBlobovnizcaCount(shardID, path string) { +func (b *blobovnicza) DecOpenBlobovniczaCount(shardID, path string) { b.treeOpenCounter.With(prometheus.Labels{ shardIDLabel: shardID, pathLabel: path, diff --git a/pkg/metrics/node.go b/pkg/metrics/node.go index ce650c22..ad6864b8 100644 --- a/pkg/metrics/node.go +++ b/pkg/metrics/node.go @@ -14,7 +14,7 @@ type NodeMetrics struct { epoch prometheus.Gauge fstree *fstreeMetrics blobstore *blobstoreMetrics - blobobvnizca *blobovnizca + blobobvnizca *blobovnicza metabase *metabaseMetrics pilorama *piloramaMetrics grpc *grpcServerMetrics @@ -35,7 +35,7 @@ func NewNodeMetrics() *NodeMetrics { }), fstree: newFSTreeMetrics(), blobstore: newBlobstoreMetrics(), - blobobvnizca: newBlobovnizca(), + blobobvnizca: newBlobovnicza(), metabase: newMetabaseMetrics(), pilorama: newPiloramaMetrics(), grpc: newGrpcServerMetrics(),