Skip to main content

WorkspaceConfig

Struct WorkspaceConfig 

Source
pub struct WorkspaceConfig {
Show 21 fields pub identity: Registration, pub notation: Notation, pub path_style: PathStyle, pub reference_target: Addressing, pub reference_label: bool, pub relation_styles: BTreeMap<String, RelationStyleConfig>, pub spanning: Option<String>, pub relation_defs: BTreeMap<String, RelationDef>, pub fields: BTreeMap<String, FieldSpec>, pub views: Vec<ViewSpec>, pub exports: Vec<ExportSpec>, pub id_storage: IdStorage, pub default_embed_format: Format, pub embed_style: EmbedStyle, pub content_format: ContentFormat, pub recycle_bin: bool, pub fixity: Fixity, pub history: History, pub about: About, pub updated: String, pub workspace_id: String,
}
Expand description

The workspace-wide policy a config declares.

Fields§

§identity: Registration

When a document earns a stable ID — the identity registration triggers.

§notation: Notation

The default reference notation (markdown / wikilink / bare). Overridden per relation by Relation::style.

§path_style: PathStyle

The default path resolution for path targets (root / relative / Ignored for id/alias targets.

§reference_target: Addressing

The default reference addressing (path / id / alias).

§reference_label: bool

Whether an id/alias reference carries a |Title label.

§relation_styles: BTreeMap<String, RelationStyleConfig>

Per-relation reference-style overrides, keyed by relation name — the config form of Relation::style. Each entry overlays the workspace default for that relation only, letting contents (down) and part_of (up) carry different styles. Empty means every relation inherits the default. Resolve with resolved_relation_styles.

§spanning: Option<String>

The name of the spanning relation — the single-parent containment tree that is the workspace’s discovery spine (DESIGN §3). None leaves it to the built vocabulary’s default. Declaring it in config is what lets a non-diaryx vocabulary name its own spine.

§relation_defs: BTreeMap<String, RelationDef>

Per-relation structural definitions, keyed by relation name — the self-describing half of the relations block (cardinality, inverse, human gloss). Empty means the workspace uses its built-in vocabulary (diaryx) unchanged. Consumed by relation_set.

§fields: BTreeMap<String, FieldSpec>

Controlled-vocabulary field declarations, keyed by frontmatter field name (tags, audience). Empty means no field is controlled — every such field is ordinary carried content (DESIGN §2, tier 3).

§views: Vec<ViewSpec>

The views the workspace declares, in declaration order — the second way through the same documents the spine already holds (“the entries under Daily, by month”). Empty means the workspace declares none, which is not the same as having none to offer: a frontend is free to derive a lens from a fields declaration, and a declared view is the workspace overriding that.

prov reads them and never acts on one. A view has no invariant to keep, so nothing in check can be violated by a wrong one — it is carried here so that every tool over the workspace reads the same views, rather than each app namespacing its own block and agreeing by convention. Executing one is prov-views.

§exports: Vec<ExportSpec>

The exports the workspace declares, in declaration order — the named, closed-by-default sets that may leave it, each bounded by a gate and optionally arranged by one of views. Empty means nothing is declared exportable, which is the default state of a workspace and of every document in it.

Carried here for the same reason views is — one axis every tool reads — but unlike a view an export has an invariant, and it lives with the planner in prov-exports: a plan’s entries are a subset of what the gate admits, whatever the named view says.

§id_storage: IdStorage

Where a document’s stable ID is persisted — registry, frontmatter shadow, or both (DESIGN §5). Independent of the identity trigger.

§default_embed_format: Format

The metadata format new documents get when they inherit no parent block — a default for authoring, never a workspace constraint (§7).

§embed_style: EmbedStyle

How that metadata is embedded — delimiters, a fenced code block, an HTML island, or a separate sidecar. Together with default_embed_format it selects the carrier a fresh root/document is authored in; recorded so the workspace is self-describing about its embedding convention. Like default_embed_format, an authoring default rather than a constraint: existing documents keep whatever carrier they already have.

§content_format: ContentFormat

The body-prose grammar the workspace is authored in (Markdown/Djot/HTML) — the format render and code-aware link scanning assume, and the intended default for new documents.

§recycle_bin: bool

Whether a delete moves the document to the recycle bin (recoverable) rather than destroying it. On by default — the safe posture for archival use, where a deletion should never be silently unrecoverable — and opt-out per workspace for those who genuinely want a hard delete as the default.

§fixity: Fixity

How far content-checksum (fixity) coverage extends — attachments only (the default), attachments plus document bodies, or off.

§history: History

Whether the workspace keeps a history store of captured pre-images — the safety net for structural damage an external sync transport introduces. Off by default; see History.

§about: About

Whether the workspace generates about.md, the prose page that tells a stranger how to read this directory. On by default; see About.

§updated: String

The frontmatter field prov edit stamps with the current time when a document’s content changes — the machine-maintained “last updated” field. Empty (the default) disables it. The name is yours (updated, modified, lastmod); the value is always machine-standard (RFC 3339 UTC), because prov reads it back to know when to rewrite it. A human-friendly date is a different, user-owned field prov never touches (see DESIGN §2, “does prov read it back?”).

§workspace_id: String

What this workspace calls itself — the qualifier a cross-workspace reference (id:<workspace>/<id>) names it by. Empty (the default) means the workspace is anonymous: it can still hold foreign references, but no reference can be recognized as pointing back at it.

This is the one piece of cross-workspace linking that is genuinely a fact about the archive, so it is the one piece that lives in its config. Where some other workspace can be found is a property of a device, not of this workspace, and deliberately has no config key — see Target::Foreign.

Must be well-formed: a malformed value is reported by diagnose and ignored rather than half-honored.

Implementations§

Source§

impl WorkspaceConfig

Source

pub fn paths_only() -> Self

Diaryx-style: path links, no identity — nothing mints an ID, so the workspace is addressed purely by path (the Adam’s-Archive shape).

Source

pub fn stable_ids() -> Self

Obsidian-style: stable IDs minted lazily (link-by-id or publish), and prov authors structural links by id — so a move rewrites nothing, the registry keeps them resolving. Portable path links for the rest.

The fused path LinkStyle this config’s notation + path resolution select — what the Workspace builder’s link_style expects for authoring structural path links.

Source

pub fn reference_style(&self) -> ReferenceStyle

The effective workspace-default ReferenceStyle — the fallback for any relation without its own override, composed from the four reference axes.

Source

pub fn resolved_relation_styles(&self) -> BTreeMap<String, ReferenceStyle>

The declared per-relation overrides resolved to full ReferenceStyles, each partial overlaid on the workspace default (reference_style) and normalized. Feed the result to RelationSet::with_styles to build the workspace’s relation vocabulary from a config. Empty when no relation declares an override — every relation then inherits the default.

Source

pub fn relation_set(&self) -> RelationSet

Build this workspace’s relation vocabulary — the self-describing path (DESIGN §1, the prov/1 spec). When relation_defs is empty, this is the diaryx preset (RelationSet::diaryx) unchanged — graceful degradation, so a minimal vault that spells out nothing keeps working. When it declares definitions, the vocabulary is built from them, and the structural pointer relations (registry/config/recycle_bin) are preserved so those pointers stay reachable regardless. An explicit spanning always wins; per-relation reference styles are overlaid last.

Source

pub fn mints_on_mutation(&self) -> bool

Whether a mutation under this config could mint a new stable ID — so a caller that will land one must bootstrap a registry document first (before the change set that would otherwise strand the id→path map with no home). Two ways an op mints: an eager identity policy stamps every created document, and any id-registering reference style (the workspace default, or a single relation’s override — e.g. part_of: id in a split) registers a link’s target when a link fires.

This is the single home for a judgment the CLI previously recomputed at every mutation command (new, attach, mv --in, reparent, duplicate, init’s adoption pass), each an identical copy of the same three-line link_registers && fires_on(Link) || fires_on(Create) — the kind of duplicated policy that drifts silently. It lives here because every term it needs is a fact about the config.

Source

pub fn apply(&mut self, meta: &Value)

Overlay the recognized keys present in meta onto this config; absent keys keep their current value. meta is either a root’s prov: block or a config document’s top-level mapping — the same nested shape. Apply the root block first, then the config document, so the config document wins.

Source

pub fn from_meta(meta: &Value) -> Self

A fresh config with meta’s recognized keys applied over the defaults.

Source

pub fn to_mapping(&self) -> Mapping

This config as config-document metadata keys (the nested vocabulary, docs/config-vocab.md). Emitted at the top level of the config document; the same mapping nests under prov: in a root’s frontmatter.

Trait Implementations§

Source§

impl Clone for WorkspaceConfig

Source§

fn clone(&self) -> WorkspaceConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorkspaceConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WorkspaceConfig

Source§

fn default() -> Self

The standalone default: portable markdown-root path links, identity available lazily (IDs minted only on a durable link-by-id or publish, §4), and path addressing (id-linking is opt-in).

Source§

impl Eq for WorkspaceConfig

Source§

impl PartialEq for WorkspaceConfig

Source§

fn eq(&self, other: &WorkspaceConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for WorkspaceConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.