Introduce KeySpace interface for API v2.#353
Introduce KeySpace interface for API v2.#353iosmanthus wants to merge 46 commits intotikv:masterfrom
Conversation
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
|
|
||
| async fn invalidate_region_cache(&self, ver_id: RegionVerId); | ||
|
|
||
| fn get_request_codec(&self) -> Self::RequestCodec; |
There was a problem hiding this comment.
Maybe it should return reference to Self::RequestCodec?
There was a problem hiding this comment.
Since the only use of RequestCodec is in the construction of Dispatch, and it requires a move, I think Self::RequestCodec is more direct.
There was a problem hiding this comment.
I see. Then we can probably rename it to create_request_codec or new_request_codec which means it's actually a factory method. It's not going to be called many times, and move is the right semantic.
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
examples/pessimistic.rs
Outdated
|
|
||
| // init | ||
| let client = Client::new_with_config(args.pd, config, None) | ||
| let client = Client::new_with_config(args.pd, config, TxnApiV1, None) |
There was a problem hiding this comment.
Client itself can tell we are using TxnKV already, can we hide things like TxnApiV1, TxnApiV2, RawApiV1, RawApiV2. Just let user chose the appropriate client and use ApiV1 or ApiV2.
There was a problem hiding this comment.
We may reexport them in their own module, like: raw::ApiV1 , txn::ApiV1
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
src/lib.rs
Outdated
| //! let client = RawClient::new(vec!["127.0.0.1:2379"], None).await?; | ||
| //! # use tikv_client::request::request_codec::RawApiV1; | ||
| //! futures::executor::block_on(async { | ||
| //! let client = RawClient::new(vec!["127.0.0.1:2379"], RawApiV1, None).await?; |
There was a problem hiding this comment.
This might break the original API, we should add a default implementation for API V1.
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
src/request/mod.rs
Outdated
| } | ||
|
|
||
| #[macro_export] | ||
| macro_rules! impl_kv_request_for_scan_op { |
There was a problem hiding this comment.
These macro rules have the same patterns which are to take some field out and then encode or decode it. We should extract them into one rule.
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
| } | ||
| } | ||
|
|
||
| impl KeySpaceId { |
There was a problem hiding this comment.
@sunxiaoguang PTAL. This is the logic for constructing keyspace from the name.
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
|
I am very excited for this! |
Signed-off-by: iosmanthus myosmanthustree@gmail.com
This pull request is still working in progress, and the interfaces for request encoding are stable. However, lots of the request structs need to implement with these interfaces.
The core interfaces to encode the request are:
When the
Cis bound toRequestCodec, the requests are able to be encoded:TODO: