utilities

package
v0.0.0-...-f7d5a40 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REPLACE_ORDERER_ADDRESS = "replace"
	ADD_ORDERER_ADDRESS     = "add"
	REMOVE_ORDERER_ADDRESS  = "remove"
)

Variables

This section is empty.

Functions

func AddOrgToChannel

func AddOrgToChannel(sdk *fabsdk.FabricSDK, channelID string, addOrgEnvelopByte []byte, signIdentities []msp.SigningIdentity, ledgerClientOrg string, ordererName string) error

AddOrgToChannel submit save channel request with provided channelID, transaction envelope and required signature to orderer name

func CollectSign

func CollectSign(sdk *fabsdk.FabricSDK, requiredMember []string) ([]msp.SigningIdentity, error)

CollectSign collect SigningIdentity for provided members

func CreatChannelTxEnvelope

func CreatChannelTxEnvelope(applicationCapability string, channelId string, consortiumName string, mspIds ...string) ([]byte, error)

CreatChannelTxEnvelope is used to build channel creation envelope

func CreateNewOrgEnvelope

func CreateNewOrgEnvelope(origChannelGroup map[string]interface{}, modifiedChannelGroup map[string]interface{}, channelID string) ([]byte, error)

CreateNewOrgEnvelope used to build add new org channel update envelope

func EncodeAndReplaceNull

func EncodeAndReplaceNull(mapJson map[string]interface{}) *bytes.Buffer

func GetConfigFromChannelGroup

func GetConfigFromChannelGroup(channelGroup map[string]interface{}, mspID string) (batchTimeout string, maxMessageCount float64, preferredMaxBytes float64, anchorPeers map[string]interface{}, orderers []string)

GetConfigFromChannelGroup will get batchTimeout/batchSize/AnchorPeers from channelGroup

func GetLastConfigIndexFromBlock

func GetLastConfigIndexFromBlock(blockBytes []byte) (uint64, error)

GetLastConfigIndexFromBlock retrieves the index of the last config block as encoded in the block metadata

func GetMetadataFromBlock

func GetMetadataFromBlock(block *common.Block, index common.BlockMetadataIndex) (*common.Metadata, error)

GetMetadataFromBlock retrieves metadata at the specified index.

func PrintMSPidFromChannelGroup

func PrintMSPidFromChannelGroup(channelGroup map[string]interface{})

PrintMSPidFromChannelGroup print MSPid list in given channel group config

func QueryChannelConfigBlock

func QueryChannelConfigBlock(ledgerClient *ledger.Client) ([]byte, error)

QueryChannelConfig is used to query latest channel config block

func UpdateChannel

func UpdateChannel(sdk *fabsdk.FabricSDK, configuUpdateEnvelope []byte, updateOptions *UpdateOptions) error

func WaitUntilUpdateSucc

func WaitUntilUpdateSucc(ledgerClient *ledger.Client, updateOptions *UpdateOptions) error

Types

type Channel_header

type Channel_header struct {
	Channel_id string
	Type       string
}

type ConfigUpdate

type ConfigUpdate struct {
	Payload Payload
}

type Data

type Data struct {
	Config_update map[string]interface{}
}
type Header struct {
	Channel_header Channel_header
}

type Payload

type Payload struct {
	Header Header
	Data   Data
}

type UpdateOptions

type UpdateOptions struct {
	ChannelID              string
	LedgerClientOrg        string
	MspID                  string
	OrdererOrgUpdate       bool // The config type : Orderer_Related or Peer_related
	OrdererAddressesUpdate bool
	PeerOrgUpdate          bool
	OrdererOrgName         string
	OrdererName            string
	BatchTimeout           string
	MaxMessageCount        float64
	PreferredMaxBytes      float64
	OrdererAddressesAction string
	OrdererAddresses       []string
	AnchorPeers            []string
}

func CreateUpdateEnvelope

func CreateUpdateEnvelope(updateOptions *UpdateOptions, configBlockBytes []byte) ([]byte, *UpdateOptions, error)

CreateUpdateEnvelope is used to build channel update envelope

func UpdateChannelGroup

func UpdateChannelGroup(originalGroup map[string]interface{}, updateOptions *UpdateOptions) (map[string]interface{}, *UpdateOptions, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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