fabric: github.com/hyperledger/fabric/token/tms/plain Index | Files

package plain

import "github.com/hyperledger/fabric/token/tms/plain"

Index

Package Files

issuer.go ledger.go manager.go pool.go transactor.go verifier.go

Variables

var TokenInputSpentMarker = []byte{1}

func GenerateKeyForTest Uses

func GenerateKeyForTest(txID string, index int) (string, error)

GenerateKeyForTest is here only for testing purposes, to be removed later.

type HistoryIterator Uses

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

HistoryIterator is an iterator for iterating through the transaction history.

func (*HistoryIterator) Next Uses

func (it *HistoryIterator) Next() (string, *token.TokenTransaction, error)

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

type Issuer Uses

type Issuer struct{}

An Issuer that can import new tokens

func (*Issuer) RequestExpectation Uses

func (i *Issuer) RequestExpectation(request *token.ExpectationRequest) (*token.TokenTransaction, error)

RequestExpectation allows indirect import based on the expectation. It creates a token transaction with the outputs as specified in the expectation.

func (*Issuer) RequestImport Uses

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 Manager Uses

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

Manager is used to access TMS components.

func (*Manager) GetTxProcessor Uses

func (m *Manager) GetTxProcessor(channel string) (transaction.TMSTxProcessor, error)

GetTxProcessor returns a TMSTxProcessor that is used to process token transactions.

func (*Manager) SetPolicyValidator Uses

func (m *Manager) SetPolicyValidator(channel string, validator identity.IssuingValidator)

SetPolicyValidator sets the policy validator for the specified channel

type MemoryLedger Uses

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

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

func NewMemoryLedger Uses

func NewMemoryLedger() *MemoryLedger

NewMemoryLedger creates a new MemoryLedger

func (*MemoryLedger) Done Uses

func (p *MemoryLedger) Done()

Done releases resources occupied by the MemoryLedger

func (*MemoryLedger) GetState Uses

func (p *MemoryLedger) GetState(namespace string, key string) ([]byte, error)

GetState gets the value for given namespace and Key. For a chaincode, the namespace corresponds to the chaincodeID

func (*MemoryLedger) GetStateRangeScanIterator Uses

func (p *MemoryLedger) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (ledger.ResultsIterator, error)

GetStateRangeScanIterator gets the values for a given namespace that lie in an interval determined by startKey and endKey. this is a mock function.

func (*MemoryLedger) SetState Uses

func (p *MemoryLedger) SetState(namespace string, key string, value []byte) error

SetState sets the given value for the given namespace and Key. For a chaincode, the namespace corresponds to the chaincodeID

type MemoryPool Uses

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 Uses

func NewMemoryPool() *MemoryPool

NewMemoryPool creates a new MemoryPool

func (*MemoryPool) CommitUpdate Uses

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

CommitUpdate commits transaction data into the pool.

func (*MemoryPool) HistoryIterator Uses

func (p *MemoryPool) HistoryIterator() *HistoryIterator

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

func (*MemoryPool) Iterator Uses

func (p *MemoryPool) Iterator() *PoolIterator

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

func (*MemoryPool) OutputByID Uses

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

OutputByID gets an output by its ID.

func (*MemoryPool) TxByID Uses

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 Uses

type OutputNotFoundError struct {
    ID string
}

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

func (*OutputNotFoundError) Error Uses

func (o *OutputNotFoundError) Error() string

type PoolIterator Uses

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

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

func (*PoolIterator) Next Uses

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 Transactor Uses

type Transactor struct {
    PublicCredential []byte
    Ledger           ledger.LedgerReader
}

A Transactor that can transfer tokens.

func (*Transactor) Done Uses

func (t *Transactor) Done()

Done releases any resources held by this transactor

func (*Transactor) ListTokens Uses

func (t *Transactor) ListTokens() (*token.UnspentTokens, error)

ListTokens creates a TokenTransaction that lists the unspent tokens owned by owner.

func (*Transactor) RequestApprove Uses

func (t *Transactor) RequestApprove(request *token.ApproveRequest) (*token.TokenTransaction, error)

func (*Transactor) RequestExpectation Uses

func (t *Transactor) RequestExpectation(request *token.ExpectationRequest) (*token.TokenTransaction, error)

RequestExpectation allows indirect transfer based on the expectation. It creates a token transaction based on the outputs as specified in the expectation.

func (*Transactor) RequestRedeem Uses

func (t *Transactor) RequestRedeem(request *token.RedeemRequest) (*token.TokenTransaction, error)

RequestRedeem creates a TokenTransaction of type redeem request

func (*Transactor) RequestTransfer Uses

func (t *Transactor) RequestTransfer(request *token.TransferRequest) (*token.TokenTransaction, error)

RequestTransfer creates a TokenTransaction of type transfer request func (t *Transactor) RequestTransfer(inTokens []*token.InputId, tokensToTransfer []*token.RecipientTransferShare) (*token.TokenTransaction, error) {

func (*Transactor) RequestTransferFrom Uses

func (t *Transactor) RequestTransferFrom(request *token.TransferRequest) (*token.TokenTransaction, error)

type TxNotFoundError Uses

type TxNotFoundError struct {
    TxID string
}

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

func (*TxNotFoundError) Error Uses

func (p *TxNotFoundError) Error() string

type Verifier Uses

type Verifier struct {
    IssuingValidator identity.IssuingValidator
}

A Verifier validates and commits token transactions.

func (*Verifier) ProcessTx Uses

func (v *Verifier) ProcessTx(txID string, creator identity.PublicInfo, ttx *token.TokenTransaction, simulator ledger.LedgerWriter) error

ProcessTx checks that transactions are correct wrt. the most recent ledger state. ProcessTx checks are ones that shall be done sequentially, since transactions within a block may introduce dependencies.

Package plain imports 20 packages (graph) and is imported by 2 packages. Updated 2019-02-04. Refresh now. Tools for package owners.