LCOV - code coverage report
Current view: top level - pageserver/src/virtual_file - metadata.rs (source / functions) Coverage Total Hit
Test: b4ae4c4857f9ef3e144e982a35ee23bc84c71983.info Lines: 100.0 % 11 11
Test Date: 2024-10-22 22:13:45 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          846 :     fn from(value: Box<tokio_epoll_uring::ops::statx::statx>) -> Self {
      12          846 :         Metadata::TokioEpollUring(value)
      13          846 :     }
      14              : }
      15              : 
      16              : impl From<std::fs::Metadata> for Metadata {
      17          846 :     fn from(value: std::fs::Metadata) -> Self {
      18          846 :         Metadata::StdFs(value)
      19          846 :     }
      20              : }
      21              : 
      22              : impl Metadata {
      23         3088 :     pub fn len(&self) -> u64 {
      24         3088 :         match self {
      25         1544 :             Metadata::StdFs(metadata) => metadata.len(),
      26              :             #[cfg(target_os = "linux")]
      27         1544 :             Metadata::TokioEpollUring(statx) => statx.stx_size,
      28              :         }
      29         3088 :     }
      30              : }
        

Generated by: LCOV version 2.1-beta