[][src]Struct clepsydra::Database

pub struct Database<L: Lang, S: Store<L>> {
    pub self_id: PeerID,
    // some fields omitted
}

Main object that clients instantiate. Encapsulates the remainder of the system. Clients need to provide a Clock and Store, as well as some number of async IO connections to other peers.

Fields

self_id: PeerID

Implementations

impl<L: Lang, S: Store<L>> Database<L, S>[src]

pub fn new(self_id: PeerID, clock: Box<dyn Clock>, store: S) -> Self[src]

Construct a new Database for a given Clock and Store. The PeerID should be unique among peers in a group, and all peers should use compatible and roughly-synchronized clocks.

pub fn coordinate(
    &self,
    stmt: L::Stmt,
    vals: Vec<L::Val>
) -> Pin<Box<dyn Future<Output = Result<(GlobalTime, BTreeMap<L::Key, ExtVal<L>>), Error>> + Send + Sync + 'static>>
[src]

Main entrypoint for clients submitting transactions. Call this and await the response. If the response is Ok, a transaction containing stmt and vals was successfully replicated to a quorum of peers and executed at a specific GlobalTime in the consensus sequential order. The result will contain the that timestamp as a map populated with any keys and their values (evaluated at the transaction's time) specified by Lang::get_eval_set(stmt).

impl<L: Lang, S: Store<L>> Database<L, S>[src]

pub async fn connect<IO: AsyncReadWrite>(&self, peer: PeerID, io: IO)[src]

Adds a connection to a remote PeerID. The io handle should be a full-duplex AsyncRead+AsyncWrite type.

pub fn launch_workers(
    &self
) -> Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>
[src]

Start network-service worker tasks on this database. Should be called before any calls to Database::coordinate.

Trait Implementations

impl<L: Lang, S: Store<L>> Clone for Database<L, S>[src]

Auto Trait Implementations

impl<L, S> !RefUnwindSafe for Database<L, S>[src]

impl<L, S> Send for Database<L, S> where
    <L as Lang>::Expr: Send,
    <L as Lang>::Key: Send,
    <L as Lang>::Val: Send
[src]

impl<L, S> Sync for Database<L, S> where
    <L as Lang>::Expr: Send,
    <L as Lang>::Key: Send,
    <L as Lang>::Val: Send
[src]

impl<L, S> Unpin for Database<L, S>[src]

impl<L, S> !UnwindSafe for Database<L, S>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithSubscriber for T[src]