actions
The traits here (Findable, HasMetadata, HasNotes, Prefixable, Taggable)
say what an entity can do, and the unit structs Artifact, Iteration and Task bind
them to the store. The submodules hold the generic actions, such as setting metadata or adding
a tag, that the artifact, iteration and task commands call.
| Name | Summary |
|---|---|
meta |
Generic meta actions: show, get, set and unset an entity’s JSON metadata. |
note |
Generic note actions: add, show, list, update and delete the notes on a task or an artifact. |
tag |
Generic tag and untag actions for any Taggable entity. |
transition |
Generic status-transition pipeline shared by task and iteration lifecycle commands. |
trait Findable
pub trait FindableAn entity that can be resolved from an ID prefix and fetched by full ID.
Implemented for Artifact, Iteration, Task.
type Findable::Model
type Model: Send + Serialize;The domain model returned by find_by_id.
Findable::entity_type
fn entity_type() -> EntityType;The entity type for envelope/sidecar loading.
| Parameter | Type | Description |
|---|---|---|
| returns | EntityType | The EntityType variant of this entity. |
Findable::find_by_id
fn find_by_id(
conn: &Connection,
id: impl Into<Id> + Send,
) -> impl Future<Output = Result<Self::Model, Error>> + Send;Fetch the entity by its full resolved ID.
| Parameter | Type | Description |
|---|---|---|
conn |
&Connection | the database connection |
id |
impl Into<Id> + Send | the full ID, already resolved from any prefix |
| returns | impl Future<Output = Result<Self::Model, Error>> + Send | The model, or a store error when no entity has that ID. |
Findable::table
fn table() -> Table;The resolve table used for prefix resolution.
| Parameter | Type | Description |
|---|---|---|
| returns | Table | The Table variant that holds this entity. |
trait HasMetadata
pub trait HasMetadata: Findable + PrefixableAn entity that carries user-defined JSON metadata and can be patched.
Implemented for Artifact, Iteration, Task.
type HasMetadata::Patch
type Patch: Default + Send;The patch type used to update the entity.
HasMetadata::event_table
fn event_table() -> &'static str;The table name used when recording transaction events (e.g., “tasks”).
| Parameter | Type | Description |
|---|---|---|
| returns | &'static str | The plural table name, such as "tasks". |
HasMetadata::metadata
fn metadata(model: &Self::Model) -> &Value;Read the metadata value from the model.
| Parameter | Type | Description |
|---|---|---|
model |
&Self::Model | the entity to read |
| returns | &Value | The entity’s metadata, a JSON value. |
HasMetadata::metadata_patch
fn metadata_patch(metadata: Value) -> Self::Patch;Produce a patch that sets only the metadata field.
| Parameter | Type | Description |
|---|---|---|
metadata |
Value | the whole new metadata value, which replaces the old one |
| returns | Self::Patch | A patch with every other field left unset. |
HasMetadata::update
fn update(
conn: &Connection,
id: &Id,
patch: &Self::Patch,
) -> impl Future<Output = Result<Self::Model, Error>> + Send;Persist the patch and return the updated model.
| Parameter | Type | Description |
|---|---|---|
conn |
&Connection | the database connection |
id |
&Id | the full ID of the entity to update |
patch |
&Self::Patch | the fields to change |
| returns | impl Future<Output = Result<Self::Model, Error>> + Send | The model as stored after the update, or a store error. |
trait HasNotes
pub trait HasNotes: Findable + PrefixableAn entity that supports notes.
trait Prefixable
pub trait Prefixable: FindableAn entity whose display ID can be shortened to a unique prefix.
Implemented for Artifact, Iteration, Task.
Prefixable::prefix_length
fn prefix_length(
conn: &Connection,
project_id: &Id,
id: &str,
) -> impl Future<Output = Result<usize, Error>> + Send;Compute the minimum unique prefix length for a single entity.
| Parameter | Type | Description |
|---|---|---|
conn |
&Connection | the database connection |
project_id |
&Id | the project whose entities the prefix must tell apart |
id |
&str | the full ID of the entity |
| returns | impl Future<Output = Result<usize, Error>> + Send | How many leading characters of id to highlight so it stands apart from the project’s other entities of the same kind; each kind’s repository decides which of them count. |
trait Taggable
pub trait Taggable: Findable + PrefixableAn entity that supports tag attachment/detachment.
struct Artifact
pub struct Artifact;Artifact entity binding for action traits.
Implements Findable, HasMetadata, HasNotes, Prefixable, Taggable.
struct Iteration
pub struct Iteration;Iteration entity binding for action traits.
Implements Findable, HasMetadata, HasStatus, Prefixable, Taggable.
struct Task
pub struct Task;Task entity binding for action traits.
Implements Findable, HasMetadata, HasNotes, HasStatus, Prefixable, Taggable.