Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: transaction api #5030

Merged
merged 14 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from 13 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
5 changes: 5 additions & 0 deletions common/management/tests/it/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ use common_meta_types::Operation;
use common_meta_types::PasswordHashMethod;
use common_meta_types::PrefixListReply;
use common_meta_types::SeqV;
use common_meta_types::TxnReply;
use common_meta_types::TxnRequest;
use common_meta_types::UpsertKVAction;
use common_meta_types::UpsertKVActionReply;
use common_meta_types::UserIdentity;
Expand All @@ -53,6 +55,9 @@ mock! {
) -> Result<MGetKVActionReply,MetaError>;

async fn prefix_list_kv(&self, prefix: &str) -> Result<PrefixListReply, MetaError>;

async fn transaction(&self, txn: TxnRequest) -> Result<TxnReply, MetaError>;

}
}

Expand Down
8 changes: 8 additions & 0 deletions common/meta/api/src/kv_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ use common_meta_types::GetKVActionReply;
use common_meta_types::MGetKVActionReply;
use common_meta_types::MetaError;
use common_meta_types::PrefixListReply;
use common_meta_types::TxnReply;
use common_meta_types::TxnRequest;
use common_meta_types::UpsertKVAction;
use common_meta_types::UpsertKVActionReply;

Expand All @@ -44,6 +46,8 @@ pub trait KVApi: Send + Sync {
async fn mget_kv(&self, key: &[String]) -> Result<MGetKVActionReply, MetaError>;

async fn prefix_list_kv(&self, prefix: &str) -> Result<PrefixListReply, MetaError>;

async fn transaction(&self, txn: TxnRequest) -> Result<TxnReply, MetaError>;
}

#[async_trait]
Expand All @@ -63,4 +67,8 @@ impl<U: KVApi, T: Deref<Target = U> + Send + Sync> KVApi for T {
async fn prefix_list_kv(&self, prefix: &str) -> Result<PrefixListReply, MetaError> {
self.deref().prefix_list_kv(prefix).await
}

async fn transaction(&self, txn: TxnRequest) -> Result<TxnReply, MetaError> {
self.deref().transaction(txn).await
}
}
Loading