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
193f7ae2
Commit
193f7ae2
authored
May 10, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3154ae82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
18 deletions
+26
-18
wcfs/wcfs.go
wcfs/wcfs.go
+25
-18
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+1
-0
No files found.
wcfs/wcfs.go
View file @
193f7ae2
...
...
@@ -1353,26 +1353,40 @@ func (w *Watch) pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) {
// XXX called synchronously - only 1 setupWatch call at a time?
func
(
wlink
*
WatchLink
)
setupWatch
(
ctx
context
.
Context
,
foid
zodb
.
Oid
,
at
zodb
.
Tid
)
(
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"setup watch f<%s> @%s"
,
foid
,
at
)
head
:=
wlink
.
head
bfdir
:=
head
.
bfdir
// XXX locking
// XXX at = zobd.InvalidTid - remove watch
// XXX if watch was already established - we need to update it
w
:=
wlink
.
byfile
[
foid
]
if
w
!=
nil
{
panic
(
"TODO"
)
// XXX update the watch
if
w
==
nil
{
// watch was not previously established - set it up anew
// XXX locking
f
:=
bfdir
.
fileTab
[
foid
]
if
f
==
nil
{
// by "invalidation protocol" watch is setup after data file was opened
return
fmt
.
Errorf
(
"file not yet known or is not a ZBigFile"
)
}
w
=
&
Watch
{
link
:
wlink
,
file
:
f
,
at
:
at
,
//pinned: make(SetI64),
pinned
:
make
(
map
[
int64
]
zodb
.
Tid
),
}
}
// watch was not previously established - set it up anew
// XXX locking
head
:=
wlink
.
head
bfdir
:=
head
.
bfdir
f
:=
bfdir
.
fileTab
[
foid
]
if
f
==
nil
{
// by "invalidation protocol" watch is setup after data file was opened
return
fmt
.
Errorf
(
"file not yet known or is not a ZBigFile"
)
// XXX check at >= w.at
if
!
(
at
>=
w
.
at
)
{
panic
(
"TODO"
)
}
headAt
:=
head
.
zconn
.
At
()
// XXX wait head.zconn.At() ≥ at
...
...
@@ -1382,14 +1396,6 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
return
fmt
.
Errorf
(
"at is too far away back from head/at (%s)"
,
headAt
)
}
w
=
&
Watch
{
link
:
wlink
,
file
:
f
,
at
:
at
,
//pinned: make(SetI64),
pinned
:
make
(
map
[
int64
]
zodb
.
Tid
),
}
// TODO register w to f here early, so that READs going in parallel to
// us preparing and processing initial pins, also send pins for read
// blocks. If we don't, we can miss to send pin for a freshly read
...
...
@@ -1400,6 +1406,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// XXX locking
// pin all tracked file blocks that were changed in (at, head] range
f
:=
w
.
file
for
_
,
δfile
:=
range
bfdir
.
δFtail
.
SliceByFileRev
(
f
,
at
,
headAt
)
{
for
blk
:=
range
δfile
.
Blocks
{
_
,
already
:=
toPin
[
blk
]
...
...
wcfs/wcfs_test.py
View file @
193f7ae2
...
...
@@ -671,6 +671,7 @@ def watch(w, zf, at): # XXX -> ?
# send watch request and check that we receive pins for in-cache blocks
# changed > at.
# XXX use timeout to detect wcfs replying less pins.
ctx
,
cancel
=
context
.
with_cancel
(
context
.
background
())
wg
=
sync
.
WorkGroup
(
ctx
)
...
...
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