chaincode

package
v2.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApproveForMyOrgCmd

func ApproveForMyOrgCmd(a *ApproverForMyOrg) *cobra.Command

ApproveForMyOrgCmd returns the cobra command for chaincode ApproveForMyOrg

func Cmd

func Cmd() *cobra.Command

Cmd returns the cobra command for Chaincode

func CommitCmd

func CommitCmd(c *Committer) *cobra.Command

CommitCmd returns the cobra command for chaincode Commit

func InstallCmd

func InstallCmd(i *Installer) *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 QueryCommittedCmd

func QueryCommittedCmd(c *CommittedQuerier) *cobra.Command

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

func QueryInstalledCmd

func QueryInstalledCmd(i *InstalledQuerier) *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 ApprovalStatusOutput

type ApprovalStatusOutput struct {
	Approved map[string]bool `json:"Approved"`
}

type ApproveForMyOrgInput

type ApproveForMyOrgInput struct {
	ChannelID                string
	Name                     string
	Version                  string
	PackageID                string
	Sequence                 int64
	EndorsementPlugin        string
	ValidationPlugin         string
	ValidationParameterBytes []byte
	CollectionConfigPackage  *cb.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 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 ClientConnections

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

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

func NewClientConnections

func NewClientConnections(input *ClientConnectionsInput) (*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  *cb.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 CommittedQuerier

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

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
}

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 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 InstalledQuerier

type InstalledQuerier struct {
	Command        *cobra.Command
	EndorserClient EndorserClient
	Signer         Signer
}

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 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)
}

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

type QueryApprovalStatus

type QueryApprovalStatus struct {
	Command        *cobra.Command
	EndorserClient pb.EndorserClient
	Input          *QueryApprovalStatusInput
	Signer         identity.SignerSerializer
}

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

func (*QueryApprovalStatus) Approve

func (a *QueryApprovalStatus) Approve() error

type QueryApprovalStatusInput

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

QueryApprovalStatusInput 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 (*QueryApprovalStatusInput) Validate

func (a *QueryApprovalStatusInput) Validate() error

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, []byte, os.FileMode) 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