api

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 23 Imported by: 13

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	ContractStateInvalid  = "invalid"
	ContractStateUnknown  = "unknown"
	ContractStatePending  = "pending"
	ContractStateActive   = "active"
	ContractStateComplete = "complete"
	ContractStateFailed   = "failed"
)
View Source
const (
	ContractArchivalReasonHostPruned = "hostpruned"
	ContractArchivalReasonRemoved    = "removed"
	ContractArchivalReasonRenewed    = "renewed"
)
View Source
const (
	ModuleConsensus   = "consensus"
	ModuleContract    = "contract"
	ModuleContractSet = "contract_set"
	ModuleHost        = "host"
	ModuleSetting     = "setting"

	EventAdd     = "add"
	EventUpdate  = "update"
	EventDelete  = "delete"
	EventArchive = "archive"
	EventRenew   = "renew"
)
View Source
const (
	HostFilterModeAll     = "all"
	HostFilterModeAllowed = "allowed"
	HostFilterModeBlocked = "blocked"

	UsabilityFilterModeAll      = "all"
	UsabilityFilterModeUsable   = "usable"
	UsabilityFilterModeUnusable = "unusable"
)
View Source
const (
	MetricMaxIntervals = 1000

	ChurnDirAdded   = "added"
	ChurnDirRemoved = "removed"

	MetricContractPrune    = "contractprune"
	MetricContractSet      = "contractset"
	MetricContractSetChurn = "churn"
	MetricContract         = "contract"
	MetricPerformance      = "performance"
	MetricWallet           = "wallet"
)
View Source
const (
	ObjectMetadataPrefix = "X-Sia-Meta-"

	ObjectsRenameModeSingle = "single"
	ObjectsRenameModeMulti  = "multi"

	ObjectSortByHealth = "health"
	ObjectSortByName   = "name"
	ObjectSortBySize   = "size"

	ObjectSortDirAsc  = "asc"
	ObjectSortDirDesc = "desc"
)
View Source
const (
	SettingContractSet      = "contractset"
	SettingGouging          = "gouging"
	SettingPricePinning     = "pricepinning"
	SettingRedundancy       = "redundancy"
	SettingS3Authentication = "s3authentication"
	SettingUploadPacking    = "uploadpacking"
)
View Source
const (
	S3MinAccessKeyLen = 16
	S3MaxAccessKeyLen = 128
	S3SecretKeyLen    = 40
)
View Source
const (
	DefaultBucketName = "default"
)

Variables

View Source
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")
)
View Source
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")
)
View Source
var (
	ErrMarkerNotFound        = errors.New("marker not found")
	ErrMaxFundAmountExceeded = errors.New("renewal exceeds max fund amount")
)
View Source
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")
)
View Source
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,
		}
	}
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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,
	}
)
View Source
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")
)
View Source
var (
	// ErrHostNotFound is returned when a host can't be retrieved from the
	// database.
	ErrHostNotFound = errors.New("host doesn't exist in hostdb")
)
View Source
var (
	ErrMaxIntervalsExceeded = fmt.Errorf("max number of intervals exceeds maximum of %v", MetricMaxIntervals)
)
View Source
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")
)
View Source
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 FormatETag(eTag string) string

func ObjectPathEscape added in v0.7.0

func ObjectPathEscape(path string) string

func ParseEventWebhook added in v1.0.8

func ParseEventWebhook(event webhooks.Event) (interface{}, error)

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

type AccountHandlerPOST struct {
	HostKey types.PublicKey `json:"hostKey"`
}

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 AccountsFundRequest struct {
	AccountID  rhpv3.Account        `json:"accountID"`
	Amount     types.Currency       `json:"amount"`
	ContractID types.FileContractID `json:"contractID"`
}

type AccountsFundResponse added in v1.1.0

type AccountsFundResponse struct {
	Deposit types.Currency `json:"deposit"`
}

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

type AccountsRequiresSyncRequest struct {
	HostKey types.PublicKey `json:"hostKey"`
}

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 AddPartialSlabResponse struct {
	SlabBufferMaxSizeSoftReached bool               `json:"slabBufferMaxSizeSoftReached"`
	Slabs                        []object.SlabSlice `json:"slabs"`
}

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.

func (*Autopilot) EndHeight added in v1.0.7

func (ap *Autopilot) EndHeight() uint64

EndHeight of a contract formed using the AutopilotConfig given the 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

type ContentRange struct {
	Offset int64
	Length int64
	Size   int64
}

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

func (c Contract) EndHeight() uint64

EndHeight returns the height at which the host is no longer obligated to store contract data.

func (Contract) FileSize

func (c Contract) FileSize() uint64

FileSize returns the current Size of the contract.

func (Contract) RemainingCollateral

func (c Contract) RemainingCollateral() types.Currency

RemainingCollateral returns the remaining collateral in the contract.

func (Contract) RenterFunds

func (c Contract) RenterFunds() types.Currency

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 ContractSetChurnMetricsQueryOpts struct {
	Name      string
	Direction string
	Reason    string
}

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

type ContractSize struct {
	Prunable uint64 `json:"prunable"`
	Size     uint64 `json:"size"`
}

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

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

type DownloadRange struct {
	Offset int64
	Length int64
}

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 DownloaderStats struct {
	AvgSectorDownloadSpeedMBPS float64         `json:"avgSectorDownloadSpeedMbps"`
	HostKey                    types.PublicKey `json:"hostKey"`
	NumDownloads               uint64          `json:"numDownloads"`
}

type DurationH added in v0.6.0

type DurationH time.Duration

A DurationH aliases time.Duration to add marshaling functions that format the duration in hours.

func (DurationH) MarshalText added in v0.6.0

func (d DurationH) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (DurationH) String added in v0.6.0

func (d DurationH) String() string

String implements fmt.Stringer.

func (*DurationH) UnmarshalText added in v0.6.0

func (d *DurationH) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type DurationMS added in v0.6.0

type DurationMS time.Duration

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 EventHostUpdate struct {
	HostKey   types.PublicKey `json:"hostKey"`
	NetAddr   string          `json:"netAddr"`
	Timestamp time.Time       `json:"timestamp"`
}

type EventSettingDelete added in v1.0.8

type EventSettingDelete struct {
	Key       string    `json:"key"`
	Timestamp time.Time `json:"timestamp"`
}

type EventSettingUpdate added in v1.0.8

type EventSettingUpdate struct {
	Key       string      `json:"key"`
	Update    interface{} `json:"update"`
	Timestamp time.Time   `json:"timestamp"`
}

type GetHostsOptions added in v0.7.0

type GetHostsOptions struct {
	Offset int
	Limit  int
}

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

func (h Host) IsAnnounced() bool

IsAnnounced returns whether the host has been announced.

func (Host) IsOnline added in v1.0.7

func (h Host) IsOnline() bool

IsOnline returns whether a host is considered online.

type HostAddress added in v1.0.7

type HostAddress struct {
	PublicKey  types.PublicKey `json:"publicKey"`
	NetAddress string          `json:"netAddress"`
}

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 HostPriceTableUpdate struct {
	HostKey    types.PublicKey `json:"hostKey"`
	Success    bool            `json:"success"`
	Timestamp  time.Time       `json:"timestamp"`
	PriceTable HostPriceTable  `json:"priceTable"`
}

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 ListObjectOptions struct {
	Prefix  string
	Marker  string
	Limit   int
	SortBy  string
	SortDir string
}

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 MemoryStatus struct {
	Available uint64 `json:"available"`
	Total     uint64 `json:"total"`
}

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 MultipartAbortRequest struct {
	Bucket   string `json:"bucket"`
	Path     string `json:"path"`
	UploadID string `json:"uploadID"`
}

type MultipartAddPartRequest added in v0.6.0

type MultipartAddPartRequest struct {
	Bucket      string             `json:"bucket"`
	ETag        string             `json:"eTag"`
	Path        string             `json:"path"`
	ContractSet string             `json:"contractSet"`
	UploadID    string             `json:"uploadID"`
	PartNumber  int                `json:"partNumber"`
	Slices      []object.SlabSlice `json:"slices"`
}

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 MultipartCompletedPart struct {
	PartNumber int    `json:"partNumber"`
	ETag       string `json:"eTag"`
}

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 MultipartListPartsRequest struct {
	Bucket           string `json:"bucket"`
	Path             string `json:"path"`
	UploadID         string `json:"uploadID"`
	PartNumberMarker int    `json:"partNumberMarker"`
	Limit            int64  `json:"limit"`
}

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 MultipartListUploadsRequest struct {
	Bucket         string `json:"bucket"`
	Prefix         string `json:"prefix"`
	PathMarker     string `json:"pathMarker"`
	UploadIDMarker string `json:"uploadIDMarker"`
	Limit          int    `json:"limit"`
}

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

type ObjectUserMetadata map[string]string

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

type ParamCurrency types.Currency

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) String

func (s ParamString) String() string

String implements fmt.Stringer.

func (*ParamString) UnmarshalText

func (s *ParamString) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type PerformanceMetricsQueryOpts added in v0.7.0

type PerformanceMetricsQueryOpts struct {
	Action  string
	HostKey types.PublicKey
	Origin  string
}

type Pin added in v1.0.8

type Pin struct {
	Pinned bool    `json:"pinned"`
	Value  float64 `json:"value"`
}

A Pin is a pinned price in an external currency.

func (Pin) IsPinned added in v1.0.8

func (p Pin) IsPinned() bool

IsPinned returns true if the pin is enabled and the value is greater than 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

type S3AuthenticationSettings struct {
	V4Keypairs map[string]string `json:"v4Keypairs"`
}

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

type SearchObjectOptions struct {
	Key    string
	Offset int
	Limit  int
}

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

func (sid *SlabID) LoadString(s string) (err error)

LoadString is implemented for jape's DecodeParam.

func (SlabID) String

func (sid SlabID) String() string

String encodes the SlabID as a string.

type TimeRFC3339 added in v0.6.0

type TimeRFC3339 time.Time

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

func (uID UploadID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (UploadID) String

func (uID UploadID) String() string

String implements fmt.Stringer.

func (*UploadID) UnmarshalText

func (uID *UploadID) UnmarshalText(b []byte) error

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

type UploadedPackedSlab struct {
	BufferID uint
	Shards   []object.Sector
}

func (UploadedPackedSlab) Contracts added in v0.7.0

func (s UploadedPackedSlab) Contracts() []types.FileContractID

type UploaderStats

type UploaderStats struct {
	HostKey                  types.PublicKey `json:"hostKey"`
	AvgSectorUploadSpeedMBPS float64         `json:"avgSectorUploadSpeedMbps"`
}

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 WalletMetric struct {
	Timestamp TimeRFC3339 `json:"timestamp"`

	Confirmed   types.Currency `json:"confirmed"`
	Spendable   types.Currency `json:"spendable"`
	Unconfirmed types.Currency `json:"unconfirmed"`
	Immature    types.Currency `json:"immature"`
}

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 WalletSendRequest struct {
	Address          types.Address  `json:"address"`
	Amount           types.Currency `json:"amount"`
	SubtractMinerFee bool           `json:"subtractMinerFee"`
	UseUnconfirmed   bool           `json:"useUnconfirmed"`
}

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

type WalletTransactionsOption func(url.Values)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL