Merge branch '4005-more-http-storage-logging' into 4009-more-logging

This commit is contained in:
Itamar Turner-Trauring 2023-04-13 13:21:34 -04:00
commit 41032e1e83
5 changed files with 16 additions and 14 deletions

View File

@ -260,7 +260,7 @@ jobs:
name: "Submit coverage results"
command: |
if [ -n "${UPLOAD_COVERAGE}" ]; then
/tmp/venv/bin/codecov
echo "TODO: Need a new coverage solution, see https://tahoe-lafs.org/trac/tahoe-lafs/ticket/4011"
fi
docker:

View File

@ -9,7 +9,7 @@ BASIC_DEPS="pip wheel"
# Python packages we need to support the test infrastructure. *Not* packages
# Tahoe-LAFS itself (implementation or test suite) need.
TEST_DEPS="tox~=3.0 codecov"
TEST_DEPS="tox~=3.0"
# Python packages we need to generate test reports for CI infrastructure.
# *Not* packages Tahoe-LAFS itself (implement or test suite) need.

View File

@ -79,7 +79,7 @@ jobs:
- name: Install Python packages
run: |
pip install --upgrade codecov "tox<4" tox-gh-actions setuptools
pip install --upgrade "tox<4" tox-gh-actions setuptools
pip list
- name: Display tool versions

0
newsfragments/4010.minor Normal file
View File

View File

@ -4,7 +4,8 @@ HTTP client that talks to the HTTP storage server.
from __future__ import annotations
from typing import Union, Optional, Sequence, Mapping, BinaryIO, cast, TypedDict
from typing import Union, Optional, Sequence, Mapping, BinaryIO, cast, TypedDict, Set
from base64 import b64encode
from io import BytesIO
from os import SEEK_END
@ -505,14 +506,14 @@ class StorageClientGeneral(object):
url = self._client.relative_url("/storage/v1/version")
response = await self._client.request("GET", url)
decoded_response = cast(
dict[bytes, object],
Mapping[bytes, object],
await self._client.decode_cbor(response, _SCHEMAS["get_version"]),
)
# Add some features we know are true because the HTTP API
# specification requires them and because other parts of the storage
# client implementation assumes they will be present.
cast(
dict[bytes, object],
Mapping[bytes, object],
decoded_response[b"http://allmydata.org/tahoe/protocols/storage/v1"],
).update(
{
@ -750,7 +751,7 @@ class StorageClientImmutables(object):
message_to_serialize=message,
)
decoded_response = cast(
dict[str, set[int]],
Mapping[str, Set[int]],
await self._client.decode_cbor(response, _SCHEMAS["allocate_buckets"]),
)
return ImmutableCreateResult(
@ -832,7 +833,7 @@ class StorageClientImmutables(object):
response.code,
)
body = cast(
dict[str, list[dict[str, int]]],
Mapping[str, Sequence[Mapping[str, int]]],
await self._client.decode_cbor(
response, _SCHEMAS["immutable_write_share_chunk"]
),
@ -853,7 +854,7 @@ class StorageClientImmutables(object):
)
@async_to_deferred
async def list_shares(self, storage_index: bytes) -> set[int]:
async def list_shares(self, storage_index: bytes) -> Set[int]:
"""
Return the set of shares for a given storage index.
"""
@ -866,7 +867,7 @@ class StorageClientImmutables(object):
)
if response.code == http.OK:
body = cast(
set[int],
Set[int],
await self._client.decode_cbor(response, _SCHEMAS["list_shares"]),
)
return set(body)
@ -939,9 +940,10 @@ class ReadTestWriteResult:
reads: Mapping[int, Sequence[bytes]]
# Result type for mutable read/test/write HTTP response.
# Result type for mutable read/test/write HTTP response. Can't just use
# dict[int,list[bytes]] because on Python 3.8 that will error out.
MUTABLE_RTW = TypedDict(
"MUTABLE_RTW", {"success": bool, "data": dict[int, list[bytes]]}
"MUTABLE_RTW", {"success": bool, "data": Mapping[int, Sequence[bytes]]}
)
@ -1016,7 +1018,7 @@ class StorageClientMutables:
)
@async_to_deferred
async def list_shares(self, storage_index: bytes) -> set[int]:
async def list_shares(self, storage_index: bytes) -> Set[int]:
"""
List the share numbers for a given storage index.
"""
@ -1026,7 +1028,7 @@ class StorageClientMutables:
response = await self._client.request("GET", url)
if response.code == http.OK:
return cast(
set[int],
Set[int],
await self._client.decode_cbor(
response, _SCHEMAS["mutable_list_shares"]
),