Documentation ¶
Index ¶
- Constants
- Variables
- func CompareTimeRFC3339(t1, t2 TimeRFC3339) bool
- func FormatETag(eTag string) string
- func ObjectPathEscape(path string) string
- func ParseEventWebhook(event webhooks.Event) (interface{}, error)
- type Account
- type AccountHandlerPOST
- type AccountsAddBalanceRequest
- type AccountsFundRequest
- type AccountsFundResponse
- type AccountsLockHandlerRequest
- type AccountsLockHandlerResponse
- type AccountsRequiresSyncRequest
- type AccountsSaveRequest
- type AccountsUnlockHandlerRequest
- type AccountsUpdateBalanceRequest
- type AddObjectOptions
- type AddObjectRequest
- type AddPartialSlabResponse
- type ArchivedContract
- type Autopilot
- type AutopilotConfig
- type AutopilotPins
- type AutopilotStateResponse
- type AutopilotTriggerRequest
- type AutopilotTriggerResponse
- type Bucket
- type BucketCreateRequest
- type BucketPolicy
- type BucketUpdatePolicyRequest
- type BuildState
- type BusStateResponse
- type CompleteMultipartOptions
- type ConfigEvaluationRequest
- type ConfigEvaluationResponse
- type ConfigRecommendation
- type ConsensusNetwork
- type ConsensusState
- type ContentRange
- type Contract
- type ContractAcquireRequest
- type ContractAcquireResponse
- type ContractAddRequest
- type ContractFormRequest
- type ContractKeepaliveRequest
- type ContractMetadata
- type ContractMetric
- type ContractMetricRequestPUT
- type ContractMetricsQueryOpts
- type ContractPrunableData
- type ContractPruneMetric
- type ContractPruneMetricRequestPUT
- type ContractPruneMetricsQueryOpts
- type ContractPruneRequest
- type ContractPruneResponse
- type ContractReleaseRequest
- type ContractRenewRequest
- type ContractRenewedRequest
- type ContractRootsResponse
- type ContractSetChurnMetric
- type ContractSetChurnMetricRequestPUT
- type ContractSetChurnMetricsQueryOpts
- type ContractSetMetric
- type ContractSetMetricsQueryOpts
- type ContractSetSetting
- type ContractSetUpdateRequest
- type ContractSize
- type ContractSpending
- type ContractSpendingRecord
- type ContractState
- type ContractsArchiveRequest
- type ContractsConfig
- type ContractsOpts
- type ContractsPrunableDataResponse
- type ContractsResponse
- type CopyObjectOptions
- type CopyObjectsRequest
- type CreateBucketOptions
- type CreateMultipartOptions
- type DeleteObjectOptions
- type DownloadObjectOptions
- type DownloadRange
- type DownloadStatsResponse
- type DownloaderStats
- type DurationH
- type DurationMS
- type EventConsensusUpdate
- type EventContractAdd
- type EventContractArchive
- type EventContractRenew
- type EventContractSetUpdate
- type EventHostUpdate
- type EventSettingDelete
- type EventSettingUpdate
- type GetHostsOptions
- type GetObjectOptions
- type GetObjectResponse
- type GougingParams
- type GougingSettings
- type GougingSettingsPins
- type HeadObjectOptions
- type HeadObjectResponse
- type Host
- type HostAddress
- type HostCheck
- type HostChecks
- type HostGougingBreakdown
- type HostInteractions
- type HostPriceTable
- type HostPriceTableUpdate
- type HostResponse
- type HostScan
- type HostScoreBreakdown
- type HostUsabilityBreakdown
- type HostsConfig
- type HostsForScanningOptions
- type HostsPriceTablesRequest
- type HostsRemoveRequest
- type HostsScanRequest
- type ListObjectOptions
- type MemoryResponse
- type MemoryStatus
- type MigrateSlabResponse
- type MigrationSlabsRequest
- type MultipartAbortRequest
- type MultipartAddPartRequest
- type MultipartCompleteRequest
- type MultipartCompleteResponse
- type MultipartCompletedPart
- type MultipartCreateRequest
- type MultipartCreateResponse
- type MultipartListPartItem
- type MultipartListPartsRequest
- type MultipartListPartsResponse
- type MultipartListUploadsRequest
- type MultipartListUploadsResponse
- type MultipartUpload
- type Object
- type ObjectMetadata
- type ObjectUserMetadata
- type ObjectsListRequest
- type ObjectsListResponse
- type ObjectsRenameRequest
- type ObjectsResponse
- type ObjectsStatsOpts
- type ObjectsStatsResponse
- type PackedSlab
- type PackedSlabsRequestGET
- type PackedSlabsRequestPOST
- type ParamCurrency
- type ParamString
- type PerformanceMetricsQueryOpts
- type Pin
- type PricePinSettings
- type RHPFormResponse
- type RHPFundRequest
- type RHPPreparePaymentRequest
- type RHPPriceTableRequest
- type RHPScanRequest
- type RHPScanResponse
- type RHPSyncRequest
- type RedundancySettings
- type S3AuthenticationSettings
- type SearchHostOptions
- type SearchHostsRequest
- type SearchObjectOptions
- type SiacoinElement
- type SlabBuffer
- type SlabID
- type TimeRFC3339
- type Transaction
- type UnhealthySlab
- type UnhealthySlabsResponse
- type UpdateAllowlistRequest
- type UpdateBlocklistRequest
- type UpdateSlabRequest
- type UploadID
- type UploadMultipartUploadPartOptions
- type UploadMultipartUploadPartResponse
- type UploadObjectOptions
- type UploadObjectResponse
- type UploadPackingSettings
- type UploadParams
- type UploadSectorRequest
- type UploadStatsResponse
- type UploadedPackedSlab
- type UploaderStats
- type WalletFundRequest
- type WalletFundResponse
- type WalletMetric
- type WalletMetricsQueryOpts
- type WalletRedistributeRequest
- type WalletResponse
- type WalletSendRequest
- type WalletSignRequest
- type WalletTransactionsOption
- type WebhookResponse
- type WorkerStateResponse
Constants ¶
const ( // BlocksPerDay defines the amount of blocks that are mined in a day (one // block every 10 minutes roughly) BlocksPerDay = 144 // DefaultAutopilotID is the id of the autopilot. DefaultAutopilotID = "autopilot" )
const ( ContractStateInvalid = "invalid" ContractStateUnknown = "unknown" ContractStatePending = "pending" ContractStateActive = "active" ContractStateComplete = "complete" ContractStateFailed = "failed" )
const ( ContractArchivalReasonHostPruned = "hostpruned" ContractArchivalReasonRemoved = "removed" ContractArchivalReasonRenewed = "renewed" )
const ( ModuleConsensus = "consensus" ModuleContract = "contract" ModuleContractSet = "contract_set" ModuleHost = "host" ModuleSetting = "setting" EventAdd = "add" EventUpdate = "update" EventDelete = "delete" EventArchive = "archive" EventRenew = "renew" )
const ( HostFilterModeAll = "all" HostFilterModeAllowed = "allowed" HostFilterModeBlocked = "blocked" UsabilityFilterModeAll = "all" UsabilityFilterModeUsable = "usable" UsabilityFilterModeUnusable = "unusable" )
const ( MetricMaxIntervals = 1000 ChurnDirAdded = "added" ChurnDirRemoved = "removed" MetricContractPrune = "contractprune" MetricContractSet = "contractset" MetricContractSetChurn = "churn" MetricContract = "contract" MetricPerformance = "performance" MetricWallet = "wallet" )
const ( ObjectMetadataPrefix = "X-Sia-Meta-" ObjectsRenameModeSingle = "single" ObjectsRenameModeMulti = "multi" ObjectSortByHealth = "health" ObjectSortByName = "name" ObjectSortBySize = "size" ObjectSortDirAsc = "asc" ObjectSortDirDesc = "desc" )
const ( SettingContractSet = "contractset" SettingGouging = "gouging" SettingPricePinning = "pricepinning" SettingRedundancy = "redundancy" SettingS3Authentication = "s3authentication" SettingUploadPacking = "uploadpacking" )
const ( S3MinAccessKeyLen = 16 S3MaxAccessKeyLen = 128 S3SecretKeyLen = 40 )
const (
DefaultBucketName = "default"
)
Variables ¶
var ( // ErrAutopilotNotFound is returned when an autopilot can't be found. ErrAutopilotNotFound = errors.New("couldn't find autopilot") // ErrMaxDowntimeHoursTooHigh is returned if the autopilot config is updated // with a value that exceeds the maximum of 99 years. ErrMaxDowntimeHoursTooHigh = errors.New("MaxDowntimeHours is too high, exceeds max value of 99 years") )
var ( // ErrBucketExists is returned when trying to create a bucket that already // exists. ErrBucketExists = errors.New("bucket already exists") // ErrBucketNotEmpty is returned when trying to delete a bucket that is not // empty. ErrBucketNotEmpty = errors.New("bucket not empty") // ErrBucketNotFound is returned when an bucket can't be retrieved from the // database. ErrBucketNotFound = errors.New("bucket not found") )
var ( ErrMarkerNotFound = errors.New("marker not found") ErrMaxFundAmountExceeded = errors.New("renewal exceeds max fund amount") )
var ( // ErrContractNotFound is returned when a contract can't be retrieved from // the database. ErrContractNotFound = errors.New("couldn't find contract") // ErrContractSetNotFound is returned when a contract set can't be retrieved // from the database. ErrContractSetNotFound = errors.New("couldn't find contract set") )
var ( WebhookConsensusUpdate = func(url string, headers map[string]string) webhooks.Webhook { return webhooks.Webhook{ Event: EventUpdate, Headers: headers, Module: ModuleConsensus, URL: url, } } WebhookContractAdd = func(url string, headers map[string]string) webhooks.Webhook { return webhooks.Webhook{ Event: EventAdd, Headers: headers, Module: ModuleContract, URL: url, } } WebhookContractArchive = func(url string, headers map[string]string) webhooks.Webhook { return webhooks.Webhook{ Event: EventArchive, Headers: headers, Module: ModuleContract, URL: url, } } WebhookContractRenew = func(url string, headers map[string]string) webhooks.Webhook { return webhooks.Webhook{ Event: EventRenew, Headers: headers, Module: ModuleContract, URL: url, } } WebhookContractSetUpdate = func(url string, headers map[string]string) webhooks.Webhook { return webhooks.Webhook{ Event: EventUpdate, Headers: headers, Module: ModuleContractSet, URL: url, } } WebhookHostUpdate = func(url string, headers map[string]string) webhooks.Webhook { return webhooks.Webhook{ Event: EventUpdate, Headers: headers, Module: ModuleHost, URL: url, } } WebhookSettingUpdate = func(url string, headers map[string]string) webhooks.Webhook { return webhooks.Webhook{ Event: EventUpdate, Headers: headers, Module: ModuleSetting, URL: url, } } WebhookSettingDelete = func(url string, headers map[string]string) webhooks.Webhook { return webhooks.Webhook{ Event: EventDelete, Headers: headers, Module: ModuleSetting, URL: url, } } )
var ( ErrUsabilityHostBlocked = errors.New("host is blocked") ErrUsabilityHostNotFound = errors.New("host not found") ErrUsabilityHostOffline = errors.New("host is offline") ErrUsabilityHostLowScore = errors.New("host's score is below minimum") ErrUsabilityHostRedundantIP = errors.New("host has redundant IP") ErrUsabilityHostPriceGouging = errors.New("host is price gouging") ErrUsabilityHostNotAcceptingContracts = errors.New("host is not accepting contracts") ErrUsabilityHostNotCompletingScan = errors.New("host is not completing scan") ErrUsabilityHostNotAnnounced = errors.New("host is not announced") )
var ( // ErrInvalidMultipartEncryptionSettings is returned if the multipart upload // has an invalid combination of encryption params. e.g. when encryption is // enabled but not offset is set. ErrInvalidMultipartEncryptionSettings = errors.New("invalid multipart encryption settings") // ErrMultipartUploadNotFound is returned if the specified multipart upload // wasn't found. ErrMultipartUploadNotFound = errors.New("multipart upload not found") // ErrPartNotFound is returned if the specified part of a multipart upload // wasn't found. ErrPartNotFound = errors.New("multipart upload part not found") // ErrUploadAlreadyExists is returned when starting an upload with an id // that's already in use. ErrUploadAlreadyExists = errors.New("upload already exists") // ErrUnknownUpload is returned when adding sectors for an upload id that's // not known. ErrUnknownUpload = errors.New("unknown upload") )
var ( // ErrObjectExists is returned when an operation fails because an object // already exists. ErrObjectExists = errors.New("object already exists") // ErrObjectNotFound is returned when an object can't be retrieved from the // database. ErrObjectNotFound = errors.New("object not found") // ErrObjectCorrupted is returned if we were unable to retrieve the object // from the database. ErrObjectCorrupted = errors.New("object corrupted") // ErrInvalidObjectSortParameters is returned when invalid sort parameters // were provided ErrInvalidObjectSortParameters = errors.New("invalid sort parameters") // ErrSlabNotFound is returned when a slab can't be retrieved from the // database. ErrSlabNotFound = errors.New("slab not found") )
var ( // ErrInvalidRedundancySettings is returned if the redundancy settings are // not valid ErrInvalidRedundancySettings = errors.New("invalid redundancy settings") // ErrSettingNotFound is returned if a requested setting is not present in the // database. ErrSettingNotFound = errors.New("setting not found") // DefaultGougingSettings define the default gouging settings the bus is // configured with on startup. These values can be adjusted using the // settings API. // DefaultGougingSettings = GougingSettings{ MaxRPCPrice: types.Siacoins(1).Div64(1000), MaxContractPrice: types.Siacoins(15), MaxDownloadPrice: types.Siacoins(3000), MaxUploadPrice: types.Siacoins(3000), MaxStoragePrice: types.Siacoins(3000).Div64(1e12).Div64(144 * 30), HostBlockHeightLeeway: 6, MinPriceTableValidity: 5 * time.Minute, MinAccountExpiry: 24 * time.Hour, MinMaxEphemeralAccountBalance: types.Siacoins(1), MigrationSurchargeMultiplier: 10, } // DefaultPricePinSettings define the default price pin settings the bus is // configured with on startup. These values can be adjusted using the // settings API. DefaultPricePinSettings = PricePinSettings{ Enabled: false, Currency: "usd", ForexEndpointURL: "https://api.siascan.com/exchange-rate/siacoin", Threshold: 0.05, } // DefaultUploadPackingSettings define the default upload packing settings // the bus is configured with on startup. DefaultUploadPackingSettings = UploadPackingSettings{ Enabled: true, SlabBufferMaxSizeSoft: 1 << 32, } // DefaultRedundancySettings define the default redundancy settings the bus // is configured with on startup. These values can be adjusted using the // settings API. // // NOTE: default redundancy settings for testnet are different from mainnet. DefaultRedundancySettings = RedundancySettings{ MinShards: 10, TotalShards: 30, } // Same as DefaultRedundancySettings but for running on testnet networks due // to their reduced number of hosts. DefaultRedundancySettingsTestnet = RedundancySettings{ MinShards: 2, TotalShards: 6, } )
var ( // ErrConsensusNotSynced is returned by the worker API by endpoints that rely on // consensus and the consensus is not synced. ErrConsensusNotSynced = errors.New("consensus is not synced") // ErrContractSetNotSpecified is returned by the worker API by endpoints that // need a contract set to be able to upload data. ErrContractSetNotSpecified = errors.New("contract set is not specified") // ErrHostOnPrivateNetwork is returned by the worker API when a host can't // be scanned since it is on a private network. ErrHostOnPrivateNetwork = errors.New("host is on a private network") // ErrMultiRangeNotSupported is returned by the worker API when a request // tries to download multiple ranges at once. ErrMultiRangeNotSupported = errors.New("multipart ranges are not supported") )
var ( // ErrHostNotFound is returned when a host can't be retrieved from the // database. ErrHostNotFound = errors.New("host doesn't exist in hostdb") )
var (
ErrMaxIntervalsExceeded = fmt.Errorf("max number of intervals exceeds maximum of %v", MetricMaxIntervals)
)
var ( // ErrRequiresSyncSetRecently indicates that an account can't be set to sync // yet because it has been set too recently. ErrRequiresSyncSetRecently = errors.New("account had 'requiresSync' flag set recently") )
var (
ErrUnknownEvent = errors.New("unknown event")
)
Functions ¶
func CompareTimeRFC3339 ¶ added in v0.7.0
func CompareTimeRFC3339(t1, t2 TimeRFC3339) bool
CompareTimeRFC3339 is a comparer function to be used with cmp.Comparer.
func FormatETag ¶ added in v0.6.0
func ObjectPathEscape ¶ added in v0.7.0
func ParseEventWebhook ¶ added in v1.0.8
Types ¶
type Account ¶
type Account struct { // ID identifies an account. It's a public key. ID rhpv3.Account `json:"id"` // CleanShutdown indicates whether the account was saved during a clean // shutdown CleanShutdown bool `json:"cleanShutdown"` // HostKey describes the host the account was created with. HostKey types.PublicKey `json:"hostKey"` // Balance is the balance of the account. Balance *big.Int `json:"balance"` // Drift is the accumulated delta between the bus' tracked balance for // an account and the balance reported by a host. Drift *big.Int `json:"drift"` // Owner is the owner of the account which is responsible for funding // it. Owner string `json:"owner"` // RequiresSync indicates whether an account needs to be synced with the // host before it can be used again. RequiresSync bool `json:"requiresSync"` }
type AccountHandlerPOST ¶
AccountHandlerPOST is the request type for the /account/:id endpoint.
type AccountsAddBalanceRequest ¶
type AccountsAddBalanceRequest struct { HostKey types.PublicKey `json:"hostKey"` Amount *big.Int `json:"amount"` }
AccountsAddBalanceRequest is the request type for /account/:id/add endpoint.
type AccountsFundRequest ¶ added in v1.1.0
type AccountsFundResponse ¶ added in v1.1.0
type AccountsLockHandlerRequest ¶
type AccountsLockHandlerRequest struct { HostKey types.PublicKey `json:"hostKey"` Exclusive bool `json:"exclusive"` Duration DurationMS `json:"duration"` }
AccountsLockHandlerRequest is the request type for the /accounts/:id/lock endpoint.
type AccountsLockHandlerResponse ¶
type AccountsLockHandlerResponse struct { Account Account `json:"account"` LockID uint64 `json:"lockID"` }
AccountsLockHandlerResponse is the response type for the /accounts/:id/lock
type AccountsRequiresSyncRequest ¶
AccountsRequiresSyncRequest is the request type for /account/:id/requiressync endpoint.
type AccountsSaveRequest ¶ added in v1.1.0
type AccountsSaveRequest struct {
Accounts []Account `json:"accounts"`
}
type AccountsUnlockHandlerRequest ¶
type AccountsUnlockHandlerRequest struct {
LockID uint64 `json:"lockID"`
}
AccountsUnlockHandlerRequest is the request type for the /accounts/:id/unlock
type AccountsUpdateBalanceRequest ¶
type AccountsUpdateBalanceRequest struct { HostKey types.PublicKey `json:"hostKey"` Amount *big.Int `json:"amount"` }
AccountsUpdateBalanceRequest is the request type for /account/:id/update endpoint.
type AddObjectOptions ¶ added in v0.7.0
type AddObjectOptions struct { ETag string MimeType string Metadata ObjectUserMetadata }
AddObjectOptions is the options type for the bus client.
type AddObjectRequest ¶ added in v1.0.3
type AddObjectRequest struct { Bucket string `json:"bucket"` ContractSet string `json:"contractSet"` Object object.Object `json:"object"` ETag string `json:"eTag"` MimeType string `json:"mimeType"` Metadata ObjectUserMetadata `json:"metadata"` }
AddObjectRequest is the request type for the /bus/object/*key endpoint.
type AddPartialSlabResponse ¶
type ArchivedContract ¶
type ArchivedContract struct { ID types.FileContractID `json:"id"` HostIP string `json:"hostIP"` HostKey types.PublicKey `json:"hostKey"` RenewedTo types.FileContractID `json:"renewedTo"` Spending ContractSpending `json:"spending"` ArchivalReason string `json:"archivalReason"` ContractPrice types.Currency `json:"contractPrice"` ProofHeight uint64 `json:"proofHeight"` RenewedFrom types.FileContractID `json:"renewedFrom"` RevisionHeight uint64 `json:"revisionHeight"` RevisionNumber uint64 `json:"revisionNumber"` Size uint64 `json:"size"` StartHeight uint64 `json:"startHeight"` State string `json:"state"` TotalCost types.Currency `json:"totalCost"` WindowStart uint64 `json:"windowStart"` WindowEnd uint64 `json:"windowEnd"` }
An ArchivedContract contains all information about a contract with a host that has been moved to the archive either due to expiring or being renewed.
type Autopilot ¶
type Autopilot struct { ID string `json:"id"` Config AutopilotConfig `json:"config"` CurrentPeriod uint64 `json:"currentPeriod"` }
Autopilot contains the autopilot's config and current period.
type AutopilotConfig ¶
type AutopilotConfig struct { Contracts ContractsConfig `json:"contracts"` Hosts HostsConfig `json:"hosts"` }
AutopilotConfig contains all autopilot configuration.
func (AutopilotConfig) Validate ¶
func (c AutopilotConfig) Validate() error
type AutopilotPins ¶ added in v1.0.8
type AutopilotPins struct {
Allowance Pin `json:"allowance"`
}
AutopilotPins contains the available autopilot settings that can be pinned.
type AutopilotStateResponse ¶
type AutopilotStateResponse struct { Configured bool `json:"configured"` Migrating bool `json:"migrating"` MigratingLastStart TimeRFC3339 `json:"migratingLastStart"` Pruning bool `json:"pruning"` PruningLastStart TimeRFC3339 `json:"pruningLastStart"` Scanning bool `json:"scanning"` ScanningLastStart TimeRFC3339 `json:"scanningLastStart"` UptimeMS DurationMS `json:"uptimeMs"` StartTime TimeRFC3339 `json:"startTime"` BuildState }
AutopilotStateResponse is the response type for the /autopilot/state endpoint.
type AutopilotTriggerRequest ¶
type AutopilotTriggerRequest struct {
ForceScan bool `json:"forceScan"`
}
AutopilotTriggerRequest is the request object used by the /trigger endpoint
type AutopilotTriggerResponse ¶
type AutopilotTriggerResponse struct {
Triggered bool `json:"triggered"`
}
AutopilotTriggerResponse is the response returned by the /trigger endpoint, indicating whether an autopilot loop was triggered.
type Bucket ¶ added in v0.6.0
type Bucket struct { CreatedAt TimeRFC3339 `json:"createdAt"` Name string `json:"name"` Policy BucketPolicy `json:"policy"` }
type BucketCreateRequest ¶ added in v0.6.0
type BucketCreateRequest struct { Name string `json:"name"` Policy BucketPolicy `json:"policy"` }
type BucketPolicy ¶ added in v0.6.0
type BucketPolicy struct {
PublicReadAccess bool `json:"publicReadAccess"`
}
type BucketUpdatePolicyRequest ¶ added in v0.6.0
type BucketUpdatePolicyRequest struct {
Policy BucketPolicy `json:"policy"`
}
type BuildState ¶
type BuildState struct { Version string `json:"version"` Commit string `json:"commit"` OS string `json:"os"` BuildTime TimeRFC3339 `json:"buildTime"` }
BuildState contains static information about the build.
type BusStateResponse ¶
type BusStateResponse struct { StartTime TimeRFC3339 `json:"startTime"` Network string `json:"network"` BuildState }
BusStateResponse is the response type for the /bus/state endpoint.
type CompleteMultipartOptions ¶ added in v1.0.7
type CompleteMultipartOptions struct {
Metadata ObjectUserMetadata
}
type ConfigEvaluationRequest ¶ added in v1.0.6
type ConfigEvaluationRequest struct { AutopilotConfig AutopilotConfig `json:"autopilotConfig"` GougingSettings GougingSettings `json:"gougingSettings"` RedundancySettings RedundancySettings `json:"redundancySettings"` }
type ConfigEvaluationResponse ¶ added in v1.0.6
type ConfigEvaluationResponse struct { Hosts uint64 `json:"hosts"` Usable uint64 `json:"usable"` Unusable struct { Blocked uint64 `json:"blocked"` Gouging struct { Contract uint64 `json:"contract"` Download uint64 `json:"download"` Gouging uint64 `json:"gouging"` Pruning uint64 `json:"pruning"` Upload uint64 `json:"upload"` } `json:"gouging"` NotAcceptingContracts uint64 `json:"notAcceptingContracts"` NotScanned uint64 `json:"notScanned"` } `json:"unusable"` Recommendation *ConfigRecommendation `json:"recommendation,omitempty"` }
ConfigEvaluationResponse is the response type for /evaluate
type ConfigRecommendation ¶ added in v1.0.6
type ConfigRecommendation struct {
GougingSettings GougingSettings `json:"gougingSettings"`
}
type ConsensusNetwork ¶
type ConsensusNetwork struct {
Name string
}
ConsensusNetwork holds the name of the network.
type ConsensusState ¶
type ConsensusState struct { BlockHeight uint64 `json:"blockHeight"` LastBlockTime TimeRFC3339 `json:"lastBlockTime"` Synced bool `json:"synced"` }
ConsensusState holds the current blockheight and whether we are synced or not.
type ContentRange ¶ added in v1.0.7
ContentRange represents a content range returned via the "Content-Range" header.
func ParseContentRange ¶ added in v1.0.7
func ParseContentRange(contentRange string) (ContentRange, error)
type Contract ¶
type Contract struct { ContractMetadata Revision *types.FileContractRevision `json:"revision"` }
A Contract wraps the contract metadata with the latest contract revision.
func (Contract) EndHeight ¶
EndHeight returns the height at which the host is no longer obligated to store contract data.
func (Contract) RemainingCollateral ¶
RemainingCollateral returns the remaining collateral in the contract.
func (Contract) RenterFunds ¶
RenterFunds returns the funds remaining in the contract's Renter payout.
type ContractAcquireRequest ¶
type ContractAcquireRequest struct { Duration DurationMS `json:"duration"` Priority int `json:"priority"` }
ContractAcquireRequest is the request type for the /contract/acquire endpoint.
type ContractAcquireResponse ¶
type ContractAcquireResponse struct {
LockID uint64 `json:"lockID"`
}
ContractAcquireResponse is the response type for the /contract/:id/acquire endpoint.
type ContractAddRequest ¶ added in v0.7.0
type ContractAddRequest struct { Contract rhpv2.ContractRevision `json:"contract"` ContractPrice types.Currency `json:"contractPrice"` StartHeight uint64 `json:"startHeight"` State string `json:"state,omitempty"` TotalCost types.Currency `json:"totalCost"` }
ContractAddRequest is the request type for the /contract/:id endpoint.
type ContractFormRequest ¶ added in v1.1.0
type ContractFormRequest struct { EndHeight uint64 `json:"endHeight"` HostCollateral types.Currency `json:"hostCollateral"` HostKey types.PublicKey `json:"hostKey"` HostIP string `json:"hostIP"` RenterFunds types.Currency `json:"renterFunds"` RenterAddress types.Address `json:"renterAddress"` }
ContractFormRequest is the request type for the POST /contracts endpoint.
type ContractKeepaliveRequest ¶
type ContractKeepaliveRequest struct { Duration DurationMS `json:"duration"` LockID uint64 `json:"lockID"` }
ContractKeepaliveRequest is the request type for the /contract/:id/keepalive endpoint.
type ContractMetadata ¶
type ContractMetadata struct { ID types.FileContractID `json:"id"` HostIP string `json:"hostIP"` HostKey types.PublicKey `json:"hostKey"` SiamuxAddr string `json:"siamuxAddr"` ProofHeight uint64 `json:"proofHeight"` RevisionHeight uint64 `json:"revisionHeight"` RevisionNumber uint64 `json:"revisionNumber"` Size uint64 `json:"size"` StartHeight uint64 `json:"startHeight"` State string `json:"state"` WindowStart uint64 `json:"windowStart"` WindowEnd uint64 `json:"windowEnd"` ContractPrice types.Currency `json:"contractPrice"` RenewedFrom types.FileContractID `json:"renewedFrom"` Spending ContractSpending `json:"spending"` TotalCost types.Currency `json:"totalCost"` ContractSets []string `json:"contractSets"` }
ContractMetadata contains all metadata for a contract.
func (ContractMetadata) InSet ¶ added in v1.1.0
func (cm ContractMetadata) InSet(set string) bool
InSet returns whether the contract is in the given set.
type ContractMetric ¶ added in v0.7.0
type ContractMetric struct { Timestamp TimeRFC3339 `json:"timestamp"` ContractID types.FileContractID `json:"contractID"` HostKey types.PublicKey `json:"hostKey"` RemainingCollateral types.Currency `json:"remainingCollateral"` RemainingFunds types.Currency `json:"remainingFunds"` RevisionNumber uint64 `json:"revisionNumber"` UploadSpending types.Currency `json:"uploadSpending"` DownloadSpending types.Currency `json:"downloadSpending"` FundAccountSpending types.Currency `json:"fundAccountSpending"` DeleteSpending types.Currency `json:"deleteSpending"` ListSpending types.Currency `json:"listSpending"` }
type ContractMetricRequestPUT ¶ added in v0.7.0
type ContractMetricRequestPUT struct {
Metrics []ContractMetric `json:"metrics"`
}
type ContractMetricsQueryOpts ¶ added in v0.7.0
type ContractMetricsQueryOpts struct { ContractID types.FileContractID HostKey types.PublicKey }
type ContractPrunableData ¶
type ContractPrunableData struct { ID types.FileContractID `json:"id"` ContractSize }
ContractPrunableData wraps a contract's size information with its id.
type ContractPruneMetric ¶ added in v0.7.0
type ContractPruneMetric struct { Timestamp TimeRFC3339 `json:"timestamp"` ContractID types.FileContractID `json:"contractID"` HostKey types.PublicKey `json:"hostKey"` HostVersion string `json:"hostVersion"` Pruned uint64 `json:"pruned"` Remaining uint64 `json:"remaining"` Duration time.Duration `json:"duration"` }
type ContractPruneMetricRequestPUT ¶ added in v0.7.0
type ContractPruneMetricRequestPUT struct {
Metrics []ContractPruneMetric `json:"metrics"`
}
type ContractPruneMetricsQueryOpts ¶ added in v0.7.0
type ContractPruneMetricsQueryOpts struct { ContractID types.FileContractID HostKey types.PublicKey HostVersion string }
type ContractPruneRequest ¶ added in v1.1.0
type ContractPruneRequest struct {
Timeout DurationMS `json:"timeout"`
}
ContractPruneRequest is the request type for the /contract/:id/prune endpoint.
type ContractPruneResponse ¶ added in v1.1.0
type ContractPruneResponse struct { ContractSize uint64 `json:"size"` Pruned uint64 `json:"pruned"` Remaining uint64 `json:"remaining"` Error string `json:"error,omitempty"` }
ContractPruneResponse is the response type for the /contract/:id/prune endpoint.
type ContractReleaseRequest ¶
type ContractReleaseRequest struct {
LockID uint64 `json:"lockID"`
}
ContractAcquireRequest is the request type for the /contract/:id/release endpoint.
type ContractRenewRequest ¶ added in v1.1.0
type ContractRenewRequest struct { EndHeight uint64 `json:"endHeight"` ExpectedNewStorage uint64 `json:"expectedNewStorage"` MaxFundAmount types.Currency `json:"maxFundAmount"` MinNewCollateral types.Currency `json:"minNewCollateral"` RenterFunds types.Currency `json:"renterFunds"` }
ContractRenewRequest is the request type for the /contract/:id/renew endpoint.
type ContractRenewedRequest ¶ added in v0.7.0
type ContractRenewedRequest struct { Contract rhpv2.ContractRevision `json:"contract"` ContractPrice types.Currency `json:"contractPrice"` RenewedFrom types.FileContractID `json:"renewedFrom"` StartHeight uint64 `json:"startHeight"` State string `json:"state,omitempty"` TotalCost types.Currency `json:"totalCost"` }
ContractRenewedRequest is the request type for the /contract/:id/renewed endpoint.
type ContractRootsResponse ¶
type ContractRootsResponse struct { Roots []types.Hash256 `json:"roots"` Uploading []types.Hash256 `json:"uploading"` }
ContractRootsResponse is the response type for the /contract/:id/roots endpoint.
type ContractSetChurnMetric ¶ added in v0.7.0
type ContractSetChurnMetric struct { Direction string `json:"direction"` ContractID types.FileContractID `json:"contractID"` Name string `json:"name"` Reason string `json:"reason,omitempty"` Timestamp TimeRFC3339 `json:"timestamp"` }
type ContractSetChurnMetricRequestPUT ¶ added in v0.7.0
type ContractSetChurnMetricRequestPUT struct {
Metrics []ContractSetChurnMetric `json:"metrics"`
}
type ContractSetChurnMetricsQueryOpts ¶ added in v0.7.0
type ContractSetMetric ¶ added in v0.7.0
type ContractSetMetric struct { Contracts int `json:"contracts"` Name string `json:"name"` Timestamp TimeRFC3339 `json:"timestamp"` }
type ContractSetMetricsQueryOpts ¶ added in v0.7.0
type ContractSetMetricsQueryOpts struct {
Name string
}
type ContractSetSetting ¶
type ContractSetSetting struct {
Default string `json:"default"`
}
ContractSetSetting contains the default contract set used by the worker for uploads and migrations.
type ContractSetUpdateRequest ¶ added in v1.1.0
type ContractSetUpdateRequest struct { ToAdd []types.FileContractID `json:"toAdd"` ToRemove []types.FileContractID `json:"toRemove"` }
type ContractSize ¶
ContractSize contains information about the size of the contract and about how much of the contract data can be pruned.
type ContractSpending ¶
type ContractSpending struct { Uploads types.Currency `json:"uploads"` Downloads types.Currency `json:"downloads"` FundAccount types.Currency `json:"fundAccount"` Deletions types.Currency `json:"deletions"` SectorRoots types.Currency `json:"sectorRoots"` }
ContractSpending contains all spending details for a contract.
func (ContractSpending) Add ¶
func (x ContractSpending) Add(y ContractSpending) (z ContractSpending)
Add returns the sum of the current and given contract spending.
func (ContractSpending) Total ¶ added in v1.1.0
func (x ContractSpending) Total() types.Currency
Total returns the total cost of the contract spending.
type ContractSpendingRecord ¶
type ContractSpendingRecord struct { ContractSpending ContractID types.FileContractID `json:"contractID"` RevisionNumber uint64 `json:"revisionNumber"` Size uint64 `json:"size"` MissedHostPayout types.Currency `json:"missedHostPayout"` ValidRenterPayout types.Currency `json:"validRenterPayout"` }
type ContractState ¶ added in v1.1.0
type ContractState string
type ContractsArchiveRequest ¶ added in v0.7.0
type ContractsArchiveRequest = map[types.FileContractID]string
ContractsArchiveRequest is the request type for the /contracts/archive endpoint.
type ContractsConfig ¶
type ContractsConfig struct { Set string `json:"set"` Amount uint64 `json:"amount"` Allowance types.Currency `json:"allowance"` Period uint64 `json:"period"` RenewWindow uint64 `json:"renewWindow"` Download uint64 `json:"download"` Upload uint64 `json:"upload"` Storage uint64 `json:"storage"` Prune bool `json:"prune"` }
ContractsConfig contains all contract settings used in the autopilot.
func (ContractsConfig) SortContractsForMaintenance ¶ added in v1.1.0
func (c ContractsConfig) SortContractsForMaintenance(contracts []Contract)
type ContractsOpts ¶ added in v0.7.2
type ContractsOpts struct {
ContractSet string `json:"contractset"`
}
type ContractsPrunableDataResponse ¶
type ContractsPrunableDataResponse struct { Contracts []ContractPrunableData `json:"contracts"` TotalPrunable uint64 `json:"totalPrunable"` TotalSize uint64 `json:"totalSize"` }
ContractsPrunableDataResponse is the response type for the /contracts/prunable endpoint.
type ContractsResponse ¶
type ContractsResponse struct { Contracts []Contract `json:"contracts"` Errors map[types.PublicKey]string `json:"errors,omitempty"` // deprecated Error string `json:"error,omitempty"` }
ContractsResponse is the response type for the /rhp/contracts endpoint.
type CopyObjectOptions ¶ added in v0.6.0
type CopyObjectOptions struct { MimeType string Metadata ObjectUserMetadata }
CopyObjectOptions is the options type for the bus client.
type CopyObjectsRequest ¶ added in v1.0.3
type CopyObjectsRequest struct { SourceBucket string `json:"sourceBucket"` SourcePath string `json:"sourcePath"` DestinationBucket string `json:"destinationBucket"` DestinationPath string `json:"destinationPath"` MimeType string `json:"mimeType"` Metadata ObjectUserMetadata `json:"metadata"` }
CopyObjectsRequest is the request type for the /bus/objects/copy endpoint.
type CreateBucketOptions ¶ added in v0.7.0
type CreateBucketOptions struct {
Policy BucketPolicy
}
type CreateMultipartOptions ¶ added in v0.6.0
type CreateMultipartOptions struct { GenerateKey bool Key *object.EncryptionKey MimeType string Metadata ObjectUserMetadata }
type DeleteObjectOptions ¶ added in v0.7.0
type DeleteObjectOptions struct {
Batch bool
}
func (DeleteObjectOptions) Apply ¶ added in v0.7.0
func (opts DeleteObjectOptions) Apply(values url.Values)
type DownloadObjectOptions ¶ added in v0.7.0
type DownloadObjectOptions struct { GetObjectOptions Range *DownloadRange }
func (DownloadObjectOptions) ApplyHeaders ¶ added in v0.7.0
func (opts DownloadObjectOptions) ApplyHeaders(h http.Header)
func (DownloadObjectOptions) ApplyValues ¶ added in v0.7.0
func (opts DownloadObjectOptions) ApplyValues(values url.Values)
type DownloadRange ¶ added in v0.6.0
DownloadRange represents a requested range for a download via the "Range" header.
func ParseDownloadRange ¶ added in v0.6.0
func ParseDownloadRange(req *http.Request) (DownloadRange, error)
func (*DownloadRange) ContentRange ¶ added in v1.0.7
func (r *DownloadRange) ContentRange(size int64) *ContentRange
type DownloadStatsResponse ¶
type DownloadStatsResponse struct { AvgDownloadSpeedMBPS float64 `json:"avgDownloadSpeedMbps"` AvgOverdrivePct float64 `json:"avgOverdrivePct"` HealthyDownloaders uint64 `json:"healthyDownloaders"` NumDownloaders uint64 `json:"numDownloaders"` DownloadersStats []DownloaderStats `json:"downloadersStats"` }
DownloadStatsResponse is the response type for the /stats/downloads endpoint.
type DownloaderStats ¶
type DurationH ¶ added in v0.6.0
A DurationH aliases time.Duration to add marshaling functions that format the duration in hours.
func (DurationH) MarshalText ¶ added in v0.6.0
MarshalText implements encoding.TextMarshaler.
func (*DurationH) UnmarshalText ¶ added in v0.6.0
UnmarshalText implements encoding.TextUnmarshaler.
type DurationMS ¶ added in v0.6.0
A DurationMS is a duration encoded as an integer number of milliseconds.
func (DurationMS) MarshalJSON ¶ added in v0.6.0
func (d DurationMS) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (DurationMS) MarshalText ¶ added in v0.6.0
func (d DurationMS) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (DurationMS) String ¶ added in v0.6.0
func (d DurationMS) String() string
String implements fmt.Stringer.
func (*DurationMS) UnmarshalJSON ¶ added in v0.6.0
func (d *DurationMS) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*DurationMS) UnmarshalText ¶ added in v0.6.0
func (d *DurationMS) UnmarshalText(b []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
type EventConsensusUpdate ¶ added in v1.0.8
type EventConsensusUpdate struct { ConsensusState TransactionFee types.Currency `json:"transactionFee"` Timestamp time.Time `json:"timestamp"` }
type EventContractAdd ¶ added in v1.1.0
type EventContractAdd struct { Added ContractMetadata `json:"added"` Timestamp time.Time `json:"timestamp"` }
type EventContractArchive ¶ added in v1.0.8
type EventContractArchive struct { ContractID types.FileContractID `json:"contractID"` Reason string `json:"reason"` Timestamp time.Time `json:"timestamp"` }
type EventContractRenew ¶ added in v1.0.8
type EventContractRenew struct { Renewal ContractMetadata `json:"renewal"` Timestamp time.Time `json:"timestamp"` }
type EventContractSetUpdate ¶ added in v1.0.8
type EventContractSetUpdate struct { Name string `json:"name"` ToAdd []types.FileContractID `json:"toAdd"` ToRemove []types.FileContractID `json:"toRemove"` Timestamp time.Time `json:"timestamp"` }
type EventHostUpdate ¶ added in v1.1.0
type EventSettingDelete ¶ added in v1.0.8
type EventSettingUpdate ¶ added in v1.0.8
type GetHostsOptions ¶ added in v0.7.0
Option types.
func (GetHostsOptions) Apply ¶ added in v0.7.0
func (opts GetHostsOptions) Apply(values url.Values)
type GetObjectOptions ¶ added in v0.7.0
type GetObjectOptions struct { Prefix string Offset int Limit int IgnoreDelim bool Marker string OnlyMetadata bool SortBy string SortDir string }
func (GetObjectOptions) Apply ¶ added in v0.7.0
func (opts GetObjectOptions) Apply(values url.Values)
type GetObjectResponse ¶ added in v0.6.0
type GetObjectResponse struct { Content io.ReadCloser `json:"content"` HeadObjectResponse }
GetObjectResponse is the response type for the GET /worker/object endpoint.
type GougingParams ¶
type GougingParams struct { ConsensusState ConsensusState GougingSettings GougingSettings RedundancySettings RedundancySettings TransactionFee types.Currency }
GougingParams contains the metadata needed by a worker to perform gouging checks.
type GougingSettings ¶
type GougingSettings struct { // MaxRPCPrice is the maximum allowed base price for RPCs MaxRPCPrice types.Currency `json:"maxRPCPrice"` // MaxContractPrice is the maximum allowed price to form a contract MaxContractPrice types.Currency `json:"maxContractPrice"` // MaxDownloadPrice is the maximum allowed price to download 1TB of data MaxDownloadPrice types.Currency `json:"maxDownloadPrice"` // MaxUploadPrice is the maximum allowed price to upload 1TB of data MaxUploadPrice types.Currency `json:"maxUploadPrice"` // MaxStoragePrice is the maximum allowed price to store 1 byte per block MaxStoragePrice types.Currency `json:"maxStoragePrice"` // HostBlockHeightLeeway is the amount of blocks of leeway given to the host // block height in the host's price table HostBlockHeightLeeway int `json:"hostBlockHeightLeeway"` // MinPriceTableValidity is the minimum accepted value for `Validity` in the // host's price settings. MinPriceTableValidity time.Duration `json:"minPriceTableValidity"` // MinAccountExpiry is the minimum accepted value for `AccountExpiry` in the // host's price settings. MinAccountExpiry time.Duration `json:"minAccountExpiry"` // MinMaxEphemeralAccountBalance is the minimum accepted value for // `MaxEphemeralAccountBalance` in the host's price settings. MinMaxEphemeralAccountBalance types.Currency `json:"minMaxEphemeralAccountBalance"` // MigrationSurchargeMultiplier is the multiplier applied to the // 'MaxDownloadPrice' when checking whether a host is too expensive, // this multiplier is only applied for when trying to migrate critically // low-health slabs. MigrationSurchargeMultiplier uint64 `json:"migrationSurchargeMultiplier"` }
GougingSettings contain some price settings used in price gouging.
func (GougingSettings) Validate ¶
func (gs GougingSettings) Validate() error
Validate returns an error if the gouging settings are not considered valid.
type GougingSettingsPins ¶ added in v1.0.8
type GougingSettingsPins struct { MaxDownload Pin `json:"maxDownload"` MaxStorage Pin `json:"maxStorage"` MaxUpload Pin `json:"maxUpload"` }
GougingSettingsPins contains the available gouging settings that can be pinned.
type HeadObjectOptions ¶ added in v1.0.6
type HeadObjectOptions struct { IgnoreDelim bool Range *DownloadRange }
func (HeadObjectOptions) Apply ¶ added in v1.0.7
func (opts HeadObjectOptions) Apply(values url.Values)
func (HeadObjectOptions) ApplyHeaders ¶ added in v1.0.6
func (opts HeadObjectOptions) ApplyHeaders(h http.Header)
type HeadObjectResponse ¶ added in v1.0.6
type HeadObjectResponse struct { ContentType string Etag string LastModified TimeRFC3339 Range *ContentRange Size int64 Metadata ObjectUserMetadata }
HeadObjectResponse is the response type for the HEAD /worker/object endpoint.
type Host ¶ added in v1.0.7
type Host struct { KnownSince time.Time `json:"knownSince"` LastAnnouncement time.Time `json:"lastAnnouncement"` PublicKey types.PublicKey `json:"publicKey"` NetAddress string `json:"netAddress"` PriceTable HostPriceTable `json:"priceTable"` Settings rhpv2.HostSettings `json:"settings"` Interactions HostInteractions `json:"interactions"` Scanned bool `json:"scanned"` Blocked bool `json:"blocked"` Checks map[string]HostCheck `json:"checks"` StoredData uint64 `json:"storedData"` ResolvedAddresses []string `json:"resolvedAddresses"` Subnets []string `json:"subnets"` }
func (Host) IsAnnounced ¶ added in v1.0.7
IsAnnounced returns whether the host has been announced.
type HostAddress ¶ added in v1.0.7
type HostCheck ¶ added in v1.0.7
type HostCheck struct { Gouging HostGougingBreakdown `json:"gouging"` Score HostScoreBreakdown `json:"score"` Usability HostUsabilityBreakdown `json:"usability"` }
type HostChecks ¶ added in v1.0.7
type HostChecks struct { Gouging bool `json:"gouging"` GougingBreakdown HostGougingBreakdown `json:"gougingBreakdown"` Score float64 `json:"score"` ScoreBreakdown HostScoreBreakdown `json:"scoreBreakdown"` Usable bool `json:"usable"` UnusableReasons []string `json:"unusableReasons,omitempty"` }
type HostGougingBreakdown ¶
type HostGougingBreakdown struct { ContractErr string `json:"contractErr"` DownloadErr string `json:"downloadErr"` GougingErr string `json:"gougingErr"` PruneErr string `json:"pruneErr"` UploadErr string `json:"uploadErr"` }
func (HostGougingBreakdown) Gouging ¶
func (hgb HostGougingBreakdown) Gouging() bool
func (HostGougingBreakdown) String ¶ added in v0.7.0
func (hgb HostGougingBreakdown) String() string
type HostInteractions ¶ added in v1.0.7
type HostInteractions struct { TotalScans uint64 `json:"totalScans"` LastScan time.Time `json:"lastScan"` LastScanSuccess bool `json:"lastScanSuccess"` LostSectors uint64 `json:"lostSectors"` SecondToLastScanSuccess bool `json:"secondToLastScanSuccess"` Uptime time.Duration `json:"uptime"` Downtime time.Duration `json:"downtime"` SuccessfulInteractions float64 `json:"successfulInteractions"` FailedInteractions float64 `json:"failedInteractions"` }
type HostPriceTable ¶ added in v1.0.7
type HostPriceTable struct { rhpv3.HostPriceTable Expiry time.Time `json:"expiry"` }
type HostPriceTableUpdate ¶ added in v1.0.7
type HostResponse ¶ added in v1.0.7
type HostResponse struct { Host Host `json:"host"` Checks *HostChecks `json:"checks,omitempty"` }
HostResponse is the response type for the GET /api/autopilot/host/:hostkey endpoint.
type HostScan ¶ added in v1.0.7
type HostScan struct { HostKey types.PublicKey `json:"hostKey"` PriceTable rhpv3.HostPriceTable `json:"priceTable"` Settings rhpv2.HostSettings `json:"settings"` ResolvedAddresses []string `json:"resolvedAddresses"` Subnets []string `json:"subnets"` Success bool `json:"success"` Timestamp time.Time `json:"timestamp"` }
type HostScoreBreakdown ¶
type HostScoreBreakdown struct { Age float64 `json:"age"` Collateral float64 `json:"collateral"` Interactions float64 `json:"interactions"` StorageRemaining float64 `json:"storageRemaining"` Uptime float64 `json:"uptime"` Version float64 `json:"version"` Prices float64 `json:"prices"` }
func (HostScoreBreakdown) Score ¶
func (sb HostScoreBreakdown) Score() float64
func (HostScoreBreakdown) String ¶
func (sb HostScoreBreakdown) String() string
type HostUsabilityBreakdown ¶ added in v1.0.7
type HostUsabilityBreakdown struct { Blocked bool `json:"blocked"` Offline bool `json:"offline"` LowScore bool `json:"lowScore"` RedundantIP bool `json:"redundantIP"` Gouging bool `json:"gouging"` NotAcceptingContracts bool `json:"notAcceptingContracts"` NotAnnounced bool `json:"notAnnounced"` NotCompletingScan bool `json:"notCompletingScan"` }
func (HostUsabilityBreakdown) IsUsable ¶ added in v1.0.7
func (ub HostUsabilityBreakdown) IsUsable() bool
func (HostUsabilityBreakdown) UnusableReasons ¶ added in v1.0.7
func (ub HostUsabilityBreakdown) UnusableReasons() []string
type HostsConfig ¶
type HostsConfig struct { AllowRedundantIPs bool `json:"allowRedundantIPs"` MaxDowntimeHours uint64 `json:"maxDowntimeHours"` MinProtocolVersion string `json:"minProtocolVersion"` MaxConsecutiveScanFailures uint64 `json:"maxConsecutiveScanFailures"` ScoreOverrides map[types.PublicKey]float64 `json:"scoreOverrides"` }
HostsConfig contains all hosts settings used in the autopilot.
type HostsForScanningOptions ¶ added in v0.7.0
type HostsForScanningOptions struct { MaxLastScan TimeRFC3339 Limit int Offset int }
Option types.
func (HostsForScanningOptions) Apply ¶ added in v0.7.0
func (opts HostsForScanningOptions) Apply(values url.Values)
type HostsPriceTablesRequest ¶
type HostsPriceTablesRequest struct {
PriceTableUpdates []HostPriceTableUpdate `json:"priceTableUpdates"`
}
HostsPriceTablesRequest is the request type for the /hosts/pricetables endpoint.
type HostsRemoveRequest ¶
type HostsRemoveRequest struct { MaxDowntimeHours DurationH `json:"maxDowntimeHours"` MaxConsecutiveScanFailures uint64 `json:"maxConsecutiveScanFailures"` }
HostsRemoveRequest is the request type for the /hosts/remove endpoint.
type HostsScanRequest ¶
type HostsScanRequest struct {
Scans []HostScan `json:"scans"`
}
HostsScanRequest is the request type for the /hosts/scans endpoint.
type ListObjectOptions ¶ added in v0.7.0
type MemoryResponse ¶ added in v0.7.0
type MemoryResponse struct { Download MemoryStatus `json:"download"` Upload MemoryStatus `json:"upload"` }
type MemoryStatus ¶ added in v0.7.0
type MigrateSlabResponse ¶ added in v0.6.0
type MigrateSlabResponse struct { NumShardsMigrated int `json:"numShardsMigrated"` SurchargeApplied bool `json:"surchargeApplied,omitempty"` Error string `json:"error,omitempty"` }
MigrateSlabResponse is the response type for the /slab/migrate endpoint.
type MigrationSlabsRequest ¶
type MigrationSlabsRequest struct { ContractSet string `json:"contractSet"` HealthCutoff float64 `json:"healthCutoff"` Limit int `json:"limit"` }
MigrationSlabsRequest is the request type for the /slabs/migration endpoint.
type MultipartAbortRequest ¶ added in v0.6.0
type MultipartAddPartRequest ¶ added in v0.6.0
type MultipartCompleteRequest ¶ added in v0.6.0
type MultipartCompleteRequest struct { Bucket string `json:"bucket"` Metadata ObjectUserMetadata `json:"metadata"` Path string `json:"path"` UploadID string `json:"uploadID"` Parts []MultipartCompletedPart `json:"parts"` }
type MultipartCompleteResponse ¶ added in v0.6.0
type MultipartCompleteResponse struct {
ETag string `json:"eTag"`
}
type MultipartCompletedPart ¶ added in v0.6.0
type MultipartCreateRequest ¶ added in v0.6.0
type MultipartCreateRequest struct { Bucket string `json:"bucket"` Path string `json:"path"` Key *object.EncryptionKey `json:"key"` MimeType string `json:"mimeType"` Metadata ObjectUserMetadata `json:"metadata"` // TODO: The next major version change should invert this to create a // key by default GenerateKey bool `json:"generateKey"` }
type MultipartCreateResponse ¶ added in v0.6.0
type MultipartCreateResponse struct {
UploadID string `json:"uploadID"`
}
type MultipartListPartItem ¶ added in v0.6.0
type MultipartListPartItem struct { PartNumber int `json:"partNumber"` LastModified TimeRFC3339 `json:"lastModified"` ETag string `json:"eTag"` Size int64 `json:"size"` }
type MultipartListPartsRequest ¶ added in v0.6.0
type MultipartListPartsResponse ¶ added in v0.6.0
type MultipartListPartsResponse struct { HasMore bool `json:"hasMore"` NextMarker int `json:"nextMarker"` Parts []MultipartListPartItem `json:"parts"` }
type MultipartListUploadsRequest ¶ added in v0.6.0
type MultipartListUploadsResponse ¶ added in v0.6.0
type MultipartListUploadsResponse struct { HasMore bool `json:"hasMore"` NextPathMarker string `json:"nextMarker"` NextUploadIDMarker string `json:"nextUploadIDMarker"` Uploads []MultipartUpload `json:"uploads"` }
type MultipartUpload ¶ added in v0.6.0
type MultipartUpload struct { Bucket string `json:"bucket"` Key object.EncryptionKey `json:"key"` Path string `json:"path"` UploadID string `json:"uploadID"` CreatedAt TimeRFC3339 `json:"createdAt"` }
type Object ¶
type Object struct { Metadata ObjectUserMetadata `json:"metadata,omitempty"` ObjectMetadata *object.Object }
Object wraps an object.Object with its metadata.
type ObjectMetadata ¶
type ObjectMetadata struct { ETag string `json:"eTag,omitempty"` Health float64 `json:"health"` ModTime TimeRFC3339 `json:"modTime"` Name string `json:"name"` Size int64 `json:"size"` MimeType string `json:"mimeType,omitempty"` }
ObjectMetadata contains various metadata about an object.
func (ObjectMetadata) ContentType ¶ added in v0.6.0
func (o ObjectMetadata) ContentType() string
ContentType returns the object's MimeType for use in the 'Content-Type' header, if the object's mime type is empty we try and deduce it from the extension in the object's name.
type ObjectUserMetadata ¶ added in v1.0.3
ObjectUserMetadata contains user-defined metadata about an object and can be provided through `X-Sia-Meta-` meta headers.
NOTE: `X-Amz-Meta-` headers are supported and will be converted to sia metadata headers internally, this means that S3 clients can safely keep using Amazon headers and find the metadata will be persisted in Sia as well
func ExtractObjectUserMetadataFrom ¶ added in v1.0.3
func ExtractObjectUserMetadataFrom(metadata map[string]string) ObjectUserMetadata
type ObjectsListRequest ¶ added in v0.6.0
type ObjectsListRequest struct { Bucket string `json:"bucket"` Limit int `json:"limit"` SortBy string `json:"sortBy"` SortDir string `json:"sortDir"` Prefix string `json:"prefix"` Marker string `json:"marker"` }
ObjectsDeleteRequest is the request type for the /bus/objects/list endpoint.
type ObjectsListResponse ¶ added in v0.6.0
type ObjectsListResponse struct { HasMore bool `json:"hasMore"` NextMarker string `json:"nextMarker"` Objects []ObjectMetadata `json:"objects"` }
ObjectsListResponse is the response type for the /bus/objects/list endpoint.
type ObjectsRenameRequest ¶
type ObjectsRenameRequest struct { Bucket string `json:"bucket"` Force bool `json:"force"` From string `json:"from"` To string `json:"to"` Mode string `json:"mode"` }
ObjectsRenameRequest is the request type for the /bus/objects/rename endpoint.
type ObjectsResponse ¶
type ObjectsResponse struct { HasMore bool `json:"hasMore"` Entries []ObjectMetadata `json:"entries,omitempty"` Object *Object `json:"object,omitempty"` }
ObjectsResponse is the response type for the /bus/objects endpoint.
type ObjectsStatsOpts ¶ added in v1.0.6
type ObjectsStatsOpts struct {
Bucket string
}
type ObjectsStatsResponse ¶
type ObjectsStatsResponse struct { NumObjects uint64 `json:"numObjects"` // number of objects NumUnfinishedObjects uint64 `json:"numUnfinishedObjects"` // number of unfinished objects MinHealth float64 `json:"minHealth"` // minimum health of all objects TotalObjectsSize uint64 `json:"totalObjectsSize"` // size of all objects TotalUnfinishedObjectsSize uint64 `json:"totalUnfinishedObjectsSize"` // size of all unfinished objects TotalSectorsSize uint64 `json:"totalSectorsSize"` // uploaded size of all objects TotalUploadedSize uint64 `json:"totalUploadedSize"` // uploaded size of all objects including redundant sectors }
ObjectsStatsResponse is the response type for the /bus/stats/objects endpoint.
type PackedSlab ¶
type PackedSlab struct { BufferID uint `json:"bufferID"` Data []byte `json:"data"` Key object.EncryptionKey `json:"key"` }
type PackedSlabsRequestGET ¶
type PackedSlabsRequestGET struct { LockingDuration DurationMS `json:"lockingDuration"` MinShards uint8 `json:"minShards"` TotalShards uint8 `json:"totalShards"` ContractSet string `json:"contractSet"` Limit int `json:"limit"` }
type PackedSlabsRequestPOST ¶
type PackedSlabsRequestPOST struct {
Slabs []UploadedPackedSlab `json:"slabs"`
}
type ParamCurrency ¶
ParamCurrency aliases types.Currency and marshal them in hastings.
func (ParamCurrency) MarshalText ¶
func (c ParamCurrency) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (ParamCurrency) String ¶
func (c ParamCurrency) String() string
String implements fmt.Stringer.
func (*ParamCurrency) UnmarshalText ¶
func (c *ParamCurrency) UnmarshalText(b []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
type ParamString ¶
type ParamString string
ParamString is a helper type since jape expects query params to implement the TextMarshaler interface.
func (ParamString) MarshalText ¶
func (s ParamString) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (*ParamString) UnmarshalText ¶
func (s *ParamString) UnmarshalText(b []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
type PerformanceMetricsQueryOpts ¶ added in v0.7.0
type PricePinSettings ¶ added in v1.0.8
type PricePinSettings struct { // Enabled can be used to either enable or temporarily disable price // pinning. If enabled, both the currency and the Forex endpoint URL // must be valid. Enabled bool `json:"enabled"` // Currency is the external three-letter currency code. Currency string `json:"currency"` // ForexEndpointURL is the endpoint that returns the exchange rate for // Siacoin against the underlying currency. ForexEndpointURL string `json:"forexEndpointURL"` // Threshold is a percentage between 0 and 1 that determines when the // pinned settings are updated based on the exchange rate at the time. Threshold float64 `json:"threshold"` // Autopilots contains the pinned settings for every autopilot. Autopilots map[string]AutopilotPins `json:"autopilots"` // GougingSettingsPins contains the pinned settings for the gouging // settings. GougingSettingsPins GougingSettingsPins `json:"gougingSettingsPins"` }
PricePinSettings holds the configuration for pinning certain settings to a specific currency (e.g., USD). It uses a Forex API to fetch the current exchange rate, allowing users to set prices in USD instead of SC.
func (PricePinSettings) Validate ¶ added in v1.0.8
func (pps PricePinSettings) Validate() error
Validate returns an error if the price pin settings are not considered valid.
type RHPFormResponse ¶
type RHPFormResponse struct { ContractID types.FileContractID `json:"contractID"` Contract rhpv2.ContractRevision `json:"contract"` TransactionSet []types.Transaction `json:"transactionSet"` }
RHPFormResponse is the response type for the /rhp/form endpoint.
type RHPFundRequest ¶
type RHPFundRequest struct { ContractID types.FileContractID `json:"contractID"` HostKey types.PublicKey `json:"hostKey"` SiamuxAddr string `json:"siamuxAddr"` Balance types.Currency `json:"balance"` }
RHPFundRequest is the request type for the /rhp/fund endpoint.
type RHPPreparePaymentRequest ¶
type RHPPreparePaymentRequest struct { Account rhpv3.Account `json:"account"` Amount types.Currency `json:"amount"` Expiry uint64 `json:"expiry"` AccountKey types.PrivateKey `json:"accountKey"` }
RHPPreparePaymentRequest is the request type for the /rhp/prepare/payment endpoint.
type RHPPriceTableRequest ¶
type RHPPriceTableRequest struct { HostKey types.PublicKey `json:"hostKey"` SiamuxAddr string `json:"siamuxAddr"` Timeout DurationMS `json:"timeout"` }
RHPPriceTableRequest is the request type for the /rhp/pricetable endpoint.
type RHPScanRequest ¶
type RHPScanRequest struct { HostKey types.PublicKey `json:"hostKey"` HostIP string `json:"hostIP"` Timeout DurationMS `json:"timeout"` }
RHPScanRequest is the request type for the /rhp/scan endpoint.
type RHPScanResponse ¶
type RHPScanResponse struct { Ping DurationMS `json:"ping"` ScanError string `json:"scanError,omitempty"` Settings rhpv2.HostSettings `json:"settings,omitempty"` PriceTable rhpv3.HostPriceTable `json:"priceTable,omitempty"` }
RHPScanResponse is the response type for the /rhp/scan endpoint.
func (RHPScanResponse) Error ¶ added in v1.1.0
func (r RHPScanResponse) Error() error
type RHPSyncRequest ¶
type RHPSyncRequest struct { ContractID types.FileContractID `json:"contractID"` HostKey types.PublicKey `json:"hostKey"` SiamuxAddr string `json:"siamuxAddr"` }
RHPSyncRequest is the request type for the /rhp/sync endpoint.
type RedundancySettings ¶
type RedundancySettings struct { MinShards int `json:"minShards"` TotalShards int `json:"totalShards"` }
RedundancySettings contain settings that dictate an object's redundancy.
func (RedundancySettings) Redundancy ¶
func (rs RedundancySettings) Redundancy() float64
Redundancy returns the effective storage redundancy of the RedundancySettings.
func (RedundancySettings) SlabSize ¶ added in v1.0.6
func (rs RedundancySettings) SlabSize() uint64
SlabSize returns the size of a slab.
func (RedundancySettings) SlabSizeNoRedundancy ¶ added in v0.7.0
func (rs RedundancySettings) SlabSizeNoRedundancy() uint64
SlabSizeNoRedundancy returns the size of a slab without redundancy.
func (RedundancySettings) Validate ¶
func (rs RedundancySettings) Validate() error
Validate returns an error if the redundancy settings are not considered valid.
type S3AuthenticationSettings ¶ added in v0.6.0
S3AuthenticationSettings contains S3 auth settings.
func (S3AuthenticationSettings) Validate ¶ added in v0.7.0
func (s3as S3AuthenticationSettings) Validate() error
Validate returns an error if the authentication settings are not considered valid.
type SearchHostOptions ¶ added in v0.7.0
type SearchHostOptions struct { AutopilotID string AddressContains string FilterMode string UsabilityMode string KeyIn []types.PublicKey Limit int Offset int }
Option types.
type SearchHostsRequest ¶
type SearchHostsRequest struct { Offset int `json:"offset"` Limit int `json:"limit"` AutopilotID string `json:"autopilotID"` FilterMode string `json:"filterMode"` UsabilityMode string `json:"usabilityMode"` AddressContains string `json:"addressContains"` KeyIn []types.PublicKey `json:"keyIn"` }
SearchHostsRequest is the request type for the /api/bus/search/hosts endpoint.
type SearchObjectOptions ¶ added in v0.7.0
func (SearchObjectOptions) Apply ¶ added in v0.7.0
func (opts SearchObjectOptions) Apply(values url.Values)
type SiacoinElement ¶ added in v1.1.0
type SiacoinElement struct { types.SiacoinOutput ID types.SiacoinOutputID `json:"id"` MaturityHeight uint64 `json:"maturityHeight"` }
A SiacoinElement is a SiacoinOutput along with its ID.
type SlabBuffer ¶
type SlabBuffer struct { ContractSet string `json:"contractSet"` // contract set that be buffer will be uploaded to Complete bool `json:"complete"` // whether the slab buffer is complete and ready to upload Filename string `json:"filename"` // name of the buffer on disk Size int64 `json:"size"` // size of the buffer MaxSize int64 `json:"maxSize"` // maximum size of the buffer Locked bool `json:"locked"` // whether the slab buffer is locked for uploading }
type SlabID ¶
type SlabID uint
A SlabID uniquely identifies a slab.
func (*SlabID) LoadString ¶
LoadString is implemented for jape's DecodeParam.
type TimeRFC3339 ¶ added in v0.6.0
TimeRFC3339 aliases time.Time to add marshaling functions that url escape and format a time in the RFC3339 format.
func TimeNow ¶ added in v0.7.0
func TimeNow() TimeRFC3339
TimeNow returns the current time as a TimeRFC3339.
func (TimeRFC3339) IsZero ¶ added in v0.7.0
func (t TimeRFC3339) IsZero() bool
IsZero reports whether t represents the zero time instant, January 1, year 1, 00:00:00 UTC.
func (TimeRFC3339) MarshalJSON ¶ added in v0.6.0
func (t TimeRFC3339) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (TimeRFC3339) Std ¶ added in v0.7.0
func (t TimeRFC3339) Std() time.Time
Std converts a TimeRFC3339 to a time.Time.
func (TimeRFC3339) String ¶ added in v0.6.0
func (t TimeRFC3339) String() string
String implements fmt.Stringer.
func (*TimeRFC3339) UnmarshalText ¶ added in v0.6.0
func (t *TimeRFC3339) UnmarshalText(b []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
type Transaction ¶ added in v1.1.0
type Transaction struct { Raw types.Transaction `json:"raw,omitempty"` Index types.ChainIndex `json:"index"` ID types.TransactionID `json:"id"` Inflow types.Currency `json:"inflow"` Outflow types.Currency `json:"outflow"` Timestamp time.Time `json:"timestamp"` }
A Transaction is an on-chain transaction relevant to a particular wallet, paired with useful metadata.
type UnhealthySlab ¶
type UnhealthySlab struct { Key object.EncryptionKey `json:"key"` Health float64 `json:"health"` }
type UnhealthySlabsResponse ¶
type UnhealthySlabsResponse struct {
Slabs []UnhealthySlab `json:"slabs"`
}
type UpdateAllowlistRequest ¶
type UpdateAllowlistRequest struct { Add []types.PublicKey `json:"add"` Remove []types.PublicKey `json:"remove"` Clear bool `json:"clear"` }
UpdateAllowlistRequest is the request type for /hosts/allowlist endpoint.
type UpdateBlocklistRequest ¶
type UpdateBlocklistRequest struct { Add []string `json:"add"` Remove []string `json:"remove"` Clear bool `json:"clear"` }
UpdateBlocklistRequest is the request type for /hosts/blocklist endpoint.
type UpdateSlabRequest ¶
type UpdateSlabRequest struct { ContractSet string `json:"contractSet"` Slab object.Slab `json:"slab"` }
UpdateSlabRequest is the request type for the /slab endpoint.
type UploadID ¶
type UploadID [8]byte
UploadID identifies an ongoing upload.
func NewUploadID ¶
func NewUploadID() (uID UploadID)
func (UploadID) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*UploadID) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type UploadMultipartUploadPartOptions ¶ added in v0.7.0
type UploadMultipartUploadPartOptions struct { ContractSet string MinShards int TotalShards int EncryptionOffset *int ContentLength int64 }
func (UploadMultipartUploadPartOptions) Apply ¶ added in v0.7.0
func (opts UploadMultipartUploadPartOptions) Apply(values url.Values)
type UploadMultipartUploadPartResponse ¶ added in v0.6.0
type UploadMultipartUploadPartResponse struct {
ETag string `json:"etag"`
}
type UploadObjectOptions ¶ added in v0.7.0
type UploadObjectOptions struct { MinShards int TotalShards int ContractSet string ContentLength int64 MimeType string Metadata ObjectUserMetadata }
UploadObjectOptions is the options type for the worker client.
func (UploadObjectOptions) ApplyHeaders ¶ added in v1.0.3
func (opts UploadObjectOptions) ApplyHeaders(h http.Header)
func (UploadObjectOptions) ApplyValues ¶ added in v1.0.3
func (opts UploadObjectOptions) ApplyValues(values url.Values)
type UploadObjectResponse ¶ added in v0.6.0
type UploadObjectResponse struct {
ETag string `json:"etag"`
}
type UploadPackingSettings ¶
type UploadPackingSettings struct { Enabled bool `json:"enabled"` SlabBufferMaxSizeSoft int64 `json:"slabBufferMaxSizeSoft"` }
UploadPackingSettings contains upload packing settings.
type UploadParams ¶
type UploadParams struct { CurrentHeight uint64 ContractSet string UploadPacking bool GougingParams }
UploadParams contains the metadata needed by a worker to upload an object.
type UploadSectorRequest ¶
type UploadSectorRequest struct { ContractID types.FileContractID `json:"contractID"` Root types.Hash256 `json:"root"` }
UploadSectorRequest is the request type for the /upload/:id/sector endpoint.
type UploadStatsResponse ¶
type UploadStatsResponse struct { AvgSlabUploadSpeedMBPS float64 `json:"avgSlabUploadSpeedMbps"` AvgOverdrivePct float64 `json:"avgOverdrivePct"` HealthyUploaders uint64 `json:"healthyUploaders"` NumUploaders uint64 `json:"numUploaders"` UploadersStats []UploaderStats `json:"uploadersStats"` }
UploadStatsResponse is the response type for the /stats/uploads endpoint.
type UploadedPackedSlab ¶
func (UploadedPackedSlab) Contracts ¶ added in v0.7.0
func (s UploadedPackedSlab) Contracts() []types.FileContractID
type UploaderStats ¶
type WalletFundRequest ¶
type WalletFundRequest struct { Transaction types.Transaction `json:"transaction"` Amount types.Currency `json:"amount"` UseUnconfirmedTxns bool `json:"useUnconfirmedTxns"` }
WalletFundRequest is the request type for the /wallet/fund endpoint.
type WalletFundResponse ¶
type WalletFundResponse struct { Transaction types.Transaction `json:"transaction"` ToSign []types.Hash256 `json:"toSign"` DependsOn []types.Transaction `json:"dependsOn"` }
WalletFundResponse is the response type for the /wallet/fund endpoint.
type WalletMetric ¶ added in v0.7.0
type WalletMetricsQueryOpts ¶ added in v0.7.0
type WalletMetricsQueryOpts struct{}
type WalletRedistributeRequest ¶
type WalletRedistributeRequest struct { Amount types.Currency `json:"amount"` Outputs int `json:"outputs"` }
WalletRedistributeRequest is the request type for the /wallet/redistribute endpoint.
type WalletResponse ¶
type WalletResponse struct { ScanHeight uint64 `json:"scanHeight"` Address types.Address `json:"address"` Spendable types.Currency `json:"spendable"` Confirmed types.Currency `json:"confirmed"` Unconfirmed types.Currency `json:"unconfirmed"` Immature types.Currency `json:"immature"` }
WalletResponse is the response type for the /wallet endpoint.
type WalletSendRequest ¶ added in v1.1.0
type WalletSignRequest ¶
type WalletSignRequest struct { Transaction types.Transaction `json:"transaction"` ToSign []types.Hash256 `json:"toSign"` CoveredFields types.CoveredFields `json:"coveredFields"` }
WalletSignRequest is the request type for the /wallet/sign endpoint.
type WalletTransactionsOption ¶
WalletTransactionsOption is an option for the WalletTransactions method.
func WalletTransactionsWithBefore ¶
func WalletTransactionsWithBefore(before time.Time) WalletTransactionsOption
func WalletTransactionsWithLimit ¶
func WalletTransactionsWithLimit(limit int) WalletTransactionsOption
func WalletTransactionsWithOffset ¶
func WalletTransactionsWithOffset(offset int) WalletTransactionsOption
func WalletTransactionsWithSince ¶
func WalletTransactionsWithSince(since time.Time) WalletTransactionsOption
type WebhookResponse ¶ added in v1.0.8
type WebhookResponse struct { Webhooks []webhooks.Webhook `json:"webhooks"` Queues []webhooks.WebhookQueueInfo `json:"queues"` }
type WorkerStateResponse ¶
type WorkerStateResponse struct { ID string `json:"id"` StartTime TimeRFC3339 `json:"startTime"` BuildState }
WorkerStateResponse is the response type for the /worker/state endpoint.