mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
integrate rocksdb to gateway client
This commit is contained in:
@@ -6,7 +6,7 @@ use drk::service::{fetch_slabs_loop, GatewayClient};
|
||||
use drk::Result;
|
||||
|
||||
async fn start(executor: Arc<Executor<'_>>) -> Result<()> {
|
||||
let mut client = GatewayClient::new("127.0.0.1:3333".parse()?);
|
||||
let mut client = GatewayClient::new("127.0.0.1:3333".parse()?)?;
|
||||
|
||||
client.start().await?;
|
||||
println!("connected to a server");
|
||||
|
||||
@@ -119,15 +119,21 @@ impl GatewayService {
|
||||
|
||||
pub struct GatewayClient {
|
||||
protocol: ReqProtocol,
|
||||
slabstore: SlabStore
|
||||
}
|
||||
|
||||
impl GatewayClient {
|
||||
pub fn new(addr: SocketAddr) -> GatewayClient {
|
||||
pub fn new(addr: SocketAddr) -> Result<GatewayClient> {
|
||||
let protocol = ReqProtocol::new(addr);
|
||||
GatewayClient { protocol }
|
||||
|
||||
let slabstore = SlabStore::new(Path::new("slabstore.db"))?;
|
||||
|
||||
Ok(GatewayClient { protocol ,slabstore})
|
||||
}
|
||||
|
||||
pub async fn start(&mut self) -> Result<()> {
|
||||
self.protocol.start().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user