resource

package
v0.0.0-...-b42ce27 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 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 CCPackage

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

CCPackage contains package type and bytes required to create CDS

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

type Opt func(opts *options)

Opt is a resource option

func WithRetry

func WithRetry(retry retry.Opts) Opt

WithRetry supplies retry options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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