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
9214be19
Commit
9214be19
authored
Apr 16, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
790bee70
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
35 deletions
+58
-35
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+7
-1
wcfs/wcfs.go
wcfs/wcfs.go
+7
-7
wcfs/δftail.go
wcfs/δftail.go
+44
-27
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
9214be19
...
...
@@ -38,6 +38,12 @@ type Key = int64
type
Value
=
zodb
.
Oid
// XXX assumes key points to IPersistent
// XXX how to represent deletion? InvalidOid?
// XXX
//
// δB:
// .rev↑
// {} root -> {}(key, value)
// ΔTail represents tail of revisional changes to BTrees.
//
// It covers changes to keys from tracked subset of BTrees parts and
...
...
@@ -59,9 +65,9 @@ type Value = zodb.Oid // XXX assumes key points to IPersistent
// It provides the following operations:
//
// - Track(path) - start tracking tree nodes and keys; root=path[0], keys=path[-1].keys
// - ForgetPast(revCut) - forget changes past revCut
// - Get(root, key, at) - get root[key] @at assuming root[key] ∈ tracked
// - Update(δZ) - update BTree δ tail given raw ZODB changes
// - ForgetPast(revCut) - forget changes past revCut
//
// 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.
...
...
wcfs/wcfs.go
View file @
9214be19
...
...
@@ -402,10 +402,10 @@ package main
// XXX notation
//
// δZ - change
s
in ZODB space
// δB - change
s
in BTree*s* space
// δF - change
s
in File*s* space
// δfile - change
s
in File(1) space
// δZ - change in ZODB space
// δB - change in BTree*s* space
// δF - change in File*s* space
// δfile - change in File(1) space
import
(
"bufio"
...
...
@@ -801,9 +801,9 @@ retry:
//fmt.Printf("\nbtreeChangev: %v\n", btreeChangev)
δf
:=
bfdir
.
δFtail
.
Update
(
δZ
)
//fmt.Printf("xfiles: %v\n", xfiles)
for
_
,
δ
:=
range
δf
.
Changev
{
file
:=
δ
.
File
// XXX use δ.Blkv
for
file
,
δfile
:=
range
δf
.
Change
{
// XXX use δfile blocks
_
=
δfile
finv
,
ok
:=
toinvalidate
[
file
]
if
!
ok
{
finv
=
&
fileInvalidate
{}
// XXX init blkmap?
...
...
wcfs/δftail.go
View file @
9214be19
...
...
@@ -27,21 +27,39 @@ import (
"./internal/xbtree"
)
// ΔFTail is like btree.ΔTail but additionally tracks tree-root -> file relation and
// takes ZBlk history into account.
// ΔFtail represents tail of revisional changes to files.
//
// It semantically consists of
//
// []δF ; rev ∈ (tail, head]
//
// where δF represents a change in files space
//
// δF:
// .rev↑
// [](file, []blk)
//
// It provides the following operations:
//
// .Update(δZ) -> δF - update files δ tail given raw ZODB changes
// .ForgetPast(revCut) - forget changes past revCut
// .Track XXX
// .SliceByRev(lo, hi) -> []δF - query for all changes with rev ∈ (lo, hi]
// .SliceByFileRev(file, lo, hi) -> []δfile - query for changes of file with rev ∈ (lo, hi]
// .LastBlkRev(file, #blk, at) - query for what is last revision that
// changed file[#blk] as of @at database state.
//
//
// XXX only tracked blocks.
type
ΔFTail
struct
{
*
xbtree
.
ΔTail
fileIdx
map
[
*
btree
.
LOBTree
]
SetBigFile
// root -> {} BigFile XXX root -> oid?
}
type
ΔFentry
struct
{
// ΔF represents a change in files space.
type
ΔF
struct
{
Rev
zodb
.
Tid
Changev
[]
ΔFile
}
type
ΔFile
struct
{
File
*
BigFile
Blkv
[]
int64
Change
map
[
*
BigFile
]
SetI64
// file -> δfile (= {}#blk)
}
func
NewΔFTail
(
at0
zodb
.
Tid
)
*
ΔFTail
{
...
...
@@ -65,33 +83,32 @@ func (δf *ΔFTail) Track(file *BigFile, path []btree.LONode) {
files
.
Add
(
file
)
}
// XXX
func
(
δf
*
ΔFTail
)
Update
(
δZ
*
zodb
.
EventCommit
)
ΔFentry
{
δB
:=
δf
.
ΔTail
.
Update
(
δZ
)
var
changev
[]
ΔFile
// δB root -> file (via .fileIdx)
for
_
,
δ
:=
range
δB
{
files
:=
δf
.
fileIdx
[
δ
.
Root
]
// Update updates δFtail given raw ZODB changes.
//
// It returns corresponding change in files space.
func
(
δFtail
*
ΔFTail
)
Update
(
δZ
*
zodb
.
EventCommit
)
ΔF
{
δB
:=
δFtail
.
ΔTail
.
Update
(
δZ
)
δF
:=
ΔF
{
Rev
:
δB
.
Rev
,
Change
:
make
(
map
[
*
BigFile
]
SetI64
)}
for
root
,
δt
:=
range
δB
{
files
:=
δFtail
.
fileIdx
[
root
]
if
len
(
files
)
==
0
{
panicf
(
"ΔFTail: root<%s> -> ø file"
,
δ
.
R
oot
.
POid
())
panicf
(
"ΔFTail: root<%s> -> ø file"
,
r
oot
.
POid
())
}
for
file
:=
range
files
{
var
blkv
[]
int64
for
blk
/*, zblk*/
:=
range
δ
.
KV
{
δfile
,
ok
:=
δF
.
Change
[
file
]
if
!
ok
{
δfile
=
make
(
SetI64
)
δF
.
Change
[
file
]
=
δfile
}
for
blk
/*, zblk*/
:=
range
δt
.
KV
{
// FIXME stub - need to take both keys and zblk changes into account
// XXX document, and in particular how to include atTail
blkv
=
append
(
blkv
,
blk
)
δfile
.
Add
(
blk
)
}
changev
=
append
(
changev
,
ΔFile
{
File
:
file
,
Blkv
:
blkv
,
})
}
}
return
ΔFentry
{
Rev
:
δZ
.
Tid
,
Changev
:
changev
,
}
return
δF
}
// LastBlkRev returns last revision that changed file[blk] as of @at database state.
...
...
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