...

Package peer

import "github.com/hyperledger/fabric/core/peer"
Overview
Index
Subdirectories

Overview ▾

Index ▾

Variables
func CacheConfiguration() (err error)
func CreateChainFromBlock(cb *common.Block, ccp ccprovider.ChaincodeProvider, sccp sysccprovider.SystemChaincodeProvider) error
func GetChannelConfig(cid string) channelconfig.Resources
func GetChannelsInfo() []*pb.ChannelInfo
func GetClientCertificate() (tls.Certificate, error)
func GetCurrConfigBlock(cid string) *common.Block
func GetLedger(cid string) ledger.PeerLedger
func GetLocalAddress() (string, error)
func GetLocalIP() string
func GetMSPIDs(cid string) []string
func GetOrdererAddressOverrides() (map[string]*comm.OrdererEndpoint, error)
func GetPeerEndpoint() (*pb.PeerEndpoint, error)
func GetPolicyManager(cid string) policies.Manager
func GetServerConfig() (comm.ServerConfig, error)
func GetServerRootCAs() ([][]byte, error)
func GetStableChannelConfig(cid string) channelconfig.Resources
func InitChain(cid string)
func Initialize(init func(string), ccp ccprovider.ChaincodeProvider, sccp sysccprovider.SystemChaincodeProvider, pm txvalidator.PluginMapper, pr *platforms.Registry, deployedCCInfoProvider ledger.DeployedChaincodeInfoProvider, membershipProvider ledger.MembershipInfoProvider, metricsProvider metrics.Provider)
func MockCreateChain(cid string) error
func MockInitialize()
func MockSetMSPIDGetter(mspIDGetter func(string) []string)
func NewChannelPolicyManagerGetter() policies.ChannelPolicyManagerGetter
func NewConfigSupport() cc.Manager
func NewDeliverEventsServer(mutualTLS bool, policyCheckerProvider PolicyCheckerProvider, chainManager deliver.ChainManager, metricsProvider metrics.Provider) peer.DeliverServer
func NewPeerServer(listenAddress string, serverConfig comm.ServerConfig) (*comm.GRPCServer, error)
func SetCurrConfigBlock(block *common.Block, cid string) error
type CollectionSupport
    func (*CollectionSupport) GetIdentityDeserializer(chainID string) msp.IdentityDeserializer
    func (cs *CollectionSupport) GetQueryExecutorForLedger(cid string) (ledger.QueryExecutor, error)
type DeliverChainManager
    func (DeliverChainManager) GetChain(chainID string) deliver.Chain
type Operations
type OrdererEndpoint
type OrdererOrg
type PolicyCheckerProvider
type Support
type SupportFactory

Package files

config.go configtx_processor.go configtx_util.go deliverevents.go mock_helpers.go peer.go peer_impl.go support.go

Variables

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

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

func CreateChainFromBlock(cb *common.Block, ccp ccprovider.ChaincodeProvider, sccp sysccprovider.SystemChaincodeProvider) error

CreateChainFromBlock creates a new chain from config block

func GetChannelConfig

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

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 GetOrdererAddressOverrides

func GetOrdererAddressOverrides() (map[string]*comm.OrdererEndpoint, error)

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

func GetServerConfig() (comm.ServerConfig, error)

GetServerConfig returns the gRPC server configuration for the peer

func GetServerRootCAs

func GetServerRootCAs() ([][]byte, error)

GetServerRootCAs returns the root certificates which will be trusted for gRPC client connections to peers and orderers.

func GetStableChannelConfig

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

func Initialize(init func(string), ccp ccprovider.ChaincodeProvider, sccp sysccprovider.SystemChaincodeProvider,
    pm txvalidator.PluginMapper, pr *platforms.Registry, deployedCCInfoProvider ledger.DeployedChaincodeInfoProvider,
    membershipProvider ledger.MembershipInfoProvider, metricsProvider metrics.Provider)

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

func NewConfigSupport() cc.Manager

NewConfigSupport returns

func NewDeliverEventsServer

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

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

func NewPeerServer

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

type CollectionSupport

TODO: Remove CollectionSupport and respective methonds on them. CollectionSupport is created per chain and is passed to the simple collection store and the gossip. As it is created per chain, there is no need to pass the channelID for both GetQueryExecutorForLedger() and GetIdentityDeserializer(). Note that the cid passed to GetQueryExecutorForLedger is never used. Instead, we can directly pass the ledger.PeerLedger and msp.IdentityDeserializer to the simpleCollectionStore and pass only the msp.IdentityDeserializer to the gossip in createChain() -- FAB-13037

type CollectionSupport struct {
    ledger.PeerLedger
}

func (*CollectionSupport) GetIdentityDeserializer

func (*CollectionSupport) GetIdentityDeserializer(chainID string) msp.IdentityDeserializer

func (*CollectionSupport) GetQueryExecutorForLedger

func (cs *CollectionSupport) GetQueryExecutorForLedger(cid string) (ledger.QueryExecutor, error)

type DeliverChainManager

DeliverChainManager provides access to a channel for performing deliver

type DeliverChainManager struct {
}

func (DeliverChainManager) GetChain

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

type Operations

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.

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, membershipProvider ledger.MembershipInfoProvider, metricsProvider metrics.Provider)
}

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

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

type OrdererEndpoint

type OrdererEndpoint struct {
    Address string
    PEMs    []byte
}

type OrdererOrg

OrdererOrg stores the per org orderer config.

type OrdererOrg interface {
    channelconfig.Org

    // Endpoints returns the endpoints of orderer nodes.
    Endpoints() []string
}

type PolicyCheckerProvider

PolicyCheckerProvider provides the corresponding policy checker for a given resource name

type PolicyCheckerProvider func(resourceName string) deliver.PolicyCheckerFunc

type Support

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

type Support interface {
    // GetApplicationConfig returns the configtxapplication.SharedConfig for the channel
    // and whether the Application config exists
    GetApplicationConfig(cid string) (channelconfig.Application, bool)
}
var DefaultSupport Support = &supportImpl{operations: Default}

type SupportFactory

SupportFactory is a factory of Support interfaces

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

Subdirectories

Name Synopsis
..
mocks