Skip to content

Commit

Permalink
Remove clone from TransformsConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai committed Mar 1, 2023
1 parent a47c5d6 commit c752f04
Show file tree
Hide file tree
Showing 21 changed files with 25 additions and 25 deletions.
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

0 comments on commit c752f04

Please sign in to comment.