in src/fs.rs [350:390]
fn read(
&mut self,
_req: &Request,
inode: Inode,
_fh: u64,
offset: i64,
_size: u32,
_flags: i32,
_lock_owner: Option<u64>,
reply: ReplyData,
) {
debug!(
"Trying to read() {} on {} at offset {}",
_size, inode, offset
);
if let Some(obj) = self.inode_to_obj.read().unwrap().get(&inode) {
debug!(" Performing read for obj: {:#?}", obj);
let result = self.tokio_rt.block_on(async {
super::gcs::get_bytes_with_client(
&self.gcs_client,
obj,
offset as u64,
_size as u64,
)
.await
});
match result {
Ok(bytes) => {
reply.data(&bytes);
}
Err(e) => {
debug!(" get_bytes failed. Error {:#?}", e);
reply.error(EIO);
}
}
} else {
debug!(" failed to find the object for inode {}", inode);
reply.error(ENOENT);
}
}