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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
e62934cf
Commit
e62934cf
authored
Jun 26, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3a26f3cd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
15 deletions
+89
-15
wcfs/__init__.py
wcfs/__init__.py
+21
-1
wcfs/todo.dot
wcfs/todo.dot
+2
-0
wcfs/todo.svg
wcfs/todo.svg
+26
-14
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+40
-0
No files found.
wcfs/__init__.py
View file @
e62934cf
...
...
@@ -26,7 +26,7 @@ XXX doc
import
os
,
sys
,
hashlib
,
tempfile
,
subprocess
,
errno
,
time
import
logging
as
log
from
os.path
import
dirname
from
py
golang
import
go
,
chan
,
select
,
default
from
golang
import
go
,
chan
,
select
,
default
# WCFS represents connection to wcfs server.
...
...
@@ -165,7 +165,10 @@ def join(zurl, autostart=None):
if
_
==
1
:
if
not
isinstance
(
_rx
,
file
):
err
=
_rx
cancelch
.
close
()
raise
RuntimeError
(
err
)
# mounted ok - construct WCFS object
# XXX do we need to remember cancelch in WCFS and close it upon leaving?
...
...
@@ -189,6 +192,23 @@ def _mntpt_4zurl(zurl):
return
"%s/wcfs/%s"
%
(
tempfile
.
gettempdir
(),
m
.
hexdigest
())
# _zstor_2zurl converts a ZODB storage to URL to access it.
def
_zstor_2zurl
(
zstor
):
# There is, sadly, no unified way to do it, as even if storages are created via
# zodburi, after creation its uri is lost. And storages could be created not
# only through URI but e.g. via ZConfig and manually. We want to support all
# those cases...
#
# For this reason extact URL with important for wcfs use-case parameters in
# ad-hoc way.
if
isinstance
(
zstor
,
FileStorage
):
return
"file://%s"
%
(
zstor
.
_file_name
,)
# TODO ZEO + NEO support
raise
NotImplementedError
(
"don't know how to extract url from %r"
%
zstor
)
# if called as main just -> run(argv[1])
def
main
():
...
...
wcfs/todo.dot
View file @
e62934cf
...
...
@@ -10,6 +10,7 @@ digraph {
client
->
wcfs_spawn
;
client
->
δ
R
;
client
->
nowcfs
;
client
->
zodburl
;
wcfs
[
label
=
"wcfs"
]
...
...
@@ -25,4 +26,5 @@ digraph {
δ
R
[
label
=
"δR encoding"
]
test
[
label
=
"? tests"
]
zodburl
[
label
=
"zstor -> zurl"
]
}
wcfs/todo.svg
View file @
e62934cf
...
...
@@ -4,11 +4,11 @@
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: %3 Pages: 1 -->
<svg
width=
"
864
pt"
height=
"206pt"
viewBox=
"0.00 0.00
863.69
205.74"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<svg
width=
"
991
pt"
height=
"206pt"
viewBox=
"0.00 0.00
990.64
205.74"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<g
id=
"graph0"
class=
"graph"
transform=
"scale(1 1) rotate(0) translate(4 201.7401)"
>
<title>
%3
</title>
<polygon
fill=
"#ffffff"
stroke=
"transparent"
points=
"-4,4 -4,-201.7401
859.6909,-201.7401 859.6909
,4 -4,4"
/>
<polygon
fill=
"#ffffff"
stroke=
"transparent"
points=
"-4,4 -4,-201.7401
986.6407,-201.7401 986.6407
,4 -4,4"
/>
<!-- wcfs -->
<g
id=
"node1"
class=
"node"
>
<title>
wcfs
</title>
...
...
@@ -92,14 +92,14 @@
<!-- client -->
<g
id=
"node8"
class=
"node"
>
<title>
client
</title>
<ellipse
fill=
"none"
stroke=
"#000000"
cx=
"
680
.0456"
cy=
"-179.7401"
rx=
"30.5947"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"
680
.0456"
y=
"-176.0401"
font-family=
"Times,serif"
font-size=
"14.00"
fill=
"#000000"
>
client
</text>
<ellipse
fill=
"none"
stroke=
"#000000"
cx=
"
741
.0456"
cy=
"-179.7401"
rx=
"30.5947"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"
741
.0456"
y=
"-176.0401"
font-family=
"Times,serif"
font-size=
"14.00"
fill=
"#000000"
>
client
</text>
</g>
<!-- client->δR -->
<g
id=
"edge8"
class=
"edge"
>
<title>
client
->
δR
</title>
<path
fill=
"none"
stroke=
"#000000"
d=
"M
659.2392,-166.3861C639.8634,-153.9502 610.6331,-135.1894 587.8985,-120.59
78"
/>
<polygon
fill=
"#000000"
stroke=
"#000000"
points=
"5
89.5328,-117.4878 579.2265,-115.0319 585.7518,-123.3789 589.5328,-117.487
8"
/>
<path
fill=
"none"
stroke=
"#000000"
d=
"M
716.2134,-169.0012C685.8435,-155.8674 633.9321,-133.4178 597.0269,-117.45
78"
/>
<polygon
fill=
"#000000"
stroke=
"#000000"
points=
"5
98.0865,-114.1028 587.5187,-113.3459 595.3079,-120.5277 598.0865,-114.102
8"
/>
</g>
<!-- wcfs_spawn -->
<g
id=
"node9"
class=
"node"
>
...
...
@@ -110,8 +110,8 @@
<!-- client->wcfs_spawn -->
<g
id=
"edge7"
class=
"edge"
>
<title>
client
->
wcfs_spawn
</title>
<path
fill=
"none"
stroke=
"#000000"
d=
"M
680.0456,-161.3894C680.0456,-151.3599 680.0456,-138.7154 680.0456,-127.4265
"
/>
<polygon
fill=
"#000000"
stroke=
"#000000"
points=
"
683.5457,-127.1481 680.0456,-117.1481 676.5457,-127.1481 683.5457,-127.1481
"
/>
<path
fill=
"none"
stroke=
"#000000"
d=
"M
728.4063,-162.9838C720.0703,-151.9324 708.9859,-137.2374 699.5322,-124.7042
"
/>
<polygon
fill=
"#000000"
stroke=
"#000000"
points=
"
702.1178,-122.32 693.3016,-116.4441 696.5294,-126.5353 702.1178,-122.32
"
/>
</g>
<!-- nowcfs -->
<g
id=
"node10"
class=
"node"
>
...
...
@@ -122,14 +122,26 @@
<!-- client->nowcfs -->
<g
id=
"edge9"
class=
"edge"
>
<title>
client
->
nowcfs
</title>
<path
fill=
"none"
stroke=
"#000000"
d=
"M7
00.633,-166.2043C719.5906,-153.74 748.0404,-135.0349 770.1469,-120.500
2"
/>
<polygon
fill=
"#000000"
stroke=
"#000000"
points=
"7
72.1452,-123.3752 778.5781,-114.9569 768.2995,-117.5262 772.1452,-123.3752
"
/>
<path
fill=
"none"
stroke=
"#000000"
d=
"M7
53.892,-162.9838C762.3647,-151.9324 773.6308,-137.2374 783.2395,-124.704
2"
/>
<polygon
fill=
"#000000"
stroke=
"#000000"
points=
"7
86.2655,-126.5098 789.5722,-116.4441 780.7102,-122.2507 786.2655,-126.5098
"
/>
</g>
<!--
test
-->
<!--
zodburl
-->
<g
id=
"node11"
class=
"node"
>
<title>
zodburl
</title>
<ellipse
fill=
"none"
stroke=
"#000000"
cx=
"928.0456"
cy=
"-98.8701"
rx=
"54.6905"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"928.0456"
y=
"-95.1701"
font-family=
"Times,serif"
font-size=
"14.00"
fill=
"#000000"
>
zstor
->
zurl
</text>
</g>
<!-- client->zodburl -->
<g
id=
"edge10"
class=
"edge"
>
<title>
client
->
zodburl
</title>
<path
fill=
"none"
stroke=
"#000000"
d=
"M765.5519,-168.6251C770.6641,-166.3309 776.0247,-163.9432 781.0456,-161.7401 791.164,-157.3002 845.5685,-134.0595 885.2517,-117.1243"
/>
<polygon
fill=
"#000000"
stroke=
"#000000"
points=
"886.6575,-120.3298 894.4815,-113.1858 883.9102,-113.8914 886.6575,-120.3298"
/>
</g>
<!-- test -->
<g
id=
"node12"
class=
"node"
>
<title>
test
</title>
<ellipse
fill=
"none"
stroke=
"#000000"
cx=
"
761
.0456"
cy=
"-179.7401"
rx=
"32.4942"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"
761
.0456"
y=
"-176.0401"
font-family=
"Times,serif"
font-size=
"14.00"
fill=
"#000000"
>
? tests
</text>
<ellipse
fill=
"none"
stroke=
"#000000"
cx=
"
822
.0456"
cy=
"-179.7401"
rx=
"32.4942"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"
822
.0456"
y=
"-176.0401"
font-family=
"Times,serif"
font-size=
"14.00"
fill=
"#000000"
>
? tests
</text>
</g>
</g>
</svg>
wcfs/wcfs_test.py
0 → 100644
View file @
e62934cf
# -*- coding: utf-8 -*-
# Copyright (C) 2018 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.
from
wendelin.lib.testing
import
getTestDB
from
golang
import
go
,
chan
testdb
=
None
def
setup_module
():
global
testdb
testdb
=
getTestDB
()
testdb
.
setup
()
def
teardown_module
():
testdb
.
teardown
()
def
test_join
():
z
=
testdb
.
getZODBStorage
()
1
/
0
def
test_join_autostart
():
# XXX
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