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_ip4_port_t addr, 18 : ulong full_slot, 19 : ulong incr_slot ); 20 : 21 : FD_PROTOTYPES_BEGIN 22 : 23 : FD_FN_CONST ulong 24 : fd_http_resolver_align( void ); 25 : 26 : FD_FN_CONST ulong 27 : fd_http_resolver_footprint( ulong peers_cnt ); 28 : 29 : void * 30 : fd_http_resolver_new( void * shmem, 31 : ulong peers_cnt, 32 : int incremental_snapshot_fetch, 33 : fd_http_resolver_on_resolve_fn_t on_resolve_cb, 34 : void * cb_arg ); 35 : 36 : /* Add a peer to the resolver. Peers are not de-duplicated and must 37 : be unique. */ 38 : void 39 : fd_http_resolver_add( fd_http_resolver_t * resolver, 40 : fd_ip4_port_t addr, 41 : char const * hostname, 42 : int is_https ); 43 : 44 : fd_http_resolver_t * 45 : fd_http_resolver_join( void * shresolve ); 46 : 47 : /* Advance the resolver forward in time until "now". Called 48 : periodically to continuously resolve snapshot slot information from 49 : peers. Takes a handle to the selector object to invalidate peers 50 : from both the resolver and selector. */ 51 : void 52 : fd_http_resolver_advance( fd_http_resolver_t * resolver, 53 : long now, 54 : fd_sspeer_selector_t * selector ); 55 : 56 : FD_PROTOTYPES_END 57 : 58 : #endif /* HEADER_fd_src_discof_restore_utils_fd_http_resolver_h */