Ticket #393: iwritable.diff.txt

File iwritable.diff.txt, 1.6 KB (added by kevan, at 2010-07-19T16:40:33Z)
Line 
1diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py
2index 166aeee..85bcc42 100644
3--- a/src/allmydata/interfaces.py
4+++ b/src/allmydata/interfaces.py
5@@ -630,6 +630,26 @@ class IReadable(Interface):
6         """
7 
8 
9+class IWritable(Interface):
10+    """
11+    I define methods that callers can use to update SDMF and MDMF
12+    mutable files on a Tahoe-LAFS grid.
13+    """
14+    # XXX: For the moment, we have only this. It is possible that we
15+    #      want to move overwrite() and modify() in here too.
16+    def update(data=IMutableUploadable, offset):
17+        """
18+        I write the data from my data argument to the MDMF file,
19+        starting at offset. I continue writing data until my data
20+        argument is exhausted, appending data to the file as necessary.
21+        """
22+        # to append data: offset=node.get_size_of_best_version()
23+        # do we want to support compacting MDMF?
24+        # for an MDMF file, this can be done with O(data.get_size())
25+        # memory. For an SDMF file, any modification takes
26+        # O(node.get_size_of_best_version()).
27+
28+
29 class IMutableFileVersion(IReadable):
30     """I provide access to a particular version of a mutable file. The
31     access is read/write if I was obtained from a filenode derived from
32@@ -798,6 +818,7 @@ class IFilesystemNode(Interface):
33     def raise_error():
34         """Raise any error associated with this node."""
35 
36+    # XXX: These may not be appropriate outside the context of an IReadable.
37     def get_size():
38         """Return the length (in bytes) of the data this node represents. For
39         directory nodes, I return the size of the backing store. I return