Source: factory.core/ObjDocumentStore.py
TTL calculation mode for file age determination.
Statistics for mirror operation.
| Method | Signature | Description |
|---|---|---|
| total_synced | total_synced() -> int |
Return total files synced in both directions. |
Document store management for archival and lifecycle operations.
Handles batch document movement based on TTL settings:
| Method | Signature | Description |
|---|---|---|
| set_test_folders | set_test_folders(cls, local: str = None, data: str = None, archive: str = None) -> None |
Configure test folder paths (call before tests). |
| clear_test_folders | clear_test_folders(cls) -> None |
Reset to production folders. |
| parse_document_path | parse_document_path(file_path: str) -> Tuple[str, str, str, str] |
Extract docname, context, context2, and folder from a file path. |
| track_mirrored | track_mirrored(docname: str, context: str = '', context2: str = '', folder: str = '') -> bool |
Mark a file as mirrored in data_documentfile. |
| track_archived | track_archived(docname: str, context: str = '', context2: str = '', folder: str = '') -> bool |
Mark a file as archived in data_documentfile. |
| track_deleted | track_deleted(docname: str, context: str = '', context2: str = '') -> bool |
Mark a file as deleted in data_documentfile. |
| track_file_event | track_file_event(file_path: str, event: str) -> bool |
Track a file event by parsing the path and updating the database. |
| get_file_date | get_file_date(file_path: str) -> str |
Extract date from filename or fall back to creation time. |
| get_day_elapsed | get_day_elapsed(date_string: str) -> int |
Calculate days elapsed from a date string in YYYYMMDD format. |
| is_file_expired | is_file_expired(file_path: str, ttl_days: int, mode: TtlMode = TtlMode.DATE_BASED) -> bool |
Check if a file has exceeded its TTL. |
| zip_file | zip_file(file_path: str) -> None |
Zip a file using 7z and remove the original upon success. |
| zip_folder | zip_folder(folder_path: str) -> None |
Zip all uncompressed files in a folder. |
| move_file | move_file(source_dir: str, dest_dir: str, ttl_days: int, mode: TtlMode = TtlMode.DATE_BASED) -> int |
Move expired files from source to destination directory. |
| move | move(doc_configs: List[Dict[str, Any]], step: int = 0, mode: TtlMode = TtlMode.DATE_BASED) -> int |
Move documents based on configuration and step. |
| move_documents | move_documents(mode: TtlMode = TtlMode.TIMESTAMP_BASED) -> int |
Move documents based on TTL settings from def_document table. |
| sync_file | sync_file(source_path: str, target_path: str, ttl_days: int, mode: TtlMode = TtlMode.TIMESTAMP_BASED) -> Tuple[str, bool] |
Sync a single file between source and target locations. |
| mirror_folder | mirror_folder(folder_name: str, source_base: str = None, target_base: str = None, ttl_days: int = 0, mode: TtlMode = TtlMode.TIMESTAMP_BASED, delete_expired: bool = True) -> MirrorStats |
Mirror a folder between source and target locations. |
| mirror_documents | mirror_documents(mode: TtlMode = TtlMode.TIMESTAMP_BASED) -> MirrorStats |
Mirror documents based on TTL settings from def_document table. |
| enforce_min_ttl | enforce_min_ttl(ttl_days: int) -> int |
Enforce minimum TTL of 1 day. |
| purge_folder | purge_folder(folder_path: str, ttl_days: int, mode: TtlMode = TtlMode.TIMESTAMP_BASED) -> Tuple[int, int] |
Purge expired files from a folder. |
| purge_archived_documents | purge_archived_documents(mode: TtlMode = TtlMode.TIMESTAMP_BASED) -> Tuple[int, int] |
Purge archived documents based on ArchiveTTL from def_document. |
| purge_permanent | purge_permanent(mode: TtlMode = TtlMode.TIMESTAMP_BASED) -> Tuple[int, int] |
Permanently purge documents based on PurgeTTL from def_document. |
| rebuild_folder_icons | rebuild_folder_icons(folder_path: str, force: bool = False) -> Tuple[int, int, int] |
Scan a folder and generate icons and previews for files |
| lifecycle_run | lifecycle_run(mode: TtlMode = TtlMode.TIMESTAMP_BASED) -> Dict[str, Any] |
Run full document lifecycle management. |
Move old documents based on TTLs in def_document.
Mirror a folder between source and target locations.
Mirror all document folders based on def_document configuration.
Purge expired documents from data.documents based on ArchiveTTL.
Permanently delete documents from archive based on PurgeTTL.
Run full document lifecycle management.
Scan a folder and generate icons for files that are missing them.