Documentation
¶
Index ¶
- Variables
- func NewChainSubscriber(whm WebhookManager, cm ChainManager, cs ChainStore, w Wallet, ...) *chainSubscriber
- func NewForexClient(url string) *client
- func NewPinManager(alerts alerts.Alerter, broadcaster webhooks.Broadcaster, s Store, ...) *pinManager
- type ChainManager
- type ChainStore
- type ContractLocker
- func (l *ContractLocker) Acquire(ctx context.Context, priority int, id types.FileContractID, d time.Duration) (uint64, error)
- func (l *ContractLocker) KeepAlive(id types.FileContractID, lockID uint64, d time.Duration) error
- func (l *ContractLocker) Release(id types.FileContractID, lockID uint64) error
- type MetricsStore
- type SectorsCache
- func (sc *SectorsCache) AddSector(uID api.UploadID, fcid types.FileContractID, root types.Hash256) error
- func (sc *SectorsCache) FinishUpload(uID api.UploadID)
- func (sc *SectorsCache) HandleRenewal(fcid, renewedFrom types.FileContractID)
- func (sc *SectorsCache) Pending(fcid types.FileContractID) (size uint64)
- func (sc *SectorsCache) Sectors(fcid types.FileContractID) (roots []types.Hash256)
- func (sc *SectorsCache) StartUpload(uID api.UploadID) error
- type Store
- type Wallet
- type WalletBalance
- type WalletMetricsRecorder
- type WebhookManager
Constants ¶
This section is empty.
Variables ¶
var ErrAcquireContractTimeout = errors.New("acquiring the lock timed out")
ErrAcquireContractTimeout is returned when the context passed in to contractLocks.Acquire is closed before the lock can be acquired.
Functions ¶
func NewChainSubscriber ¶ added in v1.1.0
func NewChainSubscriber(whm WebhookManager, cm ChainManager, cs ChainStore, w Wallet, announcementMaxAge time.Duration, logger *zap.Logger) *chainSubscriber
NewChainSubscriber creates a new chain subscriber that will sync with the given chain manager and chain store. The returned subscriber is already running and can be stopped by calling Shutdown.
func NewForexClient ¶
func NewForexClient(url string) *client
func NewPinManager ¶
func NewPinManager(alerts alerts.Alerter, broadcaster webhooks.Broadcaster, s Store, updateInterval, rateWindow time.Duration, l *zap.Logger) *pinManager
NewPinManager returns a new PinManager, responsible for pinning prices to a fixed value in an underlying currency. The returned pin manager is already running and can be stopped by calling Shutdown.
Types ¶
type ChainManager ¶ added in v1.1.0
type ChainManager interface { OnReorg(fn func(types.ChainIndex)) (cancel func()) RecommendedFee() types.Currency Tip() types.ChainIndex UpdatesSince(index types.ChainIndex, max int) (rus []chain.RevertUpdate, aus []chain.ApplyUpdate, err error) }
type ChainStore ¶ added in v1.1.0
type ContractLocker ¶ added in v1.1.0
type ContractLocker struct {
// contains filtered or unexported fields
}
func NewContractLocker ¶ added in v1.1.0
func NewContractLocker() *ContractLocker
func (*ContractLocker) Acquire ¶ added in v1.1.0
func (l *ContractLocker) Acquire(ctx context.Context, priority int, id types.FileContractID, d time.Duration) (uint64, error)
Acquire acquires a contract lock for the given id and provided duration. If acquiring the lock doesn't finish before the context is closed, ErrAcquireContractTimeout is returned. Upon success an identifier is returned which can be used to release the lock before its lock duration has passed. TODO: Extend this with some sort of priority. e.g. migrations would acquire a lock with a low priority but contract maintenance would have a very high one to avoid being starved by low prio tasks.
func (*ContractLocker) KeepAlive ¶ added in v1.1.0
func (l *ContractLocker) KeepAlive(id types.FileContractID, lockID uint64, d time.Duration) error
KeepAlive refreshes the timer on a contract lock for a given contract if the lockID matches the one on the lock.
func (*ContractLocker) Release ¶ added in v1.1.0
func (l *ContractLocker) Release(id types.FileContractID, lockID uint64) error
Release releases the contract lock for a given contract and lock id.
type MetricsStore ¶ added in v1.1.0
type MetricsStore interface {
RecordWalletMetric(ctx context.Context, metrics ...api.WalletMetric) error
}
type SectorsCache ¶ added in v1.1.0
type SectorsCache struct {
// contains filtered or unexported fields
}
func NewSectorsCache ¶ added in v1.1.0
func NewSectorsCache() *SectorsCache
func (*SectorsCache) AddSector ¶ added in v1.1.0
func (sc *SectorsCache) AddSector(uID api.UploadID, fcid types.FileContractID, root types.Hash256) error
func (*SectorsCache) FinishUpload ¶ added in v1.1.0
func (sc *SectorsCache) FinishUpload(uID api.UploadID)
func (*SectorsCache) HandleRenewal ¶ added in v1.1.0
func (sc *SectorsCache) HandleRenewal(fcid, renewedFrom types.FileContractID)
func (*SectorsCache) Pending ¶ added in v1.1.0
func (sc *SectorsCache) Pending(fcid types.FileContractID) (size uint64)
func (*SectorsCache) Sectors ¶ added in v1.1.0
func (sc *SectorsCache) Sectors(fcid types.FileContractID) (roots []types.Hash256)
func (*SectorsCache) StartUpload ¶ added in v1.1.0
func (sc *SectorsCache) StartUpload(uID api.UploadID) error
type Wallet ¶ added in v1.1.0
type Wallet interface {
UpdateChainState(tx wallet.UpdateTx, reverted []chain.RevertUpdate, applied []chain.ApplyUpdate) error
}
type WalletBalance ¶ added in v1.1.0
type WalletMetricsRecorder ¶ added in v1.1.0
type WalletMetricsRecorder struct {
// contains filtered or unexported fields
}
func NewWalletMetricRecorder ¶ added in v1.1.0
func NewWalletMetricRecorder(store MetricsStore, wallet WalletBalance, interval time.Duration, logger *zap.Logger) *WalletMetricsRecorder
NewWalletMetricRecorder returns a recorder that periodically records wallet metrics. The recorder is already running and can be stopped by calling Shutdown.