Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_runtime_fd_txncache_shmem_h 2 : #define HEADER_fd_src_flamenco_runtime_fd_txncache_shmem_h 3 : 4 : #include "../../util/fd_util_base.h" 5 : 6 639 : #define FD_TXNCACHE_SHMEM_ALIGN (128UL) 7 : 8 156 : #define FD_TXNCACHE_SHMEM_MAGIC (0xF17EDA2CE58CC4E1UL) /* FIREDANCE SMCCHE V1 */ 9 : 10 : /* FD_TXNCACHE_MAX_SLOT_DELTAS is the practical bound on the maximum 11 : number of slot deltas that can be stored into the txncache. This 12 : bound is derived from the recent blockhashes sysvar. */ 13 : 14 1145321 : #define FD_TXNCACHE_MAX_SLOT_DELTAS (151UL) 15 : 16 : typedef struct { ushort val; } fd_txncache_fork_id_t; 17 : 18 : struct fd_txncache_shmem_private; 19 : typedef struct fd_txncache_shmem_private fd_txncache_shmem_t; 20 : 21 : FD_PROTOTYPES_BEGIN 22 : 23 : FD_FN_CONST ulong 24 : fd_txncache_shmem_align( void ); 25 : 26 : /* The txnpage pool is sized for the worst case set of simultaneously 27 : live transactions: a full snapshot load (151 slot deltas at 28 : max_txn_per_slot entries, which counts each transaction twice) plus 29 : every other active fork full at max_txn_per_slot/2. Callers pass 30 : 2*config->limits.max_txn_per_slot, so a raised [development.bench] 31 : block cost limit sizes the pool up through that value. 32 : 33 : footprint and new return 0 / NULL for zero max_live_slots or 34 : max_txn_per_slot, and log an error and exit if the parameters need a 35 : txnpage pool larger than the structure can address. */ 36 : 37 : ulong 38 : fd_txncache_shmem_footprint( ulong max_live_slots, 39 : ulong max_txn_per_slot ); 40 : 41 : void * 42 : fd_txncache_shmem_new( void * shmem, 43 : ulong max_live_slots, 44 : ulong max_txn_per_slot, 45 : ulong seed ); 46 : 47 : fd_txncache_shmem_t * 48 : fd_txncache_shmem_join( void * shtc ); 49 : 50 : FD_PROTOTYPES_END 51 : 52 : #endif /* HEADER_fd_src_flamenco_runtime_fd_txncache_shmem_h */