api

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: May 18, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// EndorseTransaction request endorsement from the peers on this channel
	// for a transaction with the given parameters
	// @param {EndorseTxRequest} request identifies the chaincode to invoke
	// @returns {Response} responses from endorsers
	// @returns {error} error, if any
	EndorseTransaction(endorseRequest *EndorseTxRequest) (*channel.Response, error)

	// CommitTransaction request commit from the peers on this channel
	// for a transaction with the given parameters
	// @param {EndorseTxRequest} request identifies the chaincode to invoke
	// @param {registerTxEvent} is bool to register tx event
	// @param {EndorsedCallback} is a function that is invoked after the endorsement
	// @returns {Response} responses from endorsers
	// @returns {error} error, if any
	CommitTransaction(endorseRequest *EndorseTxRequest, registerTxEvent bool, callback EndorsedCallback) (*channel.Response, error)

	// VerifyTxnProposalSignature verify TxnProposalSignature against msp
	// @param {[]byte} Txn Proposal
	// @returns {error} error, if any
	VerifyTxnProposalSignature([]byte) error

	// GetConfig get client config
	// @returns {Config} config
	GetConfig() coreApi.Config

	// GetContext get client context
	// @returns {Client} client
	GetContext() contextApi.Client
}

Client is a wrapper interface around the fabric client It enables multithreaded access to the client

type ClientService

type ClientService interface {
	GetFabricClient(channelID string, config Config) (Client, error)
}

ClientService interface

type Config

type Config interface {
	GetLocalPeer() (*PeerConfig, error)
	GetMspID() string
	GetMspConfigPath() string
	GetTLSRootCertPath() string
	GetTLSRootCert() *x509.Certificate
	GetTLSCertPath() string
	GetTLSCert() *x509.Certificate
	GetTLSCertPem() []byte
	GetTLSKeyPath() string
	GetGRPCProtocol() string
	GetConfigPath(path string) string
	GetPeerConfig() *viper.Viper
	GetConfigBytes() []byte
	GetCryptoProvider() (string, error)
	GetEndorserSelectionMaxAttempts() int
	GetEndorserSelectionInterval() time.Duration
	GetHandlerTimeout() time.Duration
	RetryOpts() retry.Opts
	RetryOnCCError() bool
}

Config configuration interface

type EndorseTxRequest added in v0.1.4

type EndorseTxRequest struct {
	// ChaincodeID identifies the chaincode to invoke
	ChaincodeID string
	// Args to pass to the chaincode. Args[0] is the function name
	Args []string
	// TransientData map (optional)
	TransientData map[string][]byte
	// Targets for the transaction (optional)
	Targets []fabApi.Peer
	// ChaincodeIDs contains all of the chaincodes that should be included
	// when evaluating endorsement policy (including the chaincode being invoked).
	// If empty then only the invoked chaincode is included. (optional)
	ChaincodeIDs []string
	// PeerFilter filters out peers using application-specific logic (optional)
	PeerFilter PeerFilter
	// RWSetIgnoreNameSpace rw set ignore list
	RWSetIgnoreNameSpace []string
}

EndorseTxRequest contains the parameters for the EndorseTransaction function

type EndorsedCallback added in v0.1.11

type EndorsedCallback func(invoke.Response) error

EndorsedCallback is a function that is invoked after the endorsement phase of CommitTransaction. (Used in unit tests.)

type PeerConfig

type PeerConfig struct {
	Host      string
	Port      int
	EventHost string
	EventPort int
	MSPid     []byte
}

PeerConfig represents the server addresses of a fabric peer

type PeerFilter added in v0.1.4

type PeerFilter interface {
	// Accept returns true if the given peer should be included in the set of endorsers
	Accept(peer fabApi.Peer) bool
}

PeerFilter is applied to peers selected for endorsement and removes those groups that don't pass the filter acceptance test

type PeerFilterOpts added in v0.1.4

type PeerFilterOpts struct {
	Type PeerFilterType
	Args []string
}

PeerFilterOpts specifies the peer filter type and includes any args required by the peer filter

type PeerFilterType added in v0.1.4

type PeerFilterType string

PeerFilterType is the type name of the Peer Filter

const (
	// MinBlockHeightPeerFilterType is a peer filter that selects peers
	// whose block height is at least the height of the local peer on which
	// the TxSnap is being invoked.
	// Required Args:
	// - arg[0]: Channel ID
	MinBlockHeightPeerFilterType PeerFilterType = "MinBlockHeight"
)

type SnapTransactionRequest

type SnapTransactionRequest struct {
	ChannelID            string            // required channel ID
	ChaincodeID          string            // required chaincode ID
	TransientMap         map[string][]byte // optional transient Map
	EndorserArgs         [][]byte          // optional args for endorsement
	CCIDsForEndorsement  []string          // optional ccIDs For endorsement selection
	RegisterTxEvent      bool              // optional args for register Tx event (default is false)
	PeerFilter           *PeerFilterOpts   // optional peer filter
	RWSetIgnoreNameSpace []string          // RWSetIgnoreNameSpace rw set ignore list
}

SnapTransactionRequest type will be passed as argument to a transaction snap ChannelID and ChaincodeID are mandatory fields

Jump to

Keyboard shortcuts

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