LCOV - code coverage report
Current view: top level - flamenco/runtime - fd_bank_hash_cmp.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 12 0.0 %
Date: 2024-11-13 11:58:15 Functions: 0 202 0.0 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_flamenco_runtime_fd_bank_hash_cmp_h
       2             : #define HEADER_fd_src_flamenco_runtime_fd_bank_hash_cmp_h
       3             : 
       4             : #include "../fd_flamenco_base.h"
       5             : #include "fd_blockstore.h"
       6             : 
       7             : struct fd_bank_hash_cmp_entry {
       8             :   ulong     slot;
       9             :   uint      hash;
      10             :   fd_hash_t ours;
      11             :   fd_hash_t theirs[8];
      12             :   ulong     stakes[8];
      13             :   ulong     cnt;
      14             :   int       overflow;
      15             :   int       rooted;
      16             : };
      17             : typedef struct fd_bank_hash_cmp_entry fd_bank_hash_cmp_entry_t;
      18             : #define MAP_NAME        fd_bank_hash_cmp_map
      19           0 : #define MAP_T           fd_bank_hash_cmp_entry_t
      20           0 : #define MAP_KEY         slot
      21           0 : #define MAP_LG_SLOT_CNT (16) /* 0.25 fill ratio */
      22             : #include "../../util/tmpl/fd_map.c"
      23             : 
      24             : struct fd_bank_hash_cmp {
      25             :   fd_bank_hash_cmp_entry_t * map;
      26             :   ulong                      cnt;
      27             :   ulong                      watermark; /*  */
      28             :   ulong                      total_stake;
      29             :   volatile int               lock;
      30             : };
      31             : typedef struct fd_bank_hash_cmp fd_bank_hash_cmp_t;
      32             : 
      33             : FD_PROTOTYPES_BEGIN
      34             : 
      35             : static inline ulong
      36           0 : fd_bank_hash_cmp_align( void ) {
      37           0 :   return 128UL;
      38           0 : }
      39             : 
      40             : static inline ulong
      41           0 : fd_bank_hash_cmp_footprint( void ) {
      42             :   /* clang-format off */
      43           0 :     return FD_LAYOUT_FINI( FD_LAYOUT_APPEND( FD_LAYOUT_APPEND( FD_LAYOUT_INIT,
      44           0 :         fd_bank_hash_cmp_align(), sizeof(fd_bank_hash_cmp_t) ),
      45           0 :         fd_bank_hash_cmp_map_align(), fd_bank_hash_cmp_map_footprint() ),
      46           0 :         fd_bank_hash_cmp_align() );
      47             :   /* clang-format on */
      48           0 : }
      49             : 
      50             : void *
      51             : fd_bank_hash_cmp_new( void * mem );
      52             : 
      53             : fd_bank_hash_cmp_t *
      54             : fd_bank_hash_cmp_join( void * bank_hash_cmp );
      55             : 
      56             : void *
      57             : fd_bank_hash_cmp_leave( fd_bank_hash_cmp_t const * bank_hash_cmp );
      58             : 
      59             : void *
      60             : fd_bank_hash_cmp_delete( void * bank_hash_cmp );
      61             : 
      62             : void
      63             : fd_bank_hash_cmp_lock( fd_bank_hash_cmp_t * bank_hash_cmp );
      64             : 
      65             : void
      66             : fd_bank_hash_cmp_unlock( fd_bank_hash_cmp_t * bank_hash_cmp );
      67             : 
      68             : void
      69             : fd_bank_hash_cmp_insert( fd_bank_hash_cmp_t * bank_hash_cmp,
      70             :                          ulong                slot,
      71             :                          fd_hash_t const *    hash,
      72             :                          int                  ours,
      73             :                          ulong                stake );
      74             : 
      75             : /* Returns 1 on bank hash match (caller should move watermark forward),
      76             :           -1 on mismatch
      77             :            0 if we weren't able to compare yet */
      78             : int
      79             : fd_bank_hash_cmp_check( fd_bank_hash_cmp_t * bank_hash_cmp, ulong slot );
      80             : 
      81             : FD_PROTOTYPES_END
      82             : 
      83             : #endif /* HEADER_fd_src_flamenco_runtime_fd_bank_hash_cmp_h */

Generated by: LCOV version 1.14