pub struct Importer<'a> { /* private fields */ }Expand description
Importer for JSONL sync files.
The importer reads records from JSONL files and merges them into the local database using the specified merge strategy.
Implementations§
Source§impl<'a> Importer<'a>
impl<'a> Importer<'a>
Sourcepub fn new(storage: &'a mut SqliteStorage, strategy: MergeStrategy) -> Self
pub fn new(storage: &'a mut SqliteStorage, strategy: MergeStrategy) -> Self
Create a new importer with the specified merge strategy.
Sourcepub fn import(&mut self, path: &Path) -> SyncResult<ImportStats>
pub fn import(&mut self, path: &Path) -> SyncResult<ImportStats>
Import records from a JSONL file.
Each line in the file is parsed and merged into the local database. The merge strategy determines how conflicts are resolved.
§Errors
Returns an error if the file cannot be read or records are invalid.
Sourcepub fn import_all(&mut self, dir: &Path) -> SyncResult<ImportStats>
pub fn import_all(&mut self, dir: &Path) -> SyncResult<ImportStats>
Import all JSONL files from a directory.
Imports files in order: sessions, issues, context_items, memories, checkpoints. Then applies deletions last (to handle records that were created then deleted). Files that don’t exist are skipped.
§Errors
Returns an error if any file cannot be read.
Sourcepub fn import_deletions(&mut self, path: &Path) -> SyncResult<usize>
pub fn import_deletions(&mut self, path: &Path) -> SyncResult<usize>
Import deletions from a JSONL file.
Deletions are applied to the local database by removing the specified entities. This ensures that records deleted on one machine are deleted on all machines.
§Errors
Returns an error if the file cannot be read or deletions cannot be applied.
Auto Trait Implementations§
impl<'a> Freeze for Importer<'a>
impl<'a> !RefUnwindSafe for Importer<'a>
impl<'a> Send for Importer<'a>
impl<'a> !Sync for Importer<'a>
impl<'a> Unpin for Importer<'a>
impl<'a> UnsafeUnpin for Importer<'a>
impl<'a> !UnwindSafe for Importer<'a>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more