(
&self,
contents: &Vec<u8>,
file_path: Option<&str>,
)
| 150 | } |
| 151 | |
| 152 | pub async fn write_compressed_data( |
| 153 | &self, |
| 154 | contents: &Vec<u8>, |
| 155 | file_path: Option<&str>, |
| 156 | ) -> Result<(String, usize), String> { |
| 157 | match self.get_driver() { |
| 158 | Ok(driver) => { |
| 159 | let time = SystemTime::now() |
| 160 | .duration_since(UNIX_EPOCH) |
| 161 | .unwrap() |
| 162 | .as_millis(); |
| 163 | let file_name = self.create_file_name(time); |
| 164 | let response = driver |
| 165 | .upload_compressed_object(&file_name, contents, file_path) |
| 166 | .await; |
| 167 | |
| 168 | match response { |
| 169 | Ok(size) => Ok((file_name, size)), |
| 170 | Err(_) => Err(String::from("Failed to save data file")), |
| 171 | } |
| 172 | } |
| 173 | Err(err) => Err(err.to_string()), |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | pub fn get_past_max_file_name_by_timestamp( |
| 178 | &self, |
no test coverage detected