peer

package
v2.0.0-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigBlockFromLedger

func ConfigBlockFromLedger(ledger ledger.PeerLedger) (*common.Block, error)

func CreateMockChannel

func CreateMockChannel(p *Peer, cid string, resources channelconfig.Resources) error

func GetClientCertificate

func GetClientCertificate() (tls.Certificate, error)

GetClientCertificate returns the TLS certificate to use for gRPC client connections

func GetServerConfig

func GetServerConfig() (comm.ServerConfig, error)

GetServerConfig returns the gRPC server configuration for the peer

func NewConfigSupport

func NewConfigSupport(peer *Peer) cc.Manager

NewConfigSupport returns

Types

type Chain

type Chain interface {
	deliver.Chain
	Ledger() ledger.PeerLedger
}

Chain adds Ledger() to deliver.Chain

type Channel

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

Channel manages objects and configuration associated with a Channel.

func (*Channel) Apply

func (c *Channel) Apply(configtx *common.ConfigEnvelope) error

Apply is used to validate and apply configuration transactions for a channel.

func (*Channel) Capabilities

func (c *Channel) Capabilities() channelconfig.ApplicationCapabilities

Capabilities gets the application capabilities for the current channel configuration.

func (*Channel) Errored

func (c *Channel) Errored() <-chan struct{}

Errored returns a channel that can be used to determine if a backing resource has errored. At this point in time, the peer does not have any error conditions that lead to this function signaling that an error has occurred.

func (*Channel) GetMSPIDs

func (c *Channel) GetMSPIDs() []string

GetMSPIDs retrieves the MSP IDs of the organziations in the current channel configuration.

func (*Channel) Ledger

func (c *Channel) Ledger() ledger.PeerLedger

Ledger returns the ledger associated with this channel.

func (*Channel) MSPManager

func (c *Channel) MSPManager() msp.MSPManager

MSPManager returns the msp.MSPManager that reflects the current channel configuration. Users should not memoize references to this object.

func (*Channel) PolicyManager

func (c *Channel) PolicyManager() policies.Manager

PolicyManager returns the policies.Manager for the channel that reflects the current channel configuration. Users should not memoize references to this object.

func (*Channel) Reader

func (c *Channel) Reader() blockledger.Reader

Reader returns a blockledger.Reader backed by the ledger associated with this channel.

func (*Channel) Resources

func (c *Channel) Resources() channelconfig.Resources

Resources returns the active channel configuration bundle.

func (*Channel) Sequence

func (c *Channel) Sequence() uint64

Sequence returns the current config sequence number of the channel.

func (*Channel) Store

func (c *Channel) Store() *transientstore.Store

Store returns the transient store associated with this channel.

type CollectionInfoShim

type CollectionInfoShim struct {
	plugindispatcher.CollectionAndLifecycleResources
	ChannelID string
}

func (*CollectionInfoShim) CollectionValidationInfo

func (cis *CollectionInfoShim) CollectionValidationInfo(chaincodeName, collectionName string, validationState validation.State) ([]byte, error, error)

type CollectionPolicyChecker

type CollectionPolicyChecker interface {
	CheckCollectionPolicy(blockNum uint64, ccName string, collName string, cfgHistoryRetriever ledger.ConfigHistoryRetriever, deserializer msp.IdentityDeserializer, signedData *protoutil.SignedData) (bool, error)
}

CollectionPolicyChecker is an interface that encapsulates the CheckCollectionPolicy method

type Config

type Config struct {
	// LocalMSPID is the identifier of the local MSP.
	LocalMSPID string
	// ListenAddress is the local address the peer will listen on. It must be
	// formatted as [host | ipaddr]:port.
	ListenAddress string
	// PeerID provides a name for this peer instance. It is used when naming
	// docker resources to segregate fabric networks and peers.
	PeerID string
	// PeerAddress is the address other peers and clients should use to
	// communicate with the peer. It must be formatted as [host | ipaddr]:port.
	// When used by the CLI, it represents the target peer endpoint.
	PeerAddress string
	// NetworkID specifies a name to use for logical separation of networks. It
	// is used when naming docker resources to segregate fabric networks and
	// peers.
	NetworkID string
	// ChaincodeListenAddress is the endpoint on which this peer will listen for
	// chaincode connections. If omitted, it defaults to the host portion of
	// PeerAddress and port 7052.
	ChaincodeListenAddress string
	// ChaincodeAddress specifies the endpoint chaincode launched by the peer
	// should use to connect to the peer. If omitted, it defaults to
	// ChaincodeListenAddress and falls back to ListenAddress.
	ChaincodeAddress string
	// ValidatorPoolSize indicates the number of goroutines that will execute
	// transaction validation in parallel. If omitted, it defaults to number of
	// hardware threads on the machine.
	ValidatorPoolSize int

	// ----- Peer Delivery Client Keepalive -----
	// DeliveryClient Keepalive settings for communication with ordering nodes.
	DeliverClientKeepaliveOptions comm.KeepaliveOptions

	// ProfileEnabled determines if the go pprof endpoint is enabled in the peer.
	ProfileEnabled bool
	// ProfileListenAddress is the address the pprof server should accept
	// connections on.
	ProfileListenAddress string

	// DiscoveryEnabled is used to enable the discovery service.
	DiscoveryEnabled bool
	// DiscoveryOrgMembersAllowed allows non-admins to perform non channel-scoped queries.
	DiscoveryOrgMembersAllowed bool
	// DiscoveryAuthCacheEnabled is used to enable the authentication cache.
	DiscoveryAuthCacheEnabled bool
	// DiscoveryAuthCacheMaxSize sets the maximum size of authentication cache.
	DiscoveryAuthCacheMaxSize int
	// DiscoveryAuthCachePurgeRetentionRatio set the proportion of entries remains in cache
	// after overpopulation purge.
	DiscoveryAuthCachePurgeRetentionRatio float64

	// LimitsConcurrencyQSCC sets the limits for number of concurrently running
	// qscc system chaincode requests.
	LimitsConcurrencyQSCC int

	// PeerTLSEnabled enables/disables Peer TLS.
	PeerTLSEnabled bool

	// AuthenticationTimeWindow sets the acceptable time duration for current
	// server time and client's time as specified in a client request message.
	AuthenticationTimeWindow time.Duration

	// Endpoint of the vm management system. For docker can be one of the following in general
	// unix:///var/run/docker.sock
	// http://localhost:2375
	// https://localhost:2376
	VMEndpoint string

	// VMDockerTLSEnabled enables/disables TLS for dockers.
	VMDockerTLSEnabled   bool
	VMDockerAttachStdout bool
	// VMNetworkMode sets the networking mode for the container.
	VMNetworkMode string

	// ChaincodePull enables/disables force pulling of the base docker image.
	ChaincodePull bool
	// ExternalBuilders represents the builders and launchers for
	// chaincode. The external builder detection processing will iterate over the
	// builders in the order specified below.
	ExternalBuilders []ExternalBuilder

	// OperationsListenAddress provides the host and port for the operations server
	OperationsListenAddress string
	// OperationsTLSEnabled enables/disables TLS for operations.
	OperationsTLSEnabled bool
	// OperationsTLSCertFile provides the path to PEM encoded server certificate for
	// the operations server.
	OperationsTLSCertFile string
	// OperationsTLSKeyFile provides the path to PEM encoded server key for the
	// operations server.
	OperationsTLSKeyFile string
	// OperationsTLSClientAuthRequired enables/disables the requirements for client
	// certificate authentication at the TLS layer to access all resource.
	OperationsTLSClientAuthRequired bool
	// OperationsTLSClientRootCAs provides the path to PEM encoded ca certiricates to
	// trust for client authentication.
	OperationsTLSClientRootCAs []string

	// MetricsProvider provides the categories of metrics providers, which is one of
	// statsd, prometheus, or disabled.
	MetricsProvider string
	// StatsdNetwork indicate the network type used by statsd metrics. (tcp or udp).
	StatsdNetwork string
	// StatsdAaddress provides the address for statsd server.
	StatsdAaddress string
	// StatsdWriteInterval set the time interval at which locally cached counters and
	// gauges are pushed.
	StatsdWriteInterval time.Duration
	// StatsdPrefix provides the prefix that prepended to all emitted statsd metrics.
	StatsdPrefix string

	// DockerCert is the path to the PEM encoded TLS client certificate required to access
	// the docker daemon.
	DockerCert string
	// DockerKey is the path to the PEM encoded key required to access the docker daemon.
	DockerKey string
	// DockerCA is the path to the PEM encoded CA certificate for the docker daemon.
	DockerCA string
}

Config is the struct that defines the Peer configurations.

func GlobalConfig

func GlobalConfig() (*Config, error)

GlobalConfig obtains a set of configuration from viper, build and returns the config struct.

type ConfigTxProcessor

type ConfigTxProcessor struct{}

ConfigTxProcessor implements the interface 'github.com/hyperledger/fabric/core/ledger/customtx/Processor'

func (*ConfigTxProcessor) GenerateSimulationResults

func (tp *ConfigTxProcessor) GenerateSimulationResults(txEnv *common.Envelope, simulator ledger.TxSimulator, initializingLedger bool) error

GenerateSimulationResults implements function in the interface 'github.com/hyperledger/fabric/core/ledger/customtx/Processor' This implementation processes CONFIG transactions which simply stores the config-envelope-bytes

type DeliverChainManager

type DeliverChainManager struct {
	Peer *Peer
}

DeliverChainManager provides access to a channel for performing deliver

func (DeliverChainManager) GetChain

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

type DeliverServer

type DeliverServer struct {
	DeliverHandler          *deliver.Handler
	PolicyCheckerProvider   PolicyCheckerProvider
	CollectionPolicyChecker CollectionPolicyChecker
	IdentityDeserializerMgr IdentityDeserializerManager
}

DeliverServer holds the dependencies necessary to create a deliver server

func (*DeliverServer) Deliver

func (s *DeliverServer) Deliver(srv peer.Deliver_DeliverServer) (err error)

Deliver sends a stream of blocks to a client after commitment

func (*DeliverServer) DeliverFiltered

func (s *DeliverServer) DeliverFiltered(srv peer.Deliver_DeliverFilteredServer) error

DeliverFiltered sends a stream of blocks to a client after commitment

func (*DeliverServer) DeliverWithPrivateData

func (s *DeliverServer) DeliverWithPrivateData(srv peer.Deliver_DeliverWithPrivateDataServer) (err error)

DeliverWithPrivateData sends a stream of blocks and pvtdata to a client after commitment

type ExternalBuilder

type ExternalBuilder struct {
	EnvironmentWhitelist []string `yaml:"environmentWhitelist"`
	Name                 string   `yaml:"name"`
	Path                 string   `yaml:"path"`
}

ExternalBuilder represents the configuration structure of a chaincode external builder

type IdentityDeserializerManager

type IdentityDeserializerManager interface {
	// Deserializer returns an instance of transaction.Deserializer for the passed channel
	// if the channel exists
	Deserializer(channel string) (msp.IdentityDeserializer, error)
}

IdentityDeserializerManager returns instances of Deserializer

type Peer

type Peer struct {
	Server                   *comm.GRPCServer
	ServerConfig             comm.ServerConfig
	CredentialSupport        *comm.CredentialSupport
	StoreProvider            transientstore.StoreProvider
	GossipService            *gossipservice.GossipService
	LedgerMgr                *ledgermgmt.LedgerMgr
	OrdererEndpointOverrides map[string]*orderers.Endpoint
	CryptoProvider           bccsp.BCCSP
	// contains filtered or unexported fields
}

A Peer holds references to subsystems and channels associated with a Fabric peer.

func (*Peer) Channel

func (p *Peer) Channel(cid string) *Channel

func (*Peer) CreateChannel

func (p *Peer) CreateChannel(
	cid string,
	cb *common.Block,
	deployedCCInfoProvider ledger.DeployedChaincodeInfoProvider,
	legacyLifecycleValidation plugindispatcher.LifecycleResources,
	newLifecycleValidation plugindispatcher.CollectionAndLifecycleResources,
) error

func (*Peer) GetApplicationConfig

func (p *Peer) GetApplicationConfig(cid string) (channelconfig.Application, bool)

func (*Peer) GetChannelConfig

func (p *Peer) GetChannelConfig(cid string) channelconfig.Resources

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

func (*Peer) GetChannelsInfo

func (p *Peer) GetChannelsInfo() []*pb.ChannelInfo

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

func (*Peer) GetLedger

func (p *Peer) GetLedger(cid string) ledger.PeerLedger

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

func (*Peer) GetMSPIDs

func (p *Peer) GetMSPIDs(cid string) []string

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

func (*Peer) GetPolicyManager

func (p *Peer) GetPolicyManager(cid string) policies.Manager

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

func (*Peer) GetStableChannelConfig

func (p *Peer) GetStableChannelConfig(cid string) channelconfig.Resources

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

func (*Peer) Initialize

func (p *Peer) Initialize(
	init func(string),
	pm plugin.Mapper,
	deployedCCInfoProvider ledger.DeployedChaincodeInfoProvider,
	legacyLifecycleValidation plugindispatcher.LifecycleResources,
	newLifecycleValidation plugindispatcher.CollectionAndLifecycleResources,
	nWorkers int,
)

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

func (*Peer) StoreForChannel

func (p *Peer) StoreForChannel(cid string) *transientstore.Store

type PolicyCheckerProvider

type PolicyCheckerProvider func(resourceName string) deliver.PolicyCheckerFunc

PolicyCheckerProvider provides the corresponding policy checker for a given resource name

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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