Skip to main content

DbSession

Struct DbSession 

Source
pub struct DbSession<C: CanisterKind> { /* private fields */ }
Expand description

DbSession

Session-scoped database handle with policy (debug, metrics) and execution routing.

Implementations§

Source§

impl<C: CanisterKind> DbSession<C>

Source

pub fn apply_schema( &self, proposal: &SchemaProposal, ) -> Result<SchemaChangeReceipt, InternalError>

Apply one exact source-keyed schema proposal through accepted catalog authority and return its durable idempotent receipt.

Source

pub fn schema_application_target( &self, ) -> Result<SchemaApplicationTarget, InternalError>

Issue the opaque database/store identities and exact accepted head used to compose one optimistic schema proposal.

Source

pub fn schema_application_receipt( &self, database_identity: TargetDatabaseIdentity, submission_key: &SchemaSubmissionKey, ) -> Result<Option<SchemaChangeReceipt>, InternalError>

Load one durable schema-application receipt by exact target and submission identity.

Source

pub fn continue_schema_application( &self, job_id: SchemaChangeJobId, acknowledged_receipt: Option<u64>, ) -> Result<SchemaChangeProgress, InternalError>

Advance one pending schema application by at most one bounded activation step.

Source

pub fn abort_schema_application( &self, job_id: SchemaChangeJobId, acknowledged_receipt: Option<u64>, ) -> Result<SchemaChangeProgress, InternalError>

Abort one pending schema application after acknowledging any retained finding page by exact sequence.

Source

pub fn show_entities( &self, ) -> Result<Vec<EntityCatalogDescription>, InternalError>

Return one stable list of accepted runtime entity catalog entries.

Source

pub fn show_stores(&self) -> Vec<StoreCatalogDescription>

Return one stable list of runtime-registered stores.

Source

pub fn show_memory(&self) -> Vec<MemoryCatalogDescription>

Return one stable list of runtime-registered stable-memory allocations.

Source

pub fn try_describe_entity_by_source_key( &self, entity_source: &str, ) -> Result<EntitySchemaDescription, InternalError>

Return one schema description selected by an immutable authored source key.

Source

pub fn try_describe_entity_by_name( &self, entity: &str, ) -> Result<EntitySchemaDescription, InternalError>

Return one schema description selected by its accepted display name.

Source

pub fn storage_report( &self, name_to_path: &[(&'static str, &'static str)], ) -> Result<StorageReport, InternalError>

Build one point-in-time storage report for observability endpoints.

Source

pub fn storage_report_default(&self) -> Result<StorageReport, InternalError>

Build one point-in-time storage report using default entity-path labels.

Source§

impl<C: CanisterKind> DbSession<C>

Source

pub fn execute_admin_integrity( &self, request: IntegrityCheckRequest, owner: IntegrityJobOwner, ) -> Result<IntegrityCheckResult, IntegrityDeepError>

Execute one trusted typed integrity request.

The caller must enforce controller or equivalent integrity-specific authorization before accepting caller-controlled requests. The owner must be a stable identity for that already-authorized caller or capability; possession of a job ID is never authorization.

§Errors

Returns a typed protocol error for invalid requests, authorization ownership mismatches, and stale acknowledgements, or an internal error when accepted authority or physical inspection cannot be read safely.

Source§

impl<C: CanisterKind> DbSession<C>

Source

pub fn issue_typed_entity_binding( &self, entity_source_key: &str, field_requests: &[DynamicTypedFieldBindingRequest], ) -> Result<DynamicTypedEntityBinding, DynamicTypedBindingError>

Issue one opaque accepted binding for immutable generated source keys.

Source

pub fn typed_entity_binding_is_current( &self, binding: &DynamicTypedEntityBinding, ) -> Result<bool, InternalError>

Verify that an opaque typed binding still names the exact accepted authority.

Source

pub fn execute_trusted_dynamic_mutation( &self, request: &DynamicMutation, ) -> Result<DynamicMutationResult, InternalError>

Execute one trusted entity-name-driven structural mutation.

This lane resolves public values, defaults, generation, management, constraints, relations, and commit preparation from accepted schema. It never materializes a generated entity or invokes application validators/normalizers.

Source

pub fn execute_trusted_dynamic_mutation_batch( &self, requests: Vec<DynamicMutation>, ) -> Result<DynamicMutationResult, InternalError>

Execute one bounded same-entity structural mutation batch atomically.

Every item binds to the same accepted catalog identity, shares one operation timestamp, and is projected to its public result before the commit marker can be published.

Source

pub fn execute_trusted_dynamic_insert_batch( &self, entity: &str, patches: Vec<DynamicStructuralPatch>, ) -> Result<DynamicMutationResult, InternalError>

Execute one trusted atomic insert batch from entity-name-driven patches.

Every patch is lowered against the same accepted snapshot and shares one operation timestamp before the canonical structural batch owner stages any durable effect.

Source§

impl<C: CanisterKind> DbSession<C>

Source

pub const fn new(store: &'static LocalKey<StoreRegistry>) -> Self

Construct one session facade over a sealed runtime store registry.

Source

pub const fn debug(self) -> Self

Enable debug execution behavior where supported by executors.

Source

pub const fn metrics_sink(self, sink: &'static dyn MetricsSink) -> Self

Attach one metrics sink for all session-executed operations.

Source

pub const fn select_one(&self) -> Value

Return one constant scalar row equivalent to SQL SELECT 1.

This terminal bypasses query planning and access routing entirely.

Auto Trait Implementations§

§

impl<C> !RefUnwindSafe for DbSession<C>

§

impl<C> !Send for DbSession<C>

§

impl<C> !Sync for DbSession<C>

§

impl<C> !UnwindSafe for DbSession<C>

§

impl<C> Freeze for DbSession<C>

§

impl<C> Unpin for DbSession<C>
where C: Unpin,

§

impl<C> UnsafeUnpin for DbSession<C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V