Trait Gateway

Source
pub trait Gateway: ThreadSafe {
    type State: StateInstance<FE = CacheBlock>;

    // Required methods
    fn host(&self) -> &Host;
    fn link(&self, path: TCPathBuf) -> Link;
    fn fetch<'a>(
        &'a self,
        txn_id: &'a TxnId,
        link: ToUrl<'a>,
        key: &'a Value,
    ) -> TCBoxTryFuture<'_, Value>;
    fn get<'a>(
        &'a self,
        txn: &'a Txn<Self::State>,
        link: ToUrl<'a>,
        key: Value,
    ) -> TCBoxTryFuture<'a, Self::State>;
    fn put<'a>(
        &'a self,
        txn: &'a Txn<Self::State>,
        link: ToUrl<'a>,
        key: Value,
        value: Self::State,
    ) -> TCBoxTryFuture<'a, ()>;
    fn post<'a>(
        &'a self,
        txn: &'a Txn<Self::State>,
        link: ToUrl<'a>,
        params: Self::State,
    ) -> TCBoxTryFuture<'a, Self::State>;
    fn delete<'a>(
        &'a self,
        txn: &'a Txn<Self::State>,
        link: ToUrl<'a>,
        key: Value,
    ) -> TCBoxTryFuture<'a, ()>;
    fn finalize(&self, txn_id: TxnId) -> TCBoxFuture<'_, ()>;
}

Required Associated Types§

Required Methods§

Source

fn host(&self) -> &Host

Return this Host

Return a link to the given path on this host.

Source

fn fetch<'a>( &'a self, txn_id: &'a TxnId, link: ToUrl<'a>, key: &'a Value, ) -> TCBoxTryFuture<'_, Value>

Read a simple value.

Source

fn get<'a>( &'a self, txn: &'a Txn<Self::State>, link: ToUrl<'a>, key: Value, ) -> TCBoxTryFuture<'a, Self::State>

Read the [State] at link with the given key.

Source

fn put<'a>( &'a self, txn: &'a Txn<Self::State>, link: ToUrl<'a>, key: Value, value: Self::State, ) -> TCBoxTryFuture<'a, ()>

Update the [State] with the given key at link to value.

Source

fn post<'a>( &'a self, txn: &'a Txn<Self::State>, link: ToUrl<'a>, params: Self::State, ) -> TCBoxTryFuture<'a, Self::State>

Execute the POST op at link with the params

Source

fn delete<'a>( &'a self, txn: &'a Txn<Self::State>, link: ToUrl<'a>, key: Value, ) -> TCBoxTryFuture<'a, ()>

Delete the [State] at link with the given key.

Source

fn finalize(&self, txn_id: TxnId) -> TCBoxFuture<'_, ()>

Implementors§