Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_accdb_fd_accdb_admin_v2_private_h 2 : #define HEADER_fd_src_flamenco_accdb_fd_accdb_admin_v2_private_h 3 : 4 : #include "fd_accdb_admin_v2.h" 5 : #include "fd_accdb_admin_v1.h" 6 : #include "fd_vinyl_req_pool.h" 7 : 8 : /* FD_ACCDB_ROOT_BATCH_MAX controls how many accounts to write in 9 : batches to the vinyl DB server. */ 10 : 11 0 : #define FD_ACCDB_ROOT_BATCH_MAX (128UL) 12 : 13 : struct fd_accdb_admin_v2 { 14 : union { 15 : fd_accdb_admin_base_t base; 16 : fd_accdb_admin_v1_t v1[1]; 17 : }; 18 : 19 : fd_accdb_lineage_t root_lineage[1]; 20 : ulong slot_delay; 21 : 22 : /* Vinyl client */ 23 : ulong vinyl_req_id; 24 : fd_vinyl_rq_t * vinyl_rq; 25 : ulong vinyl_link_id; 26 : fd_wksp_t * vinyl_data_wksp; 27 : fd_wksp_t * vinyl_req_wksp; 28 : fd_vinyl_req_pool_t * vinyl_req_pool; 29 : }; 30 : 31 : typedef struct fd_accdb_admin_v2 fd_accdb_admin_v2_t; 32 : 33 : FD_PROTOTYPES_BEGIN 34 : 35 : /* fd_accdb_v2_root_batch "roots" a batch of funk accounts. 36 : 37 : rec0 is the head of the batch linked list to root (NULL is fine). 38 : Up to FD_ACCDB_ROOT_BATCH_MAX records starting at rec0 are migrated 39 : to vinyl. This frees rec0 and subsequent items. Returns the next 40 : record in the linked list that is not yet rooted. 41 : 42 : It is assumed that the rec0 linked list is not owned by a funk_txn at 43 : this point. (The funk_txn that used to own rec0 has child_head and 44 : child_tail set to sentinel.) 45 : 46 : Each record is considered as follows: 47 : - If another newer revision of this record exists that was already 48 : marked as rooted, this record is thrown away. 49 : - Otherwise, the record is moved to vinyl. 50 : 51 : The move to vinyl is done in a thread-safe manner (writes to vinyl 52 : first, then once the write is globally visible, removes from funk). 53 : 54 : Updates the following metrics: root_cnt, reclaim_cnt. */ 55 : 56 : fd_funk_rec_t * 57 : fd_accdb_v2_root_batch( fd_accdb_admin_v2_t * admin, 58 : fd_funk_rec_t * rec0 ); 59 : 60 : FD_PROTOTYPES_END 61 : 62 : #endif /* HEADER_fd_src_flamenco_accdb_fd_accdb_admin_v2_private_h */