Struct edjx::StorageResponsePending
source · pub struct StorageResponsePending { /* private fields */ }
Expand description
StorageResponsePending
is a placeholder for the EDJX Object Store’s
response. It is returned when crate::storage::put_streaming
is called.
It is used to retrive a StorageResponse
once it is ready.
Implementations§
source§impl StorageResponsePending
impl StorageResponsePending
sourcepub fn new(stream_desc: u32) -> Self
pub fn new(stream_desc: u32) -> Self
Examples found in repository?
src/storage.rs (line 253)
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
pub fn put_streaming<B, FN, A>(
bucket_id: B,
file_name: FN,
properties: A,
) -> Result<(StorageResponsePending, WriteStream), StorageError>
where
B: AsRef<str>,
FN: AsRef<str>,
A: AsRef<str>,
{
let bucket_id_str = bucket_id.as_ref();
let file_name_str = file_name.as_ref();
let attributes_data = properties.as_ref();
if file_name_str.trim().is_empty() {
return Err(StorageError::MissingFileName);
}
if bucket_id_str.trim().is_empty() {
return Err(StorageError::MissingBucketID);
}
let mut error_code: i32 = 0;
let mut sd: u32 = 0;
let response_value = unsafe {
host_storage_put_streaming(
bucket_id_str.as_ptr(),
bucket_id_str.len() as u32,
file_name_str.as_ptr(),
file_name_str.len() as u32,
attributes_data.as_ptr(),
attributes_data.len() as u32,
&mut sd,
&mut error_code,
)
};
if response_value < 0 {
return Err(StorageError::from(Error::from_i32(error_code).unwrap()));
}
Ok((StorageResponsePending::new(sd), BaseStream::new(sd)))
}
sourcepub fn get_storage_response(&self) -> Result<StorageResponse, StorageError>
pub fn get_storage_response(&self) -> Result<StorageResponse, StorageError>
This function is used to to retrive a StorageResponse