from allmydata.util.assertutil import _assert
from allmydata import codec, hashtree, storage, uri
from allmydata.interfaces import IDownloadTarget, IDownloader, IFileURI, \
- IDownloadStatus, IDownloadResults
+ IDownloadStatus, IDownloadResults, NotEnoughSharesError
from allmydata.immutable import layout
-from allmydata.immutable.encode import NotEnoughSharesError
from pycryptopp.cipher.aes import AES
class HaveAllPeersError(Exception):
from allmydata.util.assertutil import _assert, precondition
from allmydata.codec import CRSEncoder
from allmydata.interfaces import IEncoder, IStorageBucketWriter, \
- IEncryptedUploadable, IUploadStatus
+ IEncryptedUploadable, IUploadStatus, NotEnoughSharesError
"""
The goal of the encoder is to turn the original file into a series of
"""
-class NotEnoughSharesError(Exception):
- servermap = None
- pass
-
class UploadAborted(Exception):
pass
from allmydata.util import base32, idlib, mathutil
from allmydata.util.assertutil import precondition
from allmydata.interfaces import IUploadable, IUploader, IUploadResults, \
- IEncryptedUploadable, RIEncryptedUploadable, IUploadStatus
+ IEncryptedUploadable, RIEncryptedUploadable, IUploadStatus, NotEnoughSharesError
from allmydata.immutable import layout
from pycryptopp.cipher.aes import AES
peers = client.get_permuted_peers("storage", storage_index)
if not peers:
- raise encode.NotEnoughSharesError("client gave us zero peers")
+ raise NotEnoughSharesError("client gave us zero peers")
# figure out how much space to ask for
if self.last_failure_msg:
msg += " (%s)" % (self.last_failure_msg,)
log.msg(msg, level=log.UNUSUAL, parent=self._log_parent)
- raise encode.NotEnoughSharesError(msg)
+ raise NotEnoughSharesError(msg)
else:
# we placed enough to be happy, so we're done
if self._status:
writer-visible data using this writekey.
"""
+class NotEnoughSharesError(Exception):
+ servermap = None
+
class ExistingChildError(Exception):
"""A directory node was asked to add or replace a child that already
exists, and overwrite= was set to False."""
from twisted.internet import defer, reactor
from foolscap.eventual import eventually
from allmydata.interfaces import IMutableFileNode, IMutableFileURI, \
- ICheckable, ICheckerResults
+ ICheckable, ICheckerResults, NotEnoughSharesError
from allmydata.util import hashutil, log
from allmydata.util.assertutil import precondition
from allmydata.uri import WriteableSSKFileURI
from allmydata.monitor import Monitor
-from allmydata.immutable.encode import NotEnoughSharesError
from pycryptopp.publickey import rsa
from pycryptopp.cipher.aes import AES
from twisted.python import failure
from foolscap import DeadReferenceError
from foolscap.eventual import eventually, fireEventually
-from allmydata.interfaces import IRetrieveStatus
+from allmydata.interfaces import IRetrieveStatus, NotEnoughSharesError
from allmydata.util import hashutil, idlib, log
from allmydata import hashtree, codec, storage
-from allmydata.immutable.encode import NotEnoughSharesError
from pycryptopp.cipher.aes import AES
from pycryptopp.publickey import rsa
from allmydata import uri, dirnode, client
from allmydata.introducer.server import IntroducerNode
from allmydata.interfaces import IURI, IMutableFileNode, IFileNode, \
- FileTooLargeError, ICheckable
-from allmydata.immutable.encode import NotEnoughSharesError
+ FileTooLargeError, NotEnoughSharesError, ICheckable
from allmydata.checker_results import CheckerResults, CheckAndRepairResults, \
DeepCheckResults, DeepCheckAndRepairResults
from allmydata.mutable.common import CorruptShareError
from allmydata.immutable import encode, upload, download
from allmydata.util import hashutil, testutil
from allmydata.util.assertutil import _assert
-from allmydata.interfaces import IStorageBucketWriter, IStorageBucketReader
+from allmydata.interfaces import IStorageBucketWriter, IStorageBucketReader, NotEnoughSharesError
class LostPeerError(Exception):
pass
d = self.send_and_recover((4,8,10), AVAILABLE_SHARES=2)
def _done(res):
self.failUnless(isinstance(res, Failure))
- self.failUnless(res.check(download.NotEnoughSharesError))
+ self.failUnless(res.check(NotEnoughSharesError))
d.addBoth(_done)
return d
d = self.send_and_recover((4,8,10), bucket_modes=modemap)
def _done(res):
self.failUnless(isinstance(res, Failure))
- self.failUnless(res.check(download.NotEnoughSharesError))
+ self.failUnless(res.check(NotEnoughSharesError))
d.addBoth(_done)
return d
d = self.send_and_recover((4,8,10), bucket_modes=modemap)
def _done(res):
self.failUnless(isinstance(res, Failure))
- self.failUnless(res.check(download.NotEnoughSharesError))
+ self.failUnless(res.check(NotEnoughSharesError))
d.addBoth(_done)
return d
d = self.send_and_recover((4,8,10), bucket_modes=modemap)
def _done(res):
self.failUnless(isinstance(res, Failure))
- self.failUnless(res.check(download.NotEnoughSharesError))
+ self.failUnless(res.check(NotEnoughSharesError))
d.addBoth(_done)
return d
d = self.send_and_recover((4,8,10), bucket_modes=modemap)
def _done(res):
self.failUnless(isinstance(res, Failure))
- self.failUnless(res.check(download.NotEnoughSharesError))
+ self.failUnless(res.check(NotEnoughSharesError))
d.addBoth(_done)
return d
d = self.send_and_recover((4,8,10), bucket_modes=modemap)
def _done(res):
self.failUnless(isinstance(res, Failure))
- self.failUnless(res.check(encode.NotEnoughSharesError), res)
+ self.failUnless(res.check(NotEnoughSharesError), res)
d.addBoth(_done)
return d
d = self.send_and_recover((4,8,10), bucket_modes=modemap)
def _done(res):
self.failUnless(isinstance(res, Failure))
- self.failUnless(res.check(encode.NotEnoughSharesError))
+ self.failUnless(res.check(NotEnoughSharesError))
d.addBoth(_done)
return d
-from allmydata.immutable import encode, upload
+from allmydata.immutable import upload
from allmydata.test.common import SystemTestMixin, ShareManglingMixin
from allmydata.util import testutil
from allmydata.monitor import Monitor
-from allmydata.interfaces import IURI
+from allmydata.interfaces import IURI, NotEnoughSharesError
from twisted.internet import defer
from twisted.trial import unittest
import random, struct
self.fail() # should have gotten an errback instead
return result
def _after_download_errb(failure):
- failure.trap(encode.NotEnoughSharesError)
+ failure.trap(NotEnoughSharesError)
return None # success!
d.addCallbacks(_after_download_callb, _after_download_errb)
d.addCallback(_then_download)
from twisted.python import failure
from allmydata import uri, storage
from allmydata.immutable import download
-from allmydata.immutable.encode import NotEnoughSharesError
from allmydata.util import base32, testutil, idlib
from allmydata.util.idlib import shortnodeid_b2a
from allmydata.util.hashutil import tagged_hash
from allmydata.util.fileutil import make_dirs
from allmydata.interfaces import IURI, IMutableFileURI, IUploadable, \
- FileTooLargeError, IRepairResults
+ FileTooLargeError, NotEnoughSharesError, IRepairResults
from allmydata.monitor import Monitor
from allmydata.test.common import ShouldFailMixin
from foolscap.eventual import eventually, fireEventually
from allmydata.scripts import runner
from allmydata.interfaces import IDirectoryNode, IFileNode, IFileURI, \
ICheckerResults, ICheckAndRepairResults, IDeepCheckResults, \
- IDeepCheckAndRepairResults, NoSuchChildError
+ IDeepCheckAndRepairResults, NoSuchChildError, NotEnoughSharesError
from allmydata.monitor import Monitor, OperationCancelledError
from allmydata.mutable.common import NotMutableError
from allmydata.mutable import layout as mutable_layout
log.msg("finished downloading non-existend URI",
level=log.UNUSUAL, facility="tahoe.tests")
self.failUnless(isinstance(res, Failure))
- self.failUnless(res.check(download.NotEnoughSharesError),
+ self.failUnless(res.check(NotEnoughSharesError),
"expected NotEnoughSharesError, got %s" % res)
# TODO: files that have zero peers should get a special kind
# of NotEnoughSharesError, which can be used to suggest that
from cStringIO import StringIO
from allmydata import uri
-from allmydata.immutable import upload, encode
-from allmydata.interfaces import IFileURI, FileTooLargeError
+from allmydata.immutable import upload
+from allmydata.interfaces import IFileURI, FileTooLargeError, NotEnoughSharesError
from allmydata.util.assertutil import precondition
from allmydata.util.deferredutil import DeferredListShouldSucceed
from allmydata.util.testutil import ShouldFailMixin
self.u.parent = self.node
def _should_fail(self, f):
- self.failUnless(isinstance(f, Failure) and f.check(encode.NotEnoughSharesError), f)
+ self.failUnless(isinstance(f, Failure) and f.check(NotEnoughSharesError), f)
def test_data_large(self):
data = DATA