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
impl DbReader
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Open Cursor’s global state database read-only.
pub fn path(&self) -> &Path
Sourcepub fn read_composer_headers(&self) -> Result<ComposerHeaders>
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.
Sourcepub fn list_composer_ids(&self) -> Result<Vec<String>>
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.
Sourcepub fn read_composer_head(
&self,
composer_id: &str,
) -> Result<Option<ComposerHead>>
pub fn read_composer_head( &self, composer_id: &str, ) -> Result<Option<ComposerHead>>
Look up one header by composer id, when present.
Sourcepub fn read_composer_data(
&self,
composer_id: &str,
) -> Result<Option<ComposerData>>
pub fn read_composer_data( &self, composer_id: &str, ) -> Result<Option<ComposerData>>
Read cursorDiskKV.composerData:<composer_id>.
Sourcepub fn read_bubble(
&self,
composer_id: &str,
bubble_id: &str,
) -> Result<Option<Bubble>>
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).
Sourcepub fn list_bubble_ids_for_composer(
&self,
composer_id: &str,
) -> Result<Vec<String>>
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.
Sourcepub fn composer_has_bubbles(&self, composer_id: &str) -> Result<bool>
pub fn composer_has_bubbles(&self, composer_id: &str) -> Result<bool>
Cheap “does this composer have any rendered bubbles?” check.
Sourcepub fn read_content_blob(&self, hash: &str) -> Result<Option<String>>
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>).
Sourcepub fn load_session(&self, composer_id: &str) -> Result<CursorSession>
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.