matrix-org / matrix-org/matrix-rust-sdk
State store custom usage pattern enhancements
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
Our `StateStore` implementation have a very rough and rudimentary `custom` API to allow developers using the API to save data with it. However that is very low level and pretty limited for broader patterns - you can only `get` and `set` custom key-value pairs:
https://github.com/matrix-org/matrix-rust-sdk/blob/fb1a2f6d9491367a53cef7a76a1ecd8b525888db/crates/matrix-sdk-base/src/store/mod.rs#L309-L323
While a common pattern that we've worked out with our stores is to provide lists of keys- and values that are prefixed in a certain way. With these implementations using (if activated) encryption internally, this isn't really possible, nor is it possible to iterate over an unknown list of prefixed keys, limiting the usefulness of the store.
Aside from providing some handy methods allowing you to use `Serialize + Deserialize` for keys + values and have the store figure out the details, I propose we also add `[get|set]_prefixed_custom_value` functions that allow to specify an array of prefixes in front of the key to allow the prefix-pattern (with encrypted data) we've been grown accustomed to also to be used by developers building on top of our SDK.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with crates/matrix-sdk-base/src/store/mod.rs at the linked StateStore custom API around lines 309-323. Read how the existing get and set custom key-value operations are exposed, then define the scope of serialized keys and values and prefixed access. Done means the proposed broader custom usage patterns, including encrypted prefixed keys, are supported by the store API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100