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
bb321bc9
Commit
bb321bc9
authored
Apr 15, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1f35db44
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
30 deletions
+13
-30
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+4
-3
wcfs/wcfs.go
wcfs/wcfs.go
+5
-3
wcfs/δftail.go
wcfs/δftail.go
+4
-24
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
bb321bc9
...
...
@@ -58,6 +58,8 @@ type Value = zodb.Oid // XXX assumes key points to IPersistent
//
// XXX which operations are provided.
//
// - GetAt(root, key, at)
//
// An example for tracked set is a set of visited BTree paths.
// There is no requirement that tracked set belongs to only one single BTree.
//
...
...
@@ -67,7 +69,8 @@ type Value = zodb.Oid // XXX assumes key points to IPersistent
// XXX incremental; not full coverage
// XXX see also zodb.ΔTail .
//
// ΔTail is not safe for concurrent access. XXX -> is safe to use from multiple goroutines simultaneously.
// ΔTail is not safe for concurrent access.
// XXX -> multiple readers / single writer?
type
ΔTail
struct
{
// XXX -> δZtail
ΔZtail
*
zodb
.
ΔTail
// raw ZODB changes; Kept to rebuild δBtail/byRoot after new Track
...
...
@@ -238,8 +241,6 @@ func (btail *ΔTail) Update(δZ *zodb.EventCommit) []ΔTree {
//
// XXX at must ∈ (tail, head] XXX [tail ?
// XXX key must be tracked?
//
// XXX -> meth of ΔTreeTail ?
func
(
btail
*
ΔTail
)
GetAt
(
root
*
Tree
,
key
Key
,
at
zodb
.
Tid
)
(
value
Value
,
ok
bool
,
rev
zodb
.
Tid
,
revExact
bool
)
{
// XXX key not tracked -> panic
// XXX at not ∈ (tail, head] -> panic
...
...
wcfs/wcfs.go
View file @
bb321bc9
...
...
@@ -501,7 +501,7 @@ type BigFileDir struct {
// δ of tracked BTree nodes of all BigFiles + -> which file
// (used only for head/, not revX/)
δFmu
sync
.
Mutex
// XXX move into -> ΔFTail ?
δFmu
sync
.
RWMutex
δFtail
*
ΔFTail
}
...
...
@@ -1338,8 +1338,6 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// XXX wait wlink.head.zconn.At() ≥ at
// XXX <~> f.δtail.Head() ≥ at (?)
// XXX locking
if
at
<
bfdir
.
δFtail
.
Tail
()
{
// XXX err += head.at?
return
fmt
.
Errorf
(
"at is too far away back from head/at"
)
...
...
@@ -1347,6 +1345,10 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
toPin
:=
map
[
int64
]
zodb
.
Tid
{}
// blk -> @rev
// XXX locking ok?
bfdir
.
δFmu
.
RLock
()
defer
bfdir
.
δFmu
.
RUnlock
()
/* XXX reenable
// FIXME (!!!) since f.δtail does not have all changes to f, here we
...
...
wcfs/δftail.go
View file @
bb321bc9
...
...
@@ -94,39 +94,17 @@ func (δf *ΔFTail) Update(δZ *zodb.EventCommit) ΔFentry {
}
}
/* XXX kill
// LastRevOf return last_rev file[blk] @at XXX
//
// XXX -> merge into ZBigFile.LoadBlk?
// XXX ZBigFile.LoadBlk(blk) -> blkdata, rev
//
// XXX no - cannot merge - f.LastBlkRev is used for both @head (where we have
// zblk.rev) and for @w.at, where we don't have zblk.rev because we was not
// handling load and just need to pin watcher with the result.
func (δf *ΔFTail) LastRevOf(file *BigFile, blk int64, at zodb.Tid) (_ zodb.Tid, exact bool) {
// revision of when blktab[blk] entry changed last.
treeKeyRev, exact := δf.ΔTail.LastRevOf(file.zfile.blktab, blk, at) // XXX activate?
_ = treeKeyRev
// blktab[blk] is only a pointer (to ZBlk) and ZBlk could itself have
// been changing after treeKeyRev. We have to check for that.
panic("TODO")
}
*/
// LastBlkRev returns last revision that changed file[blk] as of @at database state.
//
// if exact=False - what is returned is only an upper bound for last block revision.
//
// at must ∈ (tail, head] XXX [tail ?
// XXX blk must be tracked?
//
// XXX -> LastTrackedBlkRev ?
func
(
f
*
BigFile
)
LastBlkRev
(
blk
int64
,
at
zodb
.
Tid
)
(
_
zodb
.
Tid
,
exact
bool
)
{
δf
:=
f
.
head
.
bfdir
.
δFtail
// revision of when blktab[blk] entry changed last.
//treeKeyRev, exact := δf.ΔTail.LastRevOf(f.zfile.blktab, blk, at) // XXX activate?
zblkOid
,
ok
,
tabRev
,
tabRevExact
:=
δf
.
ΔTail
.
GetAt
(
f
.
zfile
.
blktab
,
blk
,
at
)
// block was removed
...
...
@@ -137,6 +115,8 @@ func (f *BigFile) LastBlkRev(blk int64, at zodb.Tid) (_ zodb.Tid, exact bool) {
// blktab[blk] was changed to point to a zblk @rev.
// blk revision is max rev and when zblk changed last in (rev, at] range.
//
// XXX need to use full δZ, not only connected to tracked subset?
zblkRev
,
zblkRevExact
:=
δf
.
ΔTail
.
ΔZtail
.
LastRevOf
(
zblkOid
,
at
)
if
zblkRev
>
tabRev
{
return
zblkRev
,
zblkRevExact
...
...
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