chaincode

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChaincodeInvokeOrQuery

func ChaincodeInvokeOrQuery(
	spec *pb.ChaincodeSpec,
	cID string,
	txID string,
	invoke bool,
	signer identity.SignerSerializer,
	certificate tls.Certificate,
	endorserClients []pb.EndorserClient,
	deliverClients []pb.DeliverClient,
	bc common.BroadcastClient,
) (*pb.ProposalResponse, error)

ChaincodeInvokeOrQuery invokes or queries the chaincode. If successful, the INVOKE form prints the ProposalResponse to STDOUT, and the QUERY form prints the query result on STDOUT. A command-line flag (-r, --raw) determines whether the query result is output as raw bytes, or as a printable string. The printable form is optionally (-x, --hex) a hexadecimal representation of the query response. If the query response is NIL, nothing is output.

NOTE - Query will likely go away as all interactions with the endorser are Proposal and ProposalResponses

func Cmd

func Cmd(cf *ChaincodeCmdFactory, cryptoProvider bccsp.BCCSP) *cobra.Command

Cmd returns the cobra command for Chaincode

func GetCollectionConfigFromFile

func GetCollectionConfigFromFile(ccFile string) (*pb.CollectionConfigPackage, []byte, error)

GetCollectionConfigFromFile retrieves the collection configuration from the supplied file; the supplied file must contain a json-formatted array of collectionConfigJson elements

Types

type ChaincodeCmdFactory

type ChaincodeCmdFactory struct {
	EndorserClients []pb.EndorserClient
	DeliverClients  []pb.DeliverClient
	Certificate     tls.Certificate
	Signer          identity.SignerSerializer
	BroadcastClient common.BroadcastClient
}

ChaincodeCmdFactory holds the clients used by ChaincodeCmd

func InitCmdFactory

func InitCmdFactory(cmdName string, isEndorserRequired, isOrdererRequired bool, cryptoProvider bccsp.BCCSP) (*ChaincodeCmdFactory, error)

InitCmdFactory init the ChaincodeCmdFactory with default clients

type DeliverClient

type DeliverClient struct {
	Client     pb.DeliverClient
	Connection pb.Deliver_DeliverClient
	Address    string
}

DeliverClient holds the client/connection related to a specific peer. The address is included for logging purposes

type DeliverGroup

type DeliverGroup struct {
	Clients     []*DeliverClient
	Certificate tls.Certificate
	ChannelID   string
	TxID        string
	Signer      identity.SignerSerializer

	Error error
	// contains filtered or unexported fields
}

DeliverGroup holds all of the information needed to connect to a set of peers to wait for the interested txid to be committed to the ledgers of all peers. This functionality is currently implemented via the peer's DeliverFiltered service. An error from any of the peers/deliver clients will result in the invoke command returning an error. Only the first error that occurs will be set

func NewDeliverGroup

func NewDeliverGroup(
	deliverClients []pb.DeliverClient,
	peerAddresses []string,
	signer identity.SignerSerializer,
	certificate tls.Certificate,
	channelID string,
	txid string,
) *DeliverGroup

func (*DeliverGroup) ClientConnect

func (dg *DeliverGroup) ClientConnect(ctx context.Context, dc *DeliverClient)

ClientConnect sends a deliver seek info envelope using the provided deliver client, setting the deliverGroup's Error field upon any error

func (*DeliverGroup) ClientWait

func (dg *DeliverGroup) ClientWait(dc *DeliverClient)

ClientWait waits for the specified deliver client to receive a block event with the requested txid

func (*DeliverGroup) Connect

func (dg *DeliverGroup) Connect(ctx context.Context) error

Connect waits for all deliver clients in the group to connect to the peer's deliver service, receive an error, or for the context to timeout. An error will be returned whenever even a single deliver client fails to connect to its peer

func (*DeliverGroup) Wait

func (dg *DeliverGroup) Wait(ctx context.Context) error

Wait waits for all deliver client connections in the group to either receive a block with the txid, an error, or for the context to timeout

func (*DeliverGroup) WaitForWG

func (dg *DeliverGroup) WaitForWG(readyCh chan struct{})

WaitForWG waits for the deliverGroup's wait group and closes the channel when ready

type InstallInput

type InstallInput struct {
	Name        string
	Version     string
	Language    string
	PackageFile string
	Path        string
}

InstallInput holds the input parameters for installing a chaincode

type Installer

type Installer struct {
	Command         *cobra.Command
	EndorserClients []pb.EndorserClient
	Input           *InstallInput
	Signer          identity.SignerSerializer
	CryptoProvider  bccsp.BCCSP
}

Installer holds the dependencies needed to install a chaincode

type PackageInput

type PackageInput struct {
	Name                  string
	Version               string
	InstantiationPolicy   string
	CreateSignedCCDepSpec bool
	SignCCDepSpec         bool
	OutputFile            string
	Path                  string
	Type                  string
}

PackageInput holds the input parameters for packaging a ChaincodeInstallPackage

type Packager

type Packager struct {
	CDSFactory          ccDepSpecFactory
	ChaincodeCmdFactory *ChaincodeCmdFactory
	Command             *cobra.Command
	Input               *PackageInput
	CryptoProvider      bccsp.BCCSP
}

Packager holds the dependencies needed to package a chaincode and write it

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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