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

Generated by: LCOV version 2.1-beta