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

Remove clone from TransformsConfig #1062

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions shotover-proxy/src/config/topology.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use std::collections::HashMap;
use tokio::sync::watch;
use tracing::info;

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct Topology {
pub sources: HashMap<String, SourcesConfig>,
pub chain_config: HashMap<String, Vec<TransformsConfig>>,
pub source_to_chain_mapping: HashMap<String, String>,
}

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct TopologyConfig {
pub sources: HashMap<String, SourcesConfig>,
pub chain_config: HashMap<String, Vec<TransformsConfig>>,
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/cassandra/peers_rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use cql3_parser::common::{FQName, Identifier};
use cql3_parser::select::SelectElement;
use serde::Deserialize;

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct CassandraPeersRewriteConfig {
pub port: u16,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const PEERS_V2_TABLE: FQNameRef = FQNameRef {
name: IdentifierRef::Quoted("peers_v2"),
};

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct CassandraSinkClusterConfig {
/// contact points must be within the specified data_center and rack.
/// If this is not followed, shotover's invariants will still be upheld but shotover will communicate with a
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/cassandra/sink_single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::time::Duration;
use tokio::sync::{mpsc, oneshot};
use tracing::trace;

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct CassandraSinkSingleConfig {
#[serde(rename = "remote_address")]
pub address: String,
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/coalesce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct Coalesce {
last_write: Instant,
}

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct CoalesceConfig {
pub flush_when_buffered_message_count: Option<usize>,
pub flush_when_millis_since_last_flush: Option<u128>,
Expand Down
4 changes: 2 additions & 2 deletions shotover-proxy/src/transforms/debug/force_parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use serde::Deserialize;

/// Messages that pass through this transform will be parsed.
/// Must be individually enabled at the request or response level.
#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct DebugForceParseConfig {
parse_requests: bool,
parse_responses: bool,
Expand All @@ -31,7 +31,7 @@ impl DebugForceParseConfig {

/// Messages that pass through this transform will be parsed and then reencoded.
/// Must be individually enabled at the request or response level.
#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct DebugForceEncodeConfig {
encode_requests: bool,
encode_responses: bool,
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/debug/returner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anyhow::{anyhow, Result};
use async_trait::async_trait;
use serde::Deserialize;

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct DebugReturnerConfig {
#[serde(flatten)]
response: Response,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use serde::Deserialize;
use std::collections::HashMap;
use tracing::{debug, error, trace, warn};

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct ConsistentScatterConfig {
pub route_map: HashMap<String, Vec<TransformsConfig>>,
pub write_consistency: i32,
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct QueryTypeFilter {
pub filter: QueryType,
}

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct QueryTypeFilterConfig {
pub filter: QueryType,
}
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/kafka/sink_single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::time::Duration;
use tokio::sync::{mpsc, oneshot};
use tokio::time::timeout;

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct KafkaSinkSingleConfig {
#[serde(rename = "remote_address")]
pub address: String,
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/load_balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use serde::Deserialize;
use std::sync::Arc;
use tokio::sync::Mutex;

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct ConnectionBalanceAndPoolConfig {
pub name: String,
pub max_connections: usize,
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl Transforms {

/// The TransformsConfig enum is responsible for TransformConfig registration and enum dispatch
/// in the transform chain. Allows you to register your config struct for the config file.
#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub enum TransformsConfig {
#[cfg(feature = "alpha-transforms")]
KafkaSinkSingle(KafkaSinkSingleConfig),
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/parallel_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ where
}
}

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct ParallelMapConfig {
pub parallelism: u32,
pub chain: Vec<TransformsConfig>,
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/protect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod key_management;
mod local_kek;
mod pkcs_11;

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct ProtectConfig {
pub keyspace_table_columns: HashMap<String, HashMap<String, Vec<String>>>,
pub key_manager: KeyManagerConfig,
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/query_counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct QueryCounter {
counter_name: String,
}

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct QueryCounterConfig {
pub name: String,
}
Expand Down
4 changes: 2 additions & 2 deletions shotover-proxy/src/transforms/redis/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ enum CacheableState {
Skip,
}

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct TableCacheSchemaConfig {
partition_key: Vec<String>,
range_key: Vec<String>,
Expand All @@ -75,7 +75,7 @@ impl From<&TableCacheSchemaConfig> for TableCacheSchema {
}
}

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct RedisConfig {
pub caching_schema: HashMap<String, TableCacheSchemaConfig>,
pub chain: Vec<TransformsConfig>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::error::ChainResponse;
use crate::frame::Frame;
use crate::transforms::{Transform, TransformBuilder, Transforms, Wrapper};

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct RedisClusterPortsRewriteConfig {
pub new_port: u16,
}
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/redis/sink_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const SLOT_SIZE: usize = 16384;

type ChannelMap = HashMap<String, Vec<UnboundedSender<Request>>>;

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct RedisSinkClusterConfig {
pub first_contact_points: Vec<String>,
pub direct_destination: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/redis/sink_single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use tokio_util::codec::FramedRead;
use tokio_util::codec::FramedWrite;
use tracing::Instrument;

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct RedisSinkSingleConfig {
#[serde(rename = "remote_address")]
pub address: String,
Expand Down
4 changes: 2 additions & 2 deletions shotover-proxy/src/transforms/tee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ pub enum ConsistencyBehavior {
SubchainOnMismatch(BufferedChain),
}

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct TeeConfig {
pub behavior: Option<ConsistencyBehaviorConfig>,
pub timeout_micros: Option<u64>,
pub chain: Vec<TransformsConfig>,
pub buffer_size: Option<usize>,
}

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub enum ConsistencyBehaviorConfig {
Ignore,
FailOnMismatch,
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/src/transforms/throttling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::sync::Arc;

use super::Transforms;

#[derive(Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug)]
pub struct RequestThrottlingConfig {
pub max_requests_per_second: NonZeroU32,
}
Expand Down