pub struct MetadataKey(/* private fields */);Expand description
One caller-owned metadata key: <namespace>.<name>, at least two non-empty segments
separated by dots, whose first segment is not MetadataKey::RESERVED_NAMESPACE.
Validated wherever one is built, deserialized included, so a plugin handed one never has to ask whether it names a key this product owns.
Implementations§
Source§impl MetadataKey
impl MetadataKey
Sourcepub const RESERVED_NAMESPACE: &'static str = "onetaskgraph"
pub const RESERVED_NAMESPACE: &'static str = "onetaskgraph"
The namespace this product owns, and a narrow write therefore never names.
Every key the contract reserves lives under it — onetaskgraph.origin,
onetaskgraph.repositories, onetaskgraph.depends_on, onetaskgraph.delivers,
onetaskgraph.delivered_by, onetaskgraph.item_kind, onetaskgraph.template
(Self::TEMPLATE_KEY), onetaskgraph.copies (Self::COPIES_KEY),
onetaskgraph.members (Self::MEMBERS_KEY), onetaskgraph.member_of
(Self::MEMBER_OF_KEY) and onetaskgraph.assets (Self::ASSETS_KEY) — and so
does any key it reserves later, which is why the whole namespace is refused rather than
a list.
Sourcepub const TEMPLATE_KEY: &'static str = "onetaskgraph.template"
pub const TEMPLATE_KEY: &'static str = "onetaskgraph.template"
The reserved key a task or a document rendered from a template records where it came from under: an object holding the template’s reference, the chain digest it was rendered with, and the SHA-256 of its content and of its resolved answers.
A key of this product’s own, so no MetadataKey can name it: only a rendering write
— TaskSource::write_task_rendered and
TaskSource::set_task_rendering and their
document siblings — ever sets it, and a copy carries it like any other entry. The
engine builds and reads the value; a plugin only puts it where its metadata lives.
Sourcepub const COPIES_KEY: &'static str = "onetaskgraph.copies"
pub const COPIES_KEY: &'static str = "onetaskgraph.copies"
The reserved key a copied item records where it landed under: a JSON object mapping a destination source name to the qualified id of that item’s counterpart there, at most one entry per destination.
A key of this product’s own, so Self::new refuses it like every other key in the
namespace: only the engine’s copy writes it, through the narrow metadata write, and
Self::copies is how it names the key there. A plugin only puts it where its
metadata lives.
Sourcepub const MEMBERS_KEY: &'static str = "onetaskgraph.members"
pub const MEMBERS_KEY: &'static str = "onetaskgraph.members"
The reserved key a home project records its member projects under: a JSON list of qualified project ids, each in a different source from the home and from the others, so a home has at most one member per source.
Store-owned, like every key in the namespace: only the engine’s routed writes keep it —
a copy, or a task create routed away from its project’s source — through the home’s
own project write, and nothing a caller types can name it. A plugin
only puts it where its metadata lives.
Sourcepub const MEMBER_OF_KEY: &'static str = "onetaskgraph.member_of"
pub const MEMBER_OF_KEY: &'static str = "onetaskgraph.member_of"
The reserved key a member project records its home under: the home’s qualified id.
Written once, when a routed write — a copy or a task create — creates the member, and
never by a caller.
Sourcepub const ASSETS_KEY: &'static str = "onetaskgraph.assets"
pub const ASSETS_KEY: &'static str = "onetaskgraph.assets"
The reserved key a hosted source records what it uploaded for a record’s image assets
under: an AssetUploads — an object keyed by asset name, each
value {"sha256": <lowercase hex>, "url": <string>}.
Written by the hosted plugin itself, in the same write that lands the record, through
serve_asset_references; handed back to it as
AssetWrite::recorded_assets on the next copy onto
that record, so an asset whose SHA-256 is unchanged reuses its URL and is not uploaded
again. A copy never carries a source record’s entry to its destination: the entry says
where that source serves the bytes.
Sourcepub const COPIED_VERSION_KEY: &'static str = "onetaskgraph.copied_version"
pub const COPIED_VERSION_KEY: &'static str = "onetaskgraph.copied_version"
The reserved key a copy records on the destination item the source
Task::version it copied under — and, under --comments, a
token that covered the comments it carried.
Read back by the next copy of the same item, which skips it when the source’s current
version is still this one and the destination is unchanged since, by
Self::COPIED_DESTINATION_VERSION_KEY. Absent when the source gave no version.
Sourcepub const COPIED_WITH_COMMENTS_KEY: &'static str = "onetaskgraph.copied_with_comments"
pub const COPIED_WITH_COMMENTS_KEY: &'static str = "onetaskgraph.copied_with_comments"
The reserved key a --comments copy records on the destination item as the boolean
true, and a copy without --comments removes: whether the copy recorded at
Self::COPIED_VERSION_KEY carried the item’s comments.
A --comments copy never skips an item whose destination lacks it, so a copy that adds
--comments over an unchanged source still carries the comments.
Sourcepub const COPIED_DESTINATION_VERSION_KEY: &'static str = "onetaskgraph.copied_destination_version"
pub const COPIED_DESTINATION_VERSION_KEY: &'static str = "onetaskgraph.copied_destination_version"
The reserved key a copy records on the destination item a digest of that item as the
copy left it under, computed by the engine over the item without the three copied_*
keys: sha256:<hex>.
A later copy skips the item only when the digest of the destination as it reads it then is still this one, so an edit of copied content at the destination — a copied comment edited or deleted included — is restored by the next copy rather than skipped.
Sourcepub fn copies() -> Self
pub fn copies() -> Self
Self::COPIES_KEY, as the one reserved key a narrow metadata write may carry.
Not a way round Self::new for a caller: nothing a person types reaches this, and
the one write that sends it is the copy recording where an item landed.
Sourcepub fn is_copies(&self) -> bool
pub fn is_copies(&self) -> bool
Whether this is Self::COPIES_KEY.
Trait Implementations§
Source§impl Clone for MetadataKey
impl Clone for MetadataKey
Source§impl Debug for MetadataKey
impl Debug for MetadataKey
Source§impl<'de> Deserialize<'de> for MetadataKey
impl<'de> Deserialize<'de> for MetadataKey
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 Display for MetadataKey
impl Display for MetadataKey
impl Eq for MetadataKey
Source§impl From<MetadataKey> for String
impl From<MetadataKey> for String
Source§fn from(key: MetadataKey) -> Self
fn from(key: MetadataKey) -> Self
Source§impl Hash for MetadataKey
impl Hash for MetadataKey
Source§impl JsonSchema for MetadataKey
impl JsonSchema for MetadataKey
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