Compare commits

..
Author SHA1 Message Date
nvrl 8dd0c6f424 refactor(sync,fuse,core): move the mirror engine into pdfs-sync
sync.rs and sync/{engine,host,local_scan}.rs become pdfs_sync::mirror.
The engine already ran on a Syncer and reached the daemon only through
SyncHost; the last two links go through it too: upload thumbnails are a
SyncHost call, and the event poll interval is pdfs_sync's constant. The
transfer registry and the shutdown signal, which both sides use, move to
pdfs-core. pdfs-fuse keeps a small sync module: Core's SyncHost impl and
a re-export of the engine.

No behaviour change. pdfs-sync depends on no FUSE or GTK crate.
2026-11-26 09:40:37 +01:00
15 changed files with 4673 additions and 4632 deletions

No files matched your search

Generated
+4
View File
@@ -3776,10 +3776,14 @@ dependencies = [
name = "pdfs-sync"
version = "3.10.0"
dependencies = [
"notify",
"parking_lot 0.13.0",
"pdfs-core",
"pdfs-drive",
"pdfs-store",
"proton-drive-rs",
"sha1 0.11.0",
"tokio",
"tracing",
]
+2
View File
@@ -22,9 +22,11 @@ pub mod sdkcache;
pub mod search;
pub mod service;
pub mod shell;
pub mod shutdown;
pub mod syncignore;
pub mod syncroot;
pub mod timestamp;
pub mod transfers;
pub mod tray;
pub mod update;
@@ -21,7 +21,7 @@ use parking_lot::{Condvar, Mutex};
/// The daemon's stop signal. Set once, never cleared: a `Core` that has been
/// told to stop belongs to a mount that is going away.
#[derive(Default)]
pub(crate) struct Shutdown {
pub struct Shutdown {
stopping: Mutex<bool>,
changed: Condvar,
}
@@ -29,14 +29,14 @@ pub(crate) struct Shutdown {
impl Shutdown {
/// Whether teardown has begun. Loops check this where they would otherwise
/// start another unit of work.
pub(crate) fn is_stopping(&self) -> bool {
pub fn is_stopping(&self) -> bool {
*self.stopping.lock()
}
/// Begin teardown and wake everything waiting in [`sleep`](Self::sleep).
/// Idempotent, because more than one path can reach teardown (a signal, the
/// kernel mount ending, a failed startup).
pub(crate) fn stop(&self) {
pub fn stop(&self) {
let mut stopping = self.stopping.lock();
*stopping = true;
self.changed.notify_all();
@@ -47,7 +47,7 @@ impl Shutdown {
/// Returns `false` if the daemon is stopping — including when it was already
/// stopping on entry, so `while shutdown.sleep(interval)` is a complete and
/// correct loop condition and no separate check is needed at the top.
pub(crate) fn sleep(&self, duration: Duration) -> bool {
pub fn sleep(&self, duration: Duration) -> bool {
let mut stopping = self.stopping.lock();
if !*stopping {
self.changed.wait_for(&mut stopping, duration);
@@ -17,7 +17,7 @@
//! transfer moves is charged to its direction's [`RateLimit`], and the thread
//! moving it sleeps off whatever the charge puts it over the cap.
//!
//! [`Request::GetQueueStatus`]: pdfs_core::control::Request::GetQueueStatus
//! [`Request::GetQueueStatus`]: crate::control::Request::GetQueueStatus
use parking_lot::Mutex;
use std::collections::HashMap;
@@ -26,7 +26,7 @@ use std::sync::Arc;
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use std::time::{Duration, Instant};
use pdfs_core::control::{JobItem, TransferDirection, TransferItem};
use crate::control::{JobItem, TransferDirection, TransferItem};
/// One registered transfer. `done` is bumped from the I/O wrapper without the
/// registry lock; the rest is immutable for the transfer's lifetime.
@@ -198,7 +198,7 @@ impl TransferRegistry {
/// Snapshot every in-flight job for [`Response::Transfers`], oldest first, so
/// a front-end's rows keep their order across polls.
///
/// [`Response::Transfers`]: pdfs_core::control::Response::Transfers
/// [`Response::Transfers`]: crate::control::Response::Transfers
pub fn jobs_snapshot(&self) -> Vec<JobItem> {
let map = self.jobs.lock();
let mut ids: Vec<_> = map.keys().copied().collect();
@@ -222,7 +222,7 @@ impl TransferRegistry {
/// running average since the transfer began — simple, and stable enough for a
/// progress widget without per-tick sampling state.
///
/// [`Response::Transfers`]: pdfs_core::control::Response::Transfers
/// [`Response::Transfers`]: crate::control::Response::Transfers
pub fn snapshot(&self) -> Vec<TransferItem> {
let map = self.inner.lock();
let mut ids: Vec<_> = map.keys().copied().collect();
+3 -3
View File
@@ -115,7 +115,7 @@ mod redate;
mod relocate;
mod revisions;
mod sharing;
mod shutdown;
use pdfs_core::shutdown;
#[cfg(test)]
mod sim;
mod state;
@@ -124,7 +124,7 @@ mod sweep;
mod sync;
mod systemd;
mod takeout;
mod transfers;
use pdfs_core::transfers;
mod upload;
mod r#virtual;
mod workers;
@@ -177,7 +177,7 @@ const MAX_BACKGROUND: u16 = 64;
const MAX_NAME_LEN: u32 = 255;
/// How often the background task polls the remote event cursor.
const POLL_INTERVAL: Duration = Duration::from_secs(10);
const POLL_INTERVAL: Duration = pdfs_sync::EVENT_POLL_INTERVAL;
/// Retry backoff for a queued upload, doubling per attempt between these. The
/// floor is short because the common failure is a brief network blip; the
/// ceiling keeps a persistently failing op from spinning.
+4 -14
View File
@@ -1157,7 +1157,10 @@ impl Core {
path: PathBuf,
name: String,
) -> Vec<Thumbnail> {
thumbnails_for_upload(&self.cache, path, name).await
let staging_dir = self.cache.raw_thumbnail_staging_dir().to_path_buf();
tokio::task::spawn_blocking(move || upload_thumbnails(&path, &name, &staging_dir))
.await
.unwrap_or_default()
}
#[allow(clippy::too_many_arguments)]
@@ -3642,16 +3645,3 @@ mod thumb_tests {
}
}
}
/// The thumbnails to upload with the file at `path`, made off the async
/// runtime. Empty when the file is not an image or a video.
pub(crate) async fn thumbnails_for_upload(
cache: &pdfs_store::cache::ContentCache,
path: PathBuf,
name: String,
) -> Vec<Thumbnail> {
let staging_dir = cache.raw_thumbnail_staging_dir().to_path_buf();
tokio::task::spawn_blocking(move || upload_thumbnails(&path, &name, &staging_dir))
.await
.unwrap_or_default()
}
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -45,7 +45,7 @@ use proton_drive_rs::{PhotoLocation, PhotoTag, PhotoTagsUpdate, PhotoUploadMetad
use serde::{Deserialize, Serialize};
use tracing::{info, warn};
pub(crate) use pdfs_drive::digest::{hex_lower, sha1_of};
pub(crate) use pdfs_drive::digest::sha1_of;
use super::Core;
use crate::photos::can_make_thumbnail;
+4
View File
@@ -15,3 +15,7 @@ pdfs-drive.workspace = true
pdfs-store.workspace = true
proton-drive-rs.workspace = true
tracing.workspace = true
notify = "8"
parking_lot.workspace = true
sha1.workspace = true
tokio.workspace = true
+14 -5
View File
@@ -1,9 +1,13 @@
//! The mirror engine's decisions, apart from the I/O that feeds and applies them.
//! The mirror engine: two-way sync between a local folder and a folder on Drive.
//!
//! [`model`] is what a pass knows about each path, [`planner`] decides what to
//! do with it and refuses what looks like a wipe, [`trace`] records where a pass
//! spent its time, and [`naming`] names conflict copies. None of it touches the
//! disk, the database or Drive, so all of it is tested without a daemon.
//! [`mirror`] runs the passes. It walks both sides, applies the plan and runs
//! the engine thread; it owns its state and reaches the rest of the daemon only
//! through [`mirror::SyncHost`]. The rest is the engine's decisions, apart from
//! the I/O that feeds and applies them: [`model`] is what a pass knows about
//! each path, [`planner`] decides what to do with it and refuses what looks
//! like a wipe, [`trace`] records where a pass spent its time, and [`naming`]
//! names conflict copies. None of those touch the disk, the database or Drive,
//! so they are tested without a daemon.
use std::collections::{HashMap, HashSet};
use std::path::{Path, PathBuf};
@@ -15,6 +19,7 @@ use pdfs_store::db::StoredSyncEntry;
use proton_drive_rs::proton_sdk::ids::NodeUid;
use proton_drive_rs::{Node, NodeKind};
pub mod mirror;
pub mod model;
pub mod naming;
pub mod planner;
@@ -22,3 +27,7 @@ pub mod trace;
use model::{LocalItem, LocalSig, RemoteItem};
use trace::Call;
/// How often the daemon reads the Drive event feed. A pass trusts the feed's
/// list of changed folders only while reads keep coming at about this pace.
pub const EVENT_POLL_INTERVAL: std::time::Duration = std::time::Duration::from_secs(10);
File diff suppressed because it is too large. Load diff
@@ -31,13 +31,13 @@ const POLL_INTERVAL: Duration = Duration::from_secs(120);
/// per-item work is a network round-trip, so a folder with thousands of files is
/// unusable done one-at-a-time; this bounds concurrency like the bulk-upload
/// engine does.
pub(crate) const SYNC_CONCURRENCY: usize = 8;
pub const SYNC_CONCURRENCY: usize = 8;
/// How long after a failed watch the engine tries the watches again. Each try
/// walks the folder's whole tree, so not on every burst.
const REWATCH_RETRY: Duration = Duration::from_secs(600);
/// A message to the sync engine's control thread.
pub(crate) enum SyncMsg {
pub enum SyncMsg {
/// Reconcile one folder by id (a local change, or a targeted `SyncNow`).
Reconcile(i64),
/// Reconcile every mirror folder (periodic poll, or startup).
@@ -52,7 +52,7 @@ pub(crate) enum SyncMsg {
/// Start the sync engine: a control thread that owns the filesystem watcher and
/// serialises reconcile passes, plus a periodic poll thread. The engine receives
/// on `rx`; senders live in [`SyncParts::tx`].
pub(crate) fn spawn(core: Syncer, rx: Receiver<SyncMsg>) -> Option<std::thread::JoinHandle<()>> {
pub fn spawn(core: Syncer, rx: Receiver<SyncMsg>) -> Option<std::thread::JoinHandle<()>> {
match std::thread::Builder::new()
.name("pdfs-sync".into())
.spawn(move || engine_loop(core, rx))
@@ -72,7 +72,7 @@ pub(crate) fn spawn(core: Syncer, rx: Receiver<SyncMsg>) -> Option<std::thread::
/// file event and poll then went into a channel nobody read, the folder stayed
/// `syncing`, and nothing said so until a restart (`docs/BUGS.md` B259).
#[derive(Default)]
pub(crate) struct EngineHealth {
pub struct EngineHealth {
running: AtomicBool,
pass: Mutex<Option<PassClock>>,
panics: AtomicU64,
@@ -100,7 +100,7 @@ const PASS_HEARTBEAT: Duration = Duration::from_secs(300);
impl EngineHealth {
/// Note that the running pass reported progress. Returns the pass's folder
/// and age once every [`PASS_HEARTBEAT`], when it is time to log it.
pub(crate) fn moved(&self) -> Option<(i64, Duration)> {
pub fn moved(&self) -> Option<(i64, Duration)> {
let mut pass = self.pass.lock();
let pass = pass.as_mut()?;
let now = Instant::now();
@@ -114,7 +114,7 @@ impl EngineHealth {
/// The engine's state now. `try_lock`, like the rest of the diagnostics:
/// a report must not wait on the thing it reports about.
pub(crate) fn report(&self) -> SyncEngineState {
pub fn report(&self) -> SyncEngineState {
let pass = self.pass.try_lock().and_then(|pass| *pass);
let mut traces: Vec<_> = self
.traces
@@ -167,7 +167,7 @@ impl EngineHealth {
}
/// Apply `f` to the running pass's trace. Does nothing outside a pass.
pub(crate) fn trace(&self, f: impl FnOnce(&mut PassTrace)) {
pub fn trace(&self, f: impl FnOnce(&mut PassTrace)) {
if let Some(trace) = self.trace.lock().as_mut() {
f(trace);
}
@@ -175,7 +175,7 @@ impl EngineHealth {
/// Note that the running pass ended, `how`, and return its trace for the
/// journal.
pub(crate) fn end_trace(&self, how: &'static str) -> Option<PassTrace> {
pub fn end_trace(&self, how: &'static str) -> Option<PassTrace> {
let mut trace = self.trace.lock();
let trace = trace.as_mut()?;
trace.end(how);
@@ -1,18 +1,18 @@
//! What the sync engine owns, and the narrow port through which it reaches the
//! rest of the daemon.
//!
//! The engine used to be a set of methods on `Core`, the struct every
//! subsystem shares, so any part of a pass could read or lock anything in the
//! The engine used to be a set of methods on the daemon's `Core`, the struct
//! every subsystem shares, so any part of a pass could read or lock anything in the
//! daemon. Its own state now lives in [`SyncParts`], next to the handles it
//! borrows (the database, Drive, the content cache), and everything else it
//! needs from the daemon goes through [`SyncHost`]. A [`Syncer`] is the two
//! together: the value the engine's methods run on.
//!
//! This is the first half of moving the engine into `pdfs-sync`
//! (`docs/ARCHITECTURE.md`, step 3).
//! The daemon implements [`SyncHost`] in `pdfs-fuse`.
use std::collections::{HashMap, HashSet};
use std::ops::Deref;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::sync::atomic::AtomicI64;
@@ -20,19 +20,19 @@ use parking_lot::Mutex;
use pdfs_core::CoreResult;
use pdfs_core::control::{ActivityKind, SyncPhase, SyncProgress};
use pdfs_core::lockrank::{Rank, Ranked};
use pdfs_core::shutdown::Shutdown;
use pdfs_core::transfers::TransferRegistry;
use pdfs_drive::DriveApi;
use pdfs_store::cache::ContentCache;
use pdfs_store::db::Db;
use proton_drive_rs::Thumbnail;
use proton_drive_rs::proton_sdk::ids::NodeUid;
use tracing::info;
use super::{EngineHealth, SyncMsg};
use crate::Core;
use crate::shutdown::Shutdown;
use crate::transfers::TransferRegistry;
/// What the sync engine needs from the daemon that it does not own.
pub(crate) trait SyncHost: Send + Sync {
pub trait SyncHost: Send + Sync {
/// Append an entry to the activity feed.
fn log_activity(&self, kind: ActivityKind, target: String, detail: String, ok: bool);
/// Forget the cached listing of `parent`, after a pass changed it on Drive.
@@ -45,49 +45,52 @@ pub(crate) trait SyncHost: Send + Sync {
fn sync_paused(&self) -> bool;
/// Whether the user has paused synced folder `id`.
fn sync_folder_paused(&self, id: i64) -> bool;
/// The thumbnails to upload with the file at `path`, named `name`; none
/// when it is not an image or video this machine can render. Blocking.
fn upload_thumbnails(&self, path: &Path, name: &str) -> Vec<Thumbnail>;
}
/// The sync engine's state, and the daemon handles it uses.
#[derive(Clone)]
pub(crate) struct SyncParts {
pub(crate) db: Arc<Db>,
pub(crate) drive: Arc<dyn DriveApi>,
pub(crate) rt: tokio::runtime::Handle,
pub(crate) cache: Arc<ContentCache>,
pub(crate) transfers: Arc<TransferRegistry>,
pub(crate) shutdown: Arc<Shutdown>,
pub struct SyncParts {
pub db: Arc<Db>,
pub drive: Arc<dyn DriveApi>,
pub rt: tokio::runtime::Handle,
pub cache: Arc<ContentCache>,
pub transfers: Arc<TransferRegistry>,
pub shutdown: Arc<Shutdown>,
/// My files' root: an attached folder must stay below it.
pub(crate) primary_root_uid: NodeUid,
pub primary_root_uid: NodeUid,
/// Live per-folder progress, keyed by sync-folder id, so `ListSyncFolders`
/// can say what a pass is doing rather than just "syncing". An entry exists
/// only while that folder's pass is running.
pub(crate) progress: Arc<Mutex<HashMap<i64, SyncProgress>>>,
pub progress: Arc<Mutex<HashMap<i64, SyncProgress>>>,
/// Whether the engine is alive, and which pass it is on.
pub(crate) engine: Arc<EngineHealth>,
pub engine: Arc<EngineHealth>,
/// Channel to the engine: nudges it to reconcile a folder, reconcile
/// everything, or re-scan its watch set.
pub(crate) tx: std::sync::mpsc::Sender<SyncMsg>,
pub tx: std::sync::mpsc::Sender<SyncMsg>,
/// Per-folder locks, held for a whole pass and for a whole mode switch. A
/// `mirror→ondemand` flip evicts the local tree and mounts FUSE over it, so
/// it must never overlap a pass that is walking and uploading that tree.
pub(crate) locks: Arc<Mutex<HashMap<i64, Arc<Ranked<()>>>>>,
pub locks: Arc<Mutex<HashMap<i64, Arc<Ranked<()>>>>>,
/// Per-folder paths the last pass could not read, so the activity feed
/// says so when the set changes rather than on every poll (B196).
pub(crate) unscanned: Arc<Mutex<HashMap<i64, Vec<String>>>>,
pub unscanned: Arc<Mutex<HashMap<i64, Vec<String>>>>,
/// Folders whose running pass should stop at its next checkpoint, because
/// a removal is waiting for the folder's lock (B294).
pub(crate) abandon: Arc<Mutex<HashSet<i64>>>,
pub abandon: Arc<Mutex<HashSet<i64>>>,
/// When the Drive event feed was last read, epoch seconds; 0 before the
/// first read. A pass trusts the feed's dirty folders only while it is
/// being read.
pub(crate) events_read_at: Arc<AtomicI64>,
pub events_read_at: Arc<AtomicI64>,
}
impl SyncParts {
/// The lock guarding synced folder `id` against a pass and a mode switch
/// running at once.
pub(crate) fn lock(&self, id: i64) -> Arc<Ranked<()>> {
pub fn lock(&self, id: i64) -> Arc<Ranked<()>> {
self.locks
.lock()
.entry(id)
@@ -98,7 +101,7 @@ impl SyncParts {
// ---- live progress ----------------------------------------------------
/// Start tracking a pass over `folder_id`, in [`SyncPhase::Scanning`].
pub(crate) fn progress_begin(&self, folder_id: i64) {
pub fn progress_begin(&self, folder_id: i64) {
self.progress.lock().insert(
folder_id,
SyncProgress {
@@ -136,12 +139,12 @@ impl SyncParts {
/// but it turns the scan from an indeterminate pulse into a bar that moves,
/// which is the difference between "it's stuck" and "it's working" on a folder
/// whose walk takes minutes.
pub(crate) fn progress_scan_total(&self, folder_id: i64, n: usize) {
pub fn progress_scan_total(&self, folder_id: i64, n: usize) {
self.progress_update(folder_id, |p| p.total = n);
}
/// Note that the scan has checked one more item, named `name`.
pub(crate) fn progress_scanned(&self, folder_id: i64, name: &str) {
pub fn progress_scanned(&self, folder_id: i64, name: &str) {
self.progress_update(folder_id, |p| {
p.done += 1;
p.current = name.to_string();
@@ -150,7 +153,7 @@ impl SyncParts {
/// Note that the scan has checked `n` more items at once, read back from
/// a walk an earlier pass saved.
pub(crate) fn progress_scanned_many(&self, folder_id: i64, n: usize) {
pub fn progress_scanned_many(&self, folder_id: i64, n: usize) {
self.progress_update(folder_id, |p| p.done += n);
}
@@ -158,7 +161,7 @@ impl SyncParts {
/// moved on from scanning to applying the diff. The scan's counts are dropped:
/// they measured a different quantity (items checked, not items to apply), so
/// carrying them over would start the applying bar at a meaningless fraction.
pub(crate) fn progress_queued(&self, folder_id: i64, n: usize) {
pub fn progress_queued(&self, folder_id: i64, n: usize) {
self.progress_update(folder_id, |p| {
if p.phase == SyncPhase::Scanning {
p.phase = SyncPhase::Applying;
@@ -171,12 +174,12 @@ impl SyncParts {
}
/// Note that work has started on `name` (shown as the pass's current item).
pub(crate) fn progress_started(&self, folder_id: i64, name: &str) {
pub fn progress_started(&self, folder_id: i64, name: &str) {
self.progress_update(folder_id, |p| p.current = name.to_string());
}
/// Note that one queued item finished, whether it succeeded or not.
pub(crate) fn progress_finished(&self, folder_id: i64) {
pub fn progress_finished(&self, folder_id: i64) {
self.progress_update(folder_id, |p| {
p.done += 1;
p.current.clear();
@@ -185,14 +188,14 @@ impl SyncParts {
/// Stop tracking a pass — no progress is reported for the folder until the
/// next [`progress_begin`](Self::progress_begin).
pub(crate) fn progress_end(&self, folder_id: i64) {
pub fn progress_end(&self, folder_id: i64) {
self.progress.lock().remove(&folder_id);
}
}
/// The sync engine's state and its port to the daemon: what a pass runs on.
#[derive(Clone)]
pub(crate) struct Syncer {
pub struct Syncer {
parts: SyncParts,
host: Arc<dyn SyncHost>,
}
@@ -206,11 +209,11 @@ impl Deref for Syncer {
}
impl Syncer {
pub(crate) fn new(parts: SyncParts, host: Arc<dyn SyncHost>) -> Self {
pub fn new(parts: SyncParts, host: Arc<dyn SyncHost>) -> Self {
Self { parts, host }
}
pub(crate) fn log_activity(
pub fn log_activity(
&self,
kind: ActivityKind,
target: impl Into<String>,
@@ -221,56 +224,31 @@ impl Syncer {
.log_activity(kind, target.into(), detail.to_string(), ok);
}
pub(crate) fn invalidate_children_of(&self, parent: &NodeUid) {
pub fn invalidate_children_of(&self, parent: &NodeUid) {
self.host.invalidate_children_of(parent);
}
pub(crate) fn attach_ancestors(&self, start: &NodeUid) -> CoreResult<Vec<NodeUid>> {
pub fn attach_ancestors(&self, start: &NodeUid) -> CoreResult<Vec<NodeUid>> {
self.host.attach_ancestors(start)
}
pub(crate) fn settle_pending_mode(&self, id: i64) {
pub fn settle_pending_mode(&self, id: i64) {
self.host.settle_pending_mode(id);
}
pub(crate) fn sync_paused(&self) -> bool {
pub fn sync_paused(&self) -> bool {
self.host.sync_paused()
}
pub(crate) fn sync_folder_paused(&self, id: i64) -> bool {
pub fn sync_folder_paused(&self, id: i64) -> bool {
self.host.sync_folder_paused(id)
}
}
impl SyncHost for Core {
fn log_activity(&self, kind: ActivityKind, target: String, detail: String, ok: bool) {
Core::log_activity(self, kind, target, detail, ok);
}
fn invalidate_children_of(&self, parent: &NodeUid) {
Core::invalidate_children_of(self, parent);
}
fn attach_ancestors(&self, start: &NodeUid) -> pdfs_core::CoreResult<Vec<NodeUid>> {
Core::attach_ancestors(self, start)
}
fn settle_pending_mode(&self, id: i64) {
Core::settle_pending_mode(self, id);
}
fn sync_paused(&self) -> bool {
Core::sync_paused(self)
}
fn sync_folder_paused(&self, id: i64) -> bool {
Core::sync_folder_paused(self, id)
}
}
impl Core {
/// The sync engine, with this daemon as its host.
pub(crate) fn syncer(&self) -> Syncer {
Syncer::new(self.sync.clone(), Arc::new(self.clone()))
/// [`SyncHost::upload_thumbnails`], off the async runtime's threads.
pub async fn thumbnails_for_upload(&self, path: PathBuf, name: String) -> Vec<Thumbnail> {
let host = self.host.clone();
tokio::task::spawn_blocking(move || host.upload_thumbnails(&path, &name))
.await
.unwrap_or_default()
}
}
+4 -4
View File
@@ -47,11 +47,11 @@ graph TD
| Crate | Holds |
|---|---|
| [`pdfs-core`](../crates/pdfs-core) | Authentication and keyring (`auth`), configuration and directories (`config`), the control protocol (`control`), search scoring, ignore rules, Google Takeout parsing, the machine profile |
| [`pdfs-core`](../crates/pdfs-core) | Authentication and keyring (`auth`), configuration and directories (`config`), the control protocol (`control`), search scoring, ignore rules, Google Takeout parsing, the machine profile, the transfer registry (`transfers`) and the shutdown signal (`shutdown`) |
| [`pdfs-store`](../crates/pdfs-store) | The SQLite schema and queries (`db/`), the content cache (`cache`) |
| [`pdfs-drive`](../crates/pdfs-drive) | The `DriveApi` seam over the SDK, the call counter (`counted`), and `FakeDrive` for the simulations |
| [`pdfs-sync`](../crates/pdfs-sync) | The sync planner, the pass model and the pass trace: the parts of the sync engine with no I/O |
| [`pdfs-fuse`](../crates/pdfs-fuse) | The daemon: FUSE handlers (`filesystem`), the tree (`state`), reads (`reads`), the queue and the drain (`queue`, `drain`, `upload`), the link state (`link`), remote events (`background`), the sync engine (`sync`, `sync/`; its own state in `SyncParts`, its calls into the daemon through `SyncHost`), moves between locations (`relocate`), control handlers (`control`), push events (`events`), photos, sharing, devices, the supervisor, and the simulation tests (`sim/`) |
| [`pdfs-sync`](../crates/pdfs-sync) | The mirror engine: its passes and engine thread (`mirror`), and the parts with no I/O: planner, pass model and pass trace. It owns its state (`SyncParts`) and reaches the daemon only through `SyncHost` |
| [`pdfs-fuse`](../crates/pdfs-fuse) | The daemon: FUSE handlers (`filesystem`), the tree (`state`), reads (`reads`), the queue and the drain (`queue`, `drain`, `upload`), the link state (`link`), remote events (`background`), the daemon's side of the sync engine (`sync`, which implements `SyncHost`), moves between locations (`relocate`), control handlers (`control`), push events (`events`), photos, sharing, devices, the supervisor, and the simulation tests (`sim/`) |
| [`pdfs-cli`](../crates/pdfs-cli) | The `pdfs` binary. `pdfs daemon` runs the daemon in-process; every other command is a control-socket client |
| [`pdfs-gui`](../crates/pdfs-gui) | `pdfs-app`, `pdfs-tray` and `pdfs-prompt`. Pages in `src/app/pages/`, widgets in `src/app/widgets/`, CSS and icons in `resources/` |
@@ -306,7 +306,7 @@ so it only drops gallery rows or marks the timeline stale (`TIMELINE_TTL`, 60 s)
## 7. Synced folders
A synced folder in **mirror** mode is a plain local directory kept in step with a folder under
this computer's device in Drive. It has its own engine (`sync.rs`, `sync/`); it does not use the
this computer's device in Drive. It has its own engine (`pdfs-sync`'s `mirror`); it does not use the
queue of §5 yet (§13). A folder in **online-only** mode is a FUSE session on the tree (§2), and
its changes go through the queue like My files.