mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-08 11:24:25 +00:00
Use sets more widely in the schema.
This commit is contained in:
parent
4b20b67ce6
commit
1634f137be
@ -350,6 +350,9 @@ Because of the simple types used throughout
|
||||
and the equivalence described in `RFC 7049`_
|
||||
these examples should be representative regardless of which of these two encodings is chosen.
|
||||
|
||||
For CBOR messages, any sequence that is semantically a set (i.e. no repeated values allowed, order doesn't matter, and is hashable in Python) should be sent as a set.
|
||||
Tag 6.258 is used to indicate sets in CBOR.
|
||||
|
||||
HTTP Design
|
||||
~~~~~~~~~~~
|
||||
|
||||
|
@ -39,8 +39,9 @@ class ClientException(Exception):
|
||||
|
||||
# Schemas for server responses.
|
||||
#
|
||||
# TODO usage of sets is inconsistent. Either use everywhere (and document in
|
||||
# spec document) or use nowhere.
|
||||
# Tags are of the form #6.nnn, where the number is documented at
|
||||
# https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml. Notably, #6.258
|
||||
# indicates a set.
|
||||
_SCHEMAS = {
|
||||
"get_version": Schema(
|
||||
"""
|
||||
@ -74,7 +75,7 @@ _SCHEMAS = {
|
||||
),
|
||||
"list_shares": Schema(
|
||||
"""
|
||||
message = [* uint]
|
||||
message = #6.258([* uint])
|
||||
"""
|
||||
),
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ class HTTPServer(object):
|
||||
"""
|
||||
List shares for the given storage index.
|
||||
"""
|
||||
share_numbers = list(self._storage_server.get_buckets(storage_index).keys())
|
||||
share_numbers = set(self._storage_server.get_buckets(storage_index).keys())
|
||||
return self._send_encoded(request, share_numbers)
|
||||
|
||||
@_authorized_route(
|
||||
|
Loading…
x
Reference in New Issue
Block a user