Trait ProcessorTransactionLog

Source
pub trait ProcessorTransactionLog:
    Send
    + Sync
    + 'static {
    // Required methods
    fn begin_processing<'a>(
        &'a mut self,
        asset: &'a AssetPath<'_>,
    ) -> BoxedFuture<'a, Result<(), BevyError>>;
    fn end_processing<'a>(
        &'a mut self,
        asset: &'a AssetPath<'_>,
    ) -> BoxedFuture<'a, Result<(), BevyError>>;
    fn unrecoverable(&mut self) -> BoxedFuture<'_, Result<(), BevyError>>;
}
Expand description

A “write ahead” logger that helps ensure asset importing is transactional.

Prior to processing an asset, we write to the log to indicate it has started. After processing an asset, we write to the log to indicate it has finished. On startup, the log can be read through ProcessorTransactionLogFactory to determine if any transactions were incomplete.

Required Methods§

Source

fn begin_processing<'a>( &'a mut self, asset: &'a AssetPath<'_>, ) -> BoxedFuture<'a, Result<(), BevyError>>

Logs the start of an asset being processed.

If this is not followed at some point in the log by a closing ProcessorTransactionLog::end_processing, in the next run of the processor the asset processing will be considered “incomplete” and it will be reprocessed.

Source

fn end_processing<'a>( &'a mut self, asset: &'a AssetPath<'_>, ) -> BoxedFuture<'a, Result<(), BevyError>>

Logs the end of an asset being successfully processed. See ProcessorTransactionLog::begin_processing.

Source

fn unrecoverable(&mut self) -> BoxedFuture<'_, Result<(), BevyError>>

Logs an unrecoverable error.

On the next run of the processor, all assets will be regenerated. This should only be used as a last resort. Every call to this should be considered with scrutiny and ideally replaced with something more granular.

Implementors§