LCOV - code coverage report
Current view: top level - pageserver/src/virtual_file - metadata.rs (source / functions) Coverage Total Hit
Test: b9d67f908f91f00e353a27440ba89f642a869959.info Lines: 100.0 % 11 11
Test Date: 2024-11-19 21:44:13 Functions: 100.0 % 3 3

            Line data    Source code
       1              : use std::fs;
       2              : 
       3              : pub enum Metadata {
       4              :     StdFs(fs::Metadata),
       5              :     #[cfg(target_os = "linux")]
       6              :     TokioEpollUring(Box<tokio_epoll_uring::ops::statx::statx>),
       7              : }
       8              : 
       9              : #[cfg(target_os = "linux")]
      10              : impl From<Box<tokio_epoll_uring::ops::statx::statx>> for Metadata {
      11          866 :     fn from(value: Box<tokio_epoll_uring::ops::statx::statx>) -> Self {
      12          866 :         Metadata::TokioEpollUring(value)
      13          866 :     }
      14              : }
      15              : 
      16              : impl From<std::fs::Metadata> for Metadata {
      17          866 :     fn from(value: std::fs::Metadata) -> Self {
      18          866 :         Metadata::StdFs(value)
      19          866 :     }
      20              : }
      21              : 
      22              : impl Metadata {
      23         3146 :     pub fn len(&self) -> u64 {
      24         3146 :         match self {
      25         1573 :             Metadata::StdFs(metadata) => metadata.len(),
      26              :             #[cfg(target_os = "linux")]
      27         1573 :             Metadata::TokioEpollUring(statx) => statx.stx_size,
      28              :         }
      29         3146 :     }
      30              : }
        

Generated by: LCOV version 2.1-beta