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
de0b06ea
Commit
de0b06ea
authored
Sep 21, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
847e447a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
37 deletions
+32
-37
wcfs/internal/xbtree/blib/blib.go
wcfs/internal/xbtree/blib/blib.go
+2
-2
wcfs/internal/xbtree/blib/rangeset.go
wcfs/internal/xbtree/blib/rangeset.go
+2
-2
wcfs/internal/xbtree/treediff.go
wcfs/internal/xbtree/treediff.go
+0
-23
wcfs/internal/xbtree/xbtree.go
wcfs/internal/xbtree/xbtree.go
+27
-9
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+1
-1
No files found.
wcfs/internal/xbtree/blib/blib.go
View file @
de0b06ea
...
@@ -43,8 +43,8 @@ const KeyMin Key = math.MinInt64
...
@@ -43,8 +43,8 @@ const KeyMin Key = math.MinInt64
type
setOid
=
set
.
Oid
type
setOid
=
set
.
Oid
//
ks
tr formats key as string.
//
KS
tr formats key as string.
func
ks
tr
(
k
Key
)
string
{
func
KS
tr
(
k
Key
)
string
{
if
k
==
KeyMin
{
if
k
==
KeyMin
{
return
"-∞"
return
"-∞"
}
}
...
...
wcfs/internal/xbtree/blib/rangeset.go
View file @
de0b06ea
...
@@ -380,11 +380,11 @@ func (S RangedKeySet) String() string {
...
@@ -380,11 +380,11 @@ func (S RangedKeySet) String() string {
func
(
r
KeyRange
)
String
()
string
{
func
(
r
KeyRange
)
String
()
string
{
var
shi
string
var
shi
string
if
r
.
Hi_
==
KeyMax
{
if
r
.
Hi_
==
KeyMax
{
shi
=
ks
tr
(
r
.
Hi_
)
// ∞
shi
=
KS
tr
(
r
.
Hi_
)
// ∞
}
else
{
}
else
{
shi
=
fmt
.
Sprintf
(
"%d"
,
r
.
Hi_
+
1
)
shi
=
fmt
.
Sprintf
(
"%d"
,
r
.
Hi_
+
1
)
}
}
return
fmt
.
Sprintf
(
"[%s,%s)"
,
ks
tr
(
r
.
Lo
),
shi
)
return
fmt
.
Sprintf
(
"[%s,%s)"
,
KS
tr
(
r
.
Lo
),
shi
)
}
}
...
...
wcfs/internal/xbtree/treediff.go
View file @
de0b06ea
...
@@ -995,29 +995,6 @@ func pop(nodeStk *[]*nodeInRange) *nodeInRange {
...
@@ -995,29 +995,6 @@ func pop(nodeStk *[]*nodeInRange) *nodeInRange {
return
top
return
top
}
}
// pathEqual returns whether two paths are the same.
func
pathEqual
(
patha
,
pathb
[]
zodb
.
Oid
)
bool
{
if
len
(
patha
)
!=
len
(
pathb
)
{
return
false
}
for
i
,
a
:=
range
patha
{
if
pathb
[
i
]
!=
a
{
return
false
}
}
return
true
}
// vnode returns brief human-readable representation of node.
func
vnode
(
node
Node
)
string
{
kind
:=
"?"
switch
node
.
(
type
)
{
case
*
Tree
:
kind
=
"T"
case
*
Bucket
:
kind
=
"B"
}
return
kind
+
node
.
POid
()
.
String
()
}
func
tracefDiff
(
format
string
,
argv
...
interface
{})
{
func
tracefDiff
(
format
string
,
argv
...
interface
{})
{
if
traceDiff
{
if
traceDiff
{
fmt
.
Printf
(
format
,
argv
...
)
fmt
.
Printf
(
format
,
argv
...
)
...
...
wcfs/internal/xbtree/xbtree.go
View file @
de0b06ea
...
@@ -35,6 +35,9 @@ import (
...
@@ -35,6 +35,9 @@ import (
)
)
// this file contains only tree types and utilities.
// main code lives in δbtail.go and treediff.go .
// XXX instead of generics
// XXX instead of generics
type
Tree
=
blib
.
Tree
type
Tree
=
blib
.
Tree
type
Bucket
=
blib
.
Bucket
type
Bucket
=
blib
.
Bucket
...
@@ -59,7 +62,6 @@ type setTid = set.Tid
...
@@ -59,7 +62,6 @@ type setTid = set.Tid
// nodePathToPath converts path from []Node to []Oid.
// nodePathToPath converts path from []Node to []Oid.
// XXX place = ? -> δbtail.go/treediff.go (close to pathEqual), or move them both to misc.go
func
nodePathToPath
(
nodePath
[]
Node
)
(
path
[]
zodb
.
Oid
)
{
func
nodePathToPath
(
nodePath
[]
Node
)
(
path
[]
zodb
.
Oid
)
{
// assert nodePath = Tree Tree ... Tree Bucket
// assert nodePath = Tree Tree ... Tree Bucket
l
:=
len
(
nodePath
)
l
:=
len
(
nodePath
)
...
@@ -84,16 +86,32 @@ func nodePathToPath(nodePath []Node) (path []zodb.Oid) {
...
@@ -84,16 +86,32 @@ func nodePathToPath(nodePath []Node) (path []zodb.Oid) {
return
path
return
path
}
}
// pathEqual returns whether two paths are the same.
// kstr formats key as string.
func
pathEqual
(
patha
,
pathb
[]
zodb
.
Oid
)
bool
{
func
kstr
(
k
Key
)
string
{
if
len
(
patha
)
!=
len
(
pathb
)
{
if
k
==
KeyMin
{
return
false
return
"-∞"
}
for
i
,
a
:=
range
patha
{
if
pathb
[
i
]
!=
a
{
return
false
}
}
if
k
==
KeyMax
{
return
"∞"
}
}
return
fmt
.
Sprintf
(
"%d"
,
k
)
return
true
}
// vnode returns brief human-readable representation of node.
func
vnode
(
node
Node
)
string
{
kind
:=
"?"
switch
node
.
(
type
)
{
case
*
Tree
:
kind
=
"T"
case
*
Bucket
:
kind
=
"B"
}
return
kind
+
node
.
POid
()
.
String
()
}
func
kstr
(
key
Key
)
string
{
return
blib
.
KStr
(
key
)
}
}
func
panicf
(
format
string
,
argv
...
interface
{})
{
func
panicf
(
format
string
,
argv
...
interface
{})
{
...
...
wcfs/internal/xbtree/δbtail.go
View file @
de0b06ea
...
@@ -798,7 +798,7 @@ func (δBtail *ΔBtail) GetAt(root zodb.Oid, key Key, at zodb.Tid) (value Value,
...
@@ -798,7 +798,7 @@ func (δBtail *ΔBtail) GetAt(root zodb.Oid, key Key, at zodb.Tid) (value Value,
panicf
(
"δBtail: root<%s> not tracked"
,
root
)
panicf
(
"δBtail: root<%s> not tracked"
,
root
)
}
}
// TODO -> index lastRevOf(key) | linear scan ↓ looking for change
<=
at
// TODO -> index lastRevOf(key) | linear scan ↓ looking for change
≤
at
for
i
:=
len
(
δTtail
.
vδT
)
-
1
;
i
>=
0
;
i
--
{
for
i
:=
len
(
δTtail
.
vδT
)
-
1
;
i
>=
0
;
i
--
{
δT
:=
δTtail
.
vδT
[
i
]
δT
:=
δTtail
.
vδT
[
i
]
δvalue
,
ok_
:=
δT
.
KV
[
key
]
δvalue
,
ok_
:=
δT
.
KV
[
key
]
...
...
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