From ea1d2486115b848ec5a8409eae328792e5d2a338 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Tue, 4 Oct 2022 10:51:43 -0400 Subject: [PATCH] These objects get stored in a context where they need to be hashed, sometimes. --- src/allmydata/storage/http_client.py | 11 +++++------ src/allmydata/storage_client.py | 5 ++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/allmydata/storage/http_client.py b/src/allmydata/storage/http_client.py index 16d426dda..1fe9a99fd 100644 --- a/src/allmydata/storage/http_client.py +++ b/src/allmydata/storage/http_client.py @@ -276,7 +276,7 @@ class _StorageClientHTTPSPolicy: ) -@define +@define(hash=True) class StorageClient(object): """ Low-level HTTP client that talks to the HTTP storage server. @@ -286,7 +286,7 @@ class StorageClient(object): # ``StorageClient.from_nurl()``. _base_url: DecodedURL _swissnum: bytes - _treq: Union[treq, StubTreq, HTTPClient] + _treq: Union[treq, StubTreq, HTTPClient] = field(eq=False) @classmethod def from_nurl( @@ -379,13 +379,12 @@ class StorageClient(object): return self._treq.request(method, url, headers=headers, **kwargs) +@define(hash=True) class StorageClientGeneral(object): """ High-level HTTP APIs that aren't immutable- or mutable-specific. """ - - def __init__(self, client): # type: (StorageClient) -> None - self._client = client + _client : StorageClient @inlineCallbacks def get_version(self): @@ -534,7 +533,7 @@ async def advise_corrupt_share( ) -@define +@define(hash=True) class StorageClientImmutables(object): """ APIs for interacting with immutables. diff --git a/src/allmydata/storage_client.py b/src/allmydata/storage_client.py index a7d5edb11..3b08f0b25 100644 --- a/src/allmydata/storage_client.py +++ b/src/allmydata/storage_client.py @@ -1187,7 +1187,7 @@ class _StorageServer(object): -@attr.s +@attr.s(hash=True) class _FakeRemoteReference(object): """ Emulate a Foolscap RemoteReference, calling a local object instead. @@ -1203,7 +1203,6 @@ class _FakeRemoteReference(object): raise RemoteException(e.args) -@attr.s class _HTTPBucketWriter(object): """ Emulate a ``RIBucketWriter``, but use HTTP protocol underneath. @@ -1234,7 +1233,7 @@ class _HTTPBucketWriter(object): -@attr.s +@attr.s(hash=True) class _HTTPBucketReader(object): """ Emulate a ``RIBucketReader``, but use HTTP protocol underneath.