mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
cargo fmt
This commit is contained in:
@@ -4,7 +4,7 @@ use easy_parallel::Parallel;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use drk::service::{ClientProgramOptions, GatewayClient};
|
||||
use drk::{slab::Slab, Result, rocks::Rocks};
|
||||
use drk::{rocks::Rocks, slab::Slab, Result};
|
||||
|
||||
fn setup_addr(address: Option<SocketAddr>, default: SocketAddr) -> SocketAddr {
|
||||
match address {
|
||||
@@ -92,9 +92,9 @@ mod test {
|
||||
fn test_darkfid_client() {
|
||||
use std::path::Path;
|
||||
|
||||
use drk::rocks::Rocks;
|
||||
use drk::service::GatewayClient;
|
||||
use drk::slab::Slab;
|
||||
use drk::rocks::Rocks;
|
||||
|
||||
use log::*;
|
||||
use rand::Rng;
|
||||
@@ -120,19 +120,13 @@ mod test {
|
||||
let mut rng = rand::thread_rng();
|
||||
let rnd: u32 = rng.gen();
|
||||
|
||||
|
||||
|
||||
|
||||
let path_str = format!("database_{}.db", rnd);
|
||||
let database_path = Path::new(path_str.as_str());
|
||||
let rocks = Rocks::new(database_path.clone()).unwrap();
|
||||
|
||||
// create new client and use different slabstore
|
||||
let mut client = GatewayClient::new(
|
||||
"127.0.0.1:3333".parse().unwrap(),
|
||||
rocks,
|
||||
)
|
||||
.unwrap();
|
||||
let mut client =
|
||||
GatewayClient::new("127.0.0.1:3333".parse().unwrap(), rocks).unwrap();
|
||||
|
||||
// start client
|
||||
client.start().await.unwrap();
|
||||
@@ -140,7 +134,6 @@ mod test {
|
||||
// sending slab
|
||||
let _slab = Slab::new("testcoin".to_string(), rnd.to_le_bytes().to_vec());
|
||||
client.put_slab(_slab).await.unwrap();
|
||||
|
||||
})
|
||||
});
|
||||
thread_pools.push(thread);
|
||||
|
||||
@@ -5,8 +5,8 @@ extern crate clap;
|
||||
use async_executor::Executor;
|
||||
use easy_parallel::Parallel;
|
||||
|
||||
use drk::{Result, rocks::Rocks};
|
||||
use drk::service::{GatewayService, ProgramOptions};
|
||||
use drk::{rocks::Rocks, Result};
|
||||
|
||||
fn setup_addr(address: Option<SocketAddr>, default: SocketAddr) -> SocketAddr {
|
||||
match address {
|
||||
|
||||
@@ -2,11 +2,11 @@ use std::path::Path;
|
||||
|
||||
use crate::{Error, Result};
|
||||
|
||||
use rocksdb::{ColumnFamilyDescriptor, Options, DB, ColumnFamily};
|
||||
use rocksdb::{ColumnFamily, ColumnFamilyDescriptor, Options, DB};
|
||||
|
||||
pub enum IteratorMode{
|
||||
pub enum IteratorMode {
|
||||
Start,
|
||||
End
|
||||
End,
|
||||
}
|
||||
|
||||
pub trait Column {
|
||||
@@ -91,7 +91,7 @@ impl Rocks {
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
pub fn iterator(&self, cf: &ColumnFamily, iterator_mode: IteratorMode) -> rocksdb::DBIterator{
|
||||
pub fn iterator(&self, cf: &ColumnFamily, iterator_mode: IteratorMode) -> rocksdb::DBIterator {
|
||||
let iterator_mode = match iterator_mode {
|
||||
IteratorMode::Start => rocksdb::IteratorMode::Start,
|
||||
IteratorMode::End => rocksdb::IteratorMode::End,
|
||||
|
||||
@@ -4,7 +4,8 @@ use std::net::SocketAddr;
|
||||
|
||||
use super::reqrep::{PeerId, Publisher, RepProtocol, Reply, ReqProtocol, Request, Subscriber};
|
||||
use crate::{
|
||||
serial::deserialize, serial::serialize, slab::Slab, slabstore::SlabStore, Error, Result, rocks::Rocks
|
||||
rocks::Rocks, serial::deserialize, serial::serialize, slab::Slab, slabstore::SlabStore, Error,
|
||||
Result,
|
||||
};
|
||||
|
||||
use async_executor::Executor;
|
||||
|
||||
Reference in New Issue
Block a user