pub struct SeekHandle;Expand description
The key reading the subscription’s KinesisSeeker out of either context.
The handle is the subscription’s own, minted when it opened, so a stream-wide position moves every shard it owns and a captured one moves the shard it names.
§Examples
use ruststream::prelude::*;
use ruststream::{Seeker, subscriber};
use ruststream_kinesis::{KinesisPosition, KinesisStream, SeekHandle};
/// Rewinds the whole subscription when the producer asks for a replay.
#[subscriber(KinesisStream::new("jobs"))]
async fn work(job: &Job, Ctx(seeker): Ctx<SeekHandle>) -> HandlerOutcome {
if job.replay_from_horizon && seeker.seek(KinesisPosition::horizon()).await.is_err() {
return HandlerOutcome::retry();
}
HandlerOutcome::ack()
}Trait Implementations§
Source§impl Clone for SeekHandle
impl Clone for SeekHandle
Source§impl ContextField for SeekHandle
impl ContextField for SeekHandle
Source§type Context = KinesisContext
type Context = KinesisContext
The per-delivery context type this key reads from.
Source§type Value = KinesisSeeker
type Value = KinesisSeeker
The owned value the key yields.
Source§fn read(self, src: &KinesisContext) -> KinesisSeeker
fn read(self, src: &KinesisContext) -> KinesisSeeker
Reads this key’s field out of
src. Named apart from Field::get so a key
implementing both traits stays unambiguous to call.impl Copy for SeekHandle
Source§impl Debug for SeekHandle
impl Debug for SeekHandle
Source§impl Default for SeekHandle
impl Default for SeekHandle
impl Eq for SeekHandle
Source§impl Field<KinesisBatchContext> for SeekHandle
impl Field<KinesisBatchContext> for SeekHandle
Source§type Value<'a> = &'a KinesisSeeker
type Value<'a> = &'a KinesisSeeker
The value read through this key, borrowed from the source for
'a.Source§fn get(self, src: &KinesisBatchContext) -> &KinesisSeeker
fn get(self, src: &KinesisBatchContext) -> &KinesisSeeker
Reads this key’s field out of
src.Source§impl Field<KinesisContext> for SeekHandle
impl Field<KinesisContext> for SeekHandle
Source§type Value<'a> = &'a KinesisSeeker
type Value<'a> = &'a KinesisSeeker
The value read through this key, borrowed from the source for
'a.Source§fn get(self, src: &KinesisContext) -> &KinesisSeeker
fn get(self, src: &KinesisContext) -> &KinesisSeeker
Reads this key’s field out of
src.Source§impl Hash for SeekHandle
impl Hash for SeekHandle
Source§impl PartialEq for SeekHandle
impl PartialEq for SeekHandle
impl StructuralPartialEq for SeekHandle
Auto Trait Implementations§
impl Freeze for SeekHandle
impl RefUnwindSafe for SeekHandle
impl Send for SeekHandle
impl Sync for SeekHandle
impl Unpin for SeekHandle
impl UnsafeUnpin for SeekHandle
impl UnwindSafe for SeekHandle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K> CtxKey for Kwhere
K: ContextField,
impl<K> CtxKey for Kwhere
K: ContextField,
Source§type Value = <K as ContextField>::Value
type Value = <K as ContextField>::Value
The owned value the extractor binds.
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.