Trait order_book::traits::ExpirationScheduler
source · pub trait ExpirationScheduler<BlockNumber, OrderBookId, DEXId, OrderId, Error> {
// Required methods
fn service(current_block: BlockNumber, weight: &mut WeightMeter);
fn schedule(
when: BlockNumber,
order_book_id: OrderBookId,
order_id: OrderId
) -> Result<(), Error>;
fn unschedule(
when: BlockNumber,
order_book_id: OrderBookId,
order_id: OrderId
) -> Result<(), Error>;
}
Required Methods§
sourcefn service(current_block: BlockNumber, weight: &mut WeightMeter)
fn service(current_block: BlockNumber, weight: &mut WeightMeter)
Execute scheduled expirations considering this block to be current_block
and weight limit to be set by weight
.
If the weight limit is reached, it should continue where it’s left at the next block.
sourcefn schedule(
when: BlockNumber,
order_book_id: OrderBookId,
order_id: OrderId
) -> Result<(), Error>
fn schedule( when: BlockNumber, order_book_id: OrderBookId, order_id: OrderId ) -> Result<(), Error>
Schedule the order for expiration at block when
.
sourcefn unschedule(
when: BlockNumber,
order_book_id: OrderBookId,
order_id: OrderId
) -> Result<(), Error>
fn unschedule( when: BlockNumber, order_book_id: OrderBookId, order_id: OrderId ) -> Result<(), Error>
Remove the order from expiration schedule for block when
.