pub trait Reader: Send + Sync {
// Required methods
fn get(
&self,
op: ReadOp,
) -> impl Future<Output = Result<ReadOutcome, SinkError>> + Send;
fn search(
&self,
op: SearchOp,
) -> impl Future<Output = Result<SearchOutcome, SinkError>> + Send;
fn count(
&self,
op: SearchOp,
) -> impl Future<Output = Result<CountOutcome, SinkError>> + Send;
// Provided methods
fn cursor(
&self,
_op: CursorOp,
) -> impl Future<Output = Result<CursorOutcome, SinkError>> + Send { ... }
fn search_stream(
&self,
_op: SearchOp,
) -> impl Future<Output = Result<StreamingSearch, SinkError>> + Send { ... }
fn forward_stream(
&self,
_op: ForwardOp,
_body: ByteBody,
) -> impl Future<Output = Result<StreamingForward, SinkError>> + Send { ... }
}Expand description
Where reads come from.
The read counterpart of Sink. Kept separate because a read
is inherently direct-to-cluster: a redundancy QueueSink can absorb writes
but cannot answer a get-by-id or a search.
§Invariants
- MUST NOT panic; return
SinkErrorfor every transport/upstream failure (NFR-R1). A missing document is not an error, it is aReadOutcomewithfound == false.
Required Methods§
Sourcefn search(
&self,
op: SearchOp,
) -> impl Future<Output = Result<SearchOutcome, SinkError>> + Send
fn search( &self, op: SearchOp, ) -> impl Future<Output = Result<SearchOutcome, SinkError>> + Send
Sourcefn count(
&self,
op: SearchOp,
) -> impl Future<Output = Result<CountOutcome, SinkError>> + Send
fn count( &self, op: SearchOp, ) -> impl Future<Output = Result<CountOutcome, SinkError>> + Send
Counts the documents matching a (partition-filtered) query.
Takes the same SearchOp as Reader::search, the wrapped query is
identical, but hits the count endpoint, returning only the total.
§Errors
Returns SinkError if the upstream cannot be reached or returns a
server error.
Provided Methods§
Sourcefn cursor(
&self,
_op: CursorOp,
) -> impl Future<Output = Result<CursorOutcome, SinkError>> + Send
fn cursor( &self, _op: CursorOp, ) -> impl Future<Output = Result<CursorOutcome, SinkError>> + Send
Forwards a raw cursor request to its pinned cluster (scroll/PIT continue,
clear, close). The default is unsupported, a sink that cannot
passthrough (the in-memory test sink, a write-only queue) rejects it;
OpenSearchSink overrides it with a real upstream call.
§Errors
Returns SinkError if the sink does not support passthrough or the
upstream cannot be reached.
Sourcefn search_stream(
&self,
_op: SearchOp,
) -> impl Future<Output = Result<StreamingSearch, SinkError>> + Send
fn search_stream( &self, _op: SearchOp, ) -> impl Future<Output = Result<StreamingSearch, SinkError>> + Send
Runs a search whose response streams back (ADR-014, final stage): the
upstream hits envelope is piped to the engine’s hit transform without being
collected, so a large response (e.g. heavy aggregations) never lands in
memory. The default is unsupported; OpenSearchSink overrides it with a
real streamed upstream call.
§Errors
Returns SinkError if the sink does not support streaming search or the
upstream cannot be reached or returns a server error.
Sourcefn forward_stream(
&self,
_op: ForwardOp,
_body: ByteBody,
) -> impl Future<Output = Result<StreamingForward, SinkError>> + Send
fn forward_stream( &self, _op: ForwardOp, _body: ByteBody, ) -> impl Future<Output = Result<StreamingForward, SinkError>> + Send
Forwards a request to a cluster with the body supplied as a stream
(ADR-014 stage 2): the verbatim-passthrough path pipes the downstream body
straight upstream without buffering. The default is unsupported;
OpenSearchSink overrides it with a real streamed upstream call.
§Errors
Returns SinkError if the sink does not support streaming forward or the
upstream cannot be reached.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".