From a4537b50fa098cefd6be6ee58d69e83fceeb69b8 Mon Sep 17 00:00:00 2001 From: fengshunli <1171313930@qq.com> Date: Sun, 18 Jun 2023 00:07:10 +0800 Subject: [PATCH] fix(blobnode): modify camel case Signed-off-by: fengshunli <1171313930@qq.com> --- blobstore/api/blobnode/iostat.go | 6 +++--- blobstore/api/blobnode/iostat_test.go | 8 ++++---- blobstore/blobnode/base/flow/iostat.go | 2 +- blobstore/blobnode/core/chunk/compact.go | 2 +- blobstore/blobnode/core/disk/chunkinspect.go | 2 +- blobstore/blobnode/core/disk/disk.go | 2 +- blobstore/blobnode/core/storage/datafile.go | 6 +++--- blobstore/blobnode/datainspect.go | 2 +- blobstore/blobnode/db/metadb.go | 12 ++++++------ blobstore/blobnode/shard.go | 8 ++++---- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/blobstore/api/blobnode/iostat.go b/blobstore/api/blobnode/iostat.go index 658f1bec61..3ca5b7af20 100644 --- a/blobstore/api/blobnode/iostat.go +++ b/blobstore/api/blobnode/iostat.go @@ -59,10 +59,10 @@ func (it IOType) IsValid() bool { } func (it IOType) String() string { - return IOtypemap[uint64(it)] + return IOtypemap[it] } -func Getiotype(ctx context.Context) IOType { +func GetIoType(ctx context.Context) IOType { v := ctx.Value(_ioFlowStatKey) if v == nil { return NormalIO @@ -70,7 +70,7 @@ func Getiotype(ctx context.Context) IOType { return v.(IOType) } -func Setiotype(ctx context.Context, iot IOType) context.Context { +func SetIoType(ctx context.Context, iot IOType) context.Context { return context.WithValue(ctx, _ioFlowStatKey, iot) } diff --git a/blobstore/api/blobnode/iostat_test.go b/blobstore/api/blobnode/iostat_test.go index ca8f906816..743828e7cd 100644 --- a/blobstore/api/blobnode/iostat_test.go +++ b/blobstore/api/blobnode/iostat_test.go @@ -21,17 +21,17 @@ import ( "github.com/stretchr/testify/require" ) -func TestGetIotype(t *testing.T) { +func TestGetIoType(t *testing.T) { ctx := context.TODO() - iotype := Getiotype(ctx) + iotype := GetIoType(ctx) require.Equal(t, NormalIO, iotype) ctx0 := context.WithValue(ctx, _ioFlowStatKey, CompactIO) - iotype = Getiotype(ctx0) + iotype = GetIoType(ctx0) require.Equal(t, CompactIO, iotype) ctx1 := context.WithValue(ctx0, _ioFlowStatKey, DiskRepairIO) - iotype = Getiotype(ctx1) + iotype = GetIoType(ctx1) require.Equal(t, DiskRepairIO, iotype) } diff --git a/blobstore/blobnode/base/flow/iostat.go b/blobstore/blobnode/base/flow/iostat.go index 51be832700..2adbdecf89 100644 --- a/blobstore/blobnode/base/flow/iostat.go +++ b/blobstore/blobnode/base/flow/iostat.go @@ -67,7 +67,7 @@ func SetupDefaultIOStat(s *IOFlowStat) { defaultIOStat = s } -// ${pid}.${key}_${value}.${suffix} +// GenerateStatName ${pid}.${key}_${value}.${suffix} func GenerateStatName(pid int, key string, value string, suffix string) string { return fmt.Sprintf("%d.%s_%s.%s", pid, key, value, suffix) } diff --git a/blobstore/blobnode/core/chunk/compact.go b/blobstore/blobnode/core/chunk/compact.go index c78d85e42b..906fd9d308 100644 --- a/blobstore/blobnode/core/chunk/compact.go +++ b/blobstore/blobnode/core/chunk/compact.go @@ -149,7 +149,7 @@ func (cs *chunk) handleErrCompact(ctx context.Context, ncs core.ChunkAPI) { func (cs *chunk) doCompact(ctx context.Context, ncs *chunk) (err error) { span := trace.SpanFromContextSafe(ctx) - ctx = bnapi.Setiotype(ctx, bnapi.CompactIO) + ctx = bnapi.SetIoType(ctx, bnapi.CompactIO) startBid := proto.InValidBlobID replStg := cs.getStg() diff --git a/blobstore/blobnode/core/disk/chunkinspect.go b/blobstore/blobnode/core/disk/chunkinspect.go index 16516907d3..d943d599f9 100644 --- a/blobstore/blobnode/core/disk/chunkinspect.go +++ b/blobstore/blobnode/core/disk/chunkinspect.go @@ -132,7 +132,7 @@ func (ds *DiskStorage) maybeCleanRubbishChunk(ctx context.Context, id bnapi.Chun span := trace.SpanFromContextSafe(ctx) // set io type - ctx = bnapi.Setiotype(ctx, bnapi.InternalIO) + ctx = bnapi.SetIoType(ctx, bnapi.InternalIO) span.Debugf("chunk:%s maybe rubbish, will confirm", id) diff --git a/blobstore/blobnode/core/disk/disk.go b/blobstore/blobnode/core/disk/disk.go index b1e6b221c4..64a35b3dd1 100644 --- a/blobstore/blobnode/core/disk/disk.go +++ b/blobstore/blobnode/core/disk/disk.go @@ -917,7 +917,7 @@ func (ds *DiskStorage) cleanReleasedChunks() (err error) { span.Debugf("come in CleanChunks.") // set io type - ctx = bnapi.Setiotype(ctx, bnapi.InternalIO) + ctx = bnapi.SetIoType(ctx, bnapi.InternalIO) protectionPeriod := time.Duration(ds.Conf.ChunkReleaseProtectionM) now := time.Now().UnixNano() diff --git a/blobstore/blobnode/core/storage/datafile.go b/blobstore/blobnode/core/storage/datafile.go index 63b3fa42f2..153ccef80e 100644 --- a/blobstore/blobnode/core/storage/datafile.go +++ b/blobstore/blobnode/core/storage/datafile.go @@ -505,17 +505,17 @@ func (cd *datafile) spaceInfo() (size int64, phySpace int64, err error) { } func (cd *datafile) qosReaderAt(ctx context.Context, reader io.ReaderAt) io.ReaderAt { - ioType := bnapi.Getiotype(ctx) + ioType := bnapi.GetIoType(ctx) return cd.ioQos.ReaderAt(ctx, ioType, reader) } func (cd *datafile) qosWriterAt(ctx context.Context, writer io.WriterAt) io.WriterAt { - ioType := bnapi.Getiotype(ctx) + ioType := bnapi.GetIoType(ctx) w := cd.ioQos.WriterAt(ctx, ioType, writer) return w } func (cd *datafile) qosWriter(ctx context.Context, writer io.Writer) io.Writer { - ioType := bnapi.Getiotype(ctx) + ioType := bnapi.GetIoType(ctx) return cd.ioQos.Writer(ctx, ioType, writer) } diff --git a/blobstore/blobnode/datainspect.go b/blobstore/blobnode/datainspect.go index a2a65d43f2..7c2d96c553 100644 --- a/blobstore/blobnode/datainspect.go +++ b/blobstore/blobnode/datainspect.go @@ -95,7 +95,7 @@ func ScanShard(ctx context.Context, cs core.ChunkAPI, startBid proto.BlobID, ins func startInspect(ctx context.Context, cs core.ChunkAPI) ([]bnapi.BadShard, error) { span := trace.SpanFromContextSafe(ctx) span.Debugf("start inspect chunk, vuid:%v,chunkid:%s.", cs.Vuid(), cs.ID()) - ctx = bnapi.Setiotype(ctx, bnapi.InspectIO) + ctx = bnapi.SetIoType(ctx, bnapi.InspectIO) startBid := proto.InValidBlobID ds := cs.Disk() badShards := make([]bnapi.BadShard, 0) diff --git a/blobstore/blobnode/db/metadb.go b/blobstore/blobnode/db/metadb.go index b586b96282..eefeb6227b 100644 --- a/blobstore/blobnode/db/metadb.go +++ b/blobstore/blobnode/db/metadb.go @@ -98,7 +98,7 @@ func (md *metadb) SetIOStat(stat *flow.IOFlowStat) { } func (md *metadb) Get(ctx context.Context, key []byte) (value []byte, err error) { - mgr, iot := md.getiotype(ctx) + mgr, iot := md.getIoType(ctx) mgr.ReadBegin(1) defer mgr.ReadEnd(time.Now()) @@ -134,7 +134,7 @@ func (md *metadb) Put(ctx context.Context, kv rdb.KV) (err error) { Data: kv, } - mgr, iot := md.getiotype(ctx) + mgr, iot := md.getIoType(ctx) mgr.WriteBegin(1) defer mgr.WriteEnd(time.Now()) @@ -158,7 +158,7 @@ func (md *metadb) Delete(ctx context.Context, key []byte) (err error) { Data: rdb.KV{Key: key}, } - mgr, iot := md.getiotype(ctx) + mgr, iot := md.getIoType(ctx) mgr.WriteBegin(1) defer mgr.WriteEnd(time.Now()) @@ -182,7 +182,7 @@ func (md *metadb) DeleteRange(ctx context.Context, start, end []byte) (err error Data: rdb.Range{Start: start, Limit: end}, } - mgr, iot := md.getiotype(ctx) + mgr, iot := md.getIoType(ctx) mgr.WriteBegin(1) defer mgr.WriteEnd(time.Now()) @@ -325,8 +325,8 @@ func (md *metadb) doBatch(ctx context.Context, reqs []Request) (err error) { return err } -func (md *metadb) getiotype(ctx context.Context) (iostat.StatMgrAPI, bnapi.IOType) { - iot := bnapi.Getiotype(ctx) +func (md *metadb) getIoType(ctx context.Context) (iostat.StatMgrAPI, bnapi.IOType) { + iot := bnapi.GetIoType(ctx) mgr := md.iostat.GetStatMgr(iot) return mgr, iot } diff --git a/blobstore/blobnode/shard.go b/blobstore/blobnode/shard.go index f898522060..ee77733b9e 100644 --- a/blobstore/blobnode/shard.go +++ b/blobstore/blobnode/shard.go @@ -81,7 +81,7 @@ func (s *Service) ShardGet(c *rpc.Context) { } // set io type - ctx = bnapi.Setiotype(ctx, args.Type) + ctx = bnapi.SetIoType(ctx, args.Type) ctx = limitio.SetLimitTrack(ctx) s.lock.RLock() @@ -342,7 +342,7 @@ func (s *Service) ShardMarkdelete(c *rpc.Context) { } // set io type - ctx = bnapi.Setiotype(ctx, bnapi.DeleteIO) + ctx = bnapi.SetIoType(ctx, bnapi.DeleteIO) ctx = limitio.SetLimitTrack(ctx) err = cs.MarkDelete(ctx, args.Bid) @@ -413,7 +413,7 @@ func (s *Service) ShardDelete(c *rpc.Context) { } // set io type - ctx = bnapi.Setiotype(ctx, bnapi.DeleteIO) + ctx = bnapi.SetIoType(ctx, bnapi.DeleteIO) ctx = limitio.SetLimitTrack(ctx) err = cs.Delete(ctx, args.Bid) @@ -465,7 +465,7 @@ func (s *Service) ShardPut(c *rpc.Context) { } // set io type - ctx = bnapi.Setiotype(ctx, args.Type) + ctx = bnapi.SetIoType(ctx, args.Type) ctx = limitio.SetLimitTrack(ctx) s.lock.RLock()