LCOV - code coverage report
Current view: top level - flamenco/accdb - fd_accdb_user.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 5 11 45.5 %
Date: 2025-12-06 04:45:29 Functions: 3 372 0.8 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_flamenco_accdb_fd_accdb_user_h
       2             : #define HEADER_fd_src_flamenco_accdb_fd_accdb_user_h
       3             : 
       4             : #include "fd_accdb_base.h"
       5             : #include "fd_accdb_ref.h"
       6             : 
       7             : /* FD_ACCDB_DEPTH_MAX specifies the max non-rooted fork depth. */
       8             : 
       9          93 : #define FD_ACCDB_DEPTH_MAX (128UL)
      10             : 
      11             : /* fd_accdb_user_vt_t specifies the interface (vtable) for the account
      12             :    DB client. */
      13             : 
      14             : struct fd_accdb_user_vt {
      15             : 
      16             :   void
      17             :   (* fini)( fd_accdb_user_t * accdb );
      18             : 
      19             :   fd_accdb_peek_t *
      20             :   (* peek)( fd_accdb_user_t *         accdb,
      21             :             fd_accdb_peek_t *         peek,
      22             :             fd_funk_txn_xid_t const * xid,
      23             :             void const *              address );
      24             : 
      25             :   fd_accdb_ro_t *
      26             :   (* open_ro)( fd_accdb_user_t *         accdb,
      27             :                fd_accdb_ro_t *           ro,
      28             :                fd_funk_txn_xid_t const * xid,
      29             :                void const *              address );
      30             : 
      31             :   void
      32             :   (* close_ro)( fd_accdb_user_t * accdb,
      33             :                 fd_accdb_ro_t *   ro );
      34             : 
      35             :   fd_accdb_rw_t *
      36             :   (* open_rw)( fd_accdb_user_t *         accdb,
      37             :                fd_accdb_rw_t *           rw,
      38             :                fd_funk_txn_xid_t const * xid,
      39             :                void const *              address,
      40             :                ulong                     data_max,
      41             :                int                       do_create );
      42             : 
      43             :   void
      44             :   (* close_rw)( fd_accdb_user_t * accdb,
      45             :                 fd_accdb_rw_t *   write );
      46             : 
      47             : };
      48             : 
      49             : typedef struct fd_accdb_user_vt fd_accdb_user_vt_t;
      50             : 
      51             : struct fd_accdb_user_base {
      52             :   fd_accdb_user_vt_t const * vt;
      53             :   uint                       accdb_type;
      54             : 
      55             :   ulong rw_active;
      56             :   ulong ro_active;
      57             : };
      58             : 
      59             : typedef struct fd_accdb_user_base fd_accdb_user_base_t;
      60             : 
      61             : struct fd_accdb_user {
      62             :   fd_accdb_user_base_t base;
      63             : 
      64             :   uchar impl[ 4096 ] __attribute__((aligned(64)));
      65             : };
      66             : 
      67             : FD_PROTOTYPES_BEGIN
      68             : 
      69             : static inline ulong
      70           0 : fd_accdb_user_align( void ) {
      71           0 :   return alignof(fd_accdb_user_t);
      72           0 : }
      73             : 
      74             : static inline ulong
      75           0 : fd_accdb_user_footprint( void ) {
      76           0 :   return sizeof(fd_accdb_user_t);
      77           0 : }
      78             : 
      79             : static inline void
      80          54 : fd_accdb_user_fini( fd_accdb_user_t * accdb ) {
      81          54 :   accdb->base.vt->fini( accdb );
      82          54 :   accdb->base.accdb_type = 0;
      83          54 : }
      84             : 
      85             : FD_PROTOTYPES_END
      86             : 
      87             : #endif /* HEADER_fd_src_flamenco_accdb_fd_accdb_user_h */

Generated by: LCOV version 1.14