Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
urvisavla committed Feb 22, 2024
1 parent 8d91ef3 commit ec4283b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions exp/services/ledgerexporter/internal/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ func NewApp() *App {
}

func (a *App) init(ctx context.Context) {
a.destinationStorage = NewDestinationStorage(ctx, &a.config)
a.backend = NewLedgerBackend(ctx, a.config)
a.destinationStorage = mustNewDataStore(ctx, &a.config)
a.backend = mustNewLedgerBackend(ctx, a.config)
a.exportManager = NewExportManager(a.config.ExporterConfig, a.backend)
a.uploader = NewUploader(a.destinationStorage, a.exportManager.GetMetaArchiveChannel())
}

func (a *App) Close() {
func (a *App) close() {
//TODO: error handling
a.destinationStorage.Close()
a.backend.Close()
Expand Down Expand Up @@ -100,20 +100,20 @@ func (a *App) Run() {

wg.Wait()

a.Close()
a.close()

logger.Info("Shutting down ledger-exporter.")
}

func NewDestinationStorage(ctx context.Context, config *Config) DataStore {
func mustNewDataStore(ctx context.Context, config *Config) DataStore {
destinationStorage, err := NewDataStore(ctx, fmt.Sprintf("%s/%s", config.DestinationURL, config.Network))
logFatalIf(err, "Could not connect to destination storage")
return destinationStorage
}

// NewLedgerBackend Creates and initializes captive core ledger backend
// mustNewLedgerBackend Creates and initializes captive core ledger backend
// Currently, only supports captive-core as ledger backend
func NewLedgerBackend(ctx context.Context, config Config) ledgerbackend.LedgerBackend {
func mustNewLedgerBackend(ctx context.Context, config Config) ledgerbackend.LedgerBackend {
captiveConfig := config.GenerateCaptiveCoreConfig()

// Create a new captive core backend
Expand Down

0 comments on commit ec4283b

Please sign in to comment.