Skip to content

Integrated asynchronous programming with multithreading, leveraging the Tokio runtime for achieving asynchronous networking. Employed async/await syntax.

License

Notifications You must be signed in to change notification settings

Ariellink/kvstore-asynchrony

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kvstore-asynchrony

A multi-threaded, persistent key/value store server and client with asynchronous networking over a custom protocol.

  • KvsEngine trait presents a futures-based API, by using #[async_trait] attribute macro to make async fn in traits work.
#[async_trait]
pub trait KvsEngine: Clone + Send + 'static {
    async fn set(&self, key: String, value: String) -> Result<()>;
    async fn get(&self, key: String) -> Result<Option<String>>;
    async fn remove(&self, key: String) -> Result<()>;
}
  • Both the client and server are converted to asyncronous;
  • KvsServer is based on the tokio runtime, which handles the distribution of asynchronous work to multiple threads on its own (tokio itself contains a thread pool).
    • Replaced the serde with tokio-serde for Tokio transport serialization and deserialization of frame values.
  • KvStore handles file I/O using tokio::spawn;

About

Integrated asynchronous programming with multithreading, leveraging the Tokio runtime for achieving asynchronous networking. Employed async/await syntax.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages