pub trait TurboTasksApi:
TurboTasksCallApi
+ Sync
+ Send {
Show 26 methods
// Required methods
fn pin(&self) -> Arc<dyn TurboTasksApi>;
fn invalidate(&self, task: TaskId);
fn invalidate_with_reason(
&self,
task: TaskId,
reason: StaticOrArc<dyn InvalidationReason>,
);
fn invalidate_serialization(&self, task: TaskId);
fn notify_scheduled_tasks(&self);
fn try_read_task_output(
&self,
task: TaskId,
consistency: ReadConsistency,
) -> Result<Result<RawVc, EventListener>>;
fn try_read_task_output_untracked(
&self,
task: TaskId,
consistency: ReadConsistency,
) -> Result<Result<RawVc, EventListener>>;
fn try_read_task_cell(
&self,
task: TaskId,
index: CellId,
options: ReadCellOptions,
) -> Result<Result<TypedCellContent, EventListener>>;
fn try_read_task_cell_untracked(
&self,
task: TaskId,
index: CellId,
options: ReadCellOptions,
) -> Result<Result<TypedCellContent, EventListener>>;
fn try_read_local_output(
&self,
execution_id: ExecutionId,
local_task_id: LocalTaskId,
) -> Result<Result<RawVc, EventListener>>;
fn read_task_collectibles(
&self,
task: TaskId,
trait_id: TraitTypeId,
) -> TaskCollectiblesMap;
fn emit_collectible(&self, trait_type: TraitTypeId, collectible: RawVc);
fn unemit_collectible(
&self,
trait_type: TraitTypeId,
collectible: RawVc,
count: u32,
);
fn unemit_collectibles(
&self,
trait_type: TraitTypeId,
collectibles: &TaskCollectiblesMap,
);
fn try_read_own_task_cell_untracked(
&self,
current_task: TaskId,
index: CellId,
options: ReadCellOptions,
) -> Result<TypedCellContent>;
fn read_own_task_cell(
&self,
task: TaskId,
index: CellId,
options: ReadCellOptions,
) -> Result<TypedCellContent>;
fn update_own_task_cell(
&self,
task: TaskId,
index: CellId,
content: CellContent,
);
fn mark_own_task_as_finished(&self, task: TaskId);
fn set_own_task_aggregation_number(
&self,
task: TaskId,
aggregation_number: u32,
);
fn mark_own_task_as_session_dependent(&self, task: TaskId);
fn connect_task(&self, task: TaskId);
fn detached_for_testing(
&self,
f: Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>;
fn task_statistics(&self) -> &TaskStatisticsApi;
fn stop_and_wait(&self) -> Pin<Box<dyn Future<Output = ()> + Send>>;
fn subscribe_to_compilation_events(
&self,
event_types: Option<Vec<String>>,
) -> Receiver<Arc<dyn CompilationEvent>>;
fn send_compilation_event(&self, event: Arc<dyn CompilationEvent>);
}
Expand description
A type-erased subset of TurboTasks
stored inside a thread local when we’re in a turbo task
context. Returned by the turbo_tasks
helper function.
This trait is needed because thread locals cannot contain an unresolved Backend
type
parameter.
Required Methods§
fn pin(&self) -> Arc<dyn TurboTasksApi>
fn invalidate(&self, task: TaskId)
fn invalidate_with_reason( &self, task: TaskId, reason: StaticOrArc<dyn InvalidationReason>, )
fn invalidate_serialization(&self, task: TaskId)
Sourcefn notify_scheduled_tasks(&self)
fn notify_scheduled_tasks(&self)
Eagerly notifies all tasks that were scheduled for notifications via
schedule_notify_tasks_set()
fn try_read_task_output( &self, task: TaskId, consistency: ReadConsistency, ) -> Result<Result<RawVc, EventListener>>
Sourcefn try_read_task_output_untracked(
&self,
task: TaskId,
consistency: ReadConsistency,
) -> Result<Result<RawVc, EventListener>>
fn try_read_task_output_untracked( &self, task: TaskId, consistency: ReadConsistency, ) -> Result<Result<RawVc, EventListener>>
INVALIDATION: Be careful with this, it will not track dependencies, so using it could break cache invalidation.
fn try_read_task_cell( &self, task: TaskId, index: CellId, options: ReadCellOptions, ) -> Result<Result<TypedCellContent, EventListener>>
Sourcefn try_read_task_cell_untracked(
&self,
task: TaskId,
index: CellId,
options: ReadCellOptions,
) -> Result<Result<TypedCellContent, EventListener>>
fn try_read_task_cell_untracked( &self, task: TaskId, index: CellId, options: ReadCellOptions, ) -> Result<Result<TypedCellContent, EventListener>>
INVALIDATION: Be careful with this, it will not track dependencies, so using it could break cache invalidation.
Sourcefn try_read_local_output(
&self,
execution_id: ExecutionId,
local_task_id: LocalTaskId,
) -> Result<Result<RawVc, EventListener>>
fn try_read_local_output( &self, execution_id: ExecutionId, local_task_id: LocalTaskId, ) -> Result<Result<RawVc, EventListener>>
Reads a RawVc::LocalOutput
. If the task has completed, returns the RawVc
the local
task points to.
The returned RawVc
may also be a RawVc::LocalOutput
, so this may need to be called
recursively or in a loop.
This does not accept a consistency argument, as you cannot control consistency of a read of
an operation owned by your own task. Strongly consistent reads are only allowed on
OperationVc
s, which should never be local tasks.
No dependency tracking will happen as a result of this function call, as it’s a no-op for a task to depend on itself.
fn read_task_collectibles( &self, task: TaskId, trait_id: TraitTypeId, ) -> TaskCollectiblesMap
fn emit_collectible(&self, trait_type: TraitTypeId, collectible: RawVc)
fn unemit_collectible( &self, trait_type: TraitTypeId, collectible: RawVc, count: u32, )
fn unemit_collectibles( &self, trait_type: TraitTypeId, collectibles: &TaskCollectiblesMap, )
Sourcefn try_read_own_task_cell_untracked(
&self,
current_task: TaskId,
index: CellId,
options: ReadCellOptions,
) -> Result<TypedCellContent>
fn try_read_own_task_cell_untracked( &self, current_task: TaskId, index: CellId, options: ReadCellOptions, ) -> Result<TypedCellContent>
INVALIDATION: Be careful with this, it will not track dependencies, so using it could break cache invalidation.
fn read_own_task_cell( &self, task: TaskId, index: CellId, options: ReadCellOptions, ) -> Result<TypedCellContent>
fn update_own_task_cell( &self, task: TaskId, index: CellId, content: CellContent, )
fn mark_own_task_as_finished(&self, task: TaskId)
fn set_own_task_aggregation_number(&self, task: TaskId, aggregation_number: u32)
fn mark_own_task_as_session_dependent(&self, task: TaskId)
fn connect_task(&self, task: TaskId)
Sourcefn detached_for_testing(
&self,
f: Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>
fn detached_for_testing( &self, f: Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>
Wraps the given future in the current task.
Beware: this method is not safe to use in production code. It is only intended for use in tests and for debugging purposes.