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
3154ae82
Commit
3154ae82
authored
May 10, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a5304b31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
wcfs/wcfs.go
wcfs/wcfs.go
+14
-5
No files found.
wcfs/wcfs.go
View file @
3154ae82
...
...
@@ -607,7 +607,10 @@ type Watch struct {
// XXX locking
at
zodb
.
Tid
// requested to be watched @at
pinned
SetI64
// blocks that are already pinned to be ≤ at
// pinned SetI64 // blocks that are already pinned to be ≤ at
// {} blk -> rev
pinned
map
[
int64
]
zodb
.
Tid
// blocks that are already pinned to be ≤ at
}
// -------- 3) Cache invariant --------
...
...
@@ -1318,13 +1321,14 @@ func (w *Watch) pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) {
// XXX locking?
// XXX simultaneous calls?
// XXX rev=inf -> unpin to head
if
rev
>
w
.
at
{
panicf
(
"f<%s>: watch%d: pin #%d @%s: watch.at (%s) < rev"
,
foid
,
w
.
link
.
id
,
blk
,
rev
,
w
.
at
)
}
if
w
.
pinned
.
Has
(
blk
)
{
if
w
.
pinned
[
blk
]
==
rev
{
// XXX pinned has to be invalidated when w.at↑
return
// already pinned
}
...
...
@@ -1338,7 +1342,7 @@ func (w *Watch) pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) {
return
fmt
.
Errorf
(
"expect %q; got %q"
,
"ack"
,
ack
)
}
w
.
pinned
.
Add
(
blk
)
w
.
pinned
[
blk
]
=
rev
return
nil
}
...
...
@@ -1382,7 +1386,8 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
link
:
wlink
,
file
:
f
,
at
:
at
,
pinned
:
make
(
SetI64
),
//pinned: make(SetI64),
pinned
:
make
(
map
[
int64
]
zodb
.
Tid
),
}
// TODO register w to f here early, so that READs going in parallel to
...
...
@@ -1402,7 +1407,11 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
continue
}
toPin
[
blk
],
_
=
f
.
LastBlkRev
(
ctx
,
blk
,
at
)
//toPin[blk], _ = f.LastBlkRev(ctx, blk, at)
pinrev
,
_
:=
f
.
LastBlkRev
(
ctx
,
blk
,
at
)
if
w
.
pinned
[
blk
]
!=
pinrev
{
// XXX locking
toPin
[
blk
]
=
pinrev
}
}
}
...
...
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