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
0f7b5c42
Commit
0f7b5c42
authored
Jul 01, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 't2' into t3
* t2: X Unexport SetXXX from packages API
parents
8b31bce0
fecf1327
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
178 additions
and
180 deletions
+178
-180
wcfs/internal/set/gen-set
wcfs/internal/set/gen-set
+4
-6
wcfs/internal/set/set.go
wcfs/internal/set/set.go
+4
-4
wcfs/internal/set/set.go.in
wcfs/internal/set/set.go.in
+1
-1
wcfs/internal/set/zset_i64.go
wcfs/internal/set/zset_i64.go
+20
-20
wcfs/internal/set/zset_oid.go
wcfs/internal/set/zset_oid.go
+20
-20
wcfs/internal/set/zset_str.go
wcfs/internal/set/zset_str.go
+20
-20
wcfs/internal/set/zset_tid.go
wcfs/internal/set/zset_tid.go
+20
-20
wcfs/internal/xbtree/pptreesubset.go
wcfs/internal/xbtree/pptreesubset.go
+2
-2
wcfs/internal/xbtree/treediff.go
wcfs/internal/xbtree/treediff.go
+8
-8
wcfs/internal/xbtree/xbtree.go
wcfs/internal/xbtree/xbtree.go
+3
-3
wcfs/internal/xbtree/xbtreetest/kvdiff.go
wcfs/internal/xbtree/xbtreetest/kvdiff.go
+1
-1
wcfs/internal/xbtree/xbtreetest/xbtreetest.go
wcfs/internal/xbtree/xbtreetest/xbtreetest.go
+1
-1
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+11
-11
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+38
-38
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+15
-15
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+7
-7
wcfs/wcfs.go
wcfs/wcfs.go
+3
-3
No files found.
wcfs/internal/set/gen-set
View file @
0f7b5c42
...
@@ -21,10 +21,9 @@
...
@@ -21,10 +21,9 @@
# See COPYING file for full licensing terms.
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
# See https://www.nexedi.com/licensing for rationale and options.
PACKAGE
=
$1
KIND
=
$1
KIND
=
$2
VALUE
=
$2
VALUE
=
$3
out
=
$3
out
=
$4
input
=
$(
dirname
$0
)
/set.go.in
input
=
$(
dirname
$0
)
/set.go.in
...
@@ -32,7 +31,6 @@ echo "// Code generated by gen-set $KIND $VALUE; DO NOT EDIT." >$out
...
@@ -32,7 +31,6 @@ echo "// Code generated by gen-set $KIND $VALUE; DO NOT EDIT." >$out
echo
>>
$out
echo
>>
$out
sed
\
sed
\
-e
"s/PACKAGE/
$PACKAGE
/g"
\
-e
"s/VALUE/
$VALUE
/g"
\
-e
"s/VALUE/
$VALUE
/g"
\
-e
"s/Set/
Set
${
KIND
}
/g"
\
-e
"s/Set/
${
KIND
}
/g"
\
$input
>>
$out
$input
>>
$out
wcfs/internal/set/set.go
View file @
0f7b5c42
...
@@ -19,10 +19,10 @@
...
@@ -19,10 +19,10 @@
package
set
package
set
//go:generate ./gen-set
set
I64 int64 zset_i64.go
//go:generate ./gen-set I64 int64 zset_i64.go
//go:generate ./gen-set
set
Str string zset_str.go
//go:generate ./gen-set Str string zset_str.go
//go:generate ./gen-set
set
Oid _Oid zset_oid.go
//go:generate ./gen-set Oid _Oid zset_oid.go
//go:generate ./gen-set
set
Tid _Tid zset_tid.go
//go:generate ./gen-set Tid _Tid zset_tid.go
import
(
import
(
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb"
...
...
wcfs/internal/set/set.go.in
View file @
0f7b5c42
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
//
See
COPYING
file
for
full
licensing
terms
.
//
See
COPYING
file
for
full
licensing
terms
.
//
See
https
://
www
.
nexedi
.
com
/
licensing
for
rationale
and
options
.
//
See
https
://
www
.
nexedi
.
com
/
licensing
for
rationale
and
options
.
package
PACKAGE
package
set
import
(
import
(
"fmt"
"fmt"
...
...
wcfs/internal/set/zset_i64.go
View file @
0f7b5c42
...
@@ -27,35 +27,35 @@ import (
...
@@ -27,35 +27,35 @@ import (
"strings"
"strings"
)
)
//
Set
I64 is a set of int64.
// I64 is a set of int64.
type
Set
I64
map
[
int64
]
struct
{}
type
I64
map
[
int64
]
struct
{}
// Add adds v to the set.
// Add adds v to the set.
func
(
s
Set
I64
)
Add
(
v
int64
)
{
func
(
s
I64
)
Add
(
v
int64
)
{
s
[
v
]
=
struct
{}{}
s
[
v
]
=
struct
{}{}
}
}
// Del removes v from the set.
// Del removes v from the set.
// it is noop if v was not in the set.
// it is noop if v was not in the set.
func
(
s
Set
I64
)
Del
(
v
int64
)
{
func
(
s
I64
)
Del
(
v
int64
)
{
delete
(
s
,
v
)
delete
(
s
,
v
)
}
}
// Has checks whether the set contains v.
// Has checks whether the set contains v.
func
(
s
Set
I64
)
Has
(
v
int64
)
bool
{
func
(
s
I64
)
Has
(
v
int64
)
bool
{
_
,
ok
:=
s
[
v
]
_
,
ok
:=
s
[
v
]
return
ok
return
ok
}
}
// Update adds t values to s.
// Update adds t values to s.
func
(
s
SetI64
)
Update
(
t
Set
I64
)
{
func
(
s
I64
)
Update
(
t
I64
)
{
for
v
:=
range
t
{
for
v
:=
range
t
{
s
.
Add
(
v
)
s
.
Add
(
v
)
}
}
}
}
// Elements returns all elements of set as slice.
// Elements returns all elements of set as slice.
func
(
s
Set
I64
)
Elements
()
[]
int64
{
func
(
s
I64
)
Elements
()
[]
int64
{
ev
:=
make
([]
int64
,
len
(
s
))
ev
:=
make
([]
int64
,
len
(
s
))
i
:=
0
i
:=
0
for
e
:=
range
s
{
for
e
:=
range
s
{
...
@@ -66,14 +66,14 @@ func (s SetI64) Elements() []int64 {
...
@@ -66,14 +66,14 @@ func (s SetI64) Elements() []int64 {
}
}
// Union returns s ∪ t
// Union returns s ∪ t
func
(
s
SetI64
)
Union
(
t
SetI64
)
Set
I64
{
func
(
s
I64
)
Union
(
t
I64
)
I64
{
// l = max(len(s), len(t))
// l = max(len(s), len(t))
l
:=
len
(
s
)
l
:=
len
(
s
)
if
lt
:=
len
(
t
);
lt
>
l
{
if
lt
:=
len
(
t
);
lt
>
l
{
l
=
lt
l
=
lt
}
}
u
:=
make
(
Set
I64
,
l
)
u
:=
make
(
I64
,
l
)
for
v
:=
range
s
{
for
v
:=
range
s
{
u
.
Add
(
v
)
u
.
Add
(
v
)
...
@@ -85,8 +85,8 @@ func (s SetI64) Union(t SetI64) SetI64 {
...
@@ -85,8 +85,8 @@ func (s SetI64) Union(t SetI64) SetI64 {
}
}
// Intersection returns s ∩ t
// Intersection returns s ∩ t
func
(
s
SetI64
)
Intersection
(
t
SetI64
)
Set
I64
{
func
(
s
I64
)
Intersection
(
t
I64
)
I64
{
i
:=
Set
I64
{}
i
:=
I64
{}
for
v
:=
range
s
{
for
v
:=
range
s
{
if
t
.
Has
(
v
)
{
if
t
.
Has
(
v
)
{
i
.
Add
(
v
)
i
.
Add
(
v
)
...
@@ -96,8 +96,8 @@ func (s SetI64) Intersection(t SetI64) SetI64 {
...
@@ -96,8 +96,8 @@ func (s SetI64) Intersection(t SetI64) SetI64 {
}
}
// Difference returns s\t.
// Difference returns s\t.
func
(
s
SetI64
)
Difference
(
t
SetI64
)
Set
I64
{
func
(
s
I64
)
Difference
(
t
I64
)
I64
{
d
:=
Set
I64
{}
d
:=
I64
{}
for
v
:=
range
s
{
for
v
:=
range
s
{
if
!
t
.
Has
(
v
)
{
if
!
t
.
Has
(
v
)
{
d
.
Add
(
v
)
d
.
Add
(
v
)
...
@@ -107,8 +107,8 @@ func (s SetI64) Difference(t SetI64) SetI64 {
...
@@ -107,8 +107,8 @@ func (s SetI64) Difference(t SetI64) SetI64 {
}
}
// SymmetricDifference returns s Δ t.
// SymmetricDifference returns s Δ t.
func
(
s
SetI64
)
SymmetricDifference
(
t
SetI64
)
Set
I64
{
func
(
s
I64
)
SymmetricDifference
(
t
I64
)
I64
{
d
:=
Set
I64
{}
d
:=
I64
{}
for
v
:=
range
s
{
for
v
:=
range
s
{
if
!
t
.
Has
(
v
)
{
if
!
t
.
Has
(
v
)
{
d
.
Add
(
v
)
d
.
Add
(
v
)
...
@@ -123,7 +123,7 @@ func (s SetI64) SymmetricDifference(t SetI64) SetI64 {
...
@@ -123,7 +123,7 @@ func (s SetI64) SymmetricDifference(t SetI64) SetI64 {
}
}
// Equal returns whether a == b.
// Equal returns whether a == b.
func
(
a
SetI64
)
Equal
(
b
Set
I64
)
bool
{
func
(
a
I64
)
Equal
(
b
I64
)
bool
{
if
len
(
a
)
!=
len
(
b
)
{
if
len
(
a
)
!=
len
(
b
)
{
return
false
return
false
}
}
...
@@ -139,8 +139,8 @@ func (a SetI64) Equal(b SetI64) bool {
...
@@ -139,8 +139,8 @@ func (a SetI64) Equal(b SetI64) bool {
}
}
// Clone returns copy of the set.
// Clone returns copy of the set.
func
(
orig
SetI64
)
Clone
()
Set
I64
{
func
(
orig
I64
)
Clone
()
I64
{
klon
:=
make
(
Set
I64
,
len
(
orig
))
klon
:=
make
(
I64
,
len
(
orig
))
for
v
:=
range
orig
{
for
v
:=
range
orig
{
klon
.
Add
(
v
)
klon
.
Add
(
v
)
}
}
...
@@ -149,7 +149,7 @@ func (orig SetI64) Clone() SetI64 {
...
@@ -149,7 +149,7 @@ func (orig SetI64) Clone() SetI64 {
// --------
// --------
func
(
s
Set
I64
)
SortedElements
()
[]
int64
{
func
(
s
I64
)
SortedElements
()
[]
int64
{
ev
:=
s
.
Elements
()
ev
:=
s
.
Elements
()
sort
.
Slice
(
ev
,
func
(
i
,
j
int
)
bool
{
sort
.
Slice
(
ev
,
func
(
i
,
j
int
)
bool
{
return
ev
[
i
]
<
ev
[
j
]
return
ev
[
i
]
<
ev
[
j
]
...
@@ -157,7 +157,7 @@ func (s SetI64) SortedElements() []int64 {
...
@@ -157,7 +157,7 @@ func (s SetI64) SortedElements() []int64 {
return
ev
return
ev
}
}
func
(
s
Set
I64
)
String
()
string
{
func
(
s
I64
)
String
()
string
{
ev
:=
s
.
SortedElements
()
ev
:=
s
.
SortedElements
()
strv
:=
make
([]
string
,
len
(
ev
))
strv
:=
make
([]
string
,
len
(
ev
))
for
i
,
v
:=
range
ev
{
for
i
,
v
:=
range
ev
{
...
...
wcfs/internal/set/zset_oid.go
View file @
0f7b5c42
...
@@ -27,35 +27,35 @@ import (
...
@@ -27,35 +27,35 @@ import (
"strings"
"strings"
)
)
//
Set
Oid is a set of _Oid.
// Oid is a set of _Oid.
type
Set
Oid
map
[
_Oid
]
struct
{}
type
Oid
map
[
_Oid
]
struct
{}
// Add adds v to the set.
// Add adds v to the set.
func
(
s
Set
Oid
)
Add
(
v
_Oid
)
{
func
(
s
Oid
)
Add
(
v
_Oid
)
{
s
[
v
]
=
struct
{}{}
s
[
v
]
=
struct
{}{}
}
}
// Del removes v from the set.
// Del removes v from the set.
// it is noop if v was not in the set.
// it is noop if v was not in the set.
func
(
s
Set
Oid
)
Del
(
v
_Oid
)
{
func
(
s
Oid
)
Del
(
v
_Oid
)
{
delete
(
s
,
v
)
delete
(
s
,
v
)
}
}
// Has checks whether the set contains v.
// Has checks whether the set contains v.
func
(
s
Set
Oid
)
Has
(
v
_Oid
)
bool
{
func
(
s
Oid
)
Has
(
v
_Oid
)
bool
{
_
,
ok
:=
s
[
v
]
_
,
ok
:=
s
[
v
]
return
ok
return
ok
}
}
// Update adds t values to s.
// Update adds t values to s.
func
(
s
SetOid
)
Update
(
t
Set
Oid
)
{
func
(
s
Oid
)
Update
(
t
Oid
)
{
for
v
:=
range
t
{
for
v
:=
range
t
{
s
.
Add
(
v
)
s
.
Add
(
v
)
}
}
}
}
// Elements returns all elements of set as slice.
// Elements returns all elements of set as slice.
func
(
s
Set
Oid
)
Elements
()
[]
_Oid
{
func
(
s
Oid
)
Elements
()
[]
_Oid
{
ev
:=
make
([]
_Oid
,
len
(
s
))
ev
:=
make
([]
_Oid
,
len
(
s
))
i
:=
0
i
:=
0
for
e
:=
range
s
{
for
e
:=
range
s
{
...
@@ -66,14 +66,14 @@ func (s SetOid) Elements() []_Oid {
...
@@ -66,14 +66,14 @@ func (s SetOid) Elements() []_Oid {
}
}
// Union returns s ∪ t
// Union returns s ∪ t
func
(
s
SetOid
)
Union
(
t
SetOid
)
Set
Oid
{
func
(
s
Oid
)
Union
(
t
Oid
)
Oid
{
// l = max(len(s), len(t))
// l = max(len(s), len(t))
l
:=
len
(
s
)
l
:=
len
(
s
)
if
lt
:=
len
(
t
);
lt
>
l
{
if
lt
:=
len
(
t
);
lt
>
l
{
l
=
lt
l
=
lt
}
}
u
:=
make
(
Set
Oid
,
l
)
u
:=
make
(
Oid
,
l
)
for
v
:=
range
s
{
for
v
:=
range
s
{
u
.
Add
(
v
)
u
.
Add
(
v
)
...
@@ -85,8 +85,8 @@ func (s SetOid) Union(t SetOid) SetOid {
...
@@ -85,8 +85,8 @@ func (s SetOid) Union(t SetOid) SetOid {
}
}
// Intersection returns s ∩ t
// Intersection returns s ∩ t
func
(
s
SetOid
)
Intersection
(
t
SetOid
)
Set
Oid
{
func
(
s
Oid
)
Intersection
(
t
Oid
)
Oid
{
i
:=
Set
Oid
{}
i
:=
Oid
{}
for
v
:=
range
s
{
for
v
:=
range
s
{
if
t
.
Has
(
v
)
{
if
t
.
Has
(
v
)
{
i
.
Add
(
v
)
i
.
Add
(
v
)
...
@@ -96,8 +96,8 @@ func (s SetOid) Intersection(t SetOid) SetOid {
...
@@ -96,8 +96,8 @@ func (s SetOid) Intersection(t SetOid) SetOid {
}
}
// Difference returns s\t.
// Difference returns s\t.
func
(
s
SetOid
)
Difference
(
t
SetOid
)
Set
Oid
{
func
(
s
Oid
)
Difference
(
t
Oid
)
Oid
{
d
:=
Set
Oid
{}
d
:=
Oid
{}
for
v
:=
range
s
{
for
v
:=
range
s
{
if
!
t
.
Has
(
v
)
{
if
!
t
.
Has
(
v
)
{
d
.
Add
(
v
)
d
.
Add
(
v
)
...
@@ -107,8 +107,8 @@ func (s SetOid) Difference(t SetOid) SetOid {
...
@@ -107,8 +107,8 @@ func (s SetOid) Difference(t SetOid) SetOid {
}
}
// SymmetricDifference returns s Δ t.
// SymmetricDifference returns s Δ t.
func
(
s
SetOid
)
SymmetricDifference
(
t
SetOid
)
Set
Oid
{
func
(
s
Oid
)
SymmetricDifference
(
t
Oid
)
Oid
{
d
:=
Set
Oid
{}
d
:=
Oid
{}
for
v
:=
range
s
{
for
v
:=
range
s
{
if
!
t
.
Has
(
v
)
{
if
!
t
.
Has
(
v
)
{
d
.
Add
(
v
)
d
.
Add
(
v
)
...
@@ -123,7 +123,7 @@ func (s SetOid) SymmetricDifference(t SetOid) SetOid {
...
@@ -123,7 +123,7 @@ func (s SetOid) SymmetricDifference(t SetOid) SetOid {
}
}
// Equal returns whether a == b.
// Equal returns whether a == b.
func
(
a
SetOid
)
Equal
(
b
Set
Oid
)
bool
{
func
(
a
Oid
)
Equal
(
b
Oid
)
bool
{
if
len
(
a
)
!=
len
(
b
)
{
if
len
(
a
)
!=
len
(
b
)
{
return
false
return
false
}
}
...
@@ -139,8 +139,8 @@ func (a SetOid) Equal(b SetOid) bool {
...
@@ -139,8 +139,8 @@ func (a SetOid) Equal(b SetOid) bool {
}
}
// Clone returns copy of the set.
// Clone returns copy of the set.
func
(
orig
SetOid
)
Clone
()
Set
Oid
{
func
(
orig
Oid
)
Clone
()
Oid
{
klon
:=
make
(
Set
Oid
,
len
(
orig
))
klon
:=
make
(
Oid
,
len
(
orig
))
for
v
:=
range
orig
{
for
v
:=
range
orig
{
klon
.
Add
(
v
)
klon
.
Add
(
v
)
}
}
...
@@ -149,7 +149,7 @@ func (orig SetOid) Clone() SetOid {
...
@@ -149,7 +149,7 @@ func (orig SetOid) Clone() SetOid {
// --------
// --------
func
(
s
Set
Oid
)
SortedElements
()
[]
_Oid
{
func
(
s
Oid
)
SortedElements
()
[]
_Oid
{
ev
:=
s
.
Elements
()
ev
:=
s
.
Elements
()
sort
.
Slice
(
ev
,
func
(
i
,
j
int
)
bool
{
sort
.
Slice
(
ev
,
func
(
i
,
j
int
)
bool
{
return
ev
[
i
]
<
ev
[
j
]
return
ev
[
i
]
<
ev
[
j
]
...
@@ -157,7 +157,7 @@ func (s SetOid) SortedElements() []_Oid {
...
@@ -157,7 +157,7 @@ func (s SetOid) SortedElements() []_Oid {
return
ev
return
ev
}
}
func
(
s
Set
Oid
)
String
()
string
{
func
(
s
Oid
)
String
()
string
{
ev
:=
s
.
SortedElements
()
ev
:=
s
.
SortedElements
()
strv
:=
make
([]
string
,
len
(
ev
))
strv
:=
make
([]
string
,
len
(
ev
))
for
i
,
v
:=
range
ev
{
for
i
,
v
:=
range
ev
{
...
...
wcfs/internal/set/zset_str.go
View file @
0f7b5c42
...
@@ -27,35 +27,35 @@ import (
...
@@ -27,35 +27,35 @@ import (
"strings"
"strings"
)
)
// S
etS
tr is a set of string.
// Str is a set of string.
type
S
etS
tr
map
[
string
]
struct
{}
type
Str
map
[
string
]
struct
{}
// Add adds v to the set.
// Add adds v to the set.
func
(
s
S
etS
tr
)
Add
(
v
string
)
{
func
(
s
Str
)
Add
(
v
string
)
{
s
[
v
]
=
struct
{}{}
s
[
v
]
=
struct
{}{}
}
}
// Del removes v from the set.
// Del removes v from the set.
// it is noop if v was not in the set.
// it is noop if v was not in the set.
func
(
s
S
etS
tr
)
Del
(
v
string
)
{
func
(
s
Str
)
Del
(
v
string
)
{
delete
(
s
,
v
)
delete
(
s
,
v
)
}
}
// Has checks whether the set contains v.
// Has checks whether the set contains v.
func
(
s
S
etS
tr
)
Has
(
v
string
)
bool
{
func
(
s
Str
)
Has
(
v
string
)
bool
{
_
,
ok
:=
s
[
v
]
_
,
ok
:=
s
[
v
]
return
ok
return
ok
}
}
// Update adds t values to s.
// Update adds t values to s.
func
(
s
S
etStr
)
Update
(
t
Set
Str
)
{
func
(
s
S
tr
)
Update
(
t
Str
)
{
for
v
:=
range
t
{
for
v
:=
range
t
{
s
.
Add
(
v
)
s
.
Add
(
v
)
}
}
}
}
// Elements returns all elements of set as slice.
// Elements returns all elements of set as slice.
func
(
s
S
etS
tr
)
Elements
()
[]
string
{
func
(
s
Str
)
Elements
()
[]
string
{
ev
:=
make
([]
string
,
len
(
s
))
ev
:=
make
([]
string
,
len
(
s
))
i
:=
0
i
:=
0
for
e
:=
range
s
{
for
e
:=
range
s
{
...
@@ -66,14 +66,14 @@ func (s SetStr) Elements() []string {
...
@@ -66,14 +66,14 @@ func (s SetStr) Elements() []string {
}
}
// Union returns s ∪ t
// Union returns s ∪ t
func
(
s
S
etStr
)
Union
(
t
SetStr
)
Set
Str
{
func
(
s
S
tr
)
Union
(
t
Str
)
Str
{
// l = max(len(s), len(t))
// l = max(len(s), len(t))
l
:=
len
(
s
)
l
:=
len
(
s
)
if
lt
:=
len
(
t
);
lt
>
l
{
if
lt
:=
len
(
t
);
lt
>
l
{
l
=
lt
l
=
lt
}
}
u
:=
make
(
S
etS
tr
,
l
)
u
:=
make
(
Str
,
l
)
for
v
:=
range
s
{
for
v
:=
range
s
{
u
.
Add
(
v
)
u
.
Add
(
v
)
...
@@ -85,8 +85,8 @@ func (s SetStr) Union(t SetStr) SetStr {
...
@@ -85,8 +85,8 @@ func (s SetStr) Union(t SetStr) SetStr {
}
}
// Intersection returns s ∩ t
// Intersection returns s ∩ t
func
(
s
S
etStr
)
Intersection
(
t
SetStr
)
Set
Str
{
func
(
s
S
tr
)
Intersection
(
t
Str
)
Str
{
i
:=
S
etS
tr
{}
i
:=
Str
{}
for
v
:=
range
s
{
for
v
:=
range
s
{
if
t
.
Has
(
v
)
{
if
t
.
Has
(
v
)
{
i
.
Add
(
v
)
i
.
Add
(
v
)
...
@@ -96,8 +96,8 @@ func (s SetStr) Intersection(t SetStr) SetStr {
...
@@ -96,8 +96,8 @@ func (s SetStr) Intersection(t SetStr) SetStr {
}
}
// Difference returns s\t.
// Difference returns s\t.
func
(
s
S
etStr
)
Difference
(
t
SetStr
)
Set
Str
{
func
(
s
S
tr
)
Difference
(
t
Str
)
Str
{
d
:=
S
etS
tr
{}
d
:=
Str
{}
for
v
:=
range
s
{
for
v
:=
range
s
{
if
!
t
.
Has
(
v
)
{
if
!
t
.
Has
(
v
)
{
d
.
Add
(
v
)
d
.
Add
(
v
)
...
@@ -107,8 +107,8 @@ func (s SetStr) Difference(t SetStr) SetStr {
...
@@ -107,8 +107,8 @@ func (s SetStr) Difference(t SetStr) SetStr {
}
}
// SymmetricDifference returns s Δ t.
// SymmetricDifference returns s Δ t.
func
(
s
S
etStr
)
SymmetricDifference
(
t
SetStr
)
Set
Str
{
func
(
s
S
tr
)
SymmetricDifference
(
t
Str
)
Str
{
d
:=
S
etS
tr
{}
d
:=
Str
{}
for
v
:=
range
s
{
for
v
:=
range
s
{
if
!
t
.
Has
(
v
)
{
if
!
t
.
Has
(
v
)
{
d
.
Add
(
v
)
d
.
Add
(
v
)
...
@@ -123,7 +123,7 @@ func (s SetStr) SymmetricDifference(t SetStr) SetStr {
...
@@ -123,7 +123,7 @@ func (s SetStr) SymmetricDifference(t SetStr) SetStr {
}
}
// Equal returns whether a == b.
// Equal returns whether a == b.
func
(
a
S
etStr
)
Equal
(
b
Set
Str
)
bool
{
func
(
a
S
tr
)
Equal
(
b
Str
)
bool
{
if
len
(
a
)
!=
len
(
b
)
{
if
len
(
a
)
!=
len
(
b
)
{
return
false
return
false
}
}
...
@@ -139,8 +139,8 @@ func (a SetStr) Equal(b SetStr) bool {
...
@@ -139,8 +139,8 @@ func (a SetStr) Equal(b SetStr) bool {
}
}
// Clone returns copy of the set.
// Clone returns copy of the set.
func
(
orig
S
etStr
)
Clone
()
Set
Str
{
func
(
orig
S
tr
)
Clone
()
Str
{
klon
:=
make
(
S
etS
tr
,
len
(
orig
))
klon
:=
make
(
Str
,
len
(
orig
))
for
v
:=
range
orig
{
for
v
:=
range
orig
{
klon
.
Add
(
v
)
klon
.
Add
(
v
)
}
}
...
@@ -149,7 +149,7 @@ func (orig SetStr) Clone() SetStr {
...
@@ -149,7 +149,7 @@ func (orig SetStr) Clone() SetStr {
// --------
// --------
func
(
s
S
etS
tr
)
SortedElements
()
[]
string
{
func
(
s
Str
)
SortedElements
()
[]
string
{
ev
:=
s
.
Elements
()
ev
:=
s
.
Elements
()
sort
.
Slice
(
ev
,
func
(
i
,
j
int
)
bool
{
sort
.
Slice
(
ev
,
func
(
i
,
j
int
)
bool
{
return
ev
[
i
]
<
ev
[
j
]
return
ev
[
i
]
<
ev
[
j
]
...
@@ -157,7 +157,7 @@ func (s SetStr) SortedElements() []string {
...
@@ -157,7 +157,7 @@ func (s SetStr) SortedElements() []string {
return
ev
return
ev
}
}
func
(
s
S
etS
tr
)
String
()
string
{
func
(
s
Str
)
String
()
string
{
ev
:=
s
.
SortedElements
()
ev
:=
s
.
SortedElements
()
strv
:=
make
([]
string
,
len
(
ev
))
strv
:=
make
([]
string
,
len
(
ev
))
for
i
,
v
:=
range
ev
{
for
i
,
v
:=
range
ev
{
...
...
wcfs/internal/set/zset_tid.go
View file @
0f7b5c42
...
@@ -27,35 +27,35 @@ import (
...
@@ -27,35 +27,35 @@ import (
"strings"
"strings"
)
)
//
Set
Tid is a set of _Tid.
// Tid is a set of _Tid.
type
Set
Tid
map
[
_Tid
]
struct
{}
type
Tid
map
[
_Tid
]
struct
{}
// Add adds v to the set.
// Add adds v to the set.
func
(
s
Set
Tid
)
Add
(
v
_Tid
)
{
func
(
s
Tid
)
Add
(
v
_Tid
)
{
s
[
v
]
=
struct
{}{}
s
[
v
]
=
struct
{}{}
}
}
// Del removes v from the set.
// Del removes v from the set.
// it is noop if v was not in the set.
// it is noop if v was not in the set.
func
(
s
Set
Tid
)
Del
(
v
_Tid
)
{
func
(
s
Tid
)
Del
(
v
_Tid
)
{
delete
(
s
,
v
)
delete
(
s
,
v
)
}
}
// Has checks whether the set contains v.
// Has checks whether the set contains v.
func
(
s
Set
Tid
)
Has
(
v
_Tid
)
bool
{
func
(
s
Tid
)
Has
(
v
_Tid
)
bool
{
_
,
ok
:=
s
[
v
]
_
,
ok
:=
s
[
v
]
return
ok
return
ok
}
}
// Update adds t values to s.
// Update adds t values to s.
func
(
s
SetTid
)
Update
(
t
Set
Tid
)
{
func
(
s
Tid
)
Update
(
t
Tid
)
{
for
v
:=
range
t
{
for
v
:=
range
t
{
s
.
Add
(
v
)
s
.
Add
(
v
)
}
}
}
}
// Elements returns all elements of set as slice.
// Elements returns all elements of set as slice.
func
(
s
Set
Tid
)
Elements
()
[]
_Tid
{
func
(
s
Tid
)
Elements
()
[]
_Tid
{
ev
:=
make
([]
_Tid
,
len
(
s
))
ev
:=
make
([]
_Tid
,
len
(
s
))
i
:=
0
i
:=
0
for
e
:=
range
s
{
for
e
:=
range
s
{
...
@@ -66,14 +66,14 @@ func (s SetTid) Elements() []_Tid {
...
@@ -66,14 +66,14 @@ func (s SetTid) Elements() []_Tid {
}
}
// Union returns s ∪ t
// Union returns s ∪ t
func
(
s
SetTid
)
Union
(
t
SetTid
)
Set
Tid
{
func
(
s
Tid
)
Union
(
t
Tid
)
Tid
{
// l = max(len(s), len(t))
// l = max(len(s), len(t))
l
:=
len
(
s
)
l
:=
len
(
s
)
if
lt
:=
len
(
t
);
lt
>
l
{
if
lt
:=
len
(
t
);
lt
>
l
{
l
=
lt
l
=
lt
}
}
u
:=
make
(
Set
Tid
,
l
)
u
:=
make
(
Tid
,
l
)
for
v
:=
range
s
{
for
v
:=
range
s
{
u
.
Add
(
v
)
u
.
Add
(
v
)
...
@@ -85,8 +85,8 @@ func (s SetTid) Union(t SetTid) SetTid {
...
@@ -85,8 +85,8 @@ func (s SetTid) Union(t SetTid) SetTid {
}
}
// Intersection returns s ∩ t
// Intersection returns s ∩ t
func
(
s
SetTid
)
Intersection
(
t
SetTid
)
Set
Tid
{
func
(
s
Tid
)
Intersection
(
t
Tid
)
Tid
{
i
:=
Set
Tid
{}
i
:=
Tid
{}
for
v
:=
range
s
{
for
v
:=
range
s
{
if
t
.
Has
(
v
)
{
if
t
.
Has
(
v
)
{
i
.
Add
(
v
)
i
.
Add
(
v
)
...
@@ -96,8 +96,8 @@ func (s SetTid) Intersection(t SetTid) SetTid {
...
@@ -96,8 +96,8 @@ func (s SetTid) Intersection(t SetTid) SetTid {
}
}
// Difference returns s\t.
// Difference returns s\t.
func
(
s
SetTid
)
Difference
(
t
SetTid
)
Set
Tid
{
func
(
s
Tid
)
Difference
(
t
Tid
)
Tid
{
d
:=
Set
Tid
{}
d
:=
Tid
{}
for
v
:=
range
s
{
for
v
:=
range
s
{
if
!
t
.
Has
(
v
)
{
if
!
t
.
Has
(
v
)
{
d
.
Add
(
v
)
d
.
Add
(
v
)
...
@@ -107,8 +107,8 @@ func (s SetTid) Difference(t SetTid) SetTid {
...
@@ -107,8 +107,8 @@ func (s SetTid) Difference(t SetTid) SetTid {
}
}
// SymmetricDifference returns s Δ t.
// SymmetricDifference returns s Δ t.
func
(
s
SetTid
)
SymmetricDifference
(
t
SetTid
)
Set
Tid
{
func
(
s
Tid
)
SymmetricDifference
(
t
Tid
)
Tid
{
d
:=
Set
Tid
{}
d
:=
Tid
{}
for
v
:=
range
s
{
for
v
:=
range
s
{
if
!
t
.
Has
(
v
)
{
if
!
t
.
Has
(
v
)
{
d
.
Add
(
v
)
d
.
Add
(
v
)
...
@@ -123,7 +123,7 @@ func (s SetTid) SymmetricDifference(t SetTid) SetTid {
...
@@ -123,7 +123,7 @@ func (s SetTid) SymmetricDifference(t SetTid) SetTid {
}
}
// Equal returns whether a == b.
// Equal returns whether a == b.
func
(
a
SetTid
)
Equal
(
b
Set
Tid
)
bool
{
func
(
a
Tid
)
Equal
(
b
Tid
)
bool
{
if
len
(
a
)
!=
len
(
b
)
{
if
len
(
a
)
!=
len
(
b
)
{
return
false
return
false
}
}
...
@@ -139,8 +139,8 @@ func (a SetTid) Equal(b SetTid) bool {
...
@@ -139,8 +139,8 @@ func (a SetTid) Equal(b SetTid) bool {
}
}
// Clone returns copy of the set.
// Clone returns copy of the set.
func
(
orig
SetTid
)
Clone
()
Set
Tid
{
func
(
orig
Tid
)
Clone
()
Tid
{
klon
:=
make
(
Set
Tid
,
len
(
orig
))
klon
:=
make
(
Tid
,
len
(
orig
))
for
v
:=
range
orig
{
for
v
:=
range
orig
{
klon
.
Add
(
v
)
klon
.
Add
(
v
)
}
}
...
@@ -149,7 +149,7 @@ func (orig SetTid) Clone() SetTid {
...
@@ -149,7 +149,7 @@ func (orig SetTid) Clone() SetTid {
// --------
// --------
func
(
s
Set
Tid
)
SortedElements
()
[]
_Tid
{
func
(
s
Tid
)
SortedElements
()
[]
_Tid
{
ev
:=
s
.
Elements
()
ev
:=
s
.
Elements
()
sort
.
Slice
(
ev
,
func
(
i
,
j
int
)
bool
{
sort
.
Slice
(
ev
,
func
(
i
,
j
int
)
bool
{
return
ev
[
i
]
<
ev
[
j
]
return
ev
[
i
]
<
ev
[
j
]
...
@@ -157,7 +157,7 @@ func (s SetTid) SortedElements() []_Tid {
...
@@ -157,7 +157,7 @@ func (s SetTid) SortedElements() []_Tid {
return
ev
return
ev
}
}
func
(
s
Set
Tid
)
String
()
string
{
func
(
s
Tid
)
String
()
string
{
ev
:=
s
.
SortedElements
()
ev
:=
s
.
SortedElements
()
strv
:=
make
([]
string
,
len
(
ev
))
strv
:=
make
([]
string
,
len
(
ev
))
for
i
,
v
:=
range
ev
{
for
i
,
v
:=
range
ev
{
...
...
wcfs/internal/xbtree/pptreesubset.go
View file @
0f7b5c42
...
@@ -363,12 +363,12 @@ func (S PPTreeSubSet) verify() {
...
@@ -363,12 +363,12 @@ func (S PPTreeSubSet) verify() {
}()
}()
// recompute {} oid -> children and verify .nchild against it
// recompute {} oid -> children and verify .nchild against it
children
:=
make
(
map
[
zodb
.
Oid
]
S
etOid
,
len
(
S
))
children
:=
make
(
map
[
zodb
.
Oid
]
s
etOid
,
len
(
S
))
for
oid
,
t
:=
range
S
{
for
oid
,
t
:=
range
S
{
if
t
.
parent
!=
zodb
.
InvalidOid
{
if
t
.
parent
!=
zodb
.
InvalidOid
{
cc
,
ok
:=
children
[
t
.
parent
]
cc
,
ok
:=
children
[
t
.
parent
]
if
!
ok
{
if
!
ok
{
cc
=
make
(
S
etOid
,
1
)
cc
=
make
(
s
etOid
,
1
)
children
[
t
.
parent
]
=
cc
children
[
t
.
parent
]
=
cc
}
}
cc
.
Add
(
oid
)
cc
.
Add
(
oid
)
...
...
wcfs/internal/xbtree/treediff.go
View file @
0f7b5c42
...
@@ -113,10 +113,10 @@ func (δv ΔValue) String() string {
...
@@ -113,10 +113,10 @@ func (δv ΔValue) String() string {
// for example for e.g. t₀->t₁->b₂ if δZ/T={t₀ b₂} -> δZ/TC=δZ/T+{t₁}
// for example for e.g. t₀->t₁->b₂ if δZ/T={t₀ b₂} -> δZ/TC=δZ/T+{t₁}
//
//
// δtopsByRoot = {} root -> {top changed nodes in that tree}
// δtopsByRoot = {} root -> {top changed nodes in that tree}
func
δZConnectTracked
(
δZv
[]
zodb
.
Oid
,
T
PPTreeSubSet
)
(
δZTC
SetOid
,
δtopsByRoot
map
[
zodb
.
Oid
]
S
etOid
)
{
func
δZConnectTracked
(
δZv
[]
zodb
.
Oid
,
T
PPTreeSubSet
)
(
δZTC
setOid
,
δtopsByRoot
map
[
zodb
.
Oid
]
s
etOid
)
{
δZ
:=
S
etOid
{};
for
_
,
δ
:=
range
δZv
{
δZ
.
Add
(
δ
)
}
δZ
:=
s
etOid
{};
for
_
,
δ
:=
range
δZv
{
δZ
.
Add
(
δ
)
}
δZTC
=
S
etOid
{}
δZTC
=
s
etOid
{}
δtopsByRoot
=
map
[
zodb
.
Oid
]
S
etOid
{}
δtopsByRoot
=
map
[
zodb
.
Oid
]
s
etOid
{}
for
δ
:=
range
δZ
{
for
δ
:=
range
δZ
{
track
,
ok
:=
T
[
δ
]
track
,
ok
:=
T
[
δ
]
...
@@ -138,7 +138,7 @@ func δZConnectTracked(δZv []zodb.Oid, T PPTreeSubSet) (δZTC SetOid, δtopsByR
...
@@ -138,7 +138,7 @@ func δZConnectTracked(δZv []zodb.Oid, T PPTreeSubSet) (δZTC SetOid, δtopsByR
root
:=
node
root
:=
node
δtops
,
ok
:=
δtopsByRoot
[
root
]
δtops
,
ok
:=
δtopsByRoot
[
root
]
if
!
ok
{
if
!
ok
{
δtops
=
S
etOid
{}
δtops
=
s
etOid
{}
δtopsByRoot
[
root
]
=
δtops
δtopsByRoot
[
root
]
=
δtops
}
}
δtops
.
Add
(
δ
)
δtops
.
Add
(
δ
)
...
@@ -338,7 +338,7 @@ func (rs rangeSplit) String() string {
...
@@ -338,7 +338,7 @@ func (rs rangeSplit) String() string {
// δtops is set of top nodes for changed subtrees.
// δtops is set of top nodes for changed subtrees.
// δZTC is connected(δZ/T) - connected closure for subset of δZ(old..new) that
// δZTC is connected(δZ/T) - connected closure for subset of δZ(old..new) that
// touches tracked nodes of T.
// touches tracked nodes of T.
func
treediff
(
ctx
context
.
Context
,
root
zodb
.
Oid
,
δtops
SetOid
,
δZTC
S
etOid
,
trackSet
PPTreeSubSet
,
zconnOld
,
zconnNew
*
zodb
.
Connection
)
(
δT
map
[
Key
]
ΔValue
,
δtrack
*
ΔPPTreeSubSet
,
δtkeycov
*
RangedKeySet
,
err
error
)
{
func
treediff
(
ctx
context
.
Context
,
root
zodb
.
Oid
,
δtops
setOid
,
δZTC
s
etOid
,
trackSet
PPTreeSubSet
,
zconnOld
,
zconnNew
*
zodb
.
Connection
)
(
δT
map
[
Key
]
ΔValue
,
δtrack
*
ΔPPTreeSubSet
,
δtkeycov
*
RangedKeySet
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"treediff %s..%s %s"
,
zconnOld
.
At
(),
zconnNew
.
At
(),
root
)
defer
xerr
.
Contextf
(
&
err
,
"treediff %s..%s %s"
,
zconnOld
.
At
(),
zconnNew
.
At
(),
root
)
δT
=
map
[
Key
]
ΔValue
{}
δT
=
map
[
Key
]
ΔValue
{}
...
@@ -401,7 +401,7 @@ func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, t
...
@@ -401,7 +401,7 @@ func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, t
// consistent with b (= a + δ).
// consistent with b (= a + δ).
//
//
// δtkeycov represents how δtrack grows (always grows) tracking set key coverage.
// δtkeycov represents how δtrack grows (always grows) tracking set key coverage.
func
diffX
(
ctx
context
.
Context
,
a
,
b
Node
,
δZTC
S
etOid
,
trackSet
PPTreeSubSet
)
(
δ
map
[
Key
]
ΔValue
,
δtrack
*
ΔPPTreeSubSet
,
δtkeycov
*
RangedKeySet
,
err
error
)
{
func
diffX
(
ctx
context
.
Context
,
a
,
b
Node
,
δZTC
s
etOid
,
trackSet
PPTreeSubSet
)
(
δ
map
[
Key
]
ΔValue
,
δtrack
*
ΔPPTreeSubSet
,
δtkeycov
*
RangedKeySet
,
err
error
)
{
if
a
==
nil
&&
b
==
nil
{
if
a
==
nil
&&
b
==
nil
{
panic
(
"BUG: both a & b == nil"
)
// XXX -> not a bug e.g. for `ø ø T` sequence?
panic
(
"BUG: both a & b == nil"
)
// XXX -> not a bug e.g. for `ø ø T` sequence?
}
}
...
@@ -452,7 +452,7 @@ func diffX(ctx context.Context, a, b Node, δZTC SetOid, trackSet PPTreeSubSet)
...
@@ -452,7 +452,7 @@ func diffX(ctx context.Context, a, b Node, δZTC SetOid, trackSet PPTreeSubSet)
//
//
// a, b point to top of subtrees @old and @new revisions.
// a, b point to top of subtrees @old and @new revisions.
// δZTC is connected set of objects covering δZT (objects changed in this tree in old..new).
// δZTC is connected set of objects covering δZT (objects changed in this tree in old..new).
func
diffT
(
ctx
context
.
Context
,
A
,
B
*
Tree
,
δZTC
S
etOid
,
trackSet
PPTreeSubSet
)
(
δ
map
[
Key
]
ΔValue
,
δtrack
*
ΔPPTreeSubSet
,
δtkeycov
*
RangedKeySet
,
err
error
)
{
func
diffT
(
ctx
context
.
Context
,
A
,
B
*
Tree
,
δZTC
s
etOid
,
trackSet
PPTreeSubSet
)
(
δ
map
[
Key
]
ΔValue
,
δtrack
*
ΔPPTreeSubSet
,
δtkeycov
*
RangedKeySet
,
err
error
)
{
tracefDiff
(
" diffT %s %s
\n
"
,
xidOf
(
A
),
xidOf
(
B
))
tracefDiff
(
" diffT %s %s
\n
"
,
xidOf
(
A
),
xidOf
(
B
))
defer
xerr
.
Contextf
(
&
err
,
"diffT %s %s"
,
xidOf
(
A
),
xidOf
(
B
))
defer
xerr
.
Contextf
(
&
err
,
"diffT %s %s"
,
xidOf
(
A
),
xidOf
(
B
))
...
...
wcfs/internal/xbtree/xbtree.go
View file @
0f7b5c42
...
@@ -30,9 +30,9 @@ const KeyMin Key = math.MinInt64
...
@@ -30,9 +30,9 @@ const KeyMin Key = math.MinInt64
type
Value
=
zodb
.
Oid
type
Value
=
zodb
.
Oid
const
VDEL
=
zodb
.
InvalidOid
const
VDEL
=
zodb
.
InvalidOid
type
SetKey
=
set
.
Set
I64
type
setKey
=
set
.
I64
type
SetOid
=
set
.
Set
Oid
type
setOid
=
set
.
Oid
type
SetTid
=
set
.
Set
Tid
type
setTid
=
set
.
Tid
...
...
wcfs/internal/xbtree/xbtreetest/kvdiff.go
View file @
0f7b5c42
...
@@ -34,7 +34,7 @@ type Δstring struct {
...
@@ -34,7 +34,7 @@ type Δstring struct {
}
}
func
kvdiff
(
kv1
,
kv2
map
[
Key
]
string
)
map
[
Key
]
Δstring
{
func
kvdiff
(
kv1
,
kv2
map
[
Key
]
string
)
map
[
Key
]
Δstring
{
delta
:=
map
[
Key
]
Δstring
{}
delta
:=
map
[
Key
]
Δstring
{}
keys
:=
S
etKey
{}
keys
:=
s
etKey
{}
for
k
:=
range
kv1
{
keys
.
Add
(
k
)
}
for
k
:=
range
kv1
{
keys
.
Add
(
k
)
}
for
k
:=
range
kv2
{
keys
.
Add
(
k
)
}
for
k
:=
range
kv2
{
keys
.
Add
(
k
)
}
...
...
wcfs/internal/xbtree/xbtreetest/xbtreetest.go
View file @
0f7b5c42
...
@@ -38,7 +38,7 @@ type Bucket = btree.LOBucket
...
@@ -38,7 +38,7 @@ type Bucket = btree.LOBucket
type
Key
=
int64
type
Key
=
int64
const
KeyMax
Key
=
math
.
MaxInt64
const
KeyMax
Key
=
math
.
MaxInt64
const
KeyMin
Key
=
math
.
MinInt64
const
KeyMin
Key
=
math
.
MinInt64
type
SetKey
=
set
.
Set
I64
type
setKey
=
set
.
I64
const
VDEL
=
zodb
.
InvalidOid
const
VDEL
=
zodb
.
InvalidOid
...
...
wcfs/internal/xbtree/δbtail.go
View file @
0f7b5c42
...
@@ -99,7 +99,7 @@ type ΔBtail struct {
...
@@ -99,7 +99,7 @@ type ΔBtail struct {
trackSet
PPTreeSubSet
trackSet
PPTreeSubSet
// set of trees for which .trackNew is non-empty
// set of trees for which .trackNew is non-empty
trackNewRoots
S
etOid
trackNewRoots
s
etOid
// handle to make connections to access database.
// handle to make connections to access database.
// TODO allow client to optionally provide zconnOld/zconnNew on e.g. Update()
// TODO allow client to optionally provide zconnOld/zconnNew on e.g. Update()
...
@@ -129,7 +129,7 @@ type ΔTtail struct {
...
@@ -129,7 +129,7 @@ type ΔTtail struct {
// It describes which trees were changed, but does not provide δkv details for changed trees.
// It describes which trees were changed, but does not provide δkv details for changed trees.
type
ΔBroots
struct
{
type
ΔBroots
struct
{
Rev
zodb
.
Tid
Rev
zodb
.
Tid
ΔRoots
S
etOid
// which roots changed in this revision
ΔRoots
s
etOid
// which roots changed in this revision
}
}
// ΔB represents a change in BTrees space.
// ΔB represents a change in BTrees space.
...
@@ -159,7 +159,7 @@ func NewΔBtail(at0 zodb.Tid, db *zodb.DB) *ΔBtail {
...
@@ -159,7 +159,7 @@ func NewΔBtail(at0 zodb.Tid, db *zodb.DB) *ΔBtail {
vδBroots
:
nil
,
vδBroots
:
nil
,
vδTbyRoot
:
map
[
zodb
.
Oid
]
*
ΔTtail
{},
vδTbyRoot
:
map
[
zodb
.
Oid
]
*
ΔTtail
{},
trackSet
:
PPTreeSubSet
{},
trackSet
:
PPTreeSubSet
{},
trackNewRoots
:
S
etOid
{},
trackNewRoots
:
s
etOid
{},
db
:
db
,
db
:
db
,
}
}
}
}
...
@@ -321,7 +321,7 @@ func (δBtail *ΔBtail) rebuildAll() (err error) {
...
@@ -321,7 +321,7 @@ func (δBtail *ΔBtail) rebuildAll() (err error) {
δBtail
.
vδBroots_Update
(
root
,
δrevSet
)
δBtail
.
vδBroots_Update
(
root
,
δrevSet
)
}
}
δBtail
.
trackNewRoots
=
S
etOid
{}
δBtail
.
trackNewRoots
=
s
etOid
{}
return
nil
return
nil
}
}
...
@@ -334,7 +334,7 @@ func (δBtail *ΔBtail) rebuildAll() (err error) {
...
@@ -334,7 +334,7 @@ func (δBtail *ΔBtail) rebuildAll() (err error) {
// - set of revisions for which new entries in .vδT have been created.
// - set of revisions for which new entries in .vδT have been created.
//
//
// XXX place
// XXX place
func
(
δTtail
*
ΔTtail
)
rebuild
(
root
zodb
.
Oid
,
δZtail
*
zodb
.
ΔTail
,
db
*
zodb
.
DB
)
(
δtrackSet
PPTreeSubSet
,
δrevSet
S
etTid
,
err
error
)
{
func
(
δTtail
*
ΔTtail
)
rebuild
(
root
zodb
.
Oid
,
δZtail
*
zodb
.
ΔTail
,
db
*
zodb
.
DB
)
(
δtrackSet
PPTreeSubSet
,
δrevSet
s
etTid
,
err
error
)
{
defer
xerr
.
Context
(
&
err
,
"ΔTtail rebuild"
)
defer
xerr
.
Context
(
&
err
,
"ΔTtail rebuild"
)
// XXX locking
// XXX locking
...
@@ -348,7 +348,7 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB
...
@@ -348,7 +348,7 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB
return
nil
,
nil
,
nil
return
nil
,
nil
,
nil
}
}
δrevSet
=
S
etTid
{}
δrevSet
=
s
etTid
{}
// go backwards and merge vδT <- treediff(lo..hi/trackNew)
// go backwards and merge vδT <- treediff(lo..hi/trackNew)
vδZ
:=
δZtail
.
Data
()
vδZ
:=
δZtail
.
Data
()
...
@@ -474,7 +474,7 @@ func (δTtail *ΔTtail) rebuild1(atPrev zodb.Tid, δZ zodb.ΔRevEntry, trackNew
...
@@ -474,7 +474,7 @@ func (δTtail *ΔTtail) rebuild1(atPrev zodb.Tid, δZ zodb.ΔRevEntry, trackNew
panicf
(
"BUG: δtopsByRoot has > 1 entries: %v
\n
trackNew: %v
\n
δZ: %v"
,
δtopsByRoot
,
trackNew
,
δZ
)
panicf
(
"BUG: δtopsByRoot has > 1 entries: %v
\n
trackNew: %v
\n
δZ: %v"
,
δtopsByRoot
,
trackNew
,
δZ
)
}
}
var
root
zodb
.
Oid
var
root
zodb
.
Oid
var
δtops
S
etOid
var
δtops
s
etOid
for
root_
,
δtops_
:=
range
δtopsByRoot
{
for
root_
,
δtops_
:=
range
δtopsByRoot
{
root
=
root_
root
=
root_
δtops
=
δtops_
δtops
=
δtops_
...
@@ -594,7 +594,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
...
@@ -594,7 +594,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
}
}
// vδBroots += δB
// vδBroots += δB
δroots
:=
S
etOid
{}
δroots
:=
s
etOid
{}
for
root
:=
range
δB
.
ΔByRoot
{
for
root
:=
range
δB
.
ΔByRoot
{
δroots
.
Add
(
root
)
δroots
.
Add
(
root
)
}
}
...
@@ -681,7 +681,7 @@ func (δBtail *ΔBtail) _Update1(δZ *zodb.EventCommit) (δB1 _ΔBUpdate1, err e
...
@@ -681,7 +681,7 @@ func (δBtail *ΔBtail) _Update1(δZ *zodb.EventCommit) (δB1 _ΔBUpdate1, err e
// changed entries with δrevSet revisions.
// changed entries with δrevSet revisions.
//
//
// XXX place TODO δrevSet -> []rev↑
// XXX place TODO δrevSet -> []rev↑
func
(
δBtail
*
ΔBtail
)
vδBroots_Update
(
root
zodb
.
Oid
,
δrevSet
S
etTid
)
{
func
(
δBtail
*
ΔBtail
)
vδBroots_Update
(
root
zodb
.
Oid
,
δrevSet
s
etTid
)
{
// XXX locking
// XXX locking
for
rev
:=
range
δrevSet
{
for
rev
:=
range
δrevSet
{
l
:=
len
(
δBtail
.
vδBroots
)
l
:=
len
(
δBtail
.
vδBroots
)
...
@@ -689,7 +689,7 @@ func (δBtail *ΔBtail) vδBroots_Update(root zodb.Oid, δrevSet SetTid) {
...
@@ -689,7 +689,7 @@ func (δBtail *ΔBtail) vδBroots_Update(root zodb.Oid, δrevSet SetTid) {
return
rev
<=
δBtail
.
vδBroots
[
k
]
.
Rev
return
rev
<=
δBtail
.
vδBroots
[
k
]
.
Rev
})
})
if
j
==
l
||
δBtail
.
vδBroots
[
j
]
.
Rev
!=
rev
{
if
j
==
l
||
δBtail
.
vδBroots
[
j
]
.
Rev
!=
rev
{
δBroots
:=
ΔBroots
{
Rev
:
rev
,
ΔRoots
:
S
etOid
{}}
δBroots
:=
ΔBroots
{
Rev
:
rev
,
ΔRoots
:
s
etOid
{}}
// insert(@j, δBroots)
// insert(@j, δBroots)
δBtail
.
vδBroots
=
append
(
δBtail
.
vδBroots
[
:
j
],
δBtail
.
vδBroots
=
append
(
δBtail
.
vδBroots
[
:
j
],
append
([]
ΔBroots
{
δBroots
},
append
([]
ΔBroots
{
δBroots
},
...
@@ -708,7 +708,7 @@ func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) {
...
@@ -708,7 +708,7 @@ func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) {
// go through vδBroots till revcut -> find which trees to trim -> trim ΔTtails.
// go through vδBroots till revcut -> find which trees to trim -> trim ΔTtails.
totrim
:=
S
etOid
{}
// roots whose ΔTtail has changes ≤ revCut
totrim
:=
s
etOid
{}
// roots whose ΔTtail has changes ≤ revCut
icut
:=
0
icut
:=
0
for
;
icut
<
len
(
δBtail
.
vδBroots
);
icut
++
{
for
;
icut
<
len
(
δBtail
.
vδBroots
);
icut
++
{
δBroots
:=
δBtail
.
vδBroots
[
icut
]
δBroots
:=
δBtail
.
vδBroots
[
icut
]
...
...
wcfs/internal/xbtree/δbtail_test.go
View file @
0f7b5c42
...
@@ -71,7 +71,7 @@ import (
...
@@ -71,7 +71,7 @@ import (
)
)
// trackSet returns what should be ΔBtail.trackSet coverage for specified tracked key set.
// trackSet returns what should be ΔBtail.trackSet coverage for specified tracked key set.
func
(
rbs
RBucketSet
)
trackSet
(
tracked
S
etKey
)
PPTreeSubSet
{
func
(
rbs
RBucketSet
)
trackSet
(
tracked
s
etKey
)
PPTreeSubSet
{
// nil = don't compute keyCover
// nil = don't compute keyCover
// (trackSet is called from inside hot inner loop of rebuild test)
// (trackSet is called from inside hot inner loop of rebuild test)
trackSet
:=
rbs
.
_trackSetWithCov
(
tracked
,
nil
)
trackSet
:=
rbs
.
_trackSetWithCov
(
tracked
,
nil
)
...
@@ -79,13 +79,13 @@ func (rbs RBucketSet) trackSet(tracked SetKey) PPTreeSubSet {
...
@@ -79,13 +79,13 @@ func (rbs RBucketSet) trackSet(tracked SetKey) PPTreeSubSet {
}
}
// trackSetWithCov returns what should be ΔBtail.trackSet and its key coverage for specified tracked key set.
// trackSetWithCov returns what should be ΔBtail.trackSet and its key coverage for specified tracked key set.
func
(
rbs
RBucketSet
)
trackSetWithCov
(
tracked
S
etKey
)
(
trackSet
PPTreeSubSet
,
keyCover
*
RangedKeySet
)
{
func
(
rbs
RBucketSet
)
trackSetWithCov
(
tracked
s
etKey
)
(
trackSet
PPTreeSubSet
,
keyCover
*
RangedKeySet
)
{
keyCover
=
&
RangedKeySet
{}
keyCover
=
&
RangedKeySet
{}
trackSet
=
rbs
.
_trackSetWithCov
(
tracked
,
keyCover
)
trackSet
=
rbs
.
_trackSetWithCov
(
tracked
,
keyCover
)
return
trackSet
,
keyCover
return
trackSet
,
keyCover
}
}
func
(
rbs
RBucketSet
)
_trackSetWithCov
(
tracked
S
etKey
,
outKeyCover
*
RangedKeySet
)
(
trackSet
PPTreeSubSet
)
{
func
(
rbs
RBucketSet
)
_trackSetWithCov
(
tracked
s
etKey
,
outKeyCover
*
RangedKeySet
)
(
trackSet
PPTreeSubSet
)
{
trackSet
=
PPTreeSubSet
{}
trackSet
=
PPTreeSubSet
{}
for
k
:=
range
tracked
{
for
k
:=
range
tracked
{
kb
:=
rbs
.
Get
(
k
)
kb
:=
rbs
.
Get
(
k
)
...
@@ -179,11 +179,11 @@ func XGetδKV(t1, t2 *tTreeCommit, δkvOid map[Key]ΔValue) map[Key]Δstring {
...
@@ -179,11 +179,11 @@ func XGetδKV(t1, t2 *tTreeCommit, δkvOid map[Key]ΔValue) map[Key]Δstring {
// Note: adjacency matrix is symmetric (KAdj verifies this at runtime):
// Note: adjacency matrix is symmetric (KAdj verifies this at runtime):
//
//
// kadj(A,B) == kadj(B,A)
// kadj(A,B) == kadj(B,A)
type
KAdjMatrix
map
[
Key
]
S
etKey
type
KAdjMatrix
map
[
Key
]
s
etKey
// Map returns kadj·keys .
// Map returns kadj·keys .
func
(
kadj
KAdjMatrix
)
Map
(
keys
SetKey
)
S
etKey
{
func
(
kadj
KAdjMatrix
)
Map
(
keys
setKey
)
s
etKey
{
res
:=
make
(
S
etKey
,
len
(
keys
))
res
:=
make
(
s
etKey
,
len
(
keys
))
for
k
:=
range
keys
{
for
k
:=
range
keys
{
to
,
ok
:=
kadj
[
k
]
to
,
ok
:=
kadj
[
k
]
if
!
ok
{
if
!
ok
{
...
@@ -217,7 +217,7 @@ func (kadjA KAdjMatrix) Mul(kadjB KAdjMatrix) KAdjMatrix {
...
@@ -217,7 +217,7 @@ func (kadjA KAdjMatrix) Mul(kadjB KAdjMatrix) KAdjMatrix {
// This set of keys defaults to allTestKeys(t1,t2).
// This set of keys defaults to allTestKeys(t1,t2).
//
//
// KAdj itself is verified by testΔBTail on entries with .kadjOK set.
// KAdj itself is verified by testΔBTail on entries with .kadjOK set.
func
KAdj
(
t1
,
t2
*
tTreeCommit
,
keysv
...
S
etKey
)
(
kadj
KAdjMatrix
)
{
func
KAdj
(
t1
,
t2
*
tTreeCommit
,
keysv
...
s
etKey
)
(
kadj
KAdjMatrix
)
{
// assert KAdj(A,B) == KAdj(B,A)
// assert KAdj(A,B) == KAdj(B,A)
kadj12
:=
_KAdj
(
t1
,
t2
,
keysv
...
)
kadj12
:=
_KAdj
(
t1
,
t2
,
keysv
...
)
kadj21
:=
_KAdj
(
t2
,
t1
,
keysv
...
)
kadj21
:=
_KAdj
(
t2
,
t1
,
keysv
...
)
...
@@ -235,8 +235,8 @@ func debugfKAdj(format string, argv ...interface{}) {
...
@@ -235,8 +235,8 @@ func debugfKAdj(format string, argv ...interface{}) {
}
}
}
}
func
_KAdj
(
t1
,
t2
*
tTreeCommit
,
keysv
...
S
etKey
)
(
kadj
KAdjMatrix
)
{
func
_KAdj
(
t1
,
t2
*
tTreeCommit
,
keysv
...
s
etKey
)
(
kadj
KAdjMatrix
)
{
var
keys
S
etKey
var
keys
s
etKey
switch
len
(
keysv
)
{
switch
len
(
keysv
)
{
case
0
:
case
0
:
keys
=
allTestKeys
(
t1
,
t2
)
keys
=
allTestKeys
(
t1
,
t2
)
...
@@ -258,8 +258,8 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
...
@@ -258,8 +258,8 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
// if k is tracked and covered by changed leaf -> changes to adjacents must be in Update(t1->t2).
// if k is tracked and covered by changed leaf -> changes to adjacents must be in Update(t1->t2).
kadj
=
KAdjMatrix
{}
kadj
=
KAdjMatrix
{}
for
k
:=
range
keys
{
for
k
:=
range
keys
{
adj1
:=
S
etKey
{}
adj1
:=
s
etKey
{}
adj2
:=
S
etKey
{}
adj2
:=
s
etKey
{}
q1
:=
&
RangedKeySet
{};
q1
.
Add
(
k
)
q1
:=
&
RangedKeySet
{};
q1
.
Add
(
k
)
q2
:=
&
RangedKeySet
{};
q2
.
Add
(
k
)
q2
:=
&
RangedKeySet
{};
q2
.
Add
(
k
)
...
@@ -329,7 +329,7 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
...
@@ -329,7 +329,7 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
q2
.
Clear
()
q2
.
Clear
()
}
}
adj
:=
S
etKey
{};
adj
.
Update
(
adj1
);
adj
.
Update
(
adj2
)
adj
:=
s
etKey
{};
adj
.
Update
(
adj1
);
adj
.
Update
(
adj2
)
kadj
[
k
]
=
adj
kadj
[
k
]
=
adj
}
}
...
@@ -354,7 +354,7 @@ func xverifyΔBTail_Update(t *testing.T, subj string, db *zodb.DB, treeRoot zodb
...
@@ -354,7 +354,7 @@ func xverifyΔBTail_Update(t *testing.T, subj string, db *zodb.DB, treeRoot zodb
// verify at1->at2 for all combination of initial tracked keys.
// verify at1->at2 for all combination of initial tracked keys.
for
kidx
:=
range
IntSets
(
len
(
allKeyv
))
{
for
kidx
:=
range
IntSets
(
len
(
allKeyv
))
{
keys
:=
S
etKey
{}
keys
:=
s
etKey
{}
for
_
,
idx
:=
range
kidx
{
for
_
,
idx
:=
range
kidx
{
keys
.
Add
(
allKeyv
[
idx
])
keys
.
Add
(
allKeyv
[
idx
])
}
}
...
@@ -370,17 +370,17 @@ func xverifyΔBTail_Update(t *testing.T, subj string, db *zodb.DB, treeRoot zodb
...
@@ -370,17 +370,17 @@ func xverifyΔBTail_Update(t *testing.T, subj string, db *zodb.DB, treeRoot zodb
// xverifyΔBTail_Update1 verifies how ΔBTail handles ZODB update at1->at2 from initial
// xverifyΔBTail_Update1 verifies how ΔBTail handles ZODB update at1->at2 from initial
// tracked state defined by initialTrackedKeys.
// tracked state defined by initialTrackedKeys.
func
xverifyΔBTail_Update1
(
t
*
testing
.
T
,
subj
string
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
t1
,
t2
*
tTreeCommit
,
initialTrackedKeys
S
etKey
,
kadj
KAdjMatrix
)
{
func
xverifyΔBTail_Update1
(
t
*
testing
.
T
,
subj
string
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
t1
,
t2
*
tTreeCommit
,
initialTrackedKeys
s
etKey
,
kadj
KAdjMatrix
)
{
X
:=
exc
.
Raiseif
X
:=
exc
.
Raiseif
//t.Logf("\n>>> Track=%s\n", initialTrackedKeys)
//t.Logf("\n>>> Track=%s\n", initialTrackedKeys)
δZ
:=
t2
.
δZ
δZ
:=
t2
.
δZ
d12
:=
t2
.
δxkv
d12
:=
t2
.
δxkv
var
TrackedδZ
S
etKey
=
nil
var
TrackedδZ
s
etKey
=
nil
var
kadjTrackedδZ
S
etKey
=
nil
var
kadjTrackedδZ
s
etKey
=
nil
var
δT
,
δTok
map
[
Key
]
Δstring
=
nil
,
nil
var
δT
,
δTok
map
[
Key
]
Δstring
=
nil
,
nil
δZset
:=
S
etOid
{}
δZset
:=
s
etOid
{}
for
_
,
oid
:=
range
δZ
.
Changev
{
for
_
,
oid
:=
range
δZ
.
Changev
{
δZset
.
Add
(
oid
)
δZset
.
Add
(
oid
)
}
}
...
@@ -411,7 +411,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
...
@@ -411,7 +411,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
xtrackKeys
(
δbtail
,
t1
,
initialTrackedKeys
)
xtrackKeys
(
δbtail
,
t1
,
initialTrackedKeys
)
// TrackedδZ = Tracked ^ δZ (i.e. a tracked node has changed, or its coverage was changed)
// TrackedδZ = Tracked ^ δZ (i.e. a tracked node has changed, or its coverage was changed)
TrackedδZ
=
S
etKey
{}
TrackedδZ
=
s
etKey
{}
for
k
:=
range
initialTrackedKeys
{
for
k
:=
range
initialTrackedKeys
{
leaf1
:=
t1
.
xkv
.
Get
(
k
)
leaf1
:=
t1
.
xkv
.
Get
(
k
)
oid1
:=
leaf1
.
oid
oid1
:=
leaf1
.
oid
...
@@ -428,7 +428,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
...
@@ -428,7 +428,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
}
}
}
}
kadjTrackedδZ
=
S
etKey
{}
// kadj[Tracked^δZ] (all keys adjacent to tracked^δZ)
kadjTrackedδZ
=
s
etKey
{}
// kadj[Tracked^δZ] (all keys adjacent to tracked^δZ)
for
k
:=
range
TrackedδZ
{
for
k
:=
range
TrackedδZ
{
kadjTrackedδZ
.
Update
(
kadj
[
k
])
kadjTrackedδZ
.
Update
(
kadj
[
k
])
}
}
...
@@ -500,11 +500,11 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
...
@@ -500,11 +500,11 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
// assert δB.ByRoot == {treeRoot -> ...} if δTok != ø
// assert δB.ByRoot == {treeRoot -> ...} if δTok != ø
// == ø if δTok == ø
// == ø if δTok == ø
rootsOK
:=
S
etOid
{}
rootsOK
:=
s
etOid
{}
if
len
(
δTok
)
>
0
{
if
len
(
δTok
)
>
0
{
rootsOK
.
Add
(
treeRoot
)
rootsOK
.
Add
(
treeRoot
)
}
}
roots
:=
S
etOid
{}
roots
:=
s
etOid
{}
for
root
:=
range
δB
.
ΔByRoot
{
for
root
:=
range
δB
.
ΔByRoot
{
roots
.
Add
(
root
)
roots
.
Add
(
root
)
}
}
...
@@ -564,7 +564,7 @@ func (δBtail *ΔBtail) assertTrack(t *testing.T, subj string, trackSetOK PPTree
...
@@ -564,7 +564,7 @@ func (δBtail *ΔBtail) assertTrack(t *testing.T, subj string, trackSetOK PPTree
t
.
Errorf
(
"%s: trackSet:
\n\t
have: %v
\n\t
want: %v"
,
subj
,
δBtail
.
trackSet
,
trackSetOK
)
t
.
Errorf
(
"%s: trackSet:
\n\t
have: %v
\n\t
want: %v"
,
subj
,
δBtail
.
trackSet
,
trackSetOK
)
}
}
roots
:=
S
etOid
{}
roots
:=
s
etOid
{}
for
root
:=
range
δBtail
.
vδTbyRoot
{
for
root
:=
range
δBtail
.
vδTbyRoot
{
roots
.
Add
(
root
)
roots
.
Add
(
root
)
}
}
...
@@ -585,7 +585,7 @@ func (δBtail *ΔBtail) assertTrack(t *testing.T, subj string, trackSetOK PPTree
...
@@ -585,7 +585,7 @@ func (δBtail *ΔBtail) assertTrack(t *testing.T, subj string, trackSetOK PPTree
δTtail
:=
δBtail
.
vδTbyRoot
[
root
]
δTtail
:=
δBtail
.
vδTbyRoot
[
root
]
trackNewRootsOK
:=
S
etOid
{}
trackNewRootsOK
:=
s
etOid
{}
if
!
trackNewOK
.
Empty
()
{
if
!
trackNewOK
.
Empty
()
{
trackNewRootsOK
.
Add
(
root
)
trackNewRootsOK
.
Add
(
root
)
}
}
...
@@ -633,7 +633,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -633,7 +633,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
// verify t0 -> t1 Track(keys1) Rebuild -> t2 Track(keys2) Rebuild
// verify t0 -> t1 Track(keys1) Rebuild -> t2 Track(keys2) Rebuild
// for all combinations of keys1 and keys2
// for all combinations of keys1 and keys2
for
k1idx
:=
range
IntSets
(
len
(
tAllKeyv
))
{
for
k1idx
:=
range
IntSets
(
len
(
tAllKeyv
))
{
keys1
:=
S
etKey
{}
keys1
:=
s
etKey
{}
for
_
,
idx1
:=
range
k1idx
{
for
_
,
idx1
:=
range
k1idx
{
keys1
.
Add
(
tAllKeyv
[
idx1
])
keys1
.
Add
(
tAllKeyv
[
idx1
])
}
}
...
@@ -708,7 +708,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -708,7 +708,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
// reduce that to = tAllKeys - keys1R2 in short mode
// reduce that to = tAllKeys - keys1R2 in short mode
// ( if key from keys2 already became tracked after Track(keys1) + Update,
// ( if key from keys2 already became tracked after Track(keys1) + Update,
// adding Track(that-key), is not adding much testing coverage to recompute paths )
// adding Track(that-key), is not adding much testing coverage to recompute paths )
var
tRestKeys2
S
etKey
var
tRestKeys2
s
etKey
if
testing
.
Short
()
{
if
testing
.
Short
()
{
tRestKeys2
=
tAllKeys
.
Difference
(
keys1R2
)
tRestKeys2
=
tAllKeys
.
Difference
(
keys1R2
)
}
else
{
}
else
{
...
@@ -717,7 +717,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -717,7 +717,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
tRestKeyv2
:=
tRestKeys2
.
SortedElements
()
tRestKeyv2
:=
tRestKeys2
.
SortedElements
()
for
k2idx
:=
range
IntSets
(
len
(
tRestKeyv2
))
{
for
k2idx
:=
range
IntSets
(
len
(
tRestKeyv2
))
{
keys2
:=
S
etKey
{}
keys2
:=
s
etKey
{}
for
_
,
idx2
:=
range
k2idx
{
for
_
,
idx2
:=
range
k2idx
{
keys2
.
Add
(
tRestKeyv2
[
idx2
])
keys2
.
Add
(
tRestKeyv2
[
idx2
])
}
}
...
@@ -815,7 +815,7 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, treeRoot zodb.Oid,
...
@@ -815,7 +815,7 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, treeRoot zodb.Oid,
δrootsOK
=
0
δrootsOK
=
0
}
}
δroots
:=
S
etOid
{}
δroots
:=
s
etOid
{}
for
root
:=
range
δbtail
.
vδTbyRoot
{
for
root
:=
range
δbtail
.
vδTbyRoot
{
δroots
.
Add
(
root
)
δroots
.
Add
(
root
)
}
}
...
@@ -835,7 +835,7 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, treeRoot zodb.Oid,
...
@@ -835,7 +835,7 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, treeRoot zodb.Oid,
}
}
// xverifyΔBTail_rebuild_TR verifies ΔBtail state after Track(keys) + rebuild.
// xverifyΔBTail_rebuild_TR verifies ΔBtail state after Track(keys) + rebuild.
func
xverifyΔBTail_rebuild_TR
(
t
*
testing
.
T
,
δbtail
*
ΔBtail
,
tj
*
tTreeCommit
,
treeRoot
zodb
.
Oid
,
xat
map
[
zodb
.
Tid
]
string
,
keys
S
etKey
,
trackSet
PPTreeSubSet
,
trackNew
,
trackSetAfterRebuild
PPTreeSubSet
,
vδTok
...
map
[
Key
]
Δstring
)
{
func
xverifyΔBTail_rebuild_TR
(
t
*
testing
.
T
,
δbtail
*
ΔBtail
,
tj
*
tTreeCommit
,
treeRoot
zodb
.
Oid
,
xat
map
[
zodb
.
Tid
]
string
,
keys
s
etKey
,
trackSet
PPTreeSubSet
,
trackNew
,
trackSetAfterRebuild
PPTreeSubSet
,
vδTok
...
map
[
Key
]
Δstring
)
{
t
.
Helper
()
t
.
Helper
()
ø
:=
PPTreeSubSet
{}
ø
:=
PPTreeSubSet
{}
...
@@ -933,7 +933,7 @@ func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, tj *tTreeCommit,
...
@@ -933,7 +933,7 @@ func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, tj *tTreeCommit,
// xtrackKeys issues δbtail.Track requests for tree[keys].
// xtrackKeys issues δbtail.Track requests for tree[keys].
// XXX place
// XXX place
func
xtrackKeys
(
δbtail
*
ΔBtail
,
t
*
tTreeCommit
,
keys
S
etKey
)
{
func
xtrackKeys
(
δbtail
*
ΔBtail
,
t
*
tTreeCommit
,
keys
s
etKey
)
{
X
:=
exc
.
Raiseif
X
:=
exc
.
Raiseif
head
:=
δbtail
.
Head
()
head
:=
δbtail
.
Head
()
if
head
!=
t
.
at
{
if
head
!=
t
.
at
{
...
@@ -981,7 +981,7 @@ func ___xverifyΔBTail_GetAt(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, vt ..
...
@@ -981,7 +981,7 @@ func ___xverifyΔBTail_GetAt(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, vt ..
// verify t1->t2-> ... ->tn Track(keys) Get(keys, @at)
// verify t1->t2-> ... ->tn Track(keys) Get(keys, @at)
// for all combinations of tracked keys and at
// for all combinations of tracked keys and at
for kidx := range IntSets(len(tkeyv)) {
for kidx := range IntSets(len(tkeyv)) {
keys :=
S
etKey{}
keys :=
s
etKey{}
for _, idx := range kidx {
for _, idx := range kidx {
keys.Add(tkeyv[idx])
keys.Add(tkeyv[idx])
}
}
...
@@ -993,7 +993,7 @@ func ___xverifyΔBTail_GetAt(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, vt ..
...
@@ -993,7 +993,7 @@ func ___xverifyΔBTail_GetAt(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, vt ..
})
})
}
}
func xverifyΔBTail_GetAt1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, vt []*tTreeCommit, xat map[zodb.Tid]string, keys
S
etKey) {
func xverifyΔBTail_GetAt1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, vt []*tTreeCommit, xat map[zodb.Tid]string, keys
s
etKey) {
X := exc.Raiseif
X := exc.Raiseif
// t1->t2-> ... -> tn
// t1->t2-> ... -> tn
...
@@ -1117,9 +1117,9 @@ func testΔBTail(t_ *testing.T, testq chan ΔBTestEntry) {
...
@@ -1117,9 +1117,9 @@ func testΔBTail(t_ *testing.T, testq chan ΔBTestEntry) {
// TestΔBTail verifies ΔBTail for explicitly provided tree topologies.
// TestΔBTail verifies ΔBTail for explicitly provided tree topologies.
func
TestΔBTail
(
t
*
testing
.
T
)
{
func
TestΔBTail
(
t
*
testing
.
T
)
{
// K is shorthand for
S
etKey
// K is shorthand for
s
etKey
K
:=
func
(
keyv
...
Key
)
S
etKey
{
K
:=
func
(
keyv
...
Key
)
s
etKey
{
ks
:=
S
etKey
{}
ks
:=
s
etKey
{}
for
_
,
k
:=
range
keyv
{
ks
.
Add
(
k
)
}
for
_
,
k
:=
range
keyv
{
ks
.
Add
(
k
)
}
return
ks
return
ks
}
}
...
@@ -1577,7 +1577,7 @@ func TestΔBtailForget(t_ *testing.T) {
...
@@ -1577,7 +1577,7 @@ func TestΔBtailForget(t_ *testing.T) {
// start tracking. everything becomes tracked because t1's T/B1:a has [-∞,∞) coverage
// start tracking. everything becomes tracked because t1's T/B1:a has [-∞,∞) coverage
// By starting tracking after t2 we verify vδBroots update in both Update and rebuild
// By starting tracking after t2 we verify vδBroots update in both Update and rebuild
_0
:=
S
etKey
{};
_0
.
Add
(
0
)
_0
:=
s
etKey
{};
_0
.
Add
(
0
)
xtrackKeys
(
δbtail
,
t2
,
_0
)
xtrackKeys
(
δbtail
,
t2
,
_0
)
_
,
err
=
δbtail
.
Update
(
t3
.
δZ
);
X
(
err
)
_
,
err
=
δbtail
.
Update
(
t3
.
δZ
);
X
(
err
)
...
@@ -1609,7 +1609,7 @@ func TestΔBtailClone(t_ *testing.T) {
...
@@ -1609,7 +1609,7 @@ func TestΔBtailClone(t_ *testing.T) {
t1
:=
t
.
CommitTree
(
"T2/B1:c-B2:d"
)
t1
:=
t
.
CommitTree
(
"T2/B1:c-B2:d"
)
δbtail
:=
NewΔBtail
(
t0
.
at
,
t
.
db
)
δbtail
:=
NewΔBtail
(
t0
.
at
,
t
.
db
)
_
,
err
:=
δbtail
.
Update
(
t1
.
δZ
);
X
(
err
)
_
,
err
:=
δbtail
.
Update
(
t1
.
δZ
);
X
(
err
)
_2
:=
S
etKey
{};
_2
.
Add
(
2
)
_2
:=
s
etKey
{};
_2
.
Add
(
2
)
xtrackKeys
(
δbtail
,
t1
,
_2
)
xtrackKeys
(
δbtail
,
t1
,
_2
)
err
=
δbtail
.
rebuildAll
();
X
(
err
)
err
=
δbtail
.
rebuildAll
();
X
(
err
)
...
@@ -1678,8 +1678,8 @@ func TestIntSets(t *testing.T) {
...
@@ -1678,8 +1678,8 @@ func TestIntSets(t *testing.T) {
// allTestKeys returns all keys from vt + ∞.
// allTestKeys returns all keys from vt + ∞.
func
allTestKeys
(
vt
...*
tTreeCommit
)
S
etKey
{
func
allTestKeys
(
vt
...*
tTreeCommit
)
s
etKey
{
allKeys
:=
S
etKey
{};
allKeys
.
Add
(
KeyMax
)
// ∞ simulating ZBigFile.Size() query
allKeys
:=
s
etKey
{};
allKeys
.
Add
(
KeyMax
)
// ∞ simulating ZBigFile.Size() query
for
_
,
t
:=
range
vt
{
for
_
,
t
:=
range
vt
{
for
_
,
b
:=
range
t
.
xkv
{
for
_
,
b
:=
range
t
.
xkv
{
for
k
:=
range
b
.
kv
{
for
k
:=
range
b
.
kv
{
...
...
wcfs/internal/zdata/δftail.go
View file @
0f7b5c42
...
@@ -33,8 +33,8 @@ import (
...
@@ -33,8 +33,8 @@ import (
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xzodb"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xzodb"
)
)
type
SetI64
=
set
.
Set
I64
type
setI64
=
set
.
I64
type
SetOid
=
set
.
Set
Oid
type
setOid
=
set
.
Oid
// ΔFtail represents tail of revisional changes to files.
// ΔFtail represents tail of revisional changes to files.
//
//
...
@@ -75,9 +75,9 @@ type SetOid = set.SetOid
...
@@ -75,9 +75,9 @@ type SetOid = set.SetOid
type
ΔFtail
struct
{
type
ΔFtail
struct
{
// ΔFtail merges ΔBtail with history of ZBlk
// ΔFtail merges ΔBtail with history of ZBlk
δBtail
*
xbtree
.
ΔBtail
δBtail
*
xbtree
.
ΔBtail
fileIdx
map
[
zodb
.
Oid
]
S
etOid
// tree-root -> {} ZBigFile<oid> as of @head
fileIdx
map
[
zodb
.
Oid
]
s
etOid
// tree-root -> {} ZBigFile<oid> as of @head
trackSetZFile
S
etOid
// set of tracked ZBigFiles as of @head
trackSetZFile
s
etOid
// set of tracked ZBigFiles as of @head
trackSetZBlk
map
[
zodb
.
Oid
]
*
zblkTrack
// zblk -> {} root -> {}blk as of @head
trackSetZBlk
map
[
zodb
.
Oid
]
*
zblkTrack
// zblk -> {} root -> {}blk as of @head
// XXX kill
// XXX kill
///*
///*
...
@@ -95,8 +95,8 @@ type ΔFtail struct {
...
@@ -95,8 +95,8 @@ type ΔFtail struct {
// zblkTrack keeps information in which root/blocks ZBlk is present as of @head.
// zblkTrack keeps information in which root/blocks ZBlk is present as of @head.
type
zblkTrack
struct
{
type
zblkTrack
struct
{
// inroot map[zodb.Oid]
S
etI64 // {} root -> {}blk XXX later switch to this
// inroot map[zodb.Oid]
s
etI64 // {} root -> {}blk XXX later switch to this
infile
map
[
zodb
.
Oid
]
S
etI64
// {} foid -> {}blk
infile
map
[
zodb
.
Oid
]
s
etI64
// {} foid -> {}blk
}
}
// ΔF represents a change in files space.
// ΔF represents a change in files space.
...
@@ -108,7 +108,7 @@ type ΔF struct {
...
@@ -108,7 +108,7 @@ type ΔF struct {
// ΔFile represents a change to one file.
// ΔFile represents a change to one file.
type
ΔFile
struct
{
type
ΔFile
struct
{
Rev
zodb
.
Tid
Rev
zodb
.
Tid
Blocks
S
etI64
// changed blocks XXX -> ΔBlocks ?
Blocks
s
etI64
// changed blocks XXX -> ΔBlocks ?
Size
bool
// whether file size changed XXX -> ΔSize?
Size
bool
// whether file size changed XXX -> ΔSize?
}
}
...
@@ -123,8 +123,8 @@ type ΔFile struct {
...
@@ -123,8 +123,8 @@ type ΔFile struct {
func
NewΔFtail
(
at0
zodb
.
Tid
,
db
*
zodb
.
DB
)
*
ΔFtail
{
func
NewΔFtail
(
at0
zodb
.
Tid
,
db
*
zodb
.
DB
)
*
ΔFtail
{
return
&
ΔFtail
{
return
&
ΔFtail
{
δBtail
:
xbtree
.
NewΔBtail
(
at0
,
db
),
δBtail
:
xbtree
.
NewΔBtail
(
at0
,
db
),
fileIdx
:
map
[
zodb
.
Oid
]
S
etOid
{},
fileIdx
:
map
[
zodb
.
Oid
]
s
etOid
{},
trackSetZFile
:
S
etOid
{},
trackSetZFile
:
s
etOid
{},
trackSetZBlk
:
map
[
zodb
.
Oid
]
*
zblkTrack
{},
trackSetZBlk
:
map
[
zodb
.
Oid
]
*
zblkTrack
{},
trackNew
:
map
[
zodb
.
Oid
]
map
[
zodb
.
Oid
]
*
zblkTrack
{},
trackNew
:
map
[
zodb
.
Oid
]
map
[
zodb
.
Oid
]
*
zblkTrack
{},
}
}
...
@@ -163,7 +163,7 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, zb
...
@@ -163,7 +163,7 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, zb
root
:=
path
[
0
]
.
(
*
btree
.
LOBTree
)
root
:=
path
[
0
]
.
(
*
btree
.
LOBTree
)
files
,
ok
:=
δFtail
.
fileIdx
[
root
.
POid
()]
files
,
ok
:=
δFtail
.
fileIdx
[
root
.
POid
()]
if
!
ok
{
if
!
ok
{
files
=
S
etOid
{}
files
=
s
etOid
{}
δFtail
.
fileIdx
[
root
.
POid
()]
=
files
δFtail
.
fileIdx
[
root
.
POid
()]
=
files
}
}
files
.
Add
(
foid
)
files
.
Add
(
foid
)
...
@@ -181,9 +181,9 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, zb
...
@@ -181,9 +181,9 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, zb
blocks
,
ok
:=
zt
.
infile
[
foid
]
blocks
,
ok
:=
zt
.
infile
[
foid
]
if
!
ok
{
if
!
ok
{
blocks
=
make
(
S
etI64
,
1
)
blocks
=
make
(
s
etI64
,
1
)
if
zt
.
infile
==
nil
{
if
zt
.
infile
==
nil
{
zt
.
infile
=
make
(
map
[
zodb
.
Oid
]
S
etI64
)
zt
.
infile
=
make
(
map
[
zodb
.
Oid
]
s
etI64
)
}
}
zt
.
infile
[
foid
]
=
blocks
zt
.
infile
[
foid
]
=
blocks
}
}
...
@@ -243,7 +243,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *xzodb.ZConn) (_ ΔF
...
@@ -243,7 +243,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *xzodb.ZConn) (_ ΔF
for
file
:=
range
files
{
for
file
:=
range
files
{
δfile
,
ok
:=
δF
.
ByFile
[
file
]
δfile
,
ok
:=
δF
.
ByFile
[
file
]
if
!
ok
{
if
!
ok
{
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
S
etI64
)}
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
s
etI64
)}
δF
.
ByFile
[
file
]
=
δfile
δF
.
ByFile
[
file
]
=
δfile
}
}
for
blk
/*, zblk*/
:=
range
δt
{
for
blk
/*, zblk*/
:=
range
δt
{
...
@@ -277,7 +277,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *xzodb.ZConn) (_ ΔF
...
@@ -277,7 +277,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *xzodb.ZConn) (_ ΔF
for
foid
,
blocks
:=
range
zt
.
infile
{
for
foid
,
blocks
:=
range
zt
.
infile
{
δfile
,
ok
:=
δF
.
ByFile
[
foid
]
δfile
,
ok
:=
δF
.
ByFile
[
foid
]
if
!
ok
{
if
!
ok
{
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
S
etI64
)}
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
s
etI64
)}
δF
.
ByFile
[
foid
]
=
δfile
δF
.
ByFile
[
foid
]
=
δfile
}
}
...
@@ -328,7 +328,7 @@ func (δFtail *ΔFtail) update(file *ZBigFile) {
...
@@ -328,7 +328,7 @@ func (δFtail *ΔFtail) update(file *ZBigFile) {
// XXX -> func δF.δfile(foid) ?
// XXX -> func δF.δfile(foid) ?
δfile
,
ok
:=
δF
.
ByFile
[
foid
]
δfile
,
ok
:=
δF
.
ByFile
[
foid
]
if
!
ok
{
if
!
ok
{
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
S
etI64
)}
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
s
etI64
)}
δF
.
ByFile
[
foid
]
=
δfile
δF
.
ByFile
[
foid
]
=
δfile
}
}
...
...
wcfs/internal/zdata/δftail_test.go
View file @
0f7b5c42
...
@@ -27,12 +27,12 @@ import (
...
@@ -27,12 +27,12 @@ import (
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/set"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/set"
)
)
type
SetStr
=
set
.
Set
Str
type
setStr
=
set
.
Str
// ΔFTestEntry represents one entry in ΔFtail tests.
// ΔFTestEntry represents one entry in ΔFtail tests.
type
ΔFTestEntry
struct
{
type
ΔFTestEntry
struct
{
δblkTab
map
[
int64
]
string
// change in tree part {} #blk -> ZBlk<oid>
δblkTab
map
[
int64
]
string
// change in tree part {} #blk -> ZBlk<oid>
δblkData
S
etStr
// change to ZBlk objects
δblkData
s
etStr
// change to ZBlk objects
}
}
func
TestΔFtail
(
t
*
testing
.
T
)
{
func
TestΔFtail
(
t
*
testing
.
T
)
{
...
@@ -40,8 +40,8 @@ func TestΔFtail(t *testing.T) {
...
@@ -40,8 +40,8 @@ func TestΔFtail(t *testing.T) {
type
δT
=
map
[
int64
]
string
type
δT
=
map
[
int64
]
string
// δD is shorthand to create δblkData.
// δD is shorthand to create δblkData.
δD
:=
func
(
zblkv
...
string
)
S
etStr
{
δD
:=
func
(
zblkv
...
string
)
s
etStr
{
δ
:=
S
etStr
{}
δ
:=
s
etStr
{}
for
_
,
zblk
:=
range
zblkv
{
for
_
,
zblk
:=
range
zblkv
{
δ
.
Add
(
zblk
)
δ
.
Add
(
zblk
)
}
}
...
@@ -58,9 +58,9 @@ func TestΔFtail(t *testing.T) {
...
@@ -58,9 +58,9 @@ func TestΔFtail(t *testing.T) {
vδf
:=
[]
ΔFile
{}
// (rev↑, {}blk) XXX +.Size?
vδf
:=
[]
ΔFile
{}
// (rev↑, {}blk) XXX +.Size?
blkTab
:=
map
[
int64
]
string
{}
// #blk -> ZBlk<oid>
blkTab
:=
map
[
int64
]
string
{}
// #blk -> ZBlk<oid>
Zinblk
:=
map
[
string
]
S
etI64
{}
// ZBlk<oid> -> which #blk refer to it
Zinblk
:=
map
[
string
]
s
etI64
{}
// ZBlk<oid> -> which #blk refer to it
for
_
,
test
:=
range
testv
{
for
_
,
test
:=
range
testv
{
δf
:=
S
etI64
{}
δf
:=
s
etI64
{}
for
blk
,
zblk
:=
range
test
.
δblkTab
{
for
blk
,
zblk
:=
range
test
.
δblkTab
{
// rebuild blkTab/Zinblk
// rebuild blkTab/Zinblk
...
@@ -75,7 +75,7 @@ func TestΔFtail(t *testing.T) {
...
@@ -75,7 +75,7 @@ func TestΔFtail(t *testing.T) {
blkTab
[
blk
]
=
zblk
blkTab
[
blk
]
=
zblk
inblk
,
ok
:=
Zinblk
[
zblk
]
inblk
,
ok
:=
Zinblk
[
zblk
]
if
!
ok
{
if
!
ok
{
inblk
=
S
etI64
{}
inblk
=
s
etI64
{}
Zinblk
[
zblk
]
=
inblk
Zinblk
[
zblk
]
=
inblk
}
}
inblk
.
Add
(
blk
)
inblk
.
Add
(
blk
)
...
...
wcfs/wcfs.go
View file @
0f7b5c42
...
@@ -525,7 +525,7 @@ type (
...
@@ -525,7 +525,7 @@ type (
ZData
=
zdata
.
ZData
ZData
=
zdata
.
ZData
ZBigFile
=
zdata
.
ZBigFile
ZBigFile
=
zdata
.
ZBigFile
SetI64
=
set
.
Set
I64
setI64
=
set
.
I64
)
)
// Root represents root of wcfs filesystem.
// Root represents root of wcfs filesystem.
...
@@ -632,7 +632,7 @@ type BigFile struct {
...
@@ -632,7 +632,7 @@ type BigFile struct {
// blocks that were ever read-accessed (head/ only) XXX locking by bfdir.δFmu ?
// blocks that were ever read-accessed (head/ only) XXX locking by bfdir.δFmu ?
// XXX = δFtail.Tracked(f) ?
// XXX = δFtail.Tracked(f) ?
accessed
S
etI64
accessed
s
etI64
// inflight loadings of ZBigFile from ZODB.
// inflight loadings of ZBigFile from ZODB.
// successful load results are kept here until blkdata is put into OS pagecache.
// successful load results are kept here until blkdata is put into OS pagecache.
...
@@ -2210,7 +2210,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
...
@@ -2210,7 +2210,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
// FIXME: scan zfile.blktab - so that we can detect all btree changes
// FIXME: scan zfile.blktab - so that we can detect all btree changes
// see "XXX building δFtail lazily ..." in notes.txt
// see "XXX building δFtail lazily ..." in notes.txt
f
.
accessed
=
make
(
S
etI64
)
f
.
accessed
=
make
(
s
etI64
)
f
.
watchTab
=
make
(
map
[
*
Watch
]
struct
{})
f
.
watchTab
=
make
(
map
[
*
Watch
]
struct
{})
}
}
...
...
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