pub struct LayerSyncManager { /* private fields */ }Expand description
Manages layer synchronization between local storage and S3
Implementations§
Source§impl LayerSyncManager
impl LayerSyncManager
Sourcepub async fn new(config: LayerStorageConfig) -> Result<Self>
pub async fn new(config: LayerStorageConfig) -> Result<Self>
Create a new sync manager
§Errors
Returns an error if directories cannot be created, the database cannot be opened, or the AWS SDK fails to initialize.
Sourcepub async fn register_container(
&self,
container_id: ContainerLayerId,
) -> Result<()>
pub async fn register_container( &self, container_id: ContainerLayerId, ) -> Result<()>
Register a container for layer sync tracking
§Errors
Returns an error if persisting the sync state to the database fails.
Sourcepub async fn check_for_changes(
&self,
container_id: &ContainerLayerId,
upper_layer_path: impl AsRef<Path>,
) -> Result<bool>
pub async fn check_for_changes( &self, container_id: &ContainerLayerId, upper_layer_path: impl AsRef<Path>, ) -> Result<bool>
Check if a container’s layer has changed and needs sync
§Errors
Returns an error if the container is not registered or if calculating the directory digest fails.
Sourcepub async fn sync_layer(
&self,
container_id: &ContainerLayerId,
upper_layer_path: impl AsRef<Path>,
) -> Result<Option<LayerSnapshot>>
pub async fn sync_layer( &self, container_id: &ContainerLayerId, upper_layer_path: impl AsRef<Path>, ) -> Result<Option<LayerSnapshot>>
Create a snapshot and upload it to S3
§Errors
Returns an error if snapshot creation, S3 upload, or state persistence fails.
Sourcepub async fn restore_layer(
&self,
container_id: &ContainerLayerId,
target_path: impl AsRef<Path>,
) -> Result<LayerSnapshot>
pub async fn restore_layer( &self, container_id: &ContainerLayerId, target_path: impl AsRef<Path>, ) -> Result<LayerSnapshot>
Download and restore a layer from S3
§Errors
Returns an error if the remote layer is not found, download fails, digest verification fails, or extraction fails.
Sourcepub async fn list_containers(&self) -> Vec<ContainerLayerId>
pub async fn list_containers(&self) -> Vec<ContainerLayerId>
List all containers with sync state
Sourcepub async fn get_sync_state(
&self,
container_id: &ContainerLayerId,
) -> Option<SyncState>
pub async fn get_sync_state( &self, container_id: &ContainerLayerId, ) -> Option<SyncState>
Get sync state for a container
Auto Trait Implementations§
impl Freeze for LayerSyncManager
impl !RefUnwindSafe for LayerSyncManager
impl Send for LayerSyncManager
impl Sync for LayerSyncManager
impl Unpin for LayerSyncManager
impl UnsafeUnpin for LayerSyncManager
impl !UnwindSafe for LayerSyncManager
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> 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 more