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
a5027dc7
Commit
a5027dc7
authored
Jul 01, 2021
by
Kirill Smelkov
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
bf17bf5b
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
66 additions
and
165 deletions
+66
-165
wcfs/internal/xbtree/misc.go
wcfs/internal/xbtree/misc.go
+0
-28
wcfs/internal/xbtree/xbtreetest/kvdiff_test.go
wcfs/internal/xbtree/xbtreetest/kvdiff_test.go
+0
-44
wcfs/internal/xbtree/xbtreetest/xbtreetest.go
wcfs/internal/xbtree/xbtreetest/xbtreetest.go
+0
-49
wcfs/internal/zdata/zblk.go
wcfs/internal/zdata/zblk.go
+1
-1
wcfs/internal/zhist/kvdiff_test.go
wcfs/internal/zhist/kvdiff_test.go
+22
-1
wcfs/internal/zhist/pptreesubset.go
wcfs/internal/zhist/pptreesubset.go
+1
-1
wcfs/internal/zhist/pptreesubset_test.go
wcfs/internal/zhist/pptreesubset_test.go
+1
-1
wcfs/internal/zhist/rangeset.go
wcfs/internal/zhist/rangeset.go
+1
-1
wcfs/internal/zhist/rangeset_test.go
wcfs/internal/zhist/rangeset_test.go
+1
-1
wcfs/internal/zhist/rtree_test.go
wcfs/internal/zhist/rtree_test.go
+1
-1
wcfs/internal/zhist/testprog/treegen.py
wcfs/internal/zhist/testprog/treegen.py
+0
-0
wcfs/internal/zhist/treediff.go
wcfs/internal/zhist/treediff.go
+1
-1
wcfs/internal/zhist/treeenv_test.go
wcfs/internal/zhist/treeenv_test.go
+1
-1
wcfs/internal/zhist/treegen_test.go
wcfs/internal/zhist/treegen_test.go
+1
-1
wcfs/internal/zhist/zhist.go
wcfs/internal/zhist/zhist.go
+14
-4
wcfs/internal/zhist/δbtail.go
wcfs/internal/zhist/δbtail.go
+1
-1
wcfs/internal/zhist/δbtail_test.go
wcfs/internal/zhist/δbtail_test.go
+3
-11
wcfs/internal/zhist/δbtail_x_test.go
wcfs/internal/zhist/δbtail_x_test.go
+7
-7
wcfs/internal/zhist/δftail.go
wcfs/internal/zhist/δftail.go
+9
-10
wcfs/internal/zhist/δftail_test.go
wcfs/internal/zhist/δftail_test.go
+1
-1
No files found.
wcfs/internal/xbtree/misc.go
deleted
100644 → 0
View file @
bf17bf5b
// 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/xbtree/xbtreetest/kvdiff_test.go
deleted
100644 → 0
View file @
bf17bf5b
// 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/xbtree/xbtreetest/xbtreetest.go
deleted
100644 → 0
View file @
bf17bf5b
// 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/zdata/zblk.go
View file @
a5027dc7
...
@@ -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
+ ΔFtail for ZBigFile-level ZODB history
.
// ZBlk* + ZBigFile.
package
zdata
package
zdata
// module: "wendelin.bigfile.file_zodb"
// module: "wendelin.bigfile.file_zodb"
...
...
wcfs/internal/
xbtree/xbtreetest/kvdiff
.go
→
wcfs/internal/
zhist/kvdiff_test
.go
View file @
a5027dc7
...
@@ -17,13 +17,15 @@
...
@@ -17,13 +17,15 @@
// 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
xbtreete
st
package
zhi
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.
...
@@ -51,6 +53,16 @@ func kvdiff(kv1, kv2 map[Key]string) map[Key]Δstring {
...
@@ -51,6 +53,16 @@ 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
{
...
@@ -72,3 +84,12 @@ func kvtxt(kv map[Key]string) string {
...
@@ -72,3 +84,12 @@ 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
/pptreesubset.go
→
wcfs/internal/
zhist
/pptreesubset.go
View file @
a5027dc7
...
@@ -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
xbtree
package
zhist
// PP-connected subset of tree nodes.
// PP-connected subset of tree nodes.
import
(
import
(
...
...
wcfs/internal/
xbtree
/pptreesubset_test.go
→
wcfs/internal/
zhist
/pptreesubset_test.go
View file @
a5027dc7
...
@@ -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
xbtree
package
zhist
import
(
import
(
"strings"
"strings"
...
...
wcfs/internal/
xbtree
/rangeset.go
→
wcfs/internal/
zhist
/rangeset.go
View file @
a5027dc7
...
@@ -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
xbtree
package
zhist
// set of [lo,hi) Key ranges.
// set of [lo,hi) Key ranges.
import
(
import
(
...
...
wcfs/internal/
xbtree
/rangeset_test.go
→
wcfs/internal/
zhist
/rangeset_test.go
View file @
a5027dc7
...
@@ -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
xbtree
package
zhist
import
(
import
(
"testing"
"testing"
...
...
wcfs/internal/
xbtree/xbtreetest/rtree
.go
→
wcfs/internal/
zhist/rtree_test
.go
View file @
a5027dc7
...
@@ -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
xbtreete
st
package
zhi
st
import
(
import
(
"fmt"
"fmt"
...
...
wcfs/internal/
xbtree/xbtreetest
/treegen.py
→
wcfs/internal/
zhist/testprog
/treegen.py
View file @
a5027dc7
File moved
wcfs/internal/
xbtree
/treediff.go
→
wcfs/internal/
zhist
/treediff.go
View file @
a5027dc7
...
@@ -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
xbtree
package
zhist
// diff for BTrees
// diff for BTrees
// XXX doc
// XXX doc
...
...
wcfs/internal/
xbtree/xbtreetest/treeenv
.go
→
wcfs/internal/
zhist/treeenv_test
.go
View file @
a5027dc7
...
@@ -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
xbtreete
st
package
zhi
st
// TreeEnv + friends
// TreeEnv + friends
import
(
import
(
...
...
wcfs/internal/
xbtree/xbtreetest/treegen
.go
→
wcfs/internal/
zhist/treegen_test
.go
View file @
a5027dc7
...
@@ -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
xbtreete
st
package
zhi
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/
xbtree/xbtree
.go
→
wcfs/internal/
zhist/zhist
.go
View file @
a5027dc7
// Package xbtree complements package lab.nexedi.com/kirr/neo/go/zodb/btree.
// Package zhist provides way to query ZODB for BTree and ZBigFile history.
// XXX doc
//
package
xbtree
// It complements packages lab.nexedi.com/kirr/neo/go/zodb/btree and
// 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"
...
@@ -74,3 +80,7 @@ func kstr(k Key) string {
...
@@ -74,3 +80,7 @@ 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/
xbtree
/δbtail.go
→
wcfs/internal/
zhist
/δbtail.go
View file @
a5027dc7
...
@@ -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
xbtree
package
zhist
// ΔBtail
// ΔBtail
import
(
import
(
...
...
wcfs/internal/
xbtree
/δbtail_test.go
→
wcfs/internal/
zhist
/δbtail_test.go
View file @
a5027dc7
...
@@ -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
xbtree
package
zhist
// 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,23 +38,18 @@ package xbtree
...
@@ -38,23 +38,18 @@ package xbtree
//
//
// 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:
XXX moved to xbtreetest
// testprog/treegen.py is used as helper to both:
//
//
// - 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"
...
@@ -65,9 +60,6 @@ import (
...
@@ -65,9 +60,6 @@ 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.
...
@@ -1438,7 +1430,7 @@ func TestΔBTailAllStructs(t *testing.T) {
...
@@ -1438,7 +1430,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
:=
xbtreetest
.
StartAllStructsSrv
();
X
(
err
)
sg
,
err
:=
StartAllStructsSrv
();
X
(
err
)
defer
func
()
{
defer
func
()
{
err
:=
sg
.
Close
();
X
(
err
)
err
:=
sg
.
Close
();
X
(
err
)
}()
}()
...
...
wcfs/internal/
xbtree
/δbtail_x_test.go
→
wcfs/internal/
zhist
/δbtail_x_test.go
View file @
a5027dc7
...
@@ -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
xbtree
_test
package
zhist
_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
=
xbtree
.
Tree
type
Tree
=
zhist
.
Tree
type
Node
=
xbtree
.
Node
type
Node
=
zhist
.
Node
type
Key
=
xbtree
.
Key
type
Key
=
zhist
.
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
()
{
xbtree
.
ZTreeGetBlkData
=
ZTreeGetBlkData
zhist
.
ZTreeGetBlkData
=
ZTreeGetBlkData
xbtree
.
ZGetBlkData
=
ZGetBlkData
zhist
.
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/z
data
/δftail.go
→
wcfs/internal/z
hist
/δftail.go
View file @
a5027dc7
...
@@ -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
data
package
z
hist
import
(
import
(
"context"
"context"
...
@@ -28,13 +28,12 @@ import (
...
@@ -28,13 +28,12 @@ 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.
//
//
...
@@ -74,7 +73,7 @@ type setOid = set.Oid
...
@@ -74,7 +73,7 @@ type setOid = set.Oid
// 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
*
xbtree
.
ΔBtail
δBtail
*
Δ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
...
@@ -122,7 +121,7 @@ type ΔFile struct {
...
@@ -122,7 +121,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
:
xbtree
.
NewΔBtail
(
at0
,
db
),
δBtail
:
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
{},
...
@@ -147,13 +146,13 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
...
@@ -147,13 +146,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
*
ZBigFile
,
blk
int64
,
path
[]
btree
.
LONode
,
zblk
ZBlk
)
{
func
(
δFtail
*
ΔFtail
)
Track
(
file
*
zdata
.
ZBigFile
,
blk
int64
,
path
[]
btree
.
LONode
,
zblk
zdata
.
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
=
xbtree
.
KeyMax
blk
=
KeyMax
}
}
err
:=
δFtail
.
δBtail
.
Track
(
blk
,
path
)
err
:=
δFtail
.
δBtail
.
Track
(
blk
,
path
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -296,7 +295,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *xzodb.ZConn) (_ ΔF
...
@@ -296,7 +295,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
*
ZBigFile
)
{
func
(
δFtail
*
ΔFtail
)
update
(
file
*
zdata
.
ZBigFile
)
{
if
file
==
nil
{
if
file
==
nil
{
panic
(
"TODO"
)
panic
(
"TODO"
)
}
}
...
@@ -357,7 +356,7 @@ func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) {
...
@@ -357,7 +356,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
*
ZBigFile
,
lo
,
hi
zodb
.
Tid
)
/*readonly*/
[]
*
ΔFile
{
func
(
δFtail
*
ΔFtail
)
SliceByFileRev
(
file
*
zdata
.
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) +
...
@@ -469,7 +468,7 @@ func (δFtail *ΔFtail) SliceByFileRev(file *ZBigFile, lo, hi zodb.Tid) /*readon
...
@@ -469,7 +468,7 @@ func (δFtail *ΔFtail) SliceByFileRev(file *ZBigFile, lo, hi zodb.Tid) /*readon
// 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
*
ZBigFile
,
blk
int64
,
at
zodb
.
Tid
)
(
_
zodb
.
Tid
,
exact
bool
)
{
func
(
δFtail
*
ΔFtail
)
LastBlkRev
(
ctx
context
.
Context
,
zf
*
zdata
.
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
data
/δftail_test.go
→
wcfs/internal/z
hist
/δftail_test.go
View file @
a5027dc7
...
@@ -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
data
package
z
hist
import
(
import
(
"testing"
"testing"
...
...
Kirill Smelkov
@kirr
mentioned in commit
ba246c80
·
Jul 07, 2021
mentioned in commit
ba246c80
mentioned in commit ba246c8061d081c7724d4659cab13fc0e56ff378
Toggle commit list
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