Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
079307a4
Commit
079307a4
authored
Oct 21, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
be9fda6c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
wcfs/wcfs.go
wcfs/wcfs.go
+15
-12
No files found.
wcfs/wcfs.go
View file @
079307a4
...
...
@@ -1235,7 +1235,7 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) (err erro
case
<-
loading
.
ready
:
if
loading
.
err
==
nil
{
copy
(
dest
,
loading
.
blkdata
)
// XXX
copy
copy
(
dest
,
loading
.
blkdata
)
// TODO avoid
copy
}
return
loading
.
err
}
...
...
@@ -1255,9 +1255,16 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) (err erro
return
err
}
if
f
.
head
.
rev
==
0
{
// update δFtail index
// see "3) for */head/data the following invariant is maintained..."
δFtail
:=
f
.
head
.
bfdir
.
δFtail
δFtail
.
Track
(
f
.
zfile
,
blk
,
treepath
,
blkcov
,
zblk
)
// XXX pass in zblk.rev here?
// we have the data - it can be used after watchers are updated
// XXX should we use ctx here? (see readPinWatchers comments)
f
.
readPinWatchers
(
ctx
,
blk
,
treepath
,
blkcov
,
zblk
,
blkrevMax
)
}
// data can be used now
close
(
loading
.
ready
)
...
...
@@ -1470,7 +1477,8 @@ func (w *Watch) _pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) {
//
// See "7.2) for all registered client@at watchers ..."
//
// Called with f.head.zheadMu rlocked.
// Must be called only for f under head/
// Must be called with f.head.zheadMu rlocked.
//
// XXX do we really need to use/propagate caller context here? ideally update
// watchers should be synchronous, and in practice we just use 30s timeout.
...
...
@@ -1478,23 +1486,18 @@ func (w *Watch) _pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) {
func
(
f
*
BigFile
)
readPinWatchers
(
ctx
context
.
Context
,
blk
int64
,
treepath
[]
btree
.
LONode
,
blkcov
btree
.
LKeyRange
,
zblk
ZBlk
,
blkrevMax
zodb
.
Tid
)
{
// only head/ is being watched for
if
f
.
head
.
rev
!=
0
{
return
panic
(
"BUG: readPinWatchers: called for file under @revX/"
)
}
// fmt.Printf("S: read #%d -> pin watchers (#%d)\n", blk, len(f.watchTab))
// update δFtail index XXX -> move upper into readBlk ?
// see "3) for */head/data the following invariant is maintained..."
bfdir
:=
f
.
head
.
bfdir
δFtail
:=
bfdir
.
δFtail
δFtail
.
Track
(
f
.
zfile
,
blk
,
treepath
,
blkcov
,
zblk
)
// XXX pass in zblk.rev here?
// make sure that file[blk] on clients side stays as of @w.at state.
// try to use blkrevMax only as the first cheap criteria to skip updating watchers.
// This is likely to be the case, since most watchers should be usually close to head.
// If using blkrevMax only turns out to be not sufficient, we'll
// consult δFtail, which might involve recomputing it.
δFtail
:=
f
.
head
.
bfdir
.
δFtail
blkrev
:=
blkrevMax
blkrevRough
:=
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment