diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py index 166aeee..85bcc42 100644 --- a/src/allmydata/interfaces.py +++ b/src/allmydata/interfaces.py @@ -630,6 +630,26 @@ class IReadable(Interface): """ +class IWritable(Interface): + """ + I define methods that callers can use to update SDMF and MDMF + mutable files on a Tahoe-LAFS grid. + """ + # XXX: For the moment, we have only this. It is possible that we + # want to move overwrite() and modify() in here too. + def update(data=IMutableUploadable, offset): + """ + I write the data from my data argument to the MDMF file, + starting at offset. I continue writing data until my data + argument is exhausted, appending data to the file as necessary. + """ + # to append data: offset=node.get_size_of_best_version() + # do we want to support compacting MDMF? + # for an MDMF file, this can be done with O(data.get_size()) + # memory. For an SDMF file, any modification takes + # O(node.get_size_of_best_version()). + + class IMutableFileVersion(IReadable): """I provide access to a particular version of a mutable file. The access is read/write if I was obtained from a filenode derived from @@ -798,6 +818,7 @@ class IFilesystemNode(Interface): def raise_error(): """Raise any error associated with this node.""" + # XXX: These may not be appropriate outside the context of an IReadable. def get_size(): """Return the length (in bytes) of the data this node represents. For directory nodes, I return the size of the backing store. I return