plain

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credential

type Credential interface {
	Public() []byte
	Private() []byte
}

The Credential is used to identify token owners.

type HistoryIterator

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

HistoryIterator is an iterator for iterating through the transaction history.

func (*HistoryIterator) Next

Next gets the next transaction from the history, or io.EOF if there are no more transactions.

type Issuer

type Issuer struct{}

An Issuer that can import new tokens

func (*Issuer) RequestImport

func (i *Issuer) RequestImport(tokensToIssue []*token.TokenToIssue) (*token.TokenTransaction, error)

RequestImport creates an import request with the token owners, types, and quantities specified in tokensToIssue.

type MemoryPool

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

A MemoryPool is an in-memory ledger of transactions and unspent outputs. This implementation is only meant for testing.

func NewMemoryPool

func NewMemoryPool() *MemoryPool

NewMemoryPool creates a new MemoryPool

func (*MemoryPool) CommitUpdate

func (p *MemoryPool) CommitUpdate(transactionData []tms.TransactionData) error

CommitUpdate commits transaction data into the pool.

func (*MemoryPool) HistoryIterator

func (p *MemoryPool) HistoryIterator() *HistoryIterator

HistoryIterator creates a new HistoryIterator for iterating through the transaction history.

func (*MemoryPool) Iterator

func (p *MemoryPool) Iterator() *PoolIterator

Iterator returns an iterator of the unspent outputs based on a copy of the pool.

func (*MemoryPool) OutputByID

func (p *MemoryPool) OutputByID(id string) (*token.PlainOutput, error)

OutputByID gets an output by its ID.

func (*MemoryPool) TxByID

func (p *MemoryPool) TxByID(txID string) (*token.TokenTransaction, error)

TxByID gets a transaction by its transaction ID. If no transaction exists with the given ID, a TxNotFoundError is returned.

type OutputNotFoundError

type OutputNotFoundError struct {
	ID string
}

OutputNotFoundError is returned when an entry was not found in the pool.

func (*OutputNotFoundError) Error

func (o *OutputNotFoundError) Error() string

type PolicyValidator

type PolicyValidator interface {
	// IsIssuer returns true if the creator can issue tokens of the given type, false if not
	IsIssuer(creator Credential, tokenType string) error
}

A PolicyValidator interface, used by TMS components to validate fabric channel policies

type Pool

type Pool interface {
	CommitUpdate(transactionData []tms.TransactionData) error
}

A Pool implements a UTXO pool

type PoolIterator

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

PoolIterator is an iterator for iterating through the items in the pool.

func (*PoolIterator) Next

func (it *PoolIterator) Next() (string, *token.PlainOutput, error)

Next gets the next output from the pool, or io.EOF if there are no more outputs.

type TxNotFoundError

type TxNotFoundError struct {
	TxID string
}

TxNotFoundError is returned when a transaction was not found in the pool.

func (*TxNotFoundError) Error

func (p *TxNotFoundError) Error() string

type Verifier

type Verifier struct {
	Pool            Pool
	PolicyValidator PolicyValidator
	// contains filtered or unexported fields
}

A Verifier validates and commits token transactions.

func (*Verifier) Commit

func (v *Verifier) Commit(creator Credential, transactionData []tms.TransactionData) error

Commit checks that transactions are correct wrt. the most recent ledger state. Commit checks shall be done in parallel, since transactions within a block may introduce dependencies.

func (*Verifier) Validate

func (v *Verifier) Validate(creator Credential, data tms.TransactionData) error

Validate checks transactions to see if they are well-formed. Validation checks can be done in parallel for all of the token transactions within a block.

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