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
ba246c80
Commit
ba246c80
authored
Jul 01, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "."
This reverts commit
a5027dc7
.
parent
a5027dc7
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
165 additions
and
66 deletions
+165
-66
wcfs/internal/xbtree/misc.go
wcfs/internal/xbtree/misc.go
+28
-0
wcfs/internal/xbtree/pptreesubset.go
wcfs/internal/xbtree/pptreesubset.go
+1
-1
wcfs/internal/xbtree/pptreesubset_test.go
wcfs/internal/xbtree/pptreesubset_test.go
+1
-1
wcfs/internal/xbtree/rangeset.go
wcfs/internal/xbtree/rangeset.go
+1
-1
wcfs/internal/xbtree/rangeset_test.go
wcfs/internal/xbtree/rangeset_test.go
+1
-1
wcfs/internal/xbtree/treediff.go
wcfs/internal/xbtree/treediff.go
+1
-1
wcfs/internal/xbtree/xbtree.go
wcfs/internal/xbtree/xbtree.go
+4
-14
wcfs/internal/xbtree/xbtreetest/kvdiff.go
wcfs/internal/xbtree/xbtreetest/kvdiff.go
+1
-22
wcfs/internal/xbtree/xbtreetest/kvdiff_test.go
wcfs/internal/xbtree/xbtreetest/kvdiff_test.go
+44
-0
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
+1
-1
wcfs/internal/xbtree/xbtreetest/treegen.go
wcfs/internal/xbtree/xbtreetest/treegen.go
+1
-1
wcfs/internal/xbtree/xbtreetest/treegen.py
wcfs/internal/xbtree/xbtreetest/treegen.py
+0
-0
wcfs/internal/xbtree/xbtreetest/xbtreetest.go
wcfs/internal/xbtree/xbtreetest/xbtreetest.go
+49
-0
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+1
-1
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+11
-3
wcfs/internal/xbtree/δbtail_x_test.go
wcfs/internal/xbtree/δbtail_x_test.go
+7
-7
wcfs/internal/zdata/zblk.go
wcfs/internal/zdata/zblk.go
+1
-1
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+10
-9
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+1
-1
No files found.
wcfs/internal/xbtree/misc.go
0 → 100644
View file @
ba246c80
// Copyright (C) 2018-2021 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Free Software licenses or any of the Open Source
// Initiative approved licenses and Convey the resulting work. Corresponding
// source of such a combination shall include the source code for all other
// software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
package
xbtree
import
(
"fmt"
)
func
panicf
(
format
string
,
argv
...
interface
{})
{
panic
(
fmt
.
Sprintf
(
format
,
argv
...
))
}
wcfs/internal/
zhist
/pptreesubset.go
→
wcfs/internal/
xbtree
/pptreesubset.go
View file @
ba246c80
...
@@ -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
zhist
package
xbtree
// PP-connected subset of tree nodes.
// PP-connected subset of tree nodes.
import
(
import
(
...
...
wcfs/internal/
zhist
/pptreesubset_test.go
→
wcfs/internal/
xbtree
/pptreesubset_test.go
View file @
ba246c80
...
@@ -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
zhist
package
xbtree
import
(
import
(
"strings"
"strings"
...
...
wcfs/internal/
zhist
/rangeset.go
→
wcfs/internal/
xbtree
/rangeset.go
View file @
ba246c80
...
@@ -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
zhist
package
xbtree
// set of [lo,hi) Key ranges.
// set of [lo,hi) Key ranges.
import
(
import
(
...
...
wcfs/internal/
zhist
/rangeset_test.go
→
wcfs/internal/
xbtree
/rangeset_test.go
View file @
ba246c80
...
@@ -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
zhist
package
xbtree
import
(
import
(
"testing"
"testing"
...
...
wcfs/internal/
zhist
/treediff.go
→
wcfs/internal/
xbtree
/treediff.go
View file @
ba246c80
...
@@ -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
zhist
package
xbtree
// diff for BTrees
// diff for BTrees
// XXX doc
// XXX doc
...
...
wcfs/internal/
zhist/zhist
.go
→
wcfs/internal/
xbtree/xbtree
.go
View file @
ba246c80
// Package zhist provides way to query ZODB for BTree and ZBigFile history.
// Package xbtree complements package lab.nexedi.com/kirr/neo/go/zodb/btree.
//
// XXX doc
// It complements packages lab.nexedi.com/kirr/neo/go/zodb/btree and
package
xbtree
// lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/zdata.
//
// It provides:
//
// - ΔBTail to query BTree-level ZODB history, and
// - ΔFtail to query ZBigFile-level ZODB history.
package
zhist
import
(
import
(
"fmt"
"fmt"
...
@@ -80,7 +74,3 @@ func kstr(k Key) string {
...
@@ -80,7 +74,3 @@ func kstr(k Key) string {
}
}
return
fmt
.
Sprintf
(
"%d"
,
k
)
return
fmt
.
Sprintf
(
"%d"
,
k
)
}
}
func
panicf
(
format
string
,
argv
...
interface
{})
{
panic
(
fmt
.
Sprintf
(
format
,
argv
...
))
}
wcfs/internal/
zhist/kvdiff_test
.go
→
wcfs/internal/
xbtree/xbtreetest/kvdiff
.go
View file @
ba246c80
...
@@ -17,15 +17,13 @@
...
@@ -17,15 +17,13 @@
// 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
zhi
st
package
xbtreete
st
// kvdiff + friends
// kvdiff + friends
import
(
import
(
"fmt"
"fmt"
"reflect"
"sort"
"sort"
"strings"
"strings"
"testing"
)
)
// kvdiff returns difference in between kv1 and kv2.
// kvdiff returns difference in between kv1 and kv2.
...
@@ -53,16 +51,6 @@ func kvdiff(kv1, kv2 map[Key]string) map[Key]Δstring {
...
@@ -53,16 +51,6 @@ func kvdiff(kv1, kv2 map[Key]string) map[Key]Δstring {
return
delta
return
delta
}
}
func
TestKVDiff
(
t
*
testing
.
T
)
{
kv1
:=
map
[
Key
]
string
{
1
:
"a"
,
3
:
"c"
,
4
:
"d"
}
kv2
:=
map
[
Key
]
string
{
1
:
"b"
,
4
:
"d"
,
5
:
"e"
}
got
:=
kvdiff
(
kv1
,
kv2
)
want
:=
map
[
Key
]
Δstring
{
1
:
{
"a"
,
"b"
},
3
:
{
"c"
,
DEL
},
5
:
{
DEL
,
"e"
}}
if
!
reflect
.
DeepEqual
(
got
,
want
)
{
t
.
Fatalf
(
"error:
\n
got: %v
\n
want: %v"
,
got
,
want
)
}
}
// kvtxt returns string representation of {} kv.
// kvtxt returns string representation of {} kv.
func
kvtxt
(
kv
map
[
Key
]
string
)
string
{
func
kvtxt
(
kv
map
[
Key
]
string
)
string
{
if
len
(
kv
)
==
0
{
if
len
(
kv
)
==
0
{
...
@@ -84,12 +72,3 @@ func kvtxt(kv map[Key]string) string {
...
@@ -84,12 +72,3 @@ func kvtxt(kv map[Key]string) string {
return
strings
.
Join
(
sv
,
","
)
return
strings
.
Join
(
sv
,
","
)
}
}
func
TestKVTxt
(
t
*
testing
.
T
)
{
kv
:=
map
[
Key
]
string
{
3
:
"hello"
,
1
:
"zzz"
,
4
:
"world"
}
got
:=
kvtxt
(
kv
)
want
:=
"1:zzz,3:hello,4:world"
if
got
!=
want
{
t
.
Fatalf
(
"error:
\n
got: %q
\n
want: %q"
,
got
,
want
)
}
}
wcfs/internal/xbtree/xbtreetest/kvdiff_test.go
0 → 100644
View file @
ba246c80
// Copyright (C) 2020-2021 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Free Software licenses or any of the Open Source
// Initiative approved licenses and Convey the resulting work. Corresponding
// source of such a combination shall include the source code for all other
// software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
package
xbtreetest
import
(
"reflect"
"testing"
)
func
TestKVDiff
(
t
*
testing
.
T
)
{
kv1
:=
map
[
Key
]
string
{
1
:
"a"
,
3
:
"c"
,
4
:
"d"
}
kv2
:=
map
[
Key
]
string
{
1
:
"b"
,
4
:
"d"
,
5
:
"e"
}
got
:=
kvdiff
(
kv1
,
kv2
)
want
:=
map
[
Key
]
Δstring
{
1
:
{
"a"
,
"b"
},
3
:
{
"c"
,
DEL
},
5
:
{
DEL
,
"e"
}}
if
!
reflect
.
DeepEqual
(
got
,
want
)
{
t
.
Fatalf
(
"error:
\n
got: %v
\n
want: %v"
,
got
,
want
)
}
}
func
TestKVTxt
(
t
*
testing
.
T
)
{
kv
:=
map
[
Key
]
string
{
3
:
"hello"
,
1
:
"zzz"
,
4
:
"world"
}
got
:=
kvtxt
(
kv
)
want
:=
"1:zzz,3:hello,4:world"
if
got
!=
want
{
t
.
Fatalf
(
"error:
\n
got: %q
\n
want: %q"
,
got
,
want
)
}
}
wcfs/internal/
zhist/rtree_test
.go
→
wcfs/internal/
xbtree/xbtreetest/rtree
.go
View file @
ba246c80
...
@@ -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
zhi
st
package
xbtreete
st
import
(
import
(
"fmt"
"fmt"
...
...
wcfs/internal/
zhist/treeenv_test
.go
→
wcfs/internal/
xbtree/xbtreetest/treeenv
.go
View file @
ba246c80
...
@@ -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
zhi
st
package
xbtreete
st
// TreeEnv + friends
// TreeEnv + friends
import
(
import
(
...
...
wcfs/internal/
zhist/treegen_test
.go
→
wcfs/internal/
xbtree/xbtreetest/treegen
.go
View file @
ba246c80
...
@@ -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
zhi
st
package
xbtreete
st
// treegen.go provides functionality:
// treegen.go provides functionality:
//
//
// - to commit a particular BTree topology into ZODB, and
// - to commit a particular BTree topology into ZODB, and
...
...
wcfs/internal/
zhist/testprog
/treegen.py
→
wcfs/internal/
xbtree/xbtreetest
/treegen.py
View file @
ba246c80
File moved
wcfs/internal/xbtree/xbtreetest/xbtreetest.go
0 → 100644
View file @
ba246c80
// Copyright (C) 2020-2021 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Free Software licenses or any of the Open Source
// Initiative approved licenses and Convey the resulting work. Corresponding
// source of such a combination shall include the source code for all other
// software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// Package xbtreetest provides infrastructure for testing LOBTree with ZBlk values.
// XXX -> treetest?
package
xbtreetest
import
(
"fmt"
"math"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/set"
// "lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xbtree"
)
// XXX dup from xbtree (to avoid import cycle)
type
Tree
=
btree
.
LOBTree
type
Bucket
=
btree
.
LOBucket
type
Key
=
int64
const
KeyMax
Key
=
math
.
MaxInt64
const
KeyMin
Key
=
math
.
MinInt64
type
setKey
=
set
.
I64
const
VDEL
=
zodb
.
InvalidOid
func
panicf
(
format
string
,
argv
...
interface
{})
{
panic
(
fmt
.
Sprintf
(
format
,
argv
...
))
}
wcfs/internal/
zhist
/δbtail.go
→
wcfs/internal/
xbtree
/δbtail.go
View file @
ba246c80
...
@@ -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
zhist
package
xbtree
// ΔBtail
// ΔBtail
import
(
import
(
...
...
wcfs/internal/
zhist
/δbtail_test.go
→
wcfs/internal/
xbtree
/δbtail_test.go
View file @
ba246c80
...
@@ -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
zhist
package
xbtree
// tests for δbtail.go
// tests for δbtail.go
//
//
// This are the main tests for ΔBtail functionality. There are two primary testing concerns:
// This are the main tests for ΔBtail functionality. There are two primary testing concerns:
...
@@ -38,18 +38,23 @@ package zhist
...
@@ -38,18 +38,23 @@ package zhist
//
//
// TestΔBTail and TestΔBTailAllStructs implement approaches "a" and "b" correspondingly.
// TestΔBTail and TestΔBTailAllStructs implement approaches "a" and "b" correspondingly.
//
//
// testprog/treegen.py is used as helper to both:
// testprog/treegen.py is used as helper to both:
XXX moved to xbtreetest
//
//
// - commit a particular BTree topology into ZODB, and
// - commit a particular BTree topology into ZODB, and
// - to generate set of random tree topologies that all correspond to particular {k->v} dict.
// - to generate set of random tree topologies that all correspond to particular {k->v} dict.
import
(
import
(
"bufio"
"context"
"context"
"flag"
"flag"
"fmt"
"fmt"
"io"
"math"
"math"
"math/rand"
"math/rand"
"os"
"os/exec"
"reflect"
"reflect"
"regexp"
"sort"
"sort"
"strings"
"strings"
"testing"
"testing"
...
@@ -60,6 +65,9 @@ import (
...
@@ -60,6 +65,9 @@ import (
"lab.nexedi.com/kirr/neo/go/transaction"
"lab.nexedi.com/kirr/neo/go/transaction"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb"
_
"lab.nexedi.com/kirr/neo/go/zodb/wks"
_
"lab.nexedi.com/kirr/neo/go/zodb/wks"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xbtree/xbtreetest"
// "lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xzodb"
)
)
// 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.
...
@@ -1430,7 +1438,7 @@ func TestΔBTailAllStructs(t *testing.T) {
...
@@ -1430,7 +1438,7 @@ func TestΔBTailAllStructs(t *testing.T) {
nkeys
:=
N
(
3
,
5
,
10
)
nkeys
:=
N
(
3
,
5
,
10
)
// server to generate AllStructs(kv, ...)
// server to generate AllStructs(kv, ...)
sg
,
err
:=
StartAllStructsSrv
();
X
(
err
)
sg
,
err
:=
xbtreetest
.
StartAllStructsSrv
();
X
(
err
)
defer
func
()
{
defer
func
()
{
err
:=
sg
.
Close
();
X
(
err
)
err
:=
sg
.
Close
();
X
(
err
)
}()
}()
...
...
wcfs/internal/
zhist
/δbtail_x_test.go
→
wcfs/internal/
xbtree
/δbtail_x_test.go
View file @
ba246c80
...
@@ -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
zhist
_test
package
xbtree
_test
// ZBlk-related part of δbtail_test
// ZBlk-related part of δbtail_test
import
(
import
(
...
@@ -27,14 +27,14 @@ import (
...
@@ -27,14 +27,14 @@ import (
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xbtree"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xzodb"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xzodb"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/zdata"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/zdata"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/zhist"
)
)
type
Tree
=
zhist
.
Tree
type
Tree
=
xbtree
.
Tree
type
Node
=
zhist
.
Node
type
Node
=
xbtree
.
Node
type
Key
=
zhist
.
Key
type
Key
=
xbtree
.
Key
type
ZBlk
=
zdata
.
ZBlk
type
ZBlk
=
zdata
.
ZBlk
...
@@ -61,8 +61,8 @@ func ztreeGetBlk(ctx context.Context, ztree *Tree, k Key) (zblk ZBlk, ok bool, p
...
@@ -61,8 +61,8 @@ func ztreeGetBlk(ctx context.Context, ztree *Tree, k Key) (zblk ZBlk, ok bool, p
func
init
()
{
func
init
()
{
zhist
.
ZTreeGetBlkData
=
ZTreeGetBlkData
xbtree
.
ZTreeGetBlkData
=
ZTreeGetBlkData
zhist
.
ZGetBlkData
=
ZGetBlkData
xbtree
.
ZGetBlkData
=
ZGetBlkData
}
}
// ZTreeGetBlkData returns block data from block pointed to by ztree[k].
// ZTreeGetBlkData returns block data from block pointed to by ztree[k].
...
...
wcfs/internal/zdata/zblk.go
View file @
ba246c80
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
// Package zdata provides access for wendelin.core in-ZODB data.
// Package zdata provides access for wendelin.core in-ZODB data.
//
//
// ZBlk* + ZBigFile.
// ZBlk* + ZBigFile
+ ΔFtail for ZBigFile-level ZODB history
.
package
zdata
package
zdata
// module: "wendelin.bigfile.file_zodb"
// module: "wendelin.bigfile.file_zodb"
...
...
wcfs/internal/z
hist
/δftail.go
→
wcfs/internal/z
data
/δftail.go
View file @
ba246c80
...
@@ -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
z
hist
package
z
data
import
(
import
(
"context"
"context"
...
@@ -28,12 +28,13 @@ import (
...
@@ -28,12 +28,13 @@ import (
"lab.nexedi.com/kirr/neo/go/zodb/btree"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/set"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/set"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xbtree"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xtail"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xtail"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xzodb"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xzodb"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/zdata"
)
)
type
setI64
=
set
.
I64
type
setI64
=
set
.
I64
type
setOid
=
set
.
Oid
// ΔFtail represents tail of revisional changes to files.
// ΔFtail represents tail of revisional changes to files.
//
//
...
@@ -73,7 +74,7 @@ type setI64 = set.I64
...
@@ -73,7 +74,7 @@ type setI64 = set.I64
// See also zodb.ΔTail
// See also zodb.ΔTail
type
ΔFtail
struct
{
type
ΔFtail
struct
{
// ΔFtail merges ΔBtail with history of ZBlk
// ΔFtail merges ΔBtail with history of ZBlk
δBtail
*
ΔBtail
δBtail
*
xbtree
.
ΔBtail
fileIdx
map
[
zodb
.
Oid
]
setOid
// tree-root -> {} ZBigFile<oid> as of @head
fileIdx
map
[
zodb
.
Oid
]
setOid
// tree-root -> {} ZBigFile<oid> as of @head
trackSetZFile
setOid
// set of tracked ZBigFiles as of @head
trackSetZFile
setOid
// set of tracked ZBigFiles as of @head
...
@@ -121,7 +122,7 @@ type ΔFile struct {
...
@@ -121,7 +122,7 @@ type ΔFile struct {
// ZODB when needed.
// ZODB when needed.
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
:
NewΔBtail
(
at0
,
db
),
δBtail
:
xbtree
.
NewΔBtail
(
at0
,
db
),
fileIdx
:
map
[
zodb
.
Oid
]
setOid
{},
fileIdx
:
map
[
zodb
.
Oid
]
setOid
{},
trackSetZFile
:
setOid
{},
trackSetZFile
:
setOid
{},
trackSetZBlk
:
map
[
zodb
.
Oid
]
*
zblkTrack
{},
trackSetZBlk
:
map
[
zodb
.
Oid
]
*
zblkTrack
{},
...
@@ -146,13 +147,13 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
...
@@ -146,13 +147,13 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
// XXX objects in path and zblk must be with .PJar().At() == .head
// XXX objects in path and zblk must be with .PJar().At() == .head
//
//
// A root can be associated with several files (each provided on different Track call).
// A root can be associated with several files (each provided on different Track call).
func
(
δFtail
*
ΔFtail
)
Track
(
file
*
zdata
.
ZBigFile
,
blk
int64
,
path
[]
btree
.
LONode
,
zblk
zdata
.
ZBlk
)
{
func
(
δFtail
*
ΔFtail
)
Track
(
file
*
ZBigFile
,
blk
int64
,
path
[]
btree
.
LONode
,
zblk
ZBlk
)
{
// XXX locking
// XXX locking
foid
:=
file
.
POid
()
foid
:=
file
.
POid
()
if
blk
==
-
1
{
if
blk
==
-
1
{
// XXX blk = ∞ from beginning ?
// XXX blk = ∞ from beginning ?
blk
=
KeyMax
blk
=
xbtree
.
KeyMax
}
}
err
:=
δFtail
.
δBtail
.
Track
(
blk
,
path
)
err
:=
δFtail
.
δBtail
.
Track
(
blk
,
path
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -295,7 +296,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *xzodb.ZConn) (_ ΔF
...
@@ -295,7 +296,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *xzodb.ZConn) (_ ΔF
//
//
// If file != nil only track requests related to file are processed.
// If file != nil only track requests related to file are processed.
// Otherwise all track requests are processed.
// Otherwise all track requests are processed.
func
(
δFtail
*
ΔFtail
)
update
(
file
*
zdata
.
ZBigFile
)
{
func
(
δFtail
*
ΔFtail
)
update
(
file
*
ZBigFile
)
{
if
file
==
nil
{
if
file
==
nil
{
panic
(
"TODO"
)
panic
(
"TODO"
)
}
}
...
@@ -356,7 +357,7 @@ func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) {
...
@@ -356,7 +357,7 @@ func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) {
// the caller must not modify returned slice.
// the caller must not modify returned slice.
//
//
// Note: contrary to regular go slicing, low is exclusive while high is inclusive.
// Note: contrary to regular go slicing, low is exclusive while high is inclusive.
func
(
δFtail
*
ΔFtail
)
SliceByFileRev
(
file
*
zdata
.
ZBigFile
,
lo
,
hi
zodb
.
Tid
)
/*readonly*/
[]
*
ΔFile
{
func
(
δFtail
*
ΔFtail
)
SliceByFileRev
(
file
*
ZBigFile
,
lo
,
hi
zodb
.
Tid
)
/*readonly*/
[]
*
ΔFile
{
xtail
.
AssertSlice
(
δFtail
,
lo
,
hi
)
xtail
.
AssertSlice
(
δFtail
,
lo
,
hi
)
// FIXME rework to just query .δBtail.SliceByRootRev(file.blktab, lo, hi) +
// FIXME rework to just query .δBtail.SliceByRootRev(file.blktab, lo, hi) +
...
@@ -468,7 +469,7 @@ func (δFtail *ΔFtail) SliceByFileRev(file *zdata.ZBigFile, lo, hi zodb.Tid) /*
...
@@ -468,7 +469,7 @@ func (δFtail *ΔFtail) SliceByFileRev(file *zdata.ZBigFile, lo, hi zodb.Tid) /*
// blk must be tracked
// blk must be tracked
//
//
// XXX +ctx, error rebuild []δF here
// XXX +ctx, error rebuild []δF here
func
(
δFtail
*
ΔFtail
)
LastBlkRev
(
ctx
context
.
Context
,
zf
*
zdata
.
ZBigFile
,
blk
int64
,
at
zodb
.
Tid
)
(
_
zodb
.
Tid
,
exact
bool
)
{
func
(
δFtail
*
ΔFtail
)
LastBlkRev
(
ctx
context
.
Context
,
zf
*
ZBigFile
,
blk
int64
,
at
zodb
.
Tid
)
(
_
zodb
.
Tid
,
exact
bool
)
{
//defer xerr.Contextf(&err, "") // XXX text
//defer xerr.Contextf(&err, "") // XXX text
// XXX assert δFtail == f.head.bfdir.δFtail ?
// XXX assert δFtail == f.head.bfdir.δFtail ?
...
...
wcfs/internal/z
hist
/δftail_test.go
→
wcfs/internal/z
data
/δftail_test.go
View file @
ba246c80
...
@@ -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
z
hist
package
z
data
import
(
import
(
"testing"
"testing"
...
...
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