LCOV - code coverage report
Current view: top level - app/shared_dev/commands - bundle_client.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 54 0.0 %
Date: 2026-09-17 04:28:31 Functions: 0 4 0.0 %

          Line data    Source code
       1             : #include "../../shared/fd_config.h"
       2             : #include "../../shared/commands/run/run.h"
       3             : #include "../../shared/commands/configure/configure.h" /* CONFIGURE_NR_OPEN_FILES */
       4             : 
       5             : #include <sys/resource.h> /* RLIMIT_NOFILE */
       6             : #include "../../../disco/topo/fd_topob.h"
       7             : #include "../../../disco/fd_txn_m.h"
       8             : 
       9             : #include <unistd.h> /* pause */
      10             : 
      11             : extern fd_topo_obj_callbacks_t * CALLBACKS[];
      12             : 
      13             : fd_topo_run_tile_t
      14             : fdctl_tile_run( fd_topo_tile_t const * tile );
      15             : 
      16             : static void
      17           0 : bundle_client_topo( config_t *   config ) {
      18           0 :   fd_topo_t * topo = &config->topo;
      19           0 :   fd_topob_new( &config->topo, config->name );
      20           0 :   topo->max_page_size = fd_cstr_to_shmem_page_sz( config->hugetlbfs.max_page_size );
      21             : 
      22           0 :   fd_topob_wksp( topo, "metric_in" );
      23             : 
      24             :   /* Tiles */
      25             : 
      26           0 :   fd_topob_wksp( topo, "bundle" );
      27           0 :   fd_topo_tile_t * bundle_tile = fd_topob_tile( topo, "bundle", "bundle", "metric_in", ULONG_MAX, 0, 1, 0, 1 );
      28             : 
      29           0 :   fd_topob_wksp( topo, "sign" );
      30           0 :   fd_topo_tile_t * sign_tile = fd_topob_tile( topo, "sign", "sign", "metric_in", ULONG_MAX, 0, 1, 0, 0 );
      31             : 
      32           0 :   fd_topob_wksp( topo, "metric" );
      33           0 :   fd_topo_tile_t * metric_tile = fd_topob_tile( topo, "metric", "metric", "metric_in", ULONG_MAX, 0, 0, 0, 1 );
      34             : 
      35             :   /* Links */
      36             : 
      37           0 :   fd_topob_link( topo, "bundle_verif", "bundle", config->tiles.verify.receive_buffer_size, FD_TPU_PARSED_MTU, 1UL )
      38           0 :     ->permit_no_consumers = 1;
      39           0 :   fd_topob_link( topo, "bundle_sign",  "bundle", 65536UL,  9UL, 1UL );
      40           0 :   fd_topob_link( topo, "sign_bundle",  "bundle", 128UL,   64UL, 1UL );
      41             : 
      42           0 :   fd_topob_tile_out( topo, "bundle", 0UL, "bundle_verif", 0UL );
      43           0 :   fd_topob_tile_out( topo, "bundle", 0UL, "bundle_sign", 0UL );
      44           0 :   fd_topob_tile_out( topo, "sign", 0UL, "sign_bundle", 0UL );
      45           0 :   fd_topob_tile_in( topo, "bundle", 0UL, "metric_in", "sign_bundle", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_UNPOLLED );
      46           0 :   fd_topob_tile_in( topo, "sign", 0UL, "metric_in", "bundle_sign", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
      47             : 
      48             :   /* Tile config */
      49             : 
      50           0 :   fd_cstr_ncpy( bundle_tile->bundle.url, config->tiles.bundle.url, sizeof(bundle_tile->bundle.url) );
      51           0 :   bundle_tile->bundle.url_len = strnlen( bundle_tile->bundle.url, sizeof(bundle_tile->bundle.url)-1UL );
      52           0 :   fd_cstr_ncpy( bundle_tile->bundle.sni, config->tiles.bundle.tls_domain_name, sizeof(bundle_tile->bundle.sni) );
      53           0 :   bundle_tile->bundle.sni_len = strnlen( bundle_tile->bundle.sni, sizeof(bundle_tile->bundle.sni)-1UL );
      54           0 :   fd_cstr_ncpy( bundle_tile->bundle.identity_key_path, config->paths.identity_key, sizeof(bundle_tile->bundle.identity_key_path) );
      55           0 :   fd_cstr_ncpy( bundle_tile->bundle.key_log_path, config->development.bundle.ssl_key_log_file, sizeof(bundle_tile->bundle.key_log_path) );
      56           0 :   bundle_tile->bundle.buf_sz = config->development.bundle.buffer_size_kib<<10;
      57           0 :   bundle_tile->bundle.out_depth = config->tiles.verify.receive_buffer_size;
      58           0 :   bundle_tile->bundle.keepalive_interval_nanos = config->tiles.bundle.keepalive_interval_millis * (ulong)1e6;
      59           0 :   bundle_tile->bundle.tls_cert_verify = !!config->tiles.bundle.tls_cert_verify;
      60             : 
      61           0 :   strncpy( sign_tile->sign.identity_key_path, config->paths.identity_key, sizeof(sign_tile->sign.identity_key_path) );
      62             : 
      63           0 :   if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( config->tiles.metric.prometheus_listen_address, &metric_tile->metric.prometheus_listen_addr ) ) )
      64           0 :     FD_LOG_ERR(( "failed to parse prometheus listen address `%s`", config->tiles.metric.prometheus_listen_address ));
      65           0 :   metric_tile->metric.prometheus_listen_port = config->tiles.metric.prometheus_listen_port;
      66             : 
      67             :   /* Wrap up */
      68             : 
      69           0 :   fd_topob_waker( topo );
      70           0 :   fd_topob_finish( topo, CALLBACKS );
      71           0 :   fd_topo_print_log( /* stdout */ 1, topo );
      72           0 : }
      73             : 
      74             : static void
      75             : bundle_client_cmd_args( int *    pargc,
      76             :                         char *** pargv,
      77           0 :                         args_t * args ) {
      78           0 :   (void)pargc; (void)pargv; (void)args;
      79           0 : }
      80             : 
      81             : static void
      82             : bundle_client_cmd_fn( args_t *   args,
      83           0 :                       config_t * config ) {
      84           0 :   (void)args;
      85           0 :   fd_topo_t * topo = &config->topo;
      86           0 :   bundle_client_topo( config );
      87           0 :   initialize_workspaces( config );
      88           0 :   initialize_stacks( config );
      89           0 :   fd_topo_join_workspaces( topo, FD_SHMEM_JOIN_MODE_READ_WRITE, FD_TOPO_CORE_DUMP_LEVEL_DISABLED );
      90             : 
      91           0 :   fd_topo_run_single_process( topo, 2, config->uid, config->gid, fdctl_tile_run );
      92             : 
      93           0 :   for(;;) pause();
      94           0 : }
      95             : 
      96             : static void
      97             : bundle_client_cmd_perm( args_t *         args FD_PARAM_UNUSED,
      98             :                         fd_cap_chk_t *   chk,
      99           0 :                         config_t const * config FD_PARAM_UNUSED ) {
     100           0 :   fd_cap_chk_raise_rlimit( chk, "bundle-client", RLIMIT_NOFILE, CONFIGURE_NR_OPEN_FILES, "call `rlimit(2)` to increase `RLIMIT_NOFILE` for the fixed waker fd range" );
     101           0 : }
     102             : 
     103             : action_t fd_action_bundle_client = {
     104             :   .name          = "bundle-client",
     105             :   .args          = bundle_client_cmd_args,
     106             :   .fn            = bundle_client_cmd_fn,
     107             :   .perm          = bundle_client_cmd_perm,
     108             :   .description   = "Run bundle tile in isolation",
     109             :   .is_diagnostic = 1 /* allow running against live clusters */
     110             : };

Generated by: LCOV version 1.14