mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-31 16:36:20 +00:00
move FileTooLargeError out to a common location
This commit is contained in:
parent
91565f465d
commit
5289064dcf
@ -1867,3 +1867,8 @@ class RIKeyGenerator(RemoteInterface):
|
||||
@return: tuple(verifying_key, signing_key)
|
||||
"""
|
||||
return TupleOf(str, str)
|
||||
|
||||
|
||||
class FileTooLargeError(Exception):
|
||||
pass
|
||||
|
||||
|
@ -9,7 +9,7 @@ from twisted.internet import defer
|
||||
from zope.interface import implements
|
||||
from allmydata.interfaces import RIStorageServer, RIBucketWriter, \
|
||||
RIBucketReader, IStorageBucketWriter, IStorageBucketReader, HASH_SIZE, \
|
||||
BadWriteEnablerError, IStatsProducer
|
||||
BadWriteEnablerError, IStatsProducer, FileTooLargeError
|
||||
from allmydata.util import base32, fileutil, idlib, mathutil, log
|
||||
from allmydata.util.assertutil import precondition, _assert
|
||||
import allmydata # for __version__
|
||||
@ -1071,9 +1071,6 @@ def allocated_size(data_size, num_segments, num_share_hashes,
|
||||
uri_extension_starts_at = wbp._offsets['uri_extension']
|
||||
return uri_extension_starts_at + 4 + uri_extension_size
|
||||
|
||||
class FileTooLargeError(Exception):
|
||||
pass
|
||||
|
||||
class WriteBucketProxy:
|
||||
implements(IStorageBucketWriter)
|
||||
def __init__(self, rref, data_size, segment_size, num_segments,
|
||||
|
@ -6,8 +6,8 @@ from twisted.python import log
|
||||
from twisted.internet import defer
|
||||
from cStringIO import StringIO
|
||||
|
||||
from allmydata import upload, encode, uri, storage
|
||||
from allmydata.interfaces import IFileURI
|
||||
from allmydata import upload, encode, uri
|
||||
from allmydata.interfaces import IFileURI, FileTooLargeError
|
||||
from allmydata.util.assertutil import precondition
|
||||
from allmydata.util.deferredutil import DeferredListShouldSucceed
|
||||
from allmydata.util.testutil import ShouldFailMixin
|
||||
@ -240,12 +240,12 @@ class GoodServer(unittest.TestCase, ShouldFailMixin):
|
||||
k = 3; happy = 7; n = 10
|
||||
self.set_encoding_parameters(k, happy, n)
|
||||
data1 = GiganticUploadable(k*4*1024*1024*1024)
|
||||
d = self.shouldFail(storage.FileTooLargeError, "test_too_large-data1",
|
||||
d = self.shouldFail(FileTooLargeError, "test_too_large-data1",
|
||||
"This file is too large to be uploaded (data_size)",
|
||||
self.u.upload, data1)
|
||||
data2 = GiganticUploadable(k*4*1024*1024*1024-3)
|
||||
d.addCallback(lambda res:
|
||||
self.shouldFail(storage.FileTooLargeError,
|
||||
self.shouldFail(FileTooLargeError,
|
||||
"test_too_large-data2",
|
||||
"This file is too large to be uploaded (offsets)",
|
||||
self.u.upload, data2))
|
||||
|
Loading…
x
Reference in New Issue
Block a user