utils

package
v0.0.0-...-9a3149e Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const CC_INVOKE_BROADCAST = "chaincode.invoke.broadcast"
View Source
const CC_INVOKE_PROPOSAL = "chaincode.invoke.proposal"

Variables

This section is empty.

Functions

func NewCollectionConfig

func NewCollectionConfig(colName, policy string, reqPeerCount, maxPeerCount int32, blockToLive uint64, memberOnlyRead bool) (*cb.CollectionConfig, error)

Types

type Client

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

Client enables access to a channel on a Fabric network.

A channel client instance provides a handler to interact with peers on specified channel. An application that requires interaction with multiple channels should create a separate instance of the channel client for each channel. Channel client supports non-admin functions only.

func New

func New(channelProvider context.ChannelProvider, opts ...ClientOption) (*Client, error)

New returns a Client instance. Channel client can query chaincode, execute chaincode and register/unregister for chaincode events on specific channel.

func (*Client) Execute

func (cc *Client) Execute(request ch.Request, options ...RequestOption) (ch.Response, error)

Execute prepares and executes transaction using request and optional request options

Parameters:
request holds info about mandatory chaincode ID and function
options holds optional request options

Returns:
the proposal responses from peer(s)

func (*Client) InvokeHandler

func (cc *Client) InvokeHandler(handler invoke.Handler, request ch.Request, options ...RequestOption) (ch.Response, error)

InvokeHandler invokes handler using request and optional request options provided

Parameters:
handler to be invoked
request holds info about mandatory chaincode ID and function
options holds optional request options

Returns:
the proposal responses from peer(s)

type ClientOption

type ClientOption func(*Client) error

ClientOption describes a functional parameter for the New constructor

type CollectionConfig

type CollectionConfig struct {
	Name              string `json:"name"`
	Policy            string `json:"policy"`
	RequiredPeerCount int32  `json:"requiredPeerCount"`
	MaxPeerCount      int32  `json:"maxPeerCount"`
	BlockToLive       uint64 `json:"blockToLive"`
	MemberOnlyRead    bool   `json:"memberOnlyRead"`
}

type RequestOption

type RequestOption func(ctx context.Client, opts *requestOptions) error

RequestOption func for each Opts argument

func WithTargetEndpoints

func WithTargetEndpoints(keys ...string) RequestOption

WithTargetEndpoints allows overriding of the target peers for the request. Targets are specified by name or URL, and the SDK will create the underlying peer objects.

func WithTimeout

func WithTimeout(timeoutType fab.TimeoutType, timeout time.Duration) RequestOption

WithTimeout encapsulates key value pairs of timeout type, timeout duration to Options

Jump to

Keyboard shortcuts

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