Commit Graph

1141 Commits

Author SHA1 Message Date
Jamie Pine
fe97fc2390 refactor: streamline handling of WatermarkExchangeResponse in SyncProtocolHandler
- Simplified the processing of WatermarkExchangeResponse messages to ensure they are only handled via the bidirectional stream.
- Added a warning log for unexpected responses, improving visibility into potential misuse of the sync request mechanism.
- Removed unnecessary parameters from the response handling, enhancing code clarity and maintainability.
2025-11-16 08:40:02 -08:00
Jamie Pine
be33d4a6b9 refactor: improve watermark exchange handling in PeerSync
- Updated the watermark exchange process to utilize a request/response pattern, enhancing synchronization reliability.
- Enhanced logging to provide clearer insights into the request and response lifecycle during watermark exchanges.
- Added error handling for unexpected message types in the response, improving robustness.
- Clarified comments to better describe the asynchronous nature of the watermark exchange process.
2025-11-16 08:31:53 -08:00
Jamie Pine
a037af577e refactor: update catch-up logic in SyncService for improved synchronization handling
- Revised the catch-up logic to make the sync loop passive, driven by watermark exchanges and reconnection events.
- Enhanced comments to clarify the new approach, focusing on edge cases where retry states indicate a stuck condition.
- Removed the previous time-based sync checks in favor of a more robust failure tracking mechanism.
2025-11-16 08:07:16 -08:00
Jamie Pine
1d078206f6 refactor: improve entry count query in PeerSync for location ownership
- Updated the entry count query to utilize the entry_closure table for more accurate counting of entries associated with device locations.
- Enhanced comments to clarify the purpose of the query and the use of closure tables in the synchronization process.
2025-11-16 07:59:40 -08:00
Jamie Pine
56b57a27d3 chore: update logging levels and adjust periodic watermark check interval
- Changed logging from info to debug for various library operations to reduce log verbosity.
- Updated the periodic watermark check interval from 5 minutes to 1 minute for more frequent synchronization checks.
- Commented out the ContentBreakdown component in the Overview route for potential future use.
2025-11-16 07:38:27 -08:00
Jamie Pine
8c5543b8b2 fix: include database connection in watermark exchange for resource count retrieval
- Updated the watermark exchange methods to accept a database connection, enabling retrieval of peer resource counts during synchronization.
- Enhanced logging to provide visibility into the resource counts being exchanged, improving debugging and monitoring capabilities.
- Addressed potential issues with resource count availability by ensuring counts are fetched correctly during static exchanges.
2025-11-16 07:10:58 -08:00
Jamie Pine
680585a02f feat: enhance watermark synchronization with resource count validation
- Introduced new functionality to validate resource counts during watermark exchanges, improving synchronization accuracy.
- Added methods to retrieve device-owned resource counts for gap detection, ensuring that discrepancies are identified and addressed.
- Updated the `SyncMessage` structure to include actual resource counts, facilitating better tracking of synchronization state.
- Enhanced the `PeerSync` implementation to clear watermarks for mismatched resources, allowing for surgical recovery in case of count mismatches.
- Improved logging for better visibility into synchronization processes and potential issues.
2025-11-16 06:39:59 -08:00
Jamie Pine
08d5e7badf feat: add DataAvailableNotification for proactive data sync notifications
- Introduced a new `DataAvailableNotification` message type to notify peers of new data availability, triggering immediate watermark exchanges for synchronization.
- Enhanced the `PeerSync` implementation to handle notifications and manage real-time activity tracking per peer, improving synchronization efficiency.
- Updated the `SyncProtocolHandler` to process the new notification type and initiate catch-up logic accordingly.
- Implemented periodic watermark checks to ensure timely synchronization and prevent missed events during idle periods.
2025-11-16 05:40:30 -08:00
Jamie Pine
a33ca1e884 feat: enhance synchronization with per-resource watermark tracking and batching configuration
- Added support for per-resource watermarks in the synchronization process, allowing for fine-grained comparison and catch-up logic.
- Implemented new configuration options for real-time batching, including maximum entries before flush and flush interval in milliseconds.
- Enhanced the `apply_state_change` function to check for tombstoned records, preventing the resurrection of deleted entries.
- Updated various components to utilize the new watermark and batching features, improving synchronization efficiency and robustness.
2025-11-16 04:56:41 -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
Jamie Pine
a067dd5cbb chore: update submodule and enhance logging in ResourceManager and PeerSync
- Updated the submodule reference in `workbench`.
- Added debug logging in `ResourceManager` to track resource event emissions and virtual resource mappings.
- Improved the `PeerSync` implementation to emit resource events in a non-blocking manner, enhancing UI reactivity and ensuring proper resource formatting.
- Updated integration tests to include new resource types and refined synchronization checks for stability.
2025-11-16 02:25:05 -08:00
Jamie Pine
8305d7d235 feat: working sync test, sick log analyzer, cleanup 2025-11-16 01:53:35 -08:00
Jamie Pine
8693faf5c1 fix: improve foreign key handling in synchronization process
- Updated the foreign key mapping logic in `fk_mapper.rs` to return an error when a referenced record is missing, instead of setting the foreign key to NULL. This change ensures that sync dependencies are properly managed and allows for retrying when dependencies are resolved.
- Enhanced the error handling in `peer.rs` to buffer state changes that depend on missing foreign keys, improving the robustness of the synchronization process and preventing data loss during updates.
2025-11-15 09:22:26 -08:00
Jamie Pine
a7586b3bf7 feat: enhance real-time synchronization and event broadcasting
- Updated the `Library` implementation to generate HLCs, append to the peer log, and emit real-time events for instant synchronization.
- Introduced a mechanism to collect entries for real-time broadcasts, ensuring immediate updates are sent to peers.
- Added a yield point in the content phase to prevent foreign key orphaning by ensuring content identity events are emitted before entry updates.
2025-11-15 08:46:37 -08:00
James Pine
2f887a41fa yay 2025-11-15 08:35:07 -08:00
Jamie Pine
eb4e1db688 feat: implement connection caching for improved network performance
- Enhanced the `NetworkingService` to cache active connections, allowing for reuse of existing connections and reducing the overhead of establishing new ones.
- Implemented logic to check the status of cached connections before creating new ones, improving efficiency during synchronization and request handling.
- Added detailed logging for connection reuse and creation, aiding in monitoring and debugging network interactions.
2025-11-15 07:42:29 -08:00
Jamie Pine
15821e581a feat: implement real-time batching for state change events in PeerSync
- Introduced a batching mechanism in `PeerSync` to accumulate state change events, improving network efficiency by processing up to 100 entries at once or flushing every 50ms.
- Added a new method `flush_state_change_batch` to handle the processing of batched state changes, enhancing overall synchronization performance.
- Updated event handling logic to support batching, reducing the frequency of individual state change processing and improving throughput.
2025-11-15 07:30:13 -08:00
Jamie Pine
9303b37692 feat: implement real-time sync lock mechanism to prevent catch-up duplication
- Added a mechanism in `PeerSync` to check for active real-time broadcasts, allowing the system to skip catch-up if real-time sync is ongoing.
- Introduced a new field `last_realtime_activity` to track the timestamp of the last real-time broadcast, enhancing synchronization efficiency.
- Updated the catch-up logic in `SyncService` to incorporate the real-time sync status, improving the overall synchronization process and preventing data duplication.
2025-11-15 06:52:52 -08:00
Jamie Pine
d5020cc37e fix: prevent buffering of local state changes during synchronization
- Updated the synchronization logic in `PeerSync` to avoid buffering state changes originating from the local device, addressing a critical data loss issue during backfill requests.
- Enhanced logging to clarify the nature of the broadcasted state change events, improving traceability of local changes.
2025-11-15 06:24:36 -08:00
Jamie Pine
8cdf878b38 fix: improve entry dependency handling and synchronization broadcasting
- Updated `sync_depends_on` in the entry model to include `content_identity` and `user_metadata`, ensuring foreign key references are validated before entries are processed.
- Enhanced the synchronization process in `PeerSync` to broadcast buffered state and shared changes to peers after local application, addressing a critical data loss issue.
- Added logging for the number of processed state and shared changes to improve monitoring of synchronization activities.
2025-11-15 06:09:42 -08:00
Jamie Pine
c647ee8452 feat: add unique content count to library statistics
- Introduced a new field `unique_content_count` in `LibraryStatistics` to track the number of unique content identities.
- Updated various components to calculate and display unique content count, enhancing library statistics output.
- Modified the CLI and interface to reflect the new unique content metric, improving user insights into library data.
- Adjusted serialization and API responses to include the unique content count for better data consistency across the system.
2025-11-15 04:55:20 -08:00
Jamie Pine
e73ba2342a fix: prevent self-ACKs in synchronization process
- Updated `get_min_acked_hlc` to exclude self-ACKs from the minimum acknowledged HLC calculation, ensuring stale self-ACKs do not block pruning.
- Enhanced `on_ack_received` to ignore ACKs from the local device, adding defensive logging to catch potential bugs.
- Modified backfill logic to skip sending ACKs for changes created by the local device, improving efficiency during synchronization.
2025-11-15 03:34:49 -08:00
Jamie Pine
dfe7fa64f9 chore: update submodule references and enhance database connection pooling
- Updated submodule references for 'workbench' and 'landing' to their latest commits.
- Enhanced database connection pooling in `mod.rs` to support higher concurrency, adjusting max connections to a configurable pool size.
- Introduced batch processing functions in `fk_mapper.rs` for efficient UUID lookups and foreign key mappings, reducing database load during synchronization.
- Added new utility functions for batch processing in `sync/mod.rs` to streamline foreign key resolution and improve sync performance.
2025-11-15 02:36:25 -08:00
Jamie Pine
ed9f0ae845 refactor: change logging level from warn to debug for volume detection and parsing
- Updated logging statements in volume detection and APFS parsing to use debug level instead of warn, improving log clarity and reducing noise.
- This change enhances the debugging process without affecting the functionality of volume detection.
2025-11-15 02:17:29 -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
James Pine
b1d0fbe296 feat: implement cache-first library statistics with background updates
Backend changes:
- Modify libraries.info query to return cached stats immediately if available
- Detect empty/stale stats and calculate synchronously on first load
- Trigger background recalculation on every query to keep cache fresh
- Emit ResourceChanged events (resource_type: library) when stats update
- Add job completion hooks to trigger stats recalculation after every job

Frontend changes:
- Add library-changed event emission when setCurrentLibrary() is called
- Listen for library-changed events in useNormalizedCache to auto-refetch
- Support instant cache updates via ResourceChanged event listeners

This enables:
 Immediate load of cached stats (0ms after first time)
 Real-time updates when jobs complete
 Background recalculation to keep stats fresh
 Event-driven cache updates via normalizedCache pattern
2025-11-14 20:26:25 -08:00
Jamie Pine
76b17cc332 refactor: optimize event handling and backfill logic by improving timestamp tracking 2025-11-14 18:59:03 -08:00
Jamie Pine
6f331a1b90 feat: retrieve database ID for Entry model to include directory path in sync JSON 2025-11-14 08:53:17 -08:00
Jamie Pine
9ad57dfd0a refactor: enhance resource event emission by utilizing ResourceManager for proper formatting and error handling 2025-11-14 08:44:44 -08:00
Jamie Pine
7f01cf3c1c feat: update resource watermark after successful backfill to prevent re-syncing of already backfilled data 2025-11-14 08:11:50 -08:00
Jamie Pine
eef817d4ab feat: add unique constraint to volumes UUID for improved data integrity; implement migration for index creation and removal 2025-11-14 07:47:04 -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
b3d709d571 chore: mark subproject commits as dirty for library configuration; update documentation for device and capacity fields 2025-11-14 05:46:44 -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
f0ab50c377 feat: add job policies to location management; enhance resource routing and event emissions for virtual resources; update TypeScript types for job configurations 2025-11-13 21:28:48 -08:00
Jamie Pine
54f978d210 feat: introduce Identifiable trait genericization and Spaces resource event system; enhance resource management with direct event emissions and improved routing logic 2025-11-13 10:20:45 -08:00
Jamie Pine
07fd714f84 chore: remove outdated documentation files related to event navigation and sidecar sync, including ARCHITECTURE_EVENT_NAVIGATION.md, CODE_MAP.md, and IMPLEMENTATION_PATTERNS.md 2025-11-13 04:04:16 -08:00
Jamie Pine
e3ede87755 feat: implement sidecar management enhancements, including path resolution, availability updates, and sync job triggers for sidecar metadata changes 2025-11-13 03:56:34 -08:00
Jamie Pine
94e7715c63 feat: enhance event emission for resource changes in sync operations, including batch handling and UI reactivity updates 2025-11-13 03:13:39 -08:00
Jamie Pine
c1680d866d feat: add support for image and audio metadata extraction, enhance media listing query with new sorting options, and update related types in TypeScript definitions 2025-11-13 01:22:34 -08:00
Jamie Pine
da5d53942c feat: enhance media data management by adding support for audio, video, and image metadata extraction, update database schema, and improve file query operations 2025-11-12 22:20:43 -08:00
Jamie Pine
9f82071de4 feat: update Tauri app configuration with new asset protocol and permissions, enhance file path resolution, and improve volume management caching 2025-11-12 05:38:54 -08:00
Jamie Pine
b1dcb59076 feat: implement Identifiable trait for File resource, enhancing cache management and resolving frontend hacks 2025-11-12 04:00:51 -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
8d61dc1139 feat: implement thumbnail generation for linked content identities and improve logging in responder 2025-11-11 07:07:06 -08:00
Jamie Pine
4dde6524af chore: update subproject commits and enhance logging configuration with multi-stream support 2025-11-11 06:55:17 -08:00
Jamie Pine
b71072f065 feat: add context menu support and enhance drag demo with context menu functionality 2025-11-11 03:03:37 -08:00