Commit 8b0816bc authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 424beee4
......@@ -495,12 +495,12 @@ type BigFile struct {
head *Head
// ZBigFile top-level object
zbf *ZBigFile
zfile *ZBigFile
// things read/computed from .zbf; constant during lifetime of current transaction.
blksize int64 // zbf.blksize
size int64 // zbf.Size()
rev zodb.Tid // last revision that modified zbf data
// things read/computed from .zfile; constant during lifetime of current transaction.
blksize int64 // zfile.blksize
size int64 // zfile.Size()
rev zodb.Tid // last revision that modified zfile data
// tail change history of this file.
δFtail *ΔTailI64 // [](rev↑, []#blk)
......@@ -750,7 +750,7 @@ retry:
fmt.Printf("\n\nzδhandle: toinvalidate (#%d):\n", len(toinvalidate))
for file := range toinvalidate {
fmt.Printf("\t- %s\n", file.zbf.POid())
fmt.Printf("\t- %s\n", file.zfile.POid())
}
wg, ctx := errgroup.WithContext(context.TODO())
......@@ -802,7 +802,7 @@ retry:
// XXX -> parallel?
// XXX locking
for file := range toinvalidate {
size, treePath, err := file.zbf.Size(ctx)
size, treePath, err := file.zfile.Size(ctx)
if err != nil {
panic(err) // XXX
}
......@@ -870,7 +870,7 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) (err error) {
func() {
// store retrieved data back to OS cache for file @<rev>/file[blk]
blkrev, _ := f.δFtail.LastRevOf(blk, f.head.zconn.At())
frev, frelease, err := groot.mkrevfile(blkrev, f.zbf.POid())
frev, frelease, err := groot.mkrevfile(blkrev, f.zfile.POid())
if err != nil {
log.Errorf("BUG: %s: invalidate blk #%d: %s (ignoring, but reading @revX/bigfile will be slow)", f.path(), blk, err)
}
......@@ -1110,7 +1110,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
ctx, cancel := xcontext.Merge(ctx, zconn.txnCtx)
defer cancel()
xzbf, err := zconn.Get(ctx, oid)
xzfile, err := zconn.Get(ctx, oid)
if err != nil {
switch errors.Cause(err).(type) {
case *zodb.NoObjectError:
......@@ -1122,26 +1122,26 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
}
}
zbf, ok := xzbf.(*ZBigFile)
zfile, ok := xzfile.(*ZBigFile)
if !ok {
return nil, eINVALf("%s is not a ZBigFile", typeOf(xzbf))
return nil, eINVALf("%s is not a ZBigFile", typeOf(xzfile))
}
// extract blksize, size and initial approximation for file revision
err = zbf.PActivate(ctx)
err = zfile.PActivate(ctx)
if err != nil {
return nil, err
}
blksize := zbf.blksize
blksize := zfile.blksize
// XXX it should be revision of both ZBigFile and its data. But we
// cannot get data revision without expensive scan of all ZBigFile's objects.
// -> approximate mtime initially with ZBigFile object mtime.
//
// XXX for @rev/... we can know initial mtime more exactly?
rev := zbf.PSerial()
zbf.PDeactivate()
rev := zfile.PSerial()
zfile.PDeactivate()
size, treePath, err := zbf.Size(ctx)
size, treePath, err := zfile.Size(ctx)
if err != nil {
return nil, err
}
......@@ -1150,7 +1150,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
f := &BigFile{
fsNode: newFSNode(&fsOptions{Sticky: false}), // XXX + BigFile.OnForget -> del .head.bfdir.fileTab[]
head: head,
zbf: zbf,
zfile: zfile,
blksize: blksize,
size: size,
rev: rev,
......@@ -1173,7 +1173,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
// Close release all resources of BigFile.
func (f *BigFile) Close() error {
// XXX locking?
f.zbf = nil
f.zfile = nil
// f.zconn.Release()
// f.zconn = nil
......@@ -1303,8 +1303,8 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) error {
// noone was loading - we became responsible to load this block
zbf := f.zbf
blkdata, treepath, pathRevMax, err := zbf.LoadBlk(ctx, blk)
zfile := f.zfile
blkdata, treepath, pathRevMax, err := zfile.LoadBlk(ctx, blk)
loading.blkdata = blkdata
loading.err = err
close(loading.ready)
......@@ -1318,7 +1318,7 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) error {
}
// XXX before loading.ready?
blkrevmax, _ := f.δFtail.LastRevOf(blk, zbf.PJar().At())
blkrevmax, _ := f.δFtail.LastRevOf(blk, zfile.PJar().At())
blkrevmax = tidmin(blkrevmax, pathRevMax)
/*
......@@ -1411,7 +1411,7 @@ retry:
return
}
oid := f.zbf.POid()
oid := f.zfile.POid()
// signal to zwatcher not to run while we are performing the upload.
// upload with released zconnMu so that zwatcher can lock it even if to
......
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