Documentation
¶
Index ¶
- Constants
- Variables
- func IsConflictError(err error) bool
- func IsInsufficientFundError(err error) bool
- func IsLockError(err error) bool
- func IsNotFoundError(err error) bool
- func IsScriptErrorWithCode(err error, code string) bool
- func IsTXIDError(err error) bool
- func IsTransactionCommitError(err error) bool
- func IsValidationError(err error) bool
- func NewCache(capacityBytes, maxNumKeys int64, metrics bool) *ristretto.Cache
- func NewMachineFromScript(script string, cache *ristretto.Cache, span trace.Span) (*vm.Machine, error)
- func NewNoOpMonitor() *noOpMonitor
- func ProvideResolverOption(provider interface{}) fx.Option
- func ResolveModule(cacheBytesCapacity, cacheMaxNumKeys int64) fx.Option
- func WithPastTimestamps(l *Ledger)
- type AccountsQuery
- func (a *AccountsQuery) WithAddressFilter(address string) *AccountsQuery
- func (a *AccountsQuery) WithAfterAddress(after string) *AccountsQuery
- func (a *AccountsQuery) WithBalanceAssetFilter(value string) *AccountsQuery
- func (a *AccountsQuery) WithBalanceFilter(balance string) *AccountsQuery
- func (a *AccountsQuery) WithBalanceOperatorFilter(balanceOperator BalanceOperator) *AccountsQuery
- func (a *AccountsQuery) WithMetadataFilter(metadata map[string]string) *AccountsQuery
- func (a *AccountsQuery) WithOffset(offset uint) *AccountsQuery
- func (a *AccountsQuery) WithPageSize(pageSize uint) *AccountsQuery
- type AccountsQueryFilters
- type AggregatedBalancesQuery
- func (b *AggregatedBalancesQuery) WithAddressFilter(address string) *AggregatedBalancesQuery
- func (b *AggregatedBalancesQuery) WithAfterAddress(after string) *AggregatedBalancesQuery
- func (b *AggregatedBalancesQuery) WithOffset(offset uint) *AggregatedBalancesQuery
- func (b *AggregatedBalancesQuery) WithPageSize(pageSize uint) *AggregatedBalancesQuery
- type AggregatedBalancesQueryFilters
- type BalanceOperator
- type BalancesQuery
- type BalancesQueryFilters
- type ConflictError
- type InsufficientFundError
- type Ledger
- func (l *Ledger) Close(ctx context.Context) error
- func (l *Ledger) CountAccounts(ctx context.Context, a AccountsQuery) (uint64, error)
- func (l *Ledger) CountTransactions(ctx context.Context, q TransactionsQuery) (uint64, error)
- func (l *Ledger) ExecuteScript(ctx context.Context, preview bool, script core.ScriptData) (core.ExpandedTransaction, error)
- func (l *Ledger) ExecuteTxsData(ctx context.Context, preview, checkBalances bool, ...) ([]core.ExpandedTransaction, error)
- func (l *Ledger) GetAccount(ctx context.Context, address string) (*core.AccountWithVolumes, error)
- func (l *Ledger) GetAccounts(ctx context.Context, a AccountsQuery) (api.Cursor[core.Account], error)
- func (l *Ledger) GetBalances(ctx context.Context, q BalancesQuery) (api.Cursor[core.AccountsBalances], error)
- func (l *Ledger) GetBalancesAggregated(ctx context.Context, q AggregatedBalancesQuery) (core.AssetsBalances, error)
- func (l *Ledger) GetLedgerStore() Store
- func (l *Ledger) GetLogs(ctx context.Context, q *LogsQuery) (api.Cursor[core.Log], error)
- func (l *Ledger) GetMigrationsInfo(ctx context.Context) ([]core.MigrationInfo, error)
- func (l *Ledger) GetTransaction(ctx context.Context, id uint64) (*core.ExpandedTransaction, error)
- func (l *Ledger) GetTransactions(ctx context.Context, q TransactionsQuery) (api.Cursor[core.ExpandedTransaction], error)
- func (l *Ledger) LoadMapping(ctx context.Context) (*core.Mapping, error)
- func (l *Ledger) RevertTransaction(ctx context.Context, id uint64, checkBalances bool) (*core.ExpandedTransaction, error)
- func (l *Ledger) SaveMapping(ctx context.Context, mapping core.Mapping) error
- func (l *Ledger) SaveMeta(ctx context.Context, targetType string, targetID interface{}, m core.Metadata) error
- func (l *Ledger) Stats(ctx context.Context) (Stats, error)
- func (l *Ledger) Verify() error
- type LedgerOption
- type LockError
- type LogsQuery
- type LogsQueryFilters
- type Monitor
- type NotFoundError
- type ResolveOptionFn
- type Resolver
- type ResolverOption
- type ScriptError
- type Stats
- type Store
- type TXIDError
- type TransactionCommitError
- type TransactionsQuery
- func (a *TransactionsQuery) WithAccountFilter(account string) *TransactionsQuery
- func (a *TransactionsQuery) WithAfterTxID(after uint64) *TransactionsQuery
- func (a *TransactionsQuery) WithDestinationFilter(dest string) *TransactionsQuery
- func (a *TransactionsQuery) WithEndTimeFilter(end time.Time) *TransactionsQuery
- func (a *TransactionsQuery) WithMetadataFilter(metadata map[string]string) *TransactionsQuery
- func (a *TransactionsQuery) WithPageSize(pageSize uint) *TransactionsQuery
- func (a *TransactionsQuery) WithReferenceFilter(ref string) *TransactionsQuery
- func (a *TransactionsQuery) WithSourceFilter(source string) *TransactionsQuery
- func (a *TransactionsQuery) WithStartTimeFilter(start time.Time) *TransactionsQuery
- type TransactionsQueryFilters
- type TxVolumeAggregator
- type ValidationError
- type VolumeAggregator
Constants ¶
View Source
const ( ScriptErrorInsufficientFund = "INSUFFICIENT_FUND" ScriptErrorCompilationFailed = "COMPILATION_FAILED" ScriptErrorNoScript = "NO_SCRIPT" ScriptErrorMetadataOverride = "METADATA_OVERRIDE" )
View Source
const (
QueryDefaultPageSize = 15
)
View Source
const ResolverLedgerOptionsKey = `name:"_ledgerResolverLedgerOptions"`
View Source
const ResolverOptionsKey = `group:"_ledgerResolverOptions"`
Variables ¶
View Source
var DefaultContracts = []core.Contract{ { Name: "default", Account: "*", Expr: &core.ExprGte{ Op1: core.VariableExpr{ Name: "balance", }, Op2: core.ConstantExpr{ Value: core.NewMonetaryInt(0), }, }, }, }
View Source
var DefaultResolverOptions = []ResolverOption{ WithMonitor(&noOpMonitor{}), }
Functions ¶
func IsConflictError ¶ added in v1.0.4
func IsInsufficientFundError ¶ added in v1.0.4
func IsLockError ¶ added in v1.3.0
func IsNotFoundError ¶ added in v1.6.0
func IsScriptErrorWithCode ¶ added in v1.6.0
func IsTXIDError ¶ added in v1.12.0
func IsTransactionCommitError ¶ added in v1.0.4
func IsValidationError ¶ added in v1.0.4
func NewMachineFromScript ¶ added in v1.9.0
func NewNoOpMonitor ¶ added in v1.8.0
func NewNoOpMonitor() *noOpMonitor
func ProvideResolverOption ¶
func ResolveModule ¶
func WithPastTimestamps ¶ added in v1.7.3
func WithPastTimestamps(l *Ledger)
Types ¶
type AccountsQuery ¶ added in v1.8.0
type AccountsQuery struct { PageSize uint Offset uint AfterAddress string Filters AccountsQueryFilters }
func NewAccountsQuery ¶ added in v1.8.0
func NewAccountsQuery() *AccountsQuery
func (*AccountsQuery) WithAddressFilter ¶ added in v1.8.0
func (a *AccountsQuery) WithAddressFilter(address string) *AccountsQuery
func (*AccountsQuery) WithAfterAddress ¶ added in v1.8.0
func (a *AccountsQuery) WithAfterAddress(after string) *AccountsQuery
func (*AccountsQuery) WithBalanceAssetFilter ¶ added in v1.10.15
func (a *AccountsQuery) WithBalanceAssetFilter(value string) *AccountsQuery
func (*AccountsQuery) WithBalanceFilter ¶ added in v1.8.0
func (a *AccountsQuery) WithBalanceFilter(balance string) *AccountsQuery
func (*AccountsQuery) WithBalanceOperatorFilter ¶ added in v1.8.0
func (a *AccountsQuery) WithBalanceOperatorFilter(balanceOperator BalanceOperator) *AccountsQuery
func (*AccountsQuery) WithMetadataFilter ¶ added in v1.8.0
func (a *AccountsQuery) WithMetadataFilter(metadata map[string]string) *AccountsQuery
func (*AccountsQuery) WithOffset ¶ added in v1.8.0
func (a *AccountsQuery) WithOffset(offset uint) *AccountsQuery
func (*AccountsQuery) WithPageSize ¶ added in v1.8.0
func (a *AccountsQuery) WithPageSize(pageSize uint) *AccountsQuery
type AccountsQueryFilters ¶ added in v1.8.0
type AggregatedBalancesQuery ¶ added in v1.10.4
type AggregatedBalancesQuery struct { PageSize uint Offset uint AfterAddress string Filters AggregatedBalancesQueryFilters }
func NewAggregatedBalancesQuery ¶ added in v1.10.4
func NewAggregatedBalancesQuery() *AggregatedBalancesQuery
func (*AggregatedBalancesQuery) WithAddressFilter ¶ added in v1.10.4
func (b *AggregatedBalancesQuery) WithAddressFilter(address string) *AggregatedBalancesQuery
func (*AggregatedBalancesQuery) WithAfterAddress ¶ added in v1.10.4
func (b *AggregatedBalancesQuery) WithAfterAddress(after string) *AggregatedBalancesQuery
func (*AggregatedBalancesQuery) WithOffset ¶ added in v1.10.4
func (b *AggregatedBalancesQuery) WithOffset(offset uint) *AggregatedBalancesQuery
func (*AggregatedBalancesQuery) WithPageSize ¶ added in v1.10.4
func (b *AggregatedBalancesQuery) WithPageSize(pageSize uint) *AggregatedBalancesQuery
type AggregatedBalancesQueryFilters ¶ added in v1.10.4
type AggregatedBalancesQueryFilters struct {
AddressRegexp string
}
type BalanceOperator ¶ added in v1.8.0
type BalanceOperator string
const ( BalanceOperatorE BalanceOperator = "e" BalanceOperatorGt BalanceOperator = "gt" BalanceOperatorGte BalanceOperator = "gte" BalanceOperatorLt BalanceOperator = "lt" BalanceOperatorLte BalanceOperator = "lte" BalanceOperatorNe BalanceOperator = "ne" DefaultBalanceOperator = BalanceOperatorGte )
func NewBalanceOperator ¶ added in v1.8.0
func NewBalanceOperator(s string) (BalanceOperator, bool)
func (BalanceOperator) IsValid ¶ added in v1.8.0
func (b BalanceOperator) IsValid() bool
type BalancesQuery ¶ added in v1.8.0
type BalancesQuery struct { PageSize uint Offset uint AfterAddress string Filters BalancesQueryFilters }
func NewBalancesQuery ¶ added in v1.8.0
func NewBalancesQuery() *BalancesQuery
func (*BalancesQuery) WithAddressFilter ¶ added in v1.8.0
func (b *BalancesQuery) WithAddressFilter(address ...string) *BalancesQuery
func (*BalancesQuery) WithAfterAddress ¶ added in v1.8.0
func (b *BalancesQuery) WithAfterAddress(after string) *BalancesQuery
func (*BalancesQuery) WithOffset ¶ added in v1.8.0
func (b *BalancesQuery) WithOffset(offset uint) *BalancesQuery
func (*BalancesQuery) WithPageSize ¶ added in v1.8.0
func (b *BalancesQuery) WithPageSize(pageSize uint) *BalancesQuery
type BalancesQueryFilters ¶ added in v1.8.0
type BalancesQueryFilters struct {
AddressRegexp []string
}
type ConflictError ¶
type ConflictError struct{}
func NewConflictError ¶
func NewConflictError() *ConflictError
func (ConflictError) Error ¶
func (e ConflictError) Error() string
func (ConflictError) Is ¶ added in v1.0.4
func (e ConflictError) Is(err error) bool
type InsufficientFundError ¶
type InsufficientFundError struct {
Asset string
}
func NewInsufficientFundError ¶
func NewInsufficientFundError(asset string) *InsufficientFundError
func (InsufficientFundError) Error ¶
func (e InsufficientFundError) Error() string
func (InsufficientFundError) Is ¶ added in v1.0.4
func (e InsufficientFundError) Is(err error) bool
type Ledger ¶
type Ledger struct {
// contains filtered or unexported fields
}
func (*Ledger) CountAccounts ¶ added in v1.3.2
func (*Ledger) CountTransactions ¶ added in v1.3.2
func (*Ledger) ExecuteScript ¶ added in v1.9.0
func (l *Ledger) ExecuteScript(ctx context.Context, preview bool, script core.ScriptData) (core.ExpandedTransaction, error)
func (*Ledger) ExecuteTxsData ¶ added in v1.9.0
func (l *Ledger) ExecuteTxsData(ctx context.Context, preview, checkBalances bool, txsData ...core.TransactionData) ([]core.ExpandedTransaction, error)
func (*Ledger) GetAccount ¶
func (*Ledger) GetAccounts ¶ added in v1.3.2
func (*Ledger) GetBalances ¶ added in v1.6.0
func (l *Ledger) GetBalances(ctx context.Context, q BalancesQuery) (api.Cursor[core.AccountsBalances], error)
func (*Ledger) GetBalancesAggregated ¶ added in v1.6.0
func (l *Ledger) GetBalancesAggregated(ctx context.Context, q AggregatedBalancesQuery) (core.AssetsBalances, error)
func (*Ledger) GetLedgerStore ¶ added in v1.8.0
func (*Ledger) GetMigrationsInfo ¶ added in v1.9.0
func (*Ledger) GetTransaction ¶
func (*Ledger) GetTransactions ¶ added in v1.3.2
func (l *Ledger) GetTransactions(ctx context.Context, q TransactionsQuery) (api.Cursor[core.ExpandedTransaction], error)
func (*Ledger) LoadMapping ¶
func (*Ledger) RevertTransaction ¶
func (*Ledger) SaveMapping ¶
type LedgerOption ¶ added in v1.7.3
type LedgerOption = func(*Ledger)
type LockError ¶ added in v1.3.0
type LockError struct {
Err error
}
func NewLockError ¶ added in v1.3.0
type LogsQuery ¶ added in v1.9.0
type LogsQuery struct { AfterID uint64 PageSize uint Filters LogsQueryFilters }
func NewLogsQuery ¶ added in v1.9.0
func NewLogsQuery() *LogsQuery
func (*LogsQuery) WithAfterID ¶ added in v1.9.0
func (*LogsQuery) WithEndTimeFilter ¶ added in v1.9.0
func (*LogsQuery) WithPageSize ¶ added in v1.9.0
type LogsQueryFilters ¶ added in v1.9.0
type Monitor ¶ added in v1.3.0
type Monitor interface { CommittedTransactions(ctx context.Context, ledger string, res ...core.ExpandedTransaction) SavedMetadata(ctx context.Context, ledger, targetType, id string, metadata core.Metadata) UpdatedMapping(ctx context.Context, ledger string, mapping core.Mapping) RevertedTransaction(ctx context.Context, ledger string, reverted, revert *core.ExpandedTransaction) }
type NotFoundError ¶ added in v1.6.0
type NotFoundError struct {
Msg string
}
func NewNotFoundError ¶ added in v1.6.0
func NewNotFoundError(msg string) *NotFoundError
func (NotFoundError) Error ¶ added in v1.6.0
func (v NotFoundError) Error() string
func (NotFoundError) Is ¶ added in v1.6.0
func (v NotFoundError) Is(err error) bool
type ResolveOptionFn ¶
func WithMonitor ¶ added in v1.3.0
func WithMonitor(monitor Monitor) ResolveOptionFn
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func NewResolver( storageFactory storage.Driver[Store], ledgerOptions []LedgerOption, cacheBytesCapacity, cacheMaxNumKeys int64, options ...ResolverOption, ) *Resolver
type ResolverOption ¶
type ResolverOption interface {
// contains filtered or unexported methods
}
type ScriptError ¶ added in v1.0.5
func NewScriptError ¶ added in v1.0.5
func NewScriptError(code string, message string) *ScriptError
func (ScriptError) Error ¶ added in v1.0.5
func (e ScriptError) Error() string
func (ScriptError) Is ¶ added in v1.0.5
func (e ScriptError) Is(err error) bool
type Store ¶ added in v1.8.0
type Store interface { GetLastTransaction(ctx context.Context) (*core.ExpandedTransaction, error) CountTransactions(context.Context, TransactionsQuery) (uint64, error) GetTransactions(context.Context, TransactionsQuery) (api.Cursor[core.ExpandedTransaction], error) GetTransaction(ctx context.Context, txid uint64) (*core.ExpandedTransaction, error) GetAccount(ctx context.Context, accountAddress string) (*core.Account, error) GetAssetsVolumes(ctx context.Context, accountAddress string) (core.AssetsVolumes, error) GetAccountWithVolumes(ctx context.Context, account string) (*core.AccountWithVolumes, error) CountAccounts(context.Context, AccountsQuery) (uint64, error) GetAccounts(context.Context, AccountsQuery) (api.Cursor[core.Account], error) GetBalances(context.Context, BalancesQuery) (api.Cursor[core.AccountsBalances], error) GetBalancesAggregated(context.Context, AggregatedBalancesQuery) (core.AssetsBalances, error) GetLastLog(context.Context) (*core.Log, error) GetLogs(context.Context, *LogsQuery) (api.Cursor[core.Log], error) LoadMapping(context.Context) (*core.Mapping, error) GetMigrationsAvailable() ([]core.MigrationInfo, error) GetMigrationsDone(context.Context) ([]core.MigrationInfo, error) UpdateTransactionMetadata(ctx context.Context, txid uint64, metadata core.Metadata, at time.Time) error UpdateAccountMetadata(ctx context.Context, address string, metadata core.Metadata, at time.Time) error Commit(ctx context.Context, txs ...core.ExpandedTransaction) error SaveMapping(ctx context.Context, m core.Mapping) error Name() string Initialize(context.Context) (bool, error) Close(context.Context) error }
type TXIDError ¶ added in v1.12.0
type TXIDError struct{}
func NewTXIDError ¶ added in v1.12.0
func NewTXIDError() *TXIDError
type TransactionCommitError ¶
func NewTransactionCommitError ¶
func NewTransactionCommitError(txIndex int, err error) *TransactionCommitError
func (TransactionCommitError) Error ¶
func (e TransactionCommitError) Error() string
func (TransactionCommitError) Is ¶ added in v1.0.4
func (e TransactionCommitError) Is(err error) bool
func (TransactionCommitError) Unwrap ¶ added in v1.0.4
func (e TransactionCommitError) Unwrap() error
type TransactionsQuery ¶ added in v1.8.0
type TransactionsQuery struct { PageSize uint AfterTxID uint64 Filters TransactionsQueryFilters }
func NewTransactionsQuery ¶ added in v1.8.0
func NewTransactionsQuery() *TransactionsQuery
func (*TransactionsQuery) WithAccountFilter ¶ added in v1.8.0
func (a *TransactionsQuery) WithAccountFilter(account string) *TransactionsQuery
func (*TransactionsQuery) WithAfterTxID ¶ added in v1.8.0
func (a *TransactionsQuery) WithAfterTxID(after uint64) *TransactionsQuery
func (*TransactionsQuery) WithDestinationFilter ¶ added in v1.8.0
func (a *TransactionsQuery) WithDestinationFilter(dest string) *TransactionsQuery
func (*TransactionsQuery) WithEndTimeFilter ¶ added in v1.8.0
func (a *TransactionsQuery) WithEndTimeFilter(end time.Time) *TransactionsQuery
func (*TransactionsQuery) WithMetadataFilter ¶ added in v1.8.0
func (a *TransactionsQuery) WithMetadataFilter(metadata map[string]string) *TransactionsQuery
func (*TransactionsQuery) WithPageSize ¶ added in v1.8.0
func (a *TransactionsQuery) WithPageSize(pageSize uint) *TransactionsQuery
func (*TransactionsQuery) WithReferenceFilter ¶ added in v1.8.0
func (a *TransactionsQuery) WithReferenceFilter(ref string) *TransactionsQuery
func (*TransactionsQuery) WithSourceFilter ¶ added in v1.8.0
func (a *TransactionsQuery) WithSourceFilter(source string) *TransactionsQuery
func (*TransactionsQuery) WithStartTimeFilter ¶ added in v1.8.0
func (a *TransactionsQuery) WithStartTimeFilter(start time.Time) *TransactionsQuery
type TransactionsQueryFilters ¶ added in v1.8.0
type TxVolumeAggregator ¶ added in v1.9.0
type TxVolumeAggregator struct { PreCommitVolumes core.AccountsAssetsVolumes PostCommitVolumes core.AccountsAssetsVolumes // contains filtered or unexported fields }
func (*TxVolumeAggregator) FindInPreviousTxs ¶ added in v1.9.0
func (tva *TxVolumeAggregator) FindInPreviousTxs(addr, asset string) *core.Volumes
func (*TxVolumeAggregator) Transfer ¶ added in v1.9.0
func (tva *TxVolumeAggregator) Transfer( ctx context.Context, from, to, asset string, amount *core.MonetaryInt, accs map[string]*core.AccountWithVolumes, ) error
type ValidationError ¶
type ValidationError struct {
Msg string
}
func NewValidationError ¶
func NewValidationError(msg string) *ValidationError
func (ValidationError) Error ¶
func (v ValidationError) Error() string
func (ValidationError) Is ¶ added in v1.0.4
func (v ValidationError) Is(err error) bool
type VolumeAggregator ¶ added in v1.9.0
type VolumeAggregator struct {
// contains filtered or unexported fields
}
func NewVolumeAggregator ¶ added in v1.8.0
func NewVolumeAggregator(l *Ledger) *VolumeAggregator
func (*VolumeAggregator) NextTx ¶ added in v1.9.0
func (agg *VolumeAggregator) NextTx() *TxVolumeAggregator
Click to show internal directories.
Click to hide internal directories.