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
75cbf7be
Commit
75cbf7be
authored
Jun 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
effb897e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
17 deletions
+27
-17
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+27
-17
No files found.
wcfs/δbtail_test.go
View file @
75cbf7be
...
...
@@ -391,29 +391,39 @@ func xwalkDFS(ctx context.Context, lo, hi Key, ztree *Tree, bvisit func(*RBucket
}
// XGet
KV translates {k -> <oid>} to {k -> ZBlk(oid).data} according to db@at snapshot
.
func
XGet
KV
(
db
*
zodb
.
DB
,
at
zodb
.
Tid
,
kvOid
map
[
Key
]
Value
)
map
[
Key
]
string
{
defer
exc
.
Contextf
(
"%s:
@%s: get kv %v"
,
db
.
Storage
()
.
URL
(),
at
,
kvOid
)
// XGet
δKV translates {k -> δ<oid>} to {k -> δ(ZBlk(oid).data)} according to db@at1..at2 snapshots
.
func
XGet
δKV
(
db
*
zodb
.
DB
,
at1
,
at2
zodb
.
Tid
,
δkvOid
map
[
Key
]
ΔValue
)
map
[
Key
]
Δ
string
{
defer
exc
.
Contextf
(
"%s:
get δkv %s..%s %v"
,
db
.
Storage
()
.
URL
(),
at1
,
at2
,
δ
kvOid
)
X
:=
exc
.
Raiseif
txn
,
ctx
:=
transaction
.
New
(
context
.
Background
())
defer
txn
.
Abort
()
zconn
,
err
:=
db
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{
At
:
at
});
X
(
err
)
kv
:=
map
[
Key
]
string
{}
for
k
,
vOid
:=
range
kvOid
{
if
vOid
==
VDEL
{
kv
[
k
]
=
DEL
continue
zconn1
,
err
:=
db
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{
At
:
at1
});
X
(
err
)
zconn2
,
err
:=
db
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{
At
:
at2
});
X
(
err
)
δkv
:=
map
[
Key
]
Δstring
{}
for
k
,
δvOid
:=
range
δkvOid
{
δkv
[
k
]
=
Δstring
{
Old
:
xzgetBlkData
(
ctx
,
zconn1
,
δvOid
.
Old
),
New
:
xzgetBlkData
(
ctx
,
zconn2
,
δvOid
.
New
),
}
}
xv
,
err
:=
zconn
.
Get
(
ctx
,
vOid
);
X
(
err
)
zv
:=
xv
.
(
zBlk
)
data
,
_
,
err
:=
zv
.
loadBlkData
(
ctx
);
X
(
err
)
kv
[
k
]
=
string
(
data
)
return
δkv
}
// xzgetBlkData loads block data from ZBlk object specified by its oid.
func
xzgetBlkData
(
ctx
context
.
Context
,
zconn
*
zodb
.
Connection
,
zblkOid
zodb
.
Oid
)
string
{
X
:=
exc
.
Raiseif
if
zblkOid
==
VDEL
{
return
DEL
}
return
kv
xblk
,
err
:=
zconn
.
Get
(
ctx
,
zblkOid
);
X
(
err
)
zblk
:=
xblk
.
(
zBlk
)
data
,
_
,
err
:=
zblk
.
loadBlkData
(
ctx
);
X
(
err
)
return
string
(
data
)
}
...
...
@@ -596,8 +606,8 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
// δT <- δB
δToid
:=
δB
.
ByRoot
[
treeRoot
]
// {} k -> δoid
δT
=
XGet
KV
(
db
,
at2
,
δToid
)
// {} k -> ZBlk(oid).data
δToid
:=
δB
.
ByRoot
[
treeRoot
]
// {} k -> δoid
δT
=
XGet
δKV
(
db
,
at1
,
at2
,
δToid
)
// {} k -> δ(ZBlk(oid).data)
// δT must be subset of d12.
// changed keys, that are
...
...
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