peer

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Overview

Copyright IBM Corp. 2017 All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var ConfigTxProcessors = customtx.Processors{
	common.HeaderType_CONFIG: configTxProcessor,
}
View Source
var TransientStoreFactory = &storeProvider{stores: make(map[string]transientstore.Store)}

Functions

func CacheConfiguration

func CacheConfiguration() (err error)

CacheConfiguration computes and caches commonly-used constants and computed constants as package variables. Routines which were previously global have been embedded here to preserve the original abstraction.

func CreateChainFromBlock

CreateChainFromBlock creates a new chain from config block

func GetChannelConfig added in v1.1.1

func GetChannelConfig(cid string) channelconfig.Resources

GetChannelConfig returns the channel configuration of the chain with channel ID. Note that this call returns nil if chain cid has not been created.

func GetChannelsInfo

func GetChannelsInfo() []*pb.ChannelInfo

GetChannelsInfo returns an array with information about all channels for this peer

func GetClientCertificate added in v1.1.1

func GetClientCertificate() (tls.Certificate, error)

GetClientCertificate returns the TLS certificate to use for gRPC client connections

func GetCurrConfigBlock

func GetCurrConfigBlock(cid string) *common.Block

GetCurrConfigBlock returns the cached config block of the specified chain. Note that this call returns nil if chain cid has not been created.

func GetLedger

func GetLedger(cid string) ledger.PeerLedger

GetLedger returns the ledger of the chain with chain ID. Note that this call returns nil if chain cid has not been created.

func GetLocalAddress

func GetLocalAddress() (string, error)

GetLocalAddress returns the peer.address property

func GetLocalIP

func GetLocalIP() string

GetLocalIP returns the non loopback local IP of the host

func GetMSPIDs

func GetMSPIDs(cid string) []string

GetMSPIDs returns the ID of each application MSP defined on this chain

func GetPeerEndpoint

func GetPeerEndpoint() (*pb.PeerEndpoint, error)

GetPeerEndpoint returns peerEndpoint from cached configuration

func GetPolicyManager

func GetPolicyManager(cid string) policies.Manager

GetPolicyManager returns the policy manager of the chain with chain ID. Note that this call returns nil if chain cid has not been created.

func GetServerConfig added in v1.1.1

func GetServerConfig() (comm.ServerConfig, error)

GetServerConfig returns the gRPC server configuration for the peer

func GetStableChannelConfig added in v1.3.0

func GetStableChannelConfig(cid string) channelconfig.Resources

GetStableChannelConfig returns the stable channel configuration of the chain with channel ID. Note that this call returns nil if chain cid has not been created.

func InitChain

func InitChain(cid string)

InitChain takes care to initialize chain after peer joined, for example deploys system CCs

func Initialize

Initialize sets up any chains that the peer has from the persistence. This function should be called at the start up when the ledger and gossip ready

func MockCreateChain

func MockCreateChain(cid string) error

MockCreateChain used for creating a ledger for a chain for tests without having to join

func MockInitialize

func MockInitialize()

MockInitialize resets chains for test env

func MockSetMSPIDGetter

func MockSetMSPIDGetter(mspIDGetter func(string) []string)

func NewChannelPolicyManagerGetter

func NewChannelPolicyManagerGetter() policies.ChannelPolicyManagerGetter

NewChannelPolicyManagerGetter returns a new instance of ChannelPolicyManagerGetter

func NewConfigSupport added in v1.1.1

func NewConfigSupport() cc.Manager

NewConfigSupport returns

func NewDeliverEventsServer added in v1.1.1

func NewDeliverEventsServer(mutualTLS bool, policyCheckerProvider PolicyCheckerProvider, chainManager deliver.ChainManager) peer.DeliverServer

NewDeliverEventsServer creates a peer.Deliver server to deliver block and filtered block events

func NewPeerServer added in v1.3.0

func NewPeerServer(listenAddress string, serverConfig comm.ServerConfig) (*comm.GRPCServer, error)

NewPeerServer creates an instance of comm.GRPCServer This server is used for peer communications

func SetCurrConfigBlock

func SetCurrConfigBlock(block *common.Block, cid string) error

SetCurrConfigBlock sets the current config block of the specified channel

Types

type DeliverChainManager added in v1.3.0

type DeliverChainManager struct {
}

DeliverChainManager provides access to a channel for performing deliver

func (DeliverChainManager) GetChain added in v1.3.0

func (DeliverChainManager) GetChain(chainID string) (deliver.Chain, bool)

type Operations added in v1.3.0

type Operations interface {
	CreateChainFromBlock(cb *common.Block, ccp ccprovider.ChaincodeProvider, sccp sysccprovider.SystemChaincodeProvider) error
	GetChannelConfig(cid string) channelconfig.Resources
	GetChannelsInfo() []*pb.ChannelInfo
	GetCurrConfigBlock(cid string) *common.Block
	GetLedger(cid string) ledger.PeerLedger
	GetMSPIDs(cid string) []string
	GetPolicyManager(cid string) policies.Manager
	InitChain(cid string)
	Initialize(init func(string), ccp ccprovider.ChaincodeProvider, sccp sysccprovider.SystemChaincodeProvider, pm txvalidator.PluginMapper, pr *platforms.Registry, deployedCCInfoProvider ledger.DeployedChaincodeInfoProvider)
}

Operations exposes an interface to the package level functions that operated on singletons in the package. This is a step towards moving from package level data for the peer to instance level data.

var Default Operations = &peerImpl{
	createChainFromBlock: CreateChainFromBlock,
	getChannelConfig:     GetChannelConfig,
	getChannelsInfo:      GetChannelsInfo,
	getCurrConfigBlock:   GetCurrConfigBlock,
	getLedger:            GetLedger,
	getMSPIDs:            GetMSPIDs,
	getPolicyManager:     GetPolicyManager,
	initChain:            InitChain,
	initialize:           Initialize,
}

Default provides in implementation of the Peer interface that provides access to the package level state.

type PolicyCheckerProvider added in v1.1.1

type PolicyCheckerProvider func(resourceName string) deliver.PolicyCheckerFunc

PolicyCheckerProvider provides the corresponding policy checker for a given resource name

type Support added in v1.1.1

type Support interface {
	// GetApplicationConfig returns the configtxapplication.SharedConfig for the channel
	// and whether the Application config exists
	GetApplicationConfig(cid string) (channelconfig.Application, bool)
}

Support gives access to peer resources and avoids calls to static methods

var DefaultSupport Support = &supportImpl{operations: Default}

type SupportFactory added in v1.1.1

type SupportFactory interface {
	// NewSupport returns a Support interface
	NewSupport() Support
}

SupportFactory is a factory of Support interfaces

Jump to

Keyboard shortcuts

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