Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigProvider ¶
type Locker ¶
type Locker interface {
// Lock locks the token id for the consumer transaction txID on behalf of the given
// owner (the wallet the tokens are selected for, ownerFilter.ID()).
// owner lets a Locker implementation apply per-wallet policies such as rate limiting.
// To deny a lock for policy reasons, return an error wrapping token.SelectorRateLimited:
// the selector then aborts immediately instead of retrying.
Lock(ctx context.Context, owner string, id *token2.ID, txID string, reclaim bool) (string, error)
// UnlockIDs unlocks the passed IDs for the given owner. It returns the list of tokens
// that were not locked in the first place among those passed.
UnlockIDs(ctx context.Context, owner string, ids ...*token2.ID) []*token2.ID
UnlockByTxID(ctx context.Context, txID string)
IsLocked(id *token2.ID) bool
}
type LockerProvider ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) SetPrecision ¶ added in v0.27.0
SetPrecision sets the precision of the selectors this manager creates from now on. The selector service calls it when the public parameters of the TMS change. Selectors that already exist keep the precision they were created with.
type NewQueryEngineFunc ¶
type NewQueryEngineFunc func() QueryService
type QueryService ¶
type QueryService interface {
UnspentTokensIterator(ctx context.Context) (*token.UnspentTokensIterator, error)
UnspentTokensIteratorBy(ctx context.Context, id string, tokenType token2.Type) (driver.UnspentTokensIterator, error)
GetTokens(ctx context.Context, inputs ...*token2.ID) ([]*token2.Token, error)
}
type SelectorService ¶
type SelectorService struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(lockerProvider LockerProvider, c ConfigProvider, metricsProvider metrics.Provider, opts ...ratelimit.Option) *SelectorService
NewService returns a SelectorService for the simple driver.
By default, selection is not rate limited. Passing ratelimit options, or enabling the token.selector.rateLimit* configuration keys, meters every selection request per wallet.
func (*SelectorService) SelectorManager ¶
func (s *SelectorService) SelectorManager(tms *token.ManagementService) (token.SelectorManager, error)
Click to show internal directories.
Click to hide internal directories.