pub struct StreamStateContract(/* private fields */);Expand description
The codec/schema/restartability contract a registered ItemStream
carries, bound to the runtime at registration time.
Gate C requires the runtime to validate a registered stream’s expected
schema and codec identity/version, apply declared migrations, and reject
unknown-newer versions – all before the application’s open runs –
without introspecting the stream’s opaque internal state. This is the
small, explicit descriptor that makes that possible: it preserves the
existing separation between the stream’s logical identity
(crate::definition::ComponentStreamIdentity), its runtime
implementation (ItemStream/BoxedStream), and its state contract (this
type), which the stream’s own ComponentStateCodec already declares.
Implementations§
Source§impl StreamStateContract
impl StreamStateContract
Sourcepub fn new<T, C>(codec: C) -> StreamStateContract
pub fn new<T, C>(codec: C) -> StreamStateContract
Captures codec’s schema/codec identity, versions, and
restartability declaration as a type-erased contract.
Sourcepub fn schema_id(&self) -> &StateSchemaId
pub fn schema_id(&self) -> &StateSchemaId
Borrows the expected application schema identifier.
Sourcepub fn restartability(&self) -> RestartabilityDeclaration
pub fn restartability(&self) -> RestartabilityDeclaration
Returns the declared restartability of the stream this contract belongs to.
Sourcepub fn validate_for_open(
&self,
envelope: &ComponentStateEnvelope,
) -> Result<ComponentStateEnvelope, ComponentStateError>
pub fn validate_for_open( &self, envelope: &ComponentStateEnvelope, ) -> Result<ComponentStateEnvelope, ComponentStateError>
Validates and migrates envelope to this contract’s current schema
and codec versions before the runtime may call open with it.
§Errors
Returns the redacted identity, compatibility, or migration failure
ComponentStateEnvelope::validated_for_open would.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for StreamStateContract
impl !UnwindSafe for StreamStateContract
impl Freeze for StreamStateContract
impl Send for StreamStateContract
impl Sync for StreamStateContract
impl Unpin for StreamStateContract
impl UnsafeUnpin for StreamStateContract
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> 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> ⓘ
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> ⓘ
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 more