From a8391376431950cb9f601cb5cd2ae38f7ad95af6 Mon Sep 17 00:00:00 2001 From: Sayan Nandan Date: Sun, 30 May 2021 11:23:56 +0530 Subject: [PATCH 1/5] Move actions into an `actions` module These are actions and shouldn't be called the `kvengine`. --- server/src/{kvengine => actions}/dbsize.rs | 0 server/src/{kvengine => actions}/del.rs | 0 server/src/{kvengine => actions}/exists.rs | 0 server/src/{kvengine => actions}/flushdb.rs | 0 server/src/{kvengine => actions}/get.rs | 0 server/src/{kvengine => actions}/jget.rs | 0 server/src/{kvengine => actions}/keylen.rs | 0 server/src/{kvengine => actions}/lskeys.rs | 0 server/src/{kvengine => actions}/mget.rs | 0 server/src/{kvengine => actions}/mod.rs | 0 server/src/{kvengine => actions}/mset.rs | 0 server/src/{kvengine => actions}/mupdate.rs | 0 server/src/{kvengine => actions}/set.rs | 0 server/src/{kvengine => actions}/strong.rs | 0 server/src/{kvengine => actions}/update.rs | 0 server/src/{kvengine => actions}/uset.rs | 0 server/src/main.rs | 2 +- server/src/queryengine/mod.rs | 36 ++++++++++----------- 18 files changed, 19 insertions(+), 19 deletions(-) rename server/src/{kvengine => actions}/dbsize.rs (100%) rename server/src/{kvengine => actions}/del.rs (100%) rename server/src/{kvengine => actions}/exists.rs (100%) rename server/src/{kvengine => actions}/flushdb.rs (100%) rename server/src/{kvengine => actions}/get.rs (100%) rename server/src/{kvengine => actions}/jget.rs (100%) rename server/src/{kvengine => actions}/keylen.rs (100%) rename server/src/{kvengine => actions}/lskeys.rs (100%) rename server/src/{kvengine => actions}/mget.rs (100%) rename server/src/{kvengine => actions}/mod.rs (100%) rename server/src/{kvengine => actions}/mset.rs (100%) rename server/src/{kvengine => actions}/mupdate.rs (100%) rename server/src/{kvengine => actions}/set.rs (100%) rename server/src/{kvengine => actions}/strong.rs (100%) rename server/src/{kvengine => actions}/update.rs (100%) rename server/src/{kvengine => actions}/uset.rs (100%) diff --git a/server/src/kvengine/dbsize.rs b/server/src/actions/dbsize.rs similarity index 100% rename from server/src/kvengine/dbsize.rs rename to server/src/actions/dbsize.rs diff --git a/server/src/kvengine/del.rs b/server/src/actions/del.rs similarity index 100% rename from server/src/kvengine/del.rs rename to server/src/actions/del.rs diff --git a/server/src/kvengine/exists.rs b/server/src/actions/exists.rs similarity index 100% rename from server/src/kvengine/exists.rs rename to server/src/actions/exists.rs diff --git a/server/src/kvengine/flushdb.rs b/server/src/actions/flushdb.rs similarity index 100% rename from server/src/kvengine/flushdb.rs rename to server/src/actions/flushdb.rs diff --git a/server/src/kvengine/get.rs b/server/src/actions/get.rs similarity index 100% rename from server/src/kvengine/get.rs rename to server/src/actions/get.rs diff --git a/server/src/kvengine/jget.rs b/server/src/actions/jget.rs similarity index 100% rename from server/src/kvengine/jget.rs rename to server/src/actions/jget.rs diff --git a/server/src/kvengine/keylen.rs b/server/src/actions/keylen.rs similarity index 100% rename from server/src/kvengine/keylen.rs rename to server/src/actions/keylen.rs diff --git a/server/src/kvengine/lskeys.rs b/server/src/actions/lskeys.rs similarity index 100% rename from server/src/kvengine/lskeys.rs rename to server/src/actions/lskeys.rs diff --git a/server/src/kvengine/mget.rs b/server/src/actions/mget.rs similarity index 100% rename from server/src/kvengine/mget.rs rename to server/src/actions/mget.rs diff --git a/server/src/kvengine/mod.rs b/server/src/actions/mod.rs similarity index 100% rename from server/src/kvengine/mod.rs rename to server/src/actions/mod.rs diff --git a/server/src/kvengine/mset.rs b/server/src/actions/mset.rs similarity index 100% rename from server/src/kvengine/mset.rs rename to server/src/actions/mset.rs diff --git a/server/src/kvengine/mupdate.rs b/server/src/actions/mupdate.rs similarity index 100% rename from server/src/kvengine/mupdate.rs rename to server/src/actions/mupdate.rs diff --git a/server/src/kvengine/set.rs b/server/src/actions/set.rs similarity index 100% rename from server/src/kvengine/set.rs rename to server/src/actions/set.rs diff --git a/server/src/kvengine/strong.rs b/server/src/actions/strong.rs similarity index 100% rename from server/src/kvengine/strong.rs rename to server/src/actions/strong.rs diff --git a/server/src/kvengine/update.rs b/server/src/actions/update.rs similarity index 100% rename from server/src/kvengine/update.rs rename to server/src/actions/update.rs diff --git a/server/src/kvengine/uset.rs b/server/src/actions/uset.rs similarity index 100% rename from server/src/kvengine/uset.rs rename to server/src/actions/uset.rs diff --git a/server/src/main.rs b/server/src/main.rs index 5fb8c9cd..f1bdce77 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -36,11 +36,11 @@ use crate::config::SnapshotConfig; use std::io::{self, prelude::*}; mod config; use std::env; +mod actions; mod admin; mod coredb; mod dbnet; mod diskstore; -mod kvengine; mod protocol; mod queryengine; mod resp; diff --git a/server/src/queryengine/mod.rs b/server/src/queryengine/mod.rs index da00087d..c92e733a 100644 --- a/server/src/queryengine/mod.rs +++ b/server/src/queryengine/mod.rs @@ -31,7 +31,7 @@ use crate::dbnet::connection::prelude::*; use crate::gen_match; use crate::protocol::responses; use crate::protocol::Element; -use crate::{admin, kvengine}; +use crate::{actions, admin}; mod tags { //! This module is a collection of tags/strings used for evaluating queries @@ -89,24 +89,24 @@ where db, con, buf, - tags::TAG_DEL => kvengine::del::del, - tags::TAG_GET => kvengine::get::get, - tags::TAG_HEYA => kvengine::heya::heya, - tags::TAG_EXISTS => kvengine::exists::exists, - tags::TAG_SET => kvengine::set::set, - tags::TAG_MGET => kvengine::mget::mget, - tags::TAG_MSET => kvengine::mset::mset, - tags::TAG_UPDATE => kvengine::update::update, - tags::TAG_MUPDATE => kvengine::mupdate::mupdate, - tags::TAG_SSET => kvengine::strong::sset, - tags::TAG_SDEL => kvengine::strong::sdel, - tags::TAG_SUPDATE => kvengine::strong::supdate, - tags::TAG_DBSIZE => kvengine::dbsize::dbsize, - tags::TAG_FLUSHDB => kvengine::flushdb::flushdb, - tags::TAG_USET => kvengine::uset::uset, - tags::TAG_KEYLEN => kvengine::keylen::keylen, + tags::TAG_DEL => actions::del::del, + tags::TAG_GET => actions::get::get, + tags::TAG_HEYA => actions::heya::heya, + tags::TAG_EXISTS => actions::exists::exists, + tags::TAG_SET => actions::set::set, + tags::TAG_MGET => actions::mget::mget, + tags::TAG_MSET => actions::mset::mset, + tags::TAG_UPDATE => actions::update::update, + tags::TAG_MUPDATE => actions::mupdate::mupdate, + tags::TAG_SSET => actions::strong::sset, + tags::TAG_SDEL => actions::strong::sdel, + tags::TAG_SUPDATE => actions::strong::supdate, + tags::TAG_DBSIZE => actions::dbsize::dbsize, + tags::TAG_FLUSHDB => actions::flushdb::flushdb, + tags::TAG_USET => actions::uset::uset, + tags::TAG_KEYLEN => actions::keylen::keylen, tags::TAG_MKSNAP => admin::mksnap::mksnap, - tags::TAG_LSKEYS => kvengine::lskeys::lskeys + tags::TAG_LSKEYS => actions::lskeys::lskeys ); Ok(()) } From 58830edc80a93d3acad772030e5fff644fc6b71e Mon Sep 17 00:00:00 2001 From: Sayan Nandan Date: Sun, 30 May 2021 13:15:00 +0530 Subject: [PATCH 2/5] Use iterators for actions --- server/src/actions/dbsize.rs | 5 +- server/src/actions/del.rs | 7 +- server/src/actions/exists.rs | 7 +- server/src/actions/flushdb.rs | 5 +- server/src/actions/get.rs | 14 +++- server/src/actions/jget.rs | 5 +- server/src/actions/keylen.rs | 14 +++- server/src/actions/lskeys.rs | 7 +- server/src/actions/mget.rs | 16 ++-- server/src/actions/mod.rs | 37 +++++---- server/src/actions/mset.rs | 8 +- server/src/actions/mupdate.rs | 8 +- server/src/actions/set.rs | 14 ++-- server/src/actions/strong.rs | 48 ++++------- server/src/actions/update.rs | 14 ++-- server/src/actions/uset.rs | 8 +- server/src/admin/mksnap.rs | 10 +-- server/src/protocol/element.rs | 26 ------ server/src/queryengine/mod.rs | 146 ++++++++++++--------------------- 19 files changed, 165 insertions(+), 234 deletions(-) diff --git a/server/src/actions/dbsize.rs b/server/src/actions/dbsize.rs index cb545c50..8f58a5b8 100644 --- a/server/src/actions/dbsize.rs +++ b/server/src/actions/dbsize.rs @@ -25,18 +25,19 @@ */ use crate::dbnet::connection::prelude::*; +use crate::queryengine::ActionIter; /// Get the number of keys in the database pub async fn dbsize( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - crate::err_if_len_is!(act, con, != 0); + crate::err_if_len_is!(act, con, not 0); let len; { len = handle.get_ref().len(); diff --git a/server/src/actions/del.rs b/server/src/actions/del.rs index 37d28a02..a0e10248 100644 --- a/server/src/actions/del.rs +++ b/server/src/actions/del.rs @@ -29,6 +29,7 @@ use crate::dbnet::connection::prelude::*; use crate::protocol::responses; +use crate::queryengine::ActionIter; /// Run a `DEL` query /// @@ -37,13 +38,13 @@ use crate::protocol::responses; pub async fn del( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - crate::err_if_len_is!(act, con, == 0); + crate::err_if_len_is!(act, con, eq 0); let done_howmany: Option; { if handle.is_poisoned() { @@ -51,7 +52,7 @@ where } else { let mut many = 0; let cmap = handle.get_ref(); - act.into_iter().skip(1).for_each(|key| { + act.for_each(|key| { if cmap.true_if_removed(key.as_bytes()) { many += 1 } diff --git a/server/src/actions/exists.rs b/server/src/actions/exists.rs index 20f80bc3..319c139e 100644 --- a/server/src/actions/exists.rs +++ b/server/src/actions/exists.rs @@ -28,22 +28,23 @@ //! This module provides functions to work with `EXISTS` queries use crate::dbnet::connection::prelude::*; +use crate::queryengine::ActionIter; /// Run an `EXISTS` query pub async fn exists( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - crate::err_if_len_is!(act, con, == 0); + crate::err_if_len_is!(act, con, eq 0); let mut how_many_of_them_exist = 0usize; { let cmap = handle.get_ref(); - act.into_iter().skip(1).for_each(|key| { + act.for_each(|key| { if cmap.contains_key(key.as_bytes()) { how_many_of_them_exist += 1; } diff --git a/server/src/actions/flushdb.rs b/server/src/actions/flushdb.rs index 53ee485a..00754185 100644 --- a/server/src/actions/flushdb.rs +++ b/server/src/actions/flushdb.rs @@ -26,18 +26,19 @@ use crate::dbnet::connection::prelude::*; use crate::protocol::responses; +use crate::queryengine::ActionIter; /// Delete all the keys in the database pub async fn flushdb( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - crate::err_if_len_is!(act, con, != 0); + crate::err_if_len_is!(act, con, not 0); let failed; { if handle.is_poisoned() { diff --git a/server/src/actions/get.rs b/server/src/actions/get.rs index 4fa929a5..335fbe40 100644 --- a/server/src/actions/get.rs +++ b/server/src/actions/get.rs @@ -29,27 +29,33 @@ use crate::dbnet::connection::prelude::*; use crate::protocol::responses; +use crate::queryengine::ActionIter; use crate::resp::BytesWrapper; use bytes::Bytes; +use core::hint::unreachable_unchecked; /// Run a `GET` query pub async fn get( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + mut act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - crate::err_if_len_is!(act, con, != 1); + crate::err_if_len_is!(act, con, not 1); let res: Option = { let reader = handle.get_ref(); unsafe { - // UNSAFE(@ohsayan): act.get_ref().get_unchecked() is safe because we've already if the action + // UNSAFE(@ohsayan): unreachable_unchecked is safe because we've already checked if the action // group contains one argument (excluding the action itself) reader - .get(act.get_unchecked(1).as_bytes()) + .get( + act.next() + .unwrap_or_else(|| unreachable_unchecked()) + .as_bytes(), + ) .map(|b| b.get_blob().clone()) } }; diff --git a/server/src/actions/jget.rs b/server/src/actions/jget.rs index 2033f070..a905f269 100644 --- a/server/src/actions/jget.rs +++ b/server/src/actions/jget.rs @@ -29,6 +29,7 @@ //! Functions for handling `JGET` queries use crate::dbnet::connection::prelude::*; +use crate::queryengine::ActionIter; /// Run a `JGET` query /// This returns a JSON key/value pair of keys and values @@ -42,13 +43,13 @@ use crate::dbnet::connection::prelude::*; pub async fn jget( _handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - crate::err_if_len_is!(act, con, != 1); + crate::err_if_len_is!(act, con, not 1); todo!() } diff --git a/server/src/actions/keylen.rs b/server/src/actions/keylen.rs index 75ae62b0..daf43e90 100644 --- a/server/src/actions/keylen.rs +++ b/server/src/actions/keylen.rs @@ -26,6 +26,8 @@ use crate::dbnet::connection::prelude::*; use crate::protocol::responses; +use crate::queryengine::ActionIter; +use core::hint::unreachable_unchecked; /// Run a `KEYLEN` query /// @@ -33,20 +35,24 @@ use crate::protocol::responses; pub async fn keylen( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + mut act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - crate::err_if_len_is!(act, con, != 1); + crate::err_if_len_is!(act, con, not 1); let res: Option = { let reader = handle.get_ref(); unsafe { - // UNSAFE(@ohsayan): get_unchecked() is completely safe as we've already checked + // UNSAFE(@ohsayan): unreachable_unchecked() is completely safe as we've already checked // the number of arguments is one reader - .get(act.get_unchecked(1).as_bytes()) + .get( + act.next() + .unwrap_or_else(|| unreachable_unchecked()) + .as_bytes(), + ) .map(|b| b.get_blob().len()) } }; diff --git a/server/src/actions/lskeys.rs b/server/src/actions/lskeys.rs index 8f9fd7cd..0afe26c5 100644 --- a/server/src/actions/lskeys.rs +++ b/server/src/actions/lskeys.rs @@ -26,6 +26,7 @@ use crate::dbnet::connection::prelude::*; use crate::protocol::responses; +use crate::queryengine::ActionIter; use crate::resp::BytesWrapper; use bytes::Bytes; @@ -33,14 +34,14 @@ use bytes::Bytes; pub async fn lskeys( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + mut act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - crate::err_if_len_is!(act, con, > 1); - let item_count = if let Some(cnt) = act.get(1) { + crate::err_if_len_is!(act, con, gt 1); + let item_count = if let Some(cnt) = act.next() { if let Ok(cnt) = cnt.parse::() { cnt } else { diff --git a/server/src/actions/mget.rs b/server/src/actions/mget.rs index c1245cd9..42f75a8c 100644 --- a/server/src/actions/mget.rs +++ b/server/src/actions/mget.rs @@ -25,6 +25,7 @@ */ use crate::dbnet::connection::prelude::*; +use crate::queryengine::ActionIter; use crate::resp::BytesWrapper; use bytes::Bytes; use skytable::RespCode; @@ -34,19 +35,20 @@ use skytable::RespCode; pub async fn mget( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + mut act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - crate::err_if_len_is!(act, con, == 0); - con.write_array_length(act.len() - 1).await?; - let mut keys = act.into_iter().skip(1); - while let Some(key) = keys.next() { + crate::err_if_len_is!(act, con, eq 0); + con.write_array_length(act.len()).await?; + while let Some(key) = act.next() { let res: Option = { - let reader = handle.get_ref(); - reader.get(key.as_bytes()).map(|b| b.get_blob().clone()) + handle + .get_ref() + .get(key.as_bytes()) + .map(|b| b.get_blob().clone()) }; if let Some(value) = res { // Good, we got the value, write it off to the stream diff --git a/server/src/actions/mod.rs b/server/src/actions/mod.rs index 10d78694..40689f7c 100644 --- a/server/src/actions/mod.rs +++ b/server/src/actions/mod.rs @@ -24,9 +24,11 @@ * */ -//! # The Key/Value Engine -//! This is Skytable's K/V engine. It contains utilities to interface with -//! Skytable's K/V store +//! # Actions +//! +//! Actions are like shell commands, you provide arguments -- they return output. This module contains a collection +//! of the actions supported by Skytable +//! pub mod dbsize; pub mod del; @@ -47,12 +49,13 @@ pub mod heya { //! Respond to `HEYA` queries use crate::dbnet::connection::prelude::*; use crate::protocol; + use crate::queryengine::ActionIter; use protocol::responses; /// Returns a `HEY!` `Response` pub async fn heya( _handle: &crate::coredb::CoreDB, con: &mut T, - _act: Vec, + _act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, @@ -64,50 +67,50 @@ pub mod heya { #[macro_export] macro_rules! err_if_len_is { - ($buf:ident, $con:ident, == $len:literal) => { - if $buf.len() - 1 == $len { + ($buf:ident, $con:ident, eq $len:literal) => { + if $buf.len() == $len { return $con .write_response(&**crate::protocol::responses::groups::ACTION_ERR) .await; } }; - ($buf:ident, $con:ident, != $len:literal) => { - if $buf.len() - 1 != $len { + ($buf:ident, $con:ident, not $len:literal) => { + if $buf.len() != $len { return $con .write_response(&**crate::protocol::responses::groups::ACTION_ERR) .await; } }; - ($buf:ident, $con:ident, > $len:literal) => { - if $buf.len() - 1 > $len { + ($buf:ident, $con:ident, gt $len:literal) => { + if $buf.len() > $len { return $con .write_response(&**crate::protocol::responses::groups::ACTION_ERR) .await; } }; - ($buf:ident, $con:ident, < $len:literal) => { - if $buf.len() - 1 < $len { + ($buf:ident, $con:ident, lt $len:literal) => { + if $buf.len() < $len { return $con .write_response(&**crate::protocol::responses::groups::ACTION_ERR) .await; } }; - ($buf:ident, $con:ident, >= $len:literal) => { - if $buf.len() - 1 >= $len { + ($buf:ident, $con:ident, gt_or_eq $len:literal) => { + if $buf.len() >= $len { return $con .write_response(&**crate::protocol::responses::groups::ACTION_ERR) .await; } }; - ($buf:ident, $con:ident, <= $len:literal) => { - if $buf.len() - 1 <= $len { + ($buf:ident, $con:ident, lt_or_eq $len:literal) => { + if $buf.len() <= $len { return $con .write_response(&**crate::protocol::responses::groups::ACTION_ERR) .await; } }; ($buf:ident, $con:ident, & $len:literal) => { - if $buf.len() - 1 & $len { + if $buf.len() & $len { return $con .write_response(&**crate::protocol::responses::groups::ACTION_ERR) .await; diff --git a/server/src/actions/mset.rs b/server/src/actions/mset.rs index 8d6a3eb6..b2e408ca 100644 --- a/server/src/actions/mset.rs +++ b/server/src/actions/mset.rs @@ -27,25 +27,25 @@ use crate::coredb::Data; use crate::dbnet::connection::prelude::*; use crate::protocol::responses; +use crate::queryengine::ActionIter; /// Run an `MSET` query pub async fn mset( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + mut act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - let howmany = act.len() - 1; + let howmany = act.len(); if howmany & 1 == 1 || howmany == 0 { // An odd number of arguments means that the number of keys // is not the same as the number of values, we won't run this // action at all return con.write_response(&**responses::groups::ACTION_ERR).await; } - let mut kviter = act.into_iter().skip(1); let done_howmany: Option; { if handle.is_poisoned() { @@ -53,7 +53,7 @@ where } else { let writer = handle.get_ref(); let mut didmany = 0; - while let (Some(key), Some(val)) = (kviter.next(), kviter.next()) { + while let (Some(key), Some(val)) = (act.next(), act.next()) { if writer.true_if_insert(Data::from(key), Data::from(val)) { didmany += 1; } diff --git a/server/src/actions/mupdate.rs b/server/src/actions/mupdate.rs index a9667f95..6a76595f 100644 --- a/server/src/actions/mupdate.rs +++ b/server/src/actions/mupdate.rs @@ -27,25 +27,25 @@ use crate::coredb::Data; use crate::dbnet::connection::prelude::*; use crate::protocol::responses; +use crate::queryengine::ActionIter; /// Run an `MUPDATE` query pub async fn mupdate( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + mut act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - let howmany = act.len() - 1; + let howmany = act.len(); if howmany & 1 == 1 || howmany == 0 { // An odd number of arguments means that the number of keys // is not the same as the number of values, we won't run this // action at all return con.write_response(&**responses::groups::ACTION_ERR).await; } - let mut kviter = act.into_iter().skip(1); let done_howmany: Option; { if handle.is_poisoned() { @@ -53,7 +53,7 @@ where } else { let writer = handle.get_ref(); let mut didmany = 0; - while let (Some(key), Some(val)) = (kviter.next(), kviter.next()) { + while let (Some(key), Some(val)) = (act.next(), act.next()) { if writer.true_if_update(Data::from(key), Data::from(val)) { didmany += 1; } diff --git a/server/src/actions/set.rs b/server/src/actions/set.rs index 8abd7257..c843c745 100644 --- a/server/src/actions/set.rs +++ b/server/src/actions/set.rs @@ -30,6 +30,7 @@ use crate::coredb; use crate::dbnet::connection::prelude::*; use crate::protocol::responses; +use crate::queryengine::ActionIter; use coredb::Data; use std::hint::unreachable_unchecked; @@ -37,30 +38,25 @@ use std::hint::unreachable_unchecked; pub async fn set( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + mut act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - let howmany = act.len() - 1; - if howmany != 2 { - // There should be exactly 2 arguments - return con.write_response(&**responses::groups::ACTION_ERR).await; - } - let mut it = act.into_iter().skip(1); + crate::err_if_len_is!(act, con, not 2); let did_we = { if handle.is_poisoned() { None } else { let writer = handle.get_ref(); if writer.true_if_insert( - Data::from_string(it.next().unwrap_or_else(|| unsafe { + Data::from_string(act.next().unwrap_or_else(|| unsafe { // UNSAFE(@ohsayan): This is completely safe as we've already checked // that there are exactly 2 arguments unreachable_unchecked() })), - Data::from(it.next().unwrap_or_else(|| unsafe { + Data::from(act.next().unwrap_or_else(|| unsafe { // UNSAFE(@ohsayan): This is completely safe as we've already checked // that there are exactly 2 arguments unreachable_unchecked() diff --git a/server/src/actions/strong.rs b/server/src/actions/strong.rs index e901e7b5..5b853d45 100644 --- a/server/src/actions/strong.rs +++ b/server/src/actions/strong.rs @@ -38,8 +38,8 @@ use crate::coredb::Data; use crate::dbnet::connection::prelude::*; use crate::protocol::responses; - -use std::hint::unreachable_unchecked; +use crate::queryengine::ActionIter; +use core::hint::unreachable_unchecked; /// Run an `SSET` query /// @@ -48,13 +48,13 @@ use std::hint::unreachable_unchecked; pub async fn sset( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + mut act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - let howmany = act.len() - 1; + let howmany = act.len(); if howmany & 1 == 1 || howmany == 0 { return con.write_response(&**responses::groups::ACTION_ERR).await; } @@ -66,13 +66,7 @@ where // This iterator gives us the keys and values, skipping the first argument which // is the action name - let mut key_iter = act - .get(1..) - .unwrap_or_else(|| unsafe { - // UNSAFE(@ohsayan): We've already checked if the action group contains more than one arugment - unreachable_unchecked() - }) - .iter(); + let mut key_iter = act.as_ref().iter(); if handle.is_poisoned() { failed = None; } else { @@ -92,8 +86,7 @@ where }) { // Since the failed flag is false, none of the keys existed // So we can safely set the keys - let mut iter = act.into_iter().skip(1); - while let (Some(key), Some(value)) = (iter.next(), iter.next()) { + while let (Some(key), Some(value)) = (act.next(), act.next()) { if !mut_table.true_if_insert(Data::from(key), Data::from_string(value)) { // Tell the compiler that this will never be the case unsafe { @@ -126,13 +119,13 @@ where pub async fn sdel( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - let howmany = act.len() - 1; + let howmany = act.len(); if howmany == 0 { return con.write_response(&**responses::groups::ACTION_ERR).await; } @@ -141,13 +134,7 @@ where // We use this additional scope to tell the compiler that the write lock // doesn't go beyond the scope of this function - and is never used across // an await: cause, the compiler ain't as smart as we are ;) - let mut key_iter = act - .get(1..) - .unwrap_or_else(|| unsafe { - // UNSAFE(@ohsayan): We've already checked if the action group contains more than one arugment - unreachable_unchecked() - }) - .iter(); + let mut key_iter = act.as_ref().iter(); if handle.is_poisoned() { failed = None; } else { @@ -168,7 +155,7 @@ where }) { // Since the failed flag is false, all of the keys exist // So we can safely delete the keys - act.into_iter().skip(1).for_each(|key| { + act.into_iter().for_each(|key| { // Since we've already checked that the keys don't exist // We'll tell the compiler to optimize this let _ = mut_table.remove(key.as_bytes()).unwrap_or_else(|| unsafe { @@ -198,13 +185,13 @@ where pub async fn supdate( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + mut act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - let howmany = act.len() - 1; + let howmany = act.len(); if howmany & 1 == 1 || howmany == 0 { return con.write_response(&**responses::groups::ACTION_ERR).await; } @@ -213,13 +200,7 @@ where // We use this additional scope to tell the compiler that the write lock // doesn't go beyond the scope of this function - and is never used across // an await: cause, the compiler ain't as smart as we are ;) - let mut key_iter = act - .get(1..) - .unwrap_or_else(|| unsafe { - // UNSAFE(@ohsayan): We've already checked if the action group contains more than one arugment - unreachable_unchecked() - }) - .iter(); + let mut key_iter = act.as_ref().iter(); if handle.is_poisoned() { failed = None; } else { @@ -245,8 +226,7 @@ where }) { // Since the failed flag is false, none of the keys existed // So we can safely update the keys - let mut iter = act.into_iter().skip(1); - while let (Some(key), Some(value)) = (iter.next(), iter.next()) { + while let (Some(key), Some(value)) = (act.next(), act.next()) { if !mut_table.true_if_update(Data::from(key), Data::from_string(value)) { // Tell the compiler that this will never be the case unsafe { unreachable_unchecked() } diff --git a/server/src/actions/update.rs b/server/src/actions/update.rs index 8a792d87..dcf50628 100644 --- a/server/src/actions/update.rs +++ b/server/src/actions/update.rs @@ -31,6 +31,7 @@ use crate::coredb::{self}; use crate::dbnet::connection::prelude::*; use crate::protocol::responses; +use crate::queryengine::ActionIter; use coredb::Data; use std::hint::unreachable_unchecked; @@ -38,30 +39,25 @@ use std::hint::unreachable_unchecked; pub async fn update( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + mut act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - let howmany = act.len() - 1; - if howmany != 2 { - // There should be exactly 2 arguments - return con.write_response(&**responses::groups::ACTION_ERR).await; - } - let mut it = act.into_iter().skip(1); + crate::err_if_len_is!(act, con, not 2); let did_we = { if handle.is_poisoned() { None } else { let writer = handle.get_ref(); if writer.true_if_update( - Data::from(it.next().unwrap_or_else(|| unsafe { + Data::from(act.next().unwrap_or_else(|| unsafe { // UNSAFE(@ohsayan): We've already checked that the action contains exactly // two arguments (excluding the action itself). So, this branch won't ever be reached unreachable_unchecked() })), - Data::from_string(it.next().unwrap_or_else(|| unsafe { + Data::from_string(act.next().unwrap_or_else(|| unsafe { // UNSAFE(@ohsayan): We've already checked that the action contains exactly // two arguments (excluding the action itself). So, this branch won't ever be reached unreachable_unchecked() diff --git a/server/src/actions/uset.rs b/server/src/actions/uset.rs index 35880fc9..20dee78e 100644 --- a/server/src/actions/uset.rs +++ b/server/src/actions/uset.rs @@ -27,6 +27,7 @@ use crate::coredb::Data; use crate::dbnet::connection::prelude::*; use crate::protocol::responses; +use crate::queryengine::ActionIter; /// Run an `USET` query /// @@ -34,26 +35,25 @@ use crate::protocol::responses; pub async fn uset( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + mut act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - let howmany = act.len() - 1; + let howmany = act.len(); if howmany & 1 == 1 || howmany == 0 { // An odd number of arguments means that the number of keys // is not the same as the number of values, we won't run this // action at all return con.write_response(&**responses::groups::ACTION_ERR).await; } - let mut kviter = act.into_iter().skip(1); let failed = { if handle.is_poisoned() { true } else { let writer = handle.get_ref(); - while let (Some(key), Some(val)) = (kviter.next(), kviter.next()) { + while let (Some(key), Some(val)) = (act.next(), act.next()) { let _ = writer.upsert(Data::from(key), Data::from(val)); } drop(writer); diff --git a/server/src/admin/mksnap.rs b/server/src/admin/mksnap.rs index 572eac9e..e9e452f8 100644 --- a/server/src/admin/mksnap.rs +++ b/server/src/admin/mksnap.rs @@ -29,6 +29,7 @@ use crate::diskstore; use crate::diskstore::snapshot::SnapshotEngine; use crate::diskstore::snapshot::DIR_SNAPSHOT; use crate::protocol::responses; +use crate::queryengine::ActionIter; use std::hint::unreachable_unchecked; use std::path::{Component, PathBuf}; @@ -37,14 +38,13 @@ use std::path::{Component, PathBuf}; pub async fn mksnap( handle: &crate::coredb::CoreDB, con: &mut T, - act: Vec, + mut act: ActionIter, ) -> std::io::Result<()> where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - let howmany = act.len() - 1; - if howmany == 0 { + if act.len() == 0 { if !handle.is_snapshot_enabled() { // Since snapshotting is disabled, we can't create a snapshot! // We'll just return an error returning the same @@ -100,9 +100,9 @@ where .await; } } else { - if howmany == 1 { + if act.len() == 1 { // This means that the user wants to create a 'named' snapshot - let snapname = act.get(1).unwrap_or_else(|| unsafe { + let snapname = act.next().unwrap_or_else(|| unsafe { // UNSAFE(@ohsayan): We've already checked that the action // contains a second argument, so this can't be reached unreachable_unchecked() diff --git a/server/src/protocol/element.rs b/server/src/protocol/element.rs index 50f17eb5..7c5b0aad 100644 --- a/server/src/protocol/element.rs +++ b/server/src/protocol/element.rs @@ -24,8 +24,6 @@ * */ -use std::borrow::Cow; - #[derive(Debug, PartialEq)] #[non_exhaustive] /// # Data Types @@ -41,27 +39,3 @@ pub enum Element { /// A non-recursive String array; tsymbol: `_` FlatArray(Vec), } - -impl Element { - /// This will return a reference to the first element in the element - /// - /// If this element is a compound type, it will return a reference to the first element in the compound - /// type - pub fn get_first(&self) -> Option> { - match self { - Self::Array(elem) => match elem.first() { - Some(el) => match el { - Element::String(st) => Some(Cow::Borrowed(&st)), - _ => None, - }, - None => None, - }, - Self::FlatArray(elem) => match elem.first() { - Some(el) => Some(Cow::Borrowed(&el)), - None => None, - }, - Self::String(ref st) => Some(Cow::Borrowed(&st)), - _ => None, - } - } -} diff --git a/server/src/queryengine/mod.rs b/server/src/queryengine/mod.rs index c92e733a..c075c2da 100644 --- a/server/src/queryengine/mod.rs +++ b/server/src/queryengine/mod.rs @@ -28,50 +28,36 @@ use crate::coredb::CoreDB; use crate::dbnet::connection::prelude::*; -use crate::gen_match; use crate::protocol::responses; use crate::protocol::Element; use crate::{actions, admin}; -mod tags { - //! This module is a collection of tags/strings used for evaluating queries - //! and responses - /// `GET` action tag - pub const TAG_GET: &'static str = "GET"; - /// `SET` action tag - pub const TAG_SET: &'static str = "SET"; - /// `UPDATE` action tag - pub const TAG_UPDATE: &'static str = "UPDATE"; - /// `DEL` action tag - pub const TAG_DEL: &'static str = "DEL"; - /// `HEYA` action tag - pub const TAG_HEYA: &'static str = "HEYA"; - /// `EXISTS` action tag - pub const TAG_EXISTS: &'static str = "EXISTS"; - /// `MSET` action tag - pub const TAG_MSET: &'static str = "MSET"; - /// `MGET` action tag - pub const TAG_MGET: &'static str = "MGET"; - /// `MUPDATE` action tag - pub const TAG_MUPDATE: &'static str = "MUPDATE"; - /// `SSET` action tag - pub const TAG_SSET: &'static str = "SSET"; - /// `SDEL` action tag - pub const TAG_SDEL: &'static str = "SDEL"; - /// `SUPDATE` action tag - pub const TAG_SUPDATE: &'static str = "SUPDATE"; - /// `DBSIZE` action tag - pub const TAG_DBSIZE: &'static str = "DBSIZE"; - /// `FLUSHDB` action tag - pub const TAG_FLUSHDB: &'static str = "FLUSHDB"; - /// `USET` action tag - pub const TAG_USET: &'static str = "USET"; - /// `KEYLEN` action tag - pub const TAG_KEYLEN: &'static str = "KEYLEN"; - /// `MKSNAP` action tag - pub const TAG_MKSNAP: &'static str = "MKSNAP"; - /// `LSKEYS` action tag - pub const TAG_LSKEYS: &str = "LSKEYS"; +use std::vec::IntoIter; +pub type ActionIter = IntoIter; + +macro_rules! gen_constants_and_matches { + ($con:ident, $buf:ident, $db:ident, $($action:ident),*; $($fns:expr),*) => { + mod tags { + //! This module is a collection of tags/strings used for evaluating queries + //! and responses + $( + pub const $action: &'static str = stringify!($action); + )* + } + let mut first = match $buf.next() { + Some(first) => first, + None => return $con.write_response(&**responses::groups::PACKET_ERR).await, + }; + first.make_ascii_uppercase(); + match first.as_str() { + $( + tags::$action => $fns($db, $con, $buf).await?, + )* + _ => { + return $con.write_response(&**responses::groups::UNKNOWN_ACTION).await; + } + } + }; } /// Execute a simple(*) query @@ -80,59 +66,35 @@ where T: ProtocolConnectionExt, Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync, { - let first = match buf.get_first() { - Some(element) => element.to_ascii_uppercase(), - None => return con.write_response(&**responses::groups::PACKET_ERR).await, + let buf = if let Element::FlatArray(arr) = buf { + arr + } else { + return con + .write_response(&**responses::full_responses::R_WRONGTYPE_ERR) + .await; }; - gen_match!( - first, - db, - con, - buf, - tags::TAG_DEL => actions::del::del, - tags::TAG_GET => actions::get::get, - tags::TAG_HEYA => actions::heya::heya, - tags::TAG_EXISTS => actions::exists::exists, - tags::TAG_SET => actions::set::set, - tags::TAG_MGET => actions::mget::mget, - tags::TAG_MSET => actions::mset::mset, - tags::TAG_UPDATE => actions::update::update, - tags::TAG_MUPDATE => actions::mupdate::mupdate, - tags::TAG_SSET => actions::strong::sset, - tags::TAG_SDEL => actions::strong::sdel, - tags::TAG_SUPDATE => actions::strong::supdate, - tags::TAG_DBSIZE => actions::dbsize::dbsize, - tags::TAG_FLUSHDB => actions::flushdb::flushdb, - tags::TAG_USET => actions::uset::uset, - tags::TAG_KEYLEN => actions::keylen::keylen, - tags::TAG_MKSNAP => admin::mksnap::mksnap, - tags::TAG_LSKEYS => actions::lskeys::lskeys + let mut buf = buf.into_iter(); + gen_constants_and_matches!( + con, buf, db, GET, SET, UPDATE, DEL, HEYA, EXISTS, MSET, MGET, MUPDATE, SSET, SDEL, + SUPDATE, DBSIZE, FLUSHDB, USET, KEYLEN, MKSNAP, LSKEYS; + actions::get::get, + actions::set::set, + actions::update::update, + actions::del::del, + actions::heya::heya, + actions::exists::exists, + actions::mset::mset, + actions::mget::mget, + actions::mupdate::mupdate, + actions::strong::sset, + actions::strong::sdel, + actions::strong::supdate, + actions::dbsize::dbsize, + actions::flushdb::flushdb, + actions::uset::uset, + actions::keylen::keylen, + admin::mksnap::mksnap, + actions::lskeys::lskeys ); Ok(()) } - -#[macro_export] -/// A match generator macro built specifically for the `crate::queryengine::execute_simple` function -/// -/// **NOTE:** This macro needs _paths_ for both sides of the $x => $y, to produce something sensible -macro_rules! gen_match { - ($pre:ident, $db:ident, $con:ident, $buf:ident, $($x:pat => $y:expr),*) => { - let flat_array = if let crate::protocol::Element::FlatArray(array) = $buf { - array - } else { - return $con.write_response(&**responses::groups::WRONGTYPE_ERR).await; - }; - match $pre.as_str() { - // First repeat over all the $x => $y patterns, passing in the variables - // and adding .await calls and adding the `?` - $( - $x => $y($db, $con, flat_array).await?, - )* - // Now add the final case where no action is matched - _ => { - return $con.write_response(&**responses::groups::UNKNOWN_ACTION) - .await; - }, - } - }; -} From 2eedb041bbaaad1695436006018c0bc277718352 Mon Sep 17 00:00:00 2001 From: Sayan Nandan Date: Sun, 30 May 2021 17:01:26 +0530 Subject: [PATCH 3/5] Make `gen_constants_and_matches!` macro logical This commit imporves the overall 'look' of the macro and makes it appear more logical --- server/src/queryengine/mod.rs | 41 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/server/src/queryengine/mod.rs b/server/src/queryengine/mod.rs index c075c2da..69307aef 100644 --- a/server/src/queryengine/mod.rs +++ b/server/src/queryengine/mod.rs @@ -36,7 +36,7 @@ use std::vec::IntoIter; pub type ActionIter = IntoIter; macro_rules! gen_constants_and_matches { - ($con:ident, $buf:ident, $db:ident, $($action:ident),*; $($fns:expr),*) => { + ($con:ident, $buf:ident, $db:ident, $($action:ident => $fns:expr),*) => { mod tags { //! This module is a collection of tags/strings used for evaluating queries //! and responses @@ -75,26 +75,25 @@ where }; let mut buf = buf.into_iter(); gen_constants_and_matches!( - con, buf, db, GET, SET, UPDATE, DEL, HEYA, EXISTS, MSET, MGET, MUPDATE, SSET, SDEL, - SUPDATE, DBSIZE, FLUSHDB, USET, KEYLEN, MKSNAP, LSKEYS; - actions::get::get, - actions::set::set, - actions::update::update, - actions::del::del, - actions::heya::heya, - actions::exists::exists, - actions::mset::mset, - actions::mget::mget, - actions::mupdate::mupdate, - actions::strong::sset, - actions::strong::sdel, - actions::strong::supdate, - actions::dbsize::dbsize, - actions::flushdb::flushdb, - actions::uset::uset, - actions::keylen::keylen, - admin::mksnap::mksnap, - actions::lskeys::lskeys + con, buf, db, + GET => actions::get::get, + SET => actions::set::set, + UPDATE => actions::update::update, + DEL => actions::del::del, + HEYA => actions::heya::heya, + EXISTS => actions::exists::exists, + MSET => actions::mset::mset, + MGET => actions::mget::mget, + MUPDATE => actions::mupdate::mupdate, + SSET => actions::strong::sset, + SDEL => actions::strong::sdel, + SUPDATE => actions::strong::supdate, + DBSIZE => actions::dbsize::dbsize, + FLUSHDB => actions::flushdb::flushdb, + USET => actions::uset::uset, + KEYLEN => actions::keylen::keylen, + MKSNAP => admin::mksnap::mksnap, + LSKEYS => actions::lskeys::lskeys ); Ok(()) } From 1bec90baac342267f849d98d77abefb87335ecd0 Mon Sep 17 00:00:00 2001 From: Sayan Nandan Date: Sun, 30 May 2021 17:21:24 +0530 Subject: [PATCH 4/5] Optimize `sset` and `sdel` implementations --- server/src/actions/strong.rs | 39 +++++++++--------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/server/src/actions/strong.rs b/server/src/actions/strong.rs index 5b853d45..214a81b3 100644 --- a/server/src/actions/strong.rs +++ b/server/src/actions/strong.rs @@ -58,7 +58,7 @@ where if howmany & 1 == 1 || howmany == 0 { return con.write_response(&**responses::groups::ACTION_ERR).await; } - let mut failed = Some(false); + let failed; { // We use this additional scope to tell the compiler that the write lock // doesn't go beyond the scope of this function - and is never used across @@ -71,19 +71,8 @@ where failed = None; } else { let mut_table = handle.get_ref(); - while let Some(key) = key_iter.next() { - if mut_table.contains_key(key.as_bytes()) { - // With one of the keys existing - this action can't clearly be done - // So we'll set `failed` to true and ensure that we check this while - // writing a response back to the client - failed = Some(true); - break; - } - } - if !failed.unwrap_or_else(|| unsafe { - // UNSAFE(@ohsayan): Completely safe because we've already set a value for `failed` earlier - unreachable_unchecked() - }) { + if key_iter.all(|key| !mut_table.contains_key(key.as_bytes())) { + failed = Some(false); // Since the failed flag is false, none of the keys existed // So we can safely set the keys while let (Some(key), Some(value)) = (act.next(), act.next()) { @@ -97,6 +86,8 @@ where } } } + } else { + failed = Some(true); } } } @@ -129,7 +120,7 @@ where if howmany == 0 { return con.write_response(&**responses::groups::ACTION_ERR).await; } - let mut failed = Some(false); + let failed; { // We use this additional scope to tell the compiler that the write lock // doesn't go beyond the scope of this function - and is never used across @@ -139,20 +130,8 @@ where failed = None; } else { let mut_table = handle.get_ref(); - while let Some(key) = key_iter.next() { - if !mut_table.contains_key(key.as_bytes()) { - // With one of the keys not existing - this action can't clearly be done - // So we'll set `failed` to true and ensure that we check this while - // writing a response back to the client - failed = Some(true); - break; - } - } - if !failed.unwrap_or_else(|| unsafe { - // UNSAFE(@ohsayan): Again, completely safe as we always assign a value to - // `failed` - unreachable_unchecked() - }) { + if key_iter.all(|key| mut_table.contains_key(key.as_bytes())) { + failed = Some(false); // Since the failed flag is false, all of the keys exist // So we can safely delete the keys act.into_iter().for_each(|key| { @@ -164,6 +143,8 @@ where unreachable_unchecked() }); }); + } else { + failed = Some(true); } } } From 72d871ed3f822c328f699bbf2a7be07b02e3f0f3 Mon Sep 17 00:00:00 2001 From: Sayan Nandan Date: Sun, 30 May 2021 17:26:16 +0530 Subject: [PATCH 5/5] Upgrade deps --- Cargo.lock | 8 ++++---- cli/Cargo.toml | 2 +- server/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3244bfd5..3baa2dce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -903,8 +903,8 @@ dependencies = [ [[package]] name = "skytable" -version = "0.2.3" -source = "git+https://github.com/skytable/client-rust?branch=next#f36d7567ccae39a512d581d7f0d205c88db82b63" +version = "0.3.0" +source = "git+https://github.com/skytable/client-rust?branch=next#acf41607ebb883e539e5e2663341c2fbcf04a97f" dependencies = [ "bytes", "tokio", @@ -976,9 +976,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd3076b5c8cc18138b8f8814895c11eb4de37114a5d127bafdc5e55798ceef37" +checksum = "0a38d31d7831c6ed7aad00aa4c12d9375fd225a6dd77da1d25b707346319a975" dependencies = [ "autocfg", "bytes", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 99ebf081..a5afd8f1 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] libsky = { path = "../libsky" } -tokio = { version = "1.6.0", features = ["full"] } +tokio = { version = "1.6.1", features = ["full"] } bytes = "1.0.1" clap = { version = "2.33.3", features = ["yaml"] } openssl = { version = "0.10.34", features = ["vendored"] } diff --git a/server/Cargo.toml b/server/Cargo.toml index c093090e..a83b554c 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" build = "build.rs" [dependencies] -tokio = { version = "1.6.0", features = ["full"] } +tokio = { version = "1.6.1", features = ["full"] } bytes = "1.0.1" libsky = { path = "../libsky" } bincode = "1.3.3"