use crate::HostTypes;
pub trait IOBoundary<H: HostTypes> {}
pub trait Source<H: HostTypes>: IOBoundary<H> {
type TypeDefinition: crate::user::type_::TypeDefinition<H>;
fn source_type(&self) -> &Self::TypeDefinition;
}
pub trait Sink<H: HostTypes>: IOBoundary<H> {
type TypeDefinition: crate::user::type_::TypeDefinition<H>;
fn sink_type(&self) -> &Self::TypeDefinition;
}
pub trait BoundaryEffect<H: HostTypes>: crate::kernel::effect::ExternalEffect<H> {
type IOBoundary: IOBoundary<H>;
fn effect_boundary(&self) -> &Self::IOBoundary;
fn is_idempotent(&self) -> bool;
}
pub trait IngestEffect<H: HostTypes>: BoundaryEffect<H> {
type Source: Source<H>;
fn ingest_source(&self) -> &Self::Source;
}
pub trait EmitEffect<H: HostTypes>: BoundaryEffect<H> {
type Sink: Sink<H>;
fn emit_sink(&self) -> &Self::Sink;
}
pub trait BoundaryProtocol<H: HostTypes> {
type TypeDefinition: crate::user::type_::TypeDefinition<H>;
fn protocol_type(&self) -> &Self::TypeDefinition;
type Conjunction: crate::user::type_::Conjunction<H>;
fn protocol_ordering(&self) -> &Self::Conjunction;
}
pub trait BoundarySession<H: HostTypes>: crate::user::state::Session<H> {
type IOBoundary: IOBoundary<H>;
fn session_boundaries(&self) -> &[Self::IOBoundary];
fn crossing_count(&self) -> u64;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullIOBoundary<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullIOBoundary<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullIOBoundary<H> {
pub const ABSENT: NullIOBoundary<H> = NullIOBoundary {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> IOBoundary<H> for NullIOBoundary<H> {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullSource<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullSource<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullSource<H> {
pub const ABSENT: NullSource<H> = NullSource {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> IOBoundary<H> for NullSource<H> {}
impl<H: HostTypes> Source<H> for NullSource<H> {
type TypeDefinition = crate::user::type_::NullTypeDefinition<H>;
fn source_type(&self) -> &Self::TypeDefinition {
&<crate::user::type_::NullTypeDefinition<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullSink<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullSink<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullSink<H> {
pub const ABSENT: NullSink<H> = NullSink {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> IOBoundary<H> for NullSink<H> {}
impl<H: HostTypes> Sink<H> for NullSink<H> {
type TypeDefinition = crate::user::type_::NullTypeDefinition<H>;
fn sink_type(&self) -> &Self::TypeDefinition {
&<crate::user::type_::NullTypeDefinition<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullBoundaryEffect<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullBoundaryEffect<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullBoundaryEffect<H> {
pub const ABSENT: NullBoundaryEffect<H> = NullBoundaryEffect {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> crate::kernel::effect::Effect<H> for NullBoundaryEffect<H> {
type EffectTarget = crate::kernel::effect::NullEffectTarget<H>;
fn effect_target(&self) -> &Self::EffectTarget {
&<crate::kernel::effect::NullEffectTarget<H>>::ABSENT
}
type Context = crate::user::state::NullContext<H>;
fn pre_context(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn post_context(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn free_rank_delta(&self) -> i64 {
0
}
fn composite_index(&self) -> u64 {
0
}
fn is_commutative_with(&self) -> bool {
false
}
}
impl<H: HostTypes> crate::kernel::effect::ExternalEffect<H> for NullBoundaryEffect<H> {
type EffectShape = crate::bridge::conformance_::NullEffectShape<H>;
fn external_effect_shape(&self) -> &Self::EffectShape {
&<crate::bridge::conformance_::NullEffectShape<H>>::ABSENT
}
}
impl<H: HostTypes> BoundaryEffect<H> for NullBoundaryEffect<H> {
type IOBoundary = NullIOBoundary<H>;
fn effect_boundary(&self) -> &Self::IOBoundary {
&<NullIOBoundary<H>>::ABSENT
}
fn is_idempotent(&self) -> bool {
false
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullIngestEffect<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullIngestEffect<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullIngestEffect<H> {
pub const ABSENT: NullIngestEffect<H> = NullIngestEffect {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> crate::kernel::effect::Effect<H> for NullIngestEffect<H> {
type EffectTarget = crate::kernel::effect::NullEffectTarget<H>;
fn effect_target(&self) -> &Self::EffectTarget {
&<crate::kernel::effect::NullEffectTarget<H>>::ABSENT
}
type Context = crate::user::state::NullContext<H>;
fn pre_context(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn post_context(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn free_rank_delta(&self) -> i64 {
0
}
fn composite_index(&self) -> u64 {
0
}
fn is_commutative_with(&self) -> bool {
false
}
}
impl<H: HostTypes> crate::kernel::effect::ExternalEffect<H> for NullIngestEffect<H> {
type EffectShape = crate::bridge::conformance_::NullEffectShape<H>;
fn external_effect_shape(&self) -> &Self::EffectShape {
&<crate::bridge::conformance_::NullEffectShape<H>>::ABSENT
}
}
impl<H: HostTypes> BoundaryEffect<H> for NullIngestEffect<H> {
type IOBoundary = NullIOBoundary<H>;
fn effect_boundary(&self) -> &Self::IOBoundary {
&<NullIOBoundary<H>>::ABSENT
}
fn is_idempotent(&self) -> bool {
false
}
}
impl<H: HostTypes> IngestEffect<H> for NullIngestEffect<H> {
type Source = NullSource<H>;
fn ingest_source(&self) -> &Self::Source {
&<NullSource<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullEmitEffect<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullEmitEffect<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullEmitEffect<H> {
pub const ABSENT: NullEmitEffect<H> = NullEmitEffect {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> crate::kernel::effect::Effect<H> for NullEmitEffect<H> {
type EffectTarget = crate::kernel::effect::NullEffectTarget<H>;
fn effect_target(&self) -> &Self::EffectTarget {
&<crate::kernel::effect::NullEffectTarget<H>>::ABSENT
}
type Context = crate::user::state::NullContext<H>;
fn pre_context(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn post_context(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn free_rank_delta(&self) -> i64 {
0
}
fn composite_index(&self) -> u64 {
0
}
fn is_commutative_with(&self) -> bool {
false
}
}
impl<H: HostTypes> crate::kernel::effect::ExternalEffect<H> for NullEmitEffect<H> {
type EffectShape = crate::bridge::conformance_::NullEffectShape<H>;
fn external_effect_shape(&self) -> &Self::EffectShape {
&<crate::bridge::conformance_::NullEffectShape<H>>::ABSENT
}
}
impl<H: HostTypes> BoundaryEffect<H> for NullEmitEffect<H> {
type IOBoundary = NullIOBoundary<H>;
fn effect_boundary(&self) -> &Self::IOBoundary {
&<NullIOBoundary<H>>::ABSENT
}
fn is_idempotent(&self) -> bool {
false
}
}
impl<H: HostTypes> EmitEffect<H> for NullEmitEffect<H> {
type Sink = NullSink<H>;
fn emit_sink(&self) -> &Self::Sink {
&<NullSink<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullBoundaryProtocol<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullBoundaryProtocol<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullBoundaryProtocol<H> {
pub const ABSENT: NullBoundaryProtocol<H> = NullBoundaryProtocol {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> BoundaryProtocol<H> for NullBoundaryProtocol<H> {
type TypeDefinition = crate::user::type_::NullTypeDefinition<H>;
fn protocol_type(&self) -> &Self::TypeDefinition {
&<crate::user::type_::NullTypeDefinition<H>>::ABSENT
}
type Conjunction = crate::user::type_::NullConjunction<H>;
fn protocol_ordering(&self) -> &Self::Conjunction {
&<crate::user::type_::NullConjunction<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullBoundarySession<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullBoundarySession<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullBoundarySession<H> {
pub const ABSENT: NullBoundarySession<H> = NullBoundarySession {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> crate::user::state::Session<H> for NullBoundarySession<H> {
type Context = crate::user::state::NullContext<H>;
fn session_bindings(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn session_queries(&self) -> u64 {
0
}
}
impl<H: HostTypes> BoundarySession<H> for NullBoundarySession<H> {
type IOBoundary = NullIOBoundary<H>;
fn session_boundaries(&self) -> &[Self::IOBoundary] {
&[]
}
fn crossing_count(&self) -> u64 {
0
}
}
#[derive(Debug)]
pub struct IOBoundaryHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for IOBoundaryHandle<H> {}
impl<H: HostTypes> Clone for IOBoundaryHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for IOBoundaryHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for IOBoundaryHandle<H> {}
impl<H: HostTypes> core::hash::Hash for IOBoundaryHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> IOBoundaryHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait IOBoundaryResolver<H: HostTypes> {
fn resolve(&self, handle: IOBoundaryHandle<H>) -> Option<IOBoundaryRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct IOBoundaryRecord<H: HostTypes> {
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedIOBoundary<'r, R: IOBoundaryResolver<H>, H: HostTypes> {
handle: IOBoundaryHandle<H>,
resolver: &'r R,
record: Option<IOBoundaryRecord<H>>,
}
impl<'r, R: IOBoundaryResolver<H>, H: HostTypes> ResolvedIOBoundary<'r, R, H> {
#[inline]
pub fn new(handle: IOBoundaryHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> IOBoundaryHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&IOBoundaryRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: IOBoundaryResolver<H>, H: HostTypes> IOBoundary<H> for ResolvedIOBoundary<'r, R, H> {}
#[derive(Debug)]
pub struct SourceHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for SourceHandle<H> {}
impl<H: HostTypes> Clone for SourceHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for SourceHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for SourceHandle<H> {}
impl<H: HostTypes> core::hash::Hash for SourceHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> SourceHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait SourceResolver<H: HostTypes> {
fn resolve(&self, handle: SourceHandle<H>) -> Option<SourceRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct SourceRecord<H: HostTypes> {
pub source_type_handle: crate::user::type_::TypeDefinitionHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedSource<'r, R: SourceResolver<H>, H: HostTypes> {
handle: SourceHandle<H>,
resolver: &'r R,
record: Option<SourceRecord<H>>,
}
impl<'r, R: SourceResolver<H>, H: HostTypes> ResolvedSource<'r, R, H> {
#[inline]
pub fn new(handle: SourceHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> SourceHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&SourceRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: SourceResolver<H>, H: HostTypes> IOBoundary<H> for ResolvedSource<'r, R, H> {}
impl<'r, R: SourceResolver<H>, H: HostTypes> Source<H> for ResolvedSource<'r, R, H> {
type TypeDefinition = crate::user::type_::NullTypeDefinition<H>;
fn source_type(&self) -> &Self::TypeDefinition {
&<crate::user::type_::NullTypeDefinition<H>>::ABSENT
}
}
impl<'r, R: SourceResolver<H>, H: HostTypes> ResolvedSource<'r, R, H> {
#[inline]
pub fn resolve_source_type<'r2, R2: crate::user::type_::TypeDefinitionResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::user::type_::ResolvedTypeDefinition<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::user::type_::ResolvedTypeDefinition::new(
record.source_type_handle,
r,
))
}
}
#[derive(Debug)]
pub struct SinkHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for SinkHandle<H> {}
impl<H: HostTypes> Clone for SinkHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for SinkHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for SinkHandle<H> {}
impl<H: HostTypes> core::hash::Hash for SinkHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> SinkHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait SinkResolver<H: HostTypes> {
fn resolve(&self, handle: SinkHandle<H>) -> Option<SinkRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct SinkRecord<H: HostTypes> {
pub sink_type_handle: crate::user::type_::TypeDefinitionHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedSink<'r, R: SinkResolver<H>, H: HostTypes> {
handle: SinkHandle<H>,
resolver: &'r R,
record: Option<SinkRecord<H>>,
}
impl<'r, R: SinkResolver<H>, H: HostTypes> ResolvedSink<'r, R, H> {
#[inline]
pub fn new(handle: SinkHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> SinkHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&SinkRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: SinkResolver<H>, H: HostTypes> IOBoundary<H> for ResolvedSink<'r, R, H> {}
impl<'r, R: SinkResolver<H>, H: HostTypes> Sink<H> for ResolvedSink<'r, R, H> {
type TypeDefinition = crate::user::type_::NullTypeDefinition<H>;
fn sink_type(&self) -> &Self::TypeDefinition {
&<crate::user::type_::NullTypeDefinition<H>>::ABSENT
}
}
impl<'r, R: SinkResolver<H>, H: HostTypes> ResolvedSink<'r, R, H> {
#[inline]
pub fn resolve_sink_type<'r2, R2: crate::user::type_::TypeDefinitionResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::user::type_::ResolvedTypeDefinition<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::user::type_::ResolvedTypeDefinition::new(
record.sink_type_handle,
r,
))
}
}
#[derive(Debug)]
pub struct BoundaryEffectHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for BoundaryEffectHandle<H> {}
impl<H: HostTypes> Clone for BoundaryEffectHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for BoundaryEffectHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for BoundaryEffectHandle<H> {}
impl<H: HostTypes> core::hash::Hash for BoundaryEffectHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> BoundaryEffectHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait BoundaryEffectResolver<H: HostTypes> {
fn resolve(&self, handle: BoundaryEffectHandle<H>) -> Option<BoundaryEffectRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct BoundaryEffectRecord<H: HostTypes> {
pub effect_boundary_handle: IOBoundaryHandle<H>,
pub is_idempotent: bool,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedBoundaryEffect<'r, R: BoundaryEffectResolver<H>, H: HostTypes> {
handle: BoundaryEffectHandle<H>,
resolver: &'r R,
record: Option<BoundaryEffectRecord<H>>,
}
impl<'r, R: BoundaryEffectResolver<H>, H: HostTypes> ResolvedBoundaryEffect<'r, R, H> {
#[inline]
pub fn new(handle: BoundaryEffectHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> BoundaryEffectHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&BoundaryEffectRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: BoundaryEffectResolver<H>, H: HostTypes> crate::kernel::effect::Effect<H>
for ResolvedBoundaryEffect<'r, R, H>
{
type EffectTarget = crate::kernel::effect::NullEffectTarget<H>;
fn effect_target(&self) -> &Self::EffectTarget {
&<crate::kernel::effect::NullEffectTarget<H>>::ABSENT
}
type Context = crate::user::state::NullContext<H>;
fn pre_context(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn post_context(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn free_rank_delta(&self) -> i64 {
0
}
fn composite_index(&self) -> u64 {
0
}
fn is_commutative_with(&self) -> bool {
false
}
}
impl<'r, R: BoundaryEffectResolver<H>, H: HostTypes> crate::kernel::effect::ExternalEffect<H>
for ResolvedBoundaryEffect<'r, R, H>
{
type EffectShape = crate::bridge::conformance_::NullEffectShape<H>;
fn external_effect_shape(&self) -> &Self::EffectShape {
&<crate::bridge::conformance_::NullEffectShape<H>>::ABSENT
}
}
impl<'r, R: BoundaryEffectResolver<H>, H: HostTypes> BoundaryEffect<H>
for ResolvedBoundaryEffect<'r, R, H>
{
type IOBoundary = NullIOBoundary<H>;
fn effect_boundary(&self) -> &Self::IOBoundary {
&<NullIOBoundary<H>>::ABSENT
}
fn is_idempotent(&self) -> bool {
match &self.record {
Some(r) => r.is_idempotent,
None => false,
}
}
}
impl<'r, R: BoundaryEffectResolver<H>, H: HostTypes> ResolvedBoundaryEffect<'r, R, H> {
#[inline]
pub fn resolve_effect_boundary<'r2, R2: IOBoundaryResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedIOBoundary<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedIOBoundary::new(record.effect_boundary_handle, r))
}
}
#[derive(Debug)]
pub struct IngestEffectHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for IngestEffectHandle<H> {}
impl<H: HostTypes> Clone for IngestEffectHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for IngestEffectHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for IngestEffectHandle<H> {}
impl<H: HostTypes> core::hash::Hash for IngestEffectHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> IngestEffectHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait IngestEffectResolver<H: HostTypes> {
fn resolve(&self, handle: IngestEffectHandle<H>) -> Option<IngestEffectRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct IngestEffectRecord<H: HostTypes> {
pub ingest_source_handle: SourceHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedIngestEffect<'r, R: IngestEffectResolver<H>, H: HostTypes> {
handle: IngestEffectHandle<H>,
resolver: &'r R,
record: Option<IngestEffectRecord<H>>,
}
impl<'r, R: IngestEffectResolver<H>, H: HostTypes> ResolvedIngestEffect<'r, R, H> {
#[inline]
pub fn new(handle: IngestEffectHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> IngestEffectHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&IngestEffectRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: IngestEffectResolver<H>, H: HostTypes> crate::kernel::effect::Effect<H>
for ResolvedIngestEffect<'r, R, H>
{
type EffectTarget = crate::kernel::effect::NullEffectTarget<H>;
fn effect_target(&self) -> &Self::EffectTarget {
&<crate::kernel::effect::NullEffectTarget<H>>::ABSENT
}
type Context = crate::user::state::NullContext<H>;
fn pre_context(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn post_context(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn free_rank_delta(&self) -> i64 {
0
}
fn composite_index(&self) -> u64 {
0
}
fn is_commutative_with(&self) -> bool {
false
}
}
impl<'r, R: IngestEffectResolver<H>, H: HostTypes> crate::kernel::effect::ExternalEffect<H>
for ResolvedIngestEffect<'r, R, H>
{
type EffectShape = crate::bridge::conformance_::NullEffectShape<H>;
fn external_effect_shape(&self) -> &Self::EffectShape {
&<crate::bridge::conformance_::NullEffectShape<H>>::ABSENT
}
}
impl<'r, R: IngestEffectResolver<H>, H: HostTypes> BoundaryEffect<H>
for ResolvedIngestEffect<'r, R, H>
{
type IOBoundary = NullIOBoundary<H>;
fn effect_boundary(&self) -> &Self::IOBoundary {
&<NullIOBoundary<H>>::ABSENT
}
fn is_idempotent(&self) -> bool {
false
}
}
impl<'r, R: IngestEffectResolver<H>, H: HostTypes> IngestEffect<H>
for ResolvedIngestEffect<'r, R, H>
{
type Source = NullSource<H>;
fn ingest_source(&self) -> &Self::Source {
&<NullSource<H>>::ABSENT
}
}
impl<'r, R: IngestEffectResolver<H>, H: HostTypes> ResolvedIngestEffect<'r, R, H> {
#[inline]
pub fn resolve_ingest_source<'r2, R2: SourceResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedSource<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedSource::new(record.ingest_source_handle, r))
}
}
#[derive(Debug)]
pub struct EmitEffectHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for EmitEffectHandle<H> {}
impl<H: HostTypes> Clone for EmitEffectHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for EmitEffectHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for EmitEffectHandle<H> {}
impl<H: HostTypes> core::hash::Hash for EmitEffectHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> EmitEffectHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait EmitEffectResolver<H: HostTypes> {
fn resolve(&self, handle: EmitEffectHandle<H>) -> Option<EmitEffectRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct EmitEffectRecord<H: HostTypes> {
pub emit_sink_handle: SinkHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedEmitEffect<'r, R: EmitEffectResolver<H>, H: HostTypes> {
handle: EmitEffectHandle<H>,
resolver: &'r R,
record: Option<EmitEffectRecord<H>>,
}
impl<'r, R: EmitEffectResolver<H>, H: HostTypes> ResolvedEmitEffect<'r, R, H> {
#[inline]
pub fn new(handle: EmitEffectHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> EmitEffectHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&EmitEffectRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: EmitEffectResolver<H>, H: HostTypes> crate::kernel::effect::Effect<H>
for ResolvedEmitEffect<'r, R, H>
{
type EffectTarget = crate::kernel::effect::NullEffectTarget<H>;
fn effect_target(&self) -> &Self::EffectTarget {
&<crate::kernel::effect::NullEffectTarget<H>>::ABSENT
}
type Context = crate::user::state::NullContext<H>;
fn pre_context(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn post_context(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn free_rank_delta(&self) -> i64 {
0
}
fn composite_index(&self) -> u64 {
0
}
fn is_commutative_with(&self) -> bool {
false
}
}
impl<'r, R: EmitEffectResolver<H>, H: HostTypes> crate::kernel::effect::ExternalEffect<H>
for ResolvedEmitEffect<'r, R, H>
{
type EffectShape = crate::bridge::conformance_::NullEffectShape<H>;
fn external_effect_shape(&self) -> &Self::EffectShape {
&<crate::bridge::conformance_::NullEffectShape<H>>::ABSENT
}
}
impl<'r, R: EmitEffectResolver<H>, H: HostTypes> BoundaryEffect<H>
for ResolvedEmitEffect<'r, R, H>
{
type IOBoundary = NullIOBoundary<H>;
fn effect_boundary(&self) -> &Self::IOBoundary {
&<NullIOBoundary<H>>::ABSENT
}
fn is_idempotent(&self) -> bool {
false
}
}
impl<'r, R: EmitEffectResolver<H>, H: HostTypes> EmitEffect<H> for ResolvedEmitEffect<'r, R, H> {
type Sink = NullSink<H>;
fn emit_sink(&self) -> &Self::Sink {
&<NullSink<H>>::ABSENT
}
}
impl<'r, R: EmitEffectResolver<H>, H: HostTypes> ResolvedEmitEffect<'r, R, H> {
#[inline]
pub fn resolve_emit_sink<'r2, R2: SinkResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedSink<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedSink::new(record.emit_sink_handle, r))
}
}
#[derive(Debug)]
pub struct BoundaryProtocolHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for BoundaryProtocolHandle<H> {}
impl<H: HostTypes> Clone for BoundaryProtocolHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for BoundaryProtocolHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for BoundaryProtocolHandle<H> {}
impl<H: HostTypes> core::hash::Hash for BoundaryProtocolHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> BoundaryProtocolHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait BoundaryProtocolResolver<H: HostTypes> {
fn resolve(&self, handle: BoundaryProtocolHandle<H>) -> Option<BoundaryProtocolRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct BoundaryProtocolRecord<H: HostTypes> {
pub protocol_type_handle: crate::user::type_::TypeDefinitionHandle<H>,
pub protocol_ordering_handle: crate::user::type_::ConjunctionHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedBoundaryProtocol<'r, R: BoundaryProtocolResolver<H>, H: HostTypes> {
handle: BoundaryProtocolHandle<H>,
resolver: &'r R,
record: Option<BoundaryProtocolRecord<H>>,
}
impl<'r, R: BoundaryProtocolResolver<H>, H: HostTypes> ResolvedBoundaryProtocol<'r, R, H> {
#[inline]
pub fn new(handle: BoundaryProtocolHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> BoundaryProtocolHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&BoundaryProtocolRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: BoundaryProtocolResolver<H>, H: HostTypes> BoundaryProtocol<H>
for ResolvedBoundaryProtocol<'r, R, H>
{
type TypeDefinition = crate::user::type_::NullTypeDefinition<H>;
fn protocol_type(&self) -> &Self::TypeDefinition {
&<crate::user::type_::NullTypeDefinition<H>>::ABSENT
}
type Conjunction = crate::user::type_::NullConjunction<H>;
fn protocol_ordering(&self) -> &Self::Conjunction {
&<crate::user::type_::NullConjunction<H>>::ABSENT
}
}
impl<'r, R: BoundaryProtocolResolver<H>, H: HostTypes> ResolvedBoundaryProtocol<'r, R, H> {
#[inline]
pub fn resolve_protocol_type<'r2, R2: crate::user::type_::TypeDefinitionResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::user::type_::ResolvedTypeDefinition<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::user::type_::ResolvedTypeDefinition::new(
record.protocol_type_handle,
r,
))
}
#[inline]
pub fn resolve_protocol_ordering<'r2, R2: crate::user::type_::ConjunctionResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::user::type_::ResolvedConjunction<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::user::type_::ResolvedConjunction::new(
record.protocol_ordering_handle,
r,
))
}
}
#[derive(Debug)]
pub struct BoundarySessionHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for BoundarySessionHandle<H> {}
impl<H: HostTypes> Clone for BoundarySessionHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for BoundarySessionHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for BoundarySessionHandle<H> {}
impl<H: HostTypes> core::hash::Hash for BoundarySessionHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> BoundarySessionHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait BoundarySessionResolver<H: HostTypes> {
fn resolve(&self, handle: BoundarySessionHandle<H>) -> Option<BoundarySessionRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct BoundarySessionRecord<H: HostTypes> {
pub crossing_count: u64,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedBoundarySession<'r, R: BoundarySessionResolver<H>, H: HostTypes> {
handle: BoundarySessionHandle<H>,
resolver: &'r R,
record: Option<BoundarySessionRecord<H>>,
}
impl<'r, R: BoundarySessionResolver<H>, H: HostTypes> ResolvedBoundarySession<'r, R, H> {
#[inline]
pub fn new(handle: BoundarySessionHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> BoundarySessionHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&BoundarySessionRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: BoundarySessionResolver<H>, H: HostTypes> crate::user::state::Session<H>
for ResolvedBoundarySession<'r, R, H>
{
type Context = crate::user::state::NullContext<H>;
fn session_bindings(&self) -> &Self::Context {
&<crate::user::state::NullContext<H>>::ABSENT
}
fn session_queries(&self) -> u64 {
0
}
}
impl<'r, R: BoundarySessionResolver<H>, H: HostTypes> BoundarySession<H>
for ResolvedBoundarySession<'r, R, H>
{
type IOBoundary = NullIOBoundary<H>;
fn session_boundaries(&self) -> &[Self::IOBoundary] {
&[]
}
fn crossing_count(&self) -> u64 {
match &self.record {
Some(r) => r.crossing_count,
None => 0,
}
}
}