interfaces.py: wrap some lines to 80cols

This commit is contained in:
Brian Warner 2009-07-01 18:57:28 -07:00
parent b640baf500
commit 3dedfed9de

View File

@ -1176,7 +1176,8 @@ class ICodecEncoder(Interface):
class ICodecDecoder(Interface): class ICodecDecoder(Interface):
def set_params(data_size, required_shares, max_shares): def set_params(data_size, required_shares, max_shares):
"""Set the params. They have to be exactly the same ones that were used for encoding. """ """Set the params. They have to be exactly the same ones that were
used for encoding."""
def get_needed_shares(): def get_needed_shares():
"""Return the number of shares needed to reconstruct the data. """Return the number of shares needed to reconstruct the data.
@ -1311,9 +1312,9 @@ class IEncoder(Interface):
set_encrypted_uploadable() and set_shareholders() must be called set_encrypted_uploadable() and set_shareholders() must be called
before this can be invoked. before this can be invoked.
This returns a Deferred that fires with a verify cap when the upload process is This returns a Deferred that fires with a verify cap when the upload
complete. The verifycap, plus the encryption key, is sufficient to construct the read process is complete. The verifycap, plus the encryption key, is
cap. sufficient to construct the read cap.
""" """
class IDecoder(Interface): class IDecoder(Interface):
@ -1378,9 +1379,10 @@ class IDownloadTarget(Interface):
called. Whatever it returns will be returned to the invoker of called. Whatever it returns will be returned to the invoker of
Downloader.download. Downloader.download.
""" """
# The following methods are just because that target might be a repairer.DownUpConnector, # The following methods are just because that target might be a
# and just because the current CHKUpload object expects to find the storage index and # repairer.DownUpConnector, and just because the current CHKUpload object
# encoding parameters in its Uploadable. # expects to find the storage index and encoding parameters in its
# Uploadable.
def set_storageindex(storageindex): def set_storageindex(storageindex):
""" Set the storage index. """ """ Set the storage index. """
def set_encodingparams(encodingparams): def set_encodingparams(encodingparams):
@ -1433,11 +1435,12 @@ class IEncryptedUploadable(Interface):
plaintext hashes, but don't need the redundant encrypted data).""" plaintext hashes, but don't need the redundant encrypted data)."""
def get_plaintext_hashtree_leaves(first, last, num_segments): def get_plaintext_hashtree_leaves(first, last, num_segments):
"""OBSOLETE; Get the leaf nodes of a merkle hash tree over the plaintext """OBSOLETE; Get the leaf nodes of a merkle hash tree over the
segments, i.e. get the tagged hashes of the given segments. The plaintext segments, i.e. get the tagged hashes of the given segments.
segment size is expected to be generated by the IEncryptedUploadable The segment size is expected to be generated by the
before any plaintext is read or ciphertext produced, so that the IEncryptedUploadable before any plaintext is read or ciphertext
segment hashes can be generated with only a single pass. 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: This returns a Deferred which fires with a sequence of hashes, using:
@ -1594,8 +1597,8 @@ class IDownloadResults(Interface):
.file_size : the size of the file, in bytes .file_size : the size of the file, in bytes
.servers_used : set of server peerids that were used during download .servers_used : set of server peerids that were used during download
.server_problems : dict mapping server peerid to a problem string. Only .server_problems : dict mapping server peerid to a problem string. Only
servers that had problems (bad hashes, disconnects) are servers that had problems (bad hashes, disconnects)
listed here. are listed here.
.servermap : dict mapping server peerid to a set of share numbers. Only .servermap : dict mapping server peerid to a set of share numbers. Only
servers that had any shares are listed here. servers that had any shares are listed here.
.timings : dict of timing information, mapping name to seconds (float) .timings : dict of timing information, mapping name to seconds (float)
@ -1744,11 +1747,11 @@ class ICheckResults(Interface):
def get_data(): def get_data():
"""Return a dictionary that describes the state of the file/dir. LIT """Return a dictionary that describes the state of the file/dir. LIT
files always return an empty dictionary. Normal files and directories return a files always return an empty dictionary. Normal files and directories
dictionary with the following keys (note that these use binary strings rather than return a dictionary with the following keys (note that these use
base32-encoded ones) (also note that for mutable files, these counts are for the 'best' binary strings rather than base32-encoded ones) (also note that for
version): mutable files, these counts are for the 'best' version):
count-shares-good: the number of distinct good shares that were found count-shares-good: the number of distinct good shares that were found
count-shares-needed: 'k', the number of shares required for recovery count-shares-needed: 'k', the number of shares required for recovery
@ -1765,19 +1768,20 @@ class ICheckResults(Interface):
that was found to be corrupt. Each share that was found to be corrupt. Each share
locator is a list of (serverid, storage_index, locator is a list of (serverid, storage_index,
sharenum). sharenum).
count-incompatible-shares: the number of shares which are of a share format unknown to count-incompatible-shares: the number of shares which are of a share
this checker format unknown to this checker
list-incompatible-shares: a list of 'share locators', one for each share that was found list-incompatible-shares: a list of 'share locators', one for each
to be of an unknown format. Each share locator is a list of share that was found to be of an unknown
(serverid, storage_index, sharenum). format. Each share locator is a list of
(serverid, storage_index, sharenum).
servers-responding: list of (binary) storage server identifiers, servers-responding: list of (binary) storage server identifiers,
one for each server which responded to the share one for each server which responded to the share
query (even if they said they didn't have shares, query (even if they said they didn't have
and even if they said they did have shares but then shares, and even if they said they did have
didn't send them when asked, or dropped the shares but then didn't send them when asked, or
connection, or returned a Failure, and even if they dropped the connection, or returned a Failure,
said they did have shares and sent incorrect ones and even if they said they did have shares and
when asked) sent incorrect ones when asked)
sharemap: dict mapping share identifier to list of serverids sharemap: dict mapping share identifier to list of serverids
(binary strings). This indicates which servers are holding (binary strings). This indicates which servers are holding
which shares. For immutable files, the shareid is an which shares. For immutable files, the shareid is an
@ -2008,8 +2012,8 @@ class IClient(Interface):
@param uri: a string or IURI-providing instance. This could be for a @param uri: a string or IURI-providing instance. This could be for a
LiteralFileNode, a CHK file node, a mutable file node, or LiteralFileNode, a CHK file node, a mutable file node, or
a directory node a directory node
@return: an instance that provides IFilesystemNode (or more usefully one @return: an instance that provides IFilesystemNode (or more usefully
of its subclasses). File-specifying URIs will result in one of its subclasses). File-specifying URIs will result in
IFileNode or IMutableFileNode -providing instances, like IFileNode or IMutableFileNode -providing instances, like
FileNode, LiteralFileNode, or MutableFileNode. FileNode, LiteralFileNode, or MutableFileNode.
Directory-specifying URIs will result in Directory-specifying URIs will result in
@ -2124,7 +2128,9 @@ class RIControlClient(RemoteInterface):
storage servers. storage servers.
""" """
def upload_from_file_to_uri(filename=str, convergence=ChoiceOf(None, StringConstraint(2**20))): def upload_from_file_to_uri(filename=str,
convergence=ChoiceOf(None,
StringConstraint(2**20))):
"""Upload a file to the grid. This accepts a filename (which must be """Upload a file to the grid. This accepts a filename (which must be
absolute) that points to a file on the node's local disk. The node will absolute) that points to a file on the node's local disk. The node will
read the contents of this file, upload it to the grid, then return the read the contents of this file, upload it to the grid, then return the
@ -2237,10 +2243,11 @@ class RIStatsProvider(RemoteInterface):
def get_stats(): def get_stats():
""" """
returns a dictionary containing 'counters' and 'stats', each a dictionary returns a dictionary containing 'counters' and 'stats', each a
with string counter/stat name keys, and numeric values. counters are dictionary with string counter/stat name keys, and numeric values.
monotonically increasing measures of work done, and stats are instantaneous counters are monotonically increasing measures of work done, and
measures (potentially time averaged internally) stats are instantaneous measures (potentially time averaged
internally)
""" """
return DictOf(str, DictOf(str, ChoiceOf(float, int, long))) return DictOf(str, DictOf(str, ChoiceOf(float, int, long)))
@ -2285,8 +2292,9 @@ class FileTooLargeError(Exception):
class IValidatedThingProxy(Interface): class IValidatedThingProxy(Interface):
def start(): def start():
""" Acquire a thing and validate it. Return a deferred which is eventually fired with """ Acquire a thing and validate it. Return a deferred which is
self if the thing is valid or errbacked if it can't be acquired or validated. """ eventually fired with self if the thing is valid or errbacked if it
can't be acquired or validated."""
class InsufficientVersionError(Exception): class InsufficientVersionError(Exception):
def __init__(self, needed, got): def __init__(self, needed, got):