100 Commits

Author SHA1 Message Date
Jamie Pine
b5a77c403e Simplify database migration logic - error if both files exist 2025-12-01 15:00:59 -08:00
Jamie Pine
e127a5aa0b Fix database migration to handle existing library.db files 2025-12-01 14:57:55 -08:00
Jamie Pine
4a314fadb2 Rename database.db to library.db with automatic migration 2025-12-01 14:44:09 -08:00
Jamie Pine
9acf86a9ea Add location export/import and schema changes 2025-11-30 17:27:31 -08:00
Jamie Pine
35af15aefc Add deterministic UUIDs for library defaults
- Introduce deterministic UUID generation for library defaults (spaces,
groups, and items) - Add post-backfill rebuild support in the sync
registry (with_rebuild) - Export BatchFkMapResult type via the sync API
- Track per-peer RTT latency via SyncMetricsCollector integration - Use
deterministic IDs when creating default space and related items in
LibraryManager
2025-11-26 08:19:24 -08:00
Jamie Pine
08912e141e feat: implement library opening functionality and filesystem watcher
- Added a new "Open Library" menu item to the application, allowing users to select a library folder.
- Implemented the backend logic to handle library opening, including JSON-RPC requests to the daemon.
- Introduced a filesystem watcher in the LibraryManager to monitor library directory changes, enabling automatic opening and closing of libraries based on filesystem events.
- Enhanced error handling for library operations and added relevant logging for better traceability.
- Updated the LibraryError enum to include filesystem watcher errors, improving error reporting.
2025-11-18 18:40:56 -08:00
Jamie Pine
5a6c3eb5a0 feat: add database migration step to ensure schema consistency
- Implemented a migration step in the LibraryManager to ensure the database schema is up to date before proceeding with operations.
- This change enhances the reliability of the application by preventing potential schema-related issues during runtime.
2025-11-18 02:36:31 -08:00
Jamie Pine
c6cda350be feat: media proxy and thumbstrip functionality
- Introduced new modules and actions for generating media proxies and thumbstrips, improving media handling capabilities.
- Added configuration, error handling, and processing logic for both proxy and thumbstrip generation.
- Updated existing media operations to integrate new functionalities, ensuring seamless media processing and user experience.
- Enhanced tests to cover new features and ensure reliability in media operations.
2025-11-17 04:24:05 -08:00
Jamie Pine
d93d1efaaa chore: update submodule and add statistics listener for library management
- Updated the submodule reference in the landing app.
- Added a statistics recalculation listener in the LibraryManager to monitor resource changes.
- Included clipboard permissions in the capabilities configuration for enhanced functionality.
- Improved the LibraryInfoOutput struct to implement the Identifiable trait for better resource management.
2025-11-16 03:38:54 -08:00
James Pine
2f887a41fa yay 2025-11-15 08:35:07 -08:00
Jamie Pine
cf3eb78530 feat: enhance sync architecture with dedicated event bus
- Introduced a dedicated sync event bus to improve coordination for sync events, preventing starvation from high-volume events.
- Updated TransactionManager to utilize both sync and general event buses for better event handling.
- Refactored PeerSync to listen for sync events, ensuring proper handling of state change and shared change events.
- Adjusted LibraryManager and related components to support the new sync event bus.

This change enhances the responsiveness and reliability of the synchronization process across the system.
2025-11-14 22:24:19 -08:00
Jamie Pine
41476d13dd refactor: streamline device and sync management by removing unused watermark fields; implement per-resource watermark tracking for improved sync reliability 2025-11-14 07:23:34 -08:00
Jamie Pine
267d52d769 feat: enhance volume management with new filtering options and improved event handling; add stability tests for volume fingerprints 2025-11-14 05:20:05 -08:00
Jamie Pine
1559ab17b9 feat: add comprehensive AI processing system documentation, including job analysis, model management, and OCR/speech-to-text integration 2025-11-11 22:01:28 -08:00
Jamie Pine
2ef179d4df chore: update Zustand dependency to version 5.0.8, modify Cargo.toml for sd-core features, and enhance sidecar manager initialization in library management 2025-11-11 15:44:00 -08:00
Jamie Pine
fa5df2d51d refactor: update SpaceItem structure to include space-level items, modify related database entities and queries, and enhance item creation logic 2025-11-11 08:07:47 -08:00
Jamie Pine
d9f452f852 implement Spaces 2025-11-11 07:35:58 -08:00
Jamie Pine
0eaff9547e feat: integrate sidecars as first-class SdPath variant 2025-11-02 19:42:50 -08:00
Cursor Agent
606485c398 Refactor: Organize job logs and flatten job database
Co-authored-by: ijamespine <ijamespine@me.com>
2025-10-24 02:45:10 +00:00
Jamie Pine
8a803ba6c9 fix: implement deterministic device slug collision resolution
Fixes FK violations during library sync setup when devices have identical slugs. Implements deterministic collision resolution where the newer/joining device always renames itself with a -2 suffix, stored in device.json overrides.

- Add device info to CreateSharedLibraryRequest for pre-registration
- Add device_slug to CreateSharedLibraryResponse for resolved slug communication
- Add create_library_with_id_and_initial_device() to pre-register requesting device
- Update ensure_device_registered() to use per-library slug system
- Add collision detection to RegisterDeviceRequest message handler
- Add collision detection to Device::apply_state_change() for sync backfill
- Preserve existing slugs on device updates to avoid breaking references
- Implement execute_share_local() and execute_join_remote() with proper registration

Flow: requesting device is pre-registered before library creation, so the joining device detects the collision and stores an override in its device.json. Both libraries end up with consistent slug assignments and bidirectional sync works.
2025-10-23 18:36:33 -07:00
Jamie Pine
21c0041f0d feat: add multi-library sync routing 2025-10-20 18:16:36 -07:00
Jamie Pine
37b10ee02c fix: handle slug collisions in library 2025-10-19 17:56:29 -07:00
Jamie Pine
2563a6dee9 feat: add create-shared action to SetupArgs 2025-10-19 14:41:46 -07:00
Jamie Pine
35eeda5b11 feat: refactor LibraryManager, update MessagingProtocolHandler, implement create_library_with_id, and add as_any method 2025-10-19 13:53:15 -07:00
Jamie Pine
3512e38f67 chore: cache paired device slug for pre-library address resolution 2025-10-19 07:40:19 -07:00
Jamie Pine
b26e2b5f54 (epic): new SdPath addressing - lots of LSYNC, FSYNC progress - improved
testing framework
2025-10-15 07:02:36 -07:00
Jamie Pine
f43d2456da (chore): CI fix 2025-10-14 23:02:13 -07:00
Jamie Pine
c24063e892 (chore): CI fix 2025-10-14 22:39:16 -07:00
Jamie Pine
56fcf9be22 feat: add cloud volume handling 2025-10-14 01:23:11 -07:00
Jamie Pine
f9687c5ec2 refactor: Update sync transport implementation and library creation methods
- Revised documentation in the NetworkTransport trait to clarify the source of target device UUIDs and connected partners, switching references from the obsolete sync_partners table to the devices table.
- Introduced `create_library_no_sync` method in LibraryManager to allow library creation without automatic sync initialization, facilitating testing with mock transports.
- Enhanced logging in PeerSync to include network transport details for better debugging.
- Updated MockNetworkTransport to support transport name retrieval for improved test clarity.
2025-10-09 09:30:34 -07:00
Jamie Pine
28e3ee443d feat: Enhance sync functionality by adding sync fields to devices and implementing migration
- Added `sync_enabled` and `last_sync_at` fields to the device model to support synchronization capabilities.
- Created a migration script to update the devices table, consolidating sync-related data.
- Updated various components to ensure sync is enabled by default for new devices.
- Removed the obsolete sync partners table, streamlining the sync architecture.
- Introduced comprehensive sync integration tests to validate the new functionality and ensure robust performance.
2025-10-09 08:48:23 -07:00
Jamie Pine
6b7266de6d feat: Introduce WASM extension system with comprehensive documentation and job execution support
- Added `README_EXTENSIONS.md` to document the WASM extension system, outlining its features, quick start guide, and future plans.
- Implemented `WasmJob` for executing WASM extension jobs, including methods for job dispatching and state management.
- Enhanced `CoreContext` to include a `plugin_manager`, facilitating the management of extensions.
- Created integration tests for WASM job execution, ensuring the functionality of the new system.
- Removed the obsolete `sync_leadership` column from the database schema, streamlining the data model.
- Updated various modules to support the new extension architecture and improve overall system integration.
2025-10-09 03:48:37 -07:00
Jamie Pine
77736dbbbc feat: Implement network transport integration for sync service
- Introduced the `NetworkTransport` trait to decouple the sync layer from the networking implementation, enabling better testability and modularity.
- Added `NoOpNetworkTransport` for fallback scenarios when networking is unavailable, ensuring graceful degradation.
- Integrated `NetworkingService` as the concrete implementation of the `NetworkTransport` trait, allowing for sending sync messages and retrieving connected partners.
- Updated `PeerSync` to utilize the new network transport for broadcasting state and shared changes, enhancing the synchronization capabilities across devices.
- Refactored the `LibraryManager` and `SyncService` to support network transport initialization, ensuring seamless integration during library setup.
- Enhanced documentation to clarify the new architecture and usage of the network transport layer.
2025-10-08 21:54:13 -07:00
Jamie Pine
95295b8303 refactor: Transition to leaderless hybrid sync architecture
- Removed leadership-related components from the sync infrastructure, including `LeadershipManager` and `sync_leadership` fields across various models.
- Implemented a new peer-to-peer sync model utilizing Hybrid Logical Clocks (HLC) for shared resources and state-based sync for device-owned data.
- Updated the `Syncable` trait and related modules to reflect the new architecture, ensuring seamless integration of state and log-based synchronization.
- Introduced `PeerLog` for managing device-specific changes and `PeerSync` for handling synchronization in the leaderless environment.
- Revised documentation to outline the new sync architecture and its implications for device synchronization, emphasizing the benefits of a leaderless approach.
2025-10-08 19:18:23 -07:00
Jamie Pine
966041f46d feat: Implement sync entry application for location model
- Added `apply_sync_entry` method to the `Syncable` trait, allowing models to handle synchronization of insert, update, and delete operations.
- Enhanced the `location` model to support synchronization by checking for existing entries, updating fields, and deleting records based on sync log entries.
- Registered the `location` model for automatic sync handling, ensuring seamless integration with the sync infrastructure.
- Updated the `sync` module to include the new `apply_sync_entry` functionality, improving the overall sync capabilities of the application.
2025-10-08 06:55:06 -07:00
Jamie Pine
08adba6404 feat: Implement sync infrastructure with leader election and transaction management
- Introduced a comprehensive sync infrastructure, including a `Syncable` trait for models, enabling automatic logging of changes in a dedicated sync log database.
- Added `LeadershipManager` for managing leader election and lease tracking, ensuring reliable synchronization across devices.
- Implemented `TransactionManager` to handle atomic writes and sync logging, enhancing data integrity during state changes.
- Created a new `sync` module with necessary components such as `SyncLogDb`, `SyncLogEntry`, and sync protocol handlers for efficient communication between leader and follower devices.
- Developed integration tests to validate the sync functionality and ensure robust performance across various scenarios.
2025-10-08 06:35:28 -07:00
Jamie Pine
f9238545a3 feat: Add device management commands and enhance device listing functionality
- Introduced `DevicesCmd` for managing device operations within the CLI, allowing users to list devices from the library database.
- Implemented `DevicesListArgs` to support detailed device information retrieval, including offline status and capabilities.
- Updated the command handling logic to integrate device operations seamlessly with existing commands.
- Refactored device-related queries and outputs to improve data handling and presentation in the CLI.
- Enhanced the overall structure of device management code for better maintainability and clarity.
2025-10-04 20:18:03 -07:00
Jamie Pine
3925dac4f6 refactor: Remove Deprecated Build Scripts and Enhance Core Initialization 2025-09-29 14:36:13 -07:00
Jamie Pine
79728fdb10 feat: Enhance Library Management and UI Components
- Introduced a new `LibraryCard` and `EmptyLibraryCard` components for improved library selection UI in the macOS app.
- Updated `LibrarySelector` to display current library information and allow users to switch libraries through a new button.
- Enhanced `MenuBarManager` to dynamically update the libraries menu based on available libraries and current selection.
- Refactored `DaemonConnector` to handle library-related events and refresh library statistics accordingly.
- Improved `LibraryInfo` structure to include optional statistics, enhancing data representation for libraries.
- Updated various UI components to utilize new library statistics, providing users with better insights into their libraries.
2025-09-25 05:29:09 -07:00
Jamie Pine
e6e1a3b252 feat: Add benchmarks module and refactor job handling for resumable jobs
- Introduced a new `core/benchmarks` module to facilitate performance testing and benchmarking.
- Updated `Cargo.toml` to include the new benchmarks module in the workspace.
- Refactored job handling in the `JobManager` and `JobExecutor` to support job resumption, enhancing the ability to recover from interruptions.
- Improved logging throughout the job lifecycle to provide better visibility into job states and transitions.
- Added integration tests for job pause/resume functionality, ensuring robustness in job management.
2025-09-20 00:51:08 -07:00
Jamie Pine
bc7091768d feat: Update CLI and core dependencies, enhance daemon shutdown process
- Updated `Cargo.toml` for the CLI to include `comfy-table` for improved output formatting.
- Enhanced the daemon's shutdown process to provide clearer logging during shutdown initiation and completion.
- Refactored the logo display function to use a colored ASCII representation, improving visual appeal.
- Removed unnecessary CLI dependency on `clap` in the core, simplifying the dependency structure.
2025-09-19 21:45:35 -07:00
Jamie Pine
7b9e2d8dd6 chore: Update dependencies and enhance error handling in CLI
- Updated `bincode` dependency to version 1.3.3 for improved performance and security.
- Refactored error handling in `error.rs` to use `bincode::Error` instead of `bincode::ErrorKind`, ensuring better error management.
- Enhanced macro definitions in `macros.rs` to utilize the updated error handling structure.
- Improved error reporting in `manager.rs` when creating directories, providing clearer context for IO errors.
- Added a new design document for Sync Conduits, detailing the architecture and implementation plan for file synchronization in Spacedrive.
2025-09-15 11:45:21 -07:00
Jamie Pine
b72c42b317 refactor: Rename session_state to session in CoreContext and related modules
- Updated the CoreContext struct to rename the session_state field to session for clarity.
- Refactored all instances in the codebase where session_state was used, ensuring consistency across ActionManager, JobManager, LibraryManager, and various query implementations.
- Enhanced session management by retrieving the current library ID directly from the session, improving code readability and maintainability.
2025-09-13 16:16:05 -07:00
Jamie Pine
d439d69590 feat: Finalize Spacedrive refactor and enhance session management
- Added a new documentation file outlining the finalization plan for the Spacedrive refactor, detailing remaining tasks and objectives for migrating to a CQRS architecture.
- Implemented session state management to track the current library context across operations, improving the overall architecture's modularity and maintainability.
- Refactored CLI commands and core components to utilize the new session state service, ensuring a more consistent and error-free user experience.
- Enhanced error handling and logging in various modules to facilitate debugging and improve reliability.
2025-09-13 16:08:07 -07:00
Jamie Pine
13df73bef0 refactor: streamline action and query structures
- Removed unnecessary whitespace in `cqrs.rs` to enhance code cleanliness.
- Reorganized imports in `addressing.rs` for better clarity and consistency.
- Introduced new input types for actions, including `Input` associated types in `CoreAction` and `LibraryAction`, promoting a more modular design.
- Updated action implementations to utilize the new input structures, improving maintainability and reducing redundancy.
- Enhanced event handling in `event.rs` to ensure proper library ID filtering.

These changes improve the overall structure and maintainability of the action and query systems while ensuring a consistent API surface.
2025-09-10 17:34:11 -04:00
Jamie Pine
1a0a293700 again 2025-09-07 01:44:02 -04:00
Jamie Pine
a8a2c732ef more refactor 2025-09-07 01:43:57 -04:00
Jamie Pine
29a87a91ce huge refactor 2025-09-06 21:00:37 -04:00
Oscar Beaumont
9270da1b74 Library "state" (#1160)
* `Library` -> `LoadedLibrary`

* Move `ThumbnailRemoverActor` onto `NodeServices`
It should either be on `Library` or `NodeServices` none of this in-between stuff.

* small > big files

* prune imports

* isolate cringe

* it helps to test the code

* `Vec` -> `HashMap` - faster lookups

* mpscrr

* minor fixes

* fix language

* `!Sync` :(

* lets goooooo

* removed a comma

* fixes

* fix desktop

* lol, no one uses it

* Clippy
2023-08-05 14:42:21 +00:00
Oscar Beaumont
3521b4e25d Networked sync (#1133)
* temp remove discriminator from tunnel

* i'm lost :(

* Working `Tunnel` + move sync stuff back into p2p

* sync module

* `NetworkedSyncManager`

* Move sync stuff off `P2PManager`

* Test `SyncMessage`

* Library edit + delete hooks

* stable `identity` column

* fix

* plz work

* p2p is hard

* sync identities post pairing

* Remove `p384`

* a couple improvements

* comment out ReqRes

---------

Co-authored-by: Brendan Allan <brendonovich@outlook.com>
2023-08-02 11:49:50 +00:00