From: david-sarah Date: Tue, 24 Jul 2012 03:39:24 +0000 (+0000) Subject: interfaces.py: corrections to interfaces to make more of them checkable. X-Git-Tag: allmydata-tahoe-1.10a1~61 X-Git-Url: https://git.rkrishnan.org/COPYING.TGPPL.html?a=commitdiff_plain;h=e8240b0923ffe084be264cf58e1a1028b0a25fcf;p=tahoe-lafs%2Ftahoe-lafs.git interfaces.py: corrections to interfaces to make more of them checkable. --- diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py index 03203bab..9e1e99c2 100644 --- a/src/allmydata/interfaces.py +++ b/src/allmydata/interfaces.py @@ -471,7 +471,7 @@ class IMutableSlotWriter(Interface): """ The interface for a writer around a mutable slot on a remote server. """ - def set_checkstring(checkstring, *args): + def set_checkstring(seqnum_or_checkstring, root_hash=None, salt=None): """ Set the checkstring that I will pass to the remote server when writing. @@ -734,8 +734,7 @@ class IMutableFileVersion(IReadable): writer-visible data using this writekey. """ - # TODO: Can this be overwrite instead of replace? - def replace(new_contents): + def overwrite(new_contents): """Replace the contents of the mutable file, provided that no other node has published (or is attempting to publish, concurrently) a newer version of the file than this one. @@ -1618,21 +1617,6 @@ class IEncoder(Interface): """Specify the number of bytes that will be encoded. This must be peformed before get_serialized_params() can be called. """ - def set_params(params): - """Override the default encoding parameters. 'params' is a tuple of - (k,d,n), where 'k' is the number of required shares, 'd' is the - servers_of_happiness, and 'n' is the total number of shares that will - be created. - - Encoding parameters can be set in three ways. 1: The Encoder class - provides defaults (3/7/10). 2: the Encoder can be constructed with - an 'options' dictionary, in which the - needed_and_happy_and_total_shares' key can be a (k,d,n) tuple. 3: - set_params((k,d,n)) can be called. - - If you intend to use set_params(), you must call it before - get_share_size or get_param are called. - """ def set_encrypted_uploadable(u): """Provide a source of encrypted upload data. 'u' must implement @@ -1825,34 +1809,6 @@ class IEncryptedUploadable(Interface): resuming an interrupted upload (where we need to compute the plaintext hashes, but don't need the redundant encrypted data).""" - def get_plaintext_hashtree_leaves(first, last, num_segments): - """OBSOLETE; Get the leaf nodes of a merkle hash tree over the - plaintext segments, i.e. get the tagged hashes of the given segments. - The segment size is expected to be generated by the - IEncryptedUploadable before any plaintext is read or ciphertext - produced, so that the segment hashes can be generated with only a - single pass. - - This returns a Deferred which fires with a sequence of hashes, using: - - tuple(segment_hashes[first:last]) - - 'num_segments' is used to assert that the number of segments that the - IEncryptedUploadable handled matches the number of segments that the - encoder was expecting. - - This method must not be called until the final byte has been read - from read_encrypted(). Once this method is called, read_encrypted() - can never be called again. - """ - - def get_plaintext_hash(): - """OBSOLETE; Get the hash of the whole plaintext. - - This returns a Deferred which fires with a tagged SHA-256 hash of the - whole plaintext, obtained from hashutil.plaintext_hash(data). - """ - def close(): """Just like IUploadable.close().""" @@ -2074,8 +2030,6 @@ class IUploader(Interface): returns a Deferred that fires with an IUploadResults instance, from which the URI of the file can be obtained as results.uri .""" - def upload_ssk(write_capability, new_version, uploadable): - """TODO: how should this work?""" class ICheckable(Interface): def check(monitor, verify=False, add_lease=False): @@ -2518,7 +2472,8 @@ class INodeMaker(Interface): Tahoe process will typically have a single NodeMaker, but unit tests may create simplified/mocked forms for testing purposes. """ - def create_from_cap(writecap, readcap=None, **kwargs): + + def create_from_cap(writecap, readcap=None, deep_immutable=False, name=u""): """I create an IFilesystemNode from the given writecap/readcap. I can only provide nodes for existing file/directory objects: use my other methods to create new objects. I return synchronously."""