Merge branch '4005-more-http-storage-logging' into 4009-more-logging
This commit is contained in:
commit
41032e1e83
@ -260,7 +260,7 @@ jobs:
|
|||||||
name: "Submit coverage results"
|
name: "Submit coverage results"
|
||||||
command: |
|
command: |
|
||||||
if [ -n "${UPLOAD_COVERAGE}" ]; then
|
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
|
fi
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
|
@ -9,7 +9,7 @@ BASIC_DEPS="pip wheel"
|
|||||||
|
|
||||||
# Python packages we need to support the test infrastructure. *Not* packages
|
# Python packages we need to support the test infrastructure. *Not* packages
|
||||||
# Tahoe-LAFS itself (implementation or test suite) need.
|
# 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.
|
# Python packages we need to generate test reports for CI infrastructure.
|
||||||
# *Not* packages Tahoe-LAFS itself (implement or test suite) need.
|
# *Not* packages Tahoe-LAFS itself (implement or test suite) need.
|
||||||
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -79,7 +79,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Python packages
|
- name: Install Python packages
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade codecov "tox<4" tox-gh-actions setuptools
|
pip install --upgrade "tox<4" tox-gh-actions setuptools
|
||||||
pip list
|
pip list
|
||||||
|
|
||||||
- name: Display tool versions
|
- name: Display tool versions
|
||||||
|
0
newsfragments/4010.minor
Normal file
0
newsfragments/4010.minor
Normal file
@ -4,7 +4,8 @@ HTTP client that talks to the HTTP storage server.
|
|||||||
|
|
||||||
from __future__ import annotations
|
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 base64 import b64encode
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from os import SEEK_END
|
from os import SEEK_END
|
||||||
@ -505,14 +506,14 @@ class StorageClientGeneral(object):
|
|||||||
url = self._client.relative_url("/storage/v1/version")
|
url = self._client.relative_url("/storage/v1/version")
|
||||||
response = await self._client.request("GET", url)
|
response = await self._client.request("GET", url)
|
||||||
decoded_response = cast(
|
decoded_response = cast(
|
||||||
dict[bytes, object],
|
Mapping[bytes, object],
|
||||||
await self._client.decode_cbor(response, _SCHEMAS["get_version"]),
|
await self._client.decode_cbor(response, _SCHEMAS["get_version"]),
|
||||||
)
|
)
|
||||||
# Add some features we know are true because the HTTP API
|
# Add some features we know are true because the HTTP API
|
||||||
# specification requires them and because other parts of the storage
|
# specification requires them and because other parts of the storage
|
||||||
# client implementation assumes they will be present.
|
# client implementation assumes they will be present.
|
||||||
cast(
|
cast(
|
||||||
dict[bytes, object],
|
Mapping[bytes, object],
|
||||||
decoded_response[b"http://allmydata.org/tahoe/protocols/storage/v1"],
|
decoded_response[b"http://allmydata.org/tahoe/protocols/storage/v1"],
|
||||||
).update(
|
).update(
|
||||||
{
|
{
|
||||||
@ -750,7 +751,7 @@ class StorageClientImmutables(object):
|
|||||||
message_to_serialize=message,
|
message_to_serialize=message,
|
||||||
)
|
)
|
||||||
decoded_response = cast(
|
decoded_response = cast(
|
||||||
dict[str, set[int]],
|
Mapping[str, Set[int]],
|
||||||
await self._client.decode_cbor(response, _SCHEMAS["allocate_buckets"]),
|
await self._client.decode_cbor(response, _SCHEMAS["allocate_buckets"]),
|
||||||
)
|
)
|
||||||
return ImmutableCreateResult(
|
return ImmutableCreateResult(
|
||||||
@ -832,7 +833,7 @@ class StorageClientImmutables(object):
|
|||||||
response.code,
|
response.code,
|
||||||
)
|
)
|
||||||
body = cast(
|
body = cast(
|
||||||
dict[str, list[dict[str, int]]],
|
Mapping[str, Sequence[Mapping[str, int]]],
|
||||||
await self._client.decode_cbor(
|
await self._client.decode_cbor(
|
||||||
response, _SCHEMAS["immutable_write_share_chunk"]
|
response, _SCHEMAS["immutable_write_share_chunk"]
|
||||||
),
|
),
|
||||||
@ -853,7 +854,7 @@ class StorageClientImmutables(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@async_to_deferred
|
@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.
|
Return the set of shares for a given storage index.
|
||||||
"""
|
"""
|
||||||
@ -866,7 +867,7 @@ class StorageClientImmutables(object):
|
|||||||
)
|
)
|
||||||
if response.code == http.OK:
|
if response.code == http.OK:
|
||||||
body = cast(
|
body = cast(
|
||||||
set[int],
|
Set[int],
|
||||||
await self._client.decode_cbor(response, _SCHEMAS["list_shares"]),
|
await self._client.decode_cbor(response, _SCHEMAS["list_shares"]),
|
||||||
)
|
)
|
||||||
return set(body)
|
return set(body)
|
||||||
@ -939,9 +940,10 @@ class ReadTestWriteResult:
|
|||||||
reads: Mapping[int, Sequence[bytes]]
|
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 = 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_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.
|
List the share numbers for a given storage index.
|
||||||
"""
|
"""
|
||||||
@ -1026,7 +1028,7 @@ class StorageClientMutables:
|
|||||||
response = await self._client.request("GET", url)
|
response = await self._client.request("GET", url)
|
||||||
if response.code == http.OK:
|
if response.code == http.OK:
|
||||||
return cast(
|
return cast(
|
||||||
set[int],
|
Set[int],
|
||||||
await self._client.decode_cbor(
|
await self._client.decode_cbor(
|
||||||
response, _SCHEMAS["mutable_list_shares"]
|
response, _SCHEMAS["mutable_list_shares"]
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user