Documentation ¶
Overview ¶
Copyright (c) 2014-2020 Montana Flynn (https://montanaflynn.com)
Index ¶
- type AccountStore
- type Autopilot
- func (ap *Autopilot) Config(ctx context.Context) (api.Autopilot, error)
- func (ap *Autopilot) DismissAlert(ctx context.Context, ids ...types.Hash256)
- func (ap *Autopilot) Handler() http.Handler
- func (ap *Autopilot) RegisterAlert(ctx context.Context, a alerts.Alert)
- func (ap *Autopilot) Run() error
- func (ap *Autopilot) Shutdown(_ context.Context) error
- func (ap *Autopilot) StartTime() time.Time
- func (ap *Autopilot) Trigger(forceScan bool) bool
- func (ap *Autopilot) Uptime() (dur time.Duration)
- type Bus
- type Client
- func (c *Client) Config() (cfg api.AutopilotConfig, err error)
- func (c *Client) EvaluateConfig(ctx context.Context, cfg api.AutopilotConfig, gs api.GougingSettings, ...) (resp api.ConfigEvaluationResponse, err error)
- func (c *Client) HostInfo(hostKey types.PublicKey) (resp api.HostResponse, err error)
- func (c *Client) HostInfos(ctx context.Context, filterMode, usabilityMode, addressContains string, ...) (resp []api.HostResponse, err error)
- func (c *Client) State() (state api.AutopilotStateResponse, err error)
- func (c *Client) Trigger(forceScan bool) (_ bool, err error)
- func (c *Client) UpdateConfig(cfg api.AutopilotConfig) error
- type ContractStore
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountStore ¶
type Autopilot ¶
type Autopilot struct {
// contains filtered or unexported fields
}
func New ¶
func New(id string, bus Bus, workers []Worker, logger *zap.Logger, heartbeat time.Duration, scannerScanInterval time.Duration, scannerBatchSize, scannerNumThreads uint64, migrationHealthCutoff float64, accountsRefillInterval time.Duration, revisionSubmissionBuffer, migratorParallelSlabsPerWorker uint64, revisionBroadcastInterval time.Duration) (*Autopilot, error)
New initializes an Autopilot.
func (*Autopilot) DismissAlert ¶ added in v0.7.0
func (*Autopilot) RegisterAlert ¶ added in v0.7.0
type Bus ¶
type Bus interface { alerts.Alerter webhooks.Broadcaster // Accounts Account(ctx context.Context, id rhpv3.Account, hostKey types.PublicKey) (account api.Account, err error) Accounts(ctx context.Context) (accounts []api.Account, err error) // Autopilots Autopilot(ctx context.Context, id string) (autopilot api.Autopilot, err error) UpdateAutopilot(ctx context.Context, autopilot api.Autopilot) error // consensus ConsensusState(ctx context.Context) (api.ConsensusState, error) // contracts AddContract(ctx context.Context, c rhpv2.ContractRevision, contractPrice, totalCost types.Currency, startHeight uint64, state string) (api.ContractMetadata, error) AddRenewedContract(ctx context.Context, c rhpv2.ContractRevision, contractPrice, totalCost types.Currency, startHeight uint64, renewedFrom types.FileContractID, state string) (api.ContractMetadata, error) AncestorContracts(ctx context.Context, id types.FileContractID, minStartHeight uint64) ([]api.ArchivedContract, error) ArchiveContracts(ctx context.Context, toArchive map[types.FileContractID]string) error Contract(ctx context.Context, id types.FileContractID) (api.ContractMetadata, error) Contracts(ctx context.Context, opts api.ContractsOpts) (contracts []api.ContractMetadata, err error) FileContractTax(ctx context.Context, payout types.Currency) (types.Currency, error) SetContractSet(ctx context.Context, set string, contracts []types.FileContractID) error PrunableData(ctx context.Context) (prunableData api.ContractsPrunableDataResponse, err error) // hostdb Host(ctx context.Context, hostKey types.PublicKey) (api.Host, error) HostsForScanning(ctx context.Context, opts api.HostsForScanningOptions) ([]api.HostAddress, error) RemoveOfflineHosts(ctx context.Context, minRecentScanFailures uint64, maxDowntime time.Duration) (uint64, error) SearchHosts(ctx context.Context, opts api.SearchHostOptions) ([]api.Host, error) UpdateHostCheck(ctx context.Context, autopilotID string, hostKey types.PublicKey, hostCheck api.HostCheck) error // metrics RecordContractSetChurnMetric(ctx context.Context, metrics ...api.ContractSetChurnMetric) error RecordContractPruneMetric(ctx context.Context, metrics ...api.ContractPruneMetric) error // buckets ListBuckets(ctx context.Context) ([]api.Bucket, error) // objects ObjectsBySlabKey(ctx context.Context, bucket string, key object.EncryptionKey) (objects []api.ObjectMetadata, err error) RefreshHealth(ctx context.Context) error Slab(ctx context.Context, key object.EncryptionKey) (object.Slab, error) SlabsForMigration(ctx context.Context, healthCutoff float64, set string, limit int) ([]api.UnhealthySlab, error) // settings UpdateSetting(ctx context.Context, key string, value interface{}) error GougingSettings(ctx context.Context) (gs api.GougingSettings, err error) RedundancySettings(ctx context.Context) (rs api.RedundancySettings, err error) // syncer SyncerPeers(ctx context.Context) (resp []string, err error) // txpool RecommendedFee(ctx context.Context) (types.Currency, error) TransactionPool(ctx context.Context) (txns []types.Transaction, err error) // wallet Wallet(ctx context.Context) (api.WalletResponse, error) WalletDiscard(ctx context.Context, txn types.Transaction) error WalletOutputs(ctx context.Context) (resp []wallet.SiacoinElement, err error) WalletPending(ctx context.Context) (resp []types.Transaction, err error) WalletRedistribute(ctx context.Context, outputs int, amount types.Currency) (ids []types.TransactionID, err error) }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client provides methods for interacting with an autopilot.
func (*Client) Config ¶
func (c *Client) Config() (cfg api.AutopilotConfig, err error)
Config returns the autopilot config.
func (*Client) EvaluateConfig ¶ added in v1.0.6
func (c *Client) EvaluateConfig(ctx context.Context, cfg api.AutopilotConfig, gs api.GougingSettings, rs api.RedundancySettings) (resp api.ConfigEvaluationResponse, err error)
EvalutateConfig evaluates an autopilot config using the given gouging and redundancy settings.
func (*Client) HostInfos ¶
func (c *Client) HostInfos(ctx context.Context, filterMode, usabilityMode, addressContains string, keyIn []types.PublicKey, offset, limit int) (resp []api.HostResponse, err error)
HostInfo returns information about all hosts.
func (*Client) State ¶
func (c *Client) State() (state api.AutopilotStateResponse, err error)
State returns the current state of the autopilot.
func (*Client) UpdateConfig ¶
func (c *Client) UpdateConfig(cfg api.AutopilotConfig) error
UpdateConfig updates the autopilot config.
type ContractStore ¶
type ContractStore interface {
Contracts(ctx context.Context, opts api.ContractsOpts) ([]api.ContractMetadata, error)
}
type Worker ¶
type Worker interface { Account(ctx context.Context, hostKey types.PublicKey) (rhpv3.Account, error) Contracts(ctx context.Context, hostTimeout time.Duration) (api.ContractsResponse, error) ID(ctx context.Context) (string, error) MigrateSlab(ctx context.Context, s object.Slab, set string) (api.MigrateSlabResponse, error) RHPBroadcast(ctx context.Context, fcid types.FileContractID) (err error) RHPForm(ctx context.Context, endHeight uint64, hk types.PublicKey, hostIP string, renterAddress types.Address, renterFunds types.Currency, hostCollateral types.Currency) (rhpv2.ContractRevision, []types.Transaction, error) RHPFund(ctx context.Context, contractID types.FileContractID, hostKey types.PublicKey, hostIP, siamuxAddr string, balance types.Currency) (err error) RHPPriceTable(ctx context.Context, hostKey types.PublicKey, siamuxAddr string, timeout time.Duration) (api.HostPriceTable, error) RHPPruneContract(ctx context.Context, fcid types.FileContractID, timeout time.Duration) (pruned, remaining uint64, err error) RHPRenew(ctx context.Context, fcid types.FileContractID, endHeight uint64, hk types.PublicKey, hostIP string, hostAddress, renterAddress types.Address, renterFunds, minNewCollateral, maxFundAmount types.Currency, expectedStorage, windowSize uint64) (api.RHPRenewResponse, error) RHPScan(ctx context.Context, hostKey types.PublicKey, hostIP string, timeout time.Duration) (api.RHPScanResponse, error) RHPSync(ctx context.Context, contractID types.FileContractID, hostKey types.PublicKey, hostIP, siamuxAddr string) (err error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.