[][src]Trait rust_ether::DataStorage

pub trait DataStorage {
    fn connect(&mut self) -> Result<(), String>;
fn peek(&mut self, tag: &str) -> Result<Option<Vec<u8>>, String>;
fn send(&mut self, tag: &str, data: Vec<u8>) -> Result<(), String>;
fn remove(&mut self, tag: &str) -> Result<(), String>; }

A data storage protocol.

It is very similear to PacketTransfer trait, but implements should guarantee the persistence of the data when implementing DataStorage.

Required methods

fn connect(&mut self) -> Result<(), String>

Connect to host. Most implments should make sure the server / other peer is avaliable.

fn peek(&mut self, tag: &str) -> Result<Option<Vec<u8>>, String>

Try to download a data packet. Similear to ftp's GET.

fn send(&mut self, tag: &str, data: Vec<u8>) -> Result<(), String>

Try to upload a data packet. Similear to ftp's PUT.

fn remove(&mut self, tag: &str) -> Result<(), String>

Remove the data packet from server.

Loading content...

Implementors

Loading content...