pub struct FoldQueryClient { /* private fields */ }Expand description
Typed fold.query client. Cheap to clone (just clones the
Arcs); operator tooling typically constructs one per
process and shares it.
Implementations§
Source§impl FoldQueryClient
impl FoldQueryClient
Sourcepub fn new(mesh: Arc<MeshNode>) -> Self
pub fn new(mesh: Arc<MeshNode>) -> Self
Build a client backed by mesh with the default TTL +
deadline. Callers wanting non-defaults use
Self::with_ttl / Self::with_deadline.
Sourcepub fn with_ttl(self, ttl: Duration) -> Self
pub fn with_ttl(self, ttl: Duration) -> Self
Override the cache TTL. Duration::ZERO disables the
cache entirely (every call hits the wire).
Sourcepub fn with_deadline(self, deadline: Duration) -> Self
pub fn with_deadline(self, deadline: Duration) -> Self
Override the per-call deadline.
Sourcepub fn set_ttl_mut(&mut self, ttl: Duration)
pub fn set_ttl_mut(&mut self, ttl: Duration)
Override the cache TTL in place. Used by the FFI wrapper
so adjusting TTL doesn’t drop the warmed cache (a fresh
with_ttl(self) would clone all Arcs except the cache
is held by &mut self — the in-place mutation preserves
the inner Arc<RwLock<HashMap<...>>>).
Sourcepub fn set_deadline_mut(&mut self, deadline: Duration)
pub fn set_deadline_mut(&mut self, deadline: Duration)
Override the per-call deadline in place. Same rationale as
Self::set_ttl_mut — preserves the cache state across
FFI-side deadline adjustments.
Sourcepub async fn query_latest(
&self,
target_node_id: u64,
kind: u16,
) -> Result<Vec<SummaryAnnouncement>, FoldQueryClientError>
pub async fn query_latest( &self, target_node_id: u64, kind: u16, ) -> Result<Vec<SummaryAnnouncement>, FoldQueryClientError>
Query the aggregator for its latest cached summaries. Cache hit → return immediately; miss → issue RPC, cache the result, return.
target_node_id is the aggregator replica to query;
operator tooling typically finds it via the capability
index (role:aggregator tag) or the existing
MeshNode::find_* helpers.
Sourcepub async fn query_with_service(
&self,
target_node_id: u64,
service: &str,
kind: u16,
) -> Result<Vec<SummaryAnnouncement>, FoldQueryClientError>
pub async fn query_with_service( &self, target_node_id: u64, service: &str, kind: u16, ) -> Result<Vec<SummaryAnnouncement>, FoldQueryClientError>
Same as Self::query_latest but with a caller-supplied
service name. Useful when a node runs multiple
aggregators registered under distinct service names.
Sourcepub async fn query_summarize_now(
&self,
target_node_id: u64,
kind: u16,
) -> Result<Vec<SummaryAnnouncement>, FoldQueryClientError>
pub async fn query_summarize_now( &self, target_node_id: u64, kind: u16, ) -> Result<Vec<SummaryAnnouncement>, FoldQueryClientError>
Issue a SummarizeNow query — never cached; always
hits the wire. Use when the staleness tolerance is
tighter than summary_interval.
Sourcepub fn invalidate_cache(&self)
pub fn invalidate_cache(&self)
Drop every cached entry. Operator tooling calls this after a topology change (e.g. a placement migration) so the next query re-resolves against the new aggregator replica.
Sourcepub fn invalidate_target(&self, target_node_id: u64)
pub fn invalidate_target(&self, target_node_id: u64)
Drop just the entries matching target_node_id. Used when
a single replica is known stale but the rest of the cache
is still warm.
Trait Implementations§
Source§impl Clone for FoldQueryClient
impl Clone for FoldQueryClient
Source§fn clone(&self) -> FoldQueryClient
fn clone(&self) -> FoldQueryClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more