add writer to set_dht_value, allow multiple open_dht_record

This commit is contained in:
Christien Rioux 2024-02-21 20:18:07 -05:00
parent fac9937cf4
commit 0c3271b3b9
19 changed files with 161 additions and 66 deletions

View file

@ -75,7 +75,7 @@ class RoutingContext(ABC):
@abstractmethod
async def set_dht_value(
self, key: types.TypedKey, subkey: types.ValueSubkey, data: bytes
self, key: types.TypedKey, subkey: types.ValueSubkey, data: bytes, writer: Optional[types.KeyPair]
) -> Optional[types.ValueData]:
pass

View file

@ -626,7 +626,7 @@ class _JsonRoutingContext(RoutingContext):
return None if ret is None else ValueData.from_json(ret)
async def set_dht_value(
self, key: TypedKey, subkey: ValueSubkey, data: bytes
self, key: TypedKey, subkey: ValueSubkey, data: bytes, writer: Optional[KeyPair]
) -> Optional[ValueData]:
ret = raise_api_result(
await self.api.send_ndjson_request(
@ -637,6 +637,7 @@ class _JsonRoutingContext(RoutingContext):
key=key,
subkey=subkey,
data=data,
writer=writer,
)
)
return None if ret is None else ValueData.from_json(ret)

View file

@ -451,6 +451,12 @@
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"writer": {
"type": [
"string",
"null"
]
}
}
},