pub struct QueueManager {
sender: Sender<FileTask>,
shared_state: Arc<Mutex<AppState>>,
retry_list: Arc<Mutex<Vec<FileTask>>>,
pending_paths: Arc<Mutex<HashSet<String>>>,
retry_path: PathBuf,
policy: Arc<Mutex<EnvironmentPolicy>>,
worker_limit: Arc<AtomicUsize>,
batch_notify_state: Arc<Mutex<BatchNotifyState>>,
accepting_new: Arc<AtomicBool>,
shutdown_token: CancellationToken,
}Fields§
§sender: Sender<FileTask>Internal task sender channel.
Shared in-memory state accessed by both workers and the UI.
retry_list: Arc<Mutex<Vec<FileTask>>>Failed tasks accumulated in memory and flushed during graceful shutdown.
pending_paths: Arc<Mutex<HashSet<String>>>Paths already queued or awaiting retry to avoid duplication.
retry_path: PathBufPath of persistent retries file.
policy: Arc<Mutex<EnvironmentPolicy>>Shared current transmission limits and environmental constraints.
worker_limit: Arc<AtomicUsize>Active worker concurrency limit wrapper.
batch_notify_state: Arc<Mutex<BatchNotifyState>>Sync summary notification batch states tracker.
accepting_new: Arc<AtomicBool>Flag indicating whether new tasks are accepted.
shutdown_token: CancellationTokenInternal shutdown cancellation coordinator.
Implementations§
Source§impl QueueManager
impl QueueManager
Sourcepub fn new(
api_client: Arc<ImmichApiClient>,
workers: usize,
shared_state: Arc<Mutex<AppState>>,
sync_index: Arc<ShardedSyncIndex>,
policy: EnvironmentPolicy,
) -> Self
pub fn new( api_client: Arc<ImmichApiClient>, workers: usize, shared_state: Arc<Mutex<AppState>>, sync_index: Arc<ShardedSyncIndex>, policy: EnvironmentPolicy, ) -> Self
Initialize a new QueueManager and kick off worker threads.
Sourcepub async fn add_to_queue(&self, task: FileTask) -> bool
pub async fn add_to_queue(&self, task: FileTask) -> bool
Add a file task to the upload queue and return whether it was accepted.
pub fn set_paused(&self, paused: bool, reason: Option<String>)
pub fn is_paused(&self) -> bool
pub fn set_worker_limit(&self, workers: u8)
pub fn update_environment_policy(&self, policy: EnvironmentPolicy)
pub fn recent_events(&self) -> Vec<QueueEvent>
pub fn failed_tasks(&self) -> Vec<FileTask>
pub fn clear_failed(&self) -> usize
pub async fn retry_all_failed(&self) -> usize
pub async fn retry_failed_path(&self, path: &str) -> bool
Sourcepub async fn shutdown(&self, deadline: Duration)
pub async fn shutdown(&self, deadline: Duration)
Stop accepting new tasks, wait up to deadline for active uploads
to finish, then hard-cancel anything still in flight.
In-flight uploads that get cancelled at the deadline land in the retry
list (treated as failures) so flush_retries will persist them for the
next session.
Sourcepub fn flush_retries(&self)
pub fn flush_retries(&self)
Persist any in-memory retry items so they survive a clean shutdown.
Auto Trait Implementations§
impl !RefUnwindSafe for QueueManager
impl !UnwindSafe for QueueManager
impl Freeze for QueueManager
impl Send for QueueManager
impl Sync for QueueManager
impl Unpin for QueueManager
impl UnsafeUnpin for QueueManager
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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