utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModifiedModAdd Mod = "Add"
	ModifiedModDel Mod = "Del"

	StateNormal      ConsensusState = "STATE_NORMAL"
	StateMaintenance ConsensusState = "STATE_MAINTENANCE"

	ConsensusEtcdRaft = "etcdraft"
)

Variables

This section is empty.

Functions

func GetChannelParamsModifiedConfig

func GetChannelParamsModifiedConfig(configBytes []byte, channelOpts *ChannelOpts, sysChannel bool) []byte

func GetConsensusStateModifiedConfig

func GetConsensusStateModifiedConfig(configBytes []byte, consensus *ConsensusOpts, raftOpts *RaftOpts, sysChannel bool) []byte

func GetModifiedConfig

func GetModifiedConfig(configBytes, newOrgConfigBytes []byte, mod Mod, ordererOrg, sysChannel bool) []byte

func GetNewOrgConfigWithFielePath

func GetNewOrgConfigWithFielePath(filePath, mspID string) []byte

func GetNewestConfigWithConfigBlock

func GetNewestConfigWithConfigBlock(resMgmt *resmgmt.Client, channelName string, sysChannel bool) []byte

func GetOrgsTargetPeers

func GetOrgsTargetPeers(sdk *fabsdk.FabricSDK, orgsName []string) ([]string, error)

func GetSigningIdentities

func GetSigningIdentities(ctx context.ClientProvider, orgs []string) []msp.SigningIdentity

func GetStdConfigBytes

func GetStdConfigBytes(mspID string, configBytes []byte) []byte

func GetStdUpdateEnvelopBytes

func GetStdUpdateEnvelopBytes(channelName string, updateEnvelopBytes []byte) []byte

func GetUpdateEnvelopeProtoBytes

func GetUpdateEnvelopeProtoBytes(configBytes, modifiedConfigBytes []byte, channelName string) []byte

func SDKNew

func SDKNew(fabconfig string) *fabsdk.FabricSDK

Types

type Block

type Block struct {
	Data struct {
		Data []struct {
			Payload struct {
				Data struct {
					Config     *Config                `json:"config"`
					LastUpdate map[string]interface{} `json:"last_update"`
				} `json:"data"`
				Header map[string]interface{} `json:"header"`
			} `json:"payload"`
			Signature string `json:"signature"`
		} `json:"data"`
	} `json:"data"`
	Header   map[string]interface{} `json:"header"`
	Metadata map[string]interface{} `json:"metadata"`
}

type ChannelOpts

type ChannelOpts struct {
	BatchTimeout       string
	BatchSizeAbsolute  string
	BatchSizePreferred string
	BatchSizeMessage   int
}

type Config

type Config struct {
	ChannelGroup struct {
		Groups struct {
			Application struct {
				Groups    map[string]interface{} `json:"groups"`
				ModPolicy string                 `json:"mod_policy"`
				Policies  map[string]interface{} `json:"policies"`
				Values    map[string]interface{} `json:"values"`
				Version   string                 `json:"version"`
			} `json:"Application"`
			Orderer struct {
				Groups    map[string]interface{} `json:"groups"`
				ModPolicy string                 `json:"mod_policy"`
				Policies  map[string]interface{} `json:"policies"`
				Values    map[string]interface{} `json:"values"`
				Version   string                 `json:"version"`
			} `json:"Orderer"`
		} `json:"groups"`
		ModPolicy string                 `json:"mod_policy"`
		Policies  map[string]interface{} `json:"policies"`
		Values    map[string]interface{} `json:"values"`
		Version   string                 `json:"version"`
	} `json:"channel_group"`
	Sequence string `json:"sequence"`
}

type ConsensusOpts

type ConsensusOpts struct {
	State              string
	Type               string
	OrdererAddress     string
	KafkaBrokerAddress string
}

type ConsensusState

type ConsensusState string

func GetConsensusState

func GetConsensusState(status string) ConsensusState

type Consenters

type Consenters struct {
	Host          string `json:"host"`
	Port          int    `json:"port"`
	ClientTLSCert string `json:"client_tls_cert"`
	ServerTLSCert string `json:"server_tls_cert"`
}

type Mod

type Mod string

type RaftOpts

type RaftOpts struct {
	ElectionTick         int
	HeartbeatTick        int
	MaxInflightBlocks    int
	SnapshotIntervalSize string
	TickInterval         string
	Host                 string
	Port                 int
	ClientTLSCertPath    string
	ServerTLSCertPath    string
}

type SystemBlock

type SystemBlock struct {
	Data struct {
		Data []struct {
			Payload struct {
				Data struct {
					Config     *SystemConfig          `json:"config"`
					LastUpdate map[string]interface{} `json:"last_update"`
				} `json:"data"`
				Header map[string]interface{} `json:"header"`
			} `json:"payload"`
			Signature string `json:"signature"`
		} `json:"data"`
	} `json:"data"`
	Header   map[string]interface{} `json:"header"`
	Metadata map[string]interface{} `json:"metadata"`
}

type SystemConfig

type SystemConfig struct {
	ChannelGroup struct {
		Groups struct {
			Consortiums struct {
				Groups struct {
					SampleConsortium struct {
						Groups    map[string]interface{} `json:"groups"`
						ModPolicy string                 `json:"mod_policy"`
						Policies  map[string]interface{} `json:"policies"`
						Values    map[string]interface{} `json:"values"`
						Version   string                 `json:"version"`
					} `json:"SampleConsortium"`
				} `json:"groups"`
			} `json:"Consortiums"`
			Orderer struct {
				Groups    map[string]interface{} `json:"groups"`
				ModPolicy string                 `json:"mod_policy"`
				Policies  map[string]interface{} `json:"policies"`
				Values    map[string]interface{} `json:"values"`
				Version   string                 `json:"version"`
			} `json:"Orderer"`
		} `json:"groups"`
		ModPolicy string                 `json:"mod_policy"`
		Policies  map[string]interface{} `json:"policies"`
		Values    map[string]interface{} `json:"values"`
		Version   string                 `json:"version"`
	} `json:"channel_group"`
	Sequence string `json:"sequence"`
}

Jump to

Keyboard shortcuts

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