Improve irdest-core storage API
Currently the services
section of the irdest-core API has three main endpoints that services can use to store data.
save(UserAuth, Service, MetadataMap, TagSet)
delete(UserAuth, Service, Key(String))
query(UserAuth, Service, TagSet)
The MetadataMap
type is defined as follows:
pub struct MetadataMap {
name: String,
map: BTreeMap<String, Vec<u8>>,
}
The problem with this approach is that diff-operations need to be handled by the service, and this logic can not be re-used by other services.
The solution
-
Remove save
function endpoint -
Create an insert
function endpoint with the following properties- Each service has access to one store map (the
MetadataMap
may be re-usable) - Function API takes
(UserAuth, Service, Key, Value)
-
Key
is a(String, String)
tuple, that acts as (Namespace, Key) -
Value
is bound asV: Serialize
to be used by the service as it sees fit
- Each service has access to one store map (the
-
The delete
andquery
endpoints can be re-used, albeit their function APIs need to be adjusted.-
query
will now only return a single T, boundT: DeserializeOwned
.
-
Some future considerations to make the general storage subsystem in irdest-core simpler is to approach the alexandria API differently. Notes towards this should be tracked in #4 (closed).
Edited by Katharina Fey