Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ContractConfirmationDeadline is the number of blocks since its start // height we wait for a contract to appear on chain. ContractConfirmationDeadline = 18 )
Variables ¶
View Source
var ErrMissingRequiredFields = errors.New("missing required fields in configuration, both allowance and amount must be set")
Functions ¶
func EvaluateConfig ¶
func EvaluateConfig(cfg api.AutopilotConfig, cs api.ConsensusState, fee types.Currency, rs api.RedundancySettings, gs api.GougingSettings, hosts []api.Host) (resp api.ConfigEvaluationResponse, _ error)
EvaluateConfig evaluates the given configuration and if the gouging settings are too strict for the number of contracts required by 'cfg', it will provide a recommendation on how to loosen it.
Types ¶
type Bus ¶
type Bus interface { AncestorContracts(ctx context.Context, id types.FileContractID, minStartHeight uint64) ([]api.ArchivedContract, error) ArchiveContracts(ctx context.Context, toArchive map[types.FileContractID]string) error BroadcastContract(ctx context.Context, fcid types.FileContractID) (types.TransactionID, error) ConsensusState(ctx context.Context) (api.ConsensusState, 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) FormContract(ctx context.Context, renterAddress types.Address, renterFunds types.Currency, hostKey types.PublicKey, hostIP string, hostCollateral types.Currency, endHeight uint64) (api.ContractMetadata, error) RenewContract(ctx context.Context, fcid types.FileContractID, endHeight uint64, renterFunds, minNewCollateral, maxFundAmount types.Currency, expectedNewStorage uint64) (api.ContractMetadata, error) Host(ctx context.Context, hostKey types.PublicKey) (api.Host, error) RecordContractSetChurnMetric(ctx context.Context, metrics ...api.ContractSetChurnMetric) error SearchHosts(ctx context.Context, opts api.SearchHostOptions) ([]api.Host, error) UpdateContractSet(ctx context.Context, set string, toAdd, toRemove []types.FileContractID) error UpdateHostCheck(ctx context.Context, autopilotID string, hostKey types.PublicKey, hostCheck api.HostCheck) error }
type Contractor ¶
type Contractor struct {
// contains filtered or unexported fields
}
func New ¶
func New(bus Bus, alerter alerts.Alerter, logger *zap.SugaredLogger, revisionSubmissionBuffer uint64, revisionBroadcastInterval time.Duration) *Contractor
func (*Contractor) PerformContractMaintenance ¶
func (c *Contractor) PerformContractMaintenance(ctx context.Context, w Worker, state *MaintenanceState) (bool, error)
type MaintenanceState ¶
type MaintenanceState struct { GS api.GougingSettings RS api.RedundancySettings AP api.Autopilot Address types.Address Fee types.Currency SkipContractFormations bool }
MaintenanceState serves as input for the contractor's maintenance. It contains all state that should remain constant across a single round of contract performance.
func (*MaintenanceState) Allowance ¶
func (state *MaintenanceState) Allowance() types.Currency
func (*MaintenanceState) ContractsConfig ¶
func (state *MaintenanceState) ContractsConfig() api.ContractsConfig
func (*MaintenanceState) Period ¶
func (state *MaintenanceState) Period() uint64
type Worker ¶
type Worker interface { Contracts(ctx context.Context, hostTimeout time.Duration) (api.ContractsResponse, error) RHPPriceTable(ctx context.Context, hostKey types.PublicKey, siamuxAddr string, timeout time.Duration) (api.HostPriceTable, error) RHPScan(ctx context.Context, hostKey types.PublicKey, hostIP string, timeout time.Duration) (api.RHPScanResponse, error) }
Click to show internal directories.
Click to hide internal directories.