resource

package
v1.0.0-beta5 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package resource provides access to fabric network resource management, typically using system channel queries.

Package resource provides access to fabric network resource management, typically using system channel queries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAnchorPeersUpdate

func CreateAnchorPeersUpdate(conf *genesisconfig.Profile, channelID string, asOrg string) (*common.Envelope, error)

CreateAnchorPeersUpdate creates an anchor peers update transaction

func CreateChaincodeInstallProposal

func CreateChaincodeInstallProposal(txh fab.TransactionHeader, request ChaincodeInstallRequest) (*fab.TransactionProposal, error)

CreateChaincodeInstallProposal creates an install chaincode proposal.

func CreateChannel

func CreateChannel(reqCtx reqContext.Context, request CreateChannelRequest, opts ...Opt) (fab.TransactionID, error)

CreateChannel calls the orderer to start building the new channel.

func CreateChannelCreateTx

func CreateChannelCreateTx(conf, baseProfile *genesisconfig.Profile, channelID string) ([]byte, error)

CreateChannelCreateTx creates a Fabric transaction for creating a channel

func CreateConfigEnvelope

func CreateConfigEnvelope(data []byte) (*common.ConfigEnvelope, error)

CreateConfigEnvelope creates configuration envelope proto

func CreateConfigSignature

func CreateConfigSignature(ctx context.Client, config []byte) (*common.ConfigSignature, error)

CreateConfigSignature creates a ConfigSignature for the current context

func CreateConfigUpdateEnvelope

func CreateConfigUpdateEnvelope(data []byte) (*common.ConfigUpdateEnvelope, error)

CreateConfigUpdateEnvelope creates configuration update envelope proto

func CreateGenesisBlock

func CreateGenesisBlock(config *genesisconfig.Profile, channelID string) ([]byte, error)

CreateGenesisBlock creates a genesis block for a channel

func CreateGenesisBlockForOrderer

func CreateGenesisBlockForOrderer(config *genesisconfig.Profile, channelID string) ([]byte, error)

CreateGenesisBlockForOrderer creates a genesis block for a channel

func ExtractChannelConfig

func ExtractChannelConfig(configEnvelope []byte) ([]byte, error)

ExtractChannelConfig extracts the protobuf 'ConfigUpdate' object out of the 'ConfigEnvelope'.

func ExtractConfigFromBlock

func ExtractConfigFromBlock(block *common.Block) (*common.Config, error)

ExtractConfigFromBlock extracts channel configuration from block

func GenerateMspDir

func GenerateMspDir(mspDir string, config *msp.MSPConfig) error

GenerateMspDir generates a MSP directory, using values from the provided MSP config. The intended usage is within the scope of creating a genesis block. This means private keys are currently not handled.

func GenesisBlockFromOrderer

func GenesisBlockFromOrderer(reqCtx reqContext.Context, channelName string, orderer fab.Orderer, opts ...Opt) (*common.Block, error)

GenesisBlockFromOrderer returns the genesis block from the defined orderer that may be used in a join request

func GetLastConfigFromBlock

func GetLastConfigFromBlock(block *common.Block) (*common.LastConfig, error)

GetLastConfigFromBlock returns the LastConfig data from the given block

func InspectBlock

func InspectBlock(data []byte) (string, error)

InspectBlock inspects a block

func InspectChannelCreateTx

func InspectChannelCreateTx(data []byte) (string, error)

InspectChannelCreateTx inspects a Fabric transaction for creating a channel

func InstallChaincode

InstallChaincode sends an install proposal to one or more endorsing peers.

func JoinChannel

func JoinChannel(reqCtx reqContext.Context, request JoinChannelRequest, targets []fab.ProposalProcessor, opts ...Opt) error

JoinChannel sends a join channel proposal to the target peer.

TODO extract targets from request into parameter.

func LastConfigFromOrderer

func LastConfigFromOrderer(reqCtx reqContext.Context, channelName string, orderer fab.Orderer, opts ...Opt) (*common.Block, error)

LastConfigFromOrderer fetches the current configuration block for the specified channel from the given orderer

func QueryChannels

func QueryChannels(reqCtx reqContext.Context, peer fab.ProposalProcessor, opts ...Opt) (*pb.ChannelQueryResponse, error)

QueryChannels queries the names of all the channels that a peer has joined.

func QueryInstalledChaincodes

func QueryInstalledChaincodes(reqCtx reqContext.Context, peer fab.ProposalProcessor, opts ...Opt) (*pb.ChaincodeQueryResponse, error)

QueryInstalledChaincodes queries the installed chaincodes on a peer. Returns the details of all chaincodes installed on a peer.

func SignChannelConfig

func SignChannelConfig(ctx context.Client, config []byte, signer msp.SigningIdentity) (*common.ConfigSignature, error)

SignChannelConfig signs a configuration.

Types

type ApproveChaincodeRequest

type ApproveChaincodeRequest struct {
	Name                string
	Version             string
	PackageID           string
	Sequence            int64
	EndorsementPlugin   string
	ValidationPlugin    string
	SignaturePolicy     *common.SignaturePolicyEnvelope
	ChannelConfigPolicy string
	CollectionConfig    []*pb.CollectionConfig
	InitRequired        bool
}

ApproveChaincodeRequest contains the parameters required to approve a chaincode

type CCPackage

type CCPackage struct {
	Type pb.ChaincodeSpec_Type
	Code []byte
}

CCPackage contains package type and bytes required to create CDS

type CCReference

type CCReference struct {
	Name    string
	Version string
}

CCReference contains the name and version of an instantiated chaincode that references the installed chaincode package.

type ChaincodeInstallRequest

type ChaincodeInstallRequest struct {
	Name    string
	Path    string
	Version string
	Package *ChaincodePackage
}

ChaincodeInstallRequest requests chaincode installation on the network

type ChaincodePackage

type ChaincodePackage struct {
	Type pb.ChaincodeSpec_Type
	Code []byte
}

ChaincodePackage contains package type and bytes required to create CDS

type CheckChaincodeCommitReadinessRequest

type CheckChaincodeCommitReadinessRequest struct {
	Name                string
	Version             string
	PackageID           string
	Sequence            int64
	EndorsementPlugin   string
	ValidationPlugin    string
	SignaturePolicy     *common.SignaturePolicyEnvelope
	ChannelConfigPolicy string
	CollectionConfig    []*pb.CollectionConfig
	InitRequired        bool
}

CheckChaincodeCommitReadinessRequest contains the parameters for checking the 'commit readiness' of a chaincode

type CommitChaincodeRequest

type CommitChaincodeRequest struct {
	Name                string
	Version             string
	Sequence            int64
	EndorsementPlugin   string
	ValidationPlugin    string
	SignaturePolicy     *common.SignaturePolicyEnvelope
	ChannelConfigPolicy string
	CollectionConfig    []*pb.CollectionConfig
	InitRequired        bool
}

CommitChaincodeRequest contains the parameters for a commit chaincode request

type ConfigSignatureData

type ConfigSignatureData struct {
	SignatureHeader      common.SignatureHeader
	SignatureHeaderBytes []byte
	SigningBytes         []byte
}

ConfigSignatureData holds data ready to be signed (SigningBytes) + Signature Header

When building the common.ConfigSignature instance with the signed SigningBytes from the external tool,
assign the returned ConfigSignatureData.SignatureHeader as part of the new ConfigSignature instance.

func GetConfigSignatureData

func GetConfigSignatureData(creator identitySerializer, config []byte) (signatureHeaderData ConfigSignatureData, e error)

GetConfigSignatureData will prepare a ConfigSignatureData comprising: SignatureHeader, its marshaled []byte and the full signing []byte to be used for signing (by an external tool) a Channel Config

type CreateChannelRequest

type CreateChannelRequest struct {
	// required - The name of the new channel
	Name string
	// required - The Orderer to send the update request
	Orderer fab.Orderer
	// optional - the envelope object containing all
	// required settings and signatures to initialize this channel.
	// This envelope would have been created by the command
	// line tool "configtx"
	Envelope []byte
	// optional - ConfigUpdate object built by the
	// buildChannelConfig() method of this package
	Config []byte
	// optional - the list of collected signatures
	// required by the channel create policy when using the `apiconfig` parameter.
	// see signChannelConfig() method of this package
	Signatures []*common.ConfigSignature
}

CreateChannelRequest requests channel creation on the network

type InstallChaincodeRequest

type InstallChaincodeRequest struct {
	// required - name of the chaincode
	Name string
	// required - path to the location of chaincode sources (path from GOPATH/src folder)
	Path string
	// chaincodeVersion: required - version of the chaincode
	Version string
	// required - package (chaincode package type and bytes)
	Package *CCPackage
}

InstallChaincodeRequest requests chaincode installation on the network

type JoinChannelRequest

type JoinChannelRequest struct {
	// The name of the channel to be joined.
	Name         string
	GenesisBlock *common.Block
}

JoinChannelRequest allows a set of peers to transact on a channel on the network

type Lifecycle

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

Lifecycle implements chaincode lifecycle operations

func NewLifecycle

func NewLifecycle() *Lifecycle

NewLifecycle returns a Lifecycle resource implementation that handles all chaincode lifecycle functions

func (*Lifecycle) CreateApproveProposal

func (lc *Lifecycle) CreateApproveProposal(txh fab.TransactionHeader, req *ApproveChaincodeRequest) (*fab.TransactionProposal, error)

CreateApproveProposal creates a proposal to query approved chaincodes

func (*Lifecycle) CreateCheckCommitReadinessProposal

func (lc *Lifecycle) CreateCheckCommitReadinessProposal(txh fab.TransactionHeader, req *CheckChaincodeCommitReadinessRequest) (*fab.TransactionProposal, error)

CreateCheckCommitReadinessProposal creates a propoposal to check 'commit readiness' of a chaincode

func (*Lifecycle) CreateCommitProposal

func (lc *Lifecycle) CreateCommitProposal(txh fab.TransactionHeader, req *CommitChaincodeRequest) (*fab.TransactionProposal, error)

CreateCommitProposal creates a proposal to commit a chaincode

func (*Lifecycle) CreateQueryCommittedProposal

func (lc *Lifecycle) CreateQueryCommittedProposal(txh fab.TransactionHeader, req *QueryCommittedChaincodesRequest) (*fab.TransactionProposal, error)

CreateQueryCommittedProposal creates a propoposal to query for committed chaincodes. If the chaincode name is provided in the request then the proposal will contain a query for a single chaincode, otherwise all committed chaincodes on the chainnel will be queried.

func (*Lifecycle) GetInstalledPackage

func (lc *Lifecycle) GetInstalledPackage(reqCtx reqContext.Context, packageID string, target fab.ProposalProcessor, opts ...Opt) ([]byte, error)

GetInstalledPackage returns the installed chaincode package for the given package ID

func (*Lifecycle) Install

func (lc *Lifecycle) Install(reqCtx reqContext.Context, installPkg []byte, targets []fab.ProposalProcessor, opts ...Opt) ([]*LifecycleInstallProposalResponse, error)

Install installs a chaincode package

func (*Lifecycle) MarshalApplicationPolicy

func (lc *Lifecycle) MarshalApplicationPolicy(signaturePolicy *common.SignaturePolicyEnvelope, channelConfigPolicy string) ([]byte, error)

MarshalApplicationPolicy marshals the given signature or channel config policy into an ApplicationPolicy payload

func (*Lifecycle) QueryApproved

func (lc *Lifecycle) QueryApproved(reqCtx reqContext.Context, channelID string, req *QueryApprovedChaincodeRequest, target fab.ProposalProcessor, opts ...Opt) (*LifecycleQueryApprovedCCResponse, error)

QueryApproved returns information about the approved chaincode

func (*Lifecycle) QueryInstalled

func (lc *Lifecycle) QueryInstalled(reqCtx reqContext.Context, target fab.ProposalProcessor, opts ...Opt) (*LifecycleQueryInstalledCCResponse, error)

QueryInstalled returns information about the installed chaincodes on a given peer.

func (*Lifecycle) UnmarshalApplicationPolicy

func (lc *Lifecycle) UnmarshalApplicationPolicy(policyBytes []byte) (*common.SignaturePolicyEnvelope, string, error)

UnmarshalApplicationPolicy unmarshals the policy baytes and returns either a signature policy or a channel config policy.

type LifecycleApprovedCC

type LifecycleApprovedCC struct {
	Name                string
	Version             string
	Sequence            int64
	EndorsementPlugin   string
	ValidationPlugin    string
	SignaturePolicy     *common.SignaturePolicyEnvelope
	ChannelConfigPolicy string
	CollectionConfig    []*pb.CollectionConfig
	InitRequired        bool
	PackageID           string
}

LifecycleApprovedCC contains information about an approved chaincode

type LifecycleInstallProposalResponse

type LifecycleInstallProposalResponse struct {
	*fab.TransactionProposalResponse
	*lb.InstallChaincodeResult
}

LifecycleInstallProposalResponse is the response from an install proposal request

type LifecycleInstalledCC

type LifecycleInstalledCC struct {
	PackageID  string
	Label      string
	References map[string][]CCReference
}

LifecycleInstalledCC contains the package ID and label of the installed chaincode, including a map of channel name to chaincode name and version pairs of chaincode definitions that reference this chaincode package.

type LifecycleQueryApprovedCCResponse

type LifecycleQueryApprovedCCResponse struct {
	*fab.TransactionProposalResponse
	ApprovedChaincode *LifecycleApprovedCC
}

LifecycleQueryApprovedCCResponse contains the response for a LifecycleQueryApprovedCC request

type LifecycleQueryInstalledCCResponse

type LifecycleQueryInstalledCCResponse struct {
	*fab.TransactionProposalResponse
	InstalledChaincodes []LifecycleInstalledCC
}

LifecycleQueryInstalledCCResponse contains the response for a LifecycleQueryInstalledCC request.

type Opt

type Opt func(opts *options)

Opt is a resource option

func WithRetry

func WithRetry(retry retry.Opts) Opt

WithRetry supplies retry options

type QueryApprovedChaincodeRequest

type QueryApprovedChaincodeRequest struct {
	Name     string
	Sequence int64
}

QueryApprovedChaincodeRequest contains the parameters for an approved chaincode query

type QueryCommittedChaincodesRequest

type QueryCommittedChaincodesRequest struct {
	Name string
}

QueryCommittedChaincodesRequest contains the parameters to query committed chaincodes. If name is not provided then all committed chaincodes on the given channel are returned, otherwise only the chaincode with the given name is returned.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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