pub struct GitAdapter { /* private fields */ }Expand description
A git repository, exposed as an arbor.
Implementations§
Trait Implementations§
Source§impl AstAdapter for GitAdapter
impl AstAdapter for GitAdapter
Source§fn children_named(&self, node: NodeId, name: &str) -> Vec<NodeId>
fn children_named(&self, node: NodeId, name: &str) -> Vec<NodeId>
Literal names under /commits go straight through
rev-parse — unique prefixes, HEAD~2, v1.0^{} — with
no enumeration.
Source§fn property(&self, node: NodeId, name: &str) -> Option<Value>
fn property(&self, node: NodeId, name: &str) -> Option<Value>
Commit header fields (ref aliases answer for their commit).
Source§fn provenance(&self, node: NodeId) -> Provenance
fn provenance(&self, node: NodeId) -> Provenance
Data provenance: the repository path as the source; the
nearest commit-backed ancestor’s author date as the instant
(a tree entry answers “this repo, as of that commit” — the
same instant ::date mints). The structural dirs and the
root have no commit ancestor and answer source only. No
dpid — the commit hash stays on ::hash / ::::short.
Source§fn default_value(&self, node: NodeId) -> Option<Value>
fn default_value(&self, node: NodeId) -> Option<Value>
A blob’s content (text, lossily decoded).
Source§fn aliased_metadata(&self, _node: NodeId) -> &'static [&'static str]
fn aliased_metadata(&self, _node: NodeId) -> &'static [&'static str]
Commits: ;;;short, ;;;n-parents, ;;;tags,
;;;n-tags. Entries: ;;;type, ;;;mode, ;;;size,
;;;hash.
Ruling #29: this adapter’s property surface is closed — a
commit object cannot grow fields — so its annotations
answer at :: too. hash is in the list on purpose:
commits expose the oid as a property and tree entries as
metadata, but it is one concept — this node’s object id —
and aliasing is what makes ::hash answer everywhere in
the arbor instead of falling silently null on entries.
Source§fn resolve(
&self,
node: NodeId,
property: &str,
_hint: Option<&str>,
) -> Option<NodeId>
fn resolve( &self, node: NodeId, property: &str, _hint: Option<&str>, ) -> Option<NodeId>
::parent~> — the first parent (the hint is unused: the
target is inherently a commit).
Source§fn links(&self, node: NodeId) -> Vec<(String, NodeId)>
fn links(&self, node: NodeId) -> Vec<(String, NodeId)>
Every parent is an outgoing parent edge (merges fan out).
Source§fn backlinks(&self, node: NodeId) -> Vec<(String, NodeId)>
fn backlinks(&self, node: NodeId) -> Vec<(String, NodeId)>
The commits whose parent is here (the children — served from the enumeration, so this loads the commit list).
Source§fn children(&self, node: NodeId) -> Vec<NodeId>
fn children(&self, node: NodeId) -> Vec<NodeId>
node, in document order. Read moreSource§fn name(&self, node: NodeId) -> Option<String>
fn name(&self, node: NodeId) -> Option<String>
node — the label of its incoming tree edge. Read moreSource§fn metadata(&self, node: NodeId, key: &str) -> Option<Value>
fn metadata(&self, node: NodeId, key: &str) -> Option<Value>
::::key (a filesystem adapter’s
size, modified, permissions, …). None if absent.Source§fn properties(&self, _node: NodeId) -> Vec<(String, Value)>
fn properties(&self, _node: NodeId) -> Vec<(String, Value)>
| json, | xml,
| kaiv) merge them with the children, a child winning a
shared name. The default is none: for a reading whose values
are all nodes, the children already say everything.Source§fn non_tree_nodes(&self) -> Vec<NodeId>
fn non_tree_nodes(&self) -> Vec<NodeId>
*// reaches them after the tree, in this
order; :::is-non-tree is true on them. The default is
none: every shipped adapter puts every node in the tree.Source§fn child_host(&self, node: NodeId) -> NodeId
fn child_host(&self, node: NodeId) -> NodeId
node
reads. The default is node itself. An adapter whose tree
holds transparent links (a filesystem’s symlink to a
directory) answers the link’s target, so /link/name lands
on the target’s own child — the same node /target/name
reaches. The descendant walk never consults this: it reads
children alone, so a linked subtree is
walked once, under its own parent, and a cycle of links
cannot trap it.Source§fn answers_to(&self, node: NodeId, name: &str) -> bool
fn answers_to(&self, node: NodeId, name: &str) -> bool
node answers to name as a literal spelling
(ruling #30). The default is canonical equality. An adapter
may declare per-node aliases — a social feed spelling a
handle @alice while the stripped alice is the hop name —
and the engine consults this wherever a literal name is
matched, on every axis, so one override keeps /@alice and
//@alice in agreement. :::name stays canonical (locators
and reflection print it; an alias is a way in, never a way
out), and name patterns (~(...), *) test the canonical
name only.Source§fn has_trait(&self, node: NodeId, name: &str) -> bool
fn has_trait(&self, node: NodeId, name: &str) -> bool
node bears name as a trait, as written in a
<...> clause. The default is membership in
traits; an adapter may declare aliases the
way answers_to does for names — a
model file’s alias <chunk> <block>; or
alias <s/^tag://i>; — and the engine consults this
wherever a written trait is matched. Reflection and
serialization print the canonical traits only.Source§fn external_ref(
&self,
_node: NodeId,
_property: &str,
_hint: Option<&str>,
) -> Option<String>
fn external_ref( &self, _node: NodeId, _property: &str, _hint: Option<&str>, ) -> Option<String>
node’s property holds, if any: an
adapter-defined identifier of a document outside this
arbor — for html, the anchor’s absolute URL, a relative
href joined against the document’s own URL. A #fragment
part is the crossref within the target document and rides
along (URI semantics). Consulted by ::property--> when
in-document resolution misses: a mounted document with that
identifier answers (the fragment’s element, else its root),
an unmounted one lands among the run’s unresolved external
references for the host’s acquisition loop. The engine
itself never fetches.Source§fn resolve_fragment(&self, _node: NodeId, _fragment: &str) -> Option<NodeId>
fn resolve_fragment(&self, _node: NodeId, _fragment: &str) -> Option<NodeId>
fragment names inside the document node
belongs to — html’s id lookup. The landing rung of a
fragment-carrying external reference, once its document is
mounted.Source§fn ref_property(&self, _node: NodeId) -> Option<String>
fn ref_property(&self, _node: NodeId) -> Option<String>
node’s own reference, for the bare
arrow (//a-->): an html anchor’s href, an iframe’s
src. None for a node that references nothing.Source§fn ref_label(&self, _node: NodeId, _property: &str) -> Option<String>
fn ref_label(&self, _node: NodeId, _property: &str) -> Option<String>
node via
property carries — html’s rel attribute. None falls
back to the property name as the edge label.Source§fn link_property(
&self,
_source: NodeId,
_label: &str,
_target: NodeId,
_name: &str,
) -> Option<Value>
fn link_property( &self, _source: NodeId, _label: &str, _target: NodeId, _name: &str, ) -> Option<Value>
source --label--> target — the
$-::prop read. Adapters whose edges carry data (a property
graph’s relationship properties) override this; None if the
edge is bare or unknown. Where parallel edges share source,
label, and target, the adapter answers for one of them,
consistently.Source§fn document_by_ref(&self, _id: &str) -> Option<NodeId>
fn document_by_ref(&self, _id: &str) -> Option<NodeId>
-->
after the mounted-document table misses. An adapter over a
store of pages answers by URL lookup; the engine performs
no IO either way.Source§fn reverse_resolve(
&self,
_node: NodeId,
_property: Option<&str>,
_hint: Option<&str>,
) -> Option<Vec<NodeId>>
fn reverse_resolve( &self, _node: NodeId, _property: Option<&str>, _hint: Option<&str>, ) -> Option<Vec<NodeId>>
property (or, when None, own reference
property) resolves to node, in document order — the
reverse index behind <--. None keeps the engine’s walk
of the whole arbor; Some is the adapter’s complete answer.Source§fn descendants_named(
&self,
_node: NodeId,
_name: &str,
) -> Option<Vec<(NodeId, usize)>>
fn descendants_named( &self, _node: NodeId, _name: &str, ) -> Option<Vec<(NodeId, usize)>>
node that answer to name, each with
its depth (children are depth 1), in document order — the
fast path behind //name for an adapter whose substrate
indexes names. None keeps the engine’s walk; Some must
be exactly what the walk would find.Source§fn descendants_where(
&self,
_node: NodeId,
_name: &str,
_property: &str,
_value: &Value,
) -> Option<Vec<(NodeId, usize)>>
fn descendants_where( &self, _node: NodeId, _name: &str, _property: &str, _value: &Value, ) -> Option<Vec<(NodeId, usize)>>
node named name whose property
property equals value, each with its depth, in document
order — the fast path behind //name[::property = "value"]
for an adapter that indexes a property (the corpus reading’s
positional index answers //token[::lower = "tom"] from it).
None keeps the engine’s walk and its comparison; Some
must be exactly what the walk would find under the standard
equality, so an adapter answers only the values it can
compare as the engine does (text against text).Source§fn prefetch_links(&self, _nodes: &[NodeId], _dir: LinkDir)
fn prefetch_links(&self, _nodes: &[NodeId], _dir: LinkDir)
dir
crosslinks from every node in nodes. An adapter backed by
a store may fetch them in one statement; semantics are
unchanged either way.Source§fn quantifier_bound(&self) -> usize
fn quantifier_bound(&self) -> usize
+, *, {m,}) expand, and the ceiling of any
explicit {m,n} (the effective upper bound is min(n, N_max)).
An adapter whose natural structures run deep may raise it; the
CLI overrides it per run (qua --quantifier-bound).Source§fn allow_shell(&self) -> bool
fn allow_shell(&self) -> bool
sh(...) pipeline stage may run external
commands. False by default — query text stays inert data —
and enabled per run by the CLI (qua --allow-shell) through
the AllowShell wrapper.Source§fn invocation_instant(&self) -> Option<(i64, u32)>
fn invocation_instant(&self) -> Option<(i64, u32)>
now() denotes (spec: The Temporal
Fragment, Determinism): one UTC timeline point bound by the
runner BEFORE evaluation begins — evaluation itself never
reads a clock. None by default (a library run is fully
deterministic; now() reads as null); the CLI binds it at
startup — pinnable with qua --now — through the
WithNow wrapper.Source§fn has_node(&self, node: NodeId) -> bool
fn has_node(&self, node: NodeId) -> bool
node is an id this adapter minted — the guard
behind the node-id anchor ((!N)), which may name an id
from an earlier run (ids are minted deterministically: the
same source, the same ids). The default probes the id
through parent and name and treats a panic as absence,
so an adapter that indexes by id needs no override; one that
can answer cheaply should.Source§fn provenance_list(&self, node: NodeId) -> ProvenanceList
fn provenance_list(&self, node: NodeId) -> ProvenanceList
node as a list — every source the
substrate records for the datum, and how many it elides.
The default is the singular answer as a one-entry list; an
adapter whose substrate records several (kaiv’s ?a;b;+N)
overrides it, and a wrapper layers each entry.Source§fn unit_scale(&self, expr: &str) -> Option<(f64, String)>
fn unit_scale(&self, expr: &str) -> Option<(f64, String)>
[::range < '50kellicam'] resolves through the
document’s .!units imports.