LCOV - code coverage report
Current view: top level - flamenco/snapshot - fd_snapshot_loader.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 2 0.0 %
Date: 2025-03-20 12:08:36 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_flamenco_snapshot_fd_snapshot_loader_h
       2             : #define HEADER_fd_src_flamenco_snapshot_fd_snapshot_loader_h
       3             : 
       4             : /* fd_snapshot_loader.h provides APIs for constructing the upstream
       5             :    parts of the snapshot loading pipeline.
       6             : 
       7             :     read => unzstd => untar => restore
       8             :     ^^^^^^^^^^^^^^^^^^^^^^^
       9             : 
      10             :    This header provides high-level APIs for streaming loading of a
      11             :    snapshot from the local file system or over HTTP (regular sockets).
      12             :    The loader is currently a single-threaded streaming pipeline.  This
      13             :    is subject to change to the tile architecture in the future. */
      14             : 
      15             : #include "fd_snapshot.h"
      16             : #include "fd_snapshot_istream.h"
      17             : #include "fd_snapshot_restore.h"
      18             : 
      19             : /* FD_SNAPSHOT_SRC_{...} specifies the type of snapshot source. */
      20             : 
      21           0 : #define FD_SNAPSHOT_SRC_FILE    (1)
      22           0 : #define FD_SNAPSHOT_SRC_HTTP    (2)
      23             : 
      24             : /* fd_snapshot_src_t specifies the snapshot source. */
      25             : 
      26             : FD_PROTOTYPES_BEGIN
      27             : 
      28             : /* fd_snapshot_loader_t manages file descriptors and buffers used during
      29             :    snapshot load. */
      30             : struct fd_snapshot_loader; 
      31             : typedef struct fd_snapshot_loader fd_snapshot_loader_t;
      32             : 
      33             : struct fd_snapshot_src {
      34             :   int type;
      35             :   union {
      36             : 
      37             :     struct {
      38             :       char const * path;
      39             :     } file;
      40             : 
      41             :     struct {
      42             :       char         dest[128];
      43             :       uint         ip4;
      44             :       ushort       port;
      45             :       char const * path;
      46             :       ulong        path_len;
      47             :     } http;
      48             : 
      49             :   };
      50             : };
      51             : 
      52             : typedef struct fd_snapshot_src fd_snapshot_src_t;
      53             : 
      54             : /* Constructor API for fd_snapshot_loader_t. */
      55             : 
      56             : ulong
      57             : fd_snapshot_loader_align( void );
      58             : 
      59             : ulong
      60             : fd_snapshot_loader_footprint( ulong zstd_window_sz );
      61             : 
      62             : fd_snapshot_loader_t *
      63             : fd_snapshot_loader_new( void * mem,
      64             :                         ulong  zstd_window_sz );
      65             : 
      66             : void *
      67             : fd_snapshot_loader_delete( fd_snapshot_loader_t * loader );
      68             : 
      69             : /* fd_snapshot_loader methods *****************************************/
      70             : 
      71             : /* fd_snapshot_loader_init configures a local join to the loader object
      72             :    to send data into the given restore object.  src describes the source
      73             :    of the snapshot (file system or HTTPS path). */
      74             : 
      75             : fd_snapshot_loader_t *
      76             : fd_snapshot_loader_init( fd_snapshot_loader_t *    loader,
      77             :                          fd_snapshot_restore_t *   restore,
      78             :                          fd_snapshot_src_t const * src,
      79             :                          ulong                     base_slot,
      80             :                          int                       validate_slot );
      81             : 
      82             : /* fd_snapshot_loader_advance polls the tar reader for data.  This data
      83             :    is synchronously passed down the pipeline (ending in a manifest
      84             :    callback and new funk record insertions).  This is the primary
      85             :    polling entrypoint into fd_snapshot_loader_t.  Returns 0 if advance
      86             :    was successful.  Returns -1 on successful EOF.  On failure, returns
      87             :    errno-compatible code and logs error. */
      88             : 
      89             : int
      90             : fd_snapshot_loader_advance( fd_snapshot_loader_t * loader );
      91             : 
      92             : FD_FN_CONST fd_snapshot_name_t const *  /* nullable */
      93             : fd_snapshot_loader_get_name( fd_snapshot_loader_t const * loader );
      94             : 
      95             : /* fd_snapshot_src_parse determines the snapshot source from the given
      96             :    cstr. */
      97             : 
      98             : fd_snapshot_src_t *
      99             : fd_snapshot_src_parse( fd_snapshot_src_t * src,
     100             :                        char *              cstr );
     101             : 
     102             : FD_PROTOTYPES_END
     103             : 
     104             : #endif /* HEADER_fd_src_flamenco_snapshot_fd_snapshot_loader_h */

Generated by: LCOV version 1.14