Documentation
¶
Index ¶
- Constants
- Variables
- type ActionType
- type Cache
- type MovementRecord
- type PageTransactionsIterator
- type Pagination
- type QueryTokenRequestsParams
- type QueryTransactionsParams
- type QueryValidationRecordsParams
- type StoreService
- func (d *StoreService) AddTransactionEndorsementAck(ctx context.Context, txID string, id token.Identity, sigma []byte) error
- func (d *StoreService) AppendTransactionRecord(ctx context.Context, req *token.Request) error
- func (d *StoreService) AppendValidationRecord(ctx context.Context, txID string, tokenRequest []byte, meta map[string][]byte, ...) error
- func (d *StoreService) GetStatus(ctx context.Context, txID string) (TxStatus, string, error)
- func (d *StoreService) GetTokenRequest(ctx context.Context, txID string) ([]byte, error)
- func (d *StoreService) GetTransactionEndorsementAcks(ctx context.Context, txID string) (map[string][]byte, error)
- func (d *StoreService) SetStatus(ctx context.Context, txID string, status driver.TxStatus, message string) error
- func (d *StoreService) TokenRequests(ctx context.Context, params QueryTokenRequestsParams) (driver.TokenRequestIterator, error)
- func (d *StoreService) Transactions(ctx context.Context, params QueryTransactionsParams, pagination Pagination) (*PageTransactionsIterator, error)
- func (d *StoreService) ValidationRecords(ctx context.Context, params QueryValidationRecordsParams) (*ValidationRecordsIterator, error)
- type StoreServiceManager
- type TransactionIterator
- type TransactionRecord
- type TxStatus
- type ValidationRecord
- type ValidationRecordsIterator
- type Wallet
Constants ¶
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 ¶
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.
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.
func Movements ¶ added in v0.4.0
func Movements(ctx context.Context, record *token.AuditRecord, created time.Time) (mv []MovementRecord, err error)
Movements converts an AuditRecord to MovementRecords for storage in the database. A positive movement Amount means incoming tokens, and negative means outgoing tokens from the enrollment ID.
type PageTransactionsIterator ¶ added in v0.5.0
type PageTransactionsIterator = cdriver.PageIterator[*TransactionRecord]
Pagination iterator defines the pagination iterator for movements query results
type Pagination ¶ added in v0.5.0
type Pagination = cdriver.Pagination
Pagination defines the pagination for querying movements
type QueryTokenRequestsParams ¶ added in v0.4.0
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 QueryValidationRecordsParams ¶ added in v0.3.0
type QueryValidationRecordsParams = driver.QueryValidationRecordsParams
QueryValidationRecordsParams defines the parameters for querying movements
type StoreService ¶ added in v0.5.0
type StoreService struct { *common.StatusSupport // contains filtered or unexported fields }
StoreService is a database that stores token transactions related information
func GetByTMSId ¶ added in v0.4.0
func GetByTMSId(sp token.ServiceProvider, tmsID token.TMSID) (*StoreService, error)
func (*StoreService) AddTransactionEndorsementAck ¶ added in v0.5.0
func (d *StoreService) AddTransactionEndorsementAck(ctx context.Context, txID string, id token.Identity, sigma []byte) error
AddTransactionEndorsementAck records the signature of a given endorser for a given transaction
func (*StoreService) AppendTransactionRecord ¶ added in v0.5.0
AppendTransactionRecord appends the transaction records corresponding to the passed token request.
func (*StoreService) AppendValidationRecord ¶ added in v0.5.0
func (d *StoreService) AppendValidationRecord(ctx context.Context, txID string, tokenRequest []byte, meta map[string][]byte, ppHash driver2.PPHash) error
AppendValidationRecord appends the given validation metadata related to the given transaction id
func (*StoreService) GetStatus ¶ added in v0.5.0
GetStatus return the status of the given transaction id. It returns an error if no transaction with that id is found
func (*StoreService) GetTokenRequest ¶ added in v0.5.0
GetTokenRequest returns the token request bound to the passed transaction id, if available.
func (*StoreService) GetTransactionEndorsementAcks ¶ added in v0.5.0
func (d *StoreService) GetTransactionEndorsementAcks(ctx context.Context, txID string) (map[string][]byte, error)
GetTransactionEndorsementAcks returns the endorsement signatures for the given transaction id
func (*StoreService) SetStatus ¶ added in v0.5.0
func (d *StoreService) 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 (*StoreService) TokenRequests ¶ added in v0.5.0
func (d *StoreService) TokenRequests(ctx context.Context, params QueryTokenRequestsParams) (driver.TokenRequestIterator, error)
TokenRequests returns an iterator over the token requests matching the passed params
func (*StoreService) Transactions ¶ added in v0.5.0
func (d *StoreService) Transactions(ctx context.Context, params QueryTransactionsParams, pagination Pagination) (*PageTransactionsIterator, error)
Transactions returns an iterators of transaction records filtered by the given params.
func (*StoreService) ValidationRecords ¶ added in v0.5.0
func (d *StoreService) ValidationRecords(ctx context.Context, params QueryValidationRecordsParams) (*ValidationRecordsIterator, error)
ValidationRecords returns an iterators of validation records filtered by the given params.
type StoreServiceManager ¶ added in v0.5.0
type StoreServiceManager db.StoreServiceManager[*StoreService]
func NewStoreServiceManager ¶ added in v0.5.0
func NewStoreServiceManager(cp cdriver.ConfigService, drivers multiplexed.Driver) StoreServiceManager
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 ¶
func (t *TransactionIterator) Next() (*TransactionRecord, error)
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.
func TransactionRecords ¶ added in v0.4.0
func TransactionRecords(ctx context.Context, record *token.AuditRecord, timestamp time.Time) (txs []TransactionRecord, err error)
TransactionRecords is a pure function that converts an AuditRecord for storage in the database.
type ValidationRecord ¶ added in v0.3.0
type ValidationRecord = driver.ValidationRecord
ValidationRecord 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 ValidationRecordsIterator ¶ added in v0.3.0
type ValidationRecordsIterator struct {
// contains filtered or unexported fields
}
ValidationRecordsIterator is an iterator over validation records
func (*ValidationRecordsIterator) Close ¶ added in v0.3.0
func (t *ValidationRecordsIterator) Close()
Close closes the iterator. It must be called when done with the iterator.
func (*ValidationRecordsIterator) Next ¶ added in v0.3.0
func (t *ValidationRecordsIterator) Next() (*ValidationRecord, error)
Next returns the next validation record, if any. It returns nil, nil if there are no more records.
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