generate ec01~ec14, generate ecx file with sorted needle values
This commit is contained in:
@@ -2,6 +2,7 @@ package needle_map
|
||||
|
||||
import (
|
||||
. "github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/google/btree"
|
||||
)
|
||||
|
||||
@@ -15,3 +16,15 @@ func (this NeedleValue) Less(than btree.Item) bool {
|
||||
that := than.(NeedleValue)
|
||||
return this.Key < that.Key
|
||||
}
|
||||
|
||||
func (nv NeedleValue) ToBytes() []byte {
|
||||
return ToBytes(nv.Key, nv.Offset, nv.Size)
|
||||
}
|
||||
|
||||
func ToBytes(key NeedleId, offset Offset, size uint32) []byte {
|
||||
bytes := make([]byte, NeedleIdSize+OffsetSize+SizeSize)
|
||||
NeedleIdToBytes(bytes[0:NeedleIdSize], key)
|
||||
OffsetToBytes(bytes[NeedleIdSize:NeedleIdSize+OffsetSize], offset)
|
||||
util.Uint32toBytes(bytes[NeedleIdSize+OffsetSize:NeedleIdSize+OffsetSize+SizeSize], size)
|
||||
return bytes
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user