1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
mod client; mod error; mod spu; mod sc; mod kf; mod spu_controller; mod leader; pub mod profile; pub mod query_params; pub use client::ClientConfig; pub use client::Client; pub use error::ClientError; pub use spu::SpuLeader; pub use spu::Spu; pub use sc::ScClient; pub use kf::KfClient; pub use kf::KfLeader; pub use spu_controller::SpuController; pub use leader::ReplicaLeader; use types::socket_helpers::ServerAddress; use types::SpuId; #[derive(Debug)] pub struct LeaderConfig { spu_id: SpuId, addr: ServerAddress, client_id: String, topic: String, partition: i32 } impl LeaderConfig { pub fn new<A>(addr: A,topic: String,partition: i32) -> Self where A: Into<ServerAddress> { Self { addr: addr.into(), topic, partition, spu_id: 0, client_id: "spu".to_owned() } } pub fn client_id<S>(mut self,id: S) -> Self where S: Into<String> { self.client_id = id.into(); self } pub fn spu_id(mut self,id: SpuId) -> Self { self.spu_id = id; self } fn as_client_config(&self) -> ClientConfig<String> { ClientConfig::new(self.addr.to_string()) .client_id(self.client_id.clone()) } }