Commit 4ca61cd7 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 57d9037e
...@@ -86,7 +86,7 @@ func (z *zeo) Load(ctx context.Context, xid zodb.Xid) (*mem.Buf, zodb.Tid, error ...@@ -86,7 +86,7 @@ func (z *zeo) Load(ctx context.Context, xid zodb.Xid) (*mem.Buf, zodb.Tid, error
func (z *zeo) _Load(ctx context.Context, xid zodb.Xid) (*mem.Buf, zodb.Tid, error) { func (z *zeo) _Load(ctx context.Context, xid zodb.Xid) (*mem.Buf, zodb.Tid, error) {
rpc := z.rpc("loadBefore") rpc := z.rpc("loadBefore")
xres, err := rpc.call(ctx, oidPack(xid.Oid), tidPack(xid.At+1)) // XXX at2Before xres, err := rpc.call(ctx, z.srv.oidPack(xid.Oid), z.srv.tidPack(xid.At+1)) // XXX at2Before
if err != nil { if err != nil {
return nil, 0, err return nil, 0, err
} }
...@@ -432,7 +432,7 @@ func (zl *zLink) xuint64Unpack(xv interface{}) (uint64, bool) { ...@@ -432,7 +432,7 @@ func (zl *zLink) xuint64Unpack(xv interface{}) (uint64, bool) {
panic("bug") panic("bug")
case 'Z': case 'Z':
// pickles: str|bytes // pickle: str|bytes
v, err := pickletools.Xstrbytes8(xv) v, err := pickletools.Xstrbytes8(xv)
if err != nil { if err != nil {
return 0, false return 0, false
...@@ -456,21 +456,30 @@ func (zl *zLink) xuint64Unpack(xv interface{}) (uint64, bool) { ...@@ -456,21 +456,30 @@ func (zl *zLink) xuint64Unpack(xv interface{}) (uint64, bool) {
} }
// xuint64Pack packs v into big-endian 8-byte string // xuint64Pack packs v into big-endian 8-byte string
// func (zl *zLink) xuint64Pack(v uint64) interface{} {
// XXX do we need to emit bytes instead of str?
// XXX adapt to msgpack?
func xuint64Pack(v uint64) string {
var b [8]byte var b [8]byte
binary.BigEndian.PutUint64(b[:], v) binary.BigEndian.PutUint64(b[:], v)
return mem.String(b[:])
switch zl.encoding {
default:
panic("bug")
case 'Z':
// pickle: -> str XXX do we need to emit bytes for py3?
return mem.String(b[:])
case 'M':
// msgpack: -> bin
return b[:]
}
} }
func tidPack(tid zodb.Tid) string { func (zl *zLink) tidPack(tid zodb.Tid) interface{} {
return xuint64Pack(uint64(tid)) return zl.xuint64Pack(uint64(tid))
} }
func oidPack(oid zodb.Oid) string { func (zl *zLink) oidPack(oid zodb.Oid) interface{} {
return xuint64Pack(uint64(oid)) return zl.xuint64Pack(uint64(oid))
} }
func (zl *zLink) tidUnpack(xv interface{}) (zodb.Tid, bool) { func (zl *zLink) tidUnpack(xv interface{}) (zodb.Tid, bool) {
......
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