Commit f723fb47 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4ff147d1
......@@ -20,7 +20,12 @@
"""Module wcfs.py provides python gateway for spawning and interoperating with wcfs server
XXX doc
Join(zurl) joins wcfs server. If wcfs server for zurl is not yet running, it
can be automatically started if `autostart=True` parameter is passed to join.
It will also be automatically started by default unless
$WENDELIN_CORE_WCFS_AUTOSTART=no is specified in environment.
XXX Conn.
"""
import os, sys, hashlib, tempfile, subprocess, time
......@@ -49,19 +54,19 @@ class Conn(object):
# serve starts and runs wcfs server for ZODB @ zurl.
#
# it mounts wcfs at a location that is with 1-1 corresponence with zurl.
# it mounts wcfs at a location that is with 1-1 correspondence with zurl.
# it then waits for wcfs to exit (either due to unmount or an error).
#
# it is an error if wcfs was already started.
#
# if exec_ is True, wcfs is not spawned, but execed to.
# if exec_ is True, wcfs is not spawned, but executed into.
#
# serve(zurl, exec_=False).
def serve(zurl, exec_=False):
mntpt = _mntpt_4zurl(zurl)
# try opening .wcfs - it is an error if we can do it.
# XXX -> option to wcfs itself
# XXX -> option to wcfs itself?
try:
f = open(mntpt + "/.wcfs")
except IOError as e:
......@@ -80,14 +85,24 @@ def serve(zurl, exec_=False):
os.execv(argv[0], argv)
# _default_autostart returns default autostart setting for join.
#
# Out-of-the-box we want wcfs to be automatically started, to ease developer
# experience when wendelin.core is standalone installed. However in environments
# like SlapOS, it is more preferable to start and monitor wcfs service explicitly.
# SlapOS & co. should thus set $WENDELIN_CORE_WCFS_AUTOSTART=no.
def _default_autostart():
autostart = os.environ.get("WENDELIN_CORE_WCFS_AUTOSTART", "yes")
autostart = autostart.lower()
return {"yes": True, "no": False}[autostart]
# join connects to wcfs server for ZODB @ zurl.
#
# if wcfs for that service was already started, join connects to it.
# otherwise it starts wcfs for zurl if autostart is True or (None and system
# default for autostart is True). XXX
# If wcfs for that service was already started, join connects to it.
# Otherwise it starts wcfs for zurl if autostart is True.
#
# join(zurl) -> Conn.
def join(zurl, autostart=None):
def join(zurl, autostart=_default_autostart()):
mntpt = _mntpt_4zurl(zurl)
# try opening .wcfs - if we succeed - it is already mounted.
......@@ -101,16 +116,18 @@ def join(zurl, autostart=None):
# already have it
return Conn(mntpt, f)
# XXX autostart=None processing
if not autostart:
raise RuntimeError("wcfs: join %s: server not started" % zurl)
return _start(zurl)
# start wcfs with telling it to automatically exit when there is no client activity.
return _start(zurl, "-autoexit")
# _start starts wcfs server for ZODB @ zurl.
#
# _start(zurl) -> Conn
def _start(zurl):
# optv can be optionally given to pass flags to wcfs.
#
# _start(zurl, *optv) -> Conn
def _start(zurl, *optv):
mntpt = _mntpt_4zurl(zurl)
log.info("wcfs: starting for %s ...", zurl)
......@@ -123,7 +140,8 @@ def _start(zurl):
def spawn():
err = None
try:
p = subprocess.Popen([_wcfs_exe(), zurl, mntpt], close_fds=True)
argv = [_wcfs_exe()] + list(optv) + [zurl, mntpt]
p = subprocess.Popen(argv, close_fds=True)
while 1:
ret = p.poll()
if ret is not None:
......@@ -140,7 +158,7 @@ def _start(zurl):
break
if _ == 1:
# startup was ok - don't monitor spawned wcfs anylonger
# startup was ok - don't monitor spawned wcfs any longer
break
time.sleep(0.1)
......@@ -203,7 +221,13 @@ def _start(zurl):
if _ == 1:
if isinstance(_rx, file):
# mounted ok - return Conn object
# mounted ok - return Conn object.
#
# NOTE: we tell `spawn` thread to exit and stop monitoring spawned
# wcfs, because we want spawned wcfs to potentially overlive our
# process and to serve other processes. For the same reason we do
# not preserve cancel channel in returned Conn.
f = _rx
startedok.close()
return Conn(mntpt, f)
......@@ -212,7 +236,6 @@ def _start(zurl):
err = _rx
cancel.close()
raise RuntimeError("wcfs: start: %s" % err) # XXX errctx
......
......@@ -3,9 +3,11 @@ digraph {
wcfs -> ZODB_go_inv;
wcfs -> Sinvtree;
wcfs -> δR;
wcfs -> autoexit;
wcfs_simple -> Btree_read;
wcfs_simple -> ZBlk_read;
wcfs_simple -> autoexit;
client -> wcfs_spawn;
client -> δR;
......@@ -27,4 +29,6 @@ digraph {
test [label="? tests"]
zodburl [label="zstor -> zurl", style=filled fillcolor=grey95]
autoexit [label="autoexit if\nautostart && !activity"]
}
......@@ -4,144 +4,163 @@
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: %3 Pages: 1 -->
<svg width="991pt" 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)">
<svg width="1029pt" height="223pt"
viewBox="0.00 0.00 1028.64 223.48" 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 219.4802)">
<title>%3</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-201.7401 986.6407,-201.7401 986.6407,4 -4,4"/>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-219.4802 1024.6407,-219.4802 1024.6407,4 -4,4"/>
<!-- wcfs -->
<g id="node1" class="node">
<title>wcfs</title>
<ellipse fill="none" stroke="#000000" cx="342.0456" cy="-179.7401" rx="27.0966" ry="18"/>
<text text-anchor="middle" x="342.0456" y="-176.0401" font-family="Times,serif" font-size="14.00" fill="#000000">wcfs</text>
<ellipse fill="none" stroke="#000000" cx="414.0456" cy="-197.4802" rx="27.0966" ry="18"/>
<text text-anchor="middle" x="414.0456" y="-193.7802" font-family="Times,serif" font-size="14.00" fill="#000000">wcfs</text>
</g>
<!-- wcfs_simple -->
<g id="node2" class="node">
<title>wcfs_simple</title>
<ellipse fill="none" stroke="#000000" cx="129.0456" cy="-98.8701" rx="60.623" ry="26.7407"/>
<text text-anchor="middle" x="129.0456" y="-102.6701" font-family="Times,serif" font-size="14.00" fill="#000000">wcfs no</text>
<text text-anchor="middle" x="129.0456" y="-87.6701" font-family="Times,serif" font-size="14.00" fill="#000000">invalidations</text>
<ellipse fill="none" stroke="#000000" cx="129.0456" cy="-116.6102" rx="60.623" ry="26.7407"/>
<text text-anchor="middle" x="129.0456" y="-120.4102" font-family="Times,serif" font-size="14.00" fill="#000000">wcfs no</text>
<text text-anchor="middle" x="129.0456" y="-105.4102" font-family="Times,serif" font-size="14.00" fill="#000000">invalidations</text>
</g>
<!-- wcfs&#45;&gt;wcfs_simple -->
<g id="edge1" class="edge">
<title>wcfs&#45;&gt;wcfs_simple</title>
<path fill="none" stroke="#000000" d="M318.2464,-170.7982C289.8538,-160.1201 240.9589,-141.6981 199.0456,-125.7401 194.301,-123.9337 189.3775,-122.0541 184.4396,-120.1654"/>
<polygon fill="#000000" stroke="#000000" points="185.5598,-116.8466 174.9694,-116.5393 183.0567,-123.3838 185.5598,-116.8466"/>
<path fill="none" stroke="#000000" d="M387.9494,-191.992C347.2079,-183.1856 266.1965,-164.7164 199.0456,-143.4802 193.9258,-141.8611 188.6385,-140.0662 183.3706,-138.1941"/>
<polygon fill="#000000" stroke="#000000" points="184.5436,-134.8964 173.9497,-134.7622 182.1477,-141.4736 184.5436,-134.8964"/>
</g>
<!-- ZODB_go_inv -->
<g id="node3" class="node">
<title>ZODB_go_inv</title>
<ellipse fill="none" stroke="#000000" cx="269.0456" cy="-98.8701" rx="60.623" ry="26.7407"/>
<text text-anchor="middle" x="269.0456" y="-102.6701" font-family="Times,serif" font-size="14.00" fill="#000000">ZODB/go</text>
<text text-anchor="middle" x="269.0456" y="-87.6701" font-family="Times,serif" font-size="14.00" fill="#000000">invalidations</text>
<ellipse fill="none" stroke="#000000" cx="269.0456" cy="-116.6102" rx="60.623" ry="26.7407"/>
<text text-anchor="middle" x="269.0456" y="-120.4102" font-family="Times,serif" font-size="14.00" fill="#000000">ZODB/go</text>
<text text-anchor="middle" x="269.0456" y="-105.4102" font-family="Times,serif" font-size="14.00" fill="#000000">invalidations</text>
</g>
<!-- wcfs&#45;&gt;ZODB_go_inv -->
<g id="edge2" class="edge">
<title>wcfs&#45;&gt;ZODB_go_inv</title>
<path fill="none" stroke="#000000" d="M327.9704,-164.1476C319.622,-154.8991 308.7181,-142.8196 298.5632,-131.5699"/>
<polygon fill="#000000" stroke="#000000" points="300.9919,-129.0371 291.6932,-123.9593 295.7958,-133.7276 300.9919,-129.0371"/>
<path fill="none" stroke="#000000" d="M392.9613,-185.721C372.8665,-174.5137 341.9144,-157.2509 315.9726,-142.7825"/>
<polygon fill="#000000" stroke="#000000" points="317.47,-139.6101 307.0316,-137.7959 314.0603,-145.7236 317.47,-139.6101"/>
</g>
<!-- Sinvtree -->
<g id="node4" class="node">
<title>Sinvtree</title>
<ellipse fill="none" stroke="#000000" cx="414.0456" cy="-98.8701" rx="66.0889" ry="18"/>
<text text-anchor="middle" x="414.0456" y="-95.1701" font-family="Times,serif" font-size="14.00" fill="#000000">server: inv. tree</text>
<ellipse fill="none" stroke="#000000" cx="414.0456" cy="-116.6102" rx="66.0889" ry="18"/>
<text text-anchor="middle" x="414.0456" y="-112.9102" font-family="Times,serif" font-size="14.00" fill="#000000">server: inv. tree</text>
</g>
<!-- wcfs&#45;&gt;Sinvtree -->
<g id="edge3" class="edge">
<title>wcfs&#45;&gt;Sinvtree</title>
<path fill="none" stroke="#000000" d="M355.9279,-164.1476C366.0124,-152.8207 379.8773,-137.2477 391.5356,-124.1531"/>
<polygon fill="#000000" stroke="#000000" points="394.4204,-126.1765 398.4559,-116.3803 389.1922,-121.5217 394.4204,-126.1765"/>
<path fill="none" stroke="#000000" d="M414.0456,-179.1296C414.0456,-169.1 414.0456,-156.4555 414.0456,-145.1666"/>
<polygon fill="#000000" stroke="#000000" points="417.5457,-144.8882 414.0456,-134.8882 410.5457,-144.8883 417.5457,-144.8882"/>
</g>
<!-- δR -->
<g id="node5" class="node">
<title>δR</title>
<ellipse fill="none" stroke="#000000" cx="554.0456" cy="-98.8701" rx="55.7903" ry="18"/>
<text text-anchor="middle" x="554.0456" y="-95.1701" font-family="Times,serif" font-size="14.00" fill="#000000">δR encoding</text>
<ellipse fill="none" stroke="#000000" cx="592.0456" cy="-116.6102" rx="55.7903" ry="18"/>
<text text-anchor="middle" x="592.0456" y="-112.9102" font-family="Times,serif" font-size="14.00" fill="#000000">δR encoding</text>
</g>
<!-- wcfs&#45;&gt;δR -->
<g id="edge4" class="edge">
<title>wcfs&#45;&gt;δR</title>
<path fill="none" stroke="#000000" d="M366.3483,-171.1484C395.5899,-160.7334 446.1138,-142.4915 489.0456,-125.7401 496.006,-123.0242 503.3525,-120.0716 510.5028,-117.1505"/>
<polygon fill="#000000" stroke="#000000" points="512.1604,-120.2533 520.077,-113.212 509.4973,-113.7796 512.1604,-120.2533"/>
<path fill="none" stroke="#000000" d="M436.5894,-187.238C465.1,-174.2848 514.7498,-151.7277 550.2709,-135.5895"/>
<polygon fill="#000000" stroke="#000000" points="551.7733,-138.7513 559.43,-131.4283 548.8778,-132.3782 551.7733,-138.7513"/>
</g>
<!-- Btree_read -->
<!-- autoexit -->
<g id="node6" class="node">
<title>autoexit</title>
<ellipse fill="none" stroke="#000000" cx="460.0456" cy="-26.8701" rx="97.6615" ry="26.7407"/>
<text text-anchor="middle" x="460.0456" y="-30.6701" font-family="Times,serif" font-size="14.00" fill="#000000">autoexit if</text>
<text text-anchor="middle" x="460.0456" y="-15.6701" font-family="Times,serif" font-size="14.00" fill="#000000">autostart &amp;&amp; !activity</text>
</g>
<!-- wcfs&#45;&gt;autoexit -->
<g id="edge5" class="edge">
<title>wcfs&#45;&gt;autoexit</title>
<path fill="none" stroke="#000000" d="M437.4092,-187.8647C455.1593,-179.1615 478.2928,-164.4722 489.0456,-143.4802 502.0598,-118.0735 492.8759,-86.511 481.5061,-62.6324"/>
<polygon fill="#000000" stroke="#000000" points="484.5519,-60.8997 476.9096,-53.5617 478.3078,-64.0639 484.5519,-60.8997"/>
</g>
<!-- wcfs_simple&#45;&gt;autoexit -->
<g id="edge8" class="edge">
<title>wcfs_simple&#45;&gt;autoexit</title>
<path fill="none" stroke="#000000" d="M173.9291,-98.3925C182.215,-95.3125 190.8415,-92.2909 199.0456,-89.7401 255.7919,-72.0965 320.7548,-56.4326 371.6738,-45.153"/>
<polygon fill="#000000" stroke="#000000" points="372.6488,-48.5223 381.6637,-42.9562 371.1454,-41.6856 372.6488,-48.5223"/>
</g>
<!-- Btree_read -->
<g id="node7" class="node">
<title>Btree_read</title>
<ellipse fill="none" stroke="#000000" cx="50.0456" cy="-18" rx="50.0912" ry="18"/>
<text text-anchor="middle" x="50.0456" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">BTree read</text>
<ellipse fill="none" stroke="#000000" cx="50.0456" cy="-26.8701" rx="50.0912" ry="18"/>
<text text-anchor="middle" x="50.0456" y="-23.1701" font-family="Times,serif" font-size="14.00" fill="#000000">BTree read</text>
</g>
<!-- wcfs_simple&#45;&gt;Btree_read -->
<g id="edge5" class="edge">
<g id="edge6" class="edge">
<title>wcfs_simple&#45;&gt;Btree_read</title>
<path fill="none" stroke="#000000" d="M104.9137,-74.167C95.0785,-64.0989 83.7372,-52.4892 73.9278,-42.4475"/>
<polygon fill="#000000" stroke="#000000" points="76.2668,-39.8333 66.7753,-35.1257 71.2595,-44.7248 76.2668,-39.8333"/>
<path fill="none" stroke="#000000" d="M106.6186,-91.1343C95.7668,-78.8071 82.7861,-64.0617 71.9975,-51.8064"/>
<polygon fill="#000000" stroke="#000000" points="74.5035,-49.3562 65.2688,-44.1629 69.2494,-53.9815 74.5035,-49.3562"/>
</g>
<!-- ZBlk_read -->
<g id="node7" class="node">
<g id="node8" class="node">
<title>ZBlk_read</title>
<ellipse fill="none" stroke="#000000" cx="208.0456" cy="-18" rx="89.8845" ry="18"/>
<text text-anchor="middle" x="208.0456" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">ZBigFile / ZBlk* read</text>
<ellipse fill="none" stroke="#000000" cx="208.0456" cy="-26.8701" rx="89.8845" ry="18"/>
<text text-anchor="middle" x="208.0456" y="-23.1701" font-family="Times,serif" font-size="14.00" fill="#000000">ZBigFile / ZBlk* read</text>
</g>
<!-- wcfs_simple&#45;&gt;ZBlk_read -->
<g id="edge6" class="edge">
<g id="edge7" class="edge">
<title>wcfs_simple&#45;&gt;ZBlk_read</title>
<path fill="none" stroke="#000000" d="M153.1774,-74.167C162.7957,-64.321 173.8543,-53.0007 183.512,-43.1143"/>
<polygon fill="#000000" stroke="#000000" points="186.093,-45.4809 190.5772,-35.8818 181.0856,-40.5894 186.093,-45.4809"/>
<path fill="none" stroke="#000000" d="M151.4725,-91.1343C162.1746,-78.9772 174.9473,-64.468 185.646,-52.3149"/>
<polygon fill="#000000" stroke="#000000" points="188.3538,-54.5358 192.3344,-44.7172 183.0996,-49.9105 188.3538,-54.5358"/>
</g>
<!-- client -->
<g id="node8" class="node">
<g id="node9" class="node">
<title>client</title>
<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>
<ellipse fill="none" stroke="#000000" cx="779.0456" cy="-197.4802" rx="30.5947" ry="18"/>
<text text-anchor="middle" x="779.0456" y="-193.7802" font-family="Times,serif" font-size="14.00" fill="#000000">client</text>
</g>
<!-- client&#45;&gt;δR -->
<g id="edge8" class="edge">
<g id="edge10" class="edge">
<title>client&#45;&gt;δR</title>
<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="598.0865,-114.1028 587.5187,-113.3459 595.3079,-120.5277 598.0865,-114.1028"/>
<path fill="none" stroke="#000000" d="M754.2134,-186.7413C723.8435,-173.6075 671.9321,-151.1579 635.0269,-135.1979"/>
<polygon fill="#000000" stroke="#000000" points="636.0865,-131.8429 625.5187,-131.086 633.3079,-138.2678 636.0865,-131.8429"/>
</g>
<!-- wcfs_spawn -->
<g id="node9" class="node">
<g id="node10" class="node">
<title>wcfs_spawn</title>
<ellipse fill="#ffffe0" stroke="#000000" cx="680.0456" cy="-98.8701" rx="51.9908" ry="18"/>
<text text-anchor="middle" x="680.0456" y="-95.1701" font-family="Times,serif" font-size="14.00" fill="#000000">spawn wcfs</text>
<ellipse fill="#ffffe0" stroke="#000000" cx="718.0456" cy="-116.6102" rx="51.9908" ry="18"/>
<text text-anchor="middle" x="718.0456" y="-112.9102" font-family="Times,serif" font-size="14.00" fill="#000000">spawn wcfs</text>
</g>
<!-- client&#45;&gt;wcfs_spawn -->
<g id="edge7" class="edge">
<g id="edge9" class="edge">
<title>client&#45;&gt;wcfs_spawn</title>
<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="702.1178,-122.32 693.3016,-116.4441 696.5294,-126.5353 702.1178,-122.32"/>
<path fill="none" stroke="#000000" d="M766.4063,-180.7239C758.0703,-169.6725 746.9859,-154.9775 737.5322,-142.4443"/>
<polygon fill="#000000" stroke="#000000" points="740.1178,-140.0601 731.3016,-134.1842 734.5294,-144.2755 740.1178,-140.0601"/>
</g>
<!-- nowcfs -->
<g id="node10" class="node">
<g id="node11" class="node">
<title>nowcfs</title>
<ellipse fill="none" stroke="#000000" cx="803.0456" cy="-98.8701" rx="52.7911" ry="18"/>
<text text-anchor="middle" x="803.0456" y="-95.1701" font-family="Times,serif" font-size="14.00" fill="#000000">!wcfs mode</text>
<ellipse fill="none" stroke="#000000" cx="841.0456" cy="-116.6102" rx="52.7911" ry="18"/>
<text text-anchor="middle" x="841.0456" y="-112.9102" font-family="Times,serif" font-size="14.00" fill="#000000">!wcfs mode</text>
</g>
<!-- client&#45;&gt;nowcfs -->
<g id="edge9" class="edge">
<g id="edge11" class="edge">
<title>client&#45;&gt;nowcfs</title>
<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="786.2655,-126.5098 789.5722,-116.4441 780.7102,-122.2507 786.2655,-126.5098"/>
<path fill="none" stroke="#000000" d="M791.892,-180.7239C800.3647,-169.6725 811.6308,-154.9775 821.2395,-142.4443"/>
<polygon fill="#000000" stroke="#000000" points="824.2655,-144.2499 827.5722,-134.1842 818.7102,-139.9908 824.2655,-144.2499"/>
</g>
<!-- zodburl -->
<g id="node11" class="node">
<g id="node12" class="node">
<title>zodburl</title>
<ellipse fill="#f2f2f2" 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>
<ellipse fill="#f2f2f2" stroke="#000000" cx="966.0456" cy="-116.6102" rx="54.6905" ry="18"/>
<text text-anchor="middle" x="966.0456" y="-112.9102" 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">
<g id="edge12" 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"/>
<path fill="none" stroke="#000000" d="M803.5519,-186.3652C808.6641,-184.0711 814.0247,-181.6834 819.0456,-179.4802 829.164,-175.0403 883.5685,-151.7996 923.2517,-134.8644"/>
<polygon fill="#000000" stroke="#000000" points="924.6575,-138.0699 932.4815,-130.9259 921.9102,-131.6315 924.6575,-138.0699"/>
</g>
<!-- test -->
<g id="node12" class="node">
<g id="node13" class="node">
<title>test</title>
<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>
<ellipse fill="none" stroke="#000000" cx="860.0456" cy="-197.4802" rx="32.4942" ry="18"/>
<text text-anchor="middle" x="860.0456" y="-193.7802" font-family="Times,serif" font-size="14.00" fill="#000000">? tests</text>
</g>
</g>
</svg>
......@@ -119,7 +119,7 @@
// mmap(bigfile/<bigfileX>/head/data)
// mmap(bigfile/<bigfileX>/@<Cat>/data, δR(Cat,Sat), MAP_FIXED) # mmaped at addresses corresponding to δR(Cat,Sat)
//
// When client completes its initiall mmapping it sends ack back to the server:
// When client completes its initial mmapping it sends ack back to the server:
//
// C: ack
//
......@@ -170,7 +170,7 @@
// This way there should be no possibility for a client to block wcfs
// indefinitely waiting for client's ack.
//
// Similarly for initiall mmapings client could first mmap head/data, then open
// Similarly for initial mmapings client could first mmap head/data, then open
// head/invalidations and tell the server that it wants Cat revision, with
// the server then remmaping blocks to get to Cat state via ptrace.
//
......@@ -357,6 +357,8 @@ func (br *BigFileRoot) Mkdir(name string, mode uint32, _ *fuse.Context) (*nodefs
mkdir(br, name, bx) // XXX takes treeLock - ok under br.mu ?
mkdir(bx, "head", bf)
mkfile(bf, "data", bf.data)
// XXX mkfile(bf, "at", bf.at)
// XXX mkfile(bf, "invalidations", bf.inv)
return bx.Inode(), fuse.OK
}
......@@ -367,16 +369,15 @@ func (br *BigFileRoot) Mkdir(name string, mode uint32, _ *fuse.Context) (*nodefs
// XXX option to prevent starting if wcfs was already started ?
// XXX option to automatically exit/unmount if there are no requests for some t
// (UC: autospawned from join)
func main() {
log.SetPrefix("wcfs: ")
debug := flag.Bool("d", false, "debug")
autoexit := flag.Bool("autoexit", false, "automatically stop service when there is no client activity")
flag.Parse()
if len(flag.Args()) != 2 {
log.Fatalf("Usage: %s zurl mntpt", os.Args[0])
log.Fatalf("Usage: %s [OPTIONS] zurl mntpt", os.Args[0])
}
zurl := flag.Args()[0]
mntpt := flag.Args()[1]
......@@ -405,6 +406,9 @@ func main() {
mkfile(root, ".wcfs", NewStaticFile([]byte(zurl)))
mkdir(root, "bigfile", NewBigFileRoot(zstor))
// TODO handle autoexit
_ = autoexit
// serve client requests
server.Serve() // XXX Serve returns no eror
server.Serve() // XXX Serve returns no error
}
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