ShieldedCache v2.1.1 ShieldedCache.TaskManager.TaskSet View Source

ShieldedCache.TaskManager.TaskSet

A GenServer process that holds in it’s state a unique set of tasks.

The TaskSet defines functions to add task refs, finish task refs, and get all the current task refs.

Link to this section Summary

Types

A representation of the state of the TaskSet

A representation of the tasks saved in the TaskSet state

Link to this section Types

A representation of the state of the TaskSet

Link to this type task() View Source
task() :: {reference :: term(), task :: function()}

A representation of the tasks saved in the TaskSet state

Link to this section Functions

Link to this function add_task(task_set, task_ref, task) View Source
add_task(task_set :: atom() | pid(), task_ref :: term(), task :: function()) ::
  :ok

add_task/2

Adds a task reference to the specified task set.

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function finish_task(task_set, task_ref) View Source
finish_task(task_set :: atom() | pid(), task_ref :: term()) :: :ok

finish_task/2

Finishes the specified task reference in the specified task set.

Link to this function get_currently_running_tasks(task_set) View Source
get_currently_running_tasks(task_set :: atom() | pid()) ::
  task_refs :: [task()]

get_currently_running_tasks/1

Gets all of the currently running task references in the specified task set.

Link to this function get_tasks(task_set) View Source
get_tasks(task_set :: atom() | pid()) :: task_refs :: [task()]

get_tasks/1

Gets all of the task references in the specified task set.

Link to this function return_task(task_set, task_ref) View Source
return_task(task_set :: atom() | pid(), task_ref :: term()) :: :ok

return_task/2

Returns a task back to the task sets and removes it from currently running tasks. This will also check if the task has exceeded the maximum number of retries (5).

Link to this function start_link(opts \\ []) View Source
start_link(opts :: Keyword.t()) :: GenServer.on_start()

start_link/1

Starts the TaskSet.

Link to this function start_task(task_set, task_ref) View Source
start_task(task_set :: atom() | pid(), task_ref :: term()) :: :ok

start_task/2

Starts a task in the specified task set. This will move the task to a list of currently running fetch tasks.