pub struct Maintenance<M: Memory = DefaultMemoryImpl> { /* private fields */ }Expand description
Exclusive handle to a durably frozen source, before any target allocation/copy. Dropping this handle leaves maintenance active. Ordinary reads/writes remain closed. Host adapters own authorization and endpoint exposure.
Implementations§
Source§impl<M: Memory> Maintenance<M>
impl<M: Memory> Maintenance<M>
Sourcepub fn begin_copy(
self,
memory: RuntimeMemory<M>,
source: Schema,
target: Schema,
incarnation: [u8; 16],
) -> Result<SchemaCopy<M>, Error>
pub fn begin_copy( self, memory: RuntimeMemory<M>, source: Schema, target: Schema, incarnation: [u8; 16], ) -> Result<SchemaCopy<M>, Error>
Bind a fresh target allocation to this frozen source and initialize copying. The host supplies a fresh nonzero target incarnation, distinct from the source. The schemas must contain the same named entities, each retaining its primary key declaration and managed timestamp roles. References validate only after all entities are copied, including unchanged entities. All values and target indexes use ordinary codecs and shared batch validation.
§Errors
Refuses unsupported shapes, wrong schemas/identity or nonempty target memory before mutation. Initial supplier growth may also refuse.
§Panics
Failures after target initialization trap; never catch and continue.
Source§impl<M: Memory> Maintenance<M>
impl<M: Memory> Maintenance<M>
Sourcepub fn resume(
memory: RuntimeMemory<M>,
expected: &SchemaTransition,
) -> Result<Self, Error>
pub fn resume( memory: RuntimeMemory<M>, expected: &SchemaTransition, ) -> Result<Self, Error>
Sourcepub const fn transition(&self) -> &SchemaTransition
pub const fn transition(&self) -> &SchemaTransition
Inspect the admitted transformation identity.
Sourcepub const fn incarnation(&self) -> [u8; 16]
pub const fn incarnation(&self) -> [u8; 16]
Original database incarnation, preserved by cancellation.
Sourcepub fn source_page<E: Entity>(
&self,
source: &Schema,
after: Option<&QueryCursor>,
limit: usize,
bytes: usize,
) -> Result<QueryPage<E>, Error>
pub fn source_page<E: Entity>( &self, source: &Schema, after: Option<&QueryCursor>, limit: usize, bytes: usize, ) -> Result<QueryPage<E>, Error>
Read frozen source entities in ascending primary-key order through their
explicitly supplied compiled source schema and decoder. Limits are 1..=32
candidates and 1..=128 KiB of encoded output per call. Only next == None
establishes completion; a byte-limited page retries its unreturned row.
Cursors bind the transition, database, entity and source revision. Cancelling,
editing that entity and refreezing invalidates earlier cursors. These are
caller-controlled read positions, not trusted migration checkpoints.
§Errors
Refuses incompatible source schemas/decoders, invalid limits/cursors and
corrupt rows or revisions. An individually oversized row returns RowTooLarge.
§Panics
Supplier corruption traps without repair.
Sourcepub fn cancel(self)
pub fn cancel(self)
Cancel before target allocation/copy and restore the original live manifest. Reopening then requires an executable compatible with the source contract. A later trap in this IC message restores the frozen state.
§Panics
Supplier mutation failures trap the enclosing IC message.