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
063a03af
Commit
063a03af
authored
Oct 21, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
38b20311
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
+22
-18
wcfs/wcfs.go
wcfs/wcfs.go
+22
-18
No files found.
wcfs/wcfs.go
View file @
063a03af
...
...
@@ -1243,6 +1243,22 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) (err erro
// noone was loading - we became responsible to load this block
blkdata
,
treepath
,
blkcov
,
zblk
,
blkrevMax
,
err
:=
f
.
zfile
.
LoadBlk
(
ctx
,
blk
)
// head/ - update δFtail + pin watchers
if
f
.
head
.
rev
==
0
&&
err
==
nil
{
// 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
)
// we have the data - it can be used after watchers are updated
// XXX should we use ctx here? (see readPinWatchers comments)
err
=
f
.
readPinWatchers
(
ctx
,
blk
,
blkrevMax
)
if
err
!=
nil
{
blkdata
=
nil
}
}
loading
.
blkdata
=
blkdata
loading
.
err
=
err
...
...
@@ -1255,17 +1271,6 @@ 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
)
// 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
,
blkrevMax
)
}
// data can be used now
close
(
loading
.
ready
)
copy
(
dest
,
blkdata
)
// TODO avoid copy
...
...
@@ -1483,7 +1488,9 @@ func (w *Watch) _pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) {
// 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.
// Should a READ interrupt cause watch update failure? -> probably no
func
(
f
*
BigFile
)
readPinWatchers
(
ctx
context
.
Context
,
blk
int64
,
blkrevMax
zodb
.
Tid
)
{
func
(
f
*
BigFile
)
readPinWatchers
(
ctx
context
.
Context
,
blk
int64
,
blkrevMax
zodb
.
Tid
)
(
err
error
)
{
defer
xerr
.
Context
(
&
err
,
"pin watchers"
)
// f.path and blk is already put into context by readBlk
// only head/ is being watched for
if
f
.
head
.
rev
!=
0
{
panic
(
"BUG: readPinWatchers: called for file under @revX/"
)
...
...
@@ -1526,7 +1533,7 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, blkrevMax zodb
var
err
error
blkrev
,
_
,
err
=
δFtail
.
BlkRevAt
(
ctx
,
f
.
zfile
,
blk
,
f
.
head
.
zconn
.
At
())
if
err
!=
nil
{
panic
(
err
)
// XXX
return
err
}
blkrevRough
=
false
...
...
@@ -1546,7 +1553,7 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, blkrevMax zodb
pinrev
,
_
,
err
:=
δFtail
.
BlkRevAt
(
ctx
,
w
.
file
.
zfile
,
blk
,
w
.
at
)
// XXX move into go?
// XXX ^^^ w.file vs f ?
if
err
!=
nil
{
panic
(
err
)
// XXX
return
err
}
//fmt.Printf("S: read #%d: watch @%s: pin -> @%s\n", blk, w.at, pinrev)
...
...
@@ -1558,10 +1565,7 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, blkrevMax zodb
}
f
.
watchMu
.
RUnlock
()
err
:=
wg
.
Wait
()
if
err
!=
nil
{
panic
(
err
)
// XXX
}
return
wg
.
Wait
()
}
// setupWatch sets up or updates a Watch when client sends `watch <file> @<at>` request.
...
...
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