Skip to content

Commit e2eb9dc

Browse files
committed
Add async wrapper for rados_aio_stat()
1 parent 8267f73 commit e2eb9dc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/ceph.rs

+23
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,29 @@ impl IoCtx {
10621062
.await
10631063
}
10641064

1065+
/// Get object stats (size,SystemTime)
1066+
pub async fn rados_async_object_stat(
1067+
&self,
1068+
object_name: &str,
1069+
) -> RadosResult<(u64, SystemTime)> {
1070+
self.ioctx_guard()?;
1071+
let object_name_str = CString::new(object_name)?;
1072+
let mut psize: u64 = 0;
1073+
let mut time: ::libc::time_t = 0;
1074+
1075+
with_completion(self, |c| unsafe {
1076+
rados_aio_stat(
1077+
self.ioctx,
1078+
object_name_str.as_ptr(),
1079+
c,
1080+
&mut psize,
1081+
&mut time,
1082+
)
1083+
})?
1084+
.await?;
1085+
Ok((psize, (UNIX_EPOCH + Duration::from_secs(time as u64))))
1086+
}
1087+
10651088
/// Efficiently copy a portion of one object to another
10661089
/// If the underlying filesystem on the OSD supports it, this will be a
10671090
/// copy-on-write clone.

0 commit comments

Comments
 (0)