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

Generated by: LCOV version 2.1-beta