From 2ea5f1ac32361eb3bd7a16e18fb5e62f7fe6b59a Mon Sep 17 00:00:00 2001 From: Ajay Lotan Thakur Date: Sun, 12 Jan 2025 18:43:31 -0800 Subject: [PATCH] Fixing API errors Signed-off-by: Ajay Lotan Thakur --- drsm/api.go | 7 ++++--- drsm/chunk.go | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drsm/api.go b/drsm/api.go index 8ac0eed..1a2d075 100644 --- a/drsm/api.go +++ b/drsm/api.go @@ -7,6 +7,7 @@ package drsm import ( "fmt" "sync" + "github.com/omec-project/util/logger" ) @@ -73,14 +74,14 @@ func (d *Drsm) AllocateInt32ID() (int32, error) { } for _, c := range d.localChunkTbl { if len(c.FreeIds) > 0 { - return c.AllocateIntID(), nil + return c.AllocateIntID() } } // None of the Chunk has freeIds. Allocate new Chunk c, err := d.GetNewChunk() if err != nil { - logger.DrsmLog.Errorln("Failed to allocate new Chunk") - err := fmt.Errorf("Failed to allocate new Chunk") + logger.DrsmLog.Errorln("failed to allocate new Chunk") + err := fmt.Errorf("failed to allocate new Chunk") return 0, err } return c.AllocateIntID() diff --git a/drsm/chunk.go b/drsm/chunk.go index 868cc76..23694e1 100644 --- a/drsm/chunk.go +++ b/drsm/chunk.go @@ -66,7 +66,7 @@ func (d *Drsm) GetNewChunk() (*chunk, error) { return c, nil } -func (c *chunk) AllocateIntID() int32 { +func (c *chunk) AllocateIntID() (int32, error) { if len(c.FreeIds) == 0 { logger.DrsmLog.Errorln("freeIds in chunk 0") err := fmt.Errorf("freeIds in chunk 0") @@ -110,7 +110,7 @@ func getChunIdFromDocId(id string) int32 { return 0 } -//check the id format and if its matching chunkid doc format then return true +// check the id format and if its matching chunkid doc format then return true func isChunkDoc(id string) bool { z := strings.Split(id, "-") if len(z) == 2 && z[0] == "chunkid" {