forked from TrueCloudLab/frostfs-node
41 lines
885 B
Go
41 lines
885 B
Go
package objectstore
|
|
|
|
import "encoding/binary"
|
|
|
|
const (
|
|
compressionNone byte = 0
|
|
compressionZSTD byte = 1
|
|
|
|
blobTypeObject byte = 0 // blob contains only one object
|
|
|
|
blobStateReserved byte = 0 // blob reserved, but not commited yet
|
|
blobStateCommited byte = 1 // blob contains object
|
|
)
|
|
|
|
type blob struct {
|
|
Type byte
|
|
State byte
|
|
CreationEpoch uint64
|
|
}
|
|
|
|
func (b *blob) Bytes() []byte {
|
|
result := make([]byte, 10)
|
|
result[0] = b.Type
|
|
result[1] = b.State
|
|
binary.LittleEndian.PutUint64(result[2:], b.CreationEpoch)
|
|
return result
|
|
}
|
|
|
|
type objectIDPartBlobIDValue struct {
|
|
Compression byte
|
|
Offset uint64
|
|
Lenght uint64
|
|
}
|
|
|
|
func (v *objectIDPartBlobIDValue) Bytes() []byte {
|
|
result := make([]byte, 1+8+8)
|
|
result[0] = v.Compression
|
|
binary.LittleEndian.PutUint64(result[1:], v.Offset)
|
|
binary.LittleEndian.PutUint64(result[1+8:], v.Lenght)
|
|
return result
|
|
}
|