Commit c651a65a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0526cca3
...@@ -107,7 +107,7 @@ func (fsi *fsIndex) Save(topPos int64, w io.Writer) error { ...@@ -107,7 +107,7 @@ func (fsi *fsIndex) Save(topPos int64, w io.Writer) error {
binary.BigEndian.PutUint64(oidb[:], uint64(oidPrefixCur)) binary.BigEndian.PutUint64(oidb[:], uint64(oidPrefixCur))
t[0] = oidb[0:6] t[0] = oidb[0:6]
t[1] = bytes.Join([][]byte{oidBuf, posBuf}, nil) t[1] = bytes.Join([][]byte{oidBuf, posBuf}, nil)
err = p.Encode(t) err = p.Encode(pickle.Tuple(t[:]))
if err != nil { if err != nil {
goto out goto out
} }
...@@ -220,13 +220,14 @@ func LoadIndex(r io.Reader) (topPos int64, fsi *fsIndex, err error) { ...@@ -220,13 +220,14 @@ func LoadIndex(r io.Reader) (topPos int64, fsi *fsIndex, err error) {
loop: loop:
for { for {
// load/decode next entry // load/decode next entry
var v pickle.Tuple
picklePos = xr.InputOffset() picklePos = xr.InputOffset()
xv, err = p.Decode() xv, err = p.Decode()
if err != nil { if err != nil {
goto out goto out
} }
switch xv.(type) { switch xv := xv.(type) {
default: default:
err = fmt.Errorf("invalid entry: type %T", xv) err = fmt.Errorf("invalid entry: type %T", xv)
goto out goto out
...@@ -234,12 +235,15 @@ func LoadIndex(r io.Reader) (topPos int64, fsi *fsIndex, err error) { ...@@ -234,12 +235,15 @@ func LoadIndex(r io.Reader) (topPos int64, fsi *fsIndex, err error) {
case pickle.None: case pickle.None:
break loop break loop
// we accept tuple or list
// XXX accept only tuple ?
case pickle.Tuple:
v = xv
case []interface{}: case []interface{}:
// so far ok v = pickle.Tuple(xv)
} }
// unpack entry tuple -> oidPrefix, fsBucket // unpack entry tuple -> oidPrefix, fsBucket
v := xv.([]interface{})
if len(v) != 2 { if len(v) != 2 {
err = fmt.Errorf("invalid entry: len = %i", len(v)) err = fmt.Errorf("invalid entry: len = %i", len(v))
goto out goto out
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment