Skip to content

Commit

Permalink
fix type
Browse files Browse the repository at this point in the history
Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun committed Nov 22, 2023
1 parent 6da386c commit 615b418
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/common/meta/src/kv_backend/chroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use std::any::Any;
use std::sync::Arc;

use crate::error::Error;
use crate::kv_backend::txn::{Txn, TxnOp, TxnOpResponse, TxnResponse};
use crate::kv_backend::{KvBackend, KvBackendRef, TxnService};
use crate::rpc::store::{
Expand All @@ -29,16 +30,16 @@ pub struct ChrootKvBackend<B> {
inner: B,
}

impl<B: KvBackend> ChrootKvBackend<B> {
impl<B: KvBackend<Error = Error> + 'static> ChrootKvBackend<B> {
pub fn new<R>(root: Vec<u8>, inner: B) -> KvBackendRef {
debug_assert!(!root.is_empty());
Arc::new(ChrootKvBackend { root, inner })
}
}

#[async_trait::async_trait]
impl<B: KvBackend> TxnService for ChrootKvBackend<B> {
type Error = B::Error;
impl<B: KvBackend<Error = Error>> TxnService for ChrootKvBackend<B> {
type Error = Error;

async fn txn(&self, txn: Txn) -> Result<TxnResponse, Self::Error> {
let txn = txn_prepend_root(&self.root, txn);
Expand All @@ -48,7 +49,7 @@ impl<B: KvBackend> TxnService for ChrootKvBackend<B> {
}

#[async_trait::async_trait]
impl<B: KvBackend> KvBackend for ChrootKvBackend<B> {
impl<B: KvBackend<Error = Error>> KvBackend for ChrootKvBackend<B> {
fn name(&self) -> &str {
self.inner.name()
}
Expand Down

0 comments on commit 615b418

Please sign in to comment.