actions

Actions that several commands share, written once over the entity kinds.

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

source

pub trait Findable

An entity that can be resolved from an ID prefix and fetched by full ID.

Implemented for Artifact, Iteration, Task.

type Findable::Model

source

type Model: Send + Serialize;

The domain model returned by find_by_id.

Findable::entity_type

source

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

source

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

source

fn table() -> Table;

The resolve table used for prefix resolution.

Parameter Type Description
returns Table The Table variant that holds this entity.

trait HasMetadata

source

pub trait HasMetadata: Findable + Prefixable

An entity that carries user-defined JSON metadata and can be patched.

Implemented for Artifact, Iteration, Task.

type HasMetadata::Patch

source

type Patch: Default + Send;

The patch type used to update the entity.

HasMetadata::event_table

source

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

source

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

source

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

source

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

source

pub trait HasNotes: Findable + Prefixable

An entity that supports notes.

Implemented for Artifact, Task.

trait Prefixable

source

pub trait Prefixable: Findable

An entity whose display ID can be shortened to a unique prefix.

Implemented for Artifact, Iteration, Task.

Prefixable::prefix_length

source

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

source

pub trait Taggable: Findable + Prefixable

An entity that supports tag attachment/detachment.

Implemented for Artifact, Iteration, Task.

struct Artifact

source

pub struct Artifact;

Artifact entity binding for action traits.

Implements Findable, HasMetadata, HasNotes, Prefixable, Taggable.

struct Iteration

source

pub struct Iteration;

Iteration entity binding for action traits.

Implements Findable, HasMetadata, HasStatus, Prefixable, Taggable.

struct Task

source

pub struct Task;

Task entity binding for action traits.

Implements Findable, HasMetadata, HasNotes, HasStatus, Prefixable, Taggable.