mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-30 17:56:58 +00:00
3209fd5e09
Added metadata to the bucket store, which is used to hold the share number (but the bucket doesn't know that, it just gets a string). Modified the codec interfaces a bit. Try to pass around URIs to/from download/upload instead of verifierids. URI format is still in flux. Change the current (primitive) file encoder to use a ReplicatingEncoder because it provides ICodecEncoder. We will be moving to the (less primitive) file encoder (currently in allmydata.encode_new) eventually, but for now this change lets us test out PyRS or zooko's upcoming C-based RS codec in something larger than a single unit test. This primitive file encoder only uses a single segment, and has no merkle trees. Also added allmydata.util.deferredutil for a DeferredList wrapper that errbacks (but only when all component Deferreds have fired) if there were any errors, which unfortunately is not a behavior available from the standard DeferredList.
18 lines
544 B
Python
18 lines
544 B
Python
|
|
from twisted.internet import defer
|
|
|
|
# utility wrapper for DeferredList
|
|
def _check_deferred_list(results):
|
|
# if any of the component Deferreds failed, return the first failure such
|
|
# that an addErrback() would fire. If all were ok, return a list of the
|
|
# results (without the success/failure booleans)
|
|
for success,f in results:
|
|
if not success:
|
|
return f
|
|
return [r[1] for r in results]
|
|
def DeferredListShouldSucceed(dl):
|
|
d = defer.DeferredList(dl)
|
|
d.addCallback(_check_deferred_list)
|
|
return d
|
|
|