auditor

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: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Pending is the status of a transaction that has been submitted to the ledger
	Pending = auditdb.Pending
	// Confirmed is the status of a transaction that has been confirmed by the ledger
	Confirmed = auditdb.Confirmed
	// Deleted is the status of a transaction that has been deleted due to a failure to commit
	Deleted = auditdb.Deleted
)

Variables

View Source
var TxStatusMessage = auditdb.TxStatusMessage

Functions

This section is empty.

Types

type AuditDBProvider added in v0.4.0

type AuditDBProvider interface {
	DBByTMSId(id token.TMSID) (*auditdb.DB, error)
}

type Auditor

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

Auditor is the interface for the auditor service

func Get

Get returns the Auditor instance for the passed auditor wallet

func GetByTMSID added in v0.4.0

func GetByTMSID(sp token.ServiceProvider, tmsID token.TMSID) *Auditor

GetByTMSID returns the Auditor instance for the passed auditor wallet

func New

New returns the Auditor instance for the passed auditor wallet

func (*Auditor) Append

func (a *Auditor) Append(tx Transaction) error

Append adds the passed transaction to the auditor database. It also releases the locks acquired by Audit.

func (*Auditor) Audit

Audit extracts the list of inputs and outputs from the passed transaction. In addition, the Audit locks the enrollment named ids. Release must be invoked in case

func (*Auditor) Check added in v0.4.0

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

func (*Auditor) GetStatus added in v0.3.0

func (a *Auditor) 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 (*Auditor) GetTokenRequest added in v0.3.0

func (a *Auditor) GetTokenRequest(txID string) ([]byte, error)

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

func (*Auditor) Release added in v0.2.0

func (a *Auditor) Release(tx Transaction)

Release releases the lock acquired of the passed transaction.

func (*Auditor) SetStatus

func (a *Auditor) SetStatus(ctx context.Context, txID string, status db.TxStatus, message string) error

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

func (*Auditor) Validate

func (a *Auditor) Validate(context context.Context, request *token.Request) error

Validate validates the passed token request

type CheckService added in v0.4.0

type CheckService interface {
	Check(context context.Context) ([]string, error)
}

type CheckServiceProvider added in v0.4.0

type CheckServiceProvider interface {
	CheckService(id token.TMSID, adb *auditdb.DB, tdb *tokens.Tokens) (CheckService, error)
}

type Manager

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

Manager handles the databases

func NewManager

func NewManager(
	networkProvider NetworkProvider,
	auditDBProvider AuditDBProvider,
	tokenDBProvider TokenDBProvider,
	tmsProvider TokenManagementServiceProvider,
	tracerProvider trace.TracerProvider,
	checkServiceProvider CheckServiceProvider,
) *Manager

NewManager creates a new Auditor manager.

func (*Manager) Auditor

func (cm *Manager) Auditor(tmsID token.TMSID) (*Auditor, error)

Auditor returns the Auditor for the given wallet

func (*Manager) RestoreTMS added in v0.4.0

func (cm *Manager) RestoreTMS(tmsID token.TMSID) error

RestoreTMS restores the auditdb corresponding to the passed TMS ID.

type NetworkProvider added in v0.4.0

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

type TokenDBProvider added in v0.4.0

type TokenDBProvider interface {
	Tokens(id token.TMSID) (*tokens.Tokens, error)
}

type TokenManagementServiceProvider added in v0.4.0

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

type Transaction

type Transaction interface {
	ID() string
	Network() string
	Channel() string
	Namespace() string
	Request() *token.Request
}

Transaction models a generic token transaction

type TxStatus

type TxStatus = auditdb.TxStatus

TxStatus is the status of a transaction

Jump to

Keyboard shortcuts

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