MCPcopy Create free account
hub / github.com/BitVM/BitVM / fetch_compressed_data_by_key

Method fetch_compressed_data_by_key

bridge/src/client/data_store/data_store.rs:132–150  ·  view source on GitHub ↗
(
        &self,
        key: &str,
        file_path: Option<&str>,
    )

Source from the content-addressed store, hash-verified

130 }
131
132 pub async fn fetch_compressed_data_by_key(
133 &self,
134 key: &str,
135 file_path: Option<&str>,
136 ) -> Result<(Option<Vec<u8>>, usize), String> {
137 match self.get_driver() {
138 Ok(driver) => {
139 let json = driver.fetch_compressed_object(key, file_path).await;
140 if let Ok((data, size)) = json {
141 // println!("Fetched data file: {}", key);
142 return Ok((Some(data), size));
143 }
144
145 println!("No data file {} found", key);
146 Ok((None, 0))
147 }
148 Err(err) => Err(err.to_string()),
149 }
150 }
151
152 pub async fn write_compressed_data(
153 &self,

Callers 1

validate_data_by_keyMethod · 0.80

Calls 2

get_driverMethod · 0.80

Tested by

no test coverage detected