Skip to main content

SchemaCopy

Struct SchemaCopy 

Source
pub struct SchemaCopy<M: Memory> { /* private fields */ }
Expand description

Exclusive source/target custody for a key-preserving whole-database transformation. Both allocations remain closed to ordinary access. Dropping preserves progress. Publication requires completed validation. Allocation reuse remains unsupported.

Implementations§

Source§

impl<M: Memory> SchemaCopy<M>

Source

pub fn resume( source_memory: RuntimeMemory<M>, target_memory: RuntimeMemory<M>, source_schema: Schema, target_schema: Schema, expected: &SchemaTransition, ) -> Result<Self, Error>

Resume only the recorded source/target pair and exact transformation.

§Errors

Refuses swapped, unrelated, live, cancelled or corrupt allocations intact.

§Panics

Supplier corruption traps without repair.

Source

pub fn next_entity(&self) -> Option<&'static str>

Name of the next entity to copy, in canonical schema-name order. Returns None after copying or once cancellation/validation has started.

Source

pub fn copy_unchanged<E: Entity>( &mut self, limit: usize, bytes: usize, ) -> Result<CopyStep, Error>

Explicitly preserve an unchanged entity through the same bounded copy path. The entity’s complete declaration must be admitted by both schemas.

§Errors

Refuses changed declarations, wrong copy order, bounds or corrupt source rows.

§Panics

Supplier mutation failures trap and roll back the whole IC message.

Source

pub fn copy_next<S: Entity, T: Entity>( &mut self, limit: usize, bytes: usize, transform: fn(S, &[u8]) -> Result<T, Error>, ) -> Result<CopyStep, Error>

Transform the next bounded source page and checkpoint its target inserts. The function must be deterministic for the declared version/fixed inputs, synchronous and free of external effects or reentrant database mutations. Limits match source paging: 1..=32 candidates, 1 byte..=128 KiB source output. Target preparation additionally enforces the ordinary batch/index envelope. Managed timestamp roles and their values must be preserved; field renames are allowed through the explicit transformation. No insertion clock runs. Call for next_entity() only. Completion advances to the next schema entity; complete becomes true only after all entities have been copied. Repeated calls after completion return zero rows and complete = true.

§Errors

Refusals (including transform errors, changed keys and cross-page uniqueness collisions) leave both rows and progress unchanged. Cancelling refuses copying.

§Panics

Mutation failures or a later enclosing-message trap roll back the whole chunk on the IC. Native callers must discard the runtime after a mutation panic.

Source

pub fn cancel_step(&mut self, limit: usize) -> Result<bool, Error>

Remove at most 1..=32 target entries, retaining its ownership tombstone. Copying cannot resume once cleanup starts. Return true only after cleanup and restoration of the source live manifest; drop this handle before reopen. No physical shrink or target allocation reuse is promised.

§Errors

Refuses invalid limits before mutation.

§Panics

Supplier mutation failures trap and roll back the entire IC message.

Source

pub fn validate_next(&mut self, limit: usize) -> Result<bool, Error>

Validate at most 1..=32 physical source or target entries in one call. Checks complete row framing, exact key coverage in both directions, revision metadata, expected index membership and every stored index’s owner/key. Each row has at most eight indexes and sixteen references. Each pass first checks all declared revisions (at most 32), including empty entities. No writes to rows/indexes occur; only successful bounded progress is checkpointed. Return true only after both passes finish. Copying cannot resume afterward.

§Errors

Refuses before copy completion, during cancellation, or on limits/corruption. A refused chunk leaves its durable validation position unchanged.

§Panics

Supplier failures trap; an IC trap rolls back checkpoint advancement.

Source

pub fn publish(self) -> Result<Database<M>, Error>

Atomically retire source admission and publish the fully validated target. The host selects the target allocation for subsequent ordinary opens. Source rows remain preserved but closed: this is not an operational rollback promise after target writes. Explicit RetiredSource cleanup may remove them.

§Errors

Refuses unless both validation passes have completed.

§Panics

Mutation failures or a later enclosing-message trap roll back both manifests.

Auto Trait Implementations§

§

impl<M> !RefUnwindSafe for SchemaCopy<M>

§

impl<M> !Send for SchemaCopy<M>

§

impl<M> !Sync for SchemaCopy<M>

§

impl<M> !UnwindSafe for SchemaCopy<M>

§

impl<M> Forget for SchemaCopy<M>

§

impl<M> Freeze for SchemaCopy<M>

§

impl<M> Move for SchemaCopy<M>

§

impl<M> Unpin for SchemaCopy<M>

§

impl<M> UnsafeUnpin for SchemaCopy<M>

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<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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.