Trait PersistedGraph

Source
pub trait PersistedGraph: Sync + Send {
Show 17 methods // Required methods fn read( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<Option<(TaskData, ReadTaskState)>>; fn lookup( &self, partial_task_type: &CachedTaskType, api: &dyn PersistedGraphApi, ) -> Result<bool>; fn lookup_one( &self, task_type: &CachedTaskType, api: &dyn PersistedGraphApi, ) -> Result<Option<TaskId>>; fn is_persisted( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<bool>; fn persist( &self, task: TaskId, data: TaskData, state: PersistTaskState, api: &dyn PersistedGraphApi, ) -> Result<Option<PersistResult>>; fn activate_when_needed( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<Option<ActivateResult>>; fn deactivate_when_needed( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<Option<DeactivateResult>>; fn set_externally_active( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<bool>; fn unset_externally_active( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<bool>; fn remove_outdated_externally_active( &self, api: &dyn PersistedGraphApi, ) -> Result<Vec<TaskId>>; fn make_dirty( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<bool>; fn make_clean( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<()>; fn make_dependent_dirty( &self, vc: RawVc, api: &dyn PersistedGraphApi, ) -> Result<Vec<TaskId>>; fn get_active_external_tasks( &self, api: &dyn PersistedGraphApi, ) -> Result<Vec<TaskId>>; fn get_dirty_active_tasks( &self, api: &dyn PersistedGraphApi, ) -> Result<Vec<TaskId>>; fn get_pending_active_update( &self, api: &dyn PersistedGraphApi, ) -> Result<(Vec<TaskId>, Vec<TaskId>)>; // Provided method fn stop(&self, api: &dyn PersistedGraphApi) -> Result<()> { ... }
}

Required Methods§

Source

fn read( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<Option<(TaskData, ReadTaskState)>>

read task data and state for a specific task.

Source

fn lookup( &self, partial_task_type: &CachedTaskType, api: &dyn PersistedGraphApi, ) -> Result<bool>

lookup all cache entries for a partial task type returns true if all cache entries has been initialized returns false if that were too many

Source

fn lookup_one( &self, task_type: &CachedTaskType, api: &dyn PersistedGraphApi, ) -> Result<Option<TaskId>>

lookup one cache entry

Source

fn is_persisted( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<bool>

checks if a task is persisted

Source

fn persist( &self, task: TaskId, data: TaskData, state: PersistTaskState, api: &dyn PersistedGraphApi, ) -> Result<Option<PersistResult>>

store a completed task into the persisted graph together with dependencies, children and cells. Returns false, if the task failed to persist.

Source

fn activate_when_needed( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<Option<ActivateResult>>

Activate a task in the persisted graph when active_parents > 0 or it’s externally kept alive.

Source

fn deactivate_when_needed( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<Option<DeactivateResult>>

Deactivate a task in the persisted graph when active_parents == 0 and it’s not externally kept alive.

Source

fn set_externally_active( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<bool>

Marks a task as kept alive by the consumer graph (usually from memory to persisted graph) Returns true when activate_when_needed should be called soonish

Source

fn unset_externally_active( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<bool>

No longer marks a task as kept alive by the consumer graph (usually from memory to persisted graph) Returns true when deactivate_when_needed should be called soonish

Source

fn remove_outdated_externally_active( &self, api: &dyn PersistedGraphApi, ) -> Result<Vec<TaskId>>

Removes all external keep alives that were not renewed this round. This is usually called after the initial build has finished and all external keep alives has been renewed.

Source

fn make_dirty(&self, task: TaskId, api: &dyn PersistedGraphApi) -> Result<bool>

update the dirty flag for a stored task Returns true, when the task is active and should be scheduled

Source

fn make_clean(&self, task: TaskId, api: &dyn PersistedGraphApi) -> Result<()>

update the dirty flag for a stored task

Source

fn make_dependent_dirty( &self, vc: RawVc, api: &dyn PersistedGraphApi, ) -> Result<Vec<TaskId>>

make all tasks that depend on that vc dirty and return a list of active tasks that should be scheduled

Source

fn get_active_external_tasks( &self, api: &dyn PersistedGraphApi, ) -> Result<Vec<TaskId>>

Get all tasks that are active, but not persisted. This is usually called at beginning to create and schedule tasks that are missing in the persisted graph

Source

fn get_dirty_active_tasks( &self, api: &dyn PersistedGraphApi, ) -> Result<Vec<TaskId>>

Get all tasks that are dirty and active. This is usually called at the beginning to schedule these tasks.

Source

fn get_pending_active_update( &self, api: &dyn PersistedGraphApi, ) -> Result<(Vec<TaskId>, Vec<TaskId>)>

Get tasks that have active update pending that need to be continued returns (tasks_to_activate, tasks_to_deactivate)

Provided Methods§

Source

fn stop(&self, api: &dyn PersistedGraphApi) -> Result<()>

Stop operations

Implementations on Foreign Types§

Source§

impl PersistedGraph for ()

Source§

fn read( &self, _task: TaskId, _api: &dyn PersistedGraphApi, ) -> Result<Option<(TaskData, ReadTaskState)>>

Source§

fn lookup( &self, _partial_task_type: &CachedTaskType, _api: &dyn PersistedGraphApi, ) -> Result<bool>

Source§

fn lookup_one( &self, _task_type: &CachedTaskType, _api: &dyn PersistedGraphApi, ) -> Result<Option<TaskId>>

Source§

fn is_persisted( &self, _task: TaskId, _api: &dyn PersistedGraphApi, ) -> Result<bool>

Source§

fn persist( &self, _task: TaskId, _data: TaskData, _state: PersistTaskState, _api: &dyn PersistedGraphApi, ) -> Result<Option<PersistResult>>

Source§

fn activate_when_needed( &self, _task: TaskId, _api: &dyn PersistedGraphApi, ) -> Result<Option<ActivateResult>>

Source§

fn deactivate_when_needed( &self, _task: TaskId, _api: &dyn PersistedGraphApi, ) -> Result<Option<DeactivateResult>>

Source§

fn set_externally_active( &self, _task: TaskId, _api: &dyn PersistedGraphApi, ) -> Result<bool>

Source§

fn unset_externally_active( &self, _task: TaskId, _api: &dyn PersistedGraphApi, ) -> Result<bool>

Source§

fn remove_outdated_externally_active( &self, _api: &dyn PersistedGraphApi, ) -> Result<Vec<TaskId>>

Source§

fn make_dirty( &self, _task: TaskId, _api: &dyn PersistedGraphApi, ) -> Result<bool>

Source§

fn make_clean(&self, _task: TaskId, _api: &dyn PersistedGraphApi) -> Result<()>

Source§

fn make_dependent_dirty( &self, _vc: RawVc, _api: &dyn PersistedGraphApi, ) -> Result<Vec<TaskId>>

Source§

fn get_active_external_tasks( &self, _api: &dyn PersistedGraphApi, ) -> Result<Vec<TaskId>>

Source§

fn get_dirty_active_tasks( &self, _api: &dyn PersistedGraphApi, ) -> Result<Vec<TaskId>>

Source§

fn get_pending_active_update( &self, _api: &dyn PersistedGraphApi, ) -> Result<(Vec<TaskId>, Vec<TaskId>)>

Implementors§