LCOV - code coverage report
Current view: top level - discof/restore/utils - fd_http_resolver.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 1 0.0 %
Date: 2026-06-29 05:51:35 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_discof_restore_utils_fd_http_resolver_h
       2             : #define HEADER_fd_src_discof_restore_utils_fd_http_resolver_h
       3             : 
       4             : #include "fd_sspeer_selector.h"
       5             : 
       6             : /* Resolves snapshot slot information for http snapshot peers.  These
       7             :    peers might not publish SnapshotHashes messages through gossip,
       8             :    so we manually resolve their snapshot slot information through an
       9             :    http request. */
      10             : struct fd_http_resolver_private;
      11             : typedef struct fd_http_resolver_private fd_http_resolver_t;
      12             : 
      13           0 : #define FD_HTTP_RESOLVER_MAGIC (0xF17EDA2CE551170) /* FIREDANCE HTTP RESOLVER V0 */
      14             : 
      15             : typedef void
      16             : (* fd_http_resolver_on_resolve_fn_t)( void *                  _ctx,
      17             :                                       fd_sspeer_key_t const * key,
      18             :                                       fd_ip4_port_t           addr,
      19             :                                       ulong                   full_slot,
      20             :                                       ulong                   incr_slot,
      21             :                                       uchar                   full_hash[ FD_HASH_FOOTPRINT ],
      22             :                                       uchar                   incr_hash[ FD_HASH_FOOTPRINT ] );
      23             : 
      24             : FD_PROTOTYPES_BEGIN
      25             : 
      26             : FD_FN_CONST ulong
      27             : fd_http_resolver_align( void );
      28             : 
      29             : FD_FN_CONST ulong
      30             : fd_http_resolver_footprint( ulong peers_cnt );
      31             : 
      32             : void *
      33             : fd_http_resolver_new( void *                           shmem,
      34             :                       ulong                            peers_cnt,
      35             :                       int                              incremental_snapshot_fetch,
      36             :                       fd_http_resolver_on_resolve_fn_t on_resolve_cb,
      37             :                       void *                           cb_arg );
      38             : 
      39             : /* Add a peer to the resolver.  Peers are not de-duplicated and must
      40             :    be unique.  The peer is inserted into the selector with unknown
      41             :    slots and default latency so that subsequent on_resolve updates
      42             :    can find it.  It becomes selectable by best() once resolved.
      43             :    Returns 0 on success, and -1 otherwise. */
      44             : int
      45             : fd_http_resolver_add( fd_http_resolver_t *   resolver,
      46             :                       fd_ip4_port_t          addr,
      47             :                       char const *           hostname,
      48             :                       int                    is_https,
      49             :                       fd_sspeer_selector_t * selector );
      50             : 
      51             : fd_http_resolver_t *
      52             : fd_http_resolver_join( void * shresolve );
      53             : 
      54             : /* Advance the resolver forward in time until "now".  Called
      55             :    periodically to continuously resolve snapshot slot information from
      56             :    peers.  Takes a handle to the selector object to invalidate peers
      57             :    from both the resolver and selector. */
      58             : void
      59             : fd_http_resolver_advance( fd_http_resolver_t *   resolver,
      60             :                           long                   now,
      61             :                           fd_sspeer_selector_t * selector );
      62             : 
      63             : FD_PROTOTYPES_END
      64             : 
      65             : #endif /* HEADER_fd_src_discof_restore_utils_fd_http_resolver_h */

Generated by: LCOV version 1.14