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