MCPcopy Create free account
hub / github.com/ceramicnetwork/rust-ceramic / put

Method put

event-svc/src/store/sql/root.rs:29–44  ·  view source on GitHub ↗

Store tx_hash, root, and timestamp in roots.

(
        &self,
        tx_hash: &[u8],
        root: &[u8],
        block_hash: String, // 0xhex_hash
        timestamp: i64,
    )

Source from the content-addressed store, hash-verified

27
28 /// Store tx_hash, root, and timestamp in roots.
29 pub async fn put(
30 &self,
31 tx_hash: &[u8],
32 root: &[u8],
33 block_hash: String, // 0xhex_hash
34 timestamp: i64,
35 ) -> Result<()> {
36 let _ = sqlx::query(PUT_QUERY)
37 .bind(tx_hash)
38 .bind(root)
39 .bind(block_hash)
40 .bind(timestamp)
41 .execute(self.pool.writer())
42 .await?;
43 Ok(())
44 }
45
46 /// Get the transaction timestamp from the roots table.
47 pub async fn get(&self, tx_hash: &[u8]) -> Result<Option<i64>> {

Callers 8

encodeRawEventFunction · 0.45
signedEventToCARFunction · 0.45
encodeEventToCARFunction · 0.45
createCARFunction · 0.45
test_store_blockFunction · 0.45
test_double_store_blockFunction · 0.45
eth_block_by_hashMethod · 0.45

Calls 2

writerMethod · 0.80
executeMethod · 0.45

Tested by 2

test_store_blockFunction · 0.36
test_double_store_blockFunction · 0.36