[−][src]Struct agilulf::Server
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]
address: &str,
database: impl AsyncDatabase + 'static
) -> Result<Server, ServerError>
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]
U: From<T>,
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,