pub struct SliceSet { /* private fields */ }Expand description
A set of registry slices, indexed by producer/service base name.
Implementations§
Source§impl SliceSet
impl SliceSet
Sourcepub fn topic_list(
&self,
producer: Option<&str>,
class: Option<Class>,
type_name: Option<&str>,
deprecated: bool,
) -> Result<TopicList>
pub fn topic_list( &self, producer: Option<&str>, class: Option<Class>, type_name: Option<&str>, deprecated: bool, ) -> Result<TopicList>
topic list — every registered subject in the given slices.
Declared, not observed. A pattern with a trailing rest-variable
({path...}) stands for a whole family whose real members only exist on the
wire: proxy producers register {device}/{path...} by design, because
their metric tree belongs to the polled device, not to us. For those, this
command can only tell you the shape. zenctl echo is what tells you
the members.
class is a Class, so there is no validation here and no error
to return for one: a caller that has a Class has already parsed it,
at whatever edge it came in from. This function used to re-check a
&str against its own copy of the vocabulary, with its own copy of
the sentence (#351).
Sourcepub fn topic_info(&self, base: &str, key: &str) -> TopicInfo
pub fn topic_info(&self, base: &str, key: &str) -> TopicInfo
topic info — refine one concrete wire key against the registry slices.
This is the slice-level parse direction (RFC 08 §1): the key is parsed
structurally (grammar only), then its subject tail is matched against
the producer’s slice, binding variables by name — which is why the output
can say mount=root rather than parts[6].
pub fn service_list(&self, producer: Option<&str>) -> ServiceList
Sourcepub fn service_info(
&self,
producer: &str,
path: Option<&str>,
) -> Result<ServiceInfo>
pub fn service_info( &self, producer: &str, path: Option<&str>, ) -> Result<ServiceInfo>
service info — one producer’s @rpc surface, with call keys.
Err when nothing declares the producer, listing what does: a name
that answers nowhere is a typo far more often than a silent fleet, and
the alternative — an empty procedure list — reads as “this producer
offers nothing”, which is a verdict this cannot support (O4).
Sourcepub fn interface_list(&self) -> InterfaceList
pub fn interface_list(&self) -> InterfaceList
interface list — every payload type the slices declare, with carrier
counts. Field-level schema is deliberately absent: type definitions stay
with the owning application (RFC 08 §5), so this maps the vocabulary, not
the shapes.
Sourcepub fn interface_show(&self, type_name: &str) -> Result<InterfaceShow>
pub fn interface_show(&self, type_name: &str) -> Result<InterfaceShow>
interface show — one payload type, and every subject/procedure that
carries it (the reverse of the registry’s binding).
Source§impl SliceSet
impl SliceSet
Sourcepub fn from_dirs(dirs: &[PathBuf]) -> Result<SliceSet>
pub fn from_dirs(dirs: &[PathBuf]) -> Result<SliceSet>
Load from local registry/*.toml dirs — the offline source. What a
checked-out application declares. (types.toml is the type table,
not a slice — skipped.)
Sourcepub async fn from_bus(fleet: &Fleet<'_>, timeout: Duration) -> Result<SliceSet>
pub async fn from_bus(fleet: &Fleet<'_>, timeout: Duration) -> Result<SliceSet>
Discover every live producer’s served slice from the bus
(crate::fleet_registry_by_origin), collapsed to one slice per
producer.
The collapse is recorded rather than silent — see
collapsed. A caller whose question is which
host should not come here at all: go one layer down to
crate::fleet_registry_by_origin, which does not deduplicate.
Sourcepub fn from_served(served: Vec<ServedSlice>) -> SliceSet
pub fn from_served(served: Vec<ServedSlice>) -> SliceSet
Fold an origin-attributed sweep into one slice per producer, keeping a receipt of what the fold discarded (#385).
Pure, so the collapse is testable without a bus — and separable, so a caller that ran its own sweep can reuse the fold without re-querying.
Sourcepub fn collapsed(&self) -> Asked<&[CollapsedProducer]>
pub fn collapsed(&self) -> Asked<&[CollapsedProducer]>
Producers this set folded more than one origin’s answer into, and whether those origins agreed (#385).
Three-state on purpose (#399). NotAsked is a set built from files or
from bare slices: neither carries an origin, so nothing could be
collapsed and no question was put. Asked(&[]) is a bus sweep in
which every producer had exactly one origin answer — the fleet agrees,
and it agrees because it was asked. A bare empty slice conflated the
two, which is the O4 failure this receipt exists to avoid
(RFC 13 §3 O4).
Sourcepub fn entries(&self) -> impl Iterator<Item = (&RegistrySlice, &str)>
pub fn entries(&self) -> impl Iterator<Item = (&RegistrySlice, &str)>
Each slice with the raw TOML it was parsed from — the pair
write_cache persists. The text is empty for a set built by
from_slices, which has none to give.
pub fn slices(&self) -> &[RegistrySlice]
pub fn get(&self, name: &str) -> Option<&RegistrySlice>
Sourcepub fn by_service_origin(&self, origin: &str) -> Option<&RegistrySlice>
pub fn by_service_origin(&self, origin: &str) -> Option<&RegistrySlice>
The slice declaring a service origin (@catalog) — service keys have
no producer chunk, so refinement resolves through this.
Sourcepub fn refine<'s>(
&'s self,
producer: &str,
class: &str,
tail: &[&str],
) -> Option<(&'s SubjectDecl, Vec<(String, String)>)>
pub fn refine<'s>( &'s self, producer: &str, class: &str, tail: &[&str], ) -> Option<(&'s SubjectDecl, Vec<(String, String)>)>
Refine a subject tail against one producer’s slice: the matching subject declaration plus its named variable bindings.
Sourcepub fn from_slices(slices: Vec<RegistrySlice>) -> SliceSet
pub fn from_slices(slices: Vec<RegistrySlice>) -> SliceSet
Build from already-parsed slices (no raw TOML retained — such a set
is skipped by write_cache).
Sourcepub fn write_cache(&self, dir: &Path) -> Result<()>
pub fn write_cache(&self, dir: &Path) -> Result<()>
Write the raw slice TOMLs to a cache dir (one file per producer). Repeated invocations and dynamic shell completion read this instead of round-tripping the bus.
Sourcepub fn read_cache(dir: &Path) -> SliceSet
pub fn read_cache(dir: &Path) -> SliceSet
Read a previously written cache dir. Same forgiving posture as
from_dirs, but a missing dir is an empty set, not an error.
Source§impl SliceSet
impl SliceSet
Sourcepub async fn from_union(
fleet: &Fleet<'_>,
dirs: &[PathBuf],
timeout: Duration,
) -> Result<UnionOutcome>
pub async fn from_union( fleet: &Fleet<'_>, dirs: &[PathBuf], timeout: Duration, ) -> Result<UnionOutcome>
Load the union of the live bus and local dirs: served wins per
producer, dirs fill the gaps, and every producer where the two
disagree is retained as a SliceDisagreement.
Degrades honestly: an unreachable bus yields a dirs-only union (the
outcome’s from_bus is empty — the caller can see which case it got).
Source§impl SliceSet
impl SliceSet
Sourcepub fn diff(&self, local: &SliceSet) -> RegistryDiff
pub fn diff(&self, local: &SliceSet) -> RegistryDiff
Compare this set — what the fleet serves — against what a checkout declares, per producer.
Pure, so the comparison is testable without a bus, and engine-side so
both explorers can make it (issue #208). The per-producer comparison
is already zenkey::slice::diff; this is the set-level join that
decides what to do about a producer only one side knows.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SliceSet
impl RefUnwindSafe for SliceSet
impl Send for SliceSet
impl Sync for SliceSet
impl Unpin for SliceSet
impl UnsafeUnpin for SliceSet
impl UnwindSafe for SliceSet
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more