pub struct PeerConfig {
pub node_id: String,
pub redis_url: String,
pub priority: u32,
pub circuit_failure_threshold: u32,
pub circuit_reset_timeout_sec: u64,
pub redis_prefix: Option<String>,
}Expand description
Configuration for a single peer node.
Each peer represents a remote node whose CDC stream we tail.
Fields§
§node_id: StringPeer’s unique node ID (for logging and deduplication).
redis_url: StringRedis URL for connecting to the peer’s CDC stream.
Example: "redis://peer1.example.com:6379"
priority: u32Optional: Priority for sync (lower = higher priority). Can be used for tiered replication strategies.
circuit_failure_threshold: u32Number of consecutive failures before circuit opens.
circuit_reset_timeout_sec: u64How long to wait before trying again after circuit opens (seconds).
redis_prefix: Option<String>Redis key prefix used by the peer (e.g., “sync:”). Must match the peer’s sync-engine configuration.
Implementations§
Source§impl PeerConfig
impl PeerConfig
Sourcepub fn cdc_stream_key(&self) -> String
pub fn cdc_stream_key(&self) -> String
Get the CDC stream key for this peer. Convention: redis_prefix includes trailing colon (e.g., “redsqrl:”). Result: “redsqrl:cdc” or just “cdc” if no prefix.
Sourcepub fn for_testing(node_id: &str, redis_url: &str) -> Self
pub fn for_testing(node_id: &str, redis_url: &str) -> Self
Create a peer config for testing.
Trait Implementations§
Source§impl Clone for PeerConfig
impl Clone for PeerConfig
Source§fn clone(&self) -> PeerConfig
fn clone(&self) -> PeerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PeerConfig
impl Debug for PeerConfig
Source§impl<'de> Deserialize<'de> for PeerConfig
impl<'de> Deserialize<'de> for PeerConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for PeerConfig
impl RefUnwindSafe for PeerConfig
impl Send for PeerConfig
impl Sync for PeerConfig
impl Unpin for PeerConfig
impl UnwindSafe for PeerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more