pub struct ThreadStorage { /* private fields */ }Expand description
Main storage manager for threads and content-addressed objects.
Implementations§
Source§impl ThreadStorage
impl ThreadStorage
Sourcepub fn store_image(
&self,
bytes: &[u8],
explicit_tone: Option<String>,
) -> Result<StoredImage>
pub fn store_image( &self, bytes: &[u8], explicit_tone: Option<String>, ) -> Result<StoredImage>
Store image bytes using content-addressable storage.
Returns the hash and path to the stored image. If the image already exists with the same hash, returns the existing path.
Sourcepub fn store_image_from_path(
&self,
path: &str,
explicit_tone: Option<String>,
) -> Result<StoredImage>
pub fn store_image_from_path( &self, path: &str, explicit_tone: Option<String>, ) -> Result<StoredImage>
Store an image from a file path.
Sourcepub fn store_file(
&self,
bytes: &[u8],
extension: &str,
explicit_tone: Option<String>,
) -> Result<StoredImage>
pub fn store_file( &self, bytes: &[u8], extension: &str, explicit_tone: Option<String>, ) -> Result<StoredImage>
Store a generic file using content-addressable storage, preserving the extension.
pub fn object_dir(&self, hash: &str) -> Result<PathBuf>
pub fn load_document_conversion( &self, source_hash: &str, source_extension: &str, ) -> Result<Option<DocumentConversion>>
pub fn save_document_conversion( &self, conversion: &DocumentConversion, ) -> Result<()>
pub fn object_manifest_path(&self, hash: &str) -> Result<PathBuf>
pub fn find_object_blob(&self, hash: &str) -> Result<PathBuf>
pub fn load_object_manifest(&self, hash: &str) -> Result<ObjectManifest>
pub fn save_object_manifest( &self, hash: &str, manifest: &ObjectManifest, ) -> Result<()>
pub fn lock_object_manifest(&self, hash: &str) -> Result<ObjectManifestLock>
pub fn has_object_remotes(&self) -> Result<bool>
Sourcepub fn get_image_path(&self, hash: &str) -> Result<String>
pub fn get_image_path(&self, hash: &str) -> Result<String>
Get the canonical blob path by hash.
Sourcepub fn get_image_tone(&self, hash: &str) -> Option<String>
pub fn get_image_tone(&self, hash: &str) -> Option<String>
Get the cached tone for a stored image by hash.
pub fn get_reverse_image_search_cache( &self, hash: &str, ) -> Result<Option<ReverseImageSearchCache>>
pub fn save_reverse_image_search_cache( &self, hash: &str, imgbb_url: String, google_lens_url: String, ) -> Result<()>
Source§impl ThreadStorage
impl ThreadStorage
pub fn create_workspace( &self, name: &str, directories: &[String], ) -> Result<WorkspaceMetadata>
pub fn update_workspace( &self, workspace_id: &str, name: &str, directories: &[String], ) -> Result<WorkspaceMetadata>
pub fn delete_workspace(&self, workspace_id: &str) -> Result<()>
pub fn get_thread_workspace_id(&self, thread_id: &str) -> Result<Option<String>>
pub fn list_sidechat_threads(&self) -> Result<Vec<SideChatMetadata>>
Sourcepub fn group_threads(
&self,
first_id: &str,
second_id: &str,
) -> Result<WorkspaceMetadata>
pub fn group_threads( &self, first_id: &str, second_id: &str, ) -> Result<WorkspaceMetadata>
Group two unassigned threads in one catalog write.
pub fn list_unassigned_threads(&self) -> Result<Vec<ThreadMetadata>>
Source§impl ThreadStorage
impl ThreadStorage
pub fn attachment_manifest_entry( &self, attachment_hash: &str, display_name: &str, last_mention_at: DateTime<Utc>, ) -> Result<AttachmentManifestEntry>
pub fn save_thread(&self, thread: &ThreadData) -> Result<()>
pub fn save_thread_in_workspace( &self, thread: &ThreadData, workspace_id: &str, ) -> Result<()>
pub fn save_sidechat(&self, sidechat: &SideChatData) -> Result<()>
pub fn load_sidechat(&self, sidechat_id: &str) -> Result<SideChatData>
pub fn update_sidechat_metadata( &self, metadata: &SideChatMetadata, ) -> Result<()>
pub fn delete_sidechat(&self, sidechat_id: &str) -> Result<()>
pub fn fork_sidechat_latest( &self, sidechat_id: &str, ) -> Result<SideChatMetadata>
pub fn set_thread_workspace( &self, thread_id: &str, workspace_id: Option<&str>, ) -> Result<()>
pub fn load_thread(&self, thread_id: &str) -> Result<ThreadData>
pub fn load_messages(&self, thread_id: &str) -> Result<Vec<ThreadMessage>>
pub fn list_threads(&self) -> Result<Vec<ThreadMetadata>>
pub fn list_workspaces(&self) -> Result<Vec<WorkspaceMetadata>>
pub fn delete_thread(&self, thread_id: &str) -> Result<()>
pub fn delete_threads(&self, thread_ids: &[String]) -> Result<()>
pub fn fork_thread_latest(&self, thread_id: &str) -> Result<ThreadMetadata>
pub fn update_thread_metadata(&self, metadata: &ThreadMetadata) -> Result<()>
Source§impl ThreadStorage
impl ThreadStorage
Sourcepub fn save_ocr_data(
&self,
thread_id: &str,
model_id: &str,
ocr_data: &[OcrRegion],
) -> Result<()>
pub fn save_ocr_data( &self, thread_id: &str, model_id: &str, ocr_data: &[OcrRegion], ) -> Result<()>
Save OCR data for a specific model into the thread’s OCR annotations.
Sourcepub fn get_ocr_annotations(&self, thread_id: &str) -> Result<OcrAnnotations>
pub fn get_ocr_annotations(&self, thread_id: &str) -> Result<OcrAnnotations>
Get the entire OCR annotations for a thread.
Source§impl ThreadStorage
impl ThreadStorage
pub fn with_config_root(config_root: PathBuf) -> Result<Self>
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new storage manager using the default global thread location.
Sourcepub fn objects_dir(&self) -> &PathBuf
pub fn objects_dir(&self) -> &PathBuf
Get the objects directory path.
Auto Trait Implementations§
impl Freeze for ThreadStorage
impl RefUnwindSafe for ThreadStorage
impl Send for ThreadStorage
impl Sync for ThreadStorage
impl Unpin for ThreadStorage
impl UnsafeUnpin for ThreadStorage
impl UnwindSafe for ThreadStorage
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