Skip to main content

SliceSet

Struct SliceSet 

Source
pub struct SliceSet { /* private fields */ }
Expand description

A set of registry slices, indexed by producer/service base name.

Implementations§

Source§

impl SliceSet

Source

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).

Source

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].

Source

pub fn service_list(&self, producer: Option<&str>) -> ServiceList

Source

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).

Source

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.

Source

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

Source

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.)

Source

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.

Source

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.

Source

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).

Source

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.

Source

pub fn slices(&self) -> &[RegistrySlice]

Source

pub fn get(&self, name: &str) -> Option<&RegistrySlice>

Source

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.

Source

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.

Source

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).

Source

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.

Source

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

Source

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

Source

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§

Source§

impl Clone for SliceSet

Source§

fn clone(&self) -> SliceSet

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 SliceSet

Source§

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

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

impl Default for SliceSet

Source§

fn default() -> SliceSet

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<Source> AccessAs for Source

Source§

fn ref_as<T>(&self) -> <Source as IGuardRef<T>>::Guard<'_>
where Source: IGuardRef<T>, T: ?Sized,

Provides immutable access to a type as if it were its ABI-unstable equivalent.
Source§

fn mut_as<T>(&mut self) -> <Source as IGuardMut<T>>::GuardMut<'_>
where Source: IGuardMut<T>, T: ?Sized,

Provides mutable access to a type as if it were its ABI-unstable equivalent.
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> AsNode<T> for T

Source§

fn as_node(&self) -> &T

Source§

impl<T> AsNodeMut<T> for T

Source§

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

Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, As> IGuardMut<As> for T
where T: Into<As>, As: Into<T>,

Source§

type GuardMut<'a> = MutAs<'a, T, As> where T: 'a

The type of the guard which will clean up the temporary after applying its changes to the original.
Source§

fn guard_mut_inner(&mut self) -> <T as IGuardMut<As>>::GuardMut<'_>

Construct the temporary and guard it through a mutable reference.
Source§

impl<T, As> IGuardRef<As> for T
where T: Into<As>, As: Into<T>,

Source§

type Guard<'a> = RefAs<'a, T, As> where T: 'a

The type of the guard which will clean up the temporary.
Source§

fn guard_ref_inner(&self) -> <T as IGuardRef<As>>::Guard<'_>

Construct the temporary and guard it through an immutable reference.
Source§

impl<T> Includes<End> for T

Source§

type Output = End

The result
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more