pub struct OpenSearchSink { /* private fields */ }Expand description
A Sink that writes directly to OpenSearch clusters over pooled HTTP.
Holds a ClusterPool per cluster, its own base URL and pooled HTTP/1.1
and HTTP/2 (prior-knowledge) clients. Each operation selects the client
matching its resolved upstream Protocol (docs/04 §7), so the proxy can
speak h2 to a cluster that supports it while defaulting to h1. Every dispatch
is bounded by a per-request timeout so a stuck upstream fails fast (NFR-R7),
and a per-cluster circuit breaker sheds a cluster that keeps failing.
Implementations§
Source§impl OpenSearchSink
impl OpenSearchSink
Sourcepub fn new() -> Self
pub fn new() -> Self
Builds an empty sink. Cluster pools are created on demand from the endpoint each routing target carries (the tenancy’s placement result is the source of truth for where every cluster lives); there is no static endpoint catalog.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sets the per-request upstream timeout (builder style).
Sourcepub fn with_breaker(self, failure_threshold: u32, cooldown: Duration) -> Self
pub fn with_breaker(self, failure_threshold: u32, cooldown: Duration) -> Self
Sets the circuit-breaker thresholds: open after failure_threshold
consecutive failures, shed for cooldown before a half-open trial.
Sourcepub fn with_clock(self, clock: Arc<dyn Clock>) -> Self
pub fn with_clock(self, clock: Arc<dyn Clock>) -> Self
Swaps the clock the breaker reads (tests inject a ManualClock).
Sourcepub fn pool_stats(&self, cluster: &ClusterId) -> Option<PoolStats>
pub fn pool_stats(&self, cluster: &ClusterId) -> Option<PoolStats>
A snapshot of a cluster’s connection-reuse counters, or None if no pool
has been built for it yet. Lets operators (and tests) verify the pool is
amortizing handshakes, connections opened far below requests dispatched
(NFR-P; the docs/11 M4 “pool reuse rates verified” exit gate).
Sourcepub fn pool_stats_all(&self) -> Vec<(ClusterId, PoolStats)>
pub fn pool_stats_all(&self) -> Vec<(ClusterId, PoolStats)>
Pool-reuse counters for every pooled cluster, paired with its id, the
fleet-/agent-facing readout behind the /metrics snapshot. Order is
unspecified (a HashMap walk); callers that need stability sort by id.
Trait Implementations§
Source§impl Debug for OpenSearchSink
impl Debug for OpenSearchSink
Source§impl Default for OpenSearchSink
impl Default for OpenSearchSink
Source§impl Reader for OpenSearchSink
impl Reader for OpenSearchSink
Source§async fn get(&self, op: ReadOp) -> Result<ReadOutcome, SinkError>
async fn get(&self, op: ReadOp) -> Result<ReadOutcome, SinkError>
Source§async fn search(&self, op: SearchOp) -> Result<SearchOutcome, SinkError>
async fn search(&self, op: SearchOp) -> Result<SearchOutcome, SinkError>
Source§async fn count(&self, op: SearchOp) -> Result<CountOutcome, SinkError>
async fn count(&self, op: SearchOp) -> Result<CountOutcome, SinkError>
Source§async fn cursor(&self, op: CursorOp) -> Result<CursorOutcome, SinkError>
async fn cursor(&self, op: CursorOp) -> Result<CursorOutcome, SinkError>
OpenSearchSink overrides it with a real upstream call. Read moreSource§async fn search_stream(
&self,
op: SearchOp,
) -> Result<StreamingSearch, SinkError>
async fn search_stream( &self, op: SearchOp, ) -> Result<StreamingSearch, SinkError>
aggregations) never lands in
memory. The default is unsupported; OpenSearchSink overrides it with a
real streamed upstream call. Read moreSource§async fn forward_stream(
&self,
op: ForwardOp,
body: ByteBody,
) -> Result<StreamingForward, SinkError>
async fn forward_stream( &self, op: ForwardOp, body: ByteBody, ) -> Result<StreamingForward, SinkError>
OpenSearchSink overrides it with a real streamed upstream call. Read more