You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refactor: simplify MapApi
- Add trait `MapKey` and `MapValue` to define behavior of key values
that are used in `MapApi`.
- Add Ref and RefMut as container of reference to leveled data.
- Collect get() and range() implementation into function.
The MapApi trait can not be generalized to adapt arbitrary lifetime,
such as using `self` instead of `&self`: `MapApiRO { fn get(self, key) }`.
Because there is a known limitation with rust GAT and hihger ranked
lifetime: See: rust-lang/rust#114046
```
error: implementation of `MapApiRO` is not general enough
--> src/meta/raft-store/src/sm_v002/sm_v002.rs:80:74
|
80 | async fn get_kv(&self, key: &str) -> Result<GetKVReply, Self::Error> {
| __________________________________________________________________________^
81 | | let got = self.sm.get_kv(key).await;
82 | |
83 | | let local_now_ms = SeqV::<()>::now_ms();
84 | | let got = Self::non_expired(got, local_now_ms);
85 | | Ok(got)
86 | | }
| |_____^ implementation of `MapApiRO` is not general enough
|
= note: `MapApiRO<'1, std::string::String>` would have to be implemented for the type `&'0 LevelData`, for any two lifetimes `'0` and `'1`...
= note: ...but `MapApiRO<'2, std::string::String>` is actually implemented for the type `&'2 LevelData`, for some specific lifetime `'2`
```
* refactor: move Ref and RefMut to separate files
* refactor: rename is_not_found() to not_found()
As @ariesdevil kindly suggested.
* refactor: simplify map api names: LevelData to Level
* chore: fix clippy
0 commit comments