rcfe_core/
txn.rs

1use crate::{
2    error::Error,
3    etcdserverpb::{Compare, RequestOp, TxnResponse},
4};
5use tonic::Response;
6
7#[tonic::async_trait]
8pub trait Txn {
9    fn is<I, P>(&mut self, compares: I) -> Result<&mut Self, Error>
10    where
11        I: IntoIterator<Item = P>,
12        P: Into<Compare>;
13
14    fn then<I, P>(&mut self, ops: I) -> Result<&mut Self, Error>
15    where
16        I: IntoIterator<Item = P>,
17        P: Into<RequestOp>;
18
19    fn els<I, P>(&mut self, ops: I) -> Result<&mut Self, Error>
20    where
21        I: IntoIterator<Item = P>,
22        P: Into<RequestOp>;
23
24    async fn commit(&mut self) -> Result<Response<TxnResponse>, Error>;
25}