From: Brian Warner Date: Fri, 12 Jan 2007 03:57:14 +0000 (-0700) Subject: change IEncoder to ICodecEncoder, to match the previous change X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~376 X-Git-Url: https://git.rkrishnan.org/pf/content/simplejson/frontends/FTP-and-SFTP.rst?a=commitdiff_plain;h=e29032bc3634cb2eacb896135d62ed2a23eed7be;p=tahoe-lafs%2Ftahoe-lafs.git change IEncoder to ICodecEncoder, to match the previous change --- diff --git a/src/allmydata/codec.py b/src/allmydata/codec.py index d337689c..e8d99f18 100644 --- a/src/allmydata/codec.py +++ b/src/allmydata/codec.py @@ -4,14 +4,14 @@ from zope.interface import implements from twisted.internet import defer import sha from allmydata.util import idlib, mathutil -from allmydata.interfaces import IEncoder, IDecoder +from allmydata.interfaces import ICodecEncoder, ICodecDecoder from allmydata.py_ecc import rs_code def netstring(s): return "%d:%s," % (len(s), s) class ReplicatingEncoder(object): - implements(IEncoder) + implements(ICodecEncoder) ENCODER_TYPE = 0 def set_params(self, data_size, required_shares, total_shares): @@ -33,7 +33,7 @@ class ReplicatingEncoder(object): return defer.succeed(shares) class ReplicatingDecoder(object): - implements(IDecoder) + implements(ICodecDecoder) def set_serialized_params(self, params): self.required_shares = int(params) @@ -89,6 +89,7 @@ class Decoder(object): class PyRSEncoder(object): + implements(ICodecEncoder) ENCODER_TYPE = 1 # we will break the data into vectors in which each element is a single @@ -163,6 +164,7 @@ class PyRSEncoder(object): return defer.succeed(shares) class PyRSDecoder(object): + implements(ICodecDecoder) def set_serialized_params(self, params): pieces = params.split(":") diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py index 2bea869f..b9d35ed3 100644 --- a/src/allmydata/interfaces.py +++ b/src/allmydata/interfaces.py @@ -71,7 +71,7 @@ class RIMutableDirectoryNode(RemoteInterface): # need more to move directories -class IEncoder(Interface): +class ICodecEncoder(Interface): def set_params(data_size, required_shares, total_shares): """Set up the parameters of this encoder. @@ -123,7 +123,7 @@ class IEncoder(Interface): total_shares * get_share_size(). """ -class IDecoder(Interface): +class ICodecDecoder(Interface): def set_serialized_params(params): """Set up the parameters of this encoder, from a string returned by encoder.get_serialized_params().""" @@ -132,16 +132,16 @@ class IDecoder(Interface): """Decode a partial list of shares into data. 'some_shares' must be a list of (sharenum, share) tuples, a subset of - the shares returned by IEncoder.encode(). Each share must be of the - same length. The share tuples may appear in any order, but of course - each tuple must have a sharenum that correctly matches the associated - share data string. + the shares returned by ICodecEncode.encode(). Each share must be of + the same length. The share tuples may appear in any order, but of + course each tuple must have a sharenum that correctly matches the + associated share data string. This returns a Deferred which fires with a string. This string will always have a length equal to the 'data_size' value passed into the - original IEncoder.set_params() call. + original ICodecEncode.set_params() call. The length of 'some_shares' must be equal or greater than the value - of 'required_shares' passed into the original IEncoder.set_params() - call. + of 'required_shares' passed into the original + ICodecEncode.set_params() call. """