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§
Sourcefn read(
&self,
task: TaskId,
api: &dyn PersistedGraphApi,
) -> Result<Option<(TaskData, ReadTaskState)>>
fn read( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<Option<(TaskData, ReadTaskState)>>
read task data and state for a specific task.
Sourcefn lookup(
&self,
partial_task_type: &CachedTaskType,
api: &dyn PersistedGraphApi,
) -> Result<bool>
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
Sourcefn lookup_one(
&self,
task_type: &CachedTaskType,
api: &dyn PersistedGraphApi,
) -> Result<Option<TaskId>>
fn lookup_one( &self, task_type: &CachedTaskType, api: &dyn PersistedGraphApi, ) -> Result<Option<TaskId>>
lookup one cache entry
Sourcefn is_persisted(
&self,
task: TaskId,
api: &dyn PersistedGraphApi,
) -> Result<bool>
fn is_persisted( &self, task: TaskId, api: &dyn PersistedGraphApi, ) -> Result<bool>
checks if a task is persisted
Sourcefn persist(
&self,
task: TaskId,
data: TaskData,
state: PersistTaskState,
api: &dyn PersistedGraphApi,
) -> Result<Option<PersistResult>>
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.
Sourcefn activate_when_needed(
&self,
task: TaskId,
api: &dyn PersistedGraphApi,
) -> Result<Option<ActivateResult>>
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.
Sourcefn deactivate_when_needed(
&self,
task: TaskId,
api: &dyn PersistedGraphApi,
) -> Result<Option<DeactivateResult>>
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.
Sourcefn set_externally_active(
&self,
task: TaskId,
api: &dyn PersistedGraphApi,
) -> Result<bool>
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
Sourcefn unset_externally_active(
&self,
task: TaskId,
api: &dyn PersistedGraphApi,
) -> Result<bool>
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
Sourcefn remove_outdated_externally_active(
&self,
api: &dyn PersistedGraphApi,
) -> Result<Vec<TaskId>>
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.
Sourcefn make_dirty(&self, task: TaskId, api: &dyn PersistedGraphApi) -> Result<bool>
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
Sourcefn make_clean(&self, task: TaskId, api: &dyn PersistedGraphApi) -> Result<()>
fn make_clean(&self, task: TaskId, api: &dyn PersistedGraphApi) -> Result<()>
update the dirty flag for a stored task
Sourcefn make_dependent_dirty(
&self,
vc: RawVc,
api: &dyn PersistedGraphApi,
) -> Result<Vec<TaskId>>
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
Sourcefn get_active_external_tasks(
&self,
api: &dyn PersistedGraphApi,
) -> Result<Vec<TaskId>>
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
Sourcefn get_dirty_active_tasks(
&self,
api: &dyn PersistedGraphApi,
) -> Result<Vec<TaskId>>
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.
Sourcefn get_pending_active_update(
&self,
api: &dyn PersistedGraphApi,
) -> Result<(Vec<TaskId>, Vec<TaskId>)>
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§
Sourcefn stop(&self, api: &dyn PersistedGraphApi) -> Result<()>
fn stop(&self, api: &dyn PersistedGraphApi) -> Result<()>
Stop operations