fabric: github.com/hyperledger/fabric/core/peer Index | Files | Directories

package peer

import "github.com/hyperledger/fabric/core/peer"

Index

Package Files

channel.go config.go configtx_processor.go deliverevents.go mock_helpers.go peer.go

func ConfigBlockFromLedger Uses

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

func CreateMockChannel Uses

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

func GetClientCertificate Uses

func GetClientCertificate() (tls.Certificate, error)

GetClientCertificate returns the TLS certificate to use for gRPC client connections

func GetServerConfig Uses

func GetServerConfig() (comm.ServerConfig, error)

GetServerConfig returns the gRPC server configuration for the peer

func NewConfigSupport Uses

func NewConfigSupport(peer *Peer) cc.Manager

NewConfigSupport returns

type Chain Uses

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

Chain adds Ledger() to deliver.Chain

type Channel Uses

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

Channel manages objects and configuration associated with a Channel.

func (*Channel) Apply Uses

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

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

func (*Channel) Capabilities Uses

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

Capabilities gets the application capabilities for the current channel configuration.

func (*Channel) Errored Uses

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 Uses

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

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

func (*Channel) Ledger Uses

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

Ledger returns the ledger associated with this channel.

func (*Channel) MSPManager Uses

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 Uses

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 Uses

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

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

func (*Channel) Resources Uses

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

Resources returns the active channel configuration bundle.

func (*Channel) Sequence Uses

func (c *Channel) Sequence() uint64

Sequence returns the current config sequence number of the channel.

func (*Channel) Store Uses

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

Store returns the transient store associated with this channel.

type CollectionInfoShim Uses

type CollectionInfoShim struct {
    plugindispatcher.CollectionAndLifecycleResources
    ChannelID string
}

func (*CollectionInfoShim) CollectionValidationInfo Uses

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

type CollectionPolicyChecker Uses

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 Uses

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

    // LimitsConcurrencyEndorserService sets the limits for concurrent requests sent to
    // endorser service that handles chaincode deployment, query and invocation,
    // including both user chaincodes and system chaincodes.
    LimitsConcurrencyEndorserService int

    // LimitsConcurrencyDeliverService sets the limits for concurrent event listeners
    // registered to deliver service for blocks and transaction events.
    LimitsConcurrencyDeliverService 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 Uses

func GlobalConfig() (*Config, error)

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

type ConfigTxProcessor Uses

type ConfigTxProcessor struct{}

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

func (*ConfigTxProcessor) GenerateSimulationResults Uses

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 Uses

type DeliverChainManager struct {
    Peer *Peer
}

DeliverChainManager provides access to a channel for performing deliver

func (DeliverChainManager) GetChain Uses

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

type DeliverServer Uses

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 Uses

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

Deliver sends a stream of blocks to a client after commitment

func (*DeliverServer) DeliverFiltered Uses

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

DeliverFiltered sends a stream of blocks to a client after commitment

func (*DeliverServer) DeliverWithPrivateData Uses

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 Uses

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 Uses

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 Uses

type Peer struct {
    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 Uses

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

func (*Peer) CreateChannel Uses

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

func (*Peer) GetApplicationConfig Uses

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

func (*Peer) GetChannelConfig Uses

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 Uses

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

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

func (*Peer) GetLedger Uses

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 Uses

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

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

func (*Peer) GetPolicyManager Uses

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 Uses

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 Uses

func (p *Peer) Initialize(
    init func(string),
    server *comm.GRPCServer,
    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 Uses

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

type PolicyCheckerProvider Uses

type PolicyCheckerProvider func(resourceName string) deliver.PolicyCheckerFunc

PolicyCheckerProvider provides the corresponding policy checker for a given resource name

Directories

PathSynopsis
mockCode generated by counterfeiter.

Package peer imports 51 packages (graph) and is imported by 346 packages. Updated 2020-02-25. Refresh now. Tools for package owners.