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
e926e154
Commit
e926e154
authored
May 21, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
cdb8ff24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
19 deletions
+13
-19
wcfs/testprog/treedelta-genallstructs.py
wcfs/testprog/treedelta-genallstructs.py
+13
-19
No files found.
wcfs/testprog/treedelta-genallstructs.py
View file @
e926e154
...
@@ -52,21 +52,6 @@ from wendelin.wcfs.internal import xbtree
...
@@ -52,21 +52,6 @@ from wendelin.wcfs.internal import xbtree
from
wendelin.bigfile.file_zodb
import
ZBlk
from
wendelin.bigfile.file_zodb
import
ZBlk
from
zodbtools.util
import
storageFromURL
from
zodbtools.util
import
storageFromURL
# init initializes ...
@
func
def
init
(
zstor
):
db
=
DB
(
zstor
);
defer
(
db
.
close
)
zconn
=
db
.
open
();
defer
(
zconn
.
close
)
root
=
zconn
.
root
()
# valdict is {} for values
# {} v -> ZBlk(v)
valdict
=
root
.
setdefault
(
'treedelta/values'
,
{})
for
v
in
b'abcdefghi'
:
valdict
[
v
]
=
ZBlk
(
v
)
transaction
.
commit
()
# kvEncode encodes key->value maping into text.
# kvEncode encodes key->value maping into text.
# e.g. {1:'a', 2:'b'} -> '1:a,2:b'
# e.g. {1:'a', 2:'b'} -> '1:a,2:b'
...
@@ -99,7 +84,15 @@ def treedeltaGenAllStructs(zstor, kv1, kv2, n):
...
@@ -99,7 +84,15 @@ def treedeltaGenAllStructs(zstor, kv1, kv2, n):
zconn
=
db
.
open
();
defer
(
zconn
.
close
)
zconn
=
db
.
open
();
defer
(
zconn
.
close
)
root
=
zconn
.
root
()
root
=
zconn
.
root
()
valdict
=
root
[
'treedelta/values'
]
# root['treedelta/values'] = {} v -> ZBlk(v)
valdict
=
root
.
setdefault
(
'treedelta/values'
,
{})
for
v
in
b'abcdefghi'
:
# XXX don't ovewrite if already set?
zblk
=
ZBlk
()
zblk
.
setblkdata
(
v
)
valdict
[
v
]
=
zblk
transaction
.
commit
()
# vdecode decodes value text into value object, e.g. 'a' -> ZBlk(a)
# vdecode decodes value text into value object, e.g. 'a' -> ZBlk(a)
def
vdecode
(
vtxt
):
# -> vobj
def
vdecode
(
vtxt
):
# -> vobj
return
valdict
[
vtxt
]
return
valdict
[
vtxt
]
...
@@ -113,11 +106,12 @@ def treedeltaGenAllStructs(zstor, kv1, kv2, n):
...
@@ -113,11 +106,12 @@ def treedeltaGenAllStructs(zstor, kv1, kv2, n):
@
func
@
func
def
main
():
def
main
():
if
len
(
sys
.
argv
)
!=
5
:
if
len
(
sys
.
argv
)
!=
5
:
print
(
"Usage: %s <
n> <zurl
> <kv1> <kv2>"
%
sys
.
argv
[
0
],
file
=
sys
.
stderr
)
print
(
"Usage: %s <
zurl> <n
> <kv1> <kv2>"
%
sys
.
argv
[
0
],
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
n
=
int
(
sys
.
argv
[
1
])
zurl
=
sys
.
argv
[
1
]
zurl
,
kv1
,
kv2
=
sys
.
argv
[
2
:]
n
=
int
(
sys
.
argv
[
2
])
kv1
,
kv2
=
sys
.
argv
[
3
:]
zstor
=
storageFromURL
(
zurl
)
zstor
=
storageFromURL
(
zurl
)
defer
(
zstor
.
close
)
defer
(
zstor
.
close
)
...
...
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