@@ -106,6 +106,9 @@ type captiveCoreTomlValues struct {
106
106
EnableDiagnosticsForTxSubmission * bool `toml:"ENABLE_DIAGNOSTICS_FOR_TX_SUBMISSION,omitempty"`
107
107
EnableEmitSorobanTransactionMetaExtV1 * bool `toml:"EMIT_SOROBAN_TRANSACTION_META_EXT_V1,omitempty"`
108
108
EnableEmitLedgerCloseMetaExtV1 * bool `toml:"EMIT_LEDGER_CLOSE_META_EXT_V1,omitempty"`
109
+ HTTPQueryPort * uint `toml:"HTTP_QUERY_PORT,omitempty"`
110
+ QueryThreadPoolSize * uint `toml:"QUERY_THREAD_POOL_SIZE,omitempty"`
111
+ QuerySnapshotLedgers * uint `toml:"QUERY_SNAPSHOT_LEDGERS,omitempty"`
109
112
}
110
113
111
114
// QuorumSetIsConfigured returns true if there is a quorum set defined in the configuration.
@@ -321,6 +324,12 @@ func (c *CaptiveCoreToml) unmarshal(data []byte, strict bool) error {
321
324
return nil
322
325
}
323
326
327
+ type HTTPQueryServerParams struct {
328
+ Port uint16
329
+ ThreadPoolSize uint16
330
+ SnapshotLedgers uint16
331
+ }
332
+
324
333
// CaptiveCoreTomlParams defines captive core configuration provided by Horizon flags.
325
334
type CaptiveCoreTomlParams struct {
326
335
// NetworkPassphrase is the Stellar network passphrase used by captive core when connecting to the Stellar network.
@@ -346,6 +355,8 @@ type CaptiveCoreTomlParams struct {
346
355
EnforceSorobanDiagnosticEvents bool
347
356
// Enfore EnableSorobanTransactionMetaExtV1 when not disabled explicitly
348
357
EnforceSorobanTransactionMetaExtV1 bool
358
+ // Fast HTTP Query Server parameters
359
+ HTTPQueryServerParams * HTTPQueryServerParams
349
360
}
350
361
351
362
// NewCaptiveCoreTomlFromFile constructs a new CaptiveCoreToml instance by merging configuration
@@ -498,6 +509,18 @@ func (c *CaptiveCoreToml) setDefaults(params CaptiveCoreTomlParams) {
498
509
if params .EnforceSorobanTransactionMetaExtV1 {
499
510
enforceOption (& c .EnableEmitSorobanTransactionMetaExtV1 )
500
511
}
512
+
513
+ if params .HTTPQueryServerParams != nil {
514
+ port := uint (params .HTTPQueryServerParams .Port )
515
+ c .HTTPQueryPort = & port
516
+
517
+ ledgers := uint (params .HTTPQueryServerParams .SnapshotLedgers )
518
+ c .QuerySnapshotLedgers = & ledgers
519
+
520
+ poolSize := uint (params .HTTPQueryServerParams .ThreadPoolSize )
521
+ c .QueryThreadPoolSize = & poolSize
522
+
523
+ }
501
524
}
502
525
503
526
func enforceOption (opt * * bool ) {
@@ -516,36 +539,62 @@ func enforceOption(opt **bool) {
516
539
func (c * CaptiveCoreToml ) validate (params CaptiveCoreTomlParams ) error {
517
540
if def := c .tree .Has ("NETWORK_PASSPHRASE" ); def && c .NetworkPassphrase != params .NetworkPassphrase {
518
541
return fmt .Errorf (
519
- "NETWORK_PASSPHRASE in captive core config file: %s does not match Horizon network-passphrase flag: %s " ,
542
+ "NETWORK_PASSPHRASE in captive core config file: %s does not match passed configuration (%s) " ,
520
543
c .NetworkPassphrase ,
521
544
params .NetworkPassphrase ,
522
545
)
523
546
}
524
547
525
548
if def := c .tree .Has ("HTTP_PORT" ); def && params .HTTPPort != nil && c .HTTPPort != * params .HTTPPort {
526
549
return fmt .Errorf (
527
- "HTTP_PORT in captive core config file: %d does not match Horizon captive-core-http-port flag: %d " ,
550
+ "HTTP_PORT in captive core config file: %d does not match passed configuration (%d) " ,
528
551
c .HTTPPort ,
529
552
* params .HTTPPort ,
530
553
)
531
554
}
532
555
533
556
if def := c .tree .Has ("PEER_PORT" ); def && params .PeerPort != nil && c .PeerPort != * params .PeerPort {
534
557
return fmt .Errorf (
535
- "PEER_PORT in captive core config file: %d does not match Horizon captive-core-peer-port flag: %d " ,
558
+ "PEER_PORT in captive core config file: %d does not match passed configuration (%d) " ,
536
559
c .PeerPort ,
537
560
* params .PeerPort ,
538
561
)
539
562
}
540
563
541
564
if def := c .tree .Has ("LOG_FILE_PATH" ); def && params .LogPath != nil && c .LogFilePath != * params .LogPath {
542
565
return fmt .Errorf (
543
- "LOG_FILE_PATH in captive core config file: %s does not match Horizon captive-core-log-path flag: %s " ,
566
+ "LOG_FILE_PATH in captive core config file: %s does not match passed configuration (%s) " ,
544
567
c .LogFilePath ,
545
568
* params .LogPath ,
546
569
)
547
570
}
548
571
572
+ if params .HTTPQueryServerParams != nil {
573
+ if c .HTTPQueryPort != nil && * c .HTTPQueryPort != uint (params .HTTPQueryServerParams .Port ) {
574
+ return fmt .Errorf (
575
+ "HTTP_QUERY_PORT in captive core config file: %d does not match passed configuration (%d)" ,
576
+ c .PeerPort ,
577
+ * params .PeerPort ,
578
+ )
579
+ }
580
+
581
+ if c .QueryThreadPoolSize != nil && * c .QueryThreadPoolSize != uint (params .HTTPQueryServerParams .ThreadPoolSize ) {
582
+ return fmt .Errorf (
583
+ "QUERY_THREADPOOL_SIZE in captive core config file: %d does not match passed configuration (%d)" ,
584
+ c .PeerPort ,
585
+ * params .PeerPort ,
586
+ )
587
+ }
588
+
589
+ if c .QuerySnapshotLedgers != nil && * c .QuerySnapshotLedgers != uint (params .HTTPQueryServerParams .SnapshotLedgers ) {
590
+ return fmt .Errorf (
591
+ "QUERY_SNAPSHOT_LEDGERS in captive core config file: %d does not match passed configuration (%d)" ,
592
+ c .PeerPort ,
593
+ * params .PeerPort ,
594
+ )
595
+ }
596
+ }
597
+
549
598
if c .tree .Has ("DEPRECATED_SQL_LEDGER_STATE" ) {
550
599
if params .UseDB && * c .DeprecatedSqlLedgerState {
551
600
return fmt .Errorf ("CAPTIVE_CORE_USE_DB parameter is set to true, indicating stellar-core on-disk mode," +
0 commit comments