Documentation ¶
Index ¶
- Constants
- Variables
- func BlockToString(block *common.Block) string
- func BlockVerifierBuilder(bccsp bccsp.BCCSP) func(block *common.Block) protoutil.BlockVerifierFunc
- func BuildStepRequest(request *orderer.StepRequest) (*orderer.ClusterNodeServiceStepRequest, error)
- func BuildStepRespone(stepResponse *orderer.ClusterNodeServiceStepResponse) (*orderer.StepResponse, error)
- func DERtoPEM(der []byte) string
- func EncodeTimestamp(t *timestamp.Timestamp) []byte
- func GetSessionBindingHash(authReq *orderer.NodeAuthRequest) []byte
- func GetTLSSessionBinding(ctx context.Context, bindingPayload []byte) ([]byte, error)
- func LastConfigBlock(block *common.Block, blockRetriever BlockRetriever) (*common.Block, error)
- func LatestHeightAndEndpoint(puller ChainPuller) (string, uint64, error)
- func NewStreamsByType() map[OperationType]map[uint64]*Stream
- func PullLastConfigBlock(puller ChainPuller) (*common.Block, error)
- func SHA256Digest(data []byte) []byte
- func VerifyBlockHash(indexInBuffer int, blockBuff []*common.Block) error
- func VerifyBlockSignature(block *common.Block, verifier protoutil.BlockVerifierFunc) error
- func VerifyBlocksBFT(blocks []*common.Block, signatureVerifier protoutil.BlockVerifierFunc, ...) error
- func VerifySignature(identity, msgHash, signature []byte) error
- type AuthCommMgr
- type AuthRequestSignature
- type BlockCommitFunc
- type BlockPuller
- type BlockRetriever
- type BlockSequenceVerifier
- type BlockValidationPolicyVerifier
- type CertificateComparator
- type ChainPuller
- type ChannelExtractor
- type ChannelMembersConfig
- type ClusterClient
- type ClusterService
- func (c *ClusterService) ConfigureNodeCerts(channel string, newNodes []*common.Consenter) error
- func (s *ClusterService) Step(stream orderer.ClusterNodeService_StepServer) error
- func (s *ClusterService) VerifyAuthRequest(stream orderer.ClusterNodeService_StepServer, ...) (*orderer.NodeAuthRequest, error)
- type ClusterStepStream
- type Comm
- func (c *Comm) Configure(channel string, newNodes []RemoteNode)
- func (c *Comm) DispatchConsensus(ctx context.Context, request *orderer.ConsensusRequest) error
- func (c *Comm) DispatchSubmit(ctx context.Context, request *orderer.SubmitRequest) error
- func (c *Comm) Remote(channel string, id uint64) (*RemoteContext, error)
- func (c *Comm) Shutdown()
- type CommClientStream
- type Communicator
- type ComparisonMemoizer
- type ConnByCertMap
- type ConnectionMapper
- type ConnectionStore
- type ConnectionsCache
- type ConnectionsMgr
- type Dialer
- type Dispatcher
- type EndpointCriteria
- type Handler
- type ImpatientStream
- type ImpatientStreamCreator
- type MemberMapping
- func (mp MemberMapping) ByID(ID uint64) *Stub
- func (mp *MemberMapping) Foreach(f func(id uint64, stub *Stub))
- func (mp MemberMapping) LookupByClientCert(cert []byte) *Stub
- func (mp MemberMapping) LookupByIdentity(identity []byte) *Stub
- func (mp *MemberMapping) Put(stub *Stub)
- func (mp *MemberMapping) Remove(ID uint64)
- func (mp MemberMapping) ServerCertificates() StringSet
- type MembersByChannel
- type Metrics
- type MetricsProvider
- type NodeAddress
- type NodeCerts
- type NodeClientStream
- type OperationType
- type PredicateDialer
- type RPC
- type RemoteContext
- type RemoteNode
- type RemoteVerifier
- type SecureDialer
- type Service
- type StandardDialer
- type StepClient
- type StepClientStream
- type StepStream
- type Stream
- type StreamCountReporter
- type StreamOperation
- type StringSet
- type Stub
- type VerifierFactory
Constants ¶
const KeyingMaterialLabel = "orderer v3 authentication label"
Lable used for TLS Export Keying Material call
const ( // MinimumExpirationWarningInterval is the default minimum time interval // between consecutive warnings about certificate expiration. MinimumExpirationWarningInterval = time.Minute * 5 )
Variables ¶
var ( EgressQueueLengthOpts = metrics.GaugeOpts{ Namespace: "cluster", Subsystem: "comm", Name: "egress_queue_length", Help: "Length of the egress queue.", LabelNames: []string{"host", "msg_type", "channel"}, StatsdFormat: "%{#fqname}.%{host}.%{msg_type}.%{channel}", } EgressQueueCapacityOpts = metrics.GaugeOpts{ Namespace: "cluster", Subsystem: "comm", Name: "egress_queue_capacity", Help: "Capacity of the egress queue.", LabelNames: []string{"host", "msg_type", "channel"}, StatsdFormat: "%{#fqname}.%{host}.%{msg_type}.%{channel}", } EgressWorkersOpts = metrics.GaugeOpts{ Namespace: "cluster", Subsystem: "comm", Name: "egress_queue_workers", Help: "Count of egress queue workers.", LabelNames: []string{"channel"}, StatsdFormat: "%{#fqname}.%{channel}", } IngressStreamsCountOpts = metrics.GaugeOpts{ Namespace: "cluster", Subsystem: "comm", Name: "ingress_stream_count", Help: "Count of streams from other nodes.", StatsdFormat: "%{#fqname}", } EgressStreamsCountOpts = metrics.GaugeOpts{ Namespace: "cluster", Subsystem: "comm", Name: "egress_stream_count", Help: "Count of streams to other nodes.", LabelNames: []string{"channel"}, StatsdFormat: "%{#fqname}.%{channel}", } EgressTLSConnectionCountOpts = metrics.GaugeOpts{ Namespace: "cluster", Subsystem: "comm", Name: "egress_tls_connection_count", Help: "Count of TLS connections to other nodes.", StatsdFormat: "%{#fqname}", } MessageSendTimeOpts = metrics.HistogramOpts{ Namespace: "cluster", Subsystem: "comm", Name: "msg_send_time", Help: "The time it takes to send a message in seconds.", LabelNames: []string{"host", "channel"}, StatsdFormat: "%{#fqname}.%{host}.%{channel}", } MessagesDroppedCountOpts = metrics.CounterOpts{ Namespace: "cluster", Subsystem: "comm", Name: "msg_dropped_count", Help: "Count of messages dropped.", LabelNames: []string{"host", "channel"}, StatsdFormat: "%{#fqname}.%{host}.%{channel}", } )
var ErrForbidden = errors.New("forbidden pulling the channel")
ErrForbidden denotes that an ordering node refuses sending blocks due to access control.
var ErrNotInChannel = errors.New("not in the channel")
ErrNotInChannel denotes that an ordering node is not in the channel
var ErrRetryCountExhausted = errors.New("retry attempts exhausted")
ErrServiceUnavailable denotes that an ordering node is not servicing at the moment.
Functions ¶
func BlockToString ¶
BlockToString returns a string representation of this block.
func BlockVerifierBuilder ¶
func BuildStepRequest ¶
func BuildStepRequest(request *orderer.StepRequest) (*orderer.ClusterNodeServiceStepRequest, error)
func BuildStepRespone ¶
func BuildStepRespone(stepResponse *orderer.ClusterNodeServiceStepResponse) (*orderer.StepResponse, error)
func EncodeTimestamp ¶
func GetSessionBindingHash ¶
func GetSessionBindingHash(authReq *orderer.NodeAuthRequest) []byte
func GetTLSSessionBinding ¶
func LastConfigBlock ¶
LastConfigBlock returns the last config block relative to the given block.
func LatestHeightAndEndpoint ¶
func LatestHeightAndEndpoint(puller ChainPuller) (string, uint64, error)
func NewStreamsByType ¶
func NewStreamsByType() map[OperationType]map[uint64]*Stream
NewStreamsByType returns a mapping of operation type to a mapping of destination to stream.
func PullLastConfigBlock ¶
func PullLastConfigBlock(puller ChainPuller) (*common.Block, error)
PullLastConfigBlock pulls the last configuration block, or returns an error on failure.
func SHA256Digest ¶
func VerifyBlockHash ¶
VerifyBlockHash verifies the hash chain of the block with the given index among the blocks of the given block buffer.
func VerifyBlockSignature ¶
func VerifyBlockSignature(block *common.Block, verifier protoutil.BlockVerifierFunc) error
VerifyBlockSignature verifies the signature on the block with the given BlockVerifier and the given config.
func VerifyBlocksBFT ¶
func VerifyBlocksBFT(blocks []*common.Block, signatureVerifier protoutil.BlockVerifierFunc, vb protoutil.VerifierBuilder) error
VerifyBlocksBFT verifies the given consecutive sequence of blocks is valid, always verifies signature, and returns nil if it's valid, else an error.
func VerifySignature ¶
Types ¶
type AuthCommMgr ¶
type AuthCommMgr struct { Logger *flogging.FabricLogger Metrics *Metrics Lock sync.RWMutex Chan2Members MembersByChannel Connections *ConnectionsMgr SendBufferSize int NodeIdentity []byte Signer identity.Signer // contains filtered or unexported fields }
AuthCommMgr implements the Communicator It manages the client side connections and streams established with the Cluster GRPC server and new Cluster service
func (*AuthCommMgr) Configure ¶
func (ac *AuthCommMgr) Configure(channel string, members []RemoteNode)
func (*AuthCommMgr) Remote ¶
func (ac *AuthCommMgr) Remote(channel string, id uint64) (*RemoteContext, error)
func (*AuthCommMgr) Shutdown ¶
func (ac *AuthCommMgr) Shutdown()
type AuthRequestSignature ¶
type BlockCommitFunc ¶
BlockCommitFunc signals a block commit.
type BlockPuller ¶
type BlockPuller struct { // Configuration MaxPullBlockRetries uint64 MaxTotalBufferBytes int Signer identity.SignerSerializer TLSCert []byte Channel string FetchTimeout time.Duration RetryTimeout time.Duration Logger *flogging.FabricLogger Dialer Dialer VerifyBlockSequence BlockSequenceVerifier Endpoints []EndpointCriteria // A 'stopper' goroutine may signal the go-routine servicing PullBlock & HeightsByEndpoints to stop by closing this // channel. Note: all methods of the BlockPuller must be serviced by a single goroutine, it is not thread safe. // It is the responsibility of the 'stopper' not to close the channel more then once. StopChannel chan struct{} // contains filtered or unexported fields }
BlockPuller pulls blocks from remote ordering nodes. Its operations are not thread safe.
func (*BlockPuller) Clone ¶
func (p *BlockPuller) Clone() *BlockPuller
Clone returns a copy of this BlockPuller initialized for the given channel
func (*BlockPuller) Close ¶
func (p *BlockPuller) Close()
Close makes the BlockPuller close the connection and stream with the remote endpoint, and wipe the internal block buffer.
func (*BlockPuller) HeightsByEndpoints ¶
func (p *BlockPuller) HeightsByEndpoints() (map[string]uint64, error)
HeightsByEndpoints returns the block heights by endpoints of orderers
func (*BlockPuller) PullBlock ¶
func (p *BlockPuller) PullBlock(seq uint64) *common.Block
PullBlock blocks until a block with the given sequence is fetched from some remote ordering node, or until consecutive failures of fetching the block exceed MaxPullBlockRetries.
func (*BlockPuller) UpdateEndpoints ¶
func (p *BlockPuller) UpdateEndpoints(endpoints []EndpointCriteria)
UpdateEndpoints assigns the new endpoints and disconnects from the current one.
type BlockRetriever ¶
type BlockRetriever interface { // Block returns a block with the given number, // or nil if such a block doesn't exist. Block(number uint64) *common.Block }
BlockRetriever retrieves blocks
type BlockSequenceVerifier ¶
BlockSequenceVerifier verifies that the given consecutive sequence of blocks is valid.
type BlockValidationPolicyVerifier ¶
type BlockValidationPolicyVerifier struct { Logger *flogging.FabricLogger Channel string PolicyMgr policies.Manager BCCSP bccsp.BCCSP }
BlockValidationPolicyVerifier verifies signatures based on the block validation policy.
func (*BlockValidationPolicyVerifier) VerifyBlockSignature ¶
func (bv *BlockValidationPolicyVerifier) VerifyBlockSignature(sd []*protoutil.SignedData, envelope *common.ConfigEnvelope) error
VerifyBlockSignature verifies the signed data associated to a block, optionally with the given config envelope.
type CertificateComparator ¶
CertificateComparator returns whether some relation holds for two given certificates
func CachePublicKeyComparisons ¶
func CachePublicKeyComparisons(f CertificateComparator) CertificateComparator
CachePublicKeyComparisons creates CertificateComparator that caches invocations based on input arguments. The given CertificateComparator must be a stateless function.
type ChainPuller ¶
type ChainPuller interface { // PullBlock pulls the given block from some orderer node PullBlock(seq uint64) *common.Block // HeightsByEndpoints returns the block heights by endpoints of orderers HeightsByEndpoints() (map[string]uint64, error) // Close closes the ChainPuller Close() }
ChainPuller pulls blocks from a chain
type ChannelExtractor ¶
ChannelExtractor extracts the channel of a given message, or returns an empty string if that's not possible
type ChannelMembersConfig ¶
type ClusterClient ¶
type ClusterClient interface {
Step(ctx context.Context, opts ...grpc.CallOption) (orderer.Cluster_StepClient, error)
}
ClusterClient creates streams that point to a remote cluster member.
type ClusterService ¶
type ClusterService struct { StreamCountReporter *StreamCountReporter RequestHandler Handler Logger *flogging.FabricLogger StepLogger *flogging.FabricLogger MinimumExpirationWarningInterval time.Duration CertExpWarningThreshold time.Duration MembershipByChannel map[string]*ChannelMembersConfig Lock sync.RWMutex NodeIdentity []byte }
ClusterService implements the server API for ClusterNodeService service
func (*ClusterService) ConfigureNodeCerts ¶
func (c *ClusterService) ConfigureNodeCerts(channel string, newNodes []*common.Consenter) error
func (*ClusterService) Step ¶
func (s *ClusterService) Step(stream orderer.ClusterNodeService_StepServer) error
Step passes an implementation-specific message to another cluster member.
func (*ClusterService) VerifyAuthRequest ¶
func (s *ClusterService) VerifyAuthRequest(stream orderer.ClusterNodeService_StepServer, request *orderer.ClusterNodeServiceStepRequest) (*orderer.NodeAuthRequest, error)
type ClusterStepStream ¶
type ClusterStepStream interface { Send(response *orderer.ClusterNodeServiceStepResponse) error Recv() (*orderer.ClusterNodeServiceStepRequest, error) grpc.ServerStream }
ClusterStepStream defines the gRPC stream for sending transactions, and receiving corresponding responses
type Comm ¶
type Comm struct { MinimumExpirationWarningInterval time.Duration CertExpWarningThreshold time.Duration SendBufferSize int Lock sync.RWMutex Logger *flogging.FabricLogger ChanExt ChannelExtractor H Handler Connections *ConnectionStore Chan2Members MembersByChannel Metrics *Metrics CompareCertificate CertificateComparator // contains filtered or unexported fields }
Comm implements Communicator
func (*Comm) Configure ¶
func (c *Comm) Configure(channel string, newNodes []RemoteNode)
Configure configures the channel with the given RemoteNodes
func (*Comm) DispatchConsensus ¶
DispatchConsensus identifies the channel and sender of the step request and passes it to the underlying Handler
func (*Comm) DispatchSubmit ¶
DispatchSubmit identifies the channel and sender of the submit request and passes it to the underlying Handler
type CommClientStream ¶
type CommClientStream struct {
StepClient orderer.Cluster_StepClient
}
func (*CommClientStream) Auth ¶
func (cs *CommClientStream) Auth() error
func (*CommClientStream) Context ¶
func (cs *CommClientStream) Context() context.Context
func (*CommClientStream) Recv ¶
func (cs *CommClientStream) Recv() (*orderer.StepResponse, error)
func (*CommClientStream) Send ¶
func (cs *CommClientStream) Send(request *orderer.StepRequest) error
type Communicator ¶
type Communicator interface { // Remote returns a RemoteContext for the given RemoteNode ID in the context // of the given channel, or error if connection cannot be established, or // the channel wasn't configured Remote(channel string, id uint64) (*RemoteContext, error) // Configure configures the communication to connect to all // given members, and disconnect from any members not among the given // members. Configure(channel string, members []RemoteNode) // Shutdown shuts down the communicator Shutdown() }
Communicator defines communication for a consenter
type ComparisonMemoizer ¶
type ComparisonMemoizer struct { // Configuration F func(a, b []byte) bool MaxEntries uint16 // contains filtered or unexported fields }
ComparisonMemoizer speeds up comparison computations by caching past invocations of a stateless function
func (*ComparisonMemoizer) Compare ¶
func (cm *ComparisonMemoizer) Compare(a, b []byte) bool
Compare compares the given two byte slices. It may return previous computations for the given two arguments, otherwise it will compute the function F and cache the result.
func (*ComparisonMemoizer) Size ¶
func (cm *ComparisonMemoizer) Size() int
Size returns the number of computations the ComparisonMemoizer currently caches.
type ConnByCertMap ¶
type ConnByCertMap map[string]*grpc.ClientConn
ConnByCertMap maps certificates represented as strings to gRPC connections
func (ConnByCertMap) Lookup ¶
func (cbc ConnByCertMap) Lookup(cert []byte) (*grpc.ClientConn, bool)
Lookup looks up a certificate and returns the connection that was mapped to the certificate, and whether it was found or not
func (ConnByCertMap) Put ¶
func (cbc ConnByCertMap) Put(cert []byte, conn *grpc.ClientConn)
Put associates the given connection to the certificate
func (ConnByCertMap) Remove ¶
func (cbc ConnByCertMap) Remove(cert []byte)
Remove removes the connection that is associated to the given certificate
func (ConnByCertMap) Size ¶
func (cbc ConnByCertMap) Size() int
Size returns the size of the connections by certificate mapping
type ConnectionMapper ¶
type ConnectionMapper interface { Lookup(key []byte) (*grpc.ClientConn, bool) Put(key []byte, conn *grpc.ClientConn) Remove(key []byte) Size() int }
ConnectionMapper maps certificates to connections
type ConnectionStore ¶
type ConnectionStore struct { Connections ConnectionMapper // contains filtered or unexported fields }
ConnectionStore stores connections to remote nodes
func NewConnectionStore ¶
func NewConnectionStore(dialer SecureDialer, tlsConnectionCount metrics.Gauge) *ConnectionStore
NewConnectionStore creates a new ConnectionStore with the given SecureDialer
func (*ConnectionStore) Connection ¶
func (c *ConnectionStore) Connection(endpoint string, expectedServerCert []byte) (*grpc.ClientConn, error)
Connection obtains a connection to the given endpoint and expects the given server certificate to be presented by the remote node
func (*ConnectionStore) Disconnect ¶
func (c *ConnectionStore) Disconnect(expectedServerCert []byte)
Disconnect closes the gRPC connection that is mapped to the given certificate
type ConnectionsCache ¶
type ConnectionsCache map[string]*grpc.ClientConn
func (ConnectionsCache) Lookup ¶
func (cbc ConnectionsCache) Lookup(key string) (*grpc.ClientConn, bool)
func (ConnectionsCache) Put ¶
func (cbc ConnectionsCache) Put(key string, conn *grpc.ClientConn)
func (ConnectionsCache) Remove ¶
func (cbc ConnectionsCache) Remove(key string)
func (ConnectionsCache) Size ¶
func (cbc ConnectionsCache) Size() int
type ConnectionsMgr ¶
type ConnectionsMgr struct { Connections ConnectionsCache // contains filtered or unexported fields }
func NewConnectionMgr ¶
func NewConnectionMgr(dialer comm.ClientConfig) *ConnectionsMgr
func (*ConnectionsMgr) Connect ¶
func (c *ConnectionsMgr) Connect(endpoint string, serverRootCACert [][]byte) (*grpc.ClientConn, error)
func (*ConnectionsMgr) Disconnect ¶
func (c *ConnectionsMgr) Disconnect(endpoint string)
type Dialer ¶
type Dialer interface {
Dial(endpointCriteria EndpointCriteria) (*grpc.ClientConn, error)
}
Dialer creates a gRPC connection to a remote address
type Dispatcher ¶
type Dispatcher interface { DispatchSubmit(ctx context.Context, request *orderer.SubmitRequest) error DispatchConsensus(ctx context.Context, request *orderer.ConsensusRequest) error }
Dispatcher dispatches requests
type EndpointCriteria ¶
type EndpointCriteria struct { Endpoint string // Endpoint of the form host:port TLSRootCAs [][]byte // PEM encoded TLS root CA certificates }
EndpointCriteria defines criteria of how to connect to a remote orderer node.
func EndpointconfigFromConfigBlock ¶
func EndpointconfigFromConfigBlock(block *common.Block, bccsp bccsp.BCCSP) ([]EndpointCriteria, error)
EndpointconfigFromConfigBlock retrieves TLS CA certificates and endpoints from a config block.
func (EndpointCriteria) String ¶
func (ep EndpointCriteria) String() string
String returns a string representation of this EndpointCriteria
type Handler ¶
type Handler interface { OnConsensus(channel string, sender uint64, req *orderer.ConsensusRequest) error OnSubmit(channel string, sender uint64, req *orderer.SubmitRequest) error }
Handler handles Step() and Submit() requests and returns a corresponding response
type ImpatientStream ¶
type ImpatientStream struct { orderer.AtomicBroadcast_DeliverClient // contains filtered or unexported fields }
ImpatientStream aborts the stream if it waits for too long for a message.
func (*ImpatientStream) Recv ¶
func (stream *ImpatientStream) Recv() (*orderer.DeliverResponse, error)
Recv blocks until a response is received from the stream or the timeout expires.
type ImpatientStreamCreator ¶
type ImpatientStreamCreator func() (*ImpatientStream, error)
ImpatientStreamCreator creates an ImpatientStream
func NewImpatientStream ¶
func NewImpatientStream(conn *grpc.ClientConn, waitTimeout time.Duration) ImpatientStreamCreator
NewImpatientStream returns a ImpatientStreamCreator that creates impatientStreams.
type MemberMapping ¶
type MemberMapping struct { SamePublicKey CertificateComparator // contains filtered or unexported fields }
MemberMapping defines NetworkMembers by their ID and enables to lookup stubs by a certificate
func (MemberMapping) ByID ¶
func (mp MemberMapping) ByID(ID uint64) *Stub
ByID retrieves the Stub with the given ID from the MemberMapping
func (*MemberMapping) Foreach ¶
func (mp *MemberMapping) Foreach(f func(id uint64, stub *Stub))
Foreach applies the given function on all stubs in the mapping
func (MemberMapping) LookupByClientCert ¶
func (mp MemberMapping) LookupByClientCert(cert []byte) *Stub
LookupByClientCert retrieves a Stub with the given client certificate
func (MemberMapping) LookupByIdentity ¶
func (mp MemberMapping) LookupByIdentity(identity []byte) *Stub
LookupByIdentity retrieves a Stub by Identity
func (*MemberMapping) Put ¶
func (mp *MemberMapping) Put(stub *Stub)
Put inserts the given stub to the MemberMapping
func (*MemberMapping) Remove ¶
func (mp *MemberMapping) Remove(ID uint64)
Remove removes the stub with the given ID from the MemberMapping
func (MemberMapping) ServerCertificates ¶
func (mp MemberMapping) ServerCertificates() StringSet
ServerCertificates returns a set of the server certificates represented as strings
type MembersByChannel ¶
type MembersByChannel map[string]MemberMapping
MembersByChannel is a mapping from channel name to MemberMapping
type Metrics ¶
type Metrics struct { EgressQueueLength metrics.Gauge EgressQueueCapacity metrics.Gauge EgressWorkerCount metrics.Gauge IngressStreamsCount metrics.Gauge EgressStreamsCount metrics.Gauge EgressTLSConnectionCount metrics.Gauge MessageSendTime metrics.Histogram MessagesDroppedCount metrics.Counter }
Metrics defines the metrics for the cluster.
func NewMetrics ¶
func NewMetrics(provider MetricsProvider) *Metrics
NewMetrics initializes new metrics for the cluster infrastructure.
type MetricsProvider ¶
type MetricsProvider interface { // NewCounter creates a new instance of a Counter. NewCounter(opts metrics.CounterOpts) metrics.Counter // NewGauge creates a new instance of a Gauge. NewGauge(opts metrics.GaugeOpts) metrics.Gauge // NewHistogram creates a new instance of a Histogram. NewHistogram(opts metrics.HistogramOpts) metrics.Histogram }
A MetricsProvider is an abstraction for a metrics provider. It is a factory for Counter, Gauge, and Histogram meters.
type NodeAddress ¶
type NodeCerts ¶
type NodeCerts struct { // ServerTLSCert is the DER encoded TLS server certificate of the node ServerTLSCert []byte // ClientTLSCert is the DER encoded TLS client certificate of the node ClientTLSCert []byte // PEM-encoded X509 certificate authority to verify server certificates ServerRootCA [][]byte // PEM-encoded X509 certificate Identity []byte }
type NodeClientStream ¶
type NodeClientStream struct { StepClient orderer.ClusterNodeService_StepClient Version uint32 SourceNodeID uint64 DestinationNodeID uint64 Signer identity.Signer Channel string }
func (*NodeClientStream) Auth ¶
func (cs *NodeClientStream) Auth() error
func (*NodeClientStream) Context ¶
func (cs *NodeClientStream) Context() context.Context
func (*NodeClientStream) Recv ¶
func (cs *NodeClientStream) Recv() (*orderer.StepResponse, error)
func (*NodeClientStream) Send ¶
func (cs *NodeClientStream) Send(request *orderer.StepRequest) error
type OperationType ¶
type OperationType int
OperationType denotes a type of operation that the RPC can perform such as sending a transaction, or a consensus related message.
const ( ConsensusOperation OperationType = iota SubmitOperation )
func (OperationType) String ¶
func (ot OperationType) String() string
type PredicateDialer ¶
type PredicateDialer struct { Config comm.ClientConfig // contains filtered or unexported fields }
PredicateDialer creates gRPC connections that are only established if the given predicate is fulfilled
func (*PredicateDialer) Dial ¶
func (dialer *PredicateDialer) Dial(address string, verifyFunc RemoteVerifier) (*grpc.ClientConn, error)
Dial creates a new gRPC connection that can only be established, if the remote node's certificate chain satisfy verifyFunc
func (*PredicateDialer) UpdateRootCAs ¶
func (dialer *PredicateDialer) UpdateRootCAs(serverRootCAs [][]byte)
type RPC ¶
type RPC struct { Logger *flogging.FabricLogger Timeout time.Duration Channel string Comm Communicator StreamsByType map[OperationType]map[uint64]*Stream // contains filtered or unexported fields }
RPC performs remote procedure calls to remote cluster nodes.
func (*RPC) SendConsensus ¶
func (s *RPC) SendConsensus(destination uint64, msg *orderer.ConsensusRequest) error
SendConsensus passes the given ConsensusRequest message to the raft.Node instance.
func (*RPC) SendSubmit ¶
func (s *RPC) SendSubmit(destination uint64, request *orderer.SubmitRequest, report func(error)) error
SendSubmit sends a SubmitRequest to the given destination node.
type RemoteContext ¶
type RemoteContext struct { Metrics *Metrics Channel string SendBuffSize int Logger *flogging.FabricLogger GetStreamFunc func(context.Context) (StepClientStream, error) // interface{} ProbeConn func(conn *grpc.ClientConn) error // contains filtered or unexported fields }
RemoteContext interacts with remote cluster nodes. Every call can be aborted via call to Abort()
func (*RemoteContext) Abort ¶
func (rc *RemoteContext) Abort()
Abort aborts the contexts the RemoteContext uses, thus effectively causes all operations that use this RemoteContext to terminate.
type RemoteNode ¶
type RemoteNode struct { NodeAddress NodeCerts }
RemoteNode represents a cluster member
func (RemoteNode) String ¶
func (rm RemoteNode) String() string
String returns a string representation of this RemoteNode
type RemoteVerifier ¶
type RemoteVerifier func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error
RemoteVerifier verifies the connection to the remote host
type SecureDialer ¶
type SecureDialer interface {
Dial(address string, verifyFunc RemoteVerifier) (*grpc.ClientConn, error)
}
SecureDialer connects to a remote address
type Service ¶
type Service struct { StreamCountReporter *StreamCountReporter Dispatcher Dispatcher Logger *flogging.FabricLogger StepLogger *flogging.FabricLogger MinimumExpirationWarningInterval time.Duration CertExpWarningThreshold time.Duration }
Service defines the raft Service
type StandardDialer ¶
type StandardDialer struct {
Config comm.ClientConfig
}
StandardDialer wraps an ClientConfig, and provides a means to connect according to given EndpointCriteria.
func (*StandardDialer) Dial ¶
func (dialer *StandardDialer) Dial(endpointCriteria EndpointCriteria) (*grpc.ClientConn, error)
Dial dials an address according to the given EndpointCriteria
type StepClient ¶
type StepClient interface { Send(*orderer.StepRequest) error Recv() (*orderer.StepResponse, error) grpc.ClientStream }
StepClient defines a client that sends and receives Step requests and responses.
type StepClientStream ¶
type StepClientStream interface { Send(request *orderer.StepRequest) error Recv() (*orderer.StepResponse, error) Auth() error Context() context.Context }
StepClientStream
type StepStream ¶
type StepStream interface { Send(response *orderer.StepResponse) error Recv() (*orderer.StepRequest, error) grpc.ServerStream }
StepStream defines the gRPC stream for sending transactions, and receiving corresponding responses
type Stream ¶
type Stream struct { ID uint64 Channel string NodeName string Endpoint string Logger *flogging.FabricLogger Timeout time.Duration StepClient StepClientStream Cancel func(error) // contains filtered or unexported fields }
Stream is used to send/receive messages to/from the remote cluster member.
func (*Stream) Recv ¶
func (stream *Stream) Recv() (*orderer.StepResponse, error)
Recv receives a message from a remote cluster member.
func (*Stream) Send ¶
func (stream *Stream) Send(request *orderer.StepRequest) error
Send sends the given request to the remote cluster member.
func (*Stream) SendWithReport ¶
func (stream *Stream) SendWithReport(request *orderer.StepRequest, report func(error)) error
SendWithReport sends the given request to the remote cluster member and invokes report on the send result.
type StreamCountReporter ¶
type StreamCountReporter struct { Metrics *Metrics // contains filtered or unexported fields }
StreamCountReporter reports the number of streams currently connected to this node
func (*StreamCountReporter) Decrement ¶
func (scr *StreamCountReporter) Decrement()
func (*StreamCountReporter) Increment ¶
func (scr *StreamCountReporter) Increment()
type StreamOperation ¶
type StreamOperation func() (*orderer.StepResponse, error)
StreamOperation denotes an operation done by a stream, such a Send or Receive.
type Stub ¶
type Stub struct { RemoteNode *RemoteContext // contains filtered or unexported fields }
Stub holds all information about the remote node, including the RemoteContext for it, and serializes some operations on it.
func (*Stub) Activate ¶
func (stub *Stub) Activate(createRemoteContext func() (*RemoteContext, error)) error
Activate creates a remote context with the given function callback in an atomic manner - if two parallel invocations are invoked on this Stub, only a single invocation of createRemoteStub takes place.
func (*Stub) Deactivate ¶
func (stub *Stub) Deactivate()
Deactivate deactivates the Stub and ceases all communication operations invoked on it.
type VerifierFactory ¶
type VerifierFactory interface { // VerifierFromConfig creates a BlockVerifier from the given configuration. VerifierFromConfig(configuration *common.ConfigEnvelope, channel string) (protoutil.BlockVerifierFunc, error) }
VerifierFactory creates BlockVerifiers.