-
Notifications
You must be signed in to change notification settings - Fork 329
/
objectmap.go
47 lines (40 loc) · 1007 Bytes
/
objectmap.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package types
import (
"bytes"
"encoding/binary"
)
type ObjMap struct {
Rowkey []byte // Rowkey cache
Name string
BucketName string
NullVerNum uint64
NullVerId string
}
func (om *ObjMap) GetRowKey() (string, error) {
if len(om.Rowkey) != 0 {
return string(om.Rowkey), nil
}
var rowkey bytes.Buffer
rowkey.WriteString(om.BucketName + ObjectNameSeparator)
rowkey.WriteString(om.Name + ObjectNameSeparator)
om.Rowkey = rowkey.Bytes()
return string(om.Rowkey), nil
}
func (om *ObjMap) GetValues() (values map[string]map[string][]byte, err error) {
var nullVerNum bytes.Buffer
err = binary.Write(&nullVerNum, binary.BigEndian, om.NullVerNum)
if err != nil {
return
}
values = map[string]map[string][]byte{
OBJMAP_COLUMN_FAMILY: map[string][]byte{
"nullVerNum": nullVerNum.Bytes(),
},
}
return
}
func (om *ObjMap) GetValuesForDelete() (values map[string]map[string][]byte) {
return map[string]map[string][]byte{
OBJMAP_COLUMN_FAMILY: map[string][]byte{},
}
}