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
8cdedf83
Commit
8cdedf83
authored
Jun 17, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
dddfa56d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
10 deletions
+75
-10
wcfs/zset_oid.go
wcfs/zset_oid.go
+60
-0
wcfs/δbtail.go
wcfs/δbtail.go
+2
-0
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+13
-10
No files found.
wcfs/zset_oid.go
0 → 100644
View file @
8cdedf83
// Code generated by gen-set Oid Oid; DO NOT EDIT.
// Copyright (C) 2015-2020 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
main
// SetOid is a set of Oid.
type
SetOid
map
[
Oid
]
struct
{}
// Add adds v to the set.
func
(
s
SetOid
)
Add
(
v
Oid
)
{
s
[
v
]
=
struct
{}{}
}
// Del removes v from the set.
// it is noop if v was not in the set.
func
(
s
SetOid
)
Del
(
v
Oid
)
{
delete
(
s
,
v
)
}
// Has checks whether the set contains v.
func
(
s
SetOid
)
Has
(
v
Oid
)
bool
{
_
,
ok
:=
s
[
v
]
return
ok
}
// Update adds t values to s.
func
(
s
SetOid
)
Update
(
t
SetOid
)
{
for
v
:=
range
t
{
s
.
Add
(
v
)
}
}
// Elements returns all elements of set as slice.
func
(
s
SetOid
)
Elements
()
[]
Oid
{
ev
:=
make
([]
Oid
,
len
(
s
))
i
:=
0
for
e
:=
range
s
{
ev
[
i
]
=
e
i
++
}
return
ev
}
wcfs/δbtail.go
View file @
8cdedf83
...
...
@@ -23,6 +23,7 @@ package main
//go:generate ./gen-set main Tree *Tree zset_tree.go
////go:generate ./gen-set main Value Value zset_value.go
//go:generate ./gen-set main Oid Oid zset_oid.go
import
(
"context"
...
...
@@ -40,6 +41,7 @@ type Node = btree.LONode
type
Key
=
int64
type
Value
=
zodb
.
Oid
// assumes key points to IPersistent
// deletion is represented as InvalidOid
type
Oid
=
zodb
.
Oid
type
SetKey
=
SetI64
...
...
wcfs/δbtail_test.go
View file @
8cdedf83
...
...
@@ -573,19 +573,22 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
δB
:=
δbtail
.
Update
(
δZ
)
assert
.
Equal
(
δB
.
Rev
,
δZ
.
Tid
)
//if len(d12) == 0 && len(initialTrackedKeys) == 0 {
if
len
(
initialTrackedKeys
)
==
0
{
//if len(inδTOK) == 0 { XXX <- should be correct
assert
.
Equal
(
len
(
δB
.
ByRoot
),
0
)
return
}
// δB.ByRoot.keys() == [treeRoot]
roots
:=
[]
zodb
.
Oid
{}
// assert δB.ByRoot == {treeRoot -> ...} if inδTOK != ø
// == ø if inδTOK == ø
rootsOK
:=
SetOid
{}
if
len
(
inδTOK
)
>
0
{
rootsOK
.
Add
(
treeRoot
)
}
roots
:=
SetOid
{}
for
root
:=
range
δB
.
ByRoot
{
roots
=
append
(
roots
,
root
)
roots
.
Add
(
root
)
}
assert
.
Equal
(
roots
,
[]
zodb
.
Oid
{
treeRoot
})
if
!
reflect
.
DeepEqual
(
roots
,
rootsOK
)
{
badf
(
"δB: roots != rootsOK ; inδTOK=%v roots=%v rootsOK=%v"
,
inδTOK
,
roots
,
rootsOK
)
return
}
δToid
:=
δB
.
ByRoot
[
treeRoot
]
// {} k -> oid
δT
=
XGetKV
(
db
,
at2
,
δToid
)
// {} k -> ZBlk(oid).data
...
...
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