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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
38 deletions
+33
-38
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
+2
-2
No files found.
wcfs/internal/xbtree/blib/blib.go
View file @
de0b06ea
...
...
@@ -43,8 +43,8 @@ const KeyMin Key = math.MinInt64
type
setOid
=
set
.
Oid
//
ks
tr formats key as string.
func
ks
tr
(
k
Key
)
string
{
//
KS
tr formats key as string.
func
KS
tr
(
k
Key
)
string
{
if
k
==
KeyMin
{
return
"-∞"
}
...
...
wcfs/internal/xbtree/blib/rangeset.go
View file @
de0b06ea
...
...
@@ -380,11 +380,11 @@ func (S RangedKeySet) String() string {
func
(
r
KeyRange
)
String
()
string
{
var
shi
string
if
r
.
Hi_
==
KeyMax
{
shi
=
ks
tr
(
r
.
Hi_
)
// ∞
shi
=
KS
tr
(
r
.
Hi_
)
// ∞
}
else
{
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 {
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
{})
{
if
traceDiff
{
fmt
.
Printf
(
format
,
argv
...
)
...
...
wcfs/internal/xbtree/xbtree.go
View file @
de0b06ea
...
...
@@ -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
type
Tree
=
blib
.
Tree
type
Bucket
=
blib
.
Bucket
...
...
@@ -59,7 +62,6 @@ type setTid = set.Tid
// 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
)
{
// assert nodePath = Tree Tree ... Tree Bucket
l
:=
len
(
nodePath
)
...
...
@@ -84,16 +86,32 @@ func nodePathToPath(nodePath []Node) (path []zodb.Oid) {
return
path
}
// kstr formats key as string.
func
kstr
(
k
Key
)
string
{
if
k
==
KeyMin
{
return
"-∞"
// pathEqual returns whether two paths are the same.
func
pathEqual
(
patha
,
pathb
[]
zodb
.
Oid
)
bool
{
if
len
(
patha
)
!=
len
(
pathb
)
{
return
false
}
if
k
==
KeyMax
{
return
"∞"
for
i
,
a
:=
range
patha
{
if
pathb
[
i
]
!=
a
{
return
false
}
}
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
{})
{
...
...
wcfs/internal/xbtree/δbtail.go
View file @
de0b06ea
...
...
@@ -270,7 +270,7 @@ func (δBtail *ΔBtail) track(key Key, path []zodb.Oid) {
tracefΔBtail
(
"->T: nop
\n
"
)
path_
:=
δBtail
.
trackSet
.
Path
(
leaf
)
if
!
pathEqual
(
path
,
path_
)
{
panicf
(
"BUG: key %s is already tracked via path=%v
\n
track requests path=%v"
,
kstr
(
key
),
path_
,
path
)
panicf
(
"BUG: key %s is already tracked via path=%v
\n
track requests path=%v"
,
kstr
(
key
),
path_
,
path
)
}
return
}
...
...
@@ -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
)
}
// 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
--
{
δT
:=
δTtail
.
vδT
[
i
]
δ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