pub struct StorageManager { /* private fields */ }Expand description
Manages storage volumes for containers
Implementations§
Source§impl StorageManager
impl StorageManager
Sourcepub fn new(base_dir: impl AsRef<Path>) -> Result<Self>
pub fn new(base_dir: impl AsRef<Path>) -> Result<Self>
Create a new StorageManager with the given base directory
§Errors
Returns an error if the base directory cannot be created.
Sourcepub fn volume_dir(&self) -> &Path
pub fn volume_dir(&self) -> &Path
Get the base volume directory
Sourcepub fn create_anonymous(
&mut self,
container_id: &str,
target: &str,
) -> Result<PathBuf>
pub fn create_anonymous( &mut self, container_id: &str, target: &str, ) -> Result<PathBuf>
Create an anonymous volume for a container Returns the path to the volume directory
§Errors
Returns an error if the volume directory cannot be created.
Sourcepub fn cleanup_anonymous(&mut self, container_id: &str) -> Result<()>
pub fn cleanup_anonymous(&mut self, container_id: &str) -> Result<()>
Clean up all anonymous volumes for a container
§Errors
Returns an error if volume directories cannot be removed.
Sourcepub fn list_anonymous(&self, container_id: &str) -> Vec<&VolumeInfo>
pub fn list_anonymous(&self, container_id: &str) -> Vec<&VolumeInfo>
List anonymous volumes for a container
Sourcepub fn ensure_volume(&mut self, name: &str) -> Result<PathBuf>
pub fn ensure_volume(&mut self, name: &str) -> Result<PathBuf>
Ensure a named volume exists, creating it if necessary
§Errors
Returns an error if the volume name is invalid or the directory cannot be created.
Sourcepub async fn ensure_volume_with_sync(&mut self, name: &str) -> Result<PathBuf>
pub async fn ensure_volume_with_sync(&mut self, name: &str) -> Result<PathBuf>
Ensure a named volume exists, register it with layer sync, and restore from S3 if a backup exists.
This is the async counterpart to [ensure_volume] that integrates with
the S3 layer sync. When the s3 feature is not enabled or no layer sync
is configured, this behaves identically to [ensure_volume].
§Errors
Returns an error if the volume cannot be created or S3 restore fails.
Sourcepub fn detach_volume(&mut self, name: &str, container_id: &str) -> Result<()>
pub fn detach_volume(&mut self, name: &str, container_id: &str) -> Result<()>
Detach a container from a volume (untrack usage)
§Errors
This function currently always succeeds but returns Result for future compatibility.
Sourcepub fn delete_volume(&mut self, name: &str) -> Result<()>
pub fn delete_volume(&mut self, name: &str) -> Result<()>
Delete a volume if it’s not in use
§Errors
Returns an error if the volume is still in use or cannot be removed.
Sourcepub fn list_volumes(&self) -> Vec<&VolumeInfo>
pub fn list_volumes(&self) -> Vec<&VolumeInfo>
List all tracked volumes
Sourcepub fn get_volume(&self, name: &str) -> Option<&VolumeInfo>
pub fn get_volume(&self, name: &str) -> Option<&VolumeInfo>
Get info for a specific volume
Sourcepub fn mount_s3(
&mut self,
bucket: &str,
prefix: Option<&str>,
endpoint: Option<&str>,
container_id: &str,
) -> Result<PathBuf>
pub fn mount_s3( &mut self, bucket: &str, prefix: Option<&str>, endpoint: Option<&str>, container_id: &str, ) -> Result<PathBuf>
Mount an S3 bucket via s3fs FUSE
Requires s3fs-fuse to be installed on the system. Credentials should be configured via environment or ~/.aws/credentials
§Errors
Returns an error if the S3 mount point cannot be created or the s3fs command fails.
Sourcepub fn unmount_s3(
&mut self,
bucket: &str,
prefix: Option<&str>,
container_id: &str,
) -> Result<()>
pub fn unmount_s3( &mut self, bucket: &str, prefix: Option<&str>, container_id: &str, ) -> Result<()>
Sourcepub fn list_s3_mounts(&self) -> Vec<&S3MountInfo>
pub fn list_s3_mounts(&self) -> Vec<&S3MountInfo>
List all S3 mounts
Sourcepub fn get_s3_mount(
&self,
bucket: &str,
prefix: Option<&str>,
) -> Option<&S3MountInfo>
pub fn get_s3_mount( &self, bucket: &str, prefix: Option<&str>, ) -> Option<&S3MountInfo>
Get S3 mount info
Auto Trait Implementations§
impl Freeze for StorageManager
impl RefUnwindSafe for StorageManager
impl Send for StorageManager
impl Sync for StorageManager
impl Unpin for StorageManager
impl UnsafeUnpin for StorageManager
impl UnwindSafe for StorageManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> 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::RequestSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn propagate_header(self, header: HeaderName) -> PropagateHeader<Self>where
Self: Sized,
fn propagate_header(self, header: HeaderName) -> PropagateHeader<Self>where
Self: Sized,
Source§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
Source§fn map_request_body<F>(self, f: F) -> MapRequestBody<Self, F>where
Self: Sized,
fn map_request_body<F>(self, f: F) -> MapRequestBody<Self, F>where
Self: Sized,
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Source§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Source§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
Source§fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
Source§fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
Source§fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
Source§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
Source§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
x-request-id as the header name. Read moreSource§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
Source§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
x-request-id as the header name. Read moreSource§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read moreSource§fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
413 Payload Too Large responses. Read more