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-09-17 04:28:31 Functions: 1 45 2.2 %

          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             :   /* Cache of XIDs on fork */
      17             :   ulong tip_txn_idx; /* ==ULONG_MAX if tip is root */
      18             : };
      19             : 
      20             : 
      21             : typedef struct fd_progcache_lineage fd_progcache_lineage_t;
      22             : 
      23             : FD_PROTOTYPES_BEGIN
      24             : 
      25             : /* fd_progcache_lineage_has_xid returns 1 if the given record XID is part of
      26             :    the current lineage, otherwise 0. */
      27             : 
      28             : FD_FN_UNUSED static int
      29             : fd_progcache_lineage_has_xid( fd_progcache_lineage_t const * lineage,
      30          96 :                               fd_progcache_fork_id_t         rec_xid ) {
      31          96 :   ulong const fork_depth = lineage->fork_depth;
      32          96 :   if( rec_xid <= lineage->root ) return 1;
      33          90 :   for( ulong i=0UL; i<fork_depth; i++ ) {
      34          90 :     if( lineage->fork[i]==rec_xid ) return 1;
      35          90 :   }
      36           0 :   return 0;
      37          75 : }
      38             : 
      39             : FD_PROTOTYPES_END
      40             : 
      41             : #endif /* HEADER_fd_src_flamenco_progcache_fd_progcache_lineage_h */

Generated by: LCOV version 1.14