Commit ebf38926 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 83b604f6
......@@ -1169,7 +1169,6 @@ func (f *BigFile) updateWatchers(ctx context.Context, blk int64, treepath []btre
// XXX close watcher on any error
return w.pin(ctx, blk, blkrevmax)
})
_ = w
}
err := wg.Wait()
if err != nil {
......@@ -1248,7 +1247,8 @@ retry:
// -------- invalidation protocol notification/serving --------
// pin makes sure that file[blk] on client side is the same as of @rev state.
// pin makes sure that file[blk] on client side is the same as of @rev state. XXX no
// XXX what is passed here is rev(blk, @head) - we need to consider rev(blk, @w.at)
//
// XXX describe more.
// XXX explain that if rev ≤ .at there is no rev_next: rev < rev_next ≤ at.
......@@ -1269,6 +1269,7 @@ func (w *Watch) pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) {
return // already pinned
}
// FIXME LastBlkRev call not needed here - we get blk rev as argument. - XXX no
// XXX comment
// XXX file.δtail has not full info
rev, _ = w.file.LastBlkRev(blk, w.at)
......
......@@ -55,8 +55,10 @@ import (
"./internal/pycompat"
)
// zBlk is the interface that every ZBlk* block implements internally.
// zBlk is the interface that every ZBlk* block implements.
type zBlk interface {
zodb.IPersistent
// loadBlkData loads from database and returns data block stored by this ZBlk.
//
// If returned data size is less than the block size of containing ZBigFile,
......@@ -444,7 +446,7 @@ func (bf *zBigFileState) PySetState(pystate interface{}) (err error) {
// - BTree path in .blktab for loaded block,
// - max(_.serial for _ in ZBlk(#blk), all BTree/Bucket that lead to ZBlk)
//
// XXX better load into user-provided buf? mem.Buf?
// XXX load into user-provided buf.
func (bf *ZBigFile) LoadBlk(ctx context.Context, blk int64) (_ []byte, treePath []btree.LONode, pathRevMax zodb.Tid, err error) {
defer xerr.Contextf(&err, "bigfile %s: loadblk %d", bf.POid(), blk)
......@@ -471,15 +473,15 @@ func (bf *ZBigFile) LoadBlk(ctx context.Context, blk int64) (_ []byte, treePath
return nil, nil, 0, fmt.Errorf("expect ZBlk*; got %s", typeOf(xzblk))
}
blkdata, blkrev, err := zblk.loadBlkData(ctx)
blkdata, zblkrev, err := zblk.loadBlkData(ctx)
if err != nil {
return nil, nil, 0, err
}
pathRevMax = tidmax(pathRevMax, blkrev)
pathRevMax = tidmax(pathRevMax, zblkrev)
l := int64(len(blkdata))
if l > bf.blksize {
return nil, nil, 0, fmt.Errorf("invalid blk: size = %d (> blksize = %d)", l, bf.blksize)
return nil, nil, 0, fmt.Errorf("zblk %s: invalid blk: size = %d (> blksize = %d)", zblk.POid(), l, bf.blksize)
}
// append trailing \0 to data to reach .blksize
......
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