MCPcopy Create free account
hub / github.com/Moosync/Moosync / write_to_indexed_db

Function write_to_indexed_db

src/utils/db_utils.rs:385–402  ·  view source on GitHub ↗
(
    db: &Database,
    store: &str,
    key: &str,
    value: Vec<u8>,
)

Source from the content-addressed store, hash-verified

383
384#[tracing::instrument(level = "debug", skip(db, store, value))]
385pub async fn write_to_indexed_db(
386 db: &Database,
387 store: &str,
388 key: &str,
389 value: Vec<u8>,
390) -> Result<(), DomException> {
391 let tx = db
392 .transaction(store)
393 .with_mode(IdbTransactionMode::Readwrite)
394 .build()
395 .unwrap();
396 let store = tx.object_store(store).unwrap();
397 store.put(value).with_key(key).await.unwrap();
398 tx.commit().await.unwrap();
399 tracing::debug!("Wrote to indexed db");
400
401 Ok(())
402}
403
404#[tracing::instrument(level = "debug", skip(db, store, key))]
405pub async fn read_from_indexed_db(

Callers 1

dump_storeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected