How infomaniak/desktop-kdrive works
Purpose and executables
kDrive is a cross-platform desktop client for synchronizing local folders with Infomaniak kDrive, including sharing, conflict handling, selective sync, and on-demand files (“LiteSync”). The primary C++/Qt daemon entry point is src/server/mainserver.cpp; the legacy Qt GUI starts at src/gui/mainclient.cpp. A separate manual update executable starts at src/manualupdater/main.cpp. New native GUIs coexist for macOS and Windows.
Process topology and IPC boundary
The sync server is the authoritative local process: it owns accounts, sync configuration, databases, engine lifecycle, updates, and OS integrations. src/server/appserver.cpp composes this runtime. GUI requests cross an explicit local communications layer via src/server/comm/commmanager.cpp and GUI job dispatchers under src/server/comm/guijobs/. Transports are platform-dependent—pipes/sockets on general platforms and XPC on macOS (src/server/comm/xpccommserver_mac.mm). GUI clients receive asynchronous state, progress, error, and updater signals rather than directly manipulating engine state.
Synchronization engine
src/libsyncengine implements the Syncpal-based pipeline. Local filesystem changes are watched and normalized into operations by src/libsyncengine/update_detection/file_system_observer/filesystemobserverworker.cpp; remote state is represented through snapshots and update trees in src/libsyncengine/update_detection/update_detector/updatetreeworker.cpp. Reconciliation detects/resolves conflicts and generates sync operations (src/libsyncengine/reconciliation/conflict_finder/conflictfinderworker.cpp, src/libsyncengine/reconciliation/operation_generator/operationgeneratorworker.cpp). Operations are dependency-sorted, then executed locally or remotely (src/libsyncengine/propagation/operation_sorter/operationsorterworker.cpp, src/libsyncengine/propagation/executor/executorworker.cpp). src/libsyncengine/syncpal/syncpalworker.cpp coordinates these stages per synchronization.
Persistence, credentials, and network boundary
SQLite-backed local state is split by concern: generic DB primitives in src/libcommonserver/db/sqlitedb.cpp, application parameters and folder rules in src/libparms/db/parmsdb.cpp, and sync-node state in src/libsyncengine/db/syncdb.cpp. Authentication tokens are isolated behind keychain storage in src/libcommonserver/keychainmanager/keychainmanager.cpp. The engine accesses Infomaniak login and kDrive HTTP APIs through typed network jobs, including cursor/long-poll remote listing (src/libsyncengine/jobs/network/kDrive_API/listing/longpolljob.cpp) and resumable upload sessions (src/libsyncengine/jobs/network/kDrive_API/upload/upload_session/driveuploadsession.cpp). Poco/OpenSSL form the transport/TLS runtime.
User interfaces
The legacy desktop GUI is Qt Widgets and communicates through src/libcommongui/commclient.cpp, with application coordination in src/gui/clientgui.cpp. Native GUI4 clients are separate consumers of the same server contract: macOS uses Swift/SwiftUI/AppKit beginning at src/gui4/macOS/kDrive/KDriveApp.swift, while Windows uses C#/XAML beginning at src/gui4/windows/kDrive client/kDrive client/App.xaml.cs. The macOS client explicitly models IPC queries, signals, and observable cache state in src/gui4/macOS/kDriveCore/ServerBridge/XPC/ and src/gui4/macOS/kDriveCore/ServerBridge/Cache/.
Virtual files and file-manager integration
LiteSync exposes cloud content on demand rather than fully materializing it. Server-side VFS plugins are selected per OS (src/server/vfs/mac/vfs_mac.cpp, src/server/vfs/win/vfs_win.cpp). macOS Finder and LiteSync extensions communicate over XPC (extensions/MacOSX/kDriveLiteSync/Extension/xpcService.m); Windows implements Cloud Files API provider, placeholders, and Explorer extension components (extensions/windows/cfapi/Vfs/cloudprovider.cpp, extensions/windows/cfapi/Vfs/placeholders.cpp). These are privileged OS boundaries separate from the sync daemon.
Operations and delivery
The C++ core builds through CMake (CMakeLists.txt, src/CMakeLists.txt) with Conan-managed dependencies (conanfile.py). Supported runtime targets are Linux, macOS, and Windows; Qt underpins legacy UI and core process functionality, while native GUI4 adds Swift and .NET runtimes. Updates are server-managed with platform implementations (src/server/updater/updatemanager.cpp, src/server/updater/sparkleupdater.mm, src/server/updater/windowsupdater.cpp), plus a fallback/manual updater. Observability uses log4cplus, support-log upload jobs, Sentry (src/libcommon/log/sentry/handler.cpp), and Matomo clients.
Main entry points: appserver.cpp Sync server · commmanager.cpp Local comm manager · syncpalworker.cpp Syncpal coordinator · updatetreeworker.cpp Remote state detection
Components 21
Desktop clients
- Legacy Qt GUI
src/gui/clientgui.cpp - GUI comm client
src/libcommongui/commclient.cpp - macOS GUI4
src/gui4/macOS/kDrive/KDriveApp.swift - Windows GUI4
src/gui4/windows/kDrive client/kDrive client/App.xaml.cs
Sync server
- Sync server · Owns accounts, sync configuration, engines, updates, and OS integration.
src/server/appserver.cpp - Server entry point
src/server/mainserver.cpp - Local comm manager
src/server/comm/commmanager.cpp - macOS XPC server
src/server/comm/xpccommserver_mac.mm - Update manager
src/server/updater/updatemanager.cpp - Manual updater
src/manualupdater/main.cpp
Sync engine
- Syncpal coordinator
src/libsyncengine/syncpal/syncpalworker.cpp - Change detection
src/libsyncengine/update_detection/file_system_observer/filesystemobserverworker.cpp - Remote state detection
src/libsyncengine/update_detection/update_detector/updatetreeworker.cpp - Reconciliation
src/libsyncengine/reconciliation/conflict_finder/conflictfinderworker.cpp - Operation execution
src/libsyncengine/propagation/executor/executorworker.cpp
Platform & cloud
- Local SQLite state
src/libsyncengine/db/syncdb.cpp - Keychain tokens
src/libcommonserver/keychainmanager/keychainmanager.cpp - Infomaniak APIs · Login, kDrive listing/long-poll, and resumable upload APIs.
src/libsyncengine/jobs/network/kDrive_API/listing/longpolljob.cpp - LiteSync VFS
src/server/vfs/mac/vfs_mac.cpp - File-manager extensions · Finder/XPC extension on macOS and Cloud Files provider on Windows.
extensions/windows/cfapi/Vfs/cloudprovider.cpp - Observability
src/libcommon/log/sentry/handler.cpp
Connections 23
- Server entry point → Sync server: starts
- Legacy Qt GUI → GUI comm client: uses
- GUI comm client → Local comm manager: local requests & signals
- macOS GUI4 → macOS XPC server: XPC queries & signals
- Windows GUI4 → Local comm manager: server contract
- Local comm manager → Sync server: dispatches GUI jobs
- macOS XPC server → Local comm manager: macOS transport
- Sync server → Syncpal coordinator: manages sync lifecycle
- Sync server → Local SQLite state: accounts and folder rules
- Sync server → Keychain tokens: reads tokens
- Sync server → Update manager: manages updates
- Update manager → Manual updater: fallback path
- Sync server → LiteSync VFS: selects by OS
- LiteSync VFS → File-manager extensions: on-demand file integration
- Syncpal coordinator → Change detection: local changes
- Syncpal coordinator → Remote state detection: remote snapshots
- Change detection → Reconciliation: normalized operations
- Remote state detection → Reconciliation: update tree
- Reconciliation → Operation execution: conflicts resolved; operations generated
- Operation execution → Local SQLite state: persists sync nodes
- Operation execution → Infomaniak APIs: downloads and uploads
- Remote state detection → Infomaniak APIs: long-poll listing
- Sync server → Observability: logs and reports