pub struct SyncPlugin<FS: AsyncFileSystem + Clone> { /* private fields */ }Expand description
Plugin that owns all CRDT state and handles sync commands.
Generic over FS (filesystem), but erased to Arc<dyn WorkspacePlugin> at registration.
The FS: Clone bound is required for constructing Workspace<FS> and Exporter<FS>.
Implementations§
Source§impl<FS: AsyncFileSystem + Clone + 'static> SyncPlugin<FS>
impl<FS: AsyncFileSystem + Clone + 'static> SyncPlugin<FS>
Sourcepub fn new(fs: FS, storage: Arc<dyn CrdtStorage>) -> Self
pub fn new(fs: FS, storage: Arc<dyn CrdtStorage>) -> Self
Create with fresh empty CRDT state.
Sourcepub fn load(fs: FS, storage: Arc<dyn CrdtStorage>) -> CoreResult<Self>
pub fn load(fs: FS, storage: Arc<dyn CrdtStorage>) -> CoreResult<Self>
Create by loading existing CRDT state from storage.
Sourcepub fn with_instances(
fs: FS,
workspace_crdt: Arc<WorkspaceCrdt>,
body_docs: Arc<BodyDocManager>,
storage: Arc<dyn CrdtStorage>,
) -> Self
pub fn with_instances( fs: FS, workspace_crdt: Arc<WorkspaceCrdt>, body_docs: Arc<BodyDocManager>, storage: Arc<dyn CrdtStorage>, ) -> Self
Create with pre-configured CRDT instances.
Use this when consumers need Arc handles for event callbacks before
plugin registration (e.g., the WASM backend).
Sourcepub fn workspace_crdt(&self) -> Arc<WorkspaceCrdt>
pub fn workspace_crdt(&self) -> Arc<WorkspaceCrdt>
Get the workspace CRDT handle.
Sourcepub fn body_docs(&self) -> Arc<BodyDocManager>
pub fn body_docs(&self) -> Arc<BodyDocManager>
Get the body document manager handle.
Sourcepub fn sync_handler(&self) -> Arc<SyncHandler<FS>>
pub fn sync_handler(&self) -> Arc<SyncHandler<FS>>
Get the sync handler handle.
Sourcepub fn sync_manager(&self) -> Arc<RustSyncManager<FS>>
pub fn sync_manager(&self) -> Arc<RustSyncManager<FS>>
Get the sync manager handle.
Sourcepub fn storage(&self) -> Arc<dyn CrdtStorage>
pub fn storage(&self) -> Arc<dyn CrdtStorage>
Get the storage handle.
Trait Implementations§
Source§impl<FS: AsyncFileSystem + Clone + Send + Sync + 'static> Plugin for SyncPlugin<FS>
impl<FS: AsyncFileSystem + Clone + Send + Sync + 'static> Plugin for SyncPlugin<FS>
Source§fn manifest(&self) -> PluginManifest
fn manifest(&self) -> PluginManifest
Declarative manifest describing this plugin’s metadata and UI contributions.
Source§impl<FS: AsyncFileSystem + Clone + Send + Sync + 'static> WorkspacePlugin for SyncPlugin<FS>
impl<FS: AsyncFileSystem + Clone + Send + Sync + 'static> WorkspacePlugin for SyncPlugin<FS>
Source§fn on_workspace_opened<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceOpenedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_workspace_opened<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceOpenedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when a workspace is opened.
Source§fn handle_command<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 str,
params: JsonValue,
) -> Pin<Box<dyn Future<Output = Option<Result<JsonValue, PluginError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_command<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 str,
params: JsonValue,
) -> Pin<Box<dyn Future<Output = Option<Result<JsonValue, PluginError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle a plugin-specific command. Read more
Source§fn notify_workspace_modified<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn notify_workspace_modified<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Called after a workspace-modifying operation completes. Read more
Source§fn on_body_doc_renamed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
old_path: &'life1 str,
new_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_body_doc_renamed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
old_path: &'life1 str,
new_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when a body document needs to be renamed (file was moved/renamed). Read more
Source§fn on_body_doc_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_body_doc_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when a body document should be deleted. Read more
Source§fn track_file_for_sync<'life0, 'life1, 'async_trait>(
&'life0 self,
canonical_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn track_file_for_sync<'life0, 'life1, 'async_trait>(
&'life0 self,
canonical_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called after a file operation to track CRDT metadata for echo detection. Read more
Source§fn get_canonical_path(&self, storage_path: &str) -> Option<String>
fn get_canonical_path(&self, storage_path: &str) -> Option<String>
Resolve a canonical path from a storage path. Read more
Source§fn track_content_for_sync(&self, canonical_path: &str, content: &str)
fn track_content_for_sync(&self, canonical_path: &str, content: &str)
Track body content for echo detection. Read more
Source§fn get_file_title(&self, canonical_path: &str) -> Option<String>
fn get_file_title(&self, canonical_path: &str) -> Option<String>
Get the title for a file from CRDT metadata. Read more
Source§fn on_workspace_closed<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceClosedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn on_workspace_closed<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceClosedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Called when a workspace is closed.
Source§fn on_workspace_changed<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceChangedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn on_workspace_changed<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceChangedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Called when workspace metadata changes.
Source§fn on_workspace_committed<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceCommittedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn on_workspace_committed<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 WorkspaceCommittedEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Called when a workspace is committed (e.g., git commit or sync checkpoint).
Auto Trait Implementations§
impl<FS> !Freeze for SyncPlugin<FS>
impl<FS> !RefUnwindSafe for SyncPlugin<FS>
impl<FS> Send for SyncPlugin<FS>
impl<FS> Sync for SyncPlugin<FS>
impl<FS> Unpin for SyncPlugin<FS>where
FS: Unpin,
impl<FS> UnsafeUnpin for SyncPlugin<FS>where
FS: UnsafeUnpin,
impl<FS> !UnwindSafe for SyncPlugin<FS>
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
Mutably borrows from an owned value. Read more