pub struct ApiRegistry { /* private fields */ }Expand description
High-performance API registry with indexes
Implementations§
Source§impl ApiRegistry
impl ApiRegistry
Sourcepub fn with_capacity(max: usize) -> Self
pub fn with_capacity(max: usize) -> Self
Create with capacity limit
Sourcepub fn register(
&self,
announcement: ApiAnnouncement,
) -> Result<(), RegistryError>
pub fn register( &self, announcement: ApiAnnouncement, ) -> Result<(), RegistryError>
Register or update a node’s APIs
Sourcepub fn unregister(&self, node_id: &NodeId) -> Option<Arc<ApiAnnouncement>>
pub fn unregister(&self, node_id: &NodeId) -> Option<Arc<ApiAnnouncement>>
Unregister a node
Sourcepub fn get(&self, node_id: &NodeId) -> Option<Arc<ApiAnnouncement>>
pub fn get(&self, node_id: &NodeId) -> Option<Arc<ApiAnnouncement>>
Get a node’s API announcement
Sourcepub fn query(&self, query: &ApiQuery) -> Vec<IndexedApiNode>
pub fn query(&self, query: &ApiQuery) -> Vec<IndexedApiNode>
Query for nodes matching criteria
Sourcepub fn find_by_endpoint(
&self,
path: &str,
method: ApiMethod,
) -> Vec<IndexedApiNode>
pub fn find_by_endpoint( &self, path: &str, method: ApiMethod, ) -> Vec<IndexedApiNode>
Find nodes that provide a specific API endpoint
Sourcepub fn find_compatible(
&self,
api_name: &str,
min_version: &ApiVersion,
) -> Vec<IndexedApiNode>
pub fn find_compatible( &self, api_name: &str, min_version: &ApiVersion, ) -> Vec<IndexedApiNode>
Find nodes with compatible API version
Sourcepub fn stats(&self) -> ApiRegistryStats
pub fn stats(&self) -> ApiRegistryStats
Get statistics
apis_by_name is read from the by_api_name inverted index (providers
per API name) rather than re-scanning every node’s schemas; empty index
buckets left by remove_from_indexes are skipped. total_nodes and
total_endpoints read O(1) counters. This avoids the O(nodes × schemas)
full scan (+ per-schema String clone) the old implementation paid on
every call.
Sourcepub fn cleanup_expired(&self) -> usize
pub fn cleanup_expired(&self) -> usize
Remove expired entries
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ApiRegistry
impl !RefUnwindSafe for ApiRegistry
impl Send for ApiRegistry
impl Sync for ApiRegistry
impl Unpin for ApiRegistry
impl UnsafeUnpin for ApiRegistry
impl UnwindSafe for ApiRegistry
Blanket Implementations§
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
Mutably borrows from an owned value. Read more