LCOV - code coverage report
Current view: top level - discof/backup - fd_snapmk_tile.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 25 0.0 %
Date: 2026-10-22 18:10:43 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_discof_backup_fd_snapmk_tile_h
       2             : #define HEADER_fd_src_discof_backup_fd_snapmk_tile_h
       3             : 
       4             : /* fd_snapmk_tile.h specifies the snapmk tile ABI.
       5             :    The snapmk tile is the IPC entrypoint for snapshot production. */
       6             : 
       7             : #include "fd_backup.h"
       8             : #include "../../tango/fd_tango_base.h"
       9             : 
      10             : /* SNAPMK_STATE_* give the lifecycle states of the snapshot pipeline. */
      11             : 
      12           0 : #define SNAPMK_STATE_IDLE                 0 /* clean, waiting for job */
      13           0 : #define SNAPMK_STATE_START                1
      14           0 : #define SNAPMK_STATE_TAR_HEADERS          2
      15           0 : #define SNAPMK_STATE_MANIFEST             3 /* writing manifest */
      16           0 : #define SNAPMK_STATE_ACCDB_CACHE          4 /* writing cached accounts */
      17           0 : #define SNAPMK_STATE_ACCDB_CACHE_FLUSH    5 /* flushing cached accounts */
      18           0 : #define SNAPMK_STATE_ACCDB_CACHE_FINISH   6 /* wait for flush to complete */
      19           0 : #define SNAPMK_STATE_ACCDB_DISK           7 /* writing on-disk accounts */
      20           0 : #define SNAPMK_STATE_ACCDB_DISK_FLUSH     8 /* flushing on-disk accounts */
      21           0 : #define SNAPMK_STATE_ACCDB_DISK_FINISH    9 /* wait for flush to complete */
      22           0 : #define SNAPMK_STATE_ACCDB_DELTA         10 /* writing incremental accounts */
      23           0 : #define SNAPMK_STATE_ACCDB_DELTA_FLUSH   11 /* flushing incremental accounts */
      24           0 : #define SNAPMK_STATE_ACCDB_DELTA_FINISH  12 /* waiting for flush to complete */
      25           0 : #define SNAPMK_STATE_STATUS_CACHE        13 /* writing status cache */
      26           0 : #define SNAPMK_STATE_EOF_MARKER          14 /* writing tar EOF marker */
      27           0 : #define SNAPMK_STATE_DONE                15 /* done, notify replay tile */
      28           0 : #define SNAPMK_STATE_FAIL                16 /* error state, doing cleanup */
      29           0 : #define SNAPMK_STATE_SLEEP               17 /* sleep until FUTEX_WAKE */
      30           0 : #define SNAPMK_STATE_STARTUP             18 /* waiting for system startup */
      31           0 : #define SNAPMK_STATE_STARTUP_BURST       19 /* publish pre-existing snaps */
      32             : 
      33             : /* snapmk_out ABI
      34             : 
      35             :    snapmk_out is a reliable tango link with dcache alloc policy.
      36             :    mcache descriptor fields as follows:
      37             :    - seq: sequence number
      38             :    - sig: payload type (FD_SNAPMK_MSG_*)
      39             :    - chunk: compressed payload pointer (fd_chunk_to_laddr wksp-relative)
      40             :    - sz: payload size
      41             :    - tspub: compressed tickcount event timestamp
      42             :    Other fields are reserved for future use.
      43             : 
      44             :    Consumers can replay found/created/deleted messages to reconstruct a
      45             :    live view of all available snapshots on the file system.*/
      46             : 
      47             : /* FD_SNAPMK_MSG_* give message types */
      48             : 
      49           0 : #define FD_SNAPMK_MSG_FOUND   1 /* fd_snapmk_msg_found_t */
      50           0 : #define FD_SNAPMK_MSG_CREATED 2 /* fd_snapmk_msg_created_t */
      51           0 : #define FD_SNAPMK_MSG_DELETED 3 /* fd_snapmk_msg_deleted_t */
      52           0 : #define FD_SNAPMK_MSG_STARTED 4 /* fd_snapmk_msg_started_t */
      53           0 : #define FD_SNAPMK_MSG_FAILED  5 /* fd_snapmk_msg_failed_t */
      54             : 
      55             : /* fd_snapmk_msg_found_t signals that a pre-existing snapshot was found
      56             :    on the file system.  That snapshot comes from a previous run or was
      57             :    just downloaded by the snapshot loading pipeline.
      58             : 
      59             :    A burst of these messages is also created after startup (once the
      60             :    snapshot loading pipeline finishes). */
      61             : 
      62             : struct fd_snapmk_msg_found {
      63             :   ulong slot;      /* snapshot slot */
      64             :   ulong base_slot; /* ULONG_MAX if full snapshot */
      65             :   ulong sz;        /* snapshot file size */
      66             :   uint  pool_idx;  /* FD_SNAP_FD( pool_idx ) -> snap file descriptor */
      67             :   uint  reserved;
      68             :   char  name[ FD_SNAP_NAME_MAX ];
      69             :   long  fs_timestamp; /* unix nanosecond timestamp from file (LONG_MAX if unknown) */
      70             : };
      71             : 
      72             : typedef struct fd_snapmk_msg_found fd_snapmk_msg_found_t;
      73             : 
      74             : /* fd_snapmk_msg_created_t signals that a new snapshot was just produced
      75             :    and is available on the file system. */
      76             : 
      77             : struct fd_snapmk_msg_created {
      78             :   ulong slot;      /* snapshot slot */
      79             :   ulong base_slot; /* ULONG_MAX if full snapshot */
      80             :   ulong sz;        /* snapshot file size */
      81             :   uint  pool_idx;  /* FD_SNAP_FD( pool_idx ) -> snap file descriptor */
      82             :   uint  reserved;
      83             :   char  name[ FD_SNAP_NAME_MAX ];
      84             : };
      85             : 
      86             : typedef struct fd_snapmk_msg_created fd_snapmk_msg_created_t;
      87             : 
      88             : /* fd_snapmk_msg_deleted_t signals that a snapshot is about to be
      89             :    deleted. */
      90             : 
      91             : struct fd_snapmk_msg_deleted {
      92             :   ulong slot;
      93             :   ulong base_slot; /* ULONG_MAX if full snapshot */
      94             :   uint  pool_idx; /* FD_SNAP_FD( pool_idx ) -> snap file descriptor */
      95             :   uint  reserved1;
      96             :   char  name[ FD_SNAP_NAME_MAX ];
      97             : };
      98             : 
      99             : typedef struct fd_snapmk_msg_deleted fd_snapmk_msg_deleted_t;
     100             : 
     101             : /* fd_snapmk_msg_started_t signals that the snapshot production pipeline
     102             :    has started.  Will eventually be followed by a created or failed msg. */
     103             : 
     104             : struct fd_snapmk_msg_started {
     105             :   ulong slot;
     106             :   ulong base_slot; /* ULONG_MAX if full snapshot */
     107             :   uint  pool_idx; /* FD_SNAP_FD( pool_idx ) -> snap file descriptor */
     108             : };
     109             : 
     110             : typedef struct fd_snapmk_msg_started fd_snapmk_msg_started_t;
     111             : 
     112             : /* fd_snapmk_msg_failed_t signals that snapshot production failed.
     113             :    Currently, there is only one failure reason: too many accounts
     114             :    changed since the full snapshot to fit in the incremental snap. */
     115             : 
     116             : struct fd_snapmk_msg_failed {
     117             :   ulong slot;
     118             :   ulong base_slot; /* ULONG_MAX if full snapshot */
     119             :   uint  reserved;
     120             : };
     121             : 
     122             : typedef struct fd_snapmk_msg_failed fd_snapmk_msg_failed_t;
     123             : 
     124             : /* fd_snapmk_msg_t is the data payload behind the fd_frag_meta_t::chunk
     125             :    compressed offset. */
     126             : 
     127             : union fd_snapmk_msg {
     128             :   fd_snapmk_msg_found_t   found;
     129             :   fd_snapmk_msg_created_t created;
     130             :   fd_snapmk_msg_deleted_t deleted;
     131             :   fd_snapmk_msg_started_t started;
     132             :   fd_snapmk_msg_failed_t  failed;
     133             : };
     134             : 
     135             : typedef union fd_snapmk_msg fd_snapmk_msg_t;
     136             : 
     137             : #endif /* HEADER_fd_src_discof_backup_fd_snapmk_tile_h */

Generated by: LCOV version 1.14