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
9cce624f
Commit
9cce624f
authored
Sep 23, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
958ae9b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
37 deletions
+35
-37
wcfs/internal/xbtree/treediff.go
wcfs/internal/xbtree/treediff.go
+10
-0
wcfs/internal/xbtree/xbtree.go
wcfs/internal/xbtree/xbtree.go
+0
-37
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+25
-0
No files found.
wcfs/internal/xbtree/treediff.go
View file @
9cce624f
...
@@ -800,6 +800,16 @@ func diffB(ctx context.Context, a, b *Bucket) (δ map[Key]ΔValue, err error) {
...
@@ -800,6 +800,16 @@ func diffB(ctx context.Context, a, b *Bucket) (δ map[Key]ΔValue, err error) {
return
δ
,
nil
return
δ
,
nil
}
}
// vOid returns OID of a value object.
// it is an error if value is not persistent object.
func
vOid
(
xvalue
interface
{})
(
zodb
.
Oid
,
error
)
{
value
,
ok
:=
xvalue
.
(
zodb
.
IPersistent
)
if
!
ok
{
return
zodb
.
InvalidOid
,
fmt
.
Errorf
(
"%T is not a persitent object"
,
xvalue
)
}
return
value
.
POid
(),
nil
}
// ---- nodeInRange + rangeSplit ----
// ---- nodeInRange + rangeSplit ----
...
...
wcfs/internal/xbtree/xbtree.go
View file @
9cce624f
...
@@ -60,33 +60,6 @@ type setOid = set.Oid
...
@@ -60,33 +60,6 @@ type setOid = set.Oid
type
setTid
=
set
.
Tid
type
setTid
=
set
.
Tid
// nodePathToPath converts path from []Node to []Oid.
func
nodePathToPath
(
nodePath
[]
Node
)
(
path
[]
zodb
.
Oid
)
{
// assert nodePath = Tree Tree ... Tree Bucket
l
:=
len
(
nodePath
)
switch
{
case
l
==
0
:
panic
(
"empty path"
)
case
l
==
1
:
// must be empty Tree
_
=
nodePath
[
0
]
.
(
*
Tree
)
default
:
// must be Tree Tree ... Tree Bucket
for
_
,
node
:=
range
nodePath
[
:
l
-
1
]
{
_
=
node
.
(
*
Tree
)
}
_
=
nodePath
[
l
-
1
]
.
(
*
Bucket
)
}
path
=
make
([]
zodb
.
Oid
,
l
)
for
i
,
node
:=
range
nodePath
{
path
[
i
]
=
node
.
POid
()
}
return
path
}
// pathEqual returns whether two paths are the same.
// pathEqual returns whether two paths are the same.
func
pathEqual
(
patha
,
pathb
[]
zodb
.
Oid
)
bool
{
func
pathEqual
(
patha
,
pathb
[]
zodb
.
Oid
)
bool
{
if
len
(
patha
)
!=
len
(
pathb
)
{
if
len
(
patha
)
!=
len
(
pathb
)
{
...
@@ -110,16 +83,6 @@ func vnode(node Node) string {
...
@@ -110,16 +83,6 @@ func vnode(node Node) string {
return
kind
+
node
.
POid
()
.
String
()
return
kind
+
node
.
POid
()
.
String
()
}
}
// vOid returns OID of a value object.
// it is an error if value is not persistent object.
func
vOid
(
xvalue
interface
{})
(
zodb
.
Oid
,
error
)
{
value
,
ok
:=
xvalue
.
(
zodb
.
IPersistent
)
if
!
ok
{
return
zodb
.
InvalidOid
,
fmt
.
Errorf
(
"%T is not a persitent object"
,
xvalue
)
}
return
value
.
POid
(),
nil
}
// zgetNodeOrNil returns btree node corresponding to zconn.Get(oid) .
// zgetNodeOrNil returns btree node corresponding to zconn.Get(oid) .
// if the node does not exist, (nil, ok) is returned.
// if the node does not exist, (nil, ok) is returned.
func
zgetNodeOrNil
(
ctx
context
.
Context
,
zconn
*
zodb
.
Connection
,
oid
zodb
.
Oid
)
(
node
Node
,
err
error
)
{
func
zgetNodeOrNil
(
ctx
context
.
Context
,
zconn
*
zodb
.
Connection
,
oid
zodb
.
Oid
)
(
node
Node
,
err
error
)
{
...
...
wcfs/internal/xbtree/δbtail.go
View file @
9cce624f
...
@@ -308,6 +308,31 @@ func (δBtail *ΔBtail) Track(key Key, nodePath []Node) {
...
@@ -308,6 +308,31 @@ func (δBtail *ΔBtail) Track(key Key, nodePath []Node) {
δBtail
.
track
(
key
,
path
)
δBtail
.
track
(
key
,
path
)
}
}
// nodePathToPath converts path from []Node to []Oid.
func
nodePathToPath
(
nodePath
[]
Node
)
(
path
[]
zodb
.
Oid
)
{
// assert nodePath = Tree Tree ... Tree Bucket
l
:=
len
(
nodePath
)
switch
{
case
l
==
0
:
panic
(
"empty path"
)
case
l
==
1
:
// must be empty Tree
_
=
nodePath
[
0
]
.
(
*
Tree
)
default
:
// must be Tree Tree ... Tree Bucket
for
_
,
node
:=
range
nodePath
[
:
l
-
1
]
{
_
=
node
.
(
*
Tree
)
}
_
=
nodePath
[
l
-
1
]
.
(
*
Bucket
)
}
path
=
make
([]
zodb
.
Oid
,
l
)
for
i
,
node
:=
range
nodePath
{
path
[
i
]
=
node
.
POid
()
}
return
path
}
func
(
δBtail
*
ΔBtail
)
track
(
key
Key
,
path
[]
zodb
.
Oid
)
{
func
(
δBtail
*
ΔBtail
)
track
(
key
Key
,
path
[]
zodb
.
Oid
)
{
// XXX locking
// XXX locking
...
...
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