[][src]Struct agilulf::Server

pub struct Server { /* fields omitted */ }

A simple TCP server constructed by a foreign database with the help of agilulf_protocol

Most of it's coded are neccesary and template. There isn't much logic code in this mod:

First, set up a romio TCP server and spawn every connection on a ThreadPool.

For every connection, convert the Incoming stream into command stream and send the command to database. Then read reply from database (actually not read, it is just function return). Send the reply to reply sink (converted from outcoming sink)

This struct just assemble the protocol and database together. With this template, implement a KV server on another transimission layer is quite the same. Just replace the romio TCP server with other asynchronous server and most codes are same.

Methods

impl Server[src]

pub fn new(
    address: &str,
    database: impl AsyncDatabase + 'static
) -> Result<Server, ServerError>
[src]

pub async fn run_async(__arg0: Self) -> Result<(), ServerError>[src]

run_async is provided as a seperated function. Becasue you may want to run on a ThreadPool or any other executor. I don't want to limit the executor choice.

pub fn run(self) -> Result<(), ServerError>[src]

This function use futures::executor::block_on to run method run_async

Auto Trait Implementations

impl Send for Server

impl Unpin for Server

impl Sync for Server

impl !UnwindSafe for Server

impl !RefUnwindSafe for Server

Blanket Implementations

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

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

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> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> Erased for T