Skip to main content

ThreadStorage

Struct ThreadStorage 

Source
pub struct ThreadStorage { /* private fields */ }
Expand description

Main storage manager for threads and content-addressed objects.

Implementations§

Source§

impl ThreadStorage

Source

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.

Source

pub fn store_image_from_path( &self, path: &str, explicit_tone: Option<String>, ) -> Result<StoredImage>

Store an image from a file path.

Source

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.

Source

pub fn object_dir(&self, hash: &str) -> Result<PathBuf>

Source

pub fn load_document_conversion( &self, source_hash: &str, source_extension: &str, ) -> Result<Option<DocumentConversion>>

Source

pub fn save_document_conversion( &self, conversion: &DocumentConversion, ) -> Result<()>

Source

pub fn object_manifest_path(&self, hash: &str) -> Result<PathBuf>

Source

pub fn find_object_blob(&self, hash: &str) -> Result<PathBuf>

Source

pub fn load_object_manifest(&self, hash: &str) -> Result<ObjectManifest>

Source

pub fn save_object_manifest( &self, hash: &str, manifest: &ObjectManifest, ) -> Result<()>

Source

pub fn lock_object_manifest(&self, hash: &str) -> Result<ObjectManifestLock>

Source

pub fn has_object_remotes(&self) -> Result<bool>

Source

pub fn get_image_path(&self, hash: &str) -> Result<String>

Get the canonical blob path by hash.

Source

pub fn get_image_tone(&self, hash: &str) -> Option<String>

Get the cached tone for a stored image by hash.

Source

pub fn get_reverse_image_search_cache( &self, hash: &str, ) -> Result<Option<ReverseImageSearchCache>>

Source

pub fn save_reverse_image_search_cache( &self, hash: &str, imgbb_url: String, google_lens_url: String, ) -> Result<()>

Source§

impl ThreadStorage

Source

pub fn create_workspace( &self, name: &str, directories: &[String], ) -> Result<WorkspaceMetadata>

Source

pub fn update_workspace( &self, workspace_id: &str, name: &str, directories: &[String], ) -> Result<WorkspaceMetadata>

Source

pub fn delete_workspace(&self, workspace_id: &str) -> Result<()>

Source

pub fn get_thread_workspace_id(&self, thread_id: &str) -> Result<Option<String>>

Source

pub fn list_sidechat_threads(&self) -> Result<Vec<SideChatMetadata>>

Source

pub fn group_threads( &self, first_id: &str, second_id: &str, ) -> Result<WorkspaceMetadata>

Group two unassigned threads in one catalog write.

Source

pub fn list_unassigned_threads(&self) -> Result<Vec<ThreadMetadata>>

Source§

impl ThreadStorage

Source

pub fn attachment_manifest_entry( &self, attachment_hash: &str, display_name: &str, last_mention_at: DateTime<Utc>, ) -> Result<AttachmentManifestEntry>

Source

pub fn save_thread(&self, thread: &ThreadData) -> Result<()>

Source

pub fn save_thread_in_workspace( &self, thread: &ThreadData, workspace_id: &str, ) -> Result<()>

Source

pub fn save_sidechat(&self, sidechat: &SideChatData) -> Result<()>

Source

pub fn load_sidechat(&self, sidechat_id: &str) -> Result<SideChatData>

Source

pub fn update_sidechat_metadata( &self, metadata: &SideChatMetadata, ) -> Result<()>

Source

pub fn delete_sidechat(&self, sidechat_id: &str) -> Result<()>

Source

pub fn fork_sidechat_latest( &self, sidechat_id: &str, ) -> Result<SideChatMetadata>

Source

pub fn set_thread_workspace( &self, thread_id: &str, workspace_id: Option<&str>, ) -> Result<()>

Source

pub fn load_thread(&self, thread_id: &str) -> Result<ThreadData>

Source

pub fn load_messages(&self, thread_id: &str) -> Result<Vec<ThreadMessage>>

Source

pub fn list_threads(&self) -> Result<Vec<ThreadMetadata>>

Source

pub fn list_workspaces(&self) -> Result<Vec<WorkspaceMetadata>>

Source

pub fn delete_thread(&self, thread_id: &str) -> Result<()>

Source

pub fn delete_threads(&self, thread_ids: &[String]) -> Result<()>

Source

pub fn fork_thread_latest(&self, thread_id: &str) -> Result<ThreadMetadata>

Source

pub fn update_thread_metadata(&self, metadata: &ThreadMetadata) -> Result<()>

Source§

impl ThreadStorage

Source

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.

Source

pub fn get_ocr_annotations(&self, thread_id: &str) -> Result<OcrAnnotations>

Get the entire OCR annotations for a thread.

Source§

impl ThreadStorage

Source

pub fn with_config_root(config_root: PathBuf) -> Result<Self>

Source

pub fn new() -> Result<Self>

Create a new storage manager using the default global thread location.

Source

pub fn base_dir(&self) -> &PathBuf

Get the base storage directory path.

Source

pub fn objects_dir(&self) -> &PathBuf

Get the objects directory path.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.