pub struct SyncService<'a> { /* private fields */ }Expand description
Synchronization service - bridges filesystem and database
Implementations§
Source§impl<'a> SyncService<'a>
impl<'a> SyncService<'a>
pub fn new(db_service: &'a mut DatabaseService) -> Self
Sourcepub fn with_workspace_dir(self, workspace_dir: &'a Path) -> Self
pub fn with_workspace_dir(self, workspace_dir: &'a Path) -> Self
Set the workspace directory for lineage extraction Note: We store the original path reference without canonicalizing here because canonicalization requires owned PathBuf. The caller should ensure paths are properly resolved when needed.
Sourcepub async fn import_from_file<P: AsRef<Path>>(
&mut self,
file_path: P,
) -> Result<Document>
pub async fn import_from_file<P: AsRef<Path>>( &mut self, file_path: P, ) -> Result<Document>
Direction 1: File → DocumentObject → Database Load a document from filesystem and store in database
Sourcepub async fn export_to_file(&mut self, filepath: &str) -> Result<()>
pub async fn export_to_file(&mut self, filepath: &str) -> Result<()>
Direction 2: Database → DocumentObject → File Export a document from database to filesystem
Sourcepub async fn sync_file<P: AsRef<Path>>(
&mut self,
file_path: P,
) -> Result<SyncResult>
pub async fn sync_file<P: AsRef<Path>>( &mut self, file_path: P, ) -> Result<SyncResult>
Synchronize a single file between filesystem and database using directional methods
Sourcepub async fn sync_directory<P: AsRef<Path>>(
&mut self,
dir_path: P,
) -> Result<Vec<SyncResult>>
pub async fn sync_directory<P: AsRef<Path>>( &mut self, dir_path: P, ) -> Result<Vec<SyncResult>>
Sync all markdown files in a directory
Sourcepub fn verify_sync<P: AsRef<Path>>(
&mut self,
dir_path: P,
) -> Result<Vec<SyncIssue>>
pub fn verify_sync<P: AsRef<Path>>( &mut self, dir_path: P, ) -> Result<Vec<SyncIssue>>
Verify database and filesystem are in sync
Sourcepub fn recover_counters_from_filesystem<P: AsRef<Path>>(
&self,
dir_path: P,
) -> Result<HashMap<String, u32>>
pub fn recover_counters_from_filesystem<P: AsRef<Path>>( &self, dir_path: P, ) -> Result<HashMap<String, u32>>
Recover short code counters from filesystem by scanning all documents
This should only be called when:
- Database is missing or corrupt
- Explicit recovery is requested by user
Returns a map of document type to the highest counter found
Auto Trait Implementations§
impl<'a> Freeze for SyncService<'a>
impl<'a> !RefUnwindSafe for SyncService<'a>
impl<'a> Send for SyncService<'a>
impl<'a> !Sync for SyncService<'a>
impl<'a> Unpin for SyncService<'a>
impl<'a> !UnwindSafe for SyncService<'a>
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for 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> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read more