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: RegistrationWhen a document earns a stable ID — the identity registration triggers.
notation: NotationThe default reference notation (markdown / wikilink / bare).
Overridden per relation by Relation::style.
path_style: PathStyleThe default path resolution for path targets (root / relative /
Ignored for id/alias targets.
reference_target: AddressingThe default reference addressing (path / id / alias).
reference_label: boolWhether 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: IdStorageWhere a document’s stable ID is persisted — registry, frontmatter shadow,
or both (DESIGN §5). Independent of the identity trigger.
default_embed_format: FormatThe metadata format new documents get when they inherit no parent block — a default for authoring, never a workspace constraint (§7).
embed_style: EmbedStyleHow 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: ContentFormatThe 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: boolWhether 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: FixityHow far content-checksum (fixity) coverage extends — attachments only (the default), attachments plus document bodies, or off.
history: HistoryWhether 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: AboutWhether the workspace generates about.md, the prose page that tells
a stranger how to read this directory. On by default; see About.
updated: StringThe 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: StringWhat 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
impl WorkspaceConfig
Sourcepub fn paths_only() -> Self
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).
Sourcepub fn stable_ids() -> Self
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.
Sourcepub fn link_format(&self) -> LinkStyle
pub fn link_format(&self) -> LinkStyle
Sourcepub fn reference_style(&self) -> ReferenceStyle
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.
Sourcepub fn resolved_relation_styles(&self) -> BTreeMap<String, ReferenceStyle>
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.
Sourcepub fn relation_set(&self) -> RelationSet
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.
Sourcepub fn mints_on_mutation(&self) -> bool
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.
Sourcepub fn apply(&mut self, meta: &Value)
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.
Sourcepub fn from_meta(meta: &Value) -> Self
pub fn from_meta(meta: &Value) -> Self
A fresh config with meta’s recognized keys applied over the defaults.
Sourcepub fn to_mapping(&self) -> Mapping
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
impl Clone for WorkspaceConfig
Source§fn clone(&self) -> WorkspaceConfig
fn clone(&self) -> WorkspaceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WorkspaceConfig
impl Debug for WorkspaceConfig
Source§impl Default for WorkspaceConfig
impl Default for WorkspaceConfig
impl Eq for WorkspaceConfig
Source§impl PartialEq for WorkspaceConfig
impl PartialEq for WorkspaceConfig
impl StructuralPartialEq for WorkspaceConfig
Auto Trait Implementations§
impl Freeze for WorkspaceConfig
impl RefUnwindSafe for WorkspaceConfig
impl Send for WorkspaceConfig
impl Sync for WorkspaceConfig
impl Unpin for WorkspaceConfig
impl UnsafeUnpin for WorkspaceConfig
impl UnwindSafe for WorkspaceConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.