pub struct Topic { /* private fields */ }Expand description
One topic within a stream: the Log primitive’s data handle. Build it with
Stream::topic or, against the default stream, Laser::topic. Verbs
resolve the producer through the client’s shared cache, so handles are free
to construct and clone.
Implementations§
Source§impl Topic
impl Topic
Sourcepub fn publish(&self) -> PublishRequest<'_>
pub fn publish(&self) -> PublishRequest<'_>
Open the fluent publish builder (payload via .payload() / .json() /
.record(), then .send()). The raw payload path compiles to the same
bytes as the low-level send, nothing is linked unless a typed form is
used. Feature streaming.
Sourcepub fn publish_batch(&self) -> BatchPublishRequest<'_>
pub fn publish_batch(&self) -> BatchPublishRequest<'_>
Open the fluent record-batch builder (add records, then .send()), the
typed sibling of batch. Feature streaming.
Sourcepub async fn send(
&self,
payload: impl Into<Vec<u8>>,
headers: BTreeMap<HeaderKey, HeaderValue>,
partition_key: Option<&str>,
) -> Result<SendMessagesResponse, LaserError>
pub async fn send( &self, payload: impl Into<Vec<u8>>, headers: BTreeMap<HeaderKey, HeaderValue>, partition_key: Option<&str>, ) -> Result<SendMessagesResponse, LaserError>
One raw message with explicit user headers, the zero-overhead path.
Keyed partitioning preserves per-key ordering, None lets the producer
balance across partitions.
Sourcepub async fn batch(
&self,
messages: Vec<IggyMessage>,
partition_key: Option<&str>,
) -> Result<SendMessagesResponse, LaserError>
pub async fn batch( &self, messages: Vec<IggyMessage>, partition_key: Option<&str>, ) -> Result<SendMessagesResponse, LaserError>
One Iggy send_messages call covering many pre-built messages, all
sharing the same partitioning. An empty batch is a cheap no-op.
Sourcepub fn batching(&self) -> Result<BatchingProducerBuilder, LaserError>
pub fn batching(&self) -> Result<BatchingProducerBuilder, LaserError>
A size-and-time batching publisher over this topic: .batching(),
tune .max_records/.max_bytes/.linger/.partition_key, then
.build(). Opt-in: the unbatched verbs compile to exactly the same
calls as before. Feature agent (the linger timer rides tokio).
Sourcepub fn replay(&self) -> Result<Cursor, LaserError>
pub fn replay(&self) -> Result<Cursor, LaserError>
The positional replay handle over this topic: a resumable Cursor
reading from explicit offsets. The bounded-read rung below the reliable
consumer.
Sourcepub async fn ensure(&self, partitions: u32) -> Result<(), LaserError>
pub async fn ensure(&self, partitions: u32) -> Result<(), LaserError>
Idempotently create this topic with partitions, creating the stream
first if needed.
Sourcepub async fn ensure_consumer_group(&self, name: &str) -> Result<(), LaserError>
pub async fn ensure_consumer_group(&self, name: &str) -> Result<(), LaserError>
Idempotently create the consumer group name on this topic without
joining it or giving it a filter policy, so an operator can address it
before any member connects. ConsumerGroup::create configures a
policy in the same step.
Sourcepub fn iggy_producer(&self) -> Result<IggyProducerBuilder, LaserError>
pub fn iggy_producer(&self) -> Result<IggyProducerBuilder, LaserError>
The Iggy producer builder for this topic, the substrate front door: Iggy’s own options (batching, partitioning, retries, encryption) with nothing wrapped. Independent of the fluent path’s cached producer.
Sourcepub fn iggy_consumer(
&self,
name: &str,
partition: u32,
) -> Result<IggyConsumerBuilder, LaserError>
pub fn iggy_consumer( &self, name: &str, partition: u32, ) -> Result<IggyConsumerBuilder, LaserError>
The Iggy consumer builder named name over one partition of this
topic. The built IggyConsumer implements futures::Stream.
Sourcepub fn iggy_consumer_group(
&self,
group: &str,
) -> Result<IggyConsumerBuilder, LaserError>
pub fn iggy_consumer_group( &self, group: &str, ) -> Result<IggyConsumerBuilder, LaserError>
The Iggy consumer-group builder over this topic: the balanced group,
offsets committed under group.
Sourcepub fn producer(&self) -> ProducerBuilder
pub fn producer(&self) -> ProducerBuilder
Build a Laser streaming producer with direct batching, linger, retries,
routing, and optional stream/topic creation. build().await initializes
it before returning.
Sourcepub fn consumer(
&self,
name: impl Into<String>,
partition: u32,
) -> ConsumerBuilder
pub fn consumer( &self, name: impl Into<String>, partition: u32, ) -> ConsumerBuilder
Build a live Laser consumer for one partition. The built consumer
implements futures::Stream and exposes server-backed offset control.
Sourcepub fn consumer_group(&self, group: impl Into<String>) -> ConsumerGroup
pub fn consumer_group(&self, group: impl Into<String>) -> ConsumerGroup
The consumer group group of this topic: the handle that owns the
group’s filter policy and builds its consumers and readers. Free and
synchronous, IO happens at the verbs.
Sourcepub fn consumer_group_id(&self, id: u64) -> ConsumerGroup
pub fn consumer_group_id(&self, id: u64) -> ConsumerGroup
consumer_group by the group’s native numeric
id. The id names a group inside this topic incarnation only.
Source§impl Topic
impl Topic
Sourcepub fn json<T>(&self) -> TypedTopic<T>
pub fn json<T>(&self) -> TypedTopic<T>
The typed handle over this topic in the JSON serde form: no registry,
the body type’s Serialize/Deserialize is the contract. Publishes
stamp agdx.ct=json, records decodes each
payload back into T.
Sourcepub fn cbor<T>(&self) -> TypedTopic<T>
pub fn cbor<T>(&self) -> TypedTopic<T>
The typed handle in the CBOR serde form: same contract as
json with a binary self-describing body and
agdx.ct=cbor.
Sourcepub async fn schema<T>(
&self,
schema_id: u32,
) -> Result<TypedTopic<T>, LaserError>
pub async fn schema<T>( &self, schema_id: u32, ) -> Result<TypedTopic<T>, LaserError>
The typed handle bound to a registered writer schema: resolves the
definition from LaserData Cloud’s registry and compiles it ONCE for the
handle’s lifetime, so every publish validates against it client-side
before any byte leaves the process and stamps agdx.ct + agdx.sid.
A body that stops matching the schema fails at the producer with the
schema’s error, not downstream in the projector. Feature
schema-codecs, and the registry is managed, so this form needs
LaserData Cloud.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Topic
impl !UnwindSafe for Topic
impl Freeze for Topic
impl Send for Topic
impl Sync for Topic
impl Unpin for Topic
impl UnsafeUnpin for Topic
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.