pub struct CrossClusterLink {
pub throttle: SendThrottle,
/* private fields */
}Expand description
Cross-cluster QUIC link from a mirror to its source cluster.
Manages connection establishment, cluster-id authentication, exponential backoff reconnect, and per-mirror bytes-in-flight throttle.
Fields§
§throttle: SendThrottleBytes-in-flight throttle shared with the snapshot / log sender.
Implementations§
Source§impl CrossClusterLink
impl CrossClusterLink
Sourcepub fn new(
source_cluster_id: String,
source_database_id: String,
source_addr: SocketAddr,
endpoint: Endpoint,
client_config: ClientConfig,
throttle: SendThrottle,
) -> Self
pub fn new( source_cluster_id: String, source_database_id: String, source_addr: SocketAddr, endpoint: Endpoint, client_config: ClientConfig, throttle: SendThrottle, ) -> Self
Create a new (disconnected) link.
Call connect to open the initial connection.
Sourcepub fn source_cluster_id(&self) -> &str
pub fn source_cluster_id(&self) -> &str
The source cluster-id this link is targeting.
Sourcepub async fn connect(
&self,
last_applied_lsn: u64,
) -> Result<MirrorHelloAck, MirrorError>
pub async fn connect( &self, last_applied_lsn: u64, ) -> Result<MirrorHelloAck, MirrorError>
Establish the initial QUIC connection and run the cross-cluster
handshake. Returns the MirrorHelloAck on success.
If the source rejects the connection (cluster-id mismatch, observer
violation, etc.) this returns a MirrorError immediately — no
backoff is applied, because these are hard-configuration errors that
won’t be fixed by retrying.
Sourcepub async fn open_bidi_stream(
&self,
) -> Result<(SendStream, RecvStream), MirrorError>
pub async fn open_bidi_stream( &self, ) -> Result<(SendStream, RecvStream), MirrorError>
Open a new QUIC bidi stream on the existing connection.
Returns an error when the link is in Disconnected state; the caller
should call schedule_reconnect first.
Sourcepub async fn schedule_reconnect(
&self,
last_applied_lsn: u64,
) -> Result<MirrorHelloAck, MirrorError>
pub async fn schedule_reconnect( &self, last_applied_lsn: u64, ) -> Result<MirrorHelloAck, MirrorError>
Reconnect with exponential backoff after a disconnect.
Drives the following sequence:
- Mark link as
Disconnected, reset throttle. - Sleep for the current backoff duration.
- Dial + handshake.
- On success, mark
Connectedand return the ack. - On failure, double the delay (capped at
RECONNECT_MAX_MS) and repeat from step 2.
Auto Trait Implementations§
impl !Freeze for CrossClusterLink
impl !RefUnwindSafe for CrossClusterLink
impl Send for CrossClusterLink
impl Sync for CrossClusterLink
impl Unpin for CrossClusterLink
impl UnsafeUnpin for CrossClusterLink
impl !UnwindSafe for CrossClusterLink
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.