Skip to main content

TaskStore

Struct TaskStore 

Source
pub struct TaskStore { /* private fields */ }

Implementations§

Source§

impl TaskStore

Source

pub fn open(data_dir: &Path) -> Result<Self, ServerError>

Source

pub fn in_memory() -> Result<Self, ServerError>

Source

pub fn set_session_nick( &self, session_id: &str, nick: &str, ) -> Result<(), ServerError>

Source

pub fn session_nick( &self, session_id: &str, ) -> Result<Option<String>, ServerError>

Source

pub fn active_runs_with_nick(&self) -> Result<Vec<(Run, String)>, ServerError>

(run, session nick) for every active run whose session has a nick.

Source

pub fn replay(&self, op_id: Option<&str>) -> Result<Option<Value>, ServerError>

Replay a recorded operation result, if op_id was seen.

Source

pub fn record( &self, op_id: Option<&str>, result: &Value, ) -> Result<(), ServerError>

Source

pub fn create( &self, title: &str, body: &str, assignee: Option<&str>, ) -> Result<Task, ServerError>

Source

pub fn create_full( &self, title: &str, body: &str, assignee: Option<&str>, role: Option<&str>, parent_id: Option<i64>, status: Option<&str>, ) -> Result<Task, ServerError>

Source

pub fn get(&self, id: i64) -> Result<Option<Task>, ServerError>

Source

pub fn list( &self, assignee: Option<&str>, open_only: bool, ) -> Result<Vec<Task>, ServerError>

Source

pub fn list_filtered( &self, assignee: Option<&str>, roles: Option<&[String]>, open_only: bool, ) -> Result<Vec<Task>, ServerError>

roles: when set, only tasks without a role or with one of these roles.

Source

pub fn assign(&self, id: i64, assignee: &str) -> Result<bool, ServerError>

Source

pub fn move_to( &self, id: i64, status: &str, expected: Option<i64>, ) -> Result<Result<Task, Refused>, ServerError>

Move a task to status (operator), with optional revision check.

Source

pub fn set_status( &self, id: i64, status: &str, only_assignee: Option<&str>, ) -> Result<bool, ServerError>

Operator cancel, or the assignee moving its own task along (in_progress, done).

Source

pub fn archive_task( &self, id: i64, ) -> Result<Result<Task, Refused>, ServerError>

Operator archive of a finished task: hidden from lists, kept for history.

Source

pub fn archive_session( &self, session_id: &str, ) -> Result<Result<(), Refused>, ServerError>

Operator archive of a session record with no running run: hidden from lists.

Source

pub fn set_inventory( &self, node_id: &str, providers: &[ProviderInventory], ) -> Result<(), ServerError>

Replace one node’s provider inventory (what the node detected; nothing else).

Source

pub fn inventory(&self) -> Result<Vec<NodeInventory>, ServerError>

Source

pub fn set_role(&self, role: &str, r: &Role) -> Result<(), ServerError>

Source

pub fn delete_role(&self, role: &str) -> Result<bool, ServerError>

Source

pub fn roles(&self) -> Result<BTreeMap<String, Role>, ServerError>

Source

pub fn upsert_session(&self, s: &Session) -> Result<Session, ServerError>

Source

pub fn session(&self, id: &str) -> Result<Option<Session>, ServerError>

Source

pub fn sessions(&self, node: Option<&str>) -> Result<Vec<Session>, ServerError>

Source

pub fn start_run( &self, task_id: i64, session_id: &str, ) -> Result<Result<Run, Refused>, ServerError>

Bind a task to a recorded session. The task moves to in_progress.

Source

pub fn run(&self, id: i64) -> Result<Option<Run>, ServerError>

Source

pub fn runs(&self, task_id: i64) -> Result<Vec<Run>, ServerError>

Source

pub fn active_run(&self, task_id: i64) -> Result<Option<Run>, ServerError>

Source

pub fn close_run( &self, run_id: i64, status: &str, by: &str, caller_session: Option<&str>, branch: Option<&str>, commit_id: Option<&str>, result_message_id: Option<&str>, ) -> Result<Result<Run, Refused>, ServerError>

Close (or move to review) a run. by is session (the run’s own session, via m4a) or operator (override). A session may not reopen or touch a closed run; the operator may override any non-cancelled run. The task follows the run.

Source§

impl TaskStore

Source

pub fn add_signal( &self, node_id: &str, workspace_id: &str, instance_id: i64, provider: &str, kind: &str, hint: Option<&str>, ) -> Result<Result<SessionSignal, Refused>, ServerError>

Record a short session signal from a node (state changes only; bounded table).

Source

pub fn signals( &self, node: Option<&str>, after_id: Option<i64>, limit: i64, ) -> Result<Vec<SessionSignal>, ServerError>

Signals after after_id (oldest first), optionally for one node.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more