chaincode

package
v0.0.0-...-7a628bf Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApproveForMyOrgCmd

func ApproveForMyOrgCmd(a *ApproverForMyOrg, cryptoProvider bccsp.BCCSP) *cobra.Command

ApproveForMyOrgCmd returns the cobra command for chaincode ApproveForMyOrg

func CheckCommitReadinessCmd

func CheckCommitReadinessCmd(c *CommitReadinessChecker, cryptoProvider bccsp.BCCSP) *cobra.Command

CheckCommitReadinessCmd returns the cobra command for the CheckCommitReadiness lifecycle operation

func Cmd

func Cmd(cryptoProvider bccsp.BCCSP) *cobra.Command

Cmd returns the cobra command for Chaincode

func CommitCmd

func CommitCmd(c *Committer, cryptoProvider bccsp.BCCSP) *cobra.Command

CommitCmd returns the cobra command for chaincode Commit

func GetInstalledPackageCmd

func GetInstalledPackageCmd(i *InstalledPackageGetter, cryptoProvider bccsp.BCCSP) *cobra.Command

GetInstalledPackageCmd returns the cobra command for getting an installed chaincode package from a peer.

func InstallCmd

func InstallCmd(i *Installer, cryptoProvider bccsp.BCCSP) *cobra.Command

InstallCmd returns the cobra command for chaincode install.

func PackageCmd

func PackageCmd(p *Packager) *cobra.Command

PackageCmd returns the cobra command for packaging chaincode

func QueryApprovedCmd

func QueryApprovedCmd(a *ApprovedQuerier, cryptoProvider bccsp.BCCSP) *cobra.Command

QueryApprovedCmd returns the cobra command for querying the approved chaincode definition for the organization

func QueryCommittedCmd

func QueryCommittedCmd(c *CommittedQuerier, cryptoProvider bccsp.BCCSP) *cobra.Command

QueryCommittedCmd returns the cobra command for querying a committed chaincode definition given the chaincode name

func QueryInstalledCmd

func QueryInstalledCmd(i *InstalledQuerier, cryptoProvider bccsp.BCCSP) *cobra.Command

QueryInstalledCmd returns the cobra command for listing the installed chaincodes

func ResetFlags

func ResetFlags()

ResetFlags resets the values of these flags to facilitate tests

Types

type ApproveForMyOrgInput

type ApproveForMyOrgInput struct {
	ChannelID                string
	Name                     string
	Version                  string
	PackageID                string
	Sequence                 int64
	EndorsementPlugin        string
	ValidationPlugin         string
	ValidationParameterBytes []byte
	CollectionConfigPackage  *pb.CollectionConfigPackage
	InitRequired             bool
	PeerAddresses            []string
	WaitForEvent             bool
	WaitForEventTimeout      time.Duration
	TxID                     string
}

ApproveForMyOrgInput holds all of the input parameters for approving a chaincode definition for an organization. ValidationParameter bytes is the (marshalled) endorsement policy when using the default endorsement and validation plugins

func (*ApproveForMyOrgInput) Validate

func (a *ApproveForMyOrgInput) Validate() error

Validate the input for an ApproveChaincodeDefinitionForMyOrg proposal

type ApprovedQuerier

type ApprovedQuerier struct {
	Command        *cobra.Command
	EndorserClient EndorserClient
	Input          *ApprovedQueryInput
	Signer         Signer
	Writer         io.Writer
}

ApprovedQuerier holds the dependencies needed to query the approved chaincode definition for the organization

func (*ApprovedQuerier) Query

func (a *ApprovedQuerier) Query() error

Query returns the approved chaincode definition for a given channel and chaincode name

type ApprovedQueryInput

type ApprovedQueryInput struct {
	ChannelID    string
	Name         string
	Sequence     int64
	OutputFormat string
}

type ApproverForMyOrg

type ApproverForMyOrg struct {
	Certificate     tls.Certificate
	Command         *cobra.Command
	BroadcastClient common.BroadcastClient
	DeliverClients  []pb.DeliverClient
	EndorserClients []EndorserClient
	Input           *ApproveForMyOrgInput
	Signer          Signer
}

ApproverForMyOrg holds the dependencies needed to approve a chaincode definition for an organization

func (*ApproverForMyOrg) Approve

func (a *ApproverForMyOrg) Approve() error

Approve submits a ApproveChaincodeDefinitionForMyOrg proposal

type ChaincodeDefinition

type ChaincodeDefinition interface {
	GetVersion() string
	GetSequence() int64
	GetEndorsementPlugin() string
	GetValidationPlugin() string
}

type ClientConnections

type ClientConnections struct {
	BroadcastClient common.BroadcastClient
	DeliverClients  []pb.DeliverClient
	EndorserClients []pb.EndorserClient
	Certificate     tls.Certificate
	Signer          identity.SignerSerializer
	CryptoProvider  bccsp.BCCSP
}

ClientConnections holds the clients for connecting to the various endpoints in a Fabric network.

func NewClientConnections

func NewClientConnections(input *ClientConnectionsInput, cryptoProvider bccsp.BCCSP) (*ClientConnections, error)

NewClientConnections creates a new set of client connections based on the input parameters.

type ClientConnectionsInput

type ClientConnectionsInput struct {
	CommandName           string
	EndorserRequired      bool
	OrdererRequired       bool
	OrderingEndpoint      string
	ChannelID             string
	PeerAddresses         []string
	TLSRootCertFiles      []string
	ConnectionProfilePath string
	TLSEnabled            bool
}

ClientConnectionsInput holds the input parameters for creating client connections.

type CommitInput

type CommitInput struct {
	ChannelID                string
	Name                     string
	Version                  string
	Hash                     []byte
	Sequence                 int64
	EndorsementPlugin        string
	ValidationPlugin         string
	ValidationParameterBytes []byte
	CollectionConfigPackage  *pb.CollectionConfigPackage
	InitRequired             bool
	PeerAddresses            []string
	WaitForEvent             bool
	WaitForEventTimeout      time.Duration
	TxID                     string
}

CommitInput holds all of the input parameters for committing a chaincode definition. ValidationParameter bytes is the (marshalled) endorsement policy when using the default endorsement and validation plugins

func (*CommitInput) Validate

func (c *CommitInput) Validate() error

Validate the input for a CommitChaincodeDefinition proposal

type CommitReadinessCheckInput

type CommitReadinessCheckInput struct {
	ChannelID                string
	Name                     string
	Version                  string
	PackageID                string
	Sequence                 int64
	EndorsementPlugin        string
	ValidationPlugin         string
	ValidationParameterBytes []byte
	CollectionConfigPackage  *pb.CollectionConfigPackage
	InitRequired             bool
	PeerAddresses            []string
	TxID                     string
	OutputFormat             string
}

CommitReadinessCheckInput holds all of the input parameters for checking whether a chaincode definition is ready to be committed ValidationParameter bytes is the (marshalled) endorsement policy when using the default endorsement and validation plugins.

func (*CommitReadinessCheckInput) Validate

func (c *CommitReadinessCheckInput) Validate() error

Validate the input for a CheckCommitReadiness proposal

type CommitReadinessChecker

type CommitReadinessChecker struct {
	Command        *cobra.Command
	EndorserClient pb.EndorserClient
	Input          *CommitReadinessCheckInput
	Signer         identity.SignerSerializer
	Writer         io.Writer
}

CommitReadinessChecker holds the dependencies needed to check whether a chaincode definition is ready to be committed on a channel (i.e. has approvals from enough organizations to satisfy the lifecycle endorsement policy) and receive the list of orgs that have approved the definition.

func (*CommitReadinessChecker) ReadinessCheck

func (c *CommitReadinessChecker) ReadinessCheck() error

ReadinessCheck submits a CheckCommitReadiness proposal and prints the result.

type CommittedQuerier

type CommittedQuerier struct {
	Command        *cobra.Command
	Input          *CommittedQueryInput
	EndorserClient EndorserClient
	Signer         Signer
	Writer         io.Writer
}

CommittedQuerier holds the dependencies needed to query the committed chaincode definitions

func (*CommittedQuerier) Query

func (c *CommittedQuerier) Query() error

Query returns the committed chaincode definition for a given channel and chaincode name

type CommittedQueryInput

type CommittedQueryInput struct {
	ChannelID    string
	Name         string
	OutputFormat string
}

type Committer

type Committer struct {
	Certificate     tls.Certificate
	Command         *cobra.Command
	BroadcastClient common.BroadcastClient
	EndorserClients []EndorserClient
	DeliverClients  []pb.DeliverClient
	Input           *CommitInput
	Signer          Signer
}

Committer holds the dependencies needed to commit a chaincode

func (*Committer) Commit

func (c *Committer) Commit() error

Commit submits a CommitChaincodeDefinition proposal

type EndorserClient

type EndorserClient interface {
	ProcessProposal(ctx context.Context, in *pb.SignedProposal, opts ...grpc.CallOption) (*pb.ProposalResponse, error)
}

EndorserClient defines the interface for sending a proposal to an endorser

type GetInstalledPackageInput

type GetInstalledPackageInput struct {
	PackageID       string
	OutputDirectory string
}

GetInstalledPackageInput holds all of the input parameters for getting an installed chaincode package from a peer.

func (*GetInstalledPackageInput) Validate

func (i *GetInstalledPackageInput) Validate() error

Validate checks that the required parameters are provided.

type InstallInput

type InstallInput struct {
	PackageFile string
}

InstallInput holds the input parameters for installing a chaincode.

func (*InstallInput) Validate

func (i *InstallInput) Validate() error

Validate checks that the required install parameters are provided.

type InstalledPackageGetter

type InstalledPackageGetter struct {
	Command        *cobra.Command
	Input          *GetInstalledPackageInput
	EndorserClient EndorserClient
	Signer         Signer
	Writer         Writer
}

InstalledPackageGetter holds the dependencies needed to retrieve an installed chaincode package from a peer.

func (*InstalledPackageGetter) Get

func (i *InstalledPackageGetter) Get() error

Get retrieves the installed chaincode package from a peer.

type InstalledQuerier

type InstalledQuerier struct {
	Command        *cobra.Command
	Input          *InstalledQueryInput
	EndorserClient EndorserClient
	Signer         Signer
	Writer         io.Writer
}

InstalledQuerier holds the dependencies needed to query the installed chaincodes

func (*InstalledQuerier) Query

func (i *InstalledQuerier) Query() error

Query returns the chaincodes installed on a peer

type InstalledQueryInput

type InstalledQueryInput struct {
	OutputFormat string
}

type Installer

type Installer struct {
	Command        *cobra.Command
	EndorserClient EndorserClient
	Input          *InstallInput
	Reader         Reader
	Signer         Signer
}

Installer holds the dependencies needed to install a chaincode.

func (*Installer) Install

func (i *Installer) Install() error

Install installs a chaincode for use with _lifecycle.

func (*Installer) InstallChaincode

func (i *Installer) InstallChaincode(args []string) error

InstallChaincode installs the chaincode.

type PackageInput

type PackageInput struct {
	OutputFile string
	Path       string
	Type       string
	Label      string
}

PackageInput holds the input parameters for packaging a ChaincodeInstallPackage

func (*PackageInput) Validate

func (p *PackageInput) Validate() error

Validate checks for the required inputs

type PackageMetadata

type PackageMetadata struct {
	Path  string `json:"path"`
	Type  string `json:"type"`
	Label string `json:"label"`
}

PackageMetadata holds the path and type for a chaincode package

type Packager

type Packager struct {
	Command          *cobra.Command
	Input            *PackageInput
	PlatformRegistry PlatformRegistry
	Writer           Writer
}

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

func (*Packager) Package

func (p *Packager) Package() error

Package packages chaincodes into the package type, (.tar.gz) used by _lifecycle and writes it to disk

func (*Packager) PackageChaincode

func (p *Packager) PackageChaincode(args []string) error

PackageChaincode packages a chaincode.

type PeerDeliverClient

type PeerDeliverClient interface {
	Deliver(ctx context.Context, opts ...grpc.CallOption) (pb.Deliver_DeliverClient, error)
	DeliverFiltered(ctx context.Context, opts ...grpc.CallOption) (pb.Deliver_DeliverClient, error)
}

PeerDeliverClient defines the interface for a peer deliver client

type PlatformRegistry

type PlatformRegistry interface {
	GetDeploymentPayload(ccType, path string) ([]byte, error)
	NormalizePath(ccType, path string) (string, error)
}

PlatformRegistry defines the interface to get the code bytes for a chaincode given the type and path

type Reader

type Reader interface {
	ReadFile(string) ([]byte, error)
}

Reader defines the interface needed for reading a file.

type Signer

type Signer interface {
	Sign(msg []byte) ([]byte, error)
	Serialize() ([]byte, error)
}

Signer defines the interface needed for signing messages

type Writer

type Writer interface {
	WriteFile(string, string, []byte) error
}

Writer defines the interface needed for writing a file

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