forked from databendlabs/databend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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` ```
- Loading branch information
1 parent
b17e271
commit c7a53db
Showing
11 changed files
with
421 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.