pub struct P2pStateManager { /* private fields */ }Expand description
State manager that handles P2P metadata operations.
Wraps the metadata backend abstraction and provides a simpler API for
common operations. Configure via MX_METADATA_BACKEND env var.
Implementations§
Source§impl P2pStateManager
impl P2pStateManager
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new state manager, resolving backend config from the environment.
Configure via MX_METADATA_BACKEND (required) and REDIS_URL /
MX_REDIS_HOST / MX_REDIS_PORT (for Redis).
Sourcepub fn with_config(config: BackendConfig) -> Self
pub fn with_config(config: BackendConfig) -> Self
Create a new state manager with an explicit backend configuration.
Sourcepub async fn connect(&self) -> MetadataResult<String>
pub async fn connect(&self) -> MetadataResult<String>
Initialize the backend connection. Returns the backend type name on success.
Sourcepub async fn publish_metadata(
&self,
identity: &SourceIdentity,
worker_id: &str,
worker: WorkerMetadata,
) -> MetadataResult<()>
pub async fn publish_metadata( &self, identity: &SourceIdentity, worker_id: &str, worker: WorkerMetadata, ) -> MetadataResult<()>
Publish metadata for a source instance.
Sourcepub async fn get_metadata(
&self,
source_id: &str,
worker_id: &str,
) -> MetadataResult<Option<ModelMetadataRecord>>
pub async fn get_metadata( &self, source_id: &str, worker_id: &str, ) -> MetadataResult<Option<ModelMetadataRecord>>
Get full tensor metadata for one specific instance.
Sourcepub async fn list_workers(
&self,
source_id: Option<String>,
status_filter: Option<SourceStatus>,
) -> MetadataResult<Vec<SourceInstanceInfo>>
pub async fn list_workers( &self, source_id: Option<String>, status_filter: Option<SourceStatus>, ) -> MetadataResult<Vec<SourceInstanceInfo>>
List available source instances, optionally filtered by status.
Sourcepub async fn remove_metadata(&self, source_id: &str) -> MetadataResult<()>
pub async fn remove_metadata(&self, source_id: &str) -> MetadataResult<()>
Remove metadata by mx_source_id.
Sourcepub async fn remove_worker(
&self,
source_id: &str,
worker_id: &str,
) -> MetadataResult<()>
pub async fn remove_worker( &self, source_id: &str, worker_id: &str, ) -> MetadataResult<()>
Remove a single worker by source_id and worker_id.
Sourcepub async fn list_sources(&self) -> MetadataResult<Vec<(String, String)>>
pub async fn list_sources(&self) -> MetadataResult<Vec<(String, String)>>
List all registered source IDs and model names.
Sourcepub async fn update_worker_status(
&self,
source_id: &str,
worker_id: &str,
worker_rank: u32,
status: SourceStatus,
) -> MetadataResult<()>
pub async fn update_worker_status( &self, source_id: &str, worker_id: &str, worker_rank: u32, status: SourceStatus, ) -> MetadataResult<()>
Update the status of a worker within its stored metadata record.
Trait Implementations§
Source§impl Clone for P2pStateManager
impl Clone for P2pStateManager
Source§fn clone(&self) -> P2pStateManager
fn clone(&self) -> P2pStateManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for P2pStateManager
impl !RefUnwindSafe for P2pStateManager
impl Send for P2pStateManager
impl Sync for P2pStateManager
impl Unpin for P2pStateManager
impl UnsafeUnpin for P2pStateManager
impl !UnwindSafe for P2pStateManager
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
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 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>
T in a tonic::Request