[−][src]Struct pueue_lib::state::State
Fields
settings: Settings
tasks: 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]
&self,
group: &str,
stati: Vec<TaskStatus>
) -> Vec<usize>
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]
&self,
statuses: Vec<TaskStatus>,
task_ids: Option<Vec<usize>>
) -> (Vec<usize>, Vec<usize>)
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]
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for State
[src]
Auto Trait Implementations
impl RefUnwindSafe for State
[src]
impl Send for State
[src]
impl Sync for State
[src]
impl Unpin for State
[src]
impl UnwindSafe for State
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,