...

Package channel

import "github.com/hyperledger/fabric-sdk-go/pkg/fab/channel"
Overview
Index
Subdirectories

Overview ▾

Index ▾

type Ledger
    func NewLedger(chName string) (*Ledger, error)
    func (c *Ledger) QueryBlock(reqCtx reqContext.Context, blockNumber uint64, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.Block, error)
    func (c *Ledger) QueryBlockByHash(reqCtx reqContext.Context, blockHash []byte, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.Block, error)
    func (c *Ledger) QueryBlockByTxID(reqCtx reqContext.Context, txID fab.TransactionID, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.Block, error)
    func (c *Ledger) QueryCollectionsConfig(reqCtx reqContext.Context, chaincodeName string, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.CollectionConfigPackage, error)
    func (c *Ledger) QueryConfigBlock(reqCtx reqContext.Context, targets []fab.ProposalProcessor, verifier ResponseVerifier) (*common.Block, error)
    func (c *Ledger) QueryInfo(reqCtx reqContext.Context, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*fab.BlockchainInfoResponse, error)
    func (c *Ledger) QueryInstantiatedChaincodes(reqCtx reqContext.Context, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*pb.ChaincodeQueryResponse, error)
    func (c *Ledger) QueryTransaction(reqCtx reqContext.Context, transactionID fab.TransactionID, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*pb.ProcessedTransaction, error)
type ResponseVerifier
type TransactionProposalResponseVerifier
    func (tprv *TransactionProposalResponseVerifier) Match(transactionProposalResponses []*fab.TransactionProposalResponse) error
    func (tprv *TransactionProposalResponseVerifier) Verify(response *fab.TransactionProposalResponse) error
type Transactor
    func NewTransactor(reqCtx reqContext.Context, cfg fab.ChannelCfg) (*Transactor, error)
    func (t *Transactor) CreateTransaction(request fab.TransactionRequest) (*fab.Transaction, error)
    func (t *Transactor) CreateTransactionHeader(opts ...fab.TxnHeaderOpt) (fab.TransactionHeader, error)
    func (t *Transactor) SendTransaction(tx *fab.Transaction) (*fab.TransactionResponse, error)
    func (t *Transactor) SendTransactionProposal(proposal *fab.TransactionProposal, targets []fab.ProposalProcessor) ([]*fab.TransactionProposalResponse, error)

Package files

cscc.go ledger.go qscc.go responsevalidator.go transactor.go

type Ledger

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

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

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) QueryCollectionsConfig

func (c *Ledger) QueryCollectionsConfig(reqCtx reqContext.Context, chaincodeName string, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.CollectionConfigPackage, error)

QueryCollectionsConfig queries the collections config for a chaincode on this channel.

func (*Ledger) QueryConfigBlock

func (c *Ledger) QueryConfigBlock(reqCtx reqContext.Context, targets []fab.ProposalProcessor, verifier ResponseVerifier) (*common.Block, 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

ResponseVerifier checks transaction proposal response(s)

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

type TransactionProposalResponseVerifier

TransactionProposalResponseVerifier struct is for verifying TransactionProposalResponse and matches config blocks

type TransactionProposalResponseVerifier struct {
    MinResponses int
}

func (*TransactionProposalResponseVerifier) Match

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

Match verifies and matches transaction proposal responses

func (*TransactionProposalResponseVerifier) Verify

func (tprv *TransactionProposalResponseVerifier) Verify(response *fab.TransactionProposalResponse) error

Verify checks transaction proposal response (empty)

type Transactor

Transactor enables sending transactions and transaction proposals on the channel.

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

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(opts ...fab.TxnHeaderOpt) (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.

Subdirectories

Name Synopsis
..
membership