fabric-sdk-go: github.com/hyperledger/fabric-sdk-go/pkg/fab/resource Index | Files | Directories

package resource

import "github.com/hyperledger/fabric-sdk-go/pkg/fab/resource"

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

Package Files

api.go block.go config.go configtx.go configtxmsp.go cscc.go lifecycle.go lscc.go resource.go

func CreateAnchorPeersUpdate Uses

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

CreateAnchorPeersUpdate creates an anchor peers update transaction

func CreateChaincodeInstallProposal Uses

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

CreateChaincodeInstallProposal creates an install chaincode proposal.

func CreateChannel Uses

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

CreateChannel calls the orderer to start building the new channel.

func CreateChannelCreateTx Uses

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

CreateChannelCreateTx creates a Fabric transaction for creating a channel

func CreateConfigEnvelope Uses

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

CreateConfigEnvelope creates configuration envelope proto

func CreateConfigSignature Uses

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

CreateConfigSignature creates a ConfigSignature for the current context

func CreateConfigUpdateEnvelope Uses

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

CreateConfigUpdateEnvelope creates configuration update envelope proto

func CreateGenesisBlock Uses

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

CreateGenesisBlock creates a genesis block for a channel

func CreateGenesisBlockForOrderer Uses

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

CreateGenesisBlockForOrderer creates a genesis block for a channel

func ExtractChannelConfig Uses

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

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

func ExtractConfigFromBlock Uses

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

ExtractConfigFromBlock extracts channel configuration from block

func GenerateMspDir Uses

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 Uses

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 Uses

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

GetLastConfigFromBlock returns the LastConfig data from the given block

func InspectBlock Uses

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

InspectBlock inspects a block

func InspectChannelCreateTx Uses

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

InspectChannelCreateTx inspects a Fabric transaction for creating a channel

func InstallChaincode Uses

func InstallChaincode(reqCtx reqContext.Context, req InstallChaincodeRequest, targets []fab.ProposalProcessor, opts ...Opt) ([]*fab.TransactionProposalResponse, fab.TransactionID, error)

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

func JoinChannel Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

SignChannelConfig signs a configuration.

type ApproveChaincodeRequest Uses

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 Uses

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

CCPackage contains package type and bytes required to create CDS

type CCReference Uses

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 Uses

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

ChaincodeInstallRequest requests chaincode installation on the network

type ChaincodePackage Uses

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

ChaincodePackage contains package type and bytes required to create CDS

type CheckChaincodeCommitReadinessRequest Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

Lifecycle implements chaincode lifecycle operations

func NewLifecycle Uses

func NewLifecycle() *Lifecycle

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

func (*Lifecycle) CreateApproveProposal Uses

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

CreateApproveProposal creates a proposal to query approved chaincodes

func (*Lifecycle) CreateCheckCommitReadinessProposal Uses

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 Uses

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

CreateCommitProposal creates a proposal to commit a chaincode

func (*Lifecycle) CreateQueryCommittedProposal Uses

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 Uses

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 Uses

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

Install installs a chaincode package

func (*Lifecycle) MarshalApplicationPolicy Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

LifecycleInstallProposalResponse is the response from an install proposal request

type LifecycleInstalledCC Uses

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 Uses

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

LifecycleQueryApprovedCCResponse contains the response for a LifecycleQueryApprovedCC request

type LifecycleQueryInstalledCCResponse Uses

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

LifecycleQueryInstalledCCResponse contains the response for a LifecycleQueryInstalledCC request.

type Opt Uses

type Opt func(opts *options)

Opt is a resource option

func WithRetry Uses

func WithRetry(retry retry.Opts) Opt

WithRetry supplies retry options

type QueryApprovedChaincodeRequest Uses

type QueryApprovedChaincodeRequest struct {
    Name     string
    Sequence int64
}

QueryApprovedChaincodeRequest contains the parameters for an approved chaincode query

type QueryCommittedChaincodesRequest Uses

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

PathSynopsis
genesisconfig

Package resource imports 35 packages (graph) and is imported by 6 packages. Updated 2020-07-28. Refresh now. Tools for package owners.