Documentation ¶
Overview ¶
Package ledger enables ability to query ledger in a Fabric network.
Index ¶
- type Client
- func (c *Client) QueryBlock(blockNumber uint64, options ...RequestOption) (*common.Block, error)
- func (c *Client) QueryBlockByHash(blockHash []byte, options ...RequestOption) (*common.Block, error)
- func (c *Client) QueryBlockByTxID(txID fab.TransactionID, options ...RequestOption) (*common.Block, error)
- func (c *Client) QueryConfig(options ...RequestOption) (fab.ChannelCfg, error)
- func (c *Client) QueryInfo(options ...RequestOption) (*fab.BlockchainInfoResponse, error)
- func (c *Client) QueryTransaction(transactionID fab.TransactionID, options ...RequestOption) (*pb.ProcessedTransaction, error)
- type ClientOption
- type RequestOption
- func WithMaxTargets(maxTargets int) RequestOption
- func WithMinTargets(minTargets int) RequestOption
- func WithParentContext(parentContext reqContext.Context) RequestOption
- func WithTargetFilter(targetFilter fab.TargetFilter) RequestOption
- func WithTargetURLs(urls ...string) RequestOption
- func WithTargets(targets ...fab.Peer) RequestOption
- func WithTimeout(timeoutType core.TimeoutType, timeout time.Duration) RequestOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client enables ledger queries on a Fabric network.
A ledger client instance provides a handler to query various info on specified channel. An application that requires interaction with multiple channels should create a separate instance of the ledger client for each channel. Ledger client supports specific queries only.
func New ¶
func New(channelProvider context.ChannelProvider, opts ...ClientOption) (*Client, error)
New returns a Client instance.
func (*Client) QueryBlock ¶
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 (*Client) QueryBlockByHash ¶
func (c *Client) QueryBlockByHash(blockHash []byte, options ...RequestOption) (*common.Block, error)
QueryBlockByHash queries the ledger for Block by block hash. This query will be made to specified targets. Returns the block.
func (*Client) QueryBlockByTxID ¶
func (c *Client) QueryBlockByTxID(txID fab.TransactionID, options ...RequestOption) (*common.Block, error)
QueryBlockByTxID returns a block which contains a transaction This query will be made to specified targets. Returns the block.
func (*Client) QueryConfig ¶
func (c *Client) QueryConfig(options ...RequestOption) (fab.ChannelCfg, error)
QueryConfig config returns channel configuration
func (*Client) QueryInfo ¶
func (c *Client) QueryInfo(options ...RequestOption) (*fab.BlockchainInfoResponse, error)
QueryInfo queries for various useful information on the state of the channel (height, known peers).
func (*Client) QueryTransaction ¶
func (c *Client) QueryTransaction(transactionID fab.TransactionID, options ...RequestOption) (*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 ClientOption ¶
ClientOption describes a functional parameter for the New constructor
func WithDefaultTargetFilter ¶
func WithDefaultTargetFilter(filter fab.TargetFilter) ClientOption
WithDefaultTargetFilter option to configure new
type RequestOption ¶
RequestOption func for each requestOptions argument
func WithMaxTargets ¶
func WithMaxTargets(maxTargets int) RequestOption
WithMaxTargets encapsulates max targets to ledger RequestOption
func WithMinTargets ¶
func WithMinTargets(minTargets int) RequestOption
WithMinTargets encapsulates min targets to ledger RequestOption
func WithParentContext ¶
func WithParentContext(parentContext reqContext.Context) RequestOption
WithParentContext encapsulates grpc context parent to Options
func WithTargetFilter ¶
func WithTargetFilter(targetFilter fab.TargetFilter) RequestOption
WithTargetFilter encapsulates TargetFilter targets to ledger RequestOption
func WithTargetURLs ¶
func WithTargetURLs(urls ...string) RequestOption
WithTargetURLs allows overriding of the target peers for the request. Targets are specified by URL, and the SDK will create the underlying peer objects.
func WithTargets ¶
func WithTargets(targets ...fab.Peer) RequestOption
WithTargets encapsulates fab.Peer targets to ledger RequestOption
func WithTimeout ¶
func WithTimeout(timeoutType core.TimeoutType, timeout time.Duration) RequestOption
WithTimeout encapsulates key value pairs of timeout type, timeout duration to Options for QueryInfo,QueryBlockByHash,QueryBlock,QueryTransaction,QueryConfig functions