Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/client/client/src/client_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl<RT: SpawnApi> ClientHandle<RT> {
pub async fn streamed_get_many(
&self,
req: StreamedGetMany,
) -> Result<databend_meta_kvapi::kvapi::KVStream<MetaError>, MetaClientError> {
) -> Result<databend_meta_kvapi::KVStream<MetaError>, MetaClientError> {
self.request(req).await
}

Expand Down
2 changes: 1 addition & 1 deletion crates/client/client/src/grpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ impl<RT: RuntimeApi> MetaGrpcClient<RT> {
futures_util::stream::BoxStream<'static, Result<pb::StreamItem, MetaError>>,
MetaClientError,
> {
use databend_meta_kvapi::kvapi::fail_fast;
use databend_meta_kvapi::fail_fast;

let mut keys = req.keys;
let input_err: Arc<Mutex<Option<MetaError>>> = Arc::new(Mutex::new(None));
Expand Down
10 changes: 5 additions & 5 deletions crates/client/client/src/kvapi_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
// limitations under the License.

use async_trait::async_trait;
use databend_meta_kvapi::kvapi;
use databend_meta_kvapi::kvapi::KVStream;
use databend_meta_kvapi::kvapi::ListOptions;
use databend_meta_kvapi::kvapi::fail_fast;
use databend_meta_kvapi::kvapi::limit_stream;
use databend_meta_kvapi as kvapi;
use databend_meta_kvapi::KVStream;
use databend_meta_kvapi::ListOptions;
use databend_meta_kvapi::fail_fast;
use databend_meta_kvapi::limit_stream;
use databend_meta_runtime_api::SpawnApi;
use databend_meta_types::MetaError;
use databend_meta_types::MetaNetworkError;
Expand Down
2 changes: 1 addition & 1 deletion crates/client/client/tests/it/grpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use databend_meta_client::MetaChannelManager;
use databend_meta_client::MetaGrpcClient;
use databend_meta_client::Streamed;
use databend_meta_client::handshake;
use databend_meta_kvapi::kvapi::KvApiExt;
use databend_meta_kvapi::KvApiExt;
use databend_meta_runtime_api::SpawnApi;
use databend_meta_runtime_api::TokioRuntime;
use databend_meta_types::MetaError;
Expand Down
8 changes: 4 additions & 4 deletions crates/client/kvapi-test-suite/src/kvapi_test_suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
use std::time::Duration;
use std::time::SystemTime;

use databend_meta_kvapi::kvapi;
use databend_meta_kvapi::kvapi::KvApiExt;
use databend_meta_kvapi::kvapi::ListOptions;
use databend_meta_kvapi as kvapi;
use databend_meta_kvapi::KvApiExt;
use databend_meta_kvapi::ListOptions;
use databend_meta_types::ConditionResult;
use databend_meta_types::MatchSeq;
use databend_meta_types::MetaSpec;
Expand Down Expand Up @@ -507,7 +507,7 @@ impl TestSuite {
&self,
kv: &KV,
) -> anyhow::Result<()> {
use databend_meta_kvapi::kvapi::KVStream;
use databend_meta_kvapi::KVStream;
use databend_meta_types::errors::IncompleteStream;
use futures_util::StreamExt;

Expand Down
2 changes: 1 addition & 1 deletion crates/client/kvapi-tests/tests/it/metasrv_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::sync::Mutex;

use async_trait::async_trait;
use databend_meta_client::ClientHandle;
use databend_meta_kvapi::kvapi;
use databend_meta_kvapi as kvapi;
use databend_meta_runtime_api::TokioRuntime;
use databend_meta_test_harness::MetaSrvTestContext;
use databend_meta_test_harness::make_grpc_client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use futures_util::Stream;
use futures_util::StreamExt;
use futures_util::stream::BoxStream;

use crate::kvapi;
use crate::kvapi::ListOptions;
use crate as kvapi;
use crate::ListOptions;

/// Build an API impl instance or a cluster of API impl
#[async_trait]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::kvapi;
use crate::kvapi::Key;
use crate::kvapi::KeyCodec;
use crate::kvapi::KeyError;
use crate as kvapi;
use crate::Key;
use crate::KeyCodec;
use crate::KeyError;

/// The dir name of a key.
///
Expand Down Expand Up @@ -96,9 +96,9 @@ impl<K: Key> Key for DirName<K> {
#[cfg(test)]
mod tests {

use crate::kvapi::Key;
use crate::kvapi::dir_name::DirName;
use crate::kvapi::testing::FooKey;
use crate::Key;
use crate::dir_name::DirName;
use crate::testing::FooKey;

#[test]
fn test_dir_name_from_key() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use std::string::FromUtf8Error;

use crate::kvapi::KeyError;
use crate::KeyError;

/// Function that escapes special characters in a string.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use databend_meta_types::SeqV;

use crate::kvapi::Key;
use crate::Key;

/// Key-Value item contains key and optional value with seq number.
#[derive(Clone, Debug, PartialEq, Eq)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
use std::fmt::Debug;
use std::string::FromUtf8Error;

use crate::kvapi;
use crate::kvapi::key_codec::KeyCodec;
use crate as kvapi;
use crate::key_codec::KeyCodec;

#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum KeyError {
Expand Down Expand Up @@ -80,9 +80,9 @@ where Self: Sized
#[cfg(test)]
mod tests {

use crate::kvapi::DirName;
use crate::kvapi::Key;
use crate::kvapi::testing::FooKey;
use crate::DirName;
use crate::Key;
use crate::testing::FooKey;

#[test]
fn test_with_key_space() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

//! A helper for building a string key from a structured key

use crate::kvapi::helper::escape;
use crate::kvapi::helper::escape_specified;
use crate::helper::escape;
use crate::helper::escape_specified;

pub struct KeyBuilder {
buf: Vec<u8>,
Expand Down Expand Up @@ -67,7 +67,7 @@ impl KeyBuilder {

#[cfg(test)]
mod tests {
use crate::kvapi::key_builder::KeyBuilder;
use crate::key_builder::KeyBuilder;

#[test]
fn test_key_builder() -> anyhow::Result<()> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::kvapi;
use crate::kvapi::KeyError;
use crate as kvapi;
use crate::KeyError;

/// Encode or decode part of a meta-service key.
pub trait KeyCodec {
Expand All @@ -26,10 +26,10 @@ pub trait KeyCodec {
}

mod impls {
use crate::kvapi::KeyBuilder;
use crate::kvapi::KeyCodec;
use crate::kvapi::KeyError;
use crate::kvapi::KeyParser;
use crate::KeyBuilder;
use crate::KeyCodec;
use crate::KeyError;
use crate::KeyParser;

impl KeyCodec for String {
fn encode_key(&self, b: KeyBuilder) -> KeyBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ use std::string::FromUtf8Error;

use databend_base::non_empty::NonEmptyString;

use crate::kvapi::KeyError;
use crate::kvapi::helper::decode_id;
use crate::kvapi::helper::unescape;
use crate::kvapi::helper::unescape_specified;
use crate::KeyError;
use crate::helper::decode_id;
use crate::helper::unescape;
use crate::helper::unescape_specified;

/// A helper for parsing a string key into structured key.
pub struct KeyParser<'s> {
Expand Down Expand Up @@ -179,8 +179,8 @@ impl<'s> KeyParser<'s> {

#[cfg(test)]
mod tests {
use crate::kvapi::KeyError;
use crate::kvapi::key_parser::KeyParser;
use crate::KeyError;
use crate::key_parser::KeyParser;

#[test]
fn test_key_parser_new_prefixed() -> anyhow::Result<()> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ use futures_util::StreamExt;
use futures_util::TryStreamExt;
use log::debug;

use crate::kvapi::KVApi;
use crate::kvapi::KVStream;
use crate::kvapi::ListOptions;
use crate::KVApi;
use crate::KVStream;
use crate::ListOptions;

/// Extend the `KVApi` trait with auto implemented handy methods.
#[async_trait]
Expand Down Expand Up @@ -133,12 +133,12 @@ mod tests {
use futures_util::TryStreamExt;
use futures_util::stream::BoxStream;

use crate::kvapi;
use crate::kvapi::KVStream;
use crate::kvapi::KvApiExt;
use crate::kvapi::ListOptions;
use crate::kvapi::fail_fast;
use crate::kvapi::limit_stream;
use crate as kvapi;
use crate::KVStream;
use crate::KvApiExt;
use crate::ListOptions;
use crate::fail_fast;
use crate::limit_stream;

/// In-memory mock of KVApi backed by a BTreeMap of protobuf SeqV.
struct MockKVApi {
Expand Down
58 changes: 0 additions & 58 deletions crates/client/kvapi/src/kvapi/mod.rs

This file was deleted.

45 changes: 44 additions & 1 deletion crates/client/kvapi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,47 @@

#![allow(clippy::uninlined_format_args)]

pub mod kvapi;
mod api;
mod dir_name;
mod helper;
mod item;
mod key;
mod key_builder;
mod key_codec;
mod key_parser;
mod kv_api_ext;
mod list_options;
mod message;
mod pair;
mod value;
mod value_with_name;

pub(crate) mod testing;

pub use api::ApiBuilder;
pub use api::KVApi;
pub use api::KVStream;
pub use api::fail_fast;
pub use api::limit_stream;
pub use dir_name::DirName;
pub use item::Item;
pub use item::NonEmptyItem;
pub use key::Key;
pub use key::KeyError;
pub use key_builder::KeyBuilder;
pub use key_codec::KeyCodec;
pub use key_parser::KeyParser;
pub use kv_api_ext::KvApiExt;
pub use list_options::ListOptions;
pub use message::GetKVReply;
pub use message::GetKVReq;
pub use message::ListKVReply;
pub use message::ListKVReq;
pub use message::MGetKVReply;
pub use message::MGetKVReq;
pub use message::UpsertKVReply;
pub use pair::BasicPair;
pub use pair::Pair;
pub use pair::SeqPair;
pub use value::Value;
pub use value_with_name::ValueWithName;
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use databend_meta_types::SeqV;

use crate::kvapi;
use crate as kvapi;

/// A Key-Value pair for type Key. The value does not have a seq number.
#[derive(Clone, Debug, PartialEq, Eq)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::kvapi;
use crate::kvapi::Key;
use crate::kvapi::KeyCodec;
use crate::kvapi::KeyError;
use crate::kvapi::KeyParser;
use crate::kvapi::Value;
use crate as kvapi;
use crate::Key;
use crate::KeyCodec;
use crate::KeyError;
use crate::KeyParser;
use crate::Value;

#[allow(dead_code)]
#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down
Loading