auditdb

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 (
	// Unknown is the status of a transaction that is unknown
	Unknown = driver.Unknown
	// Pending is the status of a transaction that has been submitted to the ledger
	Pending = driver.Pending
	// Confirmed is the status of a transaction that has been confirmed by the ledger
	Confirmed = driver.Confirmed
	// Deleted is the status of a transaction that has been deleted due to a failure to commit
	Deleted = driver.Deleted
)

Variables

View Source
var TxStatusMessage = driver.TxStatusMessage

TxStatusMessage maps TxStatus to string

Functions

This section is empty.

Types

type ActionType

type ActionType = driver.ActionType

ActionType is the type of action performed by a transaction.

const (
	// Issue is the action type for issuing tokens.
	Issue ActionType = iota
	// Transfer is the action type for transferring tokens.
	Transfer
	// Redeem is the action type for redeeming tokens.
	Redeem
)

type DB

type DB struct {
	*common.StatusSupport
	// contains filtered or unexported fields
}

DB is a database that stores token transactions related information

func GetByTMSId

func GetByTMSId(sp token.ServiceProvider, tmsID token.TMSID) (*DB, error)

func (*DB) AcquireLocks

func (d *DB) AcquireLocks(anchor string, eIDs ...string) error

AcquireLocks acquires locks for the passed anchor and enrollment ids. This can be used to prevent concurrent read/write access to the audit records of the passed enrollment ids.

func (*DB) Append

func (d *DB) Append(req *token.Request) error

Append appends send and receive movements, and transaction records corresponding to the passed token request

func (*DB) GetStatus

func (d *DB) GetStatus(txID string) (TxStatus, string, error)

GetStatus return the status of the given transaction id. It returns an error if no transaction with that id is found

func (*DB) GetTokenRequest

func (d *DB) GetTokenRequest(txID string) ([]byte, error)

GetTokenRequest returns the token request bound to the passed transaction id, if available.

func (*DB) NewHoldingsFilter

func (d *DB) NewHoldingsFilter() *HoldingsFilter

NewHoldingsFilter returns a programmable filter over the holdings owned by enrollment IDs.

func (*DB) NewPaymentsFilter

func (d *DB) NewPaymentsFilter() *PaymentsFilter

NewPaymentsFilter returns a programmable filter over the payments sent or received by enrollment IDs.

func (*DB) ReleaseLocks

func (d *DB) ReleaseLocks(anchor string)

ReleaseLocks releases the locks associated to the passed anchor

func (*DB) SetStatus

func (d *DB) SetStatus(ctx context.Context, txID string, status driver.TxStatus, message string) error

SetStatus sets the status of the audit records with the passed transaction id to the passed status

func (*DB) TokenRequests

func (d *DB) TokenRequests(params QueryTokenRequestsParams) (driver.TokenRequestIterator, error)

TokenRequests returns an iterator over the token requests matching the passed params

func (*DB) Transactions

func (d *DB) Transactions(params QueryTransactionsParams) (driver.TransactionIterator, error)

Transactions returns an iterators of transaction records filtered by the given params.

type HoldingsFilter

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

func (*HoldingsFilter) ByEnrollmentId

func (f *HoldingsFilter) ByEnrollmentId(id string) *HoldingsFilter

func (*HoldingsFilter) ByType

func (f *HoldingsFilter) ByType(tokenType token.Type) *HoldingsFilter

func (*HoldingsFilter) Execute

func (f *HoldingsFilter) Execute() (*HoldingsFilter, error)

func (*HoldingsFilter) Sum

func (f *HoldingsFilter) Sum() *big.Int

type MovementRecord

type MovementRecord = driver.MovementRecord

MovementRecord is a record of a movement of assets. Given a Token Transaction, a movement record is created for each enrollment ID that participated in the transaction and each token type that was transferred. The movement record contains the total amount of the token type that was transferred to/from the enrollment ID in a given token transaction.

type PaymentsFilter

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

PaymentsFilter is a filter for payments.

func (*PaymentsFilter) ByEnrollmentId

func (f *PaymentsFilter) ByEnrollmentId(id string) *PaymentsFilter

ByEnrollmentId add an enrollment id to the filter.

func (*PaymentsFilter) ByType

func (f *PaymentsFilter) ByType(tokenType token.Type) *PaymentsFilter

func (*PaymentsFilter) Execute

func (f *PaymentsFilter) Execute() (*PaymentsFilter, error)

func (*PaymentsFilter) Last

func (f *PaymentsFilter) Last(num int) *PaymentsFilter

func (*PaymentsFilter) Sum

func (f *PaymentsFilter) Sum() *big.Int

type QueryTokenRequestsParams

type QueryTokenRequestsParams = driver.QueryTokenRequestsParams

QueryTokenRequestsParams defines the parameters for querying token requests

type QueryTransactionsParams

type QueryTransactionsParams = driver.QueryTransactionsParams

QueryTransactionsParams defines the parameters for querying movements

type TransactionIterator

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

TransactionIterator is an iterator over transaction records

func (*TransactionIterator) Close

func (t *TransactionIterator) Close()

Close closes the iterator. It must be called when done with the iterator.

func (*TransactionIterator) Next

Next returns the next transaction record, if any. It returns nil, nil if there are no more records.

type TransactionRecord

type TransactionRecord = driver.TransactionRecord

TransactionRecord is a more finer-grained version of a movement record. Given a Token Transaction, for each token action in the Token Request, a transaction record is created for each unique enrollment ID found in the outputs. The transaction record contains the total amount of the token type that was transferred to/from that enrollment ID in that action.

type TxStatus

type TxStatus = driver.TxStatus

TxStatus is the status of a transaction

type Wallet

type Wallet interface {
	// ID returns the wallet ID
	ID() string
	// TMS returns the TMS of the wallet
	TMS() *token.ManagementService
}

Wallet models a wallet

Directories

Path Synopsis
db
sql

Jump to

Keyboard shortcuts

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