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 {
...
@@ -70,7 +70,7 @@ func (rbs RBucketSet) Get(k Key) *RBucket {
}
}
rb
:=
rbs
[
i
]
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
())
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 {
...
@@ -42,7 +42,7 @@ type T struct {
work
string
// working directory
work
string
// working directory
treeSrv
*
TreeSrv
treeSrv
*
TreeSrv
zstor
zodb
.
IStorage
zstor
zodb
.
IStorage
db
*
zodb
.
DB
DB
*
zodb
.
DB
// all committed trees
// all committed trees
commitv
[]
*
Commit
commitv
[]
*
Commit
...
@@ -50,13 +50,13 @@ type T struct {
...
@@ -50,13 +50,13 @@ type T struct {
// Commit represent test commit changing a tree.
// Commit represent test commit changing a tree.
type
Commit
struct
{
type
Commit
struct
{
tree
string
// the tree in topology-encoding
Tree
string
// the tree in topology-encoding
prev
*
Commit
// previous commit
Prev
*
Commit
// previous commit
at
zodb
.
Tid
// commit revision
At
zodb
.
Tid
// commit revision
δZ
*
zodb
.
EventCommit
// raw ZODB changes; δZ.tid == at
ΔZ
*
zodb
.
EventCommit
// raw ZODB changes; δZ.tid == at
xkv
RBucketSet
// full tree state as of @at
Xkv
RBucketSet
// full tree state as of @at
δxkv
map
[
Key
]
Δstring
// full tree-diff against parent
Δxkv
map
[
Key
]
Δstring
// full tree-diff against parent
blkDataTab
map
[
zodb
.
Oid
]
string
// full snapshot of all ZBlk data @at XXX -> zblkDataTab
zblkDataTab
map
[
zodb
.
Oid
]
string
// full snapshot of all ZBlk data @at
// δzblkData map[zodb.Oid]Δstring // full diff for zblkData against parent XXX ?
// δzblkData map[zodb.Oid]Δstring // full diff for zblkData against parent XXX ?
}
}
...
@@ -81,25 +81,25 @@ func NewT(t *testing.T) *T {
...
@@ -81,25 +81,25 @@ func NewT(t *testing.T) *T {
err
:=
tt
.
zstor
.
Close
();
X
(
err
)
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
// We need objects to be cached, because otherwise it is too
// slow to run the test for many testcases, especially
// slow to run the test for many testcases, especially
// xverifyΔBTail_rebuild.
// xverifyΔBTail_rebuild.
CacheControl
:
&
tZODBCacheEverything
{},
CacheControl
:
&
tZODBCacheEverything
{},
})
})
t
.
Cleanup
(
func
()
{
t
.
Cleanup
(
func
()
{
err
:=
tt
.
db
.
Close
();
X
(
err
)
err
:=
tt
.
DB
.
Close
();
X
(
err
)
})
})
head
:=
tt
.
treeSrv
.
head
head
:=
tt
.
treeSrv
.
head
t1
:=
&
Commit
{
t1
:=
&
Commit
{
tree
:
"T/B:"
,
// treegen.py creates the tree as initially empty
Tree
:
"T/B:"
,
// treegen.py creates the tree as initially empty
prev
:
nil
,
Prev
:
nil
,
at
:
head
,
At
:
head
,
xkv
:
xGetTree
(
tt
.
db
,
head
,
tt
.
Root
()),
Xkv
:
xGetTree
(
tt
.
DB
,
head
,
tt
.
Root
()),
blkDataTab
:
xGetBlkDataTab
(
tt
.
db
,
head
),
zblkDataTab
:
xGetBlkDataTab
(
tt
.
DB
,
head
),
δZ
:
nil
,
ΔZ
:
nil
,
δxkv
:
nil
,
Δxkv
:
nil
,
}
}
tt
.
commitv
=
[]
*
Commit
{
t1
}
tt
.
commitv
=
[]
*
Commit
{
t1
}
...
@@ -152,7 +152,7 @@ func (t *T) CommitTree(tree string) *Commit {
...
@@ -152,7 +152,7 @@ func (t *T) CommitTree(tree string) *Commit {
// if the tree does not exist yet - report its structure as empty
// if the tree does not exist yet - report its structure as empty
var
xkv
RBucketSet
var
xkv
RBucketSet
if
tree
!=
DEL
{
if
tree
!=
DEL
{
xkv
=
xGetTree
(
t
.
db
,
δZ
.
Tid
,
t
.
Root
())
xkv
=
xGetTree
(
t
.
DB
,
δZ
.
Tid
,
t
.
Root
())
}
else
{
}
else
{
// empty tree with real treeRoot as oid even though the tree is
// empty tree with real treeRoot as oid even though the tree is
// deleted. Having real oid in the root tests that after deletion,
// deleted. Having real oid in the root tests that after deletion,
...
@@ -178,16 +178,16 @@ func (t *T) CommitTree(tree string) *Commit {
...
@@ -178,16 +178,16 @@ func (t *T) CommitTree(tree string) *Commit {
}
}
ttree
:=
&
Commit
{
ttree
:=
&
Commit
{
tree
:
tree
,
Tree
:
tree
,
at
:
δZ
.
Tid
,
At
:
δZ
.
Tid
,
δZ
:
δZ
,
ΔZ
:
δZ
,
xkv
:
xkv
,
Xkv
:
xkv
,
blkDataTab
:
xGetBlkDataTab
(
t
.
db
,
δZ
.
Tid
),
zblkDataTab
:
xGetBlkDataTab
(
t
.
DB
,
δZ
.
Tid
),
}
}
tprev
:=
t
.
Head
()
tprev
:=
t
.
Head
()
ttree
.
p
rev
=
tprev
ttree
.
P
rev
=
tprev
ttree
.
δxkv
=
kvdiff
(
tprev
.
xkv
.
Flatten
(),
ttree
.
x
kv
.
Flatten
())
ttree
.
Δxkv
=
kvdiff
(
tprev
.
Xkv
.
Flatten
(),
ttree
.
X
kv
.
Flatten
())
t
.
commitv
=
append
(
t
.
commitv
,
ttree
)
t
.
commitv
=
append
(
t
.
commitv
,
ttree
)
...
@@ -242,16 +242,16 @@ func xGetBlkDataTab(db *zodb.DB, at zodb.Tid) map[zodb.Oid]string {
...
@@ -242,16 +242,16 @@ func xGetBlkDataTab(db *zodb.DB, at zodb.Tid) map[zodb.Oid]string {
return
blkDataTab
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.
// 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
{
if
oid
==
VDEL
{
return
DEL
return
DEL
}
}
data
,
ok
:=
t
.
blkDataTab
[
oid
]
data
,
ok
:=
t
.
z
blkDataTab
[
oid
]
if
!
ok
{
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
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