LCOV - code coverage report
Current view: top level - funk - fd_funk.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 20 33 60.6 %
Date: 2025-10-27 04:40:00 Functions: 25 2312 1.1 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_funk_fd_funk_h
       2             : #define HEADER_fd_src_funk_fd_funk_h
       3             : 
       4             : /* Funk is a hybrid of a database and version control system designed
       5             :    for ultra high performance blockchain applications.
       6             : 
       7             :    The data model is a flat table of records.  A record is a xid/key-val
       8             :    pair and records are fast O(1) indexable by their xid/key.  xid is
       9             :    short for "transaction id" and xids have a compile time fixed size
      10             :    (e.g. 16 bytes).  keys also have a compile time fixed size (e.g.
      11             :    40 bytes).  Record values can vary in length from zero to a compile
      12             :    time maximum size.  The xid of all zeros is reserved for the "root"
      13             :    transaction described below.  Outside this, there are no
      14             :    restrictions on what a record xid, key or val can be.  Individual
      15             :    records can be created, updated, and deleted arbitrarily.  They are
      16             :    just binary data as far as funk is concerned.
      17             : 
      18             :    The maximum number of records is practically only limited by the size
      19             :    of the workspace memory backing it.  At present, each record requires
      20             :    128 bytes of metadata (this includes records that are published and
      21             :    records that are in the process of being updated).  In other words,
      22             :    about 13 GiB record metadata per hundred million records.  The
      23             :    maximum number of records that can be held by a funk instance is set
      24             :    when that it was created (given the persistent and relocatable
      25             :    properties described below though, it is straightforward to resize
      26             :    this).
      27             : 
      28             :    The transaction model is richer than what is found in a regular
      29             :    database.  A transaction is a xid-"updates to parent transaction"
      30             :    pair and transactions are fast O(1) indexable by xid.  There is no
      31             :    limitation on the number of updates in a transaction.  Updates to the
      32             :    record value are represented as the complete value record to make it
      33             :    trivial to apply cryptographic operations like hashing to all updated
      34             :    values in a transaction with file I/O, operating system calls, memory
      35             :    data marshalling overhead, etc.
      36             : 
      37             :    Like records, the maximum number of transactions in preparation is
      38             :    practically only limited by the size of the workspace memory backing
      39             :    it.  At present, a transaction requires 96 bytes of memory.  As such,
      40             :    it is practical to track a large number of forks during an extended
      41             :    period of time of consensus failure in a block chain application
      42             :    without using much workspace memory at all.  The maximum number of
      43             :    transactions that can be in preparation at any given time by a funk
      44             :    instance is set when that it was created (as before, given the
      45             :    persistent and relocatable properties described below, it is
      46             :    straightforward to resize this).
      47             : 
      48             :    That is, a transaction is a compact representation of the entire
      49             :    history of _all_ the database records up to that transaction.  We can
      50             :    trace a transaction's ancestors back to the "root" give the complete
      51             :    history of all database records up to that transaction.  The “root”
      52             :    transaction is the ancestor of all transactions.  The transaction
      53             :    history is linear from the root transaction until the "last
      54             :    published" transaction and cannot be modified.
      55             : 
      56             :    To start "preparing" a new transaction, we pick the new transaction's
      57             :    xid (ideally unique among all transactions thus far) and fork off a
      58             :    "parent" transaction.  This operation virtually clones all database
      59             :    records in the parent transaction, even if the parent itself has not
      60             :    yet been "published".  Given the above, the parent transaction can be
      61             :    the last published transaction or another in-preparation transaction.
      62             : 
      63             :    Record inserts, reads, removes take place within the context
      64             :    of a transaction, effectively isolating them to a private view of the
      65             :    world.  If a transaction is "cancelled", the changes to a record are
      66             :    harmlessly discarded.  Records in a transaction that has children
      67             :    cannot be changed ("frozen").
      68             : 
      69             :    As such, it is not possible to modify the records in transactions
      70             :    strictly before the last published transaction.  However, it is
      71             :    possible to modify the records of the last published transaction if
      72             :    there is no transactions in preparation.  This is useful, for
      73             :    example, loading up a transaction from a checkpointed state on
      74             :    startup.  A common idiom at start of a block though is to fork the
      75             :    potential transaction of that block from its parent (freezing its
      76             :    parent) and then fork a child of the potential transaction that will
      77             :    hold updates to the block that are incrementally "merged" into the
      78             :    potential transaction as block processing progresses.
      79             : 
      80             :    Critically, in-preparation transactions form a tree of dependent and
      81             :    competing histories.  This model matches blockchains, where
      82             :    speculative work can proceed on several blocks at once long before
      83             :    the blocks are finalized.  When a transaction is published, all its
      84             :    ancestors are also published, any competing histories are
      85             :    cancelled, leaving only a linear history up to the published
      86             :    transaction.  There is no practical limitation on the complexity of
      87             :    this tree.
      88             : 
      89             :    Under the hood, the database state is stored in NUMA and TLB
      90             :    optimized shared memory (i.e. fd_wksp) such that various database
      91             :    operations can be used concurrently by multiple threads distributed
      92             :    arbitrarily over multiple processes zero copy.
      93             : 
      94             :    Database operations are at algorithmic minimums with reasonably high
      95             :    performance implementations.  Most are fast O(1) time and all are
      96             :    small O(1) space (e.g. in complex transaction tree operations, there
      97             :    is no use of dynamic allocation to hold temporaries and no use of
      98             :    recursion to bound stack utilization at trivial levels).  Further,
      99             :    there are no explicit operating system calls and, given a well
     100             :    optimized workspace (i.e. the wksp pages fit within a core's TLBs) no
     101             :    implicit operating system calls.  Critical operations (e.g. those
     102             :    that actually might impact transaction history) are fortified against
     103             :    memory corruption (e.g. robust against DoS attack by corrupting
     104             :    transaction metadata to create loops in transaction trees or going
     105             :    out of bounds in memory).  Outside of record values, all memory used
     106             :    is preallocated.  And record values are O(1) lockfree concurrent
     107             :    allocated via fd_alloc using the same wksp as funk (the
     108             :    implementation is structured in layers that are straightforward to
     109             :    retarget for particular applications as might be necessary).
     110             : 
     111             :    The shared memory used by a funk instance is within a workspace such
     112             :    that it is also persistent and remotely inspectable.  For example, a
     113             :    process attached to a funk instance can be terminated and a new
     114             :    process can resume exactly where the original process left off
     115             :    instantly (e.g. no file I/O).  Or a real-time monitor could be
     116             :    visualizing the ongoing activity in a database non-invasively (e.g.
     117             :    forks in flight, records updated by forks, etc).  Or an auxiliary
     118             :    process could be lazily and non-invasively writing all published
     119             :    records to permanent storage in the background in parallel with
     120             :    on-going operations.
     121             : 
     122             :    The records are further stored in the workspace memory relocatably.
     123             :    For example, workspace memory could just be committed to a persistent
     124             :    memory as is (or backed by NVMe or such directly), copied to a
     125             :    different host, and processes on the new host could resume (indeed,
     126             :    though it wouldn't be space efficient, the shared memory region is
     127             :    usable as is as an on-disk checkpoint file).  Or the workspace could
     128             :    be resized and what not to handle large needs than when the database
     129             :    was initially created and it all "just works". */
     130             : 
     131             : //#include "fd_funk_base.h" /* Includes ../util/fd_util.h */
     132             : //#include "fd_funk_txn.h"  /* Includes fd_funk_base.h */
     133             : //#include "fd_funk_rec.h"  /* Includes fd_funk_txn.h */
     134             : #include "fd_funk_val.h"    /* Includes fd_funk_rec.h */
     135             : 
     136             : /* FD_FUNK_ALIGN describe the alignment needed
     137             :    for a funk.  ALIGN should be a positive integer power of 2.
     138             :    The footprint is dynamic depending on map sizes. */
     139             : 
     140         570 : #define FD_FUNK_ALIGN (4096UL)
     141             : 
     142             : /* The details of a fd_funk_shmem_private are exposed here to facilitate
     143             :    inlining various operations. */
     144             : 
     145         114 : #define FD_FUNK_MAGIC (0xf17eda2ce7fc2c02UL) /* firedancer funk version 2 */
     146             : 
     147             : struct __attribute__((aligned(FD_FUNK_ALIGN))) fd_funk_shmem_private {
     148             : 
     149             :   /* Metadata */
     150             : 
     151             :   ulong magic;      /* ==FD_FUNK_MAGIC */
     152             :   ulong funk_gaddr; /* wksp gaddr of this in the backing wksp, non-zero gaddr */
     153             :   ulong wksp_tag;   /* Tag to use for wksp allocations, positive */
     154             :   ulong seed;       /* Seed for various hashing function used under the hood, arbitrary */
     155             :   ulong cycle_tag;  /* Next cycle_tag to use, used internally for various data integrity checks */
     156             : 
     157             :   /* The funk transaction map stores the details about transactions
     158             :      in preparation and their relationships to each other.  This is a
     159             :      fd_map_chain_para/fd_pool_para and more details are given in
     160             :      fd_funk_txn.h
     161             : 
     162             :      txn_max is the maximum number of transactions that can be in
     163             :      preparation.  Due to the use of compressed map indices to reduce
     164             :      workspace memory footprint required, txn_max is at most
     165             :      FD_FUNK_TXN_IDX_NULL (currently ~4B).  This should be more than
     166             :      ample for anticipated uses cases ... e.g. every single validator in
     167             :      a pool of tens of thousands Solana validator had its own fork and
     168             :      with no consensus ever being achieved, a funk with txn_max at the
     169             :      limits of a compressed index will be chug along for days to weeks
     170             :      before running out of indexing space.  But if ever needing to
     171             :      support more, it is straightforward to change the code to not use
     172             :      index compression.  Then, a funk (with a planet sized workspace
     173             :      backing it) would survive a similar scenario for millions of years.
     174             :      Presumably, if such a situation arose, in the weeks to eons while
     175             :      there was consensus, somebody would notice and care enough to
     176             :      intervene (if not it is probably irrelevant to the real world
     177             :      anyway).
     178             : 
     179             :      txn_map_gaddr is the wksp gaddr of the fd_funk_txn_map_t used by
     180             :      this funk.
     181             : 
     182             :      child_{head,tail}_cidx are compressed txn map indices.  After
     183             :      decompression, they give the txn map index of the {oldest,youngest}
     184             :      child of funk (i.e. an in-preparation transaction whose parent
     185             :      transaction id is last_publish).  FD_FUNK_TXN_IDX_NULL indicates
     186             :      the funk is childless.  Thus, if head/tail is FD_FUNK_TXN_IDX_NULL,
     187             :      tail/head will be too. funk is "frozen" if it has children.
     188             : 
     189             :      last_publish is the ID of the last published transaction.  It will
     190             :      be the root transaction if no transactions have been published.
     191             :      Will be the root transaction immediately after construction. */
     192             : 
     193             :   ulong txn_max;         /* In [0,FD_FUNK_TXN_IDX_NULL] */
     194             :   ulong txn_map_gaddr;   /* Non-zero wksp gaddr with tag wksp_tag
     195             :                             seed   ==fd_funk_txn_map_seed   (txn_map)
     196             :                             txn_max==fd_funk_txn_map_key_max(txn_map) */
     197             :   ulong txn_pool_gaddr;
     198             :   ulong txn_ele_gaddr;
     199             : 
     200             :   uint  child_head_cidx; /* After decompression, in [0,txn_max) or FD_FUNK_TXN_IDX_NULL, FD_FUNK_TXN_IDX_NULL if txn_max 0 */
     201             :   uint  child_tail_cidx; /* " */
     202             : 
     203             :   /* Padding to FD_FUNK_TXN_XID_ALIGN here */
     204             : 
     205             :   fd_funk_txn_xid_t root[1];         /* Always equal to the root transaction */
     206             :   fd_funk_txn_xid_t last_publish[1]; /* Root transaction immediately after construction, not root thereafter */
     207             : 
     208             :   /* The funk record map stores the details about all the records in
     209             :      the funk, including all those in the last published transaction and
     210             :      all those getting updated in an in-preparation translation.  This
     211             :      is a fd_map_chain_para/fd_pool_para and more details are given in
     212             :      fd_funk_rec.h
     213             : 
     214             :      rec_max is the maximum number of records that can exist in this
     215             :      funk.
     216             : 
     217             :      rec_map_gaddr is the wksp gaddr of the fd_funk_rec_map_t used by
     218             :      this funk. */
     219             : 
     220             :   uint rec_max;
     221             :   ulong rec_map_gaddr; /* Non-zero wksp gaddr with tag wksp_tag
     222             :                           seed   ==fd_funk_rec_map_seed   (rec_map)
     223             :                           rec_max==fd_funk_rec_map_key_max(rec_map) */
     224             :   ulong rec_pool_gaddr;
     225             :   ulong rec_ele_gaddr;
     226             : 
     227             :   /* The funk alloc is used for allocating wksp resources for record
     228             :      values.  This is a fd_alloc and more details are given in
     229             :      fd_funk_val.h.  Allocations from this allocator will be tagged with
     230             :      wksp_tag and operations on this allocator will use concurrency
     231             :      group 0.
     232             : 
     233             :      TODO: Consider letting user just pass a join of alloc (and maybe
     234             :      the cgroup_idx to give the funk), inferring the wksp, cgroup from
     235             :      that and allocating exclusively from that? */
     236             : 
     237             :   ulong alloc_gaddr; /* Non-zero wksp gaddr with tag wksp tag */
     238             : 
     239             :   /* Padding to FD_FUNK_ALIGN here */
     240             : };
     241             : 
     242             : /* The details of a fd_funk_private are exposed here to facilitate
     243             :    inlining various operations. */
     244             : 
     245             : #define FD_FUNK_JOIN_ALIGN 64
     246             : 
     247             : struct __attribute__((aligned(FD_FUNK_JOIN_ALIGN))) fd_funk_private {
     248             : 
     249             :   fd_funk_shmem_t *  shmem;
     250             : 
     251             :   fd_funk_txn_map_t  txn_map[1];
     252             :   fd_funk_txn_pool_t txn_pool[1];
     253             : 
     254             :   fd_funk_rec_map_t  rec_map[1];
     255             :   fd_funk_rec_pool_t rec_pool[1];
     256             : 
     257             :   fd_wksp_t *  wksp;
     258             :   fd_alloc_t * alloc;
     259             : 
     260             : };
     261             : 
     262             : FD_PROTOTYPES_BEGIN
     263             : 
     264             : /* Constructors */
     265             : 
     266             : /* fd_funk_align return FD_FUNK_ALIGN. */
     267             : 
     268             : FD_FN_CONST ulong
     269             : fd_funk_align( void );
     270             : 
     271             : /* fd_funk_footprint returns the size need for funk and all
     272             :    auxiliary data structures. Note that only record valus are
     273             :    allocated dynamically. */
     274             : 
     275             : FD_FN_CONST ulong
     276             : fd_funk_footprint( ulong txn_max,
     277             :                    ulong rec_max );
     278             : 
     279             : /* fd_funk_new formats an unused wksp allocation with the appropriate
     280             :    alignment and footprint as a funk.  Caller is not joined on return.
     281             :    Returns shmem on success and NULL on failure (shmem NULL, shmem
     282             :    misaligned, zero wksp_tag, shmem is not backed by a wksp ...  logs
     283             :    details).  A workspace can be used by multiple funks concurrently.
     284             :    They will dynamically share the underlying workspace (along with any
     285             :    other non-funk usage) but will otherwise act as completely separate
     286             :    non-conflicting funks.  To help with various diagnostics, garbage
     287             :    collection and what not, all allocations to the underlying wksp are
     288             :    tagged with the given tag (positive).  Ideally, the tag used here
     289             :    should be distinct from all other tags used by this workspace but
     290             :    this is not required. */
     291             : 
     292             : void *
     293             : fd_funk_new( void * shmem,
     294             :              ulong  wksp_tag,
     295             :              ulong  seed,
     296             :              ulong  txn_max,
     297             :              ulong  rec_max );
     298             : 
     299             : /* fd_funk_join joins the caller to a funk instance.  ljoin points to a
     300             :    fd_funk_t compatible memory region in the caller's address space,
     301             :    shfunk points to the first byte of the memory region backing the funk
     302             :    in the caller's address space.  Returns an handle to the caller's
     303             :    local join on success (join has ownership of the ljoin region) and
     304             :    NULL on failure (NULL ljoin, NULL shfunk, misaligned shfunk, shfunk
     305             :    is not backed by a wksp, bad magic, ... logs details).  Every
     306             :    successful join should have a matching leave.  The lifetime of the
     307             :    join is until the matching leave or the thread group is terminated
     308             :    (joins are local to a thread group). */
     309             : 
     310             : fd_funk_t *
     311             : fd_funk_join( fd_funk_t * ljoin,
     312             :               void *      shfunk );
     313             : 
     314             : /* fd_funk_leave leaves a funk join.  Returns the memory region used for
     315             :    join on success (caller has ownership on return and the caller is no
     316             :    longer joined) and NULL on failure (logs details).  Sets *opt_shfunk
     317             :    a pointer to the funk shm region if opt_shfunk!=NULL. */
     318             : 
     319             : void *
     320             : fd_funk_leave( fd_funk_t * funk,
     321             :                void **     opt_shfunk );
     322             : 
     323             : /* fd_funk_delete unformats a wksp allocation used as a funk
     324             :    (additionally frees all wksp allocations used by that funk).  Assumes
     325             :    nobody is or will be joined to the funk.  Returns shmem on success
     326             :    and NULL on failure (logs details).  Reasons for failure include
     327             :    shfunk is NULL, misaligned shfunk, shfunk is not backed by a
     328             :    workspace, etc. */
     329             : 
     330             : void *
     331             : fd_funk_delete( void * shfunk );
     332             : 
     333             : /* fd_funk_delete_fast is an optimized verison of fd_funk_delete.
     334             :    Unlike fd_funk_delete, makes an additional assumption that this funk
     335             :    was created with a wksp_tag (see fd_funk_new) that is distinct from
     336             :    all other tags in the workspace.  Also unlike fd_funk_delete, frees
     337             :    wksp allocation backing the funk instance itself.
     338             : 
     339             :    WARNING: Using this function frees all wksp allocations matching the
     340             :    funk's wksp_tag. */
     341             : 
     342             : void
     343             : fd_funk_delete_fast( void * shfunk );
     344             : 
     345             : /* Accessors */
     346             : 
     347             : /* fd_funk_wksp returns the local join to the wksp backing the funk.
     348             :    The lifetime of the returned pointer is at least as long as the
     349             :    lifetime of the local join.  Assumes funk is a current local join. */
     350             : 
     351        2091 : FD_FN_PURE static inline fd_wksp_t * fd_funk_wksp( fd_funk_t const * funk ) { return funk->wksp; }
     352             : 
     353             : /* fd_funk_wksp_tag returns the workspace allocation tag used by the
     354             :    funk for its wksp allocations.  Will be positive.  Assumes funk is a
     355             :    current local join. */
     356             : 
     357         252 : FD_FN_PURE static inline ulong fd_funk_wksp_tag( fd_funk_t * funk ) { return funk->shmem->wksp_tag; }
     358             : 
     359             : /* fd_funk_seed returns the hash seed used by the funk for various hash
     360             :    functions.  Arbitrary value.  Assumes funk is a current local join.
     361             :    TODO: consider renaming hash_seed? */
     362             : 
     363           3 : FD_FN_PURE static inline ulong fd_funk_seed( fd_funk_t * funk ) { return funk->shmem->seed; }
     364             : 
     365             : /* fd_funk_txn_max returns maximum number of in-preparations the funk
     366             :    can support.  Assumes funk is a current local join.  Return in
     367             :    [0,FD_FUNK_TXN_IDX_NULL]. */
     368             : 
     369           3 : FD_FN_PURE static inline ulong fd_funk_txn_max( fd_funk_t * funk ) { return funk->txn_pool->ele_max; }
     370             : 
     371             : /* fd_funk_txn_map returns the funk's transaction map join. This
     372             :    join can copied by value and is generally stored as a stack variable. */
     373             : 
     374         249 : FD_FN_PURE static inline fd_funk_txn_map_t * fd_funk_txn_map( fd_funk_t * funk ) { return funk->txn_map; }
     375             : 
     376             : /* fd_funk_txn_pool returns the funk's transaction pool join. This
     377             :    join can copied by value and is generally stored as a stack variable. */
     378             : 
     379           0 : FD_FN_PURE static inline fd_funk_txn_pool_t * fd_funk_txn_pool( fd_funk_t * funk ) { return funk->txn_pool; }
     380             : 
     381             : /* fd_funk_last_publish_child_{head,tail} returns a pointer in the
     382             :    caller's address space to {oldest,young} transaction child of root, NULL if
     383             :    funk is childless.  All pointers are in the caller's address space.
     384             :    These are all a fast O(1) but not fortified against memory data
     385             :    corruption. */
     386             : 
     387             : FD_FN_PURE static inline fd_funk_txn_t *
     388             : fd_funk_last_publish_child_head( fd_funk_t *          funk,
     389           0 :                                  fd_funk_txn_pool_t * pool ) {
     390           0 :   ulong idx = fd_funk_txn_idx( funk->shmem->child_head_cidx );
     391           0 :   if( fd_funk_txn_idx_is_null( idx ) ) return NULL; /* TODO: Consider branchless? */
     392           0 :   return pool->ele + idx;
     393           0 : }
     394             : 
     395             : FD_FN_PURE static inline fd_funk_txn_t *
     396             : fd_funk_last_publish_child_tail( fd_funk_t *          funk,
     397           0 :                                  fd_funk_txn_pool_t * pool ) {
     398           0 :   ulong idx = fd_funk_txn_idx( funk->shmem->child_tail_cidx );
     399           0 :   if( fd_funk_txn_idx_is_null( idx ) ) return NULL; /* TODO: Consider branchless? */
     400           0 :   return pool->ele + idx;
     401           0 : }
     402             : 
     403             : /* fd_funk_root returns a pointer in the caller's address space to the
     404             :    transaction id of the root transaction.  Assumes funk is a current
     405             :    local join.  Lifetime of the returned pointer is the lifetime of the
     406             :    current local join.  The value at this pointer will always be the
     407             :    root transaction id. */
     408             : 
     409         264 : FD_FN_CONST static inline fd_funk_txn_xid_t const * fd_funk_root( fd_funk_t const * funk ) { return funk->shmem->root; }
     410             : 
     411             : /* fd_funk_last_publish returns a pointer in the caller's address space
     412             :    to transaction id of the last published transaction.  Assumes funk is
     413             :    a current local join.  Lifetime of the returned pointer is the
     414             :    lifetime of the current local join.  The value at this pointer will
     415             :    be constant until the next transaction is published. */
     416             : 
     417      254664 : FD_FN_CONST static inline fd_funk_txn_xid_t const * fd_funk_last_publish( fd_funk_t const * funk ) { return funk->shmem->last_publish; }
     418             : 
     419             : /* fd_funk_is_frozen returns 1 if the records of the last published
     420             :    transaction are frozen (i.e. the funk has children) and 0 otherwise
     421             :    (i.e. the funk is childless).  Assumes funk is a current local join. */
     422             : 
     423             : FD_FN_PURE static inline int
     424           3 : fd_funk_last_publish_is_frozen( fd_funk_t const * funk ) {
     425           3 :   return fd_funk_txn_idx( funk->shmem->child_head_cidx )!=FD_FUNK_TXN_IDX_NULL;
     426           3 : }
     427             : 
     428             : /* fd_funk_rec_max returns maximum number of records that can be held
     429             :    in the funk.  This includes both records of the last published
     430             :    transaction and records for transactions that are in-flight. */
     431             : 
     432           0 : FD_FN_PURE static inline ulong fd_funk_rec_max( fd_funk_t * funk ) { return funk->rec_pool->ele_max; }
     433             : 
     434             : /* fd_funk_rec_map returns the funk's record map join. This
     435             :    join can copied by value and is generally stored as a stack variable. */
     436             : 
     437         249 : FD_FN_PURE static inline fd_funk_rec_map_t * fd_funk_rec_map( fd_funk_t * funk ) { return funk->rec_map; }
     438             : 
     439             : /* fd_funk_rec_pool returns the funk's record pool join. This
     440             :    join can copied by value and is generally stored as a stack variable. */
     441             : 
     442           0 : FD_FN_PURE static inline fd_funk_rec_pool_t * fd_funk_rec_pool( fd_funk_t * funk ) { return funk->rec_pool; }
     443             : 
     444             : /* fd_funk_alloc returns a pointer in the caller's address space to
     445             :    the funk's allocator. */
     446             : 
     447         249 : FD_FN_PURE static inline fd_alloc_t * fd_funk_alloc( fd_funk_t * funk ) { return funk->alloc; }
     448             : 
     449             : /* fd_funk_rec_is_full returns 1 if no more records can be allocated
     450             :    and 0 otherwise. */
     451             : 
     452             : static inline int
     453     2287086 : fd_funk_rec_is_full( fd_funk_t * funk ) {
     454     2287086 :   return fd_funk_rec_pool_is_empty( funk->rec_pool );
     455     2287086 : }
     456             : 
     457             : /* fd_funk_txn_is_full returns true if the transaction map is
     458             :    full. No more in-preparation transactions are allowed. */
     459             : 
     460             : static inline int
     461      571710 : fd_funk_txn_is_full( fd_funk_t * funk ) {
     462      571710 :   return fd_funk_txn_pool_is_empty( funk->txn_pool );
     463      571710 : }
     464             : 
     465             : /* Misc */
     466             : 
     467             : /* fd_funk_verify verifies the integrity of funk.  Returns
     468             :    FD_FUNK_SUCCESS if funk appears to be intact and FD_FUNK_ERR_INVAL
     469             :    otherwise (logs details).  Assumes funk is a current local join (NULL
     470             :    returns FD_FUNK_ERR_INVAL and logs details.) */
     471             : 
     472             : int
     473             : fd_funk_verify( fd_funk_t * funk );
     474             : 
     475             : FD_PROTOTYPES_END
     476             : 
     477             : #endif /* HEADER_fd_src_funk_fd_funk_h */

Generated by: LCOV version 1.14