common

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker = func(ctx 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(ctx context.Context) ([]string, error)

type DefaultCheckers

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

func (*DefaultCheckers) CheckTokenSpendability

func (a *DefaultCheckers) CheckTokenSpendability(ctx context.Context) ([]string, error)

CheckTokenSpendability checks that for each unspent token, it is still spendable. Spendability is verified against the current TMS for the given TMS ID. A token is still spendable if: - The token type is among the supported; - The token is parsable; - The token's recipients are still valid.

func (*DefaultCheckers) CheckTransactions

func (a *DefaultCheckers) CheckTransactions(ctx context.Context) ([]string, error)

CheckTransactions checks that for each transaction stored in the local database, the status of this transaction matches the status of the transaction on the ledger.

func (*DefaultCheckers) CheckUnspentTokens

func (a *DefaultCheckers) CheckUnspentTokens(ctx context.Context) ([]string, error)

CheckUnspentTokens checks that for each unspent token, the content of the local database matches the ledger

type NamedChecker

type NamedChecker struct {
	Name    string
	Checker Checker
}

func NewDefaultCheckers

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

type NetworkProvider

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

type StatusEvent

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

StatusEvent models an event related to the status of a transaction

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) ListenerTxIDs added in v0.15.1

func (c *StatusSupport) ListenerTxIDs() []string

ListenerTxIDs returns the tx ids that currently have at least one registered status listener. Used by fallback pollers to scope batch status lookups to transactions someone is actually waiting on.

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(ctx context.Context, txID string) ([]byte, error)
	Transactions(ctx context.Context, params driver.QueryTransactionsParams, pagination driver2.Pagination) (*driver2.PageIterator[*driver.TransactionRecord], error)
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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