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