mirror of https://github.com/tikv/client-rust.git
Merge branch 'master' into handle-pd-get-member-with-err
This commit is contained in:
commit
9eb216774a
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct AutoIdRequest {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
/// The message save the metadata of a backup.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Header {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Status {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
/// \[start, end)
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct WaitForEntriesRequest {}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct GetRequest {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct SearchLogRequest {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct S3LockResult {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
pub enum DiskUsage {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
/// General encryption metadata for any data type.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CommandRequestHeader {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
/// The entry is a type of change that needs to be applied. It contains two data fields.
|
||||
/// While the fields are built into the model; their usage is determined by the entry_type.
|
||||
///
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
/// NotLeader is the error variant that tells a request be handle by raft leader
|
||||
/// is sent to raft follower or learner.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct RequestHeader {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
/// Defines the HTTP configuration for an API service. It contains a list of
|
||||
/// \[HttpRule\]\[google.api.HttpRule\], each specifying the mapping of an RPC method
|
||||
/// to one or more HTTP REST API methods.
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct SwitchModeRequest {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct SuspendImportRpcRequest {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct KeyspaceMeta {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
/// A transactional get command. Lookup a value for `key` in the transaction with
|
||||
/// starting timestamp = `version`.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
/// The minimal information for identify a region.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Error {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Cluster {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
pub mod autoid {
|
||||
include!("autoid.rs");
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
/// TaskMeta contains meta of a mpp plan, including query's ts and task address.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct WatchGlobalConfigRequest {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct GetRequest {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct RaftMessage {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
/// request to read region meata from a store
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
/// The replication status sync from PD to TiKV.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct ListResourceGroupsRequest {}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct ResourceMeteringRequest {}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct RequestHeader {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct BatchCommandsRequest {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct TraceRecordRequest {}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// This file is @generated by prost-build.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct RequestHeader {
|
||||
|
|
|
@ -49,7 +49,7 @@ impl Cluster {
|
|||
timeout: Duration,
|
||||
) -> Result<pdpb::GetRegionResponse> {
|
||||
let mut req = pd_request!(self.id, pdpb::GetRegionRequest);
|
||||
req.region_key = key.clone();
|
||||
req.region_key = key;
|
||||
req.send(&mut self.client, timeout).await
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ impl Cluster {
|
|||
timeout: Duration,
|
||||
) -> Result<keyspacepb::KeyspaceMeta> {
|
||||
let mut req = pd_request!(self.id, keyspacepb::LoadKeyspaceRequest);
|
||||
req.name = keyspace.to_owned();
|
||||
req.name = keyspace.to_string();
|
||||
let resp = req.send(&mut self.keyspace_client, timeout).await?;
|
||||
let keyspace = resp
|
||||
.keyspace
|
||||
|
|
|
@ -472,7 +472,7 @@ impl Shardable for RawCoprocessorRequest {
|
|||
|
||||
fn apply_shard(&mut self, shard: Self::Shard, store: &RegionStore) -> Result<()> {
|
||||
self.set_leader(&store.region_with_leader)?;
|
||||
self.inner.ranges = shard.clone();
|
||||
self.inner.ranges.clone_from(&shard);
|
||||
self.inner.data = (self.data_builder)(store.region_with_leader.region.clone(), shard);
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -575,10 +575,10 @@ mod test {
|
|||
});
|
||||
assert!(!is_valid_tikv_store(&store));
|
||||
|
||||
store.labels[1].value = "tiflash_compute".to_owned();
|
||||
store.labels[1].value = "tiflash_compute".to_string();
|
||||
assert!(!is_valid_tikv_store(&store));
|
||||
|
||||
store.labels[1].value = "other".to_owned();
|
||||
store.labels[1].value = "other".to_string();
|
||||
assert!(is_valid_tikv_store(&store));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ use std::cmp::max;
|
|||
use std::cmp::min;
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use derive_new::new;
|
||||
use futures::prelude::*;
|
||||
use futures::stream::BoxStream;
|
||||
|
@ -38,21 +37,6 @@ pub struct Store {
|
|||
pub client: Arc<dyn KvClient + Send + Sync>,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
pub trait KvConnectStore: KvConnect {
|
||||
async fn connect_to_store(
|
||||
&self,
|
||||
region: RegionWithLeader,
|
||||
address: String,
|
||||
) -> Result<RegionStore> {
|
||||
log::info!("connect to tikv endpoint: {:?}", &address);
|
||||
let client = self.connect(address.as_str()).await?;
|
||||
Ok(RegionStore::new(region, Arc::new(client)))
|
||||
}
|
||||
}
|
||||
|
||||
impl KvConnectStore for TikvConnect {}
|
||||
|
||||
/// Maps keys to a stream of stores. `key_data` must be sorted in increasing order
|
||||
pub fn store_stream_for_keys<K, KOut, PdC>(
|
||||
key_data: impl Iterator<Item = K> + Send + Sync + 'static,
|
||||
|
|
|
@ -358,13 +358,13 @@ impl BufferEntry {
|
|||
BufferEntry::Cached(_) => return None,
|
||||
BufferEntry::Put(v) => {
|
||||
pb.op = kvrpcpb::Op::Put.into();
|
||||
pb.value = v.clone();
|
||||
pb.value.clone_from(v);
|
||||
}
|
||||
BufferEntry::Del => pb.op = kvrpcpb::Op::Del.into(),
|
||||
BufferEntry::Locked(_) => pb.op = kvrpcpb::Op::Lock.into(),
|
||||
BufferEntry::Insert(v) => {
|
||||
pb.op = kvrpcpb::Op::Insert.into();
|
||||
pb.value = v.clone();
|
||||
pb.value.clone_from(v);
|
||||
}
|
||||
BufferEntry::CheckNotExist => pb.op = kvrpcpb::Op::CheckNotExists.into(),
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue