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
7ed177e4
Commit
7ed177e4
authored
Jul 01, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1e985a6c
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
30 deletions
+30
-30
wcfs/internal/xbtree/xbtreetest/rtree.go
wcfs/internal/xbtree/xbtreetest/rtree.go
+1
-1
wcfs/internal/xbtree/xbtreetest/treeenv.go
wcfs/internal/xbtree/xbtreetest/treeenv.go
+29
-29
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+0
-0
No files found.
wcfs/internal/xbtree/xbtreetest/rtree.go
View file @
7ed177e4
...
...
@@ -70,7 +70,7 @@ func (rbs RBucketSet) Get(k Key) *RBucket {
}
rb
:=
rbs
[
i
]
if
!
(
rb
.
Keycov
.
Lo
<=
k
&&
k
<=
rb
.
Keycov
.
Hi_
)
{
if
!
rb
.
Keycov
.
Has
(
k
)
{
panicf
(
"BUG: get(%v) -> %s; coverage: %s"
,
k
,
rb
.
Keycov
,
rbs
.
coverage
())
}
...
...
wcfs/internal/xbtree/xbtreetest/treeenv.go
View file @
7ed177e4
...
...
@@ -42,7 +42,7 @@ type T struct {
work
string
// working directory
treeSrv
*
TreeSrv
zstor
zodb
.
IStorage
db
*
zodb
.
DB
DB
*
zodb
.
DB
// all committed trees
commitv
[]
*
Commit
...
...
@@ -50,13 +50,13 @@ type T struct {
// Commit represent test commit changing a tree.
type
Commit
struct
{
tree
string
// the tree in topology-encoding
prev
*
Commit
// previous commit
at
zodb
.
Tid
// commit revision
δZ
*
zodb
.
EventCommit
// raw ZODB changes; δZ.tid == at
xkv
RBucketSet
// full tree state as of @at
δxkv
map
[
Key
]
Δstring
// full tree-diff against parent
blkDataTab
map
[
zodb
.
Oid
]
string
// full snapshot of all ZBlk data @at XXX -> zblkDataTab
Tree
string
// the tree in topology-encoding
Prev
*
Commit
// previous commit
At
zodb
.
Tid
// commit revision
ΔZ
*
zodb
.
EventCommit
// raw ZODB changes; δZ.tid == at
Xkv
RBucketSet
// full tree state as of @at
Δxkv
map
[
Key
]
Δstring
// full tree-diff against parent
zblkDataTab
map
[
zodb
.
Oid
]
string
// full snapshot of all ZBlk data @at
// δzblkData map[zodb.Oid]Δstring // full diff for zblkData against parent XXX ?
}
...
...
@@ -81,25 +81,25 @@ func NewT(t *testing.T) *T {
err
:=
tt
.
zstor
.
Close
();
X
(
err
)
})
tt
.
db
=
zodb
.
NewDB
(
tt
.
zstor
,
&
zodb
.
DBOptions
{
tt
.
DB
=
zodb
.
NewDB
(
tt
.
zstor
,
&
zodb
.
DBOptions
{
// We need objects to be cached, because otherwise it is too
// slow to run the test for many testcases, especially
// xverifyΔBTail_rebuild.
CacheControl
:
&
tZODBCacheEverything
{},
})
t
.
Cleanup
(
func
()
{
err
:=
tt
.
db
.
Close
();
X
(
err
)
err
:=
tt
.
DB
.
Close
();
X
(
err
)
})
head
:=
tt
.
treeSrv
.
head
t1
:=
&
Commit
{
tree
:
"T/B:"
,
// treegen.py creates the tree as initially empty
prev
:
nil
,
at
:
head
,
xkv
:
xGetTree
(
tt
.
db
,
head
,
tt
.
Root
()),
blkDataTab
:
xGetBlkDataTab
(
tt
.
db
,
head
),
δZ
:
nil
,
δxkv
:
nil
,
Tree
:
"T/B:"
,
// treegen.py creates the tree as initially empty
Prev
:
nil
,
At
:
head
,
Xkv
:
xGetTree
(
tt
.
DB
,
head
,
tt
.
Root
()),
zblkDataTab
:
xGetBlkDataTab
(
tt
.
DB
,
head
),
ΔZ
:
nil
,
Δxkv
:
nil
,
}
tt
.
commitv
=
[]
*
Commit
{
t1
}
...
...
@@ -152,7 +152,7 @@ func (t *T) CommitTree(tree string) *Commit {
// if the tree does not exist yet - report its structure as empty
var
xkv
RBucketSet
if
tree
!=
DEL
{
xkv
=
xGetTree
(
t
.
db
,
δZ
.
Tid
,
t
.
Root
())
xkv
=
xGetTree
(
t
.
DB
,
δZ
.
Tid
,
t
.
Root
())
}
else
{
// empty tree with real treeRoot as oid even though the tree is
// deleted. Having real oid in the root tests that after deletion,
...
...
@@ -178,16 +178,16 @@ func (t *T) CommitTree(tree string) *Commit {
}
ttree
:=
&
Commit
{
tree
:
tree
,
at
:
δZ
.
Tid
,
δZ
:
δZ
,
xkv
:
xkv
,
blkDataTab
:
xGetBlkDataTab
(
t
.
db
,
δZ
.
Tid
),
Tree
:
tree
,
At
:
δZ
.
Tid
,
ΔZ
:
δZ
,
Xkv
:
xkv
,
zblkDataTab
:
xGetBlkDataTab
(
t
.
DB
,
δZ
.
Tid
),
}
tprev
:=
t
.
Head
()
ttree
.
p
rev
=
tprev
ttree
.
δxkv
=
kvdiff
(
tprev
.
xkv
.
Flatten
(),
ttree
.
x
kv
.
Flatten
())
ttree
.
P
rev
=
tprev
ttree
.
Δxkv
=
kvdiff
(
tprev
.
Xkv
.
Flatten
(),
ttree
.
X
kv
.
Flatten
())
t
.
commitv
=
append
(
t
.
commitv
,
ttree
)
...
...
@@ -242,16 +242,16 @@ func xGetBlkDataTab(db *zodb.DB, at zodb.Tid) map[zodb.Oid]string {
return
blkDataTab
}
//
xg
etBlkData loads blk data for ZBlk<oid> @t.at
//
XG
etBlkData loads blk data for ZBlk<oid> @t.at
//
// For speed the load is done via preloaded t.blkDataTab instead of access to the DB.
func
(
t
*
Commit
)
xg
etBlkData
(
oid
zodb
.
Oid
)
string
{
func
(
t
*
Commit
)
XG
etBlkData
(
oid
zodb
.
Oid
)
string
{
if
oid
==
VDEL
{
return
DEL
}
data
,
ok
:=
t
.
blkDataTab
[
oid
]
data
,
ok
:=
t
.
z
blkDataTab
[
oid
]
if
!
ok
{
exc
.
Raisef
(
"getBlkData ZBlk<%s> @%s: no such ZBlk"
,
oid
,
t
.
a
t
)
exc
.
Raisef
(
"getBlkData ZBlk<%s> @%s: no such ZBlk"
,
oid
,
t
.
A
t
)
}
return
data
}
...
...
wcfs/internal/xbtree/δbtail_test.go
View file @
7ed177e4
This diff is collapsed.
Click to expand it.
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