pub struct Operation {
pub id: String,
pub op_type: OperationType,
pub status: OperationStatus,
pub target: String,
pub parameters: HashMap<String, Value>,
pub created_at: DateTime<Utc>,
pub started_at: Option<DateTime<Utc>>,
pub completed_at: Option<DateTime<Utc>>,
pub approved: bool,
pub error: Option<String>,
}Expand description
Represents a single operation to be performed.
Fields§
§id: String§op_type: OperationType§status: OperationStatus§target: StringFile path, command, etc.
parameters: HashMap<String, Value>§created_at: DateTime<Utc>§started_at: Option<DateTime<Utc>>§completed_at: Option<DateTime<Utc>>§approved: bool§error: Option<String>Implementations§
Source§impl Operation
impl Operation
Sourcepub fn new(op_type: OperationType, target: String) -> Self
pub fn new(op_type: OperationType, target: String) -> Self
Create a new pending operation.
Sourcepub fn mark_executing(&mut self)
pub fn mark_executing(&mut self)
Mark operation as executing.
Sourcepub fn mark_success(&mut self)
pub fn mark_success(&mut self)
Mark operation as successful.
Sourcepub fn mark_failed(&mut self, error: String)
pub fn mark_failed(&mut self, error: String)
Mark operation as failed.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Operation
impl<'de> Deserialize<'de> for Operation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Operation
impl RefUnwindSafe for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnsafeUnpin for Operation
impl UnwindSafe for Operation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more