pub struct GrpcStream { /* private fields */ }Expand description
A configured gRPC source that uses protobuf reflection to call any gRPC method and return JSON records.
Implementations§
Source§impl GrpcStream
impl GrpcStream
Sourcepub fn new(config: GrpcStreamConfig) -> Result<Self, FaucetError>
pub fn new(config: GrpcStreamConfig) -> Result<Self, FaucetError>
Create a new gRPC stream. Loads the FileDescriptorSet from disk.
Sourcepub fn with_auth_provider(self, provider: SharedAuthProvider) -> Self
pub fn with_auth_provider(self, provider: SharedAuthProvider) -> Self
Attach a shared AuthProvider. When set,
the provider supplies the credential for every request (taking
precedence over inline auth), so several sources can share one token
with single-flight refresh. Used by the CLI to resolve auth: { ref },
and by library callers who construct one provider and inject it into
many sources.
Trait Implementations§
Source§impl Source for GrpcStream
impl Source for GrpcStream
Source§fn stream_pages<'a>(
&'a self,
context: &'a HashMap<String, Value>,
batch_size: usize,
) -> Pin<Box<dyn Stream<Item = Result<StreamPage, FaucetError>> + Send + 'a>>
fn stream_pages<'a>( &'a self, context: &'a HashMap<String, Value>, batch_size: usize, ) -> Pin<Box<dyn Stream<Item = Result<StreamPage, FaucetError>> + Send + 'a>>
Stream records page-by-page.
For RpcKind::Unary this falls back to the default trait impl
(buffer the full response, then chunk in memory) — see the README’s
“Streaming and batching” section for the rationale.
For RpcKind::ServerStreaming this opens the gRPC stream and
flushes a page each time the buffer hits config.batch_size
(batch_size = 0 drains the entire stream before yielding). The
trait-level batch_size argument is ignored in favour of the config
field so a pipeline-supplied hint cannot silently override an explicit
config value. Transient stream errors reconnect with exponential
backoff up to reconnect_max_attempts, unless terminate_on_error = true in which case the run terminates. Server-streaming pages carry
bookmark: None — this source has no native cursor/offset, so
resumption is driven by user-supplied request fields (e.g. an event
id), not a faucet-managed bookmark.
Source§fn fetch_with_context<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_with_context<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn config_schema(&self) -> Value
fn config_schema(&self) -> Value
Source§fn fetch_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn fetch_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Source§fn fetch_with_context_incremental<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Value>, Option<Value>), FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn fetch_with_context_incremental<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Value>, Option<Value>), FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Source§fn fetch_all_incremental<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Value>, Option<Value>), FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn fetch_all_incremental<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Value>, Option<Value>), FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Source§fn state_key(&self) -> Option<String>
fn state_key(&self) -> Option<String>
StateStore. Read moreSource§fn apply_start_bookmark<'life0, 'async_trait>(
&'life0 self,
_bookmark: Value,
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn apply_start_bookmark<'life0, 'async_trait>(
&'life0 self,
_bookmark: Value,
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
StateStore
as this run’s starting point. Read moreSource§fn connector_name(&self) -> &'static str
fn connector_name(&self) -> &'static str
connector label on metrics and the
connector attribute on spans. Defaults to the final segment of
std::any::type_name::<Self>(), e.g. "RestSource". Built-in
connectors override with a short, friendly snake_case name (e.g.
"rest"). Must return a non-empty string; observability decorators
fall back to "unknown" in release builds if it is empty (and
debug_assert! in debug builds).Source§fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 CheckContext,
) -> Pin<Box<dyn Future<Output = Result<CheckReport, FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 CheckContext,
) -> Pin<Box<dyn Future<Output = Result<CheckReport, FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
faucet doctor). Read moreAuto Trait Implementations§
impl Freeze for GrpcStream
impl !RefUnwindSafe for GrpcStream
impl Send for GrpcStream
impl Sync for GrpcStream
impl Unpin for GrpcStream
impl UnsafeUnpin for GrpcStream
impl !UnwindSafe for GrpcStream
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request