util

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultGRPCRetryConfig = &config.GRPCRetryConfig{
		Max:     10,
		Timeout: config.Duration{Duration: 10 * time.Second},
	}

	DefaultGRPCKeepAliveConfig = &config.GRPCKeepAliveConfig{
		Time:    60,
		Timeout: 5,
	}
)
View Source
var (
	ErrOrdererGroupNotFound = errors.New(`orderer addresses not found`)
)

Functions

func CreateCompositeKey

func CreateCompositeKey(objectType string, attributes []string) (string, error)

func GetConfigBlockFromOrderer

func GetConfigBlockFromOrderer(ctx context.Context, id msp.SigningIdentity, orderer api.Orderer, channelName string) (*common.Block, error)

GetConfigBlockFromOrderer returns config block from orderer by channel name

func GetEventFromEnvelope

func GetEventFromEnvelope(envelopeData []byte) (*peer.ChaincodeEvent, error)

func GetOrdererHostFromChannelConfig

func GetOrdererHostFromChannelConfig(conf *common.Config) (string, error)

func IsErrUnsupportedTxType

func IsErrUnsupportedTxType(err error) bool

func LoadKeyPairFromMSP

func LoadKeyPairFromMSP(mspPath string) ([]byte, []byte, error)

func NewChannelHeader

func NewChannelHeader(headerType common.HeaderType, txId string, channelId string, epoch uint64, extension *peer.ChaincodeHeaderExtension) ([]byte, error)

NewChannelHeader returns new channel header bytes for presented transaction and channel

func NewGRPCConnectionFromConfigs

func NewGRPCConnectionFromConfigs(ctx context.Context, log *zap.Logger, conf ...config.ConnectionConfig) (*grpc.ClientConn, error)

NewGRPCConnectionFromConfigs - initilizes grpc connection with pool of adderesses with round-robin client balancer

func NewGRPCOptionsFromConfig

func NewGRPCOptionsFromConfig(c config.ConnectionConfig, log *zap.Logger) ([]grpc.DialOption, error)

NewGRPCOptionsFromConfig - adds tracing, TLS certs and connection limits

func NewPayloadFromHeader

func NewPayloadFromHeader(channelHeader, signatureHeader, data []byte) ([]byte, error)

NewPayloadFromHeader returns marshalled payload from headers and data

func NewSignatureHeader

func NewSignatureHeader(id msp.SigningIdentity, nonce []byte) ([]byte, error)

NewChannelHeader returns marshalled signature header for presented identity

func NewTxWithNonce

func NewTxWithNonce(id msp.SigningIdentity) (string, []byte, error)

NewTxWithNonce generates new transaction id with crypto nonce

func ProceedChannelUpdate

func ProceedChannelUpdate(ctx context.Context, channelName string, update *common.ConfigUpdate, orderer api.Orderer, id msp.SigningIdentity) error

func SeekEnvelope

func SeekEnvelope(channelName string, startPos *orderer.SeekPosition, stopPos *orderer.SeekPosition, identity msp.SigningIdentity) (*common.Envelope, error)

func SplitCompositeKey

func SplitCompositeKey(compositeKey string) (string, []string)

Types

type ErrUnsupportedTxType

type ErrUnsupportedTxType struct {
	Type string
}

func (*ErrUnsupportedTxType) Error

func (e *ErrUnsupportedTxType) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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