LCOV - code coverage report
Current view: top level - flamenco/progcache - fd_progcache_lineage.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 7 8 87.5 %
Date: 2026-06-30 05:50:37 Functions: 1 41 2.4 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_flamenco_progcache_fd_progcache_lineage_h
       2             : #define HEADER_fd_src_flamenco_progcache_fd_progcache_lineage_h
       3             : 
       4             : /* fd_progcache_lineage.h provides an API for filtering program cache
       5             :    records by fork graph lineage. */
       6             : 
       7             : #include "fd_progcache_base.h"
       8             : 
       9             : struct fd_progcache_lineage {
      10             : 
      11             :   /* Current fork cache */
      12             :   fd_progcache_fork_id_t fork[ FD_PROGCACHE_DEPTH_MAX ];
      13             :   ulong                  fork_depth;
      14             :   fd_progcache_fork_id_t root;
      15             : 
      16             :   uint txn_idx[ FD_PROGCACHE_DEPTH_MAX ];
      17             : 
      18             :   /* Cache of XIDs on fork */
      19             :   ulong tip_txn_idx; /* ==ULONG_MAX if tip is root */
      20             : 
      21             :   ulong max_depth;
      22             : };
      23             : 
      24             : #define FD_PROGCACHE_LINEAGE_FOOTPRINT (sizeof(fd_progcache_lineage_t))
      25             : 
      26             : typedef struct fd_progcache_lineage fd_progcache_lineage_t;
      27             : 
      28             : FD_PROTOTYPES_BEGIN
      29             : 
      30             : /* fd_progcache_lineage_has_xid returns 1 if the given record XID is part of
      31             :    the current lineage, otherwise 0. */
      32             : 
      33             : FD_FN_UNUSED static int
      34             : fd_progcache_lineage_has_xid( fd_progcache_lineage_t const * lineage,
      35          57 :                               fd_progcache_fork_id_t         rec_xid ) {
      36          57 :   ulong const fork_depth = lineage->fork_depth;
      37          57 :   if( rec_xid <= lineage->root ) return 1;
      38          66 :   for( ulong i=0UL; i<fork_depth; i++ ) {
      39          66 :     if( lineage->fork[i]==rec_xid ) return 1;
      40          66 :   }
      41           0 :   return 0;
      42          51 : }
      43             : 
      44             : FD_PROTOTYPES_END
      45             : 
      46             : #endif /* HEADER_fd_src_flamenco_progcache_fd_progcache_lineage_h */

Generated by: LCOV version 1.14