Commit Graph

72 Commits

Author SHA1 Message Date
Itamar Turner-Trauring
77ae087c77 Remove a2b_l and b2a_l from public API, to ease likely future switch to stdlib
base64's implementation.
2020-07-13 16:12:53 -04:00
meejah
6eade15b4e put WeakKeyDictionary use back 2020-05-05 14:49:16 -06:00
meejah
4c3d0ea6cc use 'with open' for more file-opens 2020-05-04 21:59:15 -06:00
meejah
4928d62d66 use set instead of WeakKeyDictionary 2020-05-04 21:59:15 -06:00
meejah
4b0c730adf use 'with open' correctly 2020-05-04 21:59:15 -06:00
Jean-Paul Calderone
de8199d3b0 Improve the behavior of get_slot_leases when no shares exist 2019-08-15 11:08:04 -04:00
Jean-Paul Calderone
fce9657ce3 it doesn't matter if any writes happen, only if the test vectors pass 2019-08-14 13:03:58 -04:00
Jean-Paul Calderone
bba8af6be1 note in the docstring about mutable shares 2019-08-14 12:29:26 -04:00
Jean-Paul Calderone
b3741ed3b5 Factor all of the logic into a helper with a flag controlling leases 2019-08-14 12:28:05 -04:00
Jean-Paul Calderone
6d414b0794 docstrings 2019-08-14 11:54:03 -04:00
Jean-Paul Calderone
74cb121b49 Add a test for uncovered remove-not-present-share case
Also fix the implementation to not blow up if the bucket for such a share
never existed.
2019-08-14 11:44:12 -04:00
Jean-Paul Calderone
dcc8f93b4e Refactor remote_slot_testv_and_readv_and_writev into some bite-sized pieces 2019-08-14 09:18:24 -04:00
tpltnt
c8f11dc2d3 ported old-style classes to new-style 2019-05-26 08:28:18 +02:00
meejah
49ae2c5eb7 use @implementer instead of implements
Also, derive some more things from 'object'
2017-02-27 11:01:30 -07:00
Leif Ryge
335c2ed06a add "Available" column to welcome page (#648)
add get_available_space() to NativeStorageServer

It uses a new 'available-space' key in the server's v1 version dict, or falls
back to 'maximum-immutable-share-size' (which presently always has the same
value but could have a different meaning in the future).

This is a squash merge of 9773555bb87fab71145ad7a0e84785a4e92d11f7
2014-11-23 06:03:00 +00:00
Brian Warner
99479226ed hush current pyflakes warnings (list comprehensions)
closes #2245
2014-06-23 13:54:07 -07:00
Daira Hopwood
d5651a0d0e Rename 'constant_time_compare' to 'timing_safe_compare'. refs #2165
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2014-02-24 20:43:23 +00:00
david-sarah
3cb99364e6 Failing to load a crawler state pickle uses default values, but the exception clause to detect this failure is too narrow; it can also fail with EOFError or KeyError for example. 2012-07-02 18:18:47 +00:00
david-sarah
33e2d2962e Change the maximum mutable share size to 69105 TB, and add a maximum-mutable-share-size field to the version announcement. Includes a test. refs #1778 2012-06-22 15:43:54 +00:00
Brian Warner
bc21726dfd new introducer: signed extensible dictionary-based messages! refs #466
This introduces new client and server halves to the Introducer (renaming the
old one with a _V1 suffix). Both have fallbacks to accomodate talking to a
different version: the publishing client switches on whether the server's
.get_version() advertises V2 support, the server switches on which
subscription method was invoked by the subscribing client.

The V2 protocol sends a three-tuple of (serialized announcement dictionary,
signature, pubkey) for each announcement. The V2 server dispatches messages
to subscribers according to the service-name, and throws errors for invalid
signatures, but does not otherwise examine the messages. The V2 receiver's
subscription callback will receive a (serverid, ann_dict) pair. The
'serverid' will be equal to the pubkey if all of the following are true:

  the originating client is V2, and was told a privkey to use
  the announcement went through a V2 server
  the signature is valid

If not, 'serverid' will be equal to the tubid portion of the announced FURL,
as was the case for V1 receivers.

Servers will create a keypair if one does not exist yet, stored in
private/server.privkey .

The signed announcement dictionary puts the server FURL in a key named
"anonymous-storage-FURL", which anticipates upcoming Accounting-related
changes in the server advertisements. It also provides a key named
"permutation-seed-base32" to tell clients what permutation seed to use. This
is computed at startup, using tubid if there are existing shares, otherwise
the pubkey, to retain share-order compatibility for existing servers.
2012-03-13 18:24:32 -07:00
Zooko O'Whielacronx
32f80625c9 storage: more paranoid handling of bounds and palimpsests in mutable share files
* storage server ignores requests to extend shares by sending a new_length
* storage server fills exposed holes (created by sending a write vector whose offset begins after the end of the current data) with 0 to avoid "palimpsest" exposure of previous contents
* storage server zeroes out lease info at the old location when moving it to a new location
ref. #1528
2011-09-12 15:26:55 -07:00
Zooko O'Whielacronx
20e2910c61 immutable: prevent clients from reading past the end of share data, which would allow them to learn the cancellation secret
Declare explicitly that we prevent this problem in the server's version dict.
fixes #1528 (there are two patches that are each a sufficient fix to #1528 and this is one of them)
2011-09-12 15:24:58 -07:00
Zooko O'Whielacronx
5476f67dc1 storage: remove the storage server's "remote_cancel_lease" function
We're removing this function because it is currently unused, because it is dangerous, and because the bug described in #1528 leaks the cancellation secret, which allows anyone who knows a file's storage index to abuse this function to delete shares of that file.
fixes #1528 (there are two patches that are each a sufficient fix to #1528 and this is one of them)
2011-09-12 15:23:31 -07:00
Brian Warner
01b5124d0a improve the storage/mutable.py asserts even more 2011-09-01 09:05:43 -07:00
wilcoxjg
d2e5de3b69 storage/mutable.py: special characters in struct.foo arguments indicate standard as opposed to native sizes, we should be using these characters in these asserts 2011-09-01 01:41:44 -07:00
david-sarah
c2972e22cb src/allmydata/storage/server.py: use the filesystem of storage/shares/, rather than storage/, to calculate remaining space. fixes #1384 2011-07-18 19:27:52 -07:00
wilcoxjg
67ad0175cd server.py: get_latencies now reports percentiles _only_ if there are sufficient observations for the interpretation of the percentile to be unambiguous.
interfaces.py:  modified the return type of RIStatsProvider.get_stats to allow for None as a return value
NEWS.rst, stats.py: documentation of change to get_latencies
stats.rst: now documents percentile modification in get_latencies
test_storage.py:  test_latencies now expects None in output categories that contain too few samples for the associated percentile to be unambiguously reported.
fixes #1392
2011-05-27 05:01:35 -07:00
Zooko O'Whielacronx
123a1a3f04 storage: use fileutil's version of get_disk_stats() and get_available_space(), use mockery/fakery in tests, enable large share test on platforms with sparse files and if > 4 GiB of disk space is currently available 2010-09-10 08:36:29 -08:00
Zooko O'Whielacronx
0f94923f22 immutable: use PrefixingLogMixin to organize logging in Tahoe2PeerSelector and add more detailed messages about peer 2010-07-19 01:20:00 -07:00
Kevan Carstensen
6374f4307f storage/immutable.py: make remote_abort btell the storage server about aborted buckets. 2010-07-15 16:21:05 -07:00
david-sarah
e76092e16c Change relative imports to absolute 2010-02-26 01:14:33 -07:00
Brian Warner
731d15e56f hush pyflakes-0.4.0 warnings: remove trivial unused variables. For #900. 2010-01-14 14:15:29 -08:00
Brian Warner
1059db51f2 server.py: undo my bogus 'correction' of David-Sarah's comment fix
and move it to a better line
2009-11-30 21:46:07 -05:00
Brian Warner
91e7cb484b storage.py: update comment 2009-11-30 11:59:13 -08:00
david-sarah
ef002c935a storage server: detect disk space usage on Windows too (fixes #637) 2009-11-20 21:56:44 -08:00
Brian Warner
c9803d5217 switch all foolscap imports to use foolscap.api or foolscap.logging 2009-05-21 17:38:23 -07:00
Brian Warner
5e8c31c3b6 storage: use constant-time comparison for write-enablers and lease-secrets 2009-03-22 20:21:28 -07:00
Brian Warner
3b65607926 expirer: tolerate empty buckets, refactor bucketsize-counting code a bit, don't increment -mutable/-immutable counters unless we actually know the sharetype 2009-03-20 12:18:16 -07:00
Brian Warner
f0071c2571 expirer: clean up constructor args, add tahoe.cfg controls, use cutoff_date instead of date_cutoff 2009-03-18 18:00:09 -07:00
Brian Warner
8eaee28550 expirer: change setup, config options, in preparation for adding tahoe.cfg controls 2009-03-18 17:21:38 -07:00
Brian Warner
fffab0d724 expirer: track mutable-vs-immutable sharecounts and sizes, report them on the web status page for comparison 2009-03-18 13:25:04 -07:00
Brian Warner
24ab5ec26f expirer: add mode to expire only-mutable or only-immutable shares 2009-03-16 23:51:18 -07:00
Brian Warner
c7254c5f1d GC: add date-cutoff -based expiration, add proposed docs 2009-03-16 22:10:41 -07:00
Brian Warner
1ccd426a34 expirer: fix prediction math, thanks to Zandr for the catch 2009-03-09 13:42:17 -07:00
Brian Warner
8708045a98 storage.expirer: oops, fix upgrade-handler code 2009-03-08 20:55:16 -07:00
Brian Warner
df3f7f93e0 storage.expirer: handle upgrades better 2009-03-08 20:42:20 -07:00
Brian Warner
6d6049430c expirer: tolerate corrupt shares, add them to the state and history for future examination 2009-03-08 20:08:40 -07:00
Brian Warner
1a98521c3d storage/immutable: raise a specific error upon seeing a bad version number, instead of using assert. Also wrap to 80cols. 2009-03-08 20:07:32 -07:00
Brian Warner
6d7319c588 storage/mutable: raise a specific error upon seeing bad magic, instead of using assert 2009-03-08 19:02:01 -07:00
Brian Warner
5675b4e7e0 expirer: make web display a bit more consistent 2009-03-07 16:14:42 -07:00