Fix pipeline impl and add basic pipeline tests

The pipeline impl had a bug which caused a parse error; this happened
because we directly wrote the length as an integer (with the tsymbol)
when we were supposed to only write the integer in its string form
to the stream. This was fixed.

Also, some preliminary tests were added for pipelines.
next
Sayan Nandan 3 years ago
parent 12db246725
commit 048e79df2c
No known key found for this signature in database
GPG Key ID: 2932644755A97720

170
Cargo.lock generated

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "ahash"
version = "0.7.5"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "991984e3fd003e7ba02eb724f87a0f997b78677c46c0e91f8424ad7394c9886a"
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
"getrandom",
"once_cell",
@ -112,9 +112,9 @@ dependencies = [
[[package]]
name = "clipboard-win"
version = "4.2.1"
version = "4.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e4ea1881992efc993e4dc50a324cdbd03216e41bdc8385720ff47efc9bd2ca8"
checksum = "3db8340083d28acb43451166543b98c838299b7e0863621be53a338adceea0ed"
dependencies = [
"error-code",
"str-buf",
@ -290,73 +290,12 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
[[package]]
name = "futures"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca"
dependencies = [
"futures-channel",
"futures-core",
"futures-executor",
"futures-io",
"futures-sink",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-channel"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
name = "futures-core"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d"
[[package]]
name = "futures-executor"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c"
dependencies = [
"futures-core",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-io"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377"
[[package]]
name = "futures-macro"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb"
dependencies = [
"autocfg",
"proc-macro-hack",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "futures-sink"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11"
[[package]]
name = "futures-task"
version = "0.3.17"
@ -370,18 +309,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481"
dependencies = [
"autocfg",
"futures-channel",
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
"pin-project-lite",
"pin-utils",
"proc-macro-hack",
"proc-macro-nested",
"slab",
]
[[package]]
@ -421,9 +352,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "instant"
version = "0.1.11"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "716d3d89f35ac6a34fd0eed635395f4c3b76fa889338a4632e5231a8684216bd"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
"cfg-if",
]
@ -463,9 +394,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.103"
version = "0.2.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6"
checksum = "869d572136620d55835903746bcb5cdc54cb2851fd0aeec53220b4bb65ef3013"
[[package]]
name = "libsky"
@ -520,9 +451,9 @@ dependencies = [
[[package]]
name = "mio"
version = "0.7.13"
version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16"
checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
dependencies = [
"libc",
"log",
@ -608,9 +539,9 @@ checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
[[package]]
name = "openssl"
version = "0.10.36"
version = "0.10.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a"
checksum = "2bc6b9e4403633698352880b22cbe2f0e45dd0177f6fabe4585536e56a3e4f75"
dependencies = [
"bitflags",
"cfg-if",
@ -631,9 +562,9 @@ dependencies = [
[[package]]
name = "openssl-sys"
version = "0.9.67"
version = "0.9.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058"
checksum = "1c571f25d3f66dd427e417cebf73dbe2361d6125cf6e3a70d143fdf97c9f5150"
dependencies = [
"autocfg",
"cc",
@ -682,33 +613,21 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.20"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c9b1041b4387893b91ee6746cddfc28516aff326a3519fb2adf820932c5e6cb"
checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f"
[[package]]
name = "ppv-lite86"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741"
[[package]]
name = "proc-macro-hack"
version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "proc-macro-nested"
version = "0.1.7"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
[[package]]
name = "proc-macro2"
version = "1.0.30"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edc3358ebc67bc8b7fa0c007f945b0b18226f78437d61bec735a9eb96b61ee70"
checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
dependencies = [
"unicode-xid",
]
@ -940,7 +859,7 @@ dependencies = [
"rand",
"serde",
"serde_json",
"skytable 0.6.0 (git+https://github.com/skytable/client-rust?branch=next)",
"skytable 0.6.1 (git+https://github.com/skytable/client-rust?branch=next)",
]
[[package]]
@ -951,7 +870,7 @@ dependencies = [
"clap",
"env_logger",
"log",
"skytable 0.6.0 (git+https://github.com/skytable/client-rust.git)",
"skytable 0.6.1 (git+https://github.com/skytable/client-rust.git)",
]
[[package]]
@ -988,7 +907,7 @@ dependencies = [
"regex",
"serde",
"sky_macros",
"skytable 0.6.0 (git+https://github.com/skytable/client-rust?branch=next)",
"skytable 0.6.1 (git+https://github.com/skytable/client-rust?branch=pipelines)",
"tokio",
"tokio-openssl",
"toml",
@ -1003,14 +922,14 @@ dependencies = [
"crossterm",
"libsky",
"rustyline",
"skytable 0.6.0 (git+https://github.com/skytable/client-rust?branch=next)",
"skytable 0.6.1 (git+https://github.com/skytable/client-rust?branch=next)",
"tokio",
]
[[package]]
name = "skytable"
version = "0.6.0"
source = "git+https://github.com/skytable/client-rust?branch=next#06de6c85930e8e4b19dbbb8c2bd378594c98b493"
version = "0.6.1"
source = "git+https://github.com/skytable/client-rust?branch=next#2f67d7c7592e5272bf00b5f2fb95cf44fb700655"
dependencies = [
"bytes",
"openssl",
@ -1020,14 +939,19 @@ dependencies = [
[[package]]
name = "skytable"
version = "0.6.0"
source = "git+https://github.com/skytable/client-rust.git#06de6c85930e8e4b19dbbb8c2bd378594c98b493"
version = "0.6.1"
source = "git+https://github.com/skytable/client-rust?branch=pipelines#8e5175107111b5661dc6b22e34928a5a63b160d5"
dependencies = [
"bytes",
"openssl",
"tokio",
"tokio-openssl",
]
[[package]]
name = "slab"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"
name = "skytable"
version = "0.6.1"
source = "git+https://github.com/skytable/client-rust.git#2f67d7c7592e5272bf00b5f2fb95cf44fb700655"
[[package]]
name = "smallvec"
@ -1052,7 +976,7 @@ dependencies = [
"log",
"num_cpus",
"rand",
"skytable 0.6.0 (git+https://github.com/skytable/client-rust?branch=next)",
"skytable 0.6.1 (git+https://github.com/skytable/client-rust?branch=next)",
"sysinfo",
]
@ -1064,9 +988,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "syn"
version = "1.0.80"
version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d010a1623fbd906d51d650a9916aaefc05ffa0e4053ff7fe601167f3e715d194"
checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"
dependencies = [
"proc-macro2",
"quote",
@ -1119,9 +1043,9 @@ dependencies = [
[[package]]
name = "tokio"
version = "1.12.0"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2c2416fdedca8443ae44b4527de1ea633af61d8f7169ffa6e72c5b53d24efcc"
checksum = "588b2d10a336da58d877567cd8fb8a14b463e2104910f8132cd054b4b96e29ee"
dependencies = [
"autocfg",
"bytes",
@ -1139,9 +1063,9 @@ dependencies = [
[[package]]
name = "tokio-macros"
version = "1.5.0"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2dd85aeaba7b68df939bd357c6afb36c87951be9e80bf9c859f2fc3e9fca0fd"
checksum = "114383b041aa6212c579467afa0075fbbdd0718de036100bc0ba7961d8cb9095"
dependencies = [
"proc-macro2",
"quote",
@ -1150,11 +1074,11 @@ dependencies = [
[[package]]
name = "tokio-openssl"
version = "0.6.2"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f24cddc8445a4dc8359cdd9e91c19d544fc95f672e32afe8945852b9381a09fe"
checksum = "c08f9ffb7809f1b20c1b398d92acf4cc719874b3b2b2d9ea2f09b4a80350878a"
dependencies = [
"futures",
"futures-util",
"openssl",
"openssl-sys",
"tokio",

@ -9,7 +9,7 @@ version = "0.7.1"
# internal deps
libsky = { path = "../libsky" }
sky_macros = { path = "../sky-macros" }
skytable = { git = "https://github.com/skytable/client-rust", branch = "next", default-features = false }
skytable = { git = "https://github.com/skytable/client-rust", branch = "pipelines", default-features = false }
# external deps
ahash = "0.7.5"
bytes = "1.1.0"
@ -44,7 +44,7 @@ libstress = { path = "../libstress" }
skytable = { git = "https://github.com/skytable/client-rust", features = [
"async",
"aio-ssl",
], default-features = false, branch = "next" }
], default-features = false, branch = "pipelines" }
# external deps
bincode = "1.3.3"
rand = "0.8.4"

@ -36,6 +36,7 @@
//! respones in compliance with the Skyhash protocol.
use super::tcp::Connection;
use crate::corestore::buffers::Integer64;
use crate::corestore::Corestore;
use crate::dbnet::tcp::BufferedSocketStream;
use crate::dbnet::Terminator;
@ -296,7 +297,9 @@ where
Box::pin(async move {
let slf = self;
slf.write_response([b'*']).await?;
slf.write_response(len).await?;
slf.get_mut_stream()
.write_all(&Integer64::init(len as u64))
.await?;
slf.write_response([b'\n']).await?;
Ok(())
})

@ -33,6 +33,7 @@ mod inspect_tests;
mod kvengine;
mod kvengine_encoding;
mod kvengine_list;
mod pipeline;
mod ssl {
use skytable::aio::TlsConnection;

@ -0,0 +1,54 @@
/*
* Created on Sat Oct 30 2021
*
* This file is a part of Skytable
* Skytable (formerly known as TerrabaseDB or Skybase) is a free and open-source
* NoSQL database written by Sayan Nandan ("the Author") with the
* vision to provide flexibility in data modelling without compromising
* on performance, queryability or scalability.
*
* Copyright (c) 2020, Sayan Nandan <ohsayan@outlook.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#[sky_macros::dbtest]
mod tests {
use skytable::{query, Element, Pipeline, RespCode};
async fn test_pipeline_heya_echo() {
let pipe = Pipeline::new()
.add(query!("heya", "first"))
.add(query!("heya", "second"));
let ret = con.run_pipeline(pipe).await.unwrap();
assert_eq!(
ret,
vec![
Element::String("first".to_owned()),
Element::String("second".to_owned())
]
)
}
async fn test_pipeline_basic() {
let pipe = Pipeline::new().add(query!("heya")).add(query!("get", "x"));
let ret = con.run_pipeline(pipe).await.unwrap();
assert_eq!(
ret,
vec![
Element::String("HEY!".to_owned()),
Element::RespCode(RespCode::NotFound)
]
);
}
}
Loading…
Cancel
Save