pub struct TaskUpdate {
pub title: Option<String>,
pub content: Option<String>,
pub status: Option<Status>,
pub priority: Option<Priority>,
pub metadata_set: BTreeMap<MetadataKey, Value>,
pub metadata_remove: BTreeSet<MetadataKey>,
pub delivers: Option<Vec<TaskRef>>,
pub depends_on: Option<Vec<DependencyEdge>>,
}Expand description
A targeted update of one existing task. A member left None (or empty) leaves that field
exactly as the source holds it.
Labels, repositories and project membership are deliberately outside it — an existing item is never moved, and no caller writes labels this way — and so is creation, which is a copy’s.
Fields§
§title: Option<String>The task’s title.
content: Option<String>Task::content exactly as a read reports it; a metadata block the source keeps in the
same backend field is kept byte for byte.
status: Option<Status>Name and category. A source that keeps status names stores the name; one that maps by
category (GitHub Projects) writes its mapped option, exactly as write_task does, and
refuses a category it has disabled in the same words.
priority: Option<Priority>The task’s priority; none clears it.
metadata_set: BTreeMap<MetadataKey, Value>Keys added or replaced; every other key is kept.
metadata_remove: BTreeSet<MetadataKey>Keys removed; a key the task does not hold is no write. Refused when it names a key
metadata_set also names.
delivers: Option<Vec<TaskRef>>Replaces the list; the engine keeps each ticket’s delivered_by in step.
depends_on: Option<Vec<DependencyEdge>>Replaces the task’s forward dependency edges (from is this task); the source sends
only the difference.
Implementations§
Source§impl TaskUpdate
impl TaskUpdate
Sourcepub fn names(&self, field: UpdatedField) -> bool
pub fn names(&self, field: UpdatedField) -> bool
Whether this update names field, which is the only way a source may report it written.
Sourcepub fn contradictions(&self) -> Vec<&MetadataKey>
pub fn contradictions(&self) -> Vec<&MetadataKey>
Every metadata key this update both sets and removes, in order.
An update naming one is refused before anything is written: which of the two it meant is not something a source may guess.
Sourcepub fn consistent(&self) -> Result<(), SourceError>
pub fn consistent(&self) -> Result<(), SourceError>
The refusal of an update that both sets and removes a key, or Ok when it does not.
Spelled once here, so every source and the engine refuse it in the same words.
§Errors
Returns SourceError::Refused naming every such key.
Sourcepub fn applied_to(&self, task: &Task) -> Task
pub fn applied_to(&self, task: &Task) -> Task
task as it reads once this update is applied to it: every named field replaced, every
named metadata key set or removed, and everything else exactly as it was.
depends_on is not a member of a Task, so it is not applied
here.
Sourcepub fn changed(&self, before: &Task, after: &Task) -> BTreeSet<UpdatedField>
pub fn changed(&self, before: &Task, after: &Task) -> BTreeSet<UpdatedField>
The fields this update names whose value differs between before and after — which,
for a source that compares before it writes, is exactly what it wrote.
UpdatedField::DependsOn is never among them: a Task carries no edges, so a
source says whether it wrote those itself.
Sourcepub async fn rewrite<S: TaskSource + ?Sized>(
&self,
source: &S,
id: &NativeId,
) -> Result<Option<TaskUpdateOutcome>, SourceError>
pub async fn rewrite<S: TaskSource + ?Sized>( &self, source: &S, id: &NativeId, ) -> Result<Option<TaskUpdateOutcome>, SourceError>
Apply this update to the task id of source by rewriting it: read it, apply the
update, and — only when anything differs — write_task it
with its target set, then read it back. None when source holds no such task.
This is what TaskSource::update_task does for a source that does not override it,
and it is public so a host forwarding the call to a peer that does not declare the
targeted update can fall back to exactly it. It is correct and not minimal: a write it
makes rewrites the whole item, and a source that can send less owes an override.
The forward edges are read whenever they are needed — to compare against a named
depends_on, or to carry unchanged through a rewrite a named depends_on does not
replace — because a write_task replaces them.
§Errors
Returns SourceError::Refused for an update that both sets and removes a key,
SourceError::Malformed when the write answers an id other than id or the task could
not be read back after it, and
whatever the source’s own read or write fails with.
Trait Implementations§
Source§impl Clone for TaskUpdate
impl Clone for TaskUpdate
Source§impl Debug for TaskUpdate
impl Debug for TaskUpdate
Source§impl Default for TaskUpdate
impl Default for TaskUpdate
Source§impl<'de> Deserialize<'de> for TaskUpdate
impl<'de> Deserialize<'de> for TaskUpdate
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>,
Source§impl JsonSchema for TaskUpdate
impl JsonSchema for TaskUpdate
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more