Skip to main content

AggregateJobs

Struct AggregateJobs 

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

Durable bounded aggregates in a host-governed allocation. Holds at most 16 jobs, each at most 16 KiB encoded bytes. Creation requires a fresh nonzero incarnation. Handles identify jobs; they do not authorize access. All mutation must run synchronously within one IC message, without awaits. Supplier failures trap; a later message trap rolls these changes back too.

Implementations§

Source§

impl<M: Memory> AggregateJobs<M>

Source

pub fn create( memory: RuntimeMemory<M>, incarnation: [u8; 16], ) -> Result<Self, Error>

Create in an empty allocation, with a host-supplied fresh incarnation.

§Errors

Refuses a zero incarnation or a nonempty/unsupported supplier allocation.

§Panics

Supplier failures after mutation begins must trap the enclosing message.

Source

pub fn open(memory: RuntimeMemory<M>) -> Result<Self, Error>

Reopen a supported job-store format without modifying it. Version-one jobs remain readable; the first successful insert/save atomically admits version two and its larger frame bound. Older executables then refuse.

§Errors

Refuses missing/corrupt headers and unsupported formats intact.

§Panics

Supplier corruption traps without repair.

Source

pub fn cancel(&mut self, handle: &JobHandle) -> Result<(), Error>

Cancel one job, immediately releasing its logical slot. Repeated/stale cancellation refuses; it cannot delete a subsequent occupant of that slot.

§Errors

Refuses a foreign, missing, stale or malformed handle/job frame. Cancellation need not interpret a known frame’s query-specific accumulator payload.

§Panics

Supplier mutation failures trap the enclosing message.

Source

pub fn cleanup_expired( &mut self, now: Timestamp, limit: usize, ) -> Result<usize, Error>

Examine at most 16 slots and remove at most limit expired jobs (1..=16). Time must be captured by the host; the database reads no clock. This does not shrink stable memory or promise physical reclamation by the supplier.

§Errors

Refuses invalid limits or malformed records before removing any job.

§Panics

Supplier mutation failures trap the enclosing message.

Auto Trait Implementations§

§

impl<M = Rc<RefCell<Vec<u8>>>> !RefUnwindSafe for AggregateJobs<M>

§

impl<M = Rc<RefCell<Vec<u8>>>> !Send for AggregateJobs<M>

§

impl<M = Rc<RefCell<Vec<u8>>>> !Sync for AggregateJobs<M>

§

impl<M = Rc<RefCell<Vec<u8>>>> !UnwindSafe for AggregateJobs<M>

§

impl<M> Forget for AggregateJobs<M>

§

impl<M> Freeze for AggregateJobs<M>
where StableBTreeMap<u8, Vec<u8>, M>: Freeze,

§

impl<M> Move for AggregateJobs<M>

§

impl<M> Unpin for AggregateJobs<M>
where StableBTreeMap<u8, Vec<u8>, M>: Unpin,

§

impl<M> UnsafeUnpin for AggregateJobs<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.