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
6b23c395
Commit
6b23c395
authored
Apr 16, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0ed8303d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
wcfs/δftail.go
wcfs/δftail.go
+16
-11
No files found.
wcfs/δftail.go
View file @
6b23c395
...
...
@@ -18,7 +18,6 @@
// See https://www.nexedi.com/licensing for rationale and options.
package
main
// ΔFtail - merge btree.ΔTail with history of ZBlk
import
(
"lab.nexedi.com/kirr/neo/go/zodb"
...
...
@@ -51,8 +50,9 @@ import (
//
//
// XXX only tracked blocks.
// XXX ΔFtail - merge btree.ΔTail with history of ZBlk
type
ΔFtail
struct
{
*
xbtree
.
ΔTail
δBtail
*
xbtree
.
ΔTail
fileIdx
map
[
*
btree
.
LOBTree
]
SetBigFile
// root -> {} BigFile XXX root -> oid?
}
...
...
@@ -64,21 +64,26 @@ type ΔF struct {
func
NewΔFTail
(
at0
zodb
.
Tid
)
*
ΔFtail
{
return
&
ΔFtail
{
ΔTail
:
xbtree
.
NewΔTail
(
at0
),
δBtail
:
xbtree
.
NewΔTail
(
at0
),
fileIdx
:
make
(
map
[
*
btree
.
LOBTree
]
SetBigFile
),
}
}
// XXX
func
(
δFtail
*
ΔFtail
)
Head
()
zodb
.
Tid
{
panic
(
"TODO"
)
}
func
(
δFtail
*
ΔFtail
)
Tail
()
zodb
.
Tid
{
panic
(
"TODO"
)
}
// Track adds tree path to tracked set and associates path root with file.
//
// A root can be associated with several files (each provided on different Track call).
func
(
δ
f
*
ΔFtail
)
Track
(
file
*
BigFile
,
path
[]
btree
.
LONode
)
{
δ
f
.
ΔT
ail
.
Track
(
path
)
func
(
δ
Ftail
*
ΔFtail
)
Track
(
file
*
BigFile
,
path
[]
btree
.
LONode
)
{
δ
Ftail
.
δBt
ail
.
Track
(
path
)
root
:=
path
[
0
]
.
(
*
btree
.
LOBTree
)
files
,
ok
:=
δ
f
.
fileIdx
[
root
]
files
,
ok
:=
δ
Ftail
.
fileIdx
[
root
]
if
!
ok
{
files
=
SetBigFile
{}
δ
f
.
fileIdx
[
root
]
=
files
δ
Ftail
.
fileIdx
[
root
]
=
files
}
files
.
Add
(
file
)
}
...
...
@@ -87,7 +92,7 @@ func (δf *ΔFtail) Track(file *BigFile, path []btree.LONode) {
//
// It returns corresponding change in files space.
func
(
δFtail
*
ΔFtail
)
Update
(
δZ
*
zodb
.
EventCommit
)
ΔF
{
δB
:=
δFtail
.
ΔT
ail
.
Update
(
δZ
)
δB
:=
δFtail
.
δBt
ail
.
Update
(
δZ
)
δF
:=
ΔF
{
Rev
:
δB
.
Rev
,
Change
:
make
(
map
[
*
BigFile
]
SetI64
)}
for
root
,
δt
:=
range
δB
.
Change
{
files
:=
δFtail
.
fileIdx
[
root
]
...
...
@@ -120,9 +125,9 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) ΔF {
//
// XXX -> LastTrackedBlkRev ?
func
(
f
*
BigFile
)
LastBlkRev
(
blk
int64
,
at
zodb
.
Tid
)
(
_
zodb
.
Tid
,
exact
bool
)
{
δ
f
:=
f
.
head
.
bfdir
.
δFtail
δ
Ftail
:=
f
.
head
.
bfdir
.
δFtail
zblkOid
,
ok
,
tabRev
,
tabRevExact
:=
δ
f
.
ΔT
ail
.
Get
(
f
.
zfile
.
blktab
,
blk
,
at
)
zblkOid
,
ok
,
tabRev
,
tabRevExact
:=
δ
Ftail
.
δBt
ail
.
Get
(
f
.
zfile
.
blktab
,
blk
,
at
)
// block was removed
// XXX or not in tracked set?
...
...
@@ -134,7 +139,7 @@ func (f *BigFile) LastBlkRev(blk int64, at zodb.Tid) (_ zodb.Tid, exact bool) {
// 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
.
ΔT
ail
.
ΔZtail
.
LastRevOf
(
zblkOid
,
at
)
zblkRev
,
zblkRevExact
:=
δ
Ftail
.
δBt
ail
.
ΔZtail
.
LastRevOf
(
zblkOid
,
at
)
if
zblkRev
>
tabRev
{
return
zblkRev
,
zblkRevExact
}
else
{
...
...
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