Struct mz_storage::client::controller::hosts::StorageHosts
source · [−]pub struct StorageHosts<T> {
pub build_info: &'static BuildInfo,
orchestrator: Arc<dyn NamespacedOrchestrator>,
storaged_image: String,
hosts: HashMap<String, StorageHost<T>>,
objects: HashMap<GlobalId, String>,
}Expand description
Manages provisioning of storage hosts and assignment of storage objects to those hosts.
See the module documentation for details.
Fields
build_info: &'static BuildInfoThe build information for this process.
orchestrator: Arc<dyn NamespacedOrchestrator>An orchestrator to start and stop storage hosts.
storaged_image: StringThe storaged image to use when starting new storage hosts.
hosts: HashMap<String, StorageHost<T>>The known storage hosts, identified by network address.
objects: HashMap<GlobalId, String>The assignment of storage objects to storage hosts.
Implementations
sourceimpl<T> StorageHosts<T>
impl<T> StorageHosts<T>
sourcepub fn new(config: StorageHostsConfig) -> StorageHosts<T>
pub fn new(config: StorageHostsConfig) -> StorageHosts<T>
Constructs a new StorageHosts from its configuration.
sourcepub async fn provision(
&mut self,
id: GlobalId,
host_addr: Option<String>
) -> Result<&mut RehydratingStorageClient<T>, Error> where
T: Timestamp + Lattice,
StorageCommand<T>: RustType<ProtoStorageCommand>,
StorageResponse<T>: RustType<ProtoStorageResponse>,
pub async fn provision(
&mut self,
id: GlobalId,
host_addr: Option<String>
) -> Result<&mut RehydratingStorageClient<T>, Error> where
T: Timestamp + Lattice,
StorageCommand<T>: RustType<ProtoStorageCommand>,
StorageResponse<T>: RustType<ProtoStorageResponse>,
Provisions a storage host for the storage object with the specified ID.
If remote_addr is Some, then the specified storage host is used.
Otherwise, a storage host is assigned automatically.
At present, the policy for storage host assignment creates a new storage host for each storage object. This policy is subject to change.
Returns a client to the provisioned host. The client may be
retrieved in the future via the client
method.
Panics
Panics if id is already provisioned.
sourcepub async fn deprovision(&mut self, id: GlobalId) -> Result<(), Error>
pub async fn deprovision(&mut self, id: GlobalId) -> Result<(), Error>
Deprovisions the storage host for the storage object with the specified ID.
Panics
Panics if the provided id has not been provisioned.
sourcepub fn client(
&mut self,
id: GlobalId
) -> Option<&mut RehydratingStorageClient<T>>
pub fn client(
&mut self,
id: GlobalId
) -> Option<&mut RehydratingStorageClient<T>>
Retrives the client for the storage host for the given ID, if the ID is currently provisioned.
sourcepub fn clients(
&mut self
) -> impl Iterator<Item = &mut RehydratingStorageClient<T>>
pub fn clients(
&mut self
) -> impl Iterator<Item = &mut RehydratingStorageClient<T>>
Returns an iterator over clients for all known storage hosts.
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for StorageHosts<T>
impl<T> Send for StorageHosts<T> where
T: Send,
impl<T> Sync for StorageHosts<T> where
T: Send,
impl<T> Unpin for StorageHosts<T>
impl<T> !UnwindSafe for StorageHosts<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T in a tonic::Request
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<P, R> ProtoType<R> for P where
R: RustType<P>,
impl<P, R> ProtoType<R> for P where
R: RustType<P>,
sourcefn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See RustType::from_proto.
sourcefn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See RustType::into_proto.
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more