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
00b1a6ab
Commit
00b1a6ab
authored
Apr 17, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
35245f42
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
40 deletions
+37
-40
wcfs/zset_object.go
wcfs/zset_object.go
+1
-1
wcfs/zset_tree.go
wcfs/zset_tree.go
+1
-1
wcfs/zδtail_i64.go
wcfs/zδtail_i64.go
+1
-1
wcfs/δbtail.go
wcfs/δbtail.go
+31
-32
wcfs/δftail.go
wcfs/δftail.go
+3
-5
No files found.
wcfs/
internal/xbtree/
zset_object.go
→
wcfs/zset_object.go
View file @
00b1a6ab
...
...
@@ -19,7 +19,7 @@
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
package
xbtree
package
main
// SetObject is a set of interface{}.
type
SetObject
map
[
interface
{}]
struct
{}
...
...
wcfs/
internal/xbtree/
zset_tree.go
→
wcfs/zset_tree.go
View file @
00b1a6ab
...
...
@@ -19,7 +19,7 @@
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
package
xbtree
package
main
// SetTree is a set of *Tree.
type
SetTree
map
[
*
Tree
]
struct
{}
...
...
wcfs/zδtail_i64.go
View file @
00b1a6ab
// Code generated by gen-δtail I64 int64; DO NOT EDIT.
// (from lab.nexedi.com/kirr/neo/go/zodb @ v1.9-224
2-g1b838adf
)
// (from lab.nexedi.com/kirr/neo/go/zodb @ v1.9-224
3-g8708ccde
)
// Copyright (C) 2018-2019 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
...
...
wcfs/
internal/xbtree/
δbtail.go
→
wcfs/δbtail.go
View file @
00b1a6ab
...
...
@@ -17,14 +17,12 @@
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// Package xbtree complements package lab.nexedi.com/kirr/neo/go/zodb/btree.
//
package
main
//
XXX -> Package xbtree complements package lab.nexedi.com/kirr/neo/go/zodb/btree.
// TODO move -> btree when ΔTail matures.
package
xbtree
//go:generate ../../gen-set xbtree Tree *Tree zset_tree.go
// //go:generate ../../gen-set xbtree Oid zodb.Oid zset_oid.go
//go:generate ../../gen-set xbtree Object interface{} zset_object.go
//go:generate ./gen-set main Tree *Tree zset_tree.go
//go:generate ./gen-set main Object interface{} zset_object.go
import
(
"context"
...
...
@@ -42,7 +40,7 @@ type Key = int64
type
Value
=
zodb
.
Oid
// XXX assumes key points to IPersistent
// XXX how to represent deletion? InvalidOid?
// ΔTail represents tail of revisional changes to BTrees.
// Δ
B
Tail represents tail of revisional changes to BTrees.
//
// It semantically consists of
//
...
...
@@ -64,7 +62,7 @@ type Value = zodb.Oid // XXX assumes key points to IPersistent
// In particular a key that was not explicitly requested to be tracked, even if
// it was changes in δZ, is not guaranted to be present in δB.
//
// ΔTail provides the following operations:
// Δ
B
Tail provides the following operations:
//
// .Track(path) - start tracking tree nodes and keys; root=path[0], keys=path[-1].keys
//
...
...
@@ -81,11 +79,10 @@ 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.
// Δ
B
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
type
ΔBtail
struct
{
δZtail
*
zodb
.
ΔTail
// raw ZODB changes; Kept to rebuild δBtail/byRoot after new Track
δRtail
[]
ΔRoots
// which BTree were changed; Noted only by keys ∈ tracket subset
byRoot
map
[
*
Tree
]
*
ΔTreeTail
// root -> k/v change history; only for keys ∈ tracket subset
...
...
@@ -114,7 +111,9 @@ type ΔRoots struct {
// ΔTreeTail represent tail of revisional changes to one BTree.
//
// See ΔTail documentation for details.
// See ΔBTail documentation for details.
//
// XXX -> ΔTtail
type
ΔTreeTail
struct
{
vδT
[]
ΔTree
// changes to tree keys; rev↑. covers keys ∈ tracket subset
...
...
@@ -132,27 +131,27 @@ type ΔTree struct {
KV
map
[
Key
]
Value
}
// NewΔ
Tail creats new empty Δ
Tail object.
// NewΔ
Btail creats new empty ΔB
Tail object.
//
// Initial tracked set is empty.
// Initial coverage is (at₀, at₀].
func
NewΔ
Tail
(
at0
zodb
.
Tid
)
*
ΔT
ail
{
return
&
Δ
T
ail
{
Δ
Ztail
:
zodb
.
NewΔTail
(
at0
),
func
NewΔ
Btail
(
at0
zodb
.
Tid
)
*
ΔBt
ail
{
return
&
Δ
Bt
ail
{
δ
Ztail
:
zodb
.
NewΔTail
(
at0
),
byRoot
:
make
(
map
[
*
Tree
]
*
ΔTreeTail
),
trackIdx
:
make
(
map
[
zodb
.
Oid
]
SetTree
),
}
}
// Head is similar to zodb.ΔTail.Head . XXX ok?
func
(
δ
b
*
ΔT
ail
)
Head
()
zodb
.
Tid
{
func
(
δ
Btail
*
ΔBt
ail
)
Head
()
zodb
.
Tid
{
//return δb.head
return
δ
b
.
Δ
Ztail
.
Head
()
return
δ
Btail
.
δ
Ztail
.
Head
()
}
// Tail is similar to zodb.ΔTail.Tail . XXX ok?
func
(
δ
b
*
ΔT
ail
)
Tail
()
zodb
.
Tid
{
return
δ
b
.
Δ
Ztail
.
Tail
()
func
(
δ
Btail
*
ΔBt
ail
)
Tail
()
zodb
.
Tid
{
return
δ
Btail
.
δ
Ztail
.
Tail
()
}
// XXX SliceByRev?
...
...
@@ -169,7 +168,7 @@ func (δb *ΔTail) Tail() zodb.Tid {
// XXX path -> []oid ?
//
// XXX catch cycles on add?
func
(
δ
b
*
ΔT
ail
)
Track
(
path
[]
Node
)
{
// XXX Tree|Bucket; path[0] = root
func
(
δ
Btail
*
ΔBt
ail
)
Track
(
path
[]
Node
)
{
// XXX Tree|Bucket; path[0] = root
l
:=
len
(
path
)
if
l
==
0
{
panic
(
"empty path"
)
...
...
@@ -179,10 +178,10 @@ func (δb *ΔTail) Track(path []Node) { // XXX Tree|Bucket; path[0] = root
for
_
,
node
:=
range
path
{
oid
:=
node
.
POid
()
nodeRoots
,
ok
:=
δ
b
.
trackIdx
[
oid
]
nodeRoots
,
ok
:=
δ
Btail
.
trackIdx
[
oid
]
if
!
ok
{
nodeRoots
=
make
(
SetTree
)
δ
b
.
trackIdx
[
oid
]
=
nodeRoots
δ
Btail
.
trackIdx
[
oid
]
=
nodeRoots
// XXX .trackNew += oid
}
nodeRoots
.
Add
(
root
)
...
...
@@ -197,13 +196,13 @@ func (δb *ΔTail) Track(path []Node) { // XXX Tree|Bucket; path[0] = root
// Only those objects from δZ that belong to tracked set are guaranteed to be
// taken into account. In other words a tree history will assuredly include
// only those keys, that correspond to tracked subset of δZ.
func
(
btail
*
ΔT
ail
)
Update
(
δZ
*
zodb
.
EventCommit
)
Δ
{
btail
.
Δ
Ztail
.
Append
(
δZ
.
Tid
,
δZ
.
Changev
)
func
(
δBtail
*
ΔBt
ail
)
Update
(
δZ
*
zodb
.
EventCommit
)
Δ
{
δBtail
.
δ
Ztail
.
Append
(
δZ
.
Tid
,
δZ
.
Changev
)
// {} root -> []oid changed under that root
δZByRoot
:=
map
[
*
Tree
][]
zodb
.
Oid
{}
// XXX -> map[*Tree]SetOid ?
for
_
,
δ
:=
range
δZ
.
Changev
{
roots
,
ok
:=
b
tail
.
trackIdx
[
δ
]
roots
,
ok
:=
δB
tail
.
trackIdx
[
δ
]
if
!
ok
{
continue
}
...
...
@@ -249,14 +248,14 @@ func (btail *ΔTail) Update(δZ *zodb.EventCommit) Δ {
*/
}
func
(
btail
*
ΔT
ail
)
ForgetPast
(
revCut
zodb
.
Tid
)
{
btail
.
Δ
Ztail
.
ForgetPast
(
revCut
)
// XXX stub
func
(
δBtail
*
ΔBt
ail
)
ForgetPast
(
revCut
zodb
.
Tid
)
{
δBtail
.
δ
Ztail
.
ForgetPast
(
revCut
)
// XXX stub
}
// update brings .δBtail up to date by recomputing diff XXX and taking new
// entries in .δZtail into account.
// func (
btail *ΔT
ail) update()
// func (
δBtail *ΔBt
ail) update()
// Get returns root[key] as of @at database state plus revision that changed it.
//
...
...
@@ -264,8 +263,8 @@ func (btail *ΔTail) ForgetPast(revCut zodb.Tid) {
//
// XXX at must ∈ (tail, head] XXX [tail ?
// XXX key must be tracked
func
(
δΒtail
*
Δ
T
ail
)
Get
(
ctx
context
.
Context
,
root
*
Tree
,
key
Key
,
at
zodb
.
Tid
)
(
value
Value
,
ok
bool
,
rev
zodb
.
Tid
,
revExact
bool
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"δBtail: root<%s>: get %
s
@%s"
,
root
.
POid
(),
key
,
at
)
func
(
δΒtail
*
Δ
Bt
ail
)
Get
(
ctx
context
.
Context
,
root
*
Tree
,
key
Key
,
at
zodb
.
Tid
)
(
value
Value
,
ok
bool
,
rev
zodb
.
Tid
,
revExact
bool
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"δBtail: root<%s>: get %
d
@%s"
,
root
.
POid
(),
key
,
at
)
// XXX key not tracked -> panic
// XXX at not ∈ (tail, head] -> panic
...
...
wcfs/δftail.go
View file @
00b1a6ab
...
...
@@ -24,8 +24,6 @@ import (
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
"./internal/xbtree"
)
// ΔFtail represents tail of revisional changes to files.
...
...
@@ -64,7 +62,7 @@ import (
// XXX see also zodb.ΔTail
type
ΔFtail
struct
{
// ΔFtail merge btree.ΔTail with history of ZBlk
δBtail
*
xbtree
.
ΔT
ail
δBtail
*
ΔBt
ail
fileIdx
map
[
*
btree
.
LOBTree
]
SetBigFile
// root -> {} BigFile XXX root -> oid?
}
...
...
@@ -80,7 +78,7 @@ type ΔF struct {
// Initial coverage of created ΔFtail is (at₀, at₀].
func
NewΔFtail
(
at0
zodb
.
Tid
)
*
ΔFtail
{
return
&
ΔFtail
{
δBtail
:
xbtree
.
NewΔT
ail
(
at0
),
δBtail
:
NewΔBt
ail
(
at0
),
fileIdx
:
make
(
map
[
*
btree
.
LOBTree
]
SetBigFile
),
}
}
...
...
@@ -179,7 +177,7 @@ func (f *BigFile) LastBlkRev(ctx context.Context, blk int64, at zodb.Tid) (_ zod
// 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
:=
δFtail
.
δBtail
.
Δ
Ztail
.
LastRevOf
(
zblkOid
,
at
)
zblkRev
,
zblkRevExact
:=
δFtail
.
δBtail
.
δ
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