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>
impl<C: CanisterKind> DbSession<C>
Sourcepub fn apply_schema(
&self,
proposal: &SchemaProposal,
) -> Result<SchemaChangeReceipt, InternalError>
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.
Sourcepub fn schema_application_target(
&self,
) -> Result<SchemaApplicationTarget, InternalError>
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.
Sourcepub fn schema_application_receipt(
&self,
database_identity: TargetDatabaseIdentity,
submission_key: &SchemaSubmissionKey,
) -> Result<Option<SchemaChangeReceipt>, InternalError>
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.
Sourcepub fn continue_schema_application(
&self,
job_id: SchemaChangeJobId,
acknowledged_receipt: Option<u64>,
) -> Result<SchemaChangeProgress, InternalError>
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.
Sourcepub fn abort_schema_application(
&self,
job_id: SchemaChangeJobId,
acknowledged_receipt: Option<u64>,
) -> Result<SchemaChangeProgress, InternalError>
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.
Sourcepub fn show_entities(
&self,
) -> Result<Vec<EntityCatalogDescription>, InternalError>
pub fn show_entities( &self, ) -> Result<Vec<EntityCatalogDescription>, InternalError>
Return one stable list of accepted runtime entity catalog entries.
Sourcepub fn show_stores(&self) -> Vec<StoreCatalogDescription>
pub fn show_stores(&self) -> Vec<StoreCatalogDescription>
Return one stable list of runtime-registered stores.
Sourcepub fn show_memory(&self) -> Vec<MemoryCatalogDescription>
pub fn show_memory(&self) -> Vec<MemoryCatalogDescription>
Return one stable list of runtime-registered stable-memory allocations.
Sourcepub fn try_describe_entity_by_source_key(
&self,
entity_source: &str,
) -> Result<EntitySchemaDescription, InternalError>
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.
Sourcepub fn try_describe_entity_by_name(
&self,
entity: &str,
) -> Result<EntitySchemaDescription, InternalError>
pub fn try_describe_entity_by_name( &self, entity: &str, ) -> Result<EntitySchemaDescription, InternalError>
Return one schema description selected by its accepted display name.
Sourcepub fn storage_report(
&self,
name_to_path: &[(&'static str, &'static str)],
) -> Result<StorageReport, InternalError>
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.
Sourcepub fn storage_report_default(&self) -> Result<StorageReport, InternalError>
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>
impl<C: CanisterKind> DbSession<C>
Sourcepub fn execute_admin_integrity(
&self,
request: IntegrityCheckRequest,
owner: IntegrityJobOwner,
) -> Result<IntegrityCheckResult, IntegrityDeepError>
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>
impl<C: CanisterKind> DbSession<C>
Sourcepub fn issue_typed_entity_binding(
&self,
entity_source_key: &str,
field_requests: &[DynamicTypedFieldBindingRequest],
) -> Result<DynamicTypedEntityBinding, DynamicTypedBindingError>
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.
Sourcepub fn typed_entity_binding_is_current(
&self,
binding: &DynamicTypedEntityBinding,
) -> Result<bool, InternalError>
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.
Sourcepub fn execute_trusted_dynamic_mutation(
&self,
request: &DynamicMutation,
) -> Result<DynamicMutationResult, InternalError>
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.
Sourcepub fn execute_trusted_dynamic_mutation_batch(
&self,
requests: Vec<DynamicMutation>,
) -> Result<DynamicMutationResult, InternalError>
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.
Sourcepub fn execute_trusted_dynamic_insert_batch(
&self,
entity: &str,
patches: Vec<DynamicStructuralPatch>,
) -> Result<DynamicMutationResult, InternalError>
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>
impl<C: CanisterKind> DbSession<C>
Sourcepub const fn new(store: &'static LocalKey<StoreRegistry>) -> Self
pub const fn new(store: &'static LocalKey<StoreRegistry>) -> Self
Construct one session facade over a sealed runtime store registry.
Sourcepub const fn metrics_sink(self, sink: &'static dyn MetricsSink) -> Self
pub const fn metrics_sink(self, sink: &'static dyn MetricsSink) -> Self
Attach one metrics sink for all session-executed operations.
Sourcepub const fn select_one(&self) -> Value
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.