pub struct SolutionRegistry<C: Connection> { /* private fields */ }Expand description
Registry for dynamically created solution handles.
Implementations§
Source§impl<C: Connection> SolutionRegistry<C>
impl<C: Connection> SolutionRegistry<C>
pub fn new(config: SolutionRegistryConfig<C>) -> Self
Sourcepub async fn get_or_init(
&self,
solution: &str,
) -> Result<Arc<SolutionHandle<C>>, RegistryError>
pub async fn get_or_init( &self, solution: &str, ) -> Result<Arc<SolutionHandle<C>>, RegistryError>
Gets the solution handle or builds it once if missing.
If the handle has been idle longer than health_check_after, a ping is
issued. On failure the stale handle is evicted and rebuilt.
§Errors
Returns RegistryError if capacity is exceeded or the build fails.
Sourcepub async fn list_solutions(&self) -> Vec<String>
pub async fn list_solutions(&self) -> Vec<String>
Lists known solutions by merging the in-memory cache with a live DB
discovery query (INFO FOR NS).
When a discover_solutions function is configured it is called first;
otherwise any live cached handle is used for the namespace query. If
neither is available the result falls back to the cache alone.
Sourcepub async fn remove_solution(&self, solution: &str) -> bool
pub async fn remove_solution(&self, solution: &str) -> bool
Removes a cached solution handle entry.
Sourcepub async fn evict_idle(&self) -> usize
pub async fn evict_idle(&self) -> usize
Evicts idle entries that exceed the configured TTL.
Sourcepub fn spawn_sweeper(self) -> Option<JoinHandle<()>>
pub fn spawn_sweeper(self) -> Option<JoinHandle<()>>
Spawns a background task to evict idle entries on a schedule.
Trait Implementations§
Source§impl<C: Clone + Connection> Clone for SolutionRegistry<C>
impl<C: Clone + Connection> Clone for SolutionRegistry<C>
Source§fn clone(&self) -> SolutionRegistry<C>
fn clone(&self) -> SolutionRegistry<C>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<C> Freeze for SolutionRegistry<C>
impl<C> !RefUnwindSafe for SolutionRegistry<C>
impl<C> Send for SolutionRegistry<C>
impl<C> Sync for SolutionRegistry<C>
impl<C> Unpin for SolutionRegistry<C>
impl<C> UnsafeUnpin for SolutionRegistry<C>
impl<C> !UnwindSafe for SolutionRegistry<C>
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
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>
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 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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request