pub struct DatagenSource { /* private fields */ }Expand description
Synthetic storefront-event source. See the crate docs for the dataset, the referential-integrity mechanism, and what this source deliberately does not promise.
Implementations§
Source§impl DatagenSource
impl DatagenSource
Sourcepub fn new(config: DatagenSourceConfig) -> DatagenSource
pub fn new(config: DatagenSourceConfig) -> DatagenSource
A source over config.
Sourcepub fn from_component_config(
section: &ComponentConfig,
) -> Result<DatagenSource, ConfigError>
pub fn from_component_config( section: &ComponentConfig, ) -> Result<DatagenSource, ConfigError>
Build from the pipeline’s opaque source: { datagen: ... } section.
Sourcepub fn avro_schema() -> &'static str
pub fn avro_schema() -> &'static str
The Avro schema the avro encoding writes against, as JSON. The same
string as EVENT_SCHEMA_JSON.
Sourcepub fn committed(&self) -> &BTreeMap<PartitionId, i64>
pub fn committed(&self) -> &BTreeMap<PartitionId, i64>
Every watermark this source has been asked to commit. In memory, and nowhere else; see the crate docs.
Trait Implementations§
Source§impl Debug for DatagenSource
impl Debug for DatagenSource
Source§impl Source for DatagenSource
impl Source for DatagenSource
Source§type Lane = DatagenLane
type Lane = DatagenLane
The lane type this source produces.
Source§fn component_type(&self) -> &str
fn component_type(&self) -> &str
The
component_type metric label for this source (e.g. "kafka"),
mirroring SinkParts::with_component_type
on the sink side. It is also the namespace of the source’s custom-metrics
Meter: declaring "kafka" scopes the source’s own
families under spate_kafka_source_*. The default "source" is a reserved
root, so a source that does not override this gets no custom Meter
(its framework stage metrics are unaffected).Source§fn framing_contract(&self) -> FramingContract
fn framing_contract(&self) -> FramingContract
How the payloads this source emits are framed, so the framework can
pair it with a deserializer without the two being coordinated by hand
(see
FramingContract). A source that splits its own bytes into one
record per payload returns FramingContract::PerRecord; the default
is FramingContract::WholePayload, where the source emits whole
payloads and the deserializer owns framing (Kafka, and any source that
does not frame).Source§fn open(&mut self, ctx: SourceCtx) -> Result<(), SourceError>
fn open(&mut self, ctx: SourceCtx) -> Result<(), SourceError>
Connect and prepare. Called once before any other method.
Source§fn poll_events(
&mut self,
timeout: Duration,
) -> Result<SourceEvent<DatagenLane>, SourceError>
fn poll_events( &mut self, timeout: Duration, ) -> Result<SourceEvent<DatagenLane>, SourceError>
Service control-plane work (rebalance callbacks, statistics) and
return the next event, waiting at most
timeout. Must be called
regularly regardless of backpressure state.Source§fn commit(
&mut self,
watermarks: &[(PartitionId, i64)],
) -> Result<(), SourceError>
fn commit( &mut self, watermarks: &[(PartitionId, i64)], ) -> Result<(), SourceError>
Store per-partition committable positions (each is the offset one
past the last acknowledged record). Positions are durable per the
source’s own policy (e.g. interval auto-commit of stored offsets).
Source§fn pause(&mut self, lanes: &[LaneId]) -> Result<(), SourceError>
fn pause(&mut self, lanes: &[LaneId]) -> Result<(), SourceError>
Stop fetching for
lanes (backpressure). Optional capability:
sources that cannot pause rely on bounded-queue pushback alone.Source§fn flush_commits(&mut self) -> Result<(), SourceError>
fn flush_commits(&mut self) -> Result<(), SourceError>
Synchronously flush stored positions (shutdown, revocation).
Auto Trait Implementations§
impl !RefUnwindSafe for DatagenSource
impl !UnwindSafe for DatagenSource
impl Freeze for DatagenSource
impl Send for DatagenSource
impl Sync for DatagenSource
impl Unpin for DatagenSource
impl UnsafeUnpin for DatagenSource
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
Mutably borrows from an owned value. Read more