[−][src]Struct clepsydra::Database
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]
&self,
stmt: L::Stmt,
vals: Vec<L::Val>
) -> Pin<Box<dyn Future<Output = Result<(GlobalTime, BTreeMap<L::Key, ExtVal<L>>), Error>> + Send + Sync + 'static>>
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]
&self
) -> Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>
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]
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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]
<L as Lang>::Expr: Send,
<L as Lang>::Key: Send,
<L as Lang>::Val: Send,
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]
<L as Lang>::Expr: Send,
<L as Lang>::Key: Send,
<L as Lang>::Val: Send,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,