Commit 19c56736 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a18daaa3
...@@ -139,7 +139,7 @@ func (e *ErrOidLoad) Error() string { ...@@ -139,7 +139,7 @@ func (e *ErrOidLoad) Error() string {
return fmt.Sprintf("loading oid %v: %v", e.Oid, e.Err) return fmt.Sprintf("loading oid %v: %v", e.Oid, e.Err)
} }
func (fs *FileStorage) LoadBefore(oid zodb.Oid, beforeTid zodb.Tid) (data []byte, tid zodb.Tid, err error) { func (fs *FileStorage) Load(xid zodb.Xid) (data []byte, tid zodb.Tid, err error) {
// lookup in index position of oid data record within latest transaction who changed this oid // lookup in index position of oid data record within latest transaction who changed this oid
dataPos, ok := fs.index.Get(oid) dataPos, ok := fs.index.Get(oid)
if !ok { if !ok {
......
...@@ -46,16 +46,28 @@ func (oid Oid) String() string { ...@@ -46,16 +46,28 @@ func (oid Oid) String() string {
return fmt.Sprintf("%016x", uint64(oid)) return fmt.Sprintf("%016x", uint64(oid))
} }
// XXX move me out of here
// XXX naming -> bint ?
func bool2int(b bool) int {
if b {
return 1
} else {
return 0
}
}
func (xtid XTid) String() string { func (xtid XTid) String() string {
// XXX also print "tid:" prefix ? // XXX also print "tid:" prefix ?
/*
s := "" s := ""
if xtid.TidBefore { if xtid.TidBefore {
s = "<" s = "<"
} else { } else {
s = "=" s = "="
} }
*/
return s + xtid.Tid.String() return fmt.Sprintf("%c%v", "=<"[bool2int(xtid.TidBefore)], xtid)
} }
func (xid Xid) String() string { func (xid Xid) String() string {
...@@ -134,7 +146,7 @@ type IStorage interface { ...@@ -134,7 +146,7 @@ type IStorage interface {
LastTid() Tid // XXX -> Tid, ok ? LastTid() Tid // XXX -> Tid, ok ?
// TODO data []byte -> something allocated from slab ? // TODO data []byte -> something allocated from slab ?
Load(xoid XOid) (data []byte, tid Tid, err error) Load(xid Xid) (data []byte, tid Tid, err error)
/* generalized ^^^ /* generalized ^^^
LoadBefore(oid Oid, beforeTid Tid) (data []byte, tid Tid, err error) LoadBefore(oid Oid, beforeTid Tid) (data []byte, tid Tid, err error)
......
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