pub trait DataStorage {
// Required methods
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>;
}
Expand description
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§
Sourcefn connect(&mut self) -> Result<(), String>
fn connect(&mut self) -> Result<(), String>
Connect to host. Most implments should make sure the server / other peer is avaliable.
Sourcefn peek(&mut self, tag: &str) -> Result<Option<Vec<u8>>, String>
fn peek(&mut self, tag: &str) -> Result<Option<Vec<u8>>, String>
Try to download a data packet. Similear to ftp’s GET
.