pub struct Index {
pub repository: RepositoryInfo,
pub objects: Vec<Object>,
pub diagnostics: Vec<Diagnostic>,
pub state: State,
pub fingerprint: String,
pub scoped: Scoped,
pub distribution: Option<Model>,
pub providers: ProviderDeclarations,
pub share: Option<PathBuf>,
}Expand description
The objects of the repository, their diagnostics, and the repository they came from.
Fields§
§repository: RepositoryInfoThe repository the index was built from.
objects: Vec<Object>Sorted by URI; unique by URI.
diagnostics: Vec<Diagnostic>Every finding, in discovery order.
state: StateOk, or degraded when a diagnostic is an error.
fingerprint: StringA hash of every object’s path and content, in URI order: the repository state this index is a picture of, stable across processes.
scoped: ScopedThe scope the index was built under, with every tracked file tallied against it.
distribution: Option<Model>The distribution model the tool was run with, when it carries one: how this project is packaged, published and installed. Read from the tool’s data directory beside the kinds and the schemas, not discovered in the repository, so that an installed copy answers the same questions a checkout does.
providers: ProviderDeclarationsThe providers the tool distribution ships an adapter for: one per template under
share/providers/, joined with what share/providers.yaml declares about it. Read
from the tool’s data directory beside the kinds and the schemas, like the
distribution model, so that the product model can say which providers exist without
a second discovery.
The distribution directory this process located, absolute, when one was located.
The share is a fact about the invocation, not about the repository: it is what
--share, MAJORDOMUS_SHARE, the repository or the installation resolved to, and
crate::app::App records it here so that a handler needing a file beside the
kinds — the obligation vocabulary, the shell tool’s command registry — reads the
distribution this process was run with instead of resolving one of its own. A
handler that resolved its own would answer from a different distribution than the
one whose kinds it was configured with, and, for an executable that lives outside
the repository, from none at all. None for an index built directly, which is what
makes the resolution fall back to the conventions.
Implementations§
Source§impl Index
impl Index
Sourcepub fn build(
repo: &Repository,
sources: &Sources,
schema: &KindSchema,
source: &dyn DiscoverySource,
git: GitState,
scope: Scope,
) -> Result<Self, Error>
pub fn build( repo: &Repository, sources: &Sources, schema: &KindSchema, source: &dyn DiscoverySource, git: GitState, scope: Scope, ) -> Result<Self, Error>
Discover, read, validate. source decides how files are enumerated; git is
whatever git::inspect said and is carried, never consulted here.