common

package
Version: v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2018 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Copyright IBM Corp. 2016-2017 All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. 2016-2017 All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. 2016-2017 All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const UndefinedParamValue = ""

UndefinedParamValue defines what undefined parameters in the command line will initialise to

Variables

View Source
var (

	// GetEndorserClientFnc is a function that returns a new endorser client connection,
	// by default it is set to GetEndorserClient function
	GetEndorserClientFnc func() (pb.EndorserClient, error)

	// GetDefaultSignerFnc is a function that returns a default Signer(Default/PERR)
	// by default it is set to GetDefaultSigner function
	GetDefaultSignerFnc func() (msp.SigningIdentity, error)

	// GetBroadcastClientFnc returns an instance of the BroadcastClient interface
	// by default it is set to GetBroadcastClient function
	GetBroadcastClientFnc func() (BroadcastClient, error)

	// GetOrdererEndpointOfChainFnc returns orderer endpoints of given chain
	// by default it is set to GetOrdererEndpointOfChain function
	GetOrdererEndpointOfChainFnc func(chainID string, signer msp.SigningIdentity,
		endorserClient pb.EndorserClient) ([]string, error)
)
View Source
var (
	OrderingEndpoint string
)

Functions

func AddOrdererFlags added in v1.1.0

func AddOrdererFlags(cmd *cobra.Command)

AddOrdererFlags adds flags for orderer-related commands

func CheckLogLevel

func CheckLogLevel(level string) error

CheckLogLevel checks that a given log level string is valid

func GetAdminClient

func GetAdminClient() (pb.AdminClient, error)

GetAdminClient returns a new admin client. The target address for the client is taken from the configuration setting "peer.address"

func GetDefaultSigner

func GetDefaultSigner() (msp.SigningIdentity, error)

GetDefaultSigner return a default Signer(Default/PERR) for cli

func GetEndorserClient

func GetEndorserClient() (pb.EndorserClient, error)

GetEndorserClient returns a new endorser client. The target address for the client is taken from the configuration setting "peer.address"

func GetMockAdminClient

func GetMockAdminClient(err error) pb.AdminClient

func GetMockEndorserClient

func GetMockEndorserClient(response *pb.ProposalResponse, err error) pb.EndorserClient

GetMockEndorserClient return a endorser client return specified ProposalResponse and err(nil or error)

func GetOrdererEndpointOfChain

func GetOrdererEndpointOfChain(chainID string, signer msp.SigningIdentity, endorserClient pb.EndorserClient) ([]string, error)

GetOrdererEndpointOfChain returns orderer endpoints of given chain

func InitConfig

func InitConfig(cmdRoot string) error

InitConfig initializes viper config

func InitCrypto

func InitCrypto(mspMgrConfigDir, localMSPID, localMSPType string) error

InitCrypto initializes crypto for this peer

func SetBCCSPKeystorePath added in v1.1.0

func SetBCCSPKeystorePath()

SetBCCSPKeystorePath sets the file keystore path for the SW BCCSP provider to an absolute path relative to the config file

func SetLogLevelFromViper

func SetLogLevelFromViper(module string) error

SetLogLevelFromViper sets the log level for 'module' logger to the value in core.yaml

func SetOrdererEnv added in v1.1.0

func SetOrdererEnv(cmd *cobra.Command, args []string)

SetOrdererEnv adds orderer-specific settings to the global Viper environment

Types

type BroadcastClient

type BroadcastClient interface {
	//Send data to orderer
	Send(env *cb.Envelope) error
	Close() error
}

func GetBroadcastClient

func GetBroadcastClient() (BroadcastClient, error)

GetBroadcastClient creates a simple instance of the BroadcastClient interface

func GetMockBroadcastClient

func GetMockBroadcastClient(err error) BroadcastClient

type OrdererClient added in v1.1.0

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

OrdererClient represents a client for communicating with an ordering service

func NewOrdererClientFromEnv added in v1.1.0

func NewOrdererClientFromEnv() (*OrdererClient, error)

NewOrdererClientFromEnv creates an instance of an OrdererClient from the global Viper instance

func (*OrdererClient) Broadcast added in v1.1.0

Broadcast returns a broadcast client for the AtomicBroadcast service

func (*OrdererClient) Certificate added in v1.1.0

func (oc *OrdererClient) Certificate() tls.Certificate

Certificate returns the TLS client certificate (if available)

func (*OrdererClient) Deliver added in v1.1.0

Deliver returns a deliver client for the AtomicBroadcast service

type PeerClient added in v1.1.0

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

PeerClient represents a client for communicating with a peer

func NewPeerClientFromEnv added in v1.1.0

func NewPeerClientFromEnv() (*PeerClient, error)

NewPeerClientFromEnv creates an instance of a PeerClient from the global Viper instance

func (*PeerClient) Admin added in v1.1.0

func (pc *PeerClient) Admin() (pb.AdminClient, error)

Admin returns a client for the Admin service

func (*PeerClient) Endorser added in v1.1.0

func (pc *PeerClient) Endorser() (pb.EndorserClient, error)

Endorser returns a client for the Endorser service

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL