ghassmo 5 vuotta sitten
vanhempi
sitoutus
09c0c43d47
4 muutettua tiedostoa jossa 18 lisäystä ja 9 poistoa
  1. 5 5
      src/rpc/adapter.rs
  2. 3 1
      src/rpc/jsonserver.rs
  3. 6 3
      src/service/gateway.rs
  4. 4 0
      src/slabstore.rs

+ 5 - 5
src/rpc/adapter.rs

@@ -1,16 +1,16 @@
-use std::sync::Arc;
+use crate::serial;
 use crate::serial;
 use crate::Result;
-use log::*;
-use rusqlite::Connection;
+use crate::Result;
 use ff::Field;
+use log::*;
 use rand::rngs::OsRng;
 use rusqlite::Connection;
+use rusqlite::Connection;
 use smol::Async;
 use std::fs::File;
 use std::io::prelude::*;
-use crate::serial;
-use crate::Result;
+use std::sync::Arc;
 
 // Dummy adapter for now
 pub struct RpcAdapter {}

+ 3 - 1
src/rpc/jsonserver.rs

@@ -165,7 +165,9 @@ impl RpcInterface {
             //let (public, private) = RpcAdapter::key_gen().await;
             // getting an error on the following:
             // RpcAdapter::save_key(&connection, private, public).await;
-            Ok(jsonrpc_core::Value::String("Attempted key generation".into()))
+            Ok(jsonrpc_core::Value::String(
+                "Attempted key generation".into(),
+            ))
         });
         debug!(target: "rpc", "JsonRpcInterface::handle_input() [END]");
         Ok(io)

+ 6 - 3
src/service/gateway.rs

@@ -119,7 +119,7 @@ impl GatewayService {
 
 pub struct GatewayClient {
     protocol: ReqProtocol,
-    slabstore: SlabStore
+    slabstore: SlabStore,
 }
 
 impl GatewayClient {
@@ -128,12 +128,15 @@ impl GatewayClient {
 
         let slabstore = SlabStore::new(Path::new("slabstore.db"))?;
 
-        Ok(GatewayClient { protocol ,slabstore})
+        Ok(GatewayClient {
+            protocol,
+            slabstore,
+        })
     }
 
     pub async fn start(&mut self) -> Result<()> {
         self.protocol.start().await?;
-        
+
         Ok(())
     }
 

+ 4 - 0
src/slabstore.rs

@@ -14,6 +14,10 @@ pub struct SlabStore {
 
 impl SlabStore {
     pub fn new(path: &Path) -> Result<Self> {
+        // TODO
+        // add index in slab struct and compare slab once received with
+        // current index
+
         let mut opt = Options::default();
         opt.create_if_missing(true);