Skip to content

Commit

Permalink
all: cleanup PR
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjan committed Nov 6, 2024
1 parent 62e584b commit fb00944
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
12 changes: 6 additions & 6 deletions autopilot/autopilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ type Bus interface {
alerts.Alerter
webhooks.Broadcaster

// Accounts
// accounts
Accounts(ctx context.Context, owner string) (accounts []api.Account, err error)

// autopilot
AutopilotState(ctx context.Context) (cfg api.AutopilotState, err error)
UpdateAutopilotConfig(ctx context.Context, cfg api.AutopilotConfig) error
UpdateAutopilotPeriod(ctx context.Context, period uint64) error

// consensus
ConsensusNetwork(ctx context.Context) (consensus.Network, error)
ConsensusState(ctx context.Context) (api.ConsensusState, error)
Expand Down Expand Up @@ -77,11 +82,6 @@ type Bus interface {
GougingSettings(ctx context.Context) (gs api.GougingSettings, err error)
UploadSettings(ctx context.Context) (us api.UploadSettings, err error)

// state
AutopilotState(ctx context.Context) (cfg api.AutopilotState, err error)
UpdateAutopilotConfig(ctx context.Context, cfg api.AutopilotConfig) error
UpdateAutopilotPeriod(ctx context.Context, period uint64) error

// syncer
SyncerPeers(ctx context.Context) (resp []string, err error)

Expand Down
2 changes: 1 addition & 1 deletion autopilot/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (m *migrator) performMigrations(p *workerPool) {
m.logger.Errorf("failed to fetch autopilot state: %w", err)
return
}
set := state.AutopilotConfig.Contracts.Set
set := state.Contracts.Set
if set == "" {
m.logger.Error("could not perform migrations, no contract set configured")
return
Expand Down
6 changes: 3 additions & 3 deletions bus/bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ type (
// Store is a collection of stores used by the bus.
Store interface {
AccountStore
AutopilotStore
BackupStore
ChainStore
HostStore
MetadataStore
MetricsStore
SettingStore
StateStore
}

// AccountStore persists information about accounts. Since accounts
Expand All @@ -183,8 +183,8 @@ type (
SaveAccounts(context.Context, []api.Account) error
}

// A StateStore stores various configuration.
StateStore interface {
// A AutopilotStore stores autopilot state.
AutopilotStore interface {
AutopilotState(ctx context.Context) (api.AutopilotState, error)
UpdateAutopilotConfig(ctx context.Context, cfg api.AutopilotConfig) error
UpdateAutopilotPeriod(ctx context.Context, period uint64) error
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion internal/sql/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,9 @@ var (
} else if err := json.Unmarshal(cfgraw, &cfg); err != nil {
log.Warnf("existing autopilot config not valid JSON, err %v", err)
} else {
res, err := tx.Exec(ctx, `UPDATE autopilot_state SET current_period = ?,contracts_amount = ?,contracts_period = ?,contracts_renew_window = ?,contracts_download = ?,contracts_upload = ?,contracts_storage = ?,contracts_prune = ?,hosts_allow_redundant_ips = ?,hosts_max_downtime_hours = ?,hosts_min_protocol_version = ?,hosts_max_consecutive_scan_failures = ? WHERE id = ?`,
res, err := tx.Exec(ctx, `UPDATE autopilot_state SET current_period = ?, contracts_set = ?, contracts_amount = ?, contracts_period = ?, contracts_renew_window = ?, contracts_download = ?, contracts_upload = ?, contracts_storage = ?, contracts_prune = ?, hosts_allow_redundant_ips = ?, hosts_max_downtime_hours = ?, hosts_min_protocol_version = ?, hosts_max_consecutive_scan_failures = ? WHERE id = ?`,
period,
cfg.Contracts.Set,
cfg.Contracts.Amount,
cfg.Contracts.Period,
cfg.Contracts.RenewWindow,
Expand Down
File renamed without changes.

0 comments on commit fb00944

Please sign in to comment.