Skip to content

Commit

Permalink
Fixing API errors
Browse files Browse the repository at this point in the history
Signed-off-by: Ajay Lotan Thakur <[email protected]>
  • Loading branch information
thakurajayL committed Jan 13, 2025
1 parent 39fea77 commit 2ea5f1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions drsm/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package drsm
import (
"fmt"
"sync"

"github.com/omec-project/util/logger"
)

Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions drsm/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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" {
Expand Down

0 comments on commit 2ea5f1a

Please sign in to comment.