mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-07 11:50:21 +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: tuple(verifying_key, signing_key)
|
||||||
"""
|
"""
|
||||||
return TupleOf(str, str)
|
return TupleOf(str, str)
|
||||||
|
|
||||||
|
|
||||||
|
class FileTooLargeError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from twisted.internet import defer
|
|||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
from allmydata.interfaces import RIStorageServer, RIBucketWriter, \
|
from allmydata.interfaces import RIStorageServer, RIBucketWriter, \
|
||||||
RIBucketReader, IStorageBucketWriter, IStorageBucketReader, HASH_SIZE, \
|
RIBucketReader, IStorageBucketWriter, IStorageBucketReader, HASH_SIZE, \
|
||||||
BadWriteEnablerError, IStatsProducer
|
BadWriteEnablerError, IStatsProducer, FileTooLargeError
|
||||||
from allmydata.util import base32, fileutil, idlib, mathutil, log
|
from allmydata.util import base32, fileutil, idlib, mathutil, log
|
||||||
from allmydata.util.assertutil import precondition, _assert
|
from allmydata.util.assertutil import precondition, _assert
|
||||||
import allmydata # for __version__
|
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']
|
uri_extension_starts_at = wbp._offsets['uri_extension']
|
||||||
return uri_extension_starts_at + 4 + uri_extension_size
|
return uri_extension_starts_at + 4 + uri_extension_size
|
||||||
|
|
||||||
class FileTooLargeError(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class WriteBucketProxy:
|
class WriteBucketProxy:
|
||||||
implements(IStorageBucketWriter)
|
implements(IStorageBucketWriter)
|
||||||
def __init__(self, rref, data_size, segment_size, num_segments,
|
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 twisted.internet import defer
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
||||||
from allmydata import upload, encode, uri, storage
|
from allmydata import upload, encode, uri
|
||||||
from allmydata.interfaces import IFileURI
|
from allmydata.interfaces import IFileURI, FileTooLargeError
|
||||||
from allmydata.util.assertutil import precondition
|
from allmydata.util.assertutil import precondition
|
||||||
from allmydata.util.deferredutil import DeferredListShouldSucceed
|
from allmydata.util.deferredutil import DeferredListShouldSucceed
|
||||||
from allmydata.util.testutil import ShouldFailMixin
|
from allmydata.util.testutil import ShouldFailMixin
|
||||||
@ -240,12 +240,12 @@ class GoodServer(unittest.TestCase, ShouldFailMixin):
|
|||||||
k = 3; happy = 7; n = 10
|
k = 3; happy = 7; n = 10
|
||||||
self.set_encoding_parameters(k, happy, n)
|
self.set_encoding_parameters(k, happy, n)
|
||||||
data1 = GiganticUploadable(k*4*1024*1024*1024)
|
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)",
|
"This file is too large to be uploaded (data_size)",
|
||||||
self.u.upload, data1)
|
self.u.upload, data1)
|
||||||
data2 = GiganticUploadable(k*4*1024*1024*1024-3)
|
data2 = GiganticUploadable(k*4*1024*1024*1024-3)
|
||||||
d.addCallback(lambda res:
|
d.addCallback(lambda res:
|
||||||
self.shouldFail(storage.FileTooLargeError,
|
self.shouldFail(FileTooLargeError,
|
||||||
"test_too_large-data2",
|
"test_too_large-data2",
|
||||||
"This file is too large to be uploaded (offsets)",
|
"This file is too large to be uploaded (offsets)",
|
||||||
self.u.upload, data2))
|
self.u.upload, data2))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user