diff --git a/cli/src/argparse.rs b/cli/src/argparse.rs
index 0b9bddec..771edd58 100644
--- a/cli/src/argparse.rs
+++ b/cli/src/argparse.rs
@@ -24,17 +24,18 @@
*
*/
-use crate::{runner::Runner, tokenizer};
-use clap::{load_yaml, App};
-use crossterm::{
- cursor, execute,
- terminal::{Clear, ClearType},
+use {
+ crate::{runner::Runner, tokenizer},
+ clap::{load_yaml, App},
+ crossterm::{
+ cursor, execute,
+ terminal::{Clear, ClearType},
+ },
+ libsky::{URL, VERSION},
+ rustyline::{config::Configurer, error::ReadlineError, Editor},
+ skytable::{Pipeline, Query},
+ std::{io::stdout, process},
};
-use libsky::{URL, VERSION};
-use readline::{config::Configurer, error::ReadlineError, Editor};
-use rustyline as readline;
-use skytable::{Pipeline, Query};
-use std::{io::stdout, process};
const ADDR: &str = "127.0.0.1";
const SKYSH_HISTORY_FILE: &str = ".sky_history";
diff --git a/cli/src/runner.rs b/cli/src/runner.rs
index 22b5afe5..f9ce45ac 100644
--- a/cli/src/runner.rs
+++ b/cli/src/runner.rs
@@ -23,15 +23,15 @@
* along with this program. If not, see .
*
*/
-use crate::tokenizer;
-use core::fmt;
-use crossterm::style::{Color, Print, ResetColor, SetForegroundColor};
-use skytable::error::Error;
-use skytable::types::Array;
-use skytable::types::FlatElement;
-use skytable::Pipeline;
-use skytable::Query;
-use skytable::{aio, Element, RespCode};
+
+use {
+ crate::tokenizer,
+ core::fmt,
+ crossterm::style::{Color, Print, ResetColor, SetForegroundColor},
+ skytable::{
+ aio, error::Error, types::Array, types::FlatElement, Element, Pipeline, Query, RespCode,
+ },
+};
type SkyResult = Result;
diff --git a/harness/src/build.rs b/harness/src/build.rs
index bc08c9c3..2664e1ec 100644
--- a/harness/src/build.rs
+++ b/harness/src/build.rs
@@ -24,11 +24,14 @@
*
*/
-use crate::util;
-use crate::HarnessResult;
-use std::path::Path;
-use std::{path::PathBuf, process::Command};
-use zip::CompressionMethod;
+use {
+ crate::{util, HarnessResult},
+ std::{
+ path::{Path, PathBuf},
+ process::Command,
+ },
+ zip::CompressionMethod,
+};
/// The binaries that will be present in a bundle
pub const BINARIES: [&str; 4] = ["skyd", "sky-bench", "skysh", "sky-migrate"];
diff --git a/harness/src/bundle.rs b/harness/src/bundle.rs
index 56228b15..d8b72267 100644
--- a/harness/src/bundle.rs
+++ b/harness/src/bundle.rs
@@ -24,17 +24,19 @@
*
*/
-use crate::{
- build::{self, BuildMode},
- util, HarnessError, HarnessResult,
+use {
+ crate::{
+ build::{self, BuildMode},
+ util, HarnessError, HarnessResult,
+ },
+ libsky::VERSION,
+ std::{
+ fs,
+ io::{Read, Write},
+ path::{Path, PathBuf},
+ },
+ zip::{write::FileOptions, ZipWriter},
};
-use libsky::VERSION;
-use std::fs;
-use std::io::Read;
-use std::io::Write;
-use std::path::Path;
-use std::path::PathBuf;
-use zip::{write::FileOptions, ZipWriter};
/// Returns the bundle name
pub fn get_bundle_name() -> String {
diff --git a/harness/src/cli.rs b/harness/src/cli.rs
index 73a313f5..ad3e32be 100644
--- a/harness/src/cli.rs
+++ b/harness/src/cli.rs
@@ -24,10 +24,10 @@
*
*/
-use crate::build::BuildMode;
-use crate::linuxpkg::LinuxPackageType;
-use crate::{HarnessError, HarnessResult};
-use std::{env, process};
+use {
+ crate::{build::BuildMode, linuxpkg::LinuxPackageType, HarnessError, HarnessResult},
+ std::{env, process},
+};
const HELP: &str = "\
harness
diff --git a/harness/src/error.rs b/harness/src/error.rs
index 1fb820de..b63a260b 100644
--- a/harness/src/error.rs
+++ b/harness/src/error.rs
@@ -24,8 +24,7 @@
*
*/
-use crate::util::ExitCode;
-use std::fmt;
+use {crate::util::ExitCode, std::fmt};
pub type HarnessResult = Result;
#[derive(Debug)]
diff --git a/harness/src/linuxpkg.rs b/harness/src/linuxpkg.rs
index 73b4605f..755afb41 100644
--- a/harness/src/linuxpkg.rs
+++ b/harness/src/linuxpkg.rs
@@ -24,9 +24,13 @@
*
*/
-use crate::build::{self, BuildMode};
-use crate::{util, HarnessResult};
-use libsky::VERSION;
+use {
+ crate::{
+ build::{self, BuildMode},
+ {util, HarnessResult},
+ },
+ libsky::VERSION,
+};
/// The Linux package type
#[derive(Copy, Clone)]
diff --git a/harness/src/main.rs b/harness/src/main.rs
index 988f0216..70011fce 100644
--- a/harness/src/main.rs
+++ b/harness/src/main.rs
@@ -37,12 +37,14 @@ mod presetup;
mod test;
#[cfg(test)]
mod tests;
-use crate::{
- cli::HarnessWhat,
- error::{HarnessError, HarnessResult},
-};
-use env_logger::Builder;
use std::{env, process};
+use {
+ crate::{
+ cli::HarnessWhat,
+ error::{HarnessError, HarnessResult},
+ },
+ env_logger::Builder,
+};
const ROOT_DIR: &str = env!("ROOT_DIR");
diff --git a/harness/src/test/mod.rs b/harness/src/test/mod.rs
index 803ef4f4..ae2afda1 100644
--- a/harness/src/test/mod.rs
+++ b/harness/src/test/mod.rs
@@ -24,24 +24,26 @@
*
*/
-use crate::{
- build::BuildMode,
- util::{self},
- HarnessError, HarnessResult,
-};
-use openssl::{
- asn1::Asn1Time,
- bn::{BigNum, MsbOption},
- error::ErrorStack,
- hash::MessageDigest,
- pkey::{PKey, Private},
- rsa::Rsa,
- x509::{
- extension::{BasicConstraints, KeyUsage, SubjectKeyIdentifier},
- X509NameBuilder, X509,
+use {
+ crate::{
+ build::BuildMode,
+ util::{self},
+ HarnessError, HarnessResult,
+ },
+ openssl::{
+ asn1::Asn1Time,
+ bn::{BigNum, MsbOption},
+ error::ErrorStack,
+ hash::MessageDigest,
+ pkey::{PKey, Private},
+ rsa::Rsa,
+ x509::{
+ extension::{BasicConstraints, KeyUsage, SubjectKeyIdentifier},
+ X509NameBuilder, X509,
+ },
},
+ std::{fs, io::Write},
};
-use std::{fs, io::Write};
mod svc;
/// Run the test suite
diff --git a/harness/src/test/svc.rs b/harness/src/test/svc.rs
index 25aa8604..0c583969 100644
--- a/harness/src/test/svc.rs
+++ b/harness/src/test/svc.rs
@@ -24,17 +24,19 @@
*
*/
-use crate::{
- util::{self},
- HarnessError, HarnessResult, ROOT_DIR,
-};
-use skytable::{error::Error, Connection, SkyResult};
#[cfg(windows)]
use std::os::windows::process::CommandExt;
-use std::{
- io::ErrorKind,
- path::Path,
- process::{Child, Command},
+use {
+ crate::{
+ util::{self},
+ HarnessError, HarnessResult, ROOT_DIR,
+ },
+ skytable::{error::Error, Connection, SkyResult},
+ std::{
+ io::ErrorKind,
+ path::Path,
+ process::{Child, Command},
+ },
};
#[cfg(windows)]
diff --git a/harness/src/tests.rs b/harness/src/tests.rs
index 9416d26e..89e97d6c 100644
--- a/harness/src/tests.rs
+++ b/harness/src/tests.rs
@@ -24,14 +24,15 @@
*
*/
-use crate::util::WORKSPACE_ROOT;
-use crate::{
- build::{self, BuildMode},
- bundle, linuxpkg, util,
+use {
+ crate::{
+ build::{self, BuildMode},
+ bundle, linuxpkg, util,
+ util::WORKSPACE_ROOT,
+ },
+ libsky::VERSION,
+ std::{env, path::PathBuf},
};
-use libsky::VERSION;
-use std::env;
-use std::path::PathBuf;
#[test]
fn file_names() {
diff --git a/harness/src/util.rs b/harness/src/util.rs
index 0c8cde87..10b3e25a 100644
--- a/harness/src/util.rs
+++ b/harness/src/util.rs
@@ -24,12 +24,19 @@
*
*/
-use crate::build::BuildMode;
-use crate::{HarnessError, HarnessResult};
-use std::env;
-use std::ffi::OsStr;
-use std::path::{Path, PathBuf};
-use std::process::{Child, Command, Output};
+use {
+ crate::{
+ build::BuildMode,
+ {HarnessError, HarnessResult},
+ },
+ std::{
+ env,
+ ffi::OsStr,
+ path::{Path, PathBuf},
+ process::{Child, Command, Output},
+ },
+};
+
pub type ExitCode = Option;
#[cfg(not(test))]
diff --git a/libstress/src/lib.rs b/libstress/src/lib.rs
index 71348860..70188515 100644
--- a/libstress/src/lib.rs
+++ b/libstress/src/lib.rs
@@ -59,13 +59,14 @@
#![deny(unused_imports)]
pub mod traits;
-use core::marker::PhantomData;
-use crossbeam_channel::Receiver as CReceiver;
-use crossbeam_channel::Sender as CSender;
-use crossbeam_channel::{bounded, unbounded};
pub use rayon;
-use rayon::prelude::*;
-use std::thread;
+
+use {
+ core::marker::PhantomData,
+ crossbeam_channel::{bounded, unbounded, Receiver as CReceiver, Sender as CSender},
+ rayon::prelude::{IntoParallelIterator, ParallelIterator},
+ std::thread,
+};
/// A Job. The UIn type parameter is the type that will be used to execute the action
/// Nothing is a variant used by the drop implementation to terminate all the workers
diff --git a/server/src/actions/del.rs b/server/src/actions/del.rs
index e6edc277..2a075679 100644
--- a/server/src/actions/del.rs
+++ b/server/src/actions/del.rs
@@ -27,10 +27,10 @@
//! # `DEL` queries
//! This module provides functions to work with `DEL` queries
-use crate::corestore::table::DataModel;
-use crate::dbnet::connection::prelude::*;
-use crate::kvengine::encoding::ENCODING_LUT_ITER;
-use crate::util::compiler;
+use crate::{
+ corestore::table::DataModel, dbnet::connection::prelude::*,
+ kvengine::encoding::ENCODING_LUT_ITER, util::compiler,
+};
action!(
/// Run a `DEL` query
diff --git a/server/src/actions/exists.rs b/server/src/actions/exists.rs
index 04e9a654..a8e06ab9 100644
--- a/server/src/actions/exists.rs
+++ b/server/src/actions/exists.rs
@@ -27,11 +27,10 @@
//! # `EXISTS` queries
//! This module provides functions to work with `EXISTS` queries
-use crate::corestore::table::DataModel;
-use crate::dbnet::connection::prelude::*;
-use crate::kvengine::encoding::ENCODING_LUT_ITER;
-use crate::queryengine::ActionIter;
-use crate::util::compiler;
+use crate::{
+ corestore::table::DataModel, dbnet::connection::prelude::*,
+ kvengine::encoding::ENCODING_LUT_ITER, queryengine::ActionIter, util::compiler,
+};
action!(
/// Run an `EXISTS` query
diff --git a/server/src/actions/flushdb.rs b/server/src/actions/flushdb.rs
index 411b0818..114a705c 100644
--- a/server/src/actions/flushdb.rs
+++ b/server/src/actions/flushdb.rs
@@ -24,8 +24,7 @@
*
*/
-use crate::dbnet::connection::prelude::*;
-use crate::queryengine::ActionIter;
+use crate::{dbnet::connection::prelude::*, queryengine::ActionIter};
action!(
/// Delete all the keys in the database
diff --git a/server/src/actions/get.rs b/server/src/actions/get.rs
index 4a599e2c..4069c1ae 100644
--- a/server/src/actions/get.rs
+++ b/server/src/actions/get.rs
@@ -27,8 +27,7 @@
//! # `GET` queries
//! This module provides functions to work with `GET` queries
-use crate::dbnet::connection::prelude::*;
-use crate::util::compiler;
+use crate::{dbnet::connection::prelude::*, util::compiler};
action!(
/// Run a `GET` query
diff --git a/server/src/actions/lists/lget.rs b/server/src/actions/lists/lget.rs
index b98dde40..7b899f90 100644
--- a/server/src/actions/lists/lget.rs
+++ b/server/src/actions/lists/lget.rs
@@ -24,8 +24,8 @@
*
*/
-use crate::corestore::Data;
-use crate::dbnet::connection::prelude::*;
+use crate::{corestore::Data, dbnet::connection::prelude::*};
+
const LEN: &[u8] = "LEN".as_bytes();
const LIMIT: &[u8] = "LIMIT".as_bytes();
const VALUEAT: &[u8] = "VALUEAT".as_bytes();
diff --git a/server/src/actions/lists/lmod.rs b/server/src/actions/lists/lmod.rs
index 20901bb6..89fe3e1c 100644
--- a/server/src/actions/lists/lmod.rs
+++ b/server/src/actions/lists/lmod.rs
@@ -24,9 +24,7 @@
*
*/
-use crate::corestore::Data;
-use crate::dbnet::connection::prelude::*;
-use crate::util::compiler;
+use crate::{corestore::Data, dbnet::connection::prelude::*, util::compiler};
const CLEAR: &[u8] = "CLEAR".as_bytes();
const PUSH: &[u8] = "PUSH".as_bytes();
diff --git a/server/src/actions/lists/mod.rs b/server/src/actions/lists/mod.rs
index 3f522304..2a004952 100644
--- a/server/src/actions/lists/mod.rs
+++ b/server/src/actions/lists/mod.rs
@@ -30,9 +30,7 @@ mod macros;
pub mod lget;
pub mod lmod;
-use crate::corestore::Data;
-use crate::dbnet::connection::prelude::*;
-use crate::kvengine::LockedVec;
+use crate::{corestore::Data, dbnet::connection::prelude::*, kvengine::LockedVec};
action! {
/// Handle an `LSET` query for the list model
diff --git a/server/src/actions/lskeys.rs b/server/src/actions/lskeys.rs
index 7cb77556..4ab08dc4 100644
--- a/server/src/actions/lskeys.rs
+++ b/server/src/actions/lskeys.rs
@@ -24,9 +24,10 @@
*
*/
-use crate::corestore::table::DataModel;
-use crate::corestore::Data;
-use crate::dbnet::connection::prelude::*;
+use crate::{
+ corestore::{table::DataModel, Data},
+ dbnet::connection::prelude::*,
+};
const DEFAULT_COUNT: usize = 10;
@@ -72,7 +73,8 @@ action!(
DataModel::KV(kv) => kv.get_inner_ref().get_keys(count),
DataModel::KVExtListmap(kv) => kv.get_inner_ref().get_keys(count),
};
- con.write_typed_non_null_array_header(items.len(), tsymbol).await?;
+ con.write_typed_non_null_array_header(items.len(), tsymbol)
+ .await?;
for key in items {
con.write_typed_non_null_array_element(&key).await?;
}
diff --git a/server/src/actions/mget.rs b/server/src/actions/mget.rs
index 2daba2d1..5b4c4a84 100644
--- a/server/src/actions/mget.rs
+++ b/server/src/actions/mget.rs
@@ -24,10 +24,10 @@
*
*/
-use crate::dbnet::connection::prelude::*;
-use crate::kvengine::encoding::ENCODING_LUT_ITER;
-use crate::queryengine::ActionIter;
-use crate::util::compiler;
+use crate::{
+ dbnet::connection::prelude::*, kvengine::encoding::ENCODING_LUT_ITER, queryengine::ActionIter,
+ util::compiler,
+};
action!(
/// Run an `MGET` query
diff --git a/server/src/actions/mod.rs b/server/src/actions/mod.rs
index bd72582d..1d695a2d 100644
--- a/server/src/actions/mod.rs
+++ b/server/src/actions/mod.rs
@@ -50,10 +50,10 @@ pub mod strong;
pub mod update;
pub mod uset;
pub mod whereami;
-use crate::corestore::memstore::DdlError;
-use crate::protocol::interface::ProtocolSpec;
-use crate::util;
-use std::io::Error as IoError;
+use {
+ crate::{corestore::memstore::DdlError, protocol::interface::ProtocolSpec, util},
+ std::io::Error as IoError,
+};
/// A generic result for actions
pub type ActionResult = Result;
diff --git a/server/src/actions/mpop.rs b/server/src/actions/mpop.rs
index 0a443bdc..30f351d8 100644
--- a/server/src/actions/mpop.rs
+++ b/server/src/actions/mpop.rs
@@ -24,11 +24,10 @@
*
*/
-use crate::corestore;
-use crate::dbnet::connection::prelude::*;
-use crate::kvengine::encoding::ENCODING_LUT_ITER;
-use crate::queryengine::ActionIter;
-use crate::util::compiler;
+use crate::{
+ corestore, dbnet::connection::prelude::*, kvengine::encoding::ENCODING_LUT_ITER,
+ queryengine::ActionIter, util::compiler,
+};
action!(
/// Run an MPOP action
diff --git a/server/src/actions/mset.rs b/server/src/actions/mset.rs
index d5bc3052..e25b7894 100644
--- a/server/src/actions/mset.rs
+++ b/server/src/actions/mset.rs
@@ -24,10 +24,10 @@
*
*/
-use crate::corestore::Data;
-use crate::dbnet::connection::prelude::*;
-use crate::kvengine::encoding::ENCODING_LUT_ITER_PAIR;
-use crate::util::compiler;
+use crate::{
+ corestore::Data, dbnet::connection::prelude::*, kvengine::encoding::ENCODING_LUT_ITER_PAIR,
+ util::compiler,
+};
action!(
/// Run an `MSET` query
diff --git a/server/src/actions/mupdate.rs b/server/src/actions/mupdate.rs
index afedb6e6..a3956a65 100644
--- a/server/src/actions/mupdate.rs
+++ b/server/src/actions/mupdate.rs
@@ -24,10 +24,10 @@
*
*/
-use crate::corestore::Data;
-use crate::dbnet::connection::prelude::*;
-use crate::kvengine::encoding::ENCODING_LUT_ITER_PAIR;
-use crate::util::compiler;
+use crate::{
+ corestore::Data, dbnet::connection::prelude::*, kvengine::encoding::ENCODING_LUT_ITER_PAIR,
+ util::compiler,
+};
action!(
/// Run an `MUPDATE` query
diff --git a/server/src/actions/set.rs b/server/src/actions/set.rs
index af047876..2ec7ad35 100644
--- a/server/src/actions/set.rs
+++ b/server/src/actions/set.rs
@@ -27,10 +27,7 @@
//! # `SET` queries
//! This module provides functions to work with `SET` queries
-use crate::corestore;
-use crate::dbnet::connection::prelude::*;
-use crate::queryengine::ActionIter;
-use corestore::Data;
+use crate::{corestore::Data, dbnet::connection::prelude::*, queryengine::ActionIter};
action!(
/// Run a `SET` query
diff --git a/server/src/actions/strong/sdel.rs b/server/src/actions/strong/sdel.rs
index f2183b62..a8ccae5b 100644
--- a/server/src/actions/strong/sdel.rs
+++ b/server/src/actions/strong/sdel.rs
@@ -24,12 +24,16 @@
*
*/
-use crate::actions::strong::StrongActionResult;
-use crate::dbnet::connection::prelude::*;
-use crate::kvengine::{KVEStandard, SingleEncoder};
-use crate::protocol::iter::DerefUnsafeSlice;
-use crate::util::compiler;
-use core::slice::Iter;
+use {
+ crate::{
+ actions::strong::StrongActionResult,
+ dbnet::connection::prelude::*,
+ kvengine::{KVEStandard, SingleEncoder},
+ protocol::iter::DerefUnsafeSlice,
+ util::compiler,
+ },
+ core::slice::Iter,
+};
action! {
/// Run an `SDEL` query
diff --git a/server/src/actions/strong/sset.rs b/server/src/actions/strong/sset.rs
index ddc57dcd..8f9c7765 100644
--- a/server/src/actions/strong/sset.rs
+++ b/server/src/actions/strong/sset.rs
@@ -24,14 +24,17 @@
*
*/
-use crate::actions::strong::StrongActionResult;
-use crate::corestore::Data;
-use crate::dbnet::connection::prelude::*;
-use crate::kvengine::DoubleEncoder;
-use crate::kvengine::KVEStandard;
-use crate::protocol::iter::DerefUnsafeSlice;
-use crate::util::compiler;
-use core::slice::Iter;
+use {
+ crate::{
+ actions::strong::StrongActionResult,
+ corestore::Data,
+ dbnet::connection::prelude::*,
+ kvengine::{DoubleEncoder, KVEStandard},
+ protocol::iter::DerefUnsafeSlice,
+ util::compiler,
+ },
+ core::slice::Iter,
+};
action! {
/// Run an `SSET` query
diff --git a/server/src/actions/strong/supdate.rs b/server/src/actions/strong/supdate.rs
index 8d1d3fb6..841d78ca 100644
--- a/server/src/actions/strong/supdate.rs
+++ b/server/src/actions/strong/supdate.rs
@@ -24,14 +24,17 @@
*
*/
-use crate::actions::strong::StrongActionResult;
-use crate::corestore::Data;
-use crate::dbnet::connection::prelude::*;
-use crate::kvengine::DoubleEncoder;
-use crate::kvengine::KVEStandard;
-use crate::protocol::iter::DerefUnsafeSlice;
-use crate::util::compiler;
-use core::slice::Iter;
+use {
+ crate::{
+ actions::strong::StrongActionResult,
+ corestore::Data,
+ dbnet::connection::prelude::*,
+ kvengine::{DoubleEncoder, KVEStandard},
+ protocol::iter::DerefUnsafeSlice,
+ util::compiler,
+ },
+ core::slice::Iter,
+};
action! {
/// Run an `SUPDATE` query
diff --git a/server/src/actions/strong/tests.rs b/server/src/actions/strong/tests.rs
index 096147b3..665b0887 100644
--- a/server/src/actions/strong/tests.rs
+++ b/server/src/actions/strong/tests.rs
@@ -25,11 +25,12 @@
*/
mod sdel_concurrency_tests {
- use super::super::sdel;
- use crate::corestore::Data;
- use crate::kvengine::KVEStandard;
- use std::sync::Arc;
- use std::thread;
+ use {
+ super::super::sdel,
+ crate::{corestore::Data, kvengine::KVEStandard},
+ std::{sync::Arc, thread},
+ };
+
#[test]
fn test_snapshot_okay() {
let kve = KVEStandard::init(true, true);
@@ -69,11 +70,12 @@ mod sdel_concurrency_tests {
}
mod sset_concurrency_tests {
- use super::super::sset;
- use crate::corestore::Data;
- use crate::kvengine::KVEStandard;
- use std::sync::Arc;
- use std::thread;
+ use {
+ super::super::sset,
+ crate::{corestore::Data, kvengine::KVEStandard},
+ std::{sync::Arc, thread},
+ };
+
#[test]
fn test_snapshot_okay() {
let kve = KVEStandard::init(true, true);
@@ -110,11 +112,12 @@ mod sset_concurrency_tests {
}
mod supdate_concurrency_tests {
- use super::super::supdate;
- use crate::corestore::Data;
- use crate::kvengine::KVEStandard;
- use std::sync::Arc;
- use std::thread;
+ use {
+ super::super::supdate,
+ crate::{corestore::Data, kvengine::KVEStandard},
+ std::{sync::Arc, thread},
+ };
+
#[test]
fn test_snapshot_okay() {
let kve = KVEStandard::init(true, true);
diff --git a/server/src/actions/update.rs b/server/src/actions/update.rs
index 29511ec7..42364ba6 100644
--- a/server/src/actions/update.rs
+++ b/server/src/actions/update.rs
@@ -28,8 +28,7 @@
//! This module provides functions to work with `UPDATE` queries
//!
-use crate::corestore::Data;
-use crate::dbnet::connection::prelude::*;
+use crate::{corestore::Data, dbnet::connection::prelude::*};
action!(
/// Run an `UPDATE` query
diff --git a/server/src/actions/uset.rs b/server/src/actions/uset.rs
index b8e0101b..346458cf 100644
--- a/server/src/actions/uset.rs
+++ b/server/src/actions/uset.rs
@@ -24,11 +24,10 @@
*
*/
-use crate::corestore::Data;
-use crate::dbnet::connection::prelude::*;
-use crate::kvengine::encoding::ENCODING_LUT_ITER_PAIR;
-use crate::queryengine::ActionIter;
-use crate::util::compiler;
+use crate::{
+ corestore::Data, dbnet::connection::prelude::*, kvengine::encoding::ENCODING_LUT_ITER_PAIR,
+ queryengine::ActionIter, util::compiler,
+};
action!(
/// Run an `USET` query
diff --git a/server/src/admin/mksnap.rs b/server/src/admin/mksnap.rs
index cce96361..11448a4d 100644
--- a/server/src/admin/mksnap.rs
+++ b/server/src/admin/mksnap.rs
@@ -24,11 +24,14 @@
*
*/
-use crate::dbnet::connection::prelude::*;
-use crate::kvengine::encoding;
-use crate::storage::v1::sengine::SnapshotActionResult;
-use core::str;
-use std::path::{Component, PathBuf};
+use {
+ crate::{
+ dbnet::connection::prelude::*, kvengine::encoding,
+ storage::v1::sengine::SnapshotActionResult,
+ },
+ core::str,
+ std::path::{Component, PathBuf},
+};
action!(
/// Create a snapshot
diff --git a/server/src/admin/sys.rs b/server/src/admin/sys.rs
index 2bb280f2..eb4e8265 100644
--- a/server/src/admin/sys.rs
+++ b/server/src/admin/sys.rs
@@ -24,11 +24,13 @@
*
*/
-use crate::{
- corestore::booltable::BoolTable, dbnet::connection::prelude::*,
- storage::v1::interface::DIR_ROOT,
+use {
+ crate::{
+ corestore::booltable::BoolTable, dbnet::connection::prelude::*,
+ storage::v1::interface::DIR_ROOT,
+ },
+ libsky::VERSION,
};
-use ::libsky::VERSION;
const INFO: &[u8] = b"info";
const METRIC: &[u8] = b"metric";
diff --git a/server/src/arbiter.rs b/server/src/arbiter.rs
index 663d4399..f3f8d73c 100644
--- a/server/src/arbiter.rs
+++ b/server/src/arbiter.rs
@@ -24,27 +24,29 @@
*
*/
-use crate::{
- auth::AuthProvider,
- config::{ConfigurationSet, SnapshotConfig, SnapshotPref},
- corestore::Corestore,
- dbnet::{self, Terminator},
- diskstore::flock::FileLock,
- services,
- storage::v1::sengine::SnapshotEngine,
- util::{
- error::{Error, SkyResult},
- os::TerminationSignal,
+use {
+ crate::{
+ auth::AuthProvider,
+ config::{ConfigurationSet, SnapshotConfig, SnapshotPref},
+ corestore::Corestore,
+ dbnet::{self, Terminator},
+ diskstore::flock::FileLock,
+ services,
+ storage::v1::sengine::SnapshotEngine,
+ util::{
+ error::{Error, SkyResult},
+ os::TerminationSignal,
+ },
},
-};
-use std::{sync::Arc, thread::sleep};
-use tokio::{
- sync::{
- broadcast,
- mpsc::{self, Sender},
+ std::{sync::Arc, thread::sleep},
+ tokio::{
+ sync::{
+ broadcast,
+ mpsc::{self, Sender},
+ },
+ task::{self, JoinHandle},
+ time::Duration,
},
- task::{self, JoinHandle},
- time::Duration,
};
const TERMSIG_THRESHOLD: usize = 3;
diff --git a/server/src/auth/keys.rs b/server/src/auth/keys.rs
index b78703d4..f1f61732 100644
--- a/server/src/auth/keys.rs
+++ b/server/src/auth/keys.rs
@@ -24,8 +24,11 @@
*
*/
-use super::provider::{Authkey, AUTHKEY_SIZE};
-use crate::corestore::array::Array;
+use {
+ super::provider::{Authkey, AUTHKEY_SIZE},
+ crate::corestore::array::Array,
+};
+
type AuthkeyArray = Array;
const RAN_BYTES_SIZE: usize = 40;
diff --git a/server/src/auth/provider.rs b/server/src/auth/provider.rs
index 35ac27c3..19495138 100644
--- a/server/src/auth/provider.rs
+++ b/server/src/auth/provider.rs
@@ -24,13 +24,16 @@
*
*/
-use super::keys;
-use crate::actions::{ActionError, ActionResult};
-use crate::corestore::array::Array;
-use crate::corestore::htable::Coremap;
-use crate::protocol::interface::ProtocolSpec;
-use crate::util::err;
-use std::sync::Arc;
+use {
+ super::keys,
+ crate::{
+ actions::{ActionError, ActionResult},
+ corestore::{array::Array, htable::Coremap},
+ protocol::interface::ProtocolSpec,
+ util::err,
+ },
+ std::sync::Arc,
+};
// constants
/// Size of an authn key in bytes
diff --git a/server/src/auth/tests.rs b/server/src/auth/tests.rs
index a067eefe..1c773e4d 100644
--- a/server/src/auth/tests.rs
+++ b/server/src/auth/tests.rs
@@ -35,9 +35,11 @@ mod keys {
}
mod authn {
- use crate::actions::ActionError;
- use crate::auth::AuthProvider;
- use crate::protocol::{interface::ProtocolSpec, Skyhash2};
+ use crate::{
+ actions::ActionError,
+ auth::AuthProvider,
+ protocol::{interface::ProtocolSpec, Skyhash2},
+ };
const ORIG: &[u8; 40] = b"c4299d190fb9a00626797fcc138c56eae9971664";
diff --git a/server/src/config/cfgcli.rs b/server/src/config/cfgcli.rs
index ae369610..fd03da7e 100644
--- a/server/src/config/cfgcli.rs
+++ b/server/src/config/cfgcli.rs
@@ -24,8 +24,10 @@
*
*/
-use super::{ConfigSourceParseResult, Configset, TryFromConfigSource};
-use clap::ArgMatches;
+use {
+ super::{ConfigSourceParseResult, Configset, TryFromConfigSource},
+ clap::ArgMatches,
+};
/// A flag. The flag is said to be set if `self.set` is true and unset if `self.set` is false. However,
/// if the flag is set, the value of SWITCH determines what value it is set to
diff --git a/server/src/config/cfgfile.rs b/server/src/config/cfgfile.rs
index 3748a4b0..d3283768 100644
--- a/server/src/config/cfgfile.rs
+++ b/server/src/config/cfgfile.rs
@@ -24,12 +24,14 @@
*
*/
-use super::{
- AuthSettings, ConfigSourceParseResult, Configset, Modeset, OptString, ProtocolVersion,
- TryFromConfigSource,
+use {
+ super::{
+ AuthSettings, ConfigSourceParseResult, Configset, Modeset, OptString, ProtocolVersion,
+ TryFromConfigSource,
+ },
+ serde::Deserialize,
+ std::net::IpAddr,
};
-use serde::Deserialize;
-use std::net::IpAddr;
/// This struct is an _object representation_ used for parsing the TOML file
#[derive(Deserialize, Debug, PartialEq)]
diff --git a/server/src/config/definitions.rs b/server/src/config/definitions.rs
index 7eda5e9d..9268187d 100644
--- a/server/src/config/definitions.rs
+++ b/server/src/config/definitions.rs
@@ -24,16 +24,16 @@
*
*/
-use super::{feedback::WarningStack, DEFAULT_IPV4, DEFAULT_PORT};
-use crate::config::AuthkeyWrapper;
-use crate::dbnet::MAXIMUM_CONNECTION_LIMIT;
-use core::fmt;
-use core::str::FromStr;
-use serde::{
- de::{self, Deserializer, Visitor},
- Deserialize,
+use {
+ super::{feedback::WarningStack, DEFAULT_IPV4, DEFAULT_PORT},
+ crate::{config::AuthkeyWrapper, dbnet::MAXIMUM_CONNECTION_LIMIT},
+ core::{fmt, str::FromStr},
+ serde::{
+ de::{self, Deserializer, Visitor},
+ Deserialize,
+ },
+ std::net::IpAddr,
};
-use std::net::IpAddr;
/// The BGSAVE configuration
///
diff --git a/server/src/config/feedback.rs b/server/src/config/feedback.rs
index e0d0374d..eb797ec3 100644
--- a/server/src/config/feedback.rs
+++ b/server/src/config/feedback.rs
@@ -24,16 +24,14 @@
*
*/
-// external imports
-use toml::de::Error as TomlError;
-// std imports
-use core::fmt;
-use core::ops;
-use std::io::Error as IoError;
-// internal imports
-use super::{ConfigurationSet, SnapshotConfig, SnapshotPref};
#[cfg(unix)]
use crate::util::os::ResourceLimit;
+use {
+ super::{ConfigurationSet, SnapshotConfig, SnapshotPref},
+ core::{fmt, ops},
+ std::io::Error as IoError,
+ toml::de::Error as TomlError,
+};
#[cfg(test)]
const EMSG_ENV: &str = "Environment";
diff --git a/server/src/config/mod.rs b/server/src/config/mod.rs
index cf3ca67b..1d3d7b61 100644
--- a/server/src/config/mod.rs
+++ b/server/src/config/mod.rs
@@ -24,14 +24,16 @@
*
*/
-// external imports
-use crate::auth::provider::Authkey;
-use clap::{load_yaml, App};
-// std imports
-use core::str::FromStr;
-use std::env::VarError;
-use std::fs;
-use std::net::{IpAddr, Ipv4Addr};
+use {
+ crate::auth::provider::Authkey,
+ clap::{load_yaml, App},
+ core::str::FromStr,
+ std::{
+ env::VarError,
+ fs,
+ net::{IpAddr, Ipv4Addr},
+ },
+};
// internal modules
mod cfgcli;
diff --git a/server/src/config/tests.rs b/server/src/config/tests.rs
index 5822bd5a..0b644be7 100644
--- a/server/src/config/tests.rs
+++ b/server/src/config/tests.rs
@@ -24,9 +24,11 @@
*
*/
-use super::{BGSave, Configset, PortConfig, SnapshotConfig, SnapshotPref, SslOpts, DEFAULT_IPV4};
-use crate::ROOT_DIR;
-use std::fs;
+use {
+ super::{BGSave, Configset, PortConfig, SnapshotConfig, SnapshotPref, SslOpts, DEFAULT_IPV4},
+ crate::ROOT_DIR,
+ std::fs,
+};
// server tests
// TCP
diff --git a/server/src/corestore/array.rs b/server/src/corestore/array.rs
index 3ba112c5..542f23ef 100644
--- a/server/src/corestore/array.rs
+++ b/server/src/corestore/array.rs
@@ -24,22 +24,20 @@
*
*/
-use bytes::Bytes;
-use core::any;
-use core::borrow::Borrow;
-use core::borrow::BorrowMut;
-use core::cmp::Ordering;
-use core::convert::TryFrom;
-use core::fmt;
-use core::hash::Hash;
-use core::hash::Hasher;
-use core::iter::FromIterator;
-use core::mem::ManuallyDrop;
-use core::mem::MaybeUninit;
-use core::ops;
-use core::ptr;
-use core::slice;
-use core::str;
+use {
+ bytes::Bytes,
+ core::{
+ any,
+ borrow::{Borrow, BorrowMut},
+ cmp::Ordering,
+ convert::TryFrom,
+ fmt,
+ hash::{Hash, Hasher},
+ iter::FromIterator,
+ mem::{ManuallyDrop, MaybeUninit},
+ ops, ptr, slice, str,
+ },
+};
/// A compile-time, fixed size array that can have unintialized memory. This array is as
/// efficient as you'd expect a normal array to be, but with the added benefit that you
diff --git a/server/src/corestore/backoff.rs b/server/src/corestore/backoff.rs
index 0374bc52..adebc101 100644
--- a/server/src/corestore/backoff.rs
+++ b/server/src/corestore/backoff.rs
@@ -24,9 +24,7 @@
*
*/
-use std::cell::Cell;
-use std::hint::spin_loop;
-use std::thread;
+use std::{cell::Cell, hint::spin_loop, thread};
/// Type to perform exponential backoff
pub struct Backoff {
diff --git a/server/src/corestore/buffers.rs b/server/src/corestore/buffers.rs
index d66e2e93..7987de75 100644
--- a/server/src/corestore/buffers.rs
+++ b/server/src/corestore/buffers.rs
@@ -24,9 +24,10 @@
*
*/
-use super::array::Array;
-use core::ops::Deref;
-use core::str;
+use {
+ super::array::Array,
+ core::{ops::Deref, str},
+};
macro_rules! push_self {
($self:expr, $what:expr) => {
diff --git a/server/src/corestore/heap_array.rs b/server/src/corestore/heap_array.rs
index a75f7f81..cf5f72e3 100644
--- a/server/src/corestore/heap_array.rs
+++ b/server/src/corestore/heap_array.rs
@@ -24,8 +24,10 @@
*
*/
-use core::{alloc::Layout, fmt, marker::PhantomData, mem::ManuallyDrop, ops::Deref, ptr, slice};
-use std::alloc::dealloc;
+use {
+ core::{alloc::Layout, fmt, marker::PhantomData, mem::ManuallyDrop, ops::Deref, ptr, slice},
+ std::alloc::dealloc,
+};
/// A heap-allocated array
pub struct HeapArray {
diff --git a/server/src/corestore/htable.rs b/server/src/corestore/htable.rs
index 97e0167b..0be8947c 100644
--- a/server/src/corestore/htable.rs
+++ b/server/src/corestore/htable.rs
@@ -26,17 +26,16 @@
#![allow(unused)] // TODO(@ohsayan): Plonk this
-use crate::corestore::map::{
- bref::{Entry, OccupiedEntry, Ref, VacantEntry},
- iter::{BorrowedIter, OwnedIter},
- Skymap,
+use {
+ crate::corestore::map::{
+ bref::{Entry, OccupiedEntry, Ref, VacantEntry},
+ iter::{BorrowedIter, OwnedIter},
+ Skymap,
+ },
+ ahash::RandomState,
+ bytes::Bytes,
+ std::{borrow::Borrow, hash::Hash, iter::FromIterator, ops::Deref},
};
-use ahash::RandomState;
-use bytes::Bytes;
-use std::borrow::Borrow;
-use std::hash::Hash;
-use std::iter::FromIterator;
-use std::ops::Deref;
type HashTable = Skymap;
diff --git a/server/src/corestore/iarray.rs b/server/src/corestore/iarray.rs
index e32756ba..f081b497 100644
--- a/server/src/corestore/iarray.rs
+++ b/server/src/corestore/iarray.rs
@@ -26,22 +26,21 @@
#![allow(dead_code)] // TODO(@ohsayan): Remove this lint or remove offending methods
-use crate::corestore::array::LenScopeGuard;
-use core::alloc::Layout;
-use core::borrow::Borrow;
-use core::borrow::BorrowMut;
-use core::cmp;
-use core::fmt;
-use core::hash::{self, Hash};
-use core::iter::FromIterator;
-use core::mem;
-use core::mem::ManuallyDrop;
-use core::mem::MaybeUninit;
-use core::ops;
-use core::ptr;
-use core::ptr::NonNull;
-use core::slice;
-use std::alloc as std_alloc;
+use {
+ crate::corestore::array::LenScopeGuard,
+ core::{
+ alloc::Layout,
+ borrow::{Borrow, BorrowMut},
+ cmp, fmt,
+ hash::{self, Hash},
+ iter::FromIterator,
+ mem::{self, ManuallyDrop, MaybeUninit},
+ ops,
+ ptr::{self, NonNull},
+ slice,
+ },
+ std::alloc as std_alloc,
+};
pub const fn new_const_iarray() -> IArray<[T; N]> {
IArray {
diff --git a/server/src/corestore/lazy.rs b/server/src/corestore/lazy.rs
index 30cb7bdb..1421e21d 100644
--- a/server/src/corestore/lazy.rs
+++ b/server/src/corestore/lazy.rs
@@ -24,13 +24,15 @@
*
*/
-use super::backoff::Backoff;
-use core::mem;
-use core::ops::Deref;
-use core::ptr;
-use core::sync::atomic::AtomicBool;
-use core::sync::atomic::AtomicPtr;
-use core::sync::atomic::Ordering;
+use {
+ super::backoff::Backoff,
+ core::{
+ mem,
+ ops::Deref,
+ ptr,
+ sync::atomic::{AtomicBool, AtomicPtr, Ordering},
+ },
+};
const ORD_ACQ: Ordering = Ordering::Acquire;
const ORD_SEQ: Ordering = Ordering::SeqCst;
diff --git a/server/src/corestore/lock.rs b/server/src/corestore/lock.rs
index b2cbb1c8..dbcaf7f5 100644
--- a/server/src/corestore/lock.rs
+++ b/server/src/corestore/lock.rs
@@ -31,12 +31,14 @@
//! the primitives that are defined here
//!
-use super::backoff::Backoff;
-use std::cell::UnsafeCell;
-use std::ops::Deref;
-use std::ops::DerefMut;
-use std::sync::atomic::AtomicBool;
-use std::sync::atomic::Ordering;
+use {
+ super::backoff::Backoff,
+ std::{
+ cell::UnsafeCell,
+ ops::{Deref, DerefMut},
+ sync::atomic::{AtomicBool, Ordering},
+ },
+};
const ORD_ACQUIRE: Ordering = Ordering::Acquire;
const ORD_RELEASE: Ordering = Ordering::Release;
diff --git a/server/src/corestore/map/bref.rs b/server/src/corestore/map/bref.rs
index 7242b18b..7dbd3fcb 100644
--- a/server/src/corestore/map/bref.rs
+++ b/server/src/corestore/map/bref.rs
@@ -24,18 +24,17 @@
*
*/
-use super::LowMap;
-use crate::util::compiler;
-use crate::util::Unwrappable;
-use core::hash::BuildHasher;
-use core::hash::Hash;
-use core::mem;
-use core::ops::Deref;
-use core::ops::DerefMut;
-use parking_lot::RwLockReadGuard;
-use parking_lot::RwLockWriteGuard;
-use std::collections::hash_map::RandomState;
-use std::sync::Arc;
+use {
+ super::LowMap,
+ crate::util::{compiler, Unwrappable},
+ core::{
+ hash::{BuildHasher, Hash},
+ mem,
+ ops::{Deref, DerefMut},
+ },
+ parking_lot::{RwLockReadGuard, RwLockWriteGuard},
+ std::{collections::hash_map::RandomState, sync::Arc},
+};
/// A read-only reference to a bucket
pub struct Ref<'a, K, V> {
diff --git a/server/src/corestore/map/iter.rs b/server/src/corestore/map/iter.rs
index c36a3b71..ca013d4f 100644
--- a/server/src/corestore/map/iter.rs
+++ b/server/src/corestore/map/iter.rs
@@ -24,15 +24,13 @@
*
*/
-use super::bref::RefMulti;
-use super::LowMap;
-use super::Skymap;
-use core::mem;
-use hashbrown::raw::RawIntoIter;
-use hashbrown::raw::RawIter;
-use parking_lot::RwLockReadGuard;
-use std::collections::hash_map::RandomState;
-use std::sync::Arc;
+use {
+ super::{bref::RefMulti, LowMap, Skymap},
+ core::mem,
+ hashbrown::raw::{RawIntoIter, RawIter},
+ parking_lot::RwLockReadGuard,
+ std::{collections::hash_map::RandomState, sync::Arc},
+};
/// An owned iterator for a [`Skymap`]
pub struct OwnedIter {
diff --git a/server/src/corestore/map/mod.rs b/server/src/corestore/map/mod.rs
index 5ca86106..a7c0f600 100644
--- a/server/src/corestore/map/mod.rs
+++ b/server/src/corestore/map/mod.rs
@@ -27,24 +27,26 @@
#![allow(clippy::manual_map)] // avoid LLVM bloat
#![allow(unused)] // TODO(@ohsayan): Plonk this
-use crate::util::compiler;
-use core::borrow::Borrow;
-use core::fmt;
-use core::hash::BuildHasher;
-use core::hash::Hash;
-use core::hash::Hasher;
-use core::iter::FromIterator;
-use core::mem;
-use parking_lot::RwLock;
-use parking_lot::RwLockReadGuard;
-use parking_lot::RwLockWriteGuard;
-use std::collections::hash_map::RandomState;
-use std::num::NonZeroUsize;
-use std::thread::available_parallelism;
+use {
+ self::{
+ bref::{Entry, OccupiedEntry, Ref, RefMut, VacantEntry},
+ iter::{BorrowedIter, OwnedIter},
+ },
+ crate::util::compiler,
+ core::{
+ borrow::Borrow,
+ fmt,
+ hash::{BuildHasher, Hash, Hasher},
+ iter::FromIterator,
+ mem,
+ num::NonZeroUsize,
+ },
+ parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard},
+ std::{collections::hash_map::RandomState, thread::available_parallelism},
+};
+
pub mod bref;
-use iter::{BorrowedIter, OwnedIter};
pub mod iter;
-use bref::{Entry, OccupiedEntry, Ref, RefMut, VacantEntry};
type LowMap = hashbrown::raw::RawTable<(K, V)>;
type ShardSlice = [RwLock>];
diff --git a/server/src/corestore/memstore.rs b/server/src/corestore/memstore.rs
index 6fb5d553..697dc952 100644
--- a/server/src/corestore/memstore.rs
+++ b/server/src/corestore/memstore.rs
@@ -54,17 +54,21 @@
//! So, all your data is at the mercy of [`Memstore`]'s constructor
//! and destructor.
-use super::KeyspaceResult;
-use crate::auth::Authmap;
-use crate::corestore::array::Array;
-use crate::corestore::htable::Coremap;
-use crate::corestore::table::Table;
-use crate::corestore::table::{SystemDataModel, SystemTable};
-use crate::registry;
-use crate::util::Wrapper;
-use core::borrow::Borrow;
-use core::hash::Hash;
-use std::sync::Arc;
+use {
+ super::KeyspaceResult,
+ crate::{
+ auth::Authmap,
+ corestore::{
+ array::Array,
+ htable::Coremap,
+ table::{SystemDataModel, SystemTable, Table},
+ },
+ registry,
+ util::Wrapper,
+ },
+ core::{borrow::Borrow, hash::Hash},
+ std::sync::Arc,
+};
uninit_array! {
const DEFAULT_ARRAY: [u8; 64] = [b'd', b'e', b'f', b'a', b'u', b'l', b't'];
diff --git a/server/src/corestore/table.rs b/server/src/corestore/table.rs
index 8642d8a6..0b64b675 100644
--- a/server/src/corestore/table.rs
+++ b/server/src/corestore/table.rs
@@ -24,16 +24,17 @@
*
*/
-use crate::actions::ActionResult;
-use crate::auth::Authmap;
-use crate::corestore::htable::Coremap;
-use crate::corestore::Data;
#[cfg(test)]
use crate::corestore::{memstore::DdlError, KeyspaceResult};
-use crate::dbnet::connection::prelude::Corestore;
-use crate::kvengine::{KVEListmap, KVEStandard, LockedVec};
-use crate::protocol::interface::ProtocolSpec;
-use crate::util;
+use crate::{
+ actions::ActionResult,
+ auth::Authmap,
+ corestore::{htable::Coremap, Data},
+ dbnet::connection::prelude::Corestore,
+ kvengine::{KVEListmap, KVEStandard, LockedVec},
+ protocol::interface::ProtocolSpec,
+ util,
+};
pub trait DescribeTable {
type Table;
diff --git a/server/src/corestore/tests.rs b/server/src/corestore/tests.rs
index 4e6c85a5..2b334482 100644
--- a/server/src/corestore/tests.rs
+++ b/server/src/corestore/tests.rs
@@ -25,8 +25,7 @@
*/
mod memstore_keyspace_tests {
- use super::super::memstore::*;
- use super::super::table::Table;
+ use super::super::{memstore::*, table::Table};
#[test]
fn test_drop_keyspace_empty() {
@@ -121,9 +120,11 @@ mod memstore_keyspace_tests {
}
mod modelcode_tests {
- use super::super::table::Table;
- use crate::kvengine::KVEListmap;
- use crate::kvengine::KVEngine;
+ use {
+ super::super::table::Table,
+ crate::kvengine::{KVEListmap, KVEngine},
+ };
+
#[test]
fn test_model_code_pure_kve() {
// binstr, binstr
diff --git a/server/src/dbnet/connection.rs b/server/src/dbnet/connection.rs
index 29ca7aef..f2ad8253 100644
--- a/server/src/dbnet/connection.rs
+++ b/server/src/dbnet/connection.rs
@@ -35,28 +35,30 @@
//! enables this connection object/type to use methods like read_query enabling it to read and interact with queries and write
//! respones in compliance with the Skyhash protocol.
-use crate::{
- actions::{ActionError, ActionResult},
- auth::AuthProvider,
- corestore::Corestore,
- dbnet::{
- connection::prelude::FutureResult,
- tcp::{BufferedSocketStream, Connection},
- Terminator,
- },
- protocol::{
- interface::{ProtocolRead, ProtocolSpec, ProtocolWrite},
- Query,
- },
- queryengine, IoResult,
-};
-use bytes::{Buf, BytesMut};
#[cfg(windows)]
use std::io::ErrorKind;
-use std::{marker::PhantomData, sync::Arc};
-use tokio::{
- io::{AsyncReadExt, AsyncWriteExt, BufWriter},
- sync::{mpsc, Semaphore},
+use {
+ crate::{
+ actions::{ActionError, ActionResult},
+ auth::AuthProvider,
+ corestore::Corestore,
+ dbnet::{
+ connection::prelude::FutureResult,
+ tcp::{BufferedSocketStream, Connection},
+ Terminator,
+ },
+ protocol::{
+ interface::{ProtocolRead, ProtocolSpec, ProtocolWrite},
+ Query,
+ },
+ queryengine, IoResult,
+ },
+ bytes::{Buf, BytesMut},
+ std::{marker::PhantomData, sync::Arc},
+ tokio::{
+ io::{AsyncReadExt, AsyncWriteExt, BufWriter},
+ sync::{mpsc, Semaphore},
+ },
};
pub type QueryWithAdvance = (Query, usize);
diff --git a/server/src/dbnet/mod.rs b/server/src/dbnet/mod.rs
index 3eb71665..90eb6267 100644
--- a/server/src/dbnet/mod.rs
+++ b/server/src/dbnet/mod.rs
@@ -58,6 +58,7 @@ use {
sync::{broadcast, mpsc, Semaphore},
},
};
+
pub mod connection;
#[macro_use]
mod macros;
diff --git a/server/src/diskstore/flock.rs b/server/src/diskstore/flock.rs
index 547542ad..3fbc32dd 100644
--- a/server/src/diskstore/flock.rs
+++ b/server/src/diskstore/flock.rs
@@ -166,18 +166,27 @@ mod __sys {
//! # Windows platform-specific file locking
//! This module contains methods used by the `FileLock` object in this module to lock and/or
//! unlock files.
- use std::fs::File;
- use std::io::{Error, Result};
- use std::mem;
- use std::os::windows::io::AsRawHandle;
- use std::os::windows::io::FromRawHandle;
- use std::ptr;
- use winapi::shared::minwindef::{BOOL, DWORD};
- use winapi::um::fileapi::{LockFileEx, UnlockFile};
- use winapi::um::handleapi::DuplicateHandle;
- use winapi::um::minwinbase::{LOCKFILE_EXCLUSIVE_LOCK, LOCKFILE_FAIL_IMMEDIATELY};
- use winapi::um::processthreadsapi::GetCurrentProcess;
- use winapi::um::winnt::{DUPLICATE_SAME_ACCESS, MAXDWORD};
+
+ use {
+ std::{
+ fs::File,
+ io::{Error, Result},
+ mem,
+ os::windows::io::{AsRawHandle, FromRawHandle},
+ ptr,
+ },
+ winapi::{
+ shared::minwindef::{BOOL, DWORD},
+ um::{
+ fileapi::{LockFileEx, UnlockFile},
+ handleapi::DuplicateHandle,
+ minwinbase::{LOCKFILE_EXCLUSIVE_LOCK, LOCKFILE_FAIL_IMMEDIATELY},
+ processthreadsapi::GetCurrentProcess,
+ winnt::{DUPLICATE_SAME_ACCESS, MAXDWORD},
+ },
+ },
+ };
+
/// Obtain an exclusive lock and **block** until we acquire it
pub fn lock_ex(file: &File) -> Result<()> {
lock_file(file, LOCKFILE_EXCLUSIVE_LOCK)
@@ -259,12 +268,14 @@ mod __sys {
//! # Unix platform-specific file locking
//! This module contains methods used by the `FileLock` object in this module to lock and/or
//! unlock files.
- use libc::c_int;
- use std::fs::File;
- use std::io::Error;
- use std::io::Result;
- use std::os::unix::io::AsRawFd;
- use std::os::unix::io::FromRawFd;
+ use {
+ libc::c_int,
+ std::{
+ fs::File,
+ io::{Error, Result},
+ os::unix::io::{AsRawFd, FromRawFd},
+ },
+ };
extern "C" {
/// Block and acquire an exclusive lock with `libc`'s `flock`
@@ -327,11 +338,11 @@ mod __sys {
#[cfg(all(target_os = "solaris", unix))]
mod __sys {
//! Solaris doesn't have flock so we'll have to simulate that using fcntl
- use std::fs::File;
- use std::io::Error;
- use std::io::Result;
- use std::os::unix::io::AsRawFd;
- use std::os::unix::io::FromRawFd;
+ use std::{
+ fs::File,
+ io::{Error, Result},
+ os::unix::io::{AsRawFd, FromRawFd},
+ };
fn simulate_flock(file: &File, flag: libc::c_int) -> Result<()> {
let mut fle = libc::flock {
diff --git a/server/src/kvengine/encoding.rs b/server/src/kvengine/encoding.rs
index 2ca07a73..6f43ae39 100644
--- a/server/src/kvengine/encoding.rs
+++ b/server/src/kvengine/encoding.rs
@@ -54,10 +54,10 @@
* - Sayan N. (July, 2021)
*/
-use crate::corestore::booltable::BoolTable;
-use crate::corestore::booltable::TwoBitLUT;
-use crate::protocol::iter::AnyArrayIter;
-use crate::protocol::iter::BorrowedAnyArrayIter;
+use crate::{
+ corestore::booltable::{BoolTable, TwoBitLUT},
+ protocol::iter::{AnyArrayIter, BorrowedAnyArrayIter},
+};
type PairFn = fn(&[u8], &[u8]) -> bool;
diff --git a/server/src/kvengine/mod.rs b/server/src/kvengine/mod.rs
index 881fcdca..b13eb250 100644
--- a/server/src/kvengine/mod.rs
+++ b/server/src/kvengine/mod.rs
@@ -30,10 +30,14 @@ pub mod encoding;
#[cfg(test)]
mod tests;
-use self::encoding::{ENCODING_LUT, ENCODING_LUT_PAIR};
-use crate::corestore::{booltable::BoolTable, htable::Coremap, map::bref::Ref, Data};
-use crate::util::compiler;
-use parking_lot::RwLock;
+use {
+ self::encoding::{ENCODING_LUT, ENCODING_LUT_PAIR},
+ crate::{
+ corestore::{booltable::BoolTable, htable::Coremap, map::bref::Ref, Data},
+ util::compiler,
+ },
+ parking_lot::RwLock,
+};
pub type KVEStandard = KVEngine;
pub type KVEListmap = KVEngine;
diff --git a/server/src/protocol/interface.rs b/server/src/protocol/interface.rs
index 654c5d35..5a592ba2 100644
--- a/server/src/protocol/interface.rs
+++ b/server/src/protocol/interface.rs
@@ -24,18 +24,20 @@
*
*/
-use super::ParseError;
-use crate::{
- corestore::{
- booltable::{BytesBoolTable, BytesNicheLUT},
- buffers::Integer64,
+use {
+ super::ParseError,
+ crate::{
+ corestore::{
+ booltable::{BytesBoolTable, BytesNicheLUT},
+ buffers::Integer64,
+ },
+ dbnet::connection::{QueryResult, QueryWithAdvance, RawConnection, Stream},
+ util::FutureResult,
+ IoResult,
},
- dbnet::connection::{QueryResult, QueryWithAdvance, RawConnection, Stream},
- util::FutureResult,
- IoResult,
+ std::io::{Error as IoError, ErrorKind},
+ tokio::io::{AsyncReadExt, AsyncWriteExt, BufWriter},
};
-use std::io::{Error as IoError, ErrorKind};
-use tokio::io::{AsyncReadExt, AsyncWriteExt, BufWriter};
/*
NOTE TO SELF (@ohsayan): Why do we split everything into separate traits? To avoid mistakes
diff --git a/server/src/protocol/iter.rs b/server/src/protocol/iter.rs
index 82b51d7b..9ea7f54f 100644
--- a/server/src/protocol/iter.rs
+++ b/server/src/protocol/iter.rs
@@ -24,9 +24,11 @@
*
*/
-use super::UnsafeSlice;
-use bytes::Bytes;
-use core::{hint::unreachable_unchecked, iter::FusedIterator, ops::Deref, slice::Iter};
+use {
+ super::UnsafeSlice,
+ bytes::Bytes,
+ core::{hint::unreachable_unchecked, iter::FusedIterator, ops::Deref, slice::Iter},
+};
/// An iterator over an [`AnyArray`] (an [`UnsafeSlice`]). The validity of the iterator is
/// left to the caller who has to guarantee:
diff --git a/server/src/protocol/v1/benches.rs b/server/src/protocol/v1/benches.rs
index a47bb970..ed6d6d56 100644
--- a/server/src/protocol/v1/benches.rs
+++ b/server/src/protocol/v1/benches.rs
@@ -25,8 +25,10 @@
*/
extern crate test;
-use super::{super::Query, Parser};
-use test::Bencher;
+use {
+ super::{super::Query, Parser},
+ test::Bencher,
+};
#[bench]
fn simple_query(b: &mut Bencher) {
diff --git a/server/src/protocol/v2/benches.rs b/server/src/protocol/v2/benches.rs
index c1e195f4..ff41a812 100644
--- a/server/src/protocol/v2/benches.rs
+++ b/server/src/protocol/v2/benches.rs
@@ -25,8 +25,10 @@
*/
extern crate test;
-use super::{super::Query, Parser};
-use test::Bencher;
+use {
+ super::{super::Query, Parser},
+ test::Bencher,
+};
#[bench]
fn simple_query(b: &mut Bencher) {
diff --git a/server/src/protocol/v2/interface_impls.rs b/server/src/protocol/v2/interface_impls.rs
index 36752980..1d36ecb6 100644
--- a/server/src/protocol/v2/interface_impls.rs
+++ b/server/src/protocol/v2/interface_impls.rs
@@ -24,18 +24,20 @@
*
*/
-use crate::{
- corestore::buffers::Integer64,
- dbnet::connection::{QueryWithAdvance, RawConnection, Stream},
- protocol::{
- interface::{ProtocolRead, ProtocolSpec, ProtocolWrite},
- ParseError, Skyhash2,
+use {
+ crate::{
+ corestore::buffers::Integer64,
+ dbnet::connection::{QueryWithAdvance, RawConnection, Stream},
+ protocol::{
+ interface::{ProtocolRead, ProtocolSpec, ProtocolWrite},
+ ParseError, Skyhash2,
+ },
+ util::FutureResult,
+ IoResult,
},
- util::FutureResult,
- IoResult,
+ ::sky_macros::compiled_eresp_bytes as eresp,
+ tokio::io::AsyncWriteExt,
};
-use ::sky_macros::compiled_eresp_bytes as eresp;
-use tokio::io::AsyncWriteExt;
impl ProtocolSpec for Skyhash2 {
// spec information
diff --git a/server/src/protocol/v2/tests.rs b/server/src/protocol/v2/tests.rs
index e0c5179b..0cb56883 100644
--- a/server/src/protocol/v2/tests.rs
+++ b/server/src/protocol/v2/tests.rs
@@ -24,13 +24,14 @@
*
*/
-use super::{
- super::raw_parser::{RawParser, RawParserExt, RawParserMeta},
- Parser, PipelinedQuery, Query, SimpleQuery,
+use {
+ super::{
+ super::raw_parser::{RawParser, RawParserExt, RawParserMeta},
+ Parser, PipelinedQuery, Query, SimpleQuery,
+ },
+ crate::protocol::{iter::AnyArrayIter, ParseError},
+ std::{iter::Map, vec::IntoIter as VecIntoIter},
};
-use crate::protocol::{iter::AnyArrayIter, ParseError};
-use std::iter::Map;
-use std::vec::IntoIter as VecIntoIter;
type IterPacketWithLen = Map>, fn(Vec) -> (usize, Vec)>;
type Packets = Vec>;
diff --git a/server/src/queryengine/mod.rs b/server/src/queryengine/mod.rs
index 16622739..ca5f55f0 100644
--- a/server/src/queryengine/mod.rs
+++ b/server/src/queryengine/mod.rs
@@ -26,12 +26,11 @@
//! # The Query Engine
-use crate::corestore::Corestore;
-use crate::dbnet::connection::prelude::*;
-
use crate::{
actions::{self, ActionError, ActionResult},
admin, auth, blueql,
+ corestore::Corestore,
+ dbnet::connection::prelude::*,
protocol::{iter::AnyArrayIter, PipelinedQuery, SimpleQuery, UnsafeSlice},
};
diff --git a/server/src/registry/mod.rs b/server/src/registry/mod.rs
index 1f13ed34..5c5298c4 100644
--- a/server/src/registry/mod.rs
+++ b/server/src/registry/mod.rs
@@ -29,9 +29,10 @@
//! The registry module provides interfaces for system-wide, global state management
//!
-use crate::corestore::lock::{QLGuard, QuickLock};
-use core::sync::atomic::AtomicBool;
-use core::sync::atomic::Ordering;
+use {
+ crate::corestore::lock::{QLGuard, QuickLock},
+ core::sync::atomic::{AtomicBool, Ordering},
+};
const ORD_ACQ: Ordering = Ordering::Acquire;
const ORD_REL: Ordering = Ordering::Release;
diff --git a/server/src/services/bgsave.rs b/server/src/services/bgsave.rs
index 63b17053..aa55823a 100644
--- a/server/src/services/bgsave.rs
+++ b/server/src/services/bgsave.rs
@@ -24,15 +24,17 @@
*
*/
-use crate::{
- config::BGSave,
- corestore::Corestore,
- dbnet::Terminator,
- registry,
- storage::{self, v1::flush::Autoflush},
- IoResult,
+use {
+ crate::{
+ config::BGSave,
+ corestore::Corestore,
+ dbnet::Terminator,
+ registry,
+ storage::{self, v1::flush::Autoflush},
+ IoResult,
+ },
+ tokio::time::{self, Duration},
};
-use tokio::time::{self, Duration};
/// The bgsave_scheduler calls the bgsave task in `Corestore` after `every` seconds
///
diff --git a/server/src/services/mod.rs b/server/src/services/mod.rs
index 19f6caaa..b294b186 100644
--- a/server/src/services/mod.rs
+++ b/server/src/services/mod.rs
@@ -26,11 +26,9 @@
pub mod bgsave;
pub mod snapshot;
-use crate::corestore::memstore::Memstore;
-use crate::diskstore::flock::FileLock;
-use crate::storage;
-use crate::util::os;
-use crate::IoResult;
+use crate::{
+ corestore::memstore::Memstore, diskstore::flock::FileLock, storage, util::os, IoResult,
+};
pub fn restore_data(src: Option) -> IoResult<()> {
if let Some(src) = src {
diff --git a/server/src/services/snapshot.rs b/server/src/services/snapshot.rs
index c07d0060..889551fd 100644
--- a/server/src/services/snapshot.rs
+++ b/server/src/services/snapshot.rs
@@ -24,13 +24,17 @@
*
*/
-use crate::config::SnapshotConfig;
-use crate::corestore::Corestore;
-use crate::dbnet::Terminator;
-use crate::registry;
-use crate::storage::v1::sengine::{SnapshotActionResult, SnapshotEngine};
-use std::sync::Arc;
-use tokio::time::{self, Duration};
+use {
+ crate::{
+ config::SnapshotConfig,
+ corestore::Corestore,
+ dbnet::Terminator,
+ registry,
+ storage::v1::sengine::{SnapshotActionResult, SnapshotEngine},
+ },
+ std::sync::Arc,
+ tokio::time::{self, Duration},
+};
/// The snapshot service
///
diff --git a/server/src/storage/v1/error.rs b/server/src/storage/v1/error.rs
index 64a65a14..b7b05c4b 100644
--- a/server/src/storage/v1/error.rs
+++ b/server/src/storage/v1/error.rs
@@ -24,9 +24,7 @@
*
*/
-use crate::corestore::memstore::ObjectID;
-use core::fmt;
-use std::io::Error as IoError;
+use {crate::corestore::memstore::ObjectID, core::fmt, std::io::Error as IoError};
pub type StorageEngineResult = Result;
diff --git a/server/src/storage/v1/flush.rs b/server/src/storage/v1/flush.rs
index 89b7caea..f11e690c 100644
--- a/server/src/storage/v1/flush.rs
+++ b/server/src/storage/v1/flush.rs
@@ -29,19 +29,22 @@
//! This module contains multiple flush routines: at the memstore level, the keyspace level and
//! the table level
-use super::{bytemarks, interface};
-use crate::corestore::memstore::SYSTEM;
-use crate::corestore::{
- map::iter::BorrowedIter,
- memstore::{Keyspace, Memstore, ObjectID, SystemKeyspace},
- table::{DataModel, SystemDataModel, SystemTable, Table},
+use {
+ super::{bytemarks, interface},
+ crate::{
+ corestore::{
+ map::iter::BorrowedIter,
+ memstore::SYSTEM,
+ memstore::{Keyspace, Memstore, ObjectID, SystemKeyspace},
+ table::{DataModel, SystemDataModel, SystemTable, Table},
+ },
+ registry,
+ util::Wrapper,
+ IoResult,
+ },
+ core::ops::Deref,
+ std::{io::Write, sync::Arc},
};
-use crate::registry;
-use crate::util::Wrapper;
-use crate::IoResult;
-use core::ops::Deref;
-use std::io::Write;
-use std::sync::Arc;
pub trait StorageTarget {
/// This storage target needs a reinit of the tree despite no preload trip.
diff --git a/server/src/storage/v1/interface.rs b/server/src/storage/v1/interface.rs
index 6fa99484..2eb65bbb 100644
--- a/server/src/storage/v1/interface.rs
+++ b/server/src/storage/v1/interface.rs
@@ -26,16 +26,20 @@
//! Interfaces with the file system
-use crate::corestore::memstore::Memstore;
-use crate::registry;
-use crate::storage::v1::flush::FlushableKeyspace;
-use crate::storage::v1::flush::FlushableTable;
-use crate::storage::v1::flush::StorageTarget;
-use crate::IoResult;
-use core::ops::Deref;
-use std::collections::HashSet;
-use std::fs;
-use std::io::{BufWriter, Write};
+use {
+ crate::{
+ corestore::memstore::Memstore,
+ registry,
+ storage::v1::flush::{FlushableKeyspace, FlushableTable, StorageTarget},
+ IoResult,
+ },
+ core::ops::Deref,
+ std::{
+ collections::HashSet,
+ fs,
+ io::{BufWriter, Write},
+ },
+};
pub const DIR_KSROOT: &str = "data/ks";
pub const DIR_SNAPROOT: &str = "data/snaps";
diff --git a/server/src/storage/v1/iter.rs b/server/src/storage/v1/iter.rs
index b24b8858..cbd632fe 100644
--- a/server/src/storage/v1/iter.rs
+++ b/server/src/storage/v1/iter.rs
@@ -33,10 +33,10 @@
and we won't read into others' memory (or corrupt our own).
*/
-use crate::storage::v1::Data;
-use core::mem;
-use core::ptr;
-use core::slice;
+use {
+ crate::storage::v1::Data,
+ core::{mem, ptr, slice},
+};
const SIZE_64BIT: usize = mem::size_of::();
const SIZE_128BIT: usize = SIZE_64BIT * 2;
diff --git a/server/src/storage/v1/mod.rs b/server/src/storage/v1/mod.rs
index 825952c5..e40c4e90 100644
--- a/server/src/storage/v1/mod.rs
+++ b/server/src/storage/v1/mod.rs
@@ -51,14 +51,12 @@ think of using them anywhere outside. This is a specialized parser built for the
*/
-use crate::corestore::array::Array;
-use crate::corestore::htable::Coremap;
-use crate::corestore::Data;
-use core::hash::Hash;
-use core::mem;
-use core::slice;
-use std::collections::HashSet;
-use std::io::Write;
+use {
+ crate::corestore::{array::Array, htable::Coremap, Data},
+ core::{hash::Hash, mem, slice},
+ std::{collections::HashSet, io::Write},
+};
+
// for some astronomical reasons do not mess with this
#[macro_use]
mod macros;
diff --git a/server/src/storage/v1/preload.rs b/server/src/storage/v1/preload.rs
index b972cee0..c5c3355a 100644
--- a/server/src/storage/v1/preload.rs
+++ b/server/src/storage/v1/preload.rs
@@ -32,14 +32,18 @@
//! 2. the `PARTMAP` preload that is placed in the ks directory
//!
-use crate::corestore::memstore::Memstore;
-use crate::corestore::memstore::ObjectID;
-use crate::storage::v1::error::{StorageEngineError, StorageEngineResult};
-use crate::IoResult;
-use core::ptr;
-use std::collections::HashMap;
-use std::collections::HashSet;
-use std::io::Write;
+use {
+ crate::{
+ corestore::memstore::{Memstore, ObjectID},
+ storage::v1::error::{StorageEngineError, StorageEngineResult},
+ IoResult,
+ },
+ core::ptr,
+ std::{
+ collections::{HashMap, HashSet},
+ io::Write,
+ },
+};
pub type LoadedPartfile = HashMap;
diff --git a/server/src/storage/v1/sengine.rs b/server/src/storage/v1/sengine.rs
index 5767fe71..77333459 100644
--- a/server/src/storage/v1/sengine.rs
+++ b/server/src/storage/v1/sengine.rs
@@ -24,23 +24,19 @@
*
*/
-use self::queue::Queue;
-use super::interface::{DIR_RSNAPROOT, DIR_SNAPROOT};
-use crate::corestore::iarray::IArray;
-use crate::corestore::lazy::Lazy;
-use crate::corestore::lock::QuickLock;
-use crate::corestore::memstore::Memstore;
-use crate::storage::v1::flush::{LocalSnapshot, RemoteSnapshot};
-use bytes::Bytes;
-use chrono::prelude::Utc;
-use core::fmt;
-use core::str;
-use regex::Regex;
-use std::collections::HashSet;
-use std::fs;
-use std::io::Error as IoError;
-use std::path::Path;
-use std::sync::Arc;
+use {
+ self::queue::Queue,
+ super::interface::{DIR_RSNAPROOT, DIR_SNAPROOT},
+ crate::{
+ corestore::{iarray::IArray, lazy::Lazy, lock::QuickLock, memstore::Memstore},
+ storage::v1::flush::{LocalSnapshot, RemoteSnapshot},
+ },
+ bytes::Bytes,
+ chrono::prelude::Utc,
+ core::{fmt, str},
+ regex::Regex,
+ std::{collections::HashSet, fs, io::Error as IoError, path::Path, sync::Arc},
+};
type QStore = IArray<[String; 64]>;
type SnapshotResult = Result;
diff --git a/server/src/storage/v1/unflush.rs b/server/src/storage/v1/unflush.rs
index fa7b0be1..04601b1e 100644
--- a/server/src/storage/v1/unflush.rs
+++ b/server/src/storage/v1/unflush.rs
@@ -28,24 +28,26 @@
//!
//! Routines for unflushing data
-use super::bytemarks;
-use crate::{
- corestore::{
- memstore::{Keyspace, Memstore, ObjectID, SystemKeyspace, SYSTEM},
- table::{SystemTable, Table},
+use {
+ super::bytemarks,
+ crate::{
+ corestore::{
+ memstore::{Keyspace, Memstore, ObjectID, SystemKeyspace, SYSTEM},
+ table::{SystemTable, Table},
+ },
+ storage::v1::{
+ de::DeserializeInto,
+ error::{ErrorContext, StorageEngineError, StorageEngineResult},
+ flush::Autoflush,
+ interface::DIR_KSROOT,
+ preload::LoadedPartfile,
+ Coremap,
+ },
+ util::Wrapper,
},
- storage::v1::{
- de::DeserializeInto,
- error::{ErrorContext, StorageEngineError, StorageEngineResult},
- flush::Autoflush,
- interface::DIR_KSROOT,
- preload::LoadedPartfile,
- Coremap,
- },
- util::Wrapper,
+ core::mem::transmute,
+ std::{fs, io::ErrorKind, path::Path, sync::Arc},
};
-use core::mem::transmute;
-use std::{fs, io::ErrorKind, path::Path, sync::Arc};
type PreloadSet = std::collections::HashSet;
const PRELOAD_PATH: &str = "data/ks/PRELOAD";
diff --git a/server/src/tests/auth.rs b/server/src/tests/auth.rs
index 00be61cc..9cbf0c42 100644
--- a/server/src/tests/auth.rs
+++ b/server/src/tests/auth.rs
@@ -24,8 +24,10 @@
*
*/
-use crate::auth::provider::testsuite_data;
-use skytable::{query, Element, RespCode};
+use {
+ crate::auth::provider::testsuite_data,
+ skytable::{query, Element, RespCode},
+};
macro_rules! assert_autherror {
($con:expr, $query:expr, $eq:expr) => {
diff --git a/server/src/tests/ddl_tests.rs b/server/src/tests/ddl_tests.rs
index 68bdae68..91c02e65 100644
--- a/server/src/tests/ddl_tests.rs
+++ b/server/src/tests/ddl_tests.rs
@@ -26,9 +26,11 @@
#[sky_macros::dbtest_module]
mod __private {
- use libstress::utils;
- use skytable::types::Array;
- use skytable::{query, Element, Query, RespCode};
+ use {
+ libstress::utils,
+ skytable::{query, types::Array, Element, Query, RespCode},
+ };
+
async fn test_create_keyspace() {
let mut rng = rand::thread_rng();
let ksname = utils::rand_alphastring(10, &mut rng);
diff --git a/server/src/tests/kvengine_encoding.rs b/server/src/tests/kvengine_encoding.rs
index 05099390..e1cd59a9 100644
--- a/server/src/tests/kvengine_encoding.rs
+++ b/server/src/tests/kvengine_encoding.rs
@@ -26,8 +26,8 @@
#[sky_macros::dbtest_module(table = "(string, string)")]
mod __private {
- use skytable::types::RawString;
- use skytable::{Element, RespCode};
+ use skytable::{types::RawString, Element, RespCode};
+
async fn test_bad_encoding_set() {
query.push("set");
query.push("x");
diff --git a/server/src/tests/mod.rs b/server/src/tests/mod.rs
index 3d4bd7bf..d91d53f8 100644
--- a/server/src/tests/mod.rs
+++ b/server/src/tests/mod.rs
@@ -52,10 +52,13 @@ mod tls {
}
mod sys {
- use crate::protocol::{LATEST_PROTOCOL_VERSION, LATEST_PROTOCOL_VERSIONSTRING};
- use libsky::VERSION;
- use sky_macros::dbtest_func as dbtest;
- use skytable::{query, Element, RespCode};
+ use {
+ crate::protocol::{LATEST_PROTOCOL_VERSION, LATEST_PROTOCOL_VERSIONSTRING},
+ libsky::VERSION,
+ sky_macros::dbtest_func as dbtest,
+ skytable::{query, Element, RespCode},
+ };
+
#[dbtest]
async fn sys_info_aerr() {
runeq!(
diff --git a/server/src/tests/persist/auth.rs b/server/src/tests/persist/auth.rs
index 7f81b542..3a53b9fe 100644
--- a/server/src/tests/persist/auth.rs
+++ b/server/src/tests/persist/auth.rs
@@ -24,8 +24,10 @@
*
*/
-use sky_macros::dbtest_func as dbtest;
-use skytable::{query, Element};
+use {
+ sky_macros::dbtest_func as dbtest,
+ skytable::{query, Element},
+};
const USERID: &str = "steinbeck";
diff --git a/server/src/tests/persist/kv.rs b/server/src/tests/persist/kv.rs
index 84e499d7..97fdb07e 100644
--- a/server/src/tests/persist/kv.rs
+++ b/server/src/tests/persist/kv.rs
@@ -24,8 +24,10 @@
*
*/
-use super::{persist_load, persist_store, PERSIST_TEST_SET_SIZE};
-use sky_macros::dbtest_func as dbtest;
+use {
+ super::{persist_load, persist_store, PERSIST_TEST_SET_SIZE},
+ sky_macros::dbtest_func as dbtest,
+};
const PERSIST_CFG_KEYMAP_BIN_BIN_TABLE: &str = "testsuite.persist_bin_bin_tbl";
const PERSIST_DATA_KEYMAP_BIN_BIN_TABLE: [(&[u8], &[u8]); PERSIST_TEST_SET_SIZE] = [
diff --git a/server/src/tests/persist/kvlist.rs b/server/src/tests/persist/kvlist.rs
index 2669281d..0b15ec0f 100644
--- a/server/src/tests/persist/kvlist.rs
+++ b/server/src/tests/persist/kvlist.rs
@@ -24,8 +24,10 @@
*
*/
-use super::{persist_load, persist_store, Bin, ListIDBin, ListIDStr, Str, PERSIST_TEST_SET_SIZE};
-use sky_macros::dbtest_func as dbtest;
+use {
+ super::{persist_load, persist_store, Bin, ListIDBin, ListIDStr, Str, PERSIST_TEST_SET_SIZE},
+ sky_macros::dbtest_func as dbtest,
+};
type ListData = [(K, [V; PERSIST_TEST_SET_SIZE]); PERSIST_TEST_SET_SIZE];
diff --git a/server/src/tests/persist/mod.rs b/server/src/tests/persist/mod.rs
index 39c73768..16a9eb25 100644
--- a/server/src/tests/persist/mod.rs
+++ b/server/src/tests/persist/mod.rs
@@ -24,12 +24,14 @@
*
*/
-use sky_macros::dbtest_func as dbtest;
-use skytable::{
- aio::Connection,
- query,
- types::{Array, RawString},
- Element, Query, RespCode,
+use {
+ sky_macros::dbtest_func as dbtest,
+ skytable::{
+ aio::Connection,
+ query,
+ types::{Array, RawString},
+ Element, Query, RespCode,
+ },
};
#[dbtest(skip_if_cfg = "persist-suite", norun = true, port = 2007)]
diff --git a/server/src/tests/snapshot.rs b/server/src/tests/snapshot.rs
index ad009400..f6cf4152 100644
--- a/server/src/tests/snapshot.rs
+++ b/server/src/tests/snapshot.rs
@@ -24,8 +24,10 @@
*
*/
-use sky_macros::dbtest_func as dbtest;
-use skytable::{query, Element, RespCode};
+use {
+ sky_macros::dbtest_func as dbtest,
+ skytable::{query, Element, RespCode},
+};
const SNAPSHOT_DISABLED: &str = "err-snapshot-disabled";
diff --git a/server/src/util/error.rs b/server/src/util/error.rs
index 52200043..4627ef33 100644
--- a/server/src/util/error.rs
+++ b/server/src/util/error.rs
@@ -24,9 +24,11 @@
*
*/
-use crate::storage::v1::{error::StorageEngineError, sengine::SnapshotEngineError};
-use openssl::{error::ErrorStack as SslErrorStack, ssl::Error as SslError};
-use std::{fmt, io::Error as IoError};
+use {
+ crate::storage::v1::{error::StorageEngineError, sengine::SnapshotEngineError},
+ openssl::{error::ErrorStack as SslErrorStack, ssl::Error as SslError},
+ std::{fmt, io::Error as IoError},
+};
pub type SkyResult = Result;
diff --git a/server/src/util/os.rs b/server/src/util/os.rs
index 30aaca40..028c5191 100644
--- a/server/src/util/os.rs
+++ b/server/src/util/os.rs
@@ -36,8 +36,16 @@ use {
#[cfg(unix)]
mod unix {
- use libc::{rlimit, RLIMIT_NOFILE};
- use std::io::Error as IoError;
+ use {
+ libc::{rlimit, RLIMIT_NOFILE},
+ std::{
+ future::Future,
+ io::Error as IoError,
+ pin::Pin,
+ task::{Context, Poll},
+ },
+ tokio::signal::unix::{signal, Signal, SignalKind},
+ };
#[derive(Debug)]
pub struct ResourceLimit {
@@ -87,11 +95,6 @@ mod unix {
let _ = ResourceLimit::get().unwrap();
}
- use std::future::Future;
- use std::pin::Pin;
- use std::task::{Context, Poll};
- use tokio::signal::unix::{signal, Signal, SignalKind};
-
pub struct TerminationSignal {
sigint: Signal,
sigterm: Signal,
@@ -121,10 +124,14 @@ mod unix {
#[cfg(windows)]
mod windows {
- use std::future::Future;
- use std::pin::Pin;
- use std::task::{Context, Poll};
- use tokio::signal::windows::{ctrl_break, ctrl_c, CtrlBreak, CtrlC};
+ use {
+ std::{
+ future::Future,
+ pin::Pin,
+ task::{Context, Poll},
+ },
+ tokio::signal::windows::{ctrl_break, ctrl_c, CtrlBreak, CtrlC},
+ };
pub struct TerminationSignal {
ctrl_c: CtrlC,
diff --git a/sky-bench/src/benchtool/mod.rs b/sky-bench/src/benchtool/mod.rs
index 73ff2ba1..e219d783 100644
--- a/sky-bench/src/benchtool/mod.rs
+++ b/sky-bench/src/benchtool/mod.rs
@@ -24,17 +24,19 @@
*
*/
-use crate::{report::AggregatedReport, util};
-use devtimer::DevTime;
-use libstress::{utils::generate_random_byte_vector, PoolConfig};
-use rand::thread_rng;
-use skytable::{types::RawString, Query};
-use std::{
- io::{Read, Write},
- net::TcpStream,
+use {
+ self::validation::SQ_RESPCODE_SIZE,
+ crate::{report::AggregatedReport, util},
+ devtimer::DevTime,
+ libstress::{utils::generate_random_byte_vector, PoolConfig},
+ rand::thread_rng,
+ skytable::{types::RawString, Query},
+ std::{
+ io::{Read, Write},
+ net::TcpStream,
+ },
};
pub mod validation;
-use self::validation::SQ_RESPCODE_SIZE;
const NOTICE_INIT_BENCH: &str = "Finished sanity test. Initializing benchmark ...";
const NOTICE_INIT_COMPLETE: &str = "Initialization complete! Benchmark started";
diff --git a/sky-bench/src/main.rs b/sky-bench/src/main.rs
index c1b7c6c6..e6f7be07 100644
--- a/sky-bench/src/main.rs
+++ b/sky-bench/src/main.rs
@@ -36,13 +36,12 @@ mod util;
mod benchtool;
mod report;
mod testkey;
-use crate::util::DEFAULT_PACKET_SIZE;
-use crate::util::DEFAULT_QUERY_COUNT;
-use crate::util::DEFAULT_REPEAT;
-use crate::util::DEFAULT_WORKER_COUNT;
-// external imports
-use clap::{load_yaml, App};
-use core::hint::unreachable_unchecked;
+
+use {
+ crate::util::{DEFAULT_PACKET_SIZE, DEFAULT_QUERY_COUNT, DEFAULT_REPEAT, DEFAULT_WORKER_COUNT},
+ clap::{load_yaml, App},
+ core::hint::unreachable_unchecked,
+};
fn main() {
let cfg_layout = load_yaml!("./cli.yml");
diff --git a/sky-bench/src/report.rs b/sky-bench/src/report.rs
index 53aa0315..7d07a193 100644
--- a/sky-bench/src/report.rs
+++ b/sky-bench/src/report.rs
@@ -24,10 +24,11 @@
*
*/
-use crate::util;
-use core::cmp::Ordering;
-use std::collections::hash_map::Entry;
-use std::collections::HashMap;
+use {
+ crate::util,
+ core::cmp::Ordering,
+ std::collections::{hash_map::Entry, HashMap},
+};
/// A map of reports
pub struct AggregatedReport {
diff --git a/sky-bench/src/testkey.rs b/sky-bench/src/testkey.rs
index 0f4fb5e4..6cc0c9c9 100644
--- a/sky-bench/src/testkey.rs
+++ b/sky-bench/src/testkey.rs
@@ -24,13 +24,16 @@
*
*/
-use crate::{benchtool::validation::SQ_RESPCODE_SIZE, hoststr, sanity_test};
-use libstress::utils::generate_random_string_vector;
-use libstress::Workpool;
-use rand::thread_rng;
-use skytable::Query;
-use std::io::{Read, Write};
-use std::net::{self, TcpStream};
+use {
+ crate::{benchtool::validation::SQ_RESPCODE_SIZE, hoststr, sanity_test},
+ libstress::{utils::generate_random_string_vector, Workpool},
+ rand::thread_rng,
+ skytable::Query,
+ std::{
+ io::{Read, Write},
+ net::{self, TcpStream},
+ },
+};
pub fn create_testkeys(host: &str, port: u16, num: usize, connections: usize, size: usize) {
if let Err(e) = sanity_test!(host, port) {
diff --git a/sky-bench/src/util.rs b/sky-bench/src/util.rs
index 60e47812..9a415f7b 100644
--- a/sky-bench/src/util.rs
+++ b/sky-bench/src/util.rs
@@ -24,9 +24,7 @@
*
*/
-use libstress::utils::ran_string;
-use rand::thread_rng;
-use std::error::Error;
+use {libstress::utils::ran_string, rand::thread_rng, std::error::Error};
pub const DEFAULT_WORKER_COUNT: usize = 10;
pub const DEFAULT_PACKET_SIZE: usize = 4;
diff --git a/sky-macros/src/dbtest_fn.rs b/sky-macros/src/dbtest_fn.rs
index df068667..2b4ef21a 100644
--- a/sky-macros/src/dbtest_fn.rs
+++ b/sky-macros/src/dbtest_fn.rs
@@ -24,10 +24,7 @@
*
*/
-use crate::util;
-use proc_macro::TokenStream;
-use quote::quote;
-use syn::AttributeArgs;
+use {crate::util, proc_macro::TokenStream, quote::quote, syn::AttributeArgs};
type OptString = Option;
diff --git a/sky-macros/src/dbtest_mod.rs b/sky-macros/src/dbtest_mod.rs
index 2d69b5ad..d57a1754 100644
--- a/sky-macros/src/dbtest_mod.rs
+++ b/sky-macros/src/dbtest_mod.rs
@@ -24,14 +24,16 @@
*
*/
-use crate::{
- dbtest_fn::{self, DBTestFunctionConfig},
- util,
+use {
+ crate::{
+ dbtest_fn::{self, DBTestFunctionConfig},
+ util,
+ },
+ proc_macro::TokenStream,
+ quote::quote,
+ std::collections::HashSet,
+ syn::{self, AttributeArgs},
};
-use proc_macro::TokenStream;
-use quote::quote;
-use std::collections::HashSet;
-use syn::{self, AttributeArgs};
struct DBTestModuleConfig {
fcfg: DBTestFunctionConfig,
diff --git a/sky-macros/src/lib.rs b/sky-macros/src/lib.rs
index 2d66332f..13b0dedd 100644
--- a/sky-macros/src/lib.rs
+++ b/sky-macros/src/lib.rs
@@ -43,9 +43,7 @@
//! - `__MYENTITY__` - `String` with entity
//!
-use proc_macro::TokenStream;
-use quote::quote;
-use syn::Lit;
+use {proc_macro::TokenStream, quote::quote, syn::Lit};
mod dbtest_fn;
mod dbtest_mod;
diff --git a/sky-macros/src/util.rs b/sky-macros/src/util.rs
index 24a6a73b..b55c029b 100644
--- a/sky-macros/src/util.rs
+++ b/sky-macros/src/util.rs
@@ -24,11 +24,12 @@
*
*/
-use core::fmt::Display;
-use core::str::FromStr;
-use proc_macro2::Span;
-use rand::Rng;
-use syn::{Lit, MetaNameValue};
+use {
+ core::{fmt::Display, str::FromStr},
+ proc_macro2::Span,
+ rand::Rng,
+ syn::{Lit, MetaNameValue},
+};
const CHARSET: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
diff --git a/sky-migrate/src/main.rs b/sky-migrate/src/main.rs
index 80b65710..f77bcf6a 100644
--- a/sky-migrate/src/main.rs
+++ b/sky-migrate/src/main.rs
@@ -26,21 +26,15 @@
#![allow(clippy::unit_arg)]
-use clap::{load_yaml, App};
-use core::hint::unreachable_unchecked;
-use env_logger::Builder;
-use log::error as err;
-use log::info;
-use skytable::query;
-use skytable::sync::Connection;
-use skytable::Element;
-use skytable::Query;
-use skytable::RespCode;
-use std::collections::HashMap;
-use std::env;
-use std::fs;
-use std::path::PathBuf;
-use std::process;
+use {
+ clap::{load_yaml, App},
+ core::hint::unreachable_unchecked,
+ env_logger::Builder,
+ log::{error as err, info},
+ skytable::{query, sync::Connection, Element, Query, RespCode},
+ std::{collections::HashMap, env, fs, path::PathBuf, process},
+};
+
type Bytes = Vec;
fn main() {
diff --git a/stress-test/src/linearity_client.rs b/stress-test/src/linearity_client.rs
index 752ff119..dd125892 100644
--- a/stress-test/src/linearity_client.rs
+++ b/stress-test/src/linearity_client.rs
@@ -32,17 +32,13 @@
//! concurrent clients.
//!
-use crate::logstress;
-use crate::{DEFAULT_QUERY_COUNT, DEFAULT_SIZE_KV};
-use crossbeam_channel::bounded;
-use devtimer::SimpleTimer;
-use libstress::rayon::prelude::*;
-use libstress::utils::generate_random_string_vector;
-use libstress::Workpool;
-use skytable::actions::Actions;
-use skytable::query;
-use skytable::Connection;
-use skytable::{Element, Query, RespCode};
+use {
+ crate::{logstress, DEFAULT_QUERY_COUNT, DEFAULT_SIZE_KV},
+ crossbeam_channel::bounded,
+ devtimer::SimpleTimer,
+ libstress::{rayon::prelude::*, utils::generate_random_string_vector, Workpool},
+ skytable::{actions::Actions, query, Connection, Element, Query, RespCode},
+};
macro_rules! log_client_linearity {
($stressid:expr, $counter:expr, $what:expr) => {
diff --git a/stress-test/src/main.rs b/stress-test/src/main.rs
index d646a731..b71658f5 100644
--- a/stress-test/src/main.rs
+++ b/stress-test/src/main.rs
@@ -27,12 +27,14 @@
#![deny(unused_crate_dependencies)]
#![deny(unused_imports)]
-use libstress::traits::ExitError;
-use log::{info, trace, warn};
-use rand::thread_rng;
-use skytable::Connection;
-use std::env;
-use sysinfo::{RefreshKind, System, SystemExt};
+use {
+ libstress::traits::ExitError,
+ log::{info, trace, warn},
+ rand::thread_rng,
+ skytable::Connection,
+ std::env,
+ sysinfo::{RefreshKind, System, SystemExt},
+};
mod linearity_client;
mod utils;
diff --git a/stress-test/src/utils.rs b/stress-test/src/utils.rs
index 5d001189..76cbbc8f 100644
--- a/stress-test/src/utils.rs
+++ b/stress-test/src/utils.rs
@@ -23,9 +23,11 @@
* along with this program. If not, see .
*
*/
-use log::trace;
-use skytable::Query;
-use sysinfo::{System, SystemExt};
+use {
+ log::trace,
+ skytable::Query,
+ sysinfo::{System, SystemExt},
+};
pub fn calculate_max_keylen(expected_queries: usize, sys: &mut System) -> usize {
let total_mem_in_bytes = (sys.total_memory() * 1024) as usize;