use crate::enums::SaturationPhase;
use crate::enums::SessionBoundaryType;
use crate::Primitives;
pub trait Context<P: Primitives> {
type Binding: Binding<P>;
fn binding(&self) -> &[Self::Binding];
fn capacity(&self) -> P::PositiveInteger;
fn content_address(&self) -> &P::String;
fn quantum(&self) -> P::PositiveInteger;
fn saturation_degree(&self) -> P::Decimal;
fn context_temperature(&self) -> P::Decimal;
fn is_saturated(&self) -> P::Boolean;
fn saturation_phase(&self) -> SaturationPhase;
fn residual_free_count(&self) -> P::NonNegativeInteger;
}
pub trait Binding<P: Primitives> {
type Address: crate::kernel::address::Address<P>;
fn address(&self) -> &Self::Address;
type Datum: crate::kernel::schema::Datum<P>;
fn content(&self) -> &Self::Datum;
type TypeDefinition: crate::user::type_::TypeDefinition<P>;
fn bound_type(&self) -> &[Self::TypeDefinition];
fn timestamp(&self) -> &P::String;
}
pub trait Frame<P: Primitives> {
type Binding: Binding<P>;
fn active_bindings(&self) -> &[Self::Binding];
type Context: Context<P>;
fn context(&self) -> &Self::Context;
type Constraint: crate::user::type_::Constraint<P>;
fn constraint(&self) -> &Self::Constraint;
}
pub trait Transition<P: Primitives> {
type Context: Context<P>;
fn from(&self) -> &Self::Context;
fn to(&self) -> &Self::Context;
type Binding: Binding<P>;
fn added_bindings(&self) -> &[Self::Binding];
fn removed_bindings(&self) -> &[Self::Binding];
type ComputationTrace: crate::bridge::trace::ComputationTrace<P>;
fn trace(&self) -> &Self::ComputationTrace;
type TopologicalDelta: crate::user::morphism::TopologicalDelta<P>;
fn topological_snapshot(&self) -> &Self::TopologicalDelta;
}
pub trait Session<P: Primitives> {
type Context: Context<P>;
fn session_bindings(&self) -> &Self::Context;
fn session_queries(&self) -> P::NonNegativeInteger;
}
pub trait BindingAccumulator<P: Primitives> {
type FiberBudget: crate::bridge::partition::FiberBudget<P>;
fn aggregate_fiber_deficit(&self) -> &Self::FiberBudget;
type Binding: Binding<P>;
fn accumulated_bindings(&self) -> &[Self::Binding];
}
pub trait SessionBoundary<P: Primitives> {
fn boundary_reason(&self) -> &P::String;
fn boundary_type(&self) -> SessionBoundaryType;
type Context: Context<P>;
fn prior_context(&self) -> &Self::Context;
fn fresh_context(&self) -> &Self::Context;
}
pub trait SaturatedContext<P: Primitives>: Context<P> {
type SaturationCertificate: crate::bridge::cert::SaturationCertificate<P>;
fn saturation_certificate(&self) -> &Self::SaturationCertificate;
}
pub trait SaturationWitness<P: Primitives> {
type Binding: Binding<P>;
fn witness_binding(&self) -> &[Self::Binding];
fn witness_step(&self) -> P::NonNegativeInteger;
}
pub trait DomainSaturationRecord<P: Primitives> {
type SaturatedContext: SaturatedContext<P>;
fn saturated_context(&self) -> &Self::SaturatedContext;
fn saturated_domain(&self) -> &P::String;
fn domain_free_count(&self) -> P::NonNegativeInteger;
}
pub trait SharedContext<P: Primitives>: Context<P> {
type ContextLease: ContextLease<P>;
fn lease_set(&self) -> &[Self::ContextLease];
}
pub trait ContextLease<P: Primitives> {
type FiberBudget: crate::bridge::partition::FiberBudget<P>;
fn leased_fibers(&self) -> &Self::FiberBudget;
type Session: Session<P>;
fn lease_holder(&self) -> &Self::Session;
}
pub trait SessionComposition<P: Primitives> {
type Session: Session<P>;
fn composed_from(&self) -> &[Self::Session];
fn composition_compatible(&self) -> P::Boolean;
type Context: Context<P>;
fn composition_result(&self) -> &Self::Context;
fn tower_consistency_verified(&self) -> P::Boolean;
}
pub mod explicit_reset {}
pub mod convergence_boundary {}
pub mod contradiction_boundary {}
pub mod unsaturated {}
pub mod partial_saturation {}
pub mod full_saturation {}
pub mod ground_state {
pub const CONTEXT_TEMPERATURE: &str = "0.0";
pub const IS_SATURATED: bool = true;
pub const RESIDUAL_FREE_COUNT: i64 = 0;
pub const SATURATION_DEGREE: &str = "1.0";
pub const SATURATION_PHASE: &str = "https://uor.foundation/state/FullSaturation";
}