lab/lab2/
lab.rs

1use tribbler::{config::KeeperConfig, err::TribResult, storage::BinStorage, trib::Server};
2
3/// This function accepts a list of backend addresses, and returns a
4/// type which should implement the [BinStorage] trait to access the
5/// underlying storage system.
6#[allow(unused_variables)]
7pub async fn new_bin_client(backs: Vec<String>) -> TribResult<Box<dyn BinStorage>> {
8    todo!()
9}
10
11/// this async function accepts a [KeeperConfig] that should be used to start
12/// a new keeper server on the address given in the config.
13///
14/// This function should block indefinitely and only return upon erroring. Make
15/// sure to send the proper signal to the channel in `kc` when the keeper has
16/// started.
17#[allow(unused_variables)]
18pub async fn serve_keeper(kc: KeeperConfig) -> TribResult<()> {
19    todo!()
20}
21
22/// this function accepts a [BinStorage] client which should be used in order to
23/// implement the [Server] trait.
24///
25/// You'll need to translate calls from the tribbler front-end into storage
26/// calls using the [BinStorage] interface.
27///
28/// Additionally, two trait bounds [Send] and [Sync] are required of your
29/// implementation. This should guarantee your front-end is safe to use in the
30/// tribbler front-end service launched by the`trib-front` command
31#[allow(unused_variables)]
32pub async fn new_front(
33    bin_storage: Box<dyn BinStorage>,
34) -> TribResult<Box<dyn Server + Send + Sync>> {
35    todo!()
36}