from zope.interface import implements
-from twisted.internet import defer
from allmydata.filetree.interfaces import (INode,
IDirectoryNode,
ISubTree,
- IMutableSubTree)
+ ICHKDirectoryNode, ISSKDirectoryNode,
+ NoSuchChildError,
+ )
+from allmydata import download
from allmydata.util import bencode
# interesting feature ideas:
# vice versa.
+def to_node(spec):
+ # TODO
+ pass
+def to_spec(node):
+ # TODO
+ pass
+
+
class SubTreeNode:
implements(INode, IDirectoryNode)
if childname in self.subdirectory_node_children:
del self.subdirectory_node_children[childname]
elif childname in self.child_specifications:
- del to_node(self.child_specifications[childname])
+ del self.child_specifications[childname]
else:
raise NoSuchChildError("no child named '%s'" % (childname,))
# ... detach subtree, merge subtree, etc
+
+# TODO
+
+class ICHKDirectoryNode(Interface):
+ pass
+class ISSKDirectoryNode(Interface):
+ pass
+
+
+
+class NoSuchChildError(Exception):
+ pass
+class NoSuchDirectoryError(Exception):
+ pass
+class PathAlreadyExistsError(Exception):
+ pass
+class PathDoesNotExistError(Exception):
+ pass
-from allmydata.filetree import interfaces, opener
+from zope.interface import implements
+from allmydata.filetree import opener
+from allmydata.filetree.interfaces import (IVirtualDrive, ISubTree, IFileNode,
+ IDirectoryNode, NoSuchDirectoryError,
+ NoSuchChildError, PathAlreadyExistsError,
+ PathDoesNotExistError,
+ )
+from allmydata.upload import IUploadable
class VirtualDrive(object):
- implements(interfaces.IVirtualDrive)
+ implements(IVirtualDrive)
def __init__(self, workqueue, downloader, root_specification):
self.workqueue = workqueue
workqueue.set_vdrive(self)
# TODO: queen?
- self.opener = Opener(queen, downloader)
+ self.opener = opener.Opener(self.queen, downloader)
self.root_specification = root_specification
# these methods are used to walk through our subtrees
def _got_directory(node):
if not node:
raise NoSuchDirectoryError
- assert interfaces.IDirectoryNode(node)
+ assert IDirectoryNode(node)
return node
d.addCallback(_got_directory)
return d
+"""
from zope.interface import implements
from twisted.trial import unittest
from twisted.internet import defer
class Redirect(unittest.TestCase):
pass
+"""
def step_addpath(self, boxname, *path):
data = self.read_from_box(boxname)
child_node = unserialize(data) # TODO: unserialize ?
- return self.vdrive.add(path, node)
+ return self.vdrive.add(path, child_node)
def step_retain_ssk(self, index_a, read_key_a):
pass