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
eb8703df
Commit
eb8703df
authored
Jul 11, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1a10f6bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
5 deletions
+45
-5
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+1
-0
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+44
-5
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
eb8703df
...
...
@@ -806,6 +806,7 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
// either use @tail[key], if it is present, or @head[key]
rev
=
δBtail
.
Tail
()
revExact
=
false
// XXX kill KVAtTail completely
value
,
ok
=
δTtail
.
KVAtTail
[
key
]
// XXX kill - just use δvalue.Old from next-to-at entry
if
ok
{
return
...
...
wcfs/internal/zdata/δftail_test.go
View file @
eb8703df
...
...
@@ -201,10 +201,11 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
}
// data built via applying changes from testv
vδf
:=
[]
*
ΔFile
{}
// (rev↑, {}blk)
blkTab
:=
map
[
int64
]
string
{}
// #blk -> ZBlk<name>
dataTab
:=
map
[
string
]
string
{}
// ZBlk<name> -> data
Zinblk
:=
map
[
string
]
setI64
{}
// ZBlk<name> -> which #blk refer to it
vδf
:=
[]
*
ΔFile
{}
// (rev↑, {}blk)
blkTab
:=
map
[
int64
]
string
{}
// #blk -> ZBlk<name>
dataTab
:=
map
[
string
]
string
{}
// ZBlk<name> -> data
Zinblk
:=
map
[
string
]
setI64
{}
// ZBlk<name> -> which #blk refer to it
blkRevAt
:=
map
[
zodb
.
Tid
]
map
[
int64
]
zodb
.
Tid
{}
// {} at -> {} #blk -> rev
// initialize dataTab from root['treegen/values']
for
/*oid*/
_
,
zblki
:=
range
t
.
Head
()
.
ZBlkTab
{
...
...
@@ -276,6 +277,19 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
dTxt
:=
"D"
+
dataTabTxt
(
dataTab
)
commit
:=
t
.
CommitTree
(
tTxt
+
" "
+
dTxt
)
// update blkRevAt
var
blkRevPrev
map
[
int64
]
zodb
.
Tid
if
i
!=
0
{
blkRevPrev
=
blkRevAt
[
δftail
.
Head
()]
}
blkRev
:=
map
[
int64
]
zodb
.
Tid
{}
for
blk
,
rev
:=
range
blkRevPrev
{
blkRev
[
blk
]
=
rev
}
for
blk
:=
range
δblk
{
blkRev
[
blk
]
=
commit
.
At
}
var
δfok
*
ΔFile
if
len
(
δblk
)
!=
0
{
δfok
=
&
ΔFile
{
...
...
@@ -375,7 +389,32 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
}
// XXX LastBlkRev
// LastBlkRev
blkv
:=
[]
int64
{}
// all blocks
for
blk
:=
range
blkRevAt
[
vδf
[
len
(
vδf
)
-
1
]
.
Rev
]
{
blkv
=
append
(
blkv
,
blk
)
}
blkv
=
append
(
blkv
,
1E4
/*this block is hole*/
)
sort
.
Slice
(
blkv
,
func
(
i
,
j
int
)
bool
{
return
blkv
[
i
]
<
blkv
[
j
]
})
for
j
:=
0
;
j
<
len
(
vδf
);
j
++
{
at
:=
vδf
[
j
]
.
Rev
blkRev
:=
blkRevAt
[
at
]
for
_
,
blk
:=
range
blkv
{
rev
,
exact
:=
δftail
.
LastBlkRev
(
ctx
,
zfile
,
blk
,
at
)
revOK
,
exactOK
:=
blkRev
[
blk
],
true
if
revOK
<=
δftail
.
Tail
()
{
revOK
,
exactOK
=
δftail
.
Tail
(),
false
}
if
!
(
rev
==
revOK
&&
exact
==
exactOK
)
{
t
.
Errorf
(
"blkrev #%d @%s:
\n
have: @%s, %v
\n
want: @%s, %v"
,
blk
,
at
,
rev
,
exact
,
revOK
,
exactOK
)
}
}
}
}
}
...
...
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