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
d4805b37
Commit
d4805b37
authored
May 16, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ee67e0b9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
7 deletions
+97
-7
wcfs/set.go.in
wcfs/set.go.in
+16
-0
wcfs/zset_bigfile.go
wcfs/zset_bigfile.go
+16
-0
wcfs/zset_i64.go
wcfs/zset_i64.go
+16
-0
wcfs/zset_oid.go
wcfs/zset_oid.go
+16
-0
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+33
-7
No files found.
wcfs/set.go.in
View file @
d4805b37
...
...
@@ -113,3 +113,19 @@ func (s Set) SymmetricDifference(t Set) Set {
}
return
d
}
//
Equal
returns
whether
a
==
b
.
func
(
a
Set
)
Equal
(
b
Set
)
bool
{
if
len
(
a
)
!= len(b) {
return
false
}
for
v
:=
range
a
{
_
,
ok
:=
b
[
v
]
if
!ok {
return
false
}
}
return
true
}
wcfs/zset_bigfile.go
View file @
d4805b37
...
...
@@ -115,3 +115,19 @@ func (s SetBigFile) SymmetricDifference(t SetBigFile) SetBigFile {
}
return
d
}
// Equal returns whether a == b.
func
(
a
SetBigFile
)
Equal
(
b
SetBigFile
)
bool
{
if
len
(
a
)
!=
len
(
b
)
{
return
false
}
for
v
:=
range
a
{
_
,
ok
:=
b
[
v
]
if
!
ok
{
return
false
}
}
return
true
}
wcfs/zset_i64.go
View file @
d4805b37
...
...
@@ -115,3 +115,19 @@ func (s SetI64) SymmetricDifference(t SetI64) SetI64 {
}
return
d
}
// Equal returns whether a == b.
func
(
a
SetI64
)
Equal
(
b
SetI64
)
bool
{
if
len
(
a
)
!=
len
(
b
)
{
return
false
}
for
v
:=
range
a
{
_
,
ok
:=
b
[
v
]
if
!
ok
{
return
false
}
}
return
true
}
wcfs/zset_oid.go
View file @
d4805b37
...
...
@@ -115,3 +115,19 @@ func (s SetOid) SymmetricDifference(t SetOid) SetOid {
}
return
d
}
// Equal returns whether a == b.
func
(
a
SetOid
)
Equal
(
b
SetOid
)
bool
{
if
len
(
a
)
!=
len
(
b
)
{
return
false
}
for
v
:=
range
a
{
_
,
ok
:=
b
[
v
]
if
!
ok
{
return
false
}
}
return
true
}
wcfs/δbtail_test.go
View file @
d4805b37
...
...
@@ -572,7 +572,7 @@ func (kadj KAdjMatrix) Map(keys SetKey) SetKey {
//
// KAdj itself is verified by testΔBTail on entries with .kadjOK set.
func
KAdj
(
t1
,
t2
*
tTreeCommit
,
keysv
...
SetKey
)
(
kadj
KAdjMatrix
)
{
//
XXX vvv verifies tha
t KAdj(A,B) == KAdj(B,A)
//
asser
t KAdj(A,B) == KAdj(B,A)
kadj12
:=
_KAdj
(
t1
,
t2
,
keysv
...
)
kadj21
:=
_KAdj
(
t2
,
t1
,
keysv
...
)
if
!
reflect
.
DeepEqual
(
kadj12
,
kadj21
)
{
...
...
@@ -879,6 +879,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
fmt
.
Printf
(
"@%s: %v
\n
"
,
xat
[
t1
.
at
],
t1
.
xkv
.
Flatten
())
fmt
.
Printf
(
"@%s: %v
\n
"
,
xat
[
t2
.
at
],
t2
.
xkv
.
Flatten
())
kadj01
:=
KAdj
(
t0
,
t1
,
allTestKeys
(
t0
,
t1
,
t2
))
kadj10
:=
KAdj
(
t1
,
t0
,
allTestKeys
(
t0
,
t1
,
t2
))
kadj21
:=
KAdj
(
t2
,
t1
,
allTestKeys
(
t0
,
t1
,
t2
))
kadj12
:=
KAdj
(
t1
,
t2
,
allTestKeys
(
t0
,
t1
,
t2
))
...
...
@@ -922,7 +923,8 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
t
.
Run
((
" →"
+
t2
.
tree
),
func
(
t
*
testing
.
T
)
{
// tracked keys1 becomes tracked keys1_2 after Update(t1->t2)
keys1_2
:=
kadj12
.
Map
(
keys1
)
// keys1_2 := kadj12.Map(keys1)
keys1_2
:=
kadj12
.
Map
(
kadj01
.
Map
(
keys1_0
))
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
t1
,
t2
,
xat
,
/*trackSet=*/
t2
.
xkv
.
trackSet
(
keys1_2
))
// tRestKeys2 = tAllKeys - keys1
...
...
@@ -934,13 +936,36 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
keys2
.
Add
(
tRestKeyv2
[
idx2
])
}
// find out full set of keys that should become tracked after
// Track(keys2) + rebuild
keys12R
:=
keys1_2
.
Union
(
keys2
)
for
{
keys12R_
:=
kadj10
.
Map
(
kadj21
.
Map
(
keys12R
))
if
keys12R
.
Equal
(
keys12R_
)
{
break
}
keys12R
=
keys12R_
}
// δkv1_2 = t1.δxkv / kadj10(kadj21(kadj12(keys1) | keys2))
// δkv2_2 = t2.δxkv / kadj10(kadj21(kadj12(keys1) | keys2))
keys12_2
:=
keys1_2
.
Union
(
keys2
)
keys12_0
:=
kadj10
.
Map
(
kadj21
.
Map
(
keys12_2
))
// keys12_2 := keys1_2.Union(keys2)
// keys12_0 := kadj10.Map(kadj21.Map(keys12_2))
fmt
.
Printf
(
"
\n\n\n
KKK
\n
keys1=%s keys2=%s
\n
"
,
keys1
,
keys2
)
fmt
.
Printf
(
"keys12R=%s
\n
"
,
keys12R
)
fmt
.
Printf
(
"t0.xkv: %v
\n
"
,
t0
.
xkv
)
fmt
.
Printf
(
"t1.xkv: %v
\n
"
,
t1
.
xkv
)
fmt
.
Printf
(
"t2.xkv: %v
\n
"
,
t2
.
xkv
)
fmt
.
Printf
(
"kadj21: %v
\n
"
,
kadj21
)
fmt
.
Printf
(
"kadj12: %v
\n
"
,
kadj12
)
fmt
.
Printf
(
"t2.xkv.trackSet(%s) -> %s"
,
keys12R
,
t2
.
xkv
.
trackSet
(
keys12R
))
fmt
.
Printf
(
"
\n\n\n
"
)
δkv1_2
:=
map
[
Key
]
Δstring
{}
δkv2_2
:=
map
[
Key
]
Δstring
{}
for
k
:=
range
keys12
_0
{
for
k
:=
range
keys12
R
{
δv1
,
ok
:=
t1
.
δxkv
[
k
]
if
ok
{
δkv1_2
[
k
]
=
δv1
...
...
@@ -957,12 +982,13 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
xverifyΔBTail_rebuild_TR
(
t
,
db
,
δbtail_
,
t2
,
treeRoot
,
xat
,
// after Track(keys2)
keys2
,
/*trackSet*/
t2
.
xkv
.
trackSet
(
keys1_0
.
Union
(
keys1_2
)),
// /*trackSet*/ t2.xkv.trackSet(keys1_0.Union(keys1_2)),
/*trackSet*/
t2
.
xkv
.
trackSet
(
keys1_2
),
// FIXME vvv trackNew should not cover ranges that are already in trackSet
/*trackNew*/
t2
.
xkv
.
trackSet
(
keys2
),
// after rebuild
/* trackSet=*/
t2
.
xkv
.
trackSet
(
keys12
_0
),
/* trackSet=*/
t2
.
xkv
.
trackSet
(
keys12
R
),
/*vδT=*/
δkv1_2
,
δkv2_2
)
// })
}
...
...
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