Skip to main content

coven_database/store/store_session/test_support/
blob.rs

1use super::*;
2
3impl StoreDatabase {
4    pub async fn replace_blob_row_stamp_for_test(
5        &self,
6        table: &str,
7        row_id: &str,
8        stamp: &str,
9    ) -> Result<(), DbError> {
10        let table = table.to_string();
11        let row_id = row_id.to_string();
12        let stamp = stamp.to_string();
13        self.call_store(move |session| {
14            session.replace_blob_row_stamp_for_test(&table, &row_id, &stamp)
15        })
16        .await
17    }
18
19    pub async fn replace_blob_row_facts_for_test(
20        &self,
21        table: &str,
22        row_id: &str,
23        size: i64,
24        hash: &str,
25        stamp: &str,
26    ) -> Result<(), DbError> {
27        let table = table.to_string();
28        let row_id = row_id.to_string();
29        let hash = hash.to_string();
30        let stamp = stamp.to_string();
31        self.call_store(move |session| {
32            session.replace_blob_row_facts_for_test(&table, &row_id, size, &hash, &stamp)
33        })
34        .await
35    }
36
37    pub async fn complete_note_blob_transition_to_remote_for_test(
38        &self,
39        reference: coven_protocol::blob::RowBlobRef,
40        note_id: String,
41    ) -> Result<(), DbError> {
42        self.call_store(move |session| {
43            session.complete_note_blob_transition_to_remote_for_test(&reference, &note_id)
44        })
45        .await
46    }
47
48    pub async fn plant_blob_namespace_collision_for_test(
49        &self,
50        id: &str,
51        local_hash: &str,
52        remote_hash: &str,
53    ) -> Result<(), DbError> {
54        let id = id.to_string();
55        let local_hash = local_hash.to_string();
56        let remote_hash = remote_hash.to_string();
57        self.call_store(move |session| {
58            session.plant_blob_namespace_collision_for_test(&id, &local_hash, &remote_hash)
59        })
60        .await
61    }
62
63    pub async fn plant_note_cover_blob_row_for_test(
64        &self,
65        id: &str,
66        note_id: &str,
67        size: i64,
68        hash: &str,
69    ) -> Result<(), DbError> {
70        let id = id.to_string();
71        let note_id = note_id.to_string();
72        let hash = hash.to_string();
73        self.call_store(move |session| {
74            session.plant_note_cover_blob_row_for_test(&id, &note_id, size, &hash)
75        })
76        .await
77    }
78}