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" {