channel

package
v1.0.0-alpha3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ledger

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

Ledger is a client that provides access to the underlying ledger of a channel.

func NewLedger

func NewLedger(chName string) (*Ledger, error)

NewLedger constructs a Ledger client for the current context and named channel.

func (*Ledger) QueryBlock

func (c *Ledger) QueryBlock(reqCtx reqContext.Context, blockNumber uint64, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.Block, error)

QueryBlock queries the ledger for Block by block number. This query will be made to specified targets. blockNumber: The number which is the ID of the Block. It returns the block.

func (*Ledger) QueryBlockByHash

func (c *Ledger) QueryBlockByHash(reqCtx reqContext.Context, blockHash []byte, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.Block, error)

QueryBlockByHash queries the ledger for Block by block hash. This query will be made to specified targets. Returns the block.

func (*Ledger) QueryBlockByTxID

func (c *Ledger) QueryBlockByTxID(reqCtx reqContext.Context, txID fab.TransactionID, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.Block, error)

QueryBlockByTxID returns a block which contains a transaction This query will be made to specified targets. Returns the block.

func (*Ledger) QueryConfigBlock

func (c *Ledger) QueryConfigBlock(reqCtx reqContext.Context, targets []fab.ProposalProcessor, verifier ResponseVerifier) (*common.ConfigEnvelope, error)

QueryConfigBlock returns the current configuration block for the specified channel. If the peer doesn't belong to the channel, return error

func (*Ledger) QueryInfo

func (c *Ledger) QueryInfo(reqCtx reqContext.Context, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*fab.BlockchainInfoResponse, error)

QueryInfo queries for various useful information on the state of the channel (height, known peers).

func (*Ledger) QueryInstantiatedChaincodes

func (c *Ledger) QueryInstantiatedChaincodes(reqCtx reqContext.Context, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*pb.ChaincodeQueryResponse, error)

QueryInstantiatedChaincodes queries the instantiated chaincodes on this channel. This query will be made to specified targets.

func (*Ledger) QueryTransaction

func (c *Ledger) QueryTransaction(reqCtx reqContext.Context, transactionID fab.TransactionID, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*pb.ProcessedTransaction, error)

QueryTransaction queries the ledger for Transaction by number. This query will be made to specified targets. Returns the ProcessedTransaction information containing the transaction.

type ResponseVerifier

type ResponseVerifier interface {
	Verify(response *fab.TransactionProposalResponse) error
	Match(response []*fab.TransactionProposalResponse) error
}

ResponseVerifier checks transaction proposal response(s)

type TransactionProposalResponseVerifier

type TransactionProposalResponseVerifier struct {
	MinResponses int
}

TransactionProposalResponseVerifier struct is for verifying TransactionProposalResponse and matches config blocks

func (*TransactionProposalResponseVerifier) Match

func (tprv *TransactionProposalResponseVerifier) Match(transactionProposalResponses []*fab.TransactionProposalResponse) error

Match verifies and matches transaction proposal responses

func (*TransactionProposalResponseVerifier) Verify

Verify checks transaction proposal response (empty)

type Transactor

type Transactor struct {
	ChannelID string
	// contains filtered or unexported fields
}

Transactor enables sending transactions and transaction proposals on the channel.

func NewTransactor

func NewTransactor(reqCtx reqContext.Context, cfg fab.ChannelCfg) (*Transactor, error)

NewTransactor returns a Transactor for the current context and channel config.

func (*Transactor) CreateTransaction

func (t *Transactor) CreateTransaction(request fab.TransactionRequest) (*fab.Transaction, error)

CreateTransaction create a transaction with proposal response. TODO: should this be removed as it is purely a wrapper?

func (*Transactor) CreateTransactionHeader

func (t *Transactor) CreateTransactionHeader() (fab.TransactionHeader, error)

CreateTransactionHeader creates a Transaction Header based on the current context.

func (*Transactor) SendTransaction

func (t *Transactor) SendTransaction(tx *fab.Transaction) (*fab.TransactionResponse, error)

SendTransaction send a transaction to the chain’s orderer service (one or more orderer endpoints) for consensus and committing to the ledger.

func (*Transactor) SendTransactionProposal

func (t *Transactor) SendTransactionProposal(proposal *fab.TransactionProposal, targets []fab.ProposalProcessor) ([]*fab.TransactionProposalResponse, error)

SendTransactionProposal sends a TransactionProposal to the target peers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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