common

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const Infinitely = -1

Variables

View Source
var ErrMaxRetriesExceeded = errors.New("maximum number of retries exceeded")

Functions

func NewRetryRunner

func NewRetryRunner(maxTimes int, delay time.Duration, expBackoff bool) *retryRunner

Types

type Checker

type Checker = func(context context.Context) ([]string, error)

type ChecksService

type ChecksService struct {
	// contains filtered or unexported fields
}

func NewChecksService

func NewChecksService(checkers []NamedChecker) *ChecksService

func (*ChecksService) Check

func (a *ChecksService) Check(context context.Context) ([]string, error)

type DefaultCheckers

type DefaultCheckers struct {
	// contains filtered or unexported fields
}

type NamedChecker

type NamedChecker struct {
	Name    string
	Checker Checker
}

func NewDefaultCheckers

func NewDefaultCheckers(tmsProvider TokenManagementServiceProvider, networkProvider NetworkProvider, db TokenTransactionDB, tokenDB *tokens.Tokens, tmsID token.TMSID) []NamedChecker

type NetworkProvider

type NetworkProvider interface {
	GetNetwork(network string, channel string) (*network.Network, error)
}

type RetryRunner

type RetryRunner interface {
	Run(func() error) error
}

RetryRunner receives a function that potentially fails and retries according to the specified strategy

type StatusEvent

type StatusEvent struct {
	Ctx               context.Context
	TxID              string
	ValidationCode    driver.TxStatus
	ValidationMessage string
}

type StatusSupport

type StatusSupport struct {
	// contains filtered or unexported fields
}

func NewStatusSupport

func NewStatusSupport() *StatusSupport

func (*StatusSupport) AddStatusListener

func (c *StatusSupport) AddStatusListener(txID string, ch chan StatusEvent)

func (*StatusSupport) DeleteStatusListener

func (c *StatusSupport) DeleteStatusListener(txID string, ch chan StatusEvent)

func (*StatusSupport) Notify

func (c *StatusSupport) Notify(event StatusEvent)

type TokenManagementServiceProvider

type TokenManagementServiceProvider interface {
	GetManagementService(opts ...token.ServiceOption) (*token.ManagementService, error)
}

type TokenTransactionDB

type TokenTransactionDB interface {
	GetTokenRequest(txID string) ([]byte, error)
	Transactions(params driver.QueryTransactionsParams) (driver.TransactionIterator, error)
}

Jump to

Keyboard shortcuts

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