Skip to main content

DbReader

Struct DbReader 

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

Thin wrapper around a rusqlite connection opened read-only against Cursor’s state.vscdb.

Implementations§

Source§

impl DbReader

Source

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>

Open Cursor’s global state database read-only.

Source

pub fn path(&self) -> &Path

Source

pub fn read_composer_headers(&self) -> Result<ComposerHeaders>

Read ItemTable.composer.composerHeaders. Returns the parsed blob, or an empty ComposerHeaders when the key is missing.

Source

pub fn list_composer_ids(&self) -> Result<Vec<String>>

All composer ids known to the DB, in the order they appear in composer.composerHeaders.allComposers. Composers with no bubbles are included — call Self::composer_has_bubbles to filter drafts.

Source

pub fn read_composer_head( &self, composer_id: &str, ) -> Result<Option<ComposerHead>>

Look up one header by composer id, when present.

Source

pub fn read_composer_data( &self, composer_id: &str, ) -> Result<Option<ComposerData>>

Read cursorDiskKV.composerData:<composer_id>.

Source

pub fn read_bubble( &self, composer_id: &str, bubble_id: &str, ) -> Result<Option<Bubble>>

Read a single bubble by composer + bubble id. None when the row is absent (drafts referenced by header but never saved fall in this case).

Source

pub fn list_bubble_ids_for_composer( &self, composer_id: &str, ) -> Result<Vec<String>>

All bubble ids stored for a composer. The order from this function is not meaningful — combine with the composer’s fullConversationHeadersOnly to order them as the UI renders.

Source

pub fn composer_has_bubbles(&self, composer_id: &str) -> Result<bool>

Cheap “does this composer have any rendered bubbles?” check.

Source

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

Read a content-addressed file blob. hash is the substring after composer.content.. UTF-8 decoded; non-text blobs are returned as Some(<lossy>).

Source

pub fn load_session(&self, composer_id: &str) -> Result<CursorSession>

Compose a complete session: header (when present), data, and the bubble bodies in fullConversationHeadersOnly order (filtered to bubbles that actually exist on disk). Bubbles listed in the header manifest but missing from cursorDiskKV are silently skipped — they’re rendered as placeholders in the UI but carry no content.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.