refactoring: add type for needle id, offset
later the type size can possibly be adjusted
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
. "github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||
)
|
||||
|
||||
func TestMemoryUsage(t *testing.T) {
|
||||
@@ -29,11 +30,11 @@ func loadNewNeedleMap(file *os.File) {
|
||||
}
|
||||
for count > 0 && e == nil {
|
||||
for i := 0; i < count; i += 16 {
|
||||
key := util.BytesToUint64(bytes[i : i+8])
|
||||
offset := util.BytesToUint32(bytes[i+8 : i+12])
|
||||
size := util.BytesToUint32(bytes[i+12 : i+16])
|
||||
key := util.BytesToUint64(bytes[i: i+8])
|
||||
offset := util.BytesToUint32(bytes[i+8: i+12])
|
||||
size := util.BytesToUint32(bytes[i+12: i+16])
|
||||
if offset > 0 {
|
||||
m.Set(Key(key), offset, size)
|
||||
m.Set(NeedleId(key), offset, size)
|
||||
} else {
|
||||
//delete(m, key)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user