Commit 1dd5d4c1 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0fc00c67
......@@ -39,17 +39,18 @@ type Backend struct {
// 2 ? (data.fs)
// 3 packed/ (deltified objects)
//
// XXX we currently depend on extra functionality FS provides over
// plain zodb.IStorage (e.g. loading with nextSerial) and even if
// nextSerial will be gone in the future, we will probably depend on
// particular layout more and more -> directly work with fs1 & friends.
// NOTE we currently depend on extra functionality FS provides over
// plain zodb.IStorage (loading with nextSerial) and even if nextSerial
// will be gone in the future, we will probably depend on particular
// layout more and more -> directly work with fs1 & friends.
zstor *fs1.FileStorage // underlying ZODB storage
}
var _ storage.Backend = (*Backend)(nil)
func Open(ctx context.Context, path string) (*Backend, error) {
zstor, _, err := fs1.Open(ctx, path, &zodb.DriverOptions{ReadOnly: true}) // XXX RO? +Watchq?
// XXX +Watchq? but nobody except us should change the file. -> lock?
zstor, _, err := fs1.Open(ctx, path, &zodb.DriverOptions{ReadOnly: true})
if err != nil {
return nil, err
}
......@@ -69,7 +70,7 @@ func (f *Backend) LastOid(ctx context.Context) (zodb.Oid, error) {
}
func (f *Backend) Load(ctx context.Context, xid zodb.Xid) (*proto.AnswerObject, error) {
// FIXME kill nextSerial support after neo/py cache does not depend on next_serial
// TODO kill nextSerial support after neo/py cache does not depend on next_serial
// see also: https://github.com/zopefoundation/ZODB/pull/323
buf, serial, nextSerial, err := f.zstor.Load_XXXWithNextSerialXXX(ctx, xid)
if err != nil {
......@@ -81,15 +82,14 @@ func (f *Backend) Load(ctx context.Context, xid zodb.Xid) (*proto.AnswerObject,
nextSerial = proto.INVALID_TID
}
return &proto.AnswerObject{
Oid: xid.Oid,
Serial: serial,
NextSerial: nextSerial,
Compression: false,
Data: buf,
Checksum: xsha1.NEOSum(buf.Data), // XXX computing every time
Compression: false,
Data: buf,
Checksum: xsha1.NEOSum(buf.Data), // XXX computing every time
// XXX .DataSerial
}, nil
......@@ -103,7 +103,7 @@ func openBackend(ctx context.Context, path string) (storage.Backend, error) {
if err == nil {
return b, nil
} else {
return nil, err // XXX don't return just b -> will be !nil interface
return nil, err // don't return just b -> will be !nil interface
}
}
......
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