[][src]Struct pueue_lib::state::State

pub struct State {
    pub settings: Settings,
    pub tasks: BTreeMap<usize, Task>,
    pub groups: BTreeMap<String, GroupStatus>,
    // some fields omitted
}

Fields

settings: Settingstasks: BTreeMap<usize, Task>groups: BTreeMap<String, GroupStatus>

Implementations

impl State[src]

This is the full representation of the current state of the Pueue daemon. This includes

  • All settings.
  • The full task list
  • The current status of all tasks

However, the State does NOT include:

  • Information about child processes
  • Handles to child processes

That information is saved in the TaskHandler.

pub fn new(settings: &Settings, config_path: Option<PathBuf>) -> State[src]

pub fn add_task(&mut self, mut task: Task) -> usize[src]

pub fn change_status(&mut self, id: usize, new_status: TaskStatus)[src]

pub fn set_enqueue_at(&mut self, id: usize, enqueue_at: Option<DateTime<Local>>)[src]

pub fn create_group(&mut self, group: &str)[src]

Check if the given group already exists. If it doesn't exist yet, create a state entry and a new settings entry.

pub fn remove_group(&mut self, group: &str) -> Result<()>[src]

Remove a group. Also go through all tasks and set the removed group to None.

pub fn set_status_for_all_groups(&mut self, status: GroupStatus)[src]

Set the running status for all groups including the default queue

pub fn task_ids_in_group_with_stati(
    &self,
    group: &str,
    stati: Vec<TaskStatus>
) -> Vec<usize>
[src]

Get all ids of task with a specific state inside a specific group

pub fn task_ids_in_group(&self, group: &str) -> Vec<usize>[src]

Get all ids of task inside a specific group

pub fn tasks_in_statuses(
    &self,
    statuses: Vec<TaskStatus>,
    task_ids: Option<Vec<usize>>
) -> (Vec<usize>, Vec<usize>)
[src]

This checks, whether the given task_ids are in the specified statuses. The first result is the list of task_ids that match these statuses. The second result is the list of task_ids that don't match these statuses.

Additionally, a list of task_ids can be specified to only run the check on a subset of all tasks.

pub fn is_task_removable(&self, task_id: &usize, to_delete: &[usize]) -> bool[src]

Check if a task can be deleted. We have to check all dependant tasks, which haven't finished yet. This is necessary to prevent deletion of tasks which are specified as a dependency.

to_delete A list of task ids, which should also be deleted.

pub fn handle_task_failure(&mut self, group: String)[src]

Users can specify to pause either the task's group or all groups on a failure.

pub fn reset(&mut self)[src]

pub fn save_settings(&self) -> Result<()>[src]

pub fn save(&self)[src]

Convenience wrapper around save_to_file.

pub fn backup(&self)[src]

Save the current current state in a file with a timestamp. At the same time remove old state logs from the log directory. This function is called, when large changes to the state are applied, e.g. clean/reset.

pub fn restore(&mut self)[src]

Restore the last state from a previous session. The state is stored as json in the log directory.

Trait Implementations

impl Clone for State[src]

impl Debug for State[src]

impl<'de> Deserialize<'de> for State[src]

impl Serialize for State[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,