Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split shotover library/binary into separate crates #1102

Merged
merged 2 commits into from Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 36 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion Cargo.toml
@@ -1,5 +1,6 @@
[workspace]
members = [
"shotover",
"shotover-proxy",
"test-helpers",
"tokio-bin-process",
Expand All @@ -16,8 +17,9 @@ codegen-units = 1

[workspace.dependencies]
bytes = "1.0.0"
tokio-openssl = "0.6.2"
tokio = { version = "1.25.0", features = ["full", "macros"] }
tokio-util = { version = "0.7.7" }
tokio-openssl = "0.6.2"
itertools = "0.10.1"
openssl = { version = "0.10.36", features = ["vendored"] }
anyhow = "1.0.42"
Expand All @@ -34,3 +36,13 @@ nix = "0.26.0"
serde_json = "1.0"
rcgen = "0.10.0"
subprocess = "0.2.7"
chacha20poly1305 = { version = "0.10.0", features = ["std"] }
csv = "1.2.0"
redis-protocol = { version = "4.0.1", features = ["decode-mut"] }
bincode = "1.3.1"
futures = "0.3"
hex = "0.4.3"
hex-literal = "0.3.3"
rand = "0.8.4"
rand_distr = "0.4.1"
clap = { version = "4.0.4", features = ["cargo", "derive"] }
98 changes: 26 additions & 72 deletions shotover-proxy/Cargo.toml
Expand Up @@ -3,94 +3,48 @@ name = "shotover-proxy"
version = "0.1.9"
authors = ["Ben <ben@instaclustr.com>"]
edition = "2021"
rust-version = "1.56"
license = "Apache-2.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
# Include WIP alpha transforms in the public API
alpha-transforms = []
cassandra-cpp-driver-tests = ["test-helpers/cassandra-cpp-driver-tests"]

[dependencies]
pretty-hex = "0.3.0"
hex = "0.4.3"
tokio.workspace = true
tokio-util = { version = "0.7.7" }
tokio-stream = "0.1.2"
bytes.workspace = true
bytes-utils = "0.1.1"
futures = "0.3"
async-trait = "0.1.30"
clap = { version = "4.0.4", features = ["cargo", "derive"] }
derivative = "2.1.1"
itertools.workspace = true
rand = { version = "0.8.4", features = ["small_rng"] }
rand_distr = "0.4.1"
cached = "0.42"
tokio-openssl.workspace = true
openssl.workspace = true
async-recursion = "1.0"
governor = { version = "0.5.0", default-features = false, features = ["std", "jitter", "quanta"] }
nonzero_ext = "0.3.0"
version-compare = "0.1"
split-iter = "0.1.0"

# Error handling
thiserror = "1.0"
anyhow.workspace = true
backtrace = "0.3.66"

# Parsers
cql3-parser = "0.3.2"
serde.workspace = true
serde_json.workspace = true
serde_yaml.workspace = true
bincode = "1.3.1"
num = { version = "0.4.0", features = ["serde"] }
uuid.workspace = true
bigdecimal = {version ="0.3.0", features = ["serde"] }
base64 = "0.21.0"

#Observability
metrics = "0.20.0"
metrics-exporter-prometheus = "0.11.0"
tokio.workspace = true
clap.workspace = true
shotover = { path = "../shotover" }
tracing.workspace = true
tracing-subscriber.workspace = true
tracing-appender = "0.2.0"
hyper = { version = "0.14.14", features = ["server"] }
halfbrown = "0.1.11"

# Transform dependencies
redis-protocol = { version = "4.0.1", features = ["decode-mut"] }
cassandra-protocol.workspace = true
crc16 = "0.4.0"
ordered-float = { version = "3.0.0", features = ["serde"] }

#Crypto
rusoto_kms = "0.48.0"
rusoto_signature = "0.48.0"
csv = "1.2.0"
strum_macros = "0.24"
chacha20poly1305 = { version = "0.10.0", features = ["std"] }
generic-array = { version = "0.14", features = ["serde"] }
dyn-clone = "1.0.10"
kafka-protocol = "0.6.0"
typetag = "0.2.5"

[dev-dependencies]
criterion = { git = "https://github.com/shotover/criterion.rs", branch = "0.4.0-bench_with_input_fn", features = ["async_tokio"] }
redis.workspace = true
serial_test = "1.0.0"
rstest = "0.17.0"
cassandra-cpp = { version = "2.0.0" }
test-helpers = { path = "../test-helpers", features = ["cassandra-cpp-driver-tests"] }
hex-literal = "0.3.3"
rdkafka = { version = "0.29", features = ["cmake-build"] }
redis.workspace = true
chacha20poly1305.workspace = true
serde.workspace = true
csv.workspace = true
uuid.workspace = true
itertools.workspace = true
nix.workspace = true
cdrs-tokio.workspace = true
rstest = "0.17.0"
rdkafka = { version = "0.29", features = ["cmake-build"] }
redis-protocol.workspace = true
tokio-util.workspace = true
bincode.workspace = true
futures.workspace = true
hex.workspace = true
hex-literal.workspace = true
cassandra-protocol.workspace = true
bytes.workspace = true
rand.workspace = true
rand_distr.workspace = true

[[bench]]
name = "benches"
harness = false

[features]
# Include WIP alpha transforms in the public API
alpha-transforms = ["shotover/alpha-transforms"]
cassandra-cpp-driver-tests = ["test-helpers/cassandra-cpp-driver-tests"]
28 changes: 14 additions & 14 deletions shotover-proxy/benches/benches/chain.rs
Expand Up @@ -3,21 +3,21 @@ use cassandra_protocol::compression::Compression;
use cassandra_protocol::{consistency::Consistency, frame::Version, query::QueryParams};
use criterion::{criterion_group, BatchSize, Criterion};
use hex_literal::hex;
use shotover_proxy::frame::cassandra::{parse_statement_single, Tracing};
use shotover_proxy::frame::RedisFrame;
use shotover_proxy::frame::{CassandraFrame, CassandraOperation, Frame};
use shotover_proxy::message::{Message, ProtocolType, QueryType};
use shotover_proxy::transforms::cassandra::peers_rewrite::CassandraPeersRewrite;
use shotover_proxy::transforms::chain::{TransformChain, TransformChainBuilder};
use shotover_proxy::transforms::debug::returner::{DebugReturner, Response};
use shotover_proxy::transforms::filter::QueryTypeFilter;
use shotover_proxy::transforms::null::NullSink;
use shotover::frame::cassandra::{parse_statement_single, Tracing};
use shotover::frame::RedisFrame;
use shotover::frame::{CassandraFrame, CassandraOperation, Frame};
use shotover::message::{Message, ProtocolType, QueryType};
use shotover::transforms::cassandra::peers_rewrite::CassandraPeersRewrite;
use shotover::transforms::chain::{TransformChain, TransformChainBuilder};
use shotover::transforms::debug::returner::{DebugReturner, Response};
use shotover::transforms::filter::QueryTypeFilter;
use shotover::transforms::null::NullSink;
#[cfg(feature = "alpha-transforms")]
use shotover_proxy::transforms::protect::{KeyManagerConfig, ProtectConfig};
use shotover_proxy::transforms::redis::cluster_ports_rewrite::RedisClusterPortsRewrite;
use shotover_proxy::transforms::redis::timestamp_tagging::RedisTimestampTagger;
use shotover_proxy::transforms::throttling::RequestThrottlingConfig;
use shotover_proxy::transforms::{TransformConfig, Wrapper};
use shotover::transforms::protect::{KeyManagerConfig, ProtectConfig};
use shotover::transforms::redis::cluster_ports_rewrite::RedisClusterPortsRewrite;
use shotover::transforms::redis::timestamp_tagging::RedisTimestampTagger;
use shotover::transforms::throttling::RequestThrottlingConfig;
use shotover::transforms::{TransformConfig, Wrapper};

fn criterion_benchmark(c: &mut Criterion) {
let rt = tokio::runtime::Runtime::new().unwrap();
Expand Down
12 changes: 6 additions & 6 deletions shotover-proxy/benches/benches/codec.rs
Expand Up @@ -4,12 +4,12 @@ use cassandra_protocol::frame::message_result::{
};
use cassandra_protocol::frame::Version;
use criterion::{black_box, criterion_group, BatchSize, Criterion};
use shotover_proxy::codec::cassandra::CassandraCodecBuilder;
use shotover_proxy::codec::{CodecBuilder, Direction};
use shotover_proxy::frame::cassandra::{parse_statement_single, Tracing};
use shotover_proxy::frame::{CassandraFrame, CassandraOperation, CassandraResult, Frame};
use shotover_proxy::message::Message;
use shotover_proxy::message_value::{IntSize, MessageValue};
use shotover::codec::cassandra::CassandraCodecBuilder;
use shotover::codec::{CodecBuilder, Direction};
use shotover::frame::cassandra::{parse_statement_single, Tracing};
use shotover::frame::{CassandraFrame, CassandraOperation, CassandraResult, Frame};
use shotover::message::Message;
use shotover::message_value::{IntSize, MessageValue};
use tokio_util::codec::Encoder;

fn criterion_benchmark(c: &mut Criterion) {
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/main.rs
Expand Up @@ -3,7 +3,7 @@

use anyhow::{Context, Result};
use clap::Parser;
use shotover_proxy::runner::{ConfigOpts, Runner, TracingState};
use shotover::runner::{ConfigOpts, Runner, TracingState};
use tokio::runtime::Runtime;

fn main() -> Result<()> {
Expand Down
8 changes: 4 additions & 4 deletions shotover-proxy/tests/cassandra_int_tests/cluster/mod.rs
@@ -1,9 +1,9 @@
use cassandra_protocol::frame::message_startup::BodyReqStartup;
use cassandra_protocol::frame::Version;
use shotover_proxy::frame::{cassandra::Tracing, CassandraFrame, CassandraOperation, Frame};
use shotover_proxy::message::Message;
use shotover_proxy::tls::{TlsConnector, TlsConnectorConfig};
use shotover_proxy::transforms::cassandra::sink_cluster::{
use shotover::frame::{cassandra::Tracing, CassandraFrame, CassandraOperation, Frame};
use shotover::message::Message;
use shotover::tls::{TlsConnector, TlsConnectorConfig};
use shotover::transforms::cassandra::sink_cluster::{
node::{CassandraNode, ConnectionFactory},
topology::{create_topology_task, TaskConnectionInfo},
};
Expand Down
4 changes: 2 additions & 2 deletions shotover-proxy/tests/cassandra_int_tests/mod.rs
Expand Up @@ -222,7 +222,7 @@ async fn cluster_single_rack_v4(#[case] driver: CassandraDriver) {
.shutdown_and_then_consume_events(&[
EventMatcher::new()
.with_level(Level::Error)
.with_target("shotover_proxy::server")
.with_target("shotover::server")
.with_message(
r#"connection was unexpectedly terminated

Expand All @@ -235,7 +235,7 @@ Caused by:
.with_count(Count::Any),
EventMatcher::new()
.with_level(Level::Warn)
.with_target("shotover_proxy::transforms::cassandra::sink_cluster")
.with_target("shotover::transforms::cassandra::sink_cluster")
.with_message(
r#"A successful connection to a control node was made but attempts to connect to these nodes failed first:
* 172.16.1.3:9044:
Expand Down
4 changes: 2 additions & 2 deletions shotover-proxy/tests/redis_int_tests/basic_driver_tests.rs
Expand Up @@ -6,8 +6,8 @@ use rand_distr::Alphanumeric;
use redis::aio::Connection;
use redis::cluster::ClusterConnection;
use redis::{AsyncCommands, Commands, ErrorKind, RedisError, Value};
use shotover_proxy::frame::RedisFrame;
use shotover_proxy::tcp;
use shotover::frame::RedisFrame;
use shotover::tcp;
use std::collections::{HashMap, HashSet};
use std::thread::sleep;
use std::time::Duration;
Expand Down