Commit e62934cf authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3a26f3cd
...@@ -26,7 +26,7 @@ XXX doc ...@@ -26,7 +26,7 @@ XXX doc
import os, sys, hashlib, tempfile, subprocess, errno, time import os, sys, hashlib, tempfile, subprocess, errno, time
import logging as log import logging as log
from os.path import dirname from os.path import dirname
from pygolang import go, chan, select, default from golang import go, chan, select, default
# WCFS represents connection to wcfs server. # WCFS represents connection to wcfs server.
...@@ -165,7 +165,10 @@ def join(zurl, autostart=None): ...@@ -165,7 +165,10 @@ def join(zurl, autostart=None):
if _ == 1: if _ == 1:
if not isinstance(_rx, file): if not isinstance(_rx, file):
err = _rx
cancelch.close() cancelch.close()
raise RuntimeError(err)
# mounted ok - construct WCFS object # mounted ok - construct WCFS object
# XXX do we need to remember cancelch in WCFS and close it upon leaving? # XXX do we need to remember cancelch in WCFS and close it upon leaving?
...@@ -189,6 +192,23 @@ def _mntpt_4zurl(zurl): ...@@ -189,6 +192,23 @@ def _mntpt_4zurl(zurl):
return "%s/wcfs/%s" % (tempfile.gettempdir(), m.hexdigest()) 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]) # if called as main just -> run(argv[1])
def main(): def main():
......
...@@ -10,6 +10,7 @@ digraph { ...@@ -10,6 +10,7 @@ digraph {
client -> wcfs_spawn; client -> wcfs_spawn;
client -> δR; client -> δR;
client -> nowcfs; client -> nowcfs;
client -> zodburl;
wcfs [label="wcfs"] wcfs [label="wcfs"]
...@@ -25,4 +26,5 @@ digraph { ...@@ -25,4 +26,5 @@ digraph {
δR [label="δR encoding"] δR [label="δR encoding"]
test [label="? tests"] test [label="? tests"]
zodburl [label="zstor -> zurl"]
} }
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
<!-- Generated by graphviz version 2.40.1 (20161225.0304) <!-- Generated by graphviz version 2.40.1 (20161225.0304)
--> -->
<!-- Title: %3 Pages: 1 --> <!-- Title: %3 Pages: 1 -->
<svg width="864pt" height="206pt" <svg width="991pt" 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"> 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)"> <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 201.7401)">
<title>%3</title> <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 --> <!-- wcfs -->
<g id="node1" class="node"> <g id="node1" class="node">
<title>wcfs</title> <title>wcfs</title>
...@@ -92,14 +92,14 @@ ...@@ -92,14 +92,14 @@
<!-- client --> <!-- client -->
<g id="node8" class="node"> <g id="node8" class="node">
<title>client</title> <title>client</title>
<ellipse fill="none" stroke="#000000" cx="680.0456" cy="-179.7401" rx="30.5947" ry="18"/> <ellipse fill="none" stroke="#000000" cx="741.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> <text text-anchor="middle" x="741.0456" y="-176.0401" font-family="Times,serif" font-size="14.00" fill="#000000">client</text>
</g> </g>
<!-- client&#45;&gt;δR --> <!-- client&#45;&gt;δR -->
<g id="edge8" class="edge"> <g id="edge8" class="edge">
<title>client&#45;&gt;δR</title> <title>client&#45;&gt;δR</title>
<path fill="none" stroke="#000000" d="M659.2392,-166.3861C639.8634,-153.9502 610.6331,-135.1894 587.8985,-120.5978"/> <path fill="none" stroke="#000000" d="M716.2134,-169.0012C685.8435,-155.8674 633.9321,-133.4178 597.0269,-117.4578"/>
<polygon fill="#000000" stroke="#000000" points="589.5328,-117.4878 579.2265,-115.0319 585.7518,-123.3789 589.5328,-117.4878"/> <polygon fill="#000000" stroke="#000000" points="598.0865,-114.1028 587.5187,-113.3459 595.3079,-120.5277 598.0865,-114.1028"/>
</g> </g>
<!-- wcfs_spawn --> <!-- wcfs_spawn -->
<g id="node9" class="node"> <g id="node9" class="node">
...@@ -110,8 +110,8 @@ ...@@ -110,8 +110,8 @@
<!-- client&#45;&gt;wcfs_spawn --> <!-- client&#45;&gt;wcfs_spawn -->
<g id="edge7" class="edge"> <g id="edge7" class="edge">
<title>client&#45;&gt;wcfs_spawn</title> <title>client&#45;&gt;wcfs_spawn</title>
<path fill="none" stroke="#000000" d="M680.0456,-161.3894C680.0456,-151.3599 680.0456,-138.7154 680.0456,-127.4265"/> <path fill="none" stroke="#000000" d="M728.4063,-162.9838C720.0703,-151.9324 708.9859,-137.2374 699.5322,-124.7042"/>
<polygon fill="#000000" stroke="#000000" points="683.5457,-127.1481 680.0456,-117.1481 676.5457,-127.1481 683.5457,-127.1481"/> <polygon fill="#000000" stroke="#000000" points="702.1178,-122.32 693.3016,-116.4441 696.5294,-126.5353 702.1178,-122.32"/>
</g> </g>
<!-- nowcfs --> <!-- nowcfs -->
<g id="node10" class="node"> <g id="node10" class="node">
...@@ -122,14 +122,26 @@ ...@@ -122,14 +122,26 @@
<!-- client&#45;&gt;nowcfs --> <!-- client&#45;&gt;nowcfs -->
<g id="edge9" class="edge"> <g id="edge9" class="edge">
<title>client&#45;&gt;nowcfs</title> <title>client&#45;&gt;nowcfs</title>
<path fill="none" stroke="#000000" d="M700.633,-166.2043C719.5906,-153.74 748.0404,-135.0349 770.1469,-120.5002"/> <path fill="none" stroke="#000000" d="M753.892,-162.9838C762.3647,-151.9324 773.6308,-137.2374 783.2395,-124.7042"/>
<polygon fill="#000000" stroke="#000000" points="772.1452,-123.3752 778.5781,-114.9569 768.2995,-117.5262 772.1452,-123.3752"/> <polygon fill="#000000" stroke="#000000" points="786.2655,-126.5098 789.5722,-116.4441 780.7102,-122.2507 786.2655,-126.5098"/>
</g> </g>
<!-- test --> <!-- zodburl -->
<g id="node11" class="node"> <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 &#45;&gt; zurl</text>
</g>
<!-- client&#45;&gt;zodburl -->
<g id="edge10" class="edge">
<title>client&#45;&gt;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> <title>test</title>
<ellipse fill="none" stroke="#000000" cx="761.0456" cy="-179.7401" rx="32.4942" ry="18"/> <ellipse fill="none" stroke="#000000" cx="822.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> <text text-anchor="middle" x="822.0456" y="-176.0401" font-family="Times,serif" font-size="14.00" fill="#000000">? tests</text>
</g> </g>
</g> </g>
</svg> </svg>
# -*- 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment