fabric: github.com/hyperledger/fabric/orderer/common/cluster Index | Files | Directories

package cluster

import "github.com/hyperledger/fabric/orderer/common/cluster"

Index

Package Files

comm.go connections.go deliver.go metrics.go replication.go rpc.go service.go util.go

Constants

const (
    // MinimumExpirationWarningInterval is the default minimum time interval
    // between consecutive warnings about certificate expiration.
    MinimumExpirationWarningInterval = time.Minute * 5
)
const (
    // RetryTimeout is the time the block puller retries.
    RetryTimeout = time.Second * 10
)

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")
var ErrServiceUnavailable = errors.New("service unavailable")

ErrServiceUnavailable denotes that an ordering node is not servicing at the moment.

var ErrSkipped = errors.New("skipped")

ErrSkipped denotes that replicating a chain was skipped

func AnyChannel Uses

func AnyChannel(_ string) bool

AnyChannel accepts all channels.

func BlockToString Uses

func BlockToString(block *common.Block) string

BlockToString returns a string representation of this block.

func ChannelCreationBlockToGenesisBlock Uses

func ChannelCreationBlockToGenesisBlock(block *common.Block) (*common.Block, error)

ChannelCreationBlockToGenesisBlock converts a channel creation block to a genesis block

func ConfigFromBlock Uses

func ConfigFromBlock(block *common.Block) (*common.ConfigEnvelope, error)

ConfigFromBlock returns a ConfigEnvelope if exists, or a *NotAConfigBlock error. It may also return some other error in case parsing failed.

func DERtoPEM Uses

func DERtoPEM(der []byte) string

DERtoPEM returns a PEM representation of the DER encoded certificate

func IsNewChannelBlock Uses

func IsNewChannelBlock(block *common.Block) (string, error)

IsNewChannelBlock returns a name of the channel in case it holds a channel create transaction, or empty string otherwise.

func LastConfigBlock Uses

func LastConfigBlock(block *common.Block, blockRetriever BlockRetriever) (*common.Block, error)

LastConfigBlock returns the last config block relative to the given block.

func NewStreamsByType Uses

func NewStreamsByType() map[OperationType]map[uint64]*Stream

NewStreamsByType returns a mapping of operation type to a mapping of destination to stream.

func Participant Uses

func Participant(puller ChainPuller, analyzeLastConfBlock SelfMembershipPredicate) error

Participant returns whether the caller participates in the chain. It receives a ChainPuller that should already be calibrated for the chain, and a SelfMembershipPredicate that is used to detect whether the caller should service the chain. It returns nil if the caller participates in the chain. It may return: ErrNotInChannel in case the caller doesn't participate in the chain. ErrForbidden in case the caller is forbidden from pulling the block. ErrServiceUnavailable in case all orderers reachable cannot complete the request. ErrRetryCountExhausted in case no orderer is reachable.

func PullLastConfigBlock Uses

func PullLastConfigBlock(puller ChainPuller) (*common.Block, error)

PullLastConfigBlock pulls the last configuration block, or returns an error on failure.

func SignatureSetFromBlock Uses

func SignatureSetFromBlock(block *common.Block) ([]*common.SignedData, error)

SignatureSetFromBlock creates a signature set out of a block.

func VerifyBlockHash Uses

func VerifyBlockHash(indexInBuffer int, blockBuff []*common.Block) error

VerifyBlockHash verifies the hash chain of the block with the given index among the blocks of the given block buffer.

func VerifyBlockSignature Uses

func VerifyBlockSignature(block *common.Block, verifier BlockVerifier, config *common.ConfigEnvelope) error

VerifyBlockSignature verifies the signature on the block with the given BlockVerifier and the given config.

func VerifyBlocks Uses

func VerifyBlocks(blockBuff []*common.Block, signatureVerifier BlockVerifier) error

VerifyBlocks verifies the given consecutive sequence of blocks is valid, and returns nil if it's valid, else an error.

type BlockCommitFunc Uses

type BlockCommitFunc func(block *common.Block, channel string)

BlockCommitFunc signals a block commit.

type BlockPuller Uses

type BlockPuller struct {
    // Configuration
    MaxPullBlockRetries uint64
    MaxTotalBufferBytes int
    Signer              crypto.LocalSigner
    TLSCert             []byte
    Channel             string
    FetchTimeout        time.Duration
    RetryTimeout        time.Duration
    Logger              *flogging.FabricLogger
    Dialer              Dialer
    VerifyBlockSequence BlockSequenceVerifier
    Endpoints           []EndpointCriteria
    // contains filtered or unexported fields
}

BlockPuller pulls blocks from remote ordering nodes. Its operations are not thread safe.

func BlockPullerFromConfigBlock Uses

func BlockPullerFromConfigBlock(conf PullerConfig, block *common.Block, verifierRetriever VerifierRetriever) (*BlockPuller, error)

BlockPullerFromConfigBlock returns a BlockPuller that doesn't verify signatures on blocks.

func (*BlockPuller) Clone Uses

func (p *BlockPuller) Clone() *BlockPuller

Clone returns a copy of this BlockPuller initialized for the given channel

func (*BlockPuller) Close Uses

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 Uses

func (p *BlockPuller) HeightsByEndpoints() (map[string]uint64, error)

HeightsByEndpoints returns the block heights by endpoints of orderers

func (*BlockPuller) PullBlock Uses

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.

type BlockRetriever Uses

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 Uses

type BlockSequenceVerifier func(blocks []*common.Block, channel string) error

BlockSequenceVerifier verifies that the given consecutive sequence of blocks is valid.

type BlockValidationPolicyVerifier Uses

type BlockValidationPolicyVerifier struct {
    Logger    *flogging.FabricLogger
    Channel   string
    PolicyMgr policies.Manager
}

BlockValidationPolicyVerifier verifies signatures based on the block validation policy.

func (*BlockValidationPolicyVerifier) VerifyBlockSignature Uses

func (bv *BlockValidationPolicyVerifier) VerifyBlockSignature(sd []*common.SignedData, envelope *common.ConfigEnvelope) error

VerifyBlockSignature verifies the signed data associated to a block, optionally with the given config envelope.

type BlockVerifier Uses

type BlockVerifier interface {
    // VerifyBlockSignature verifies a signature of a block.
    // It has an optional argument of a configuration envelope
    // which would make the block verification to use validation rules
    // based on the given configuration in the ConfigEnvelope.
    // If the config envelope passed is nil, then the validation rules used
    // are the ones that were applied at commit of previous blocks.
    VerifyBlockSignature(sd []*common.SignedData, config *common.ConfigEnvelope) error
}

BlockVerifier verifies block signatures.

type BlockVerifierAssembler Uses

type BlockVerifierAssembler struct {
    Logger *flogging.FabricLogger
}

BlockVerifierAssembler creates a BlockVerifier out of a config envelope

func (*BlockVerifierAssembler) VerifierFromConfig Uses

func (bva *BlockVerifierAssembler) VerifierFromConfig(configuration *common.ConfigEnvelope, channel string) (BlockVerifier, error)

VerifierFromConfig creates a BlockVerifier from the given configuration.

type ChainInspector Uses

type ChainInspector struct {
    Logger          *flogging.FabricLogger
    Puller          ChainPuller
    LastConfigBlock *common.Block
}

ChainInspector walks over a chain

func (*ChainInspector) Channels Uses

func (ci *ChainInspector) Channels() []ChannelGenesisBlock

Channels returns the list of ChannelGenesisBlocks for all channels. Each such ChannelGenesisBlock contains the genesis block of the channel.

func (*ChainInspector) Close Uses

func (ci *ChainInspector) Close()

Close closes the ChainInspector

type ChainPuller Uses

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 Uses

type ChannelExtractor interface {
    TargetChannel(message proto.Message) string
}

ChannelExtractor extracts the channel of a given message, or returns an empty string if that's not possible

type ChannelGenesisBlock Uses

type ChannelGenesisBlock struct {
    ChannelName  string
    GenesisBlock *common.Block
}

ChannelGenesisBlock wraps a Block and its channel name

type ChannelLister Uses

type ChannelLister interface {
    // Channels returns a list of channels
    Channels() []ChannelGenesisBlock
    // Close closes the ChannelLister
    Close()
}

ChannelLister returns a list of channels

type ChannelPredicate Uses

type ChannelPredicate func(channelName string) bool

ChannelPredicate accepts channels according to their names.

type ClusterClient Uses

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 Comm Uses

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
    // contains filtered or unexported fields
}

Comm implements Communicator

func (*Comm) Configure Uses

func (c *Comm) Configure(channel string, newNodes []RemoteNode)

Configure configures the channel with the given RemoteNodes

func (*Comm) DispatchConsensus Uses

func (c *Comm) DispatchConsensus(ctx context.Context, request *orderer.ConsensusRequest) error

DispatchConsensus identifies the channel and sender of the step request and passes it to the underlying Handler

func (*Comm) DispatchSubmit Uses

func (c *Comm) DispatchSubmit(ctx context.Context, request *orderer.SubmitRequest) error

DispatchSubmit identifies the channel and sender of the submit request and passes it to the underlying Handler

func (*Comm) Remote Uses

func (c *Comm) Remote(channel string, id uint64) (*RemoteContext, error)

Remote obtains a RemoteContext linked to the destination node on the context of a given channel

func (*Comm) Shutdown Uses

func (c *Comm) Shutdown()

Shutdown shuts down the instance

type Communicator Uses

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 ConnByCertMap Uses

type ConnByCertMap map[string]*grpc.ClientConn

ConnByCertMap maps certificates represented as strings to gRPC connections

func (ConnByCertMap) Lookup Uses

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 Uses

func (cbc ConnByCertMap) Put(cert []byte, conn *grpc.ClientConn)

Put associates the given connection to the certificate

func (ConnByCertMap) Remove Uses

func (cbc ConnByCertMap) Remove(cert []byte)

Remove removes the connection that is associated to the given certificate

func (ConnByCertMap) Size Uses

func (cbc ConnByCertMap) Size() int

type ConnectionMapper Uses

type ConnectionMapper interface {
    Lookup(cert []byte) (*grpc.ClientConn, bool)
    Put(cert []byte, conn *grpc.ClientConn)
    Remove(cert []byte)
    Size() int
}

ConnectionMapper maps certificates to connections

type ConnectionStore Uses

type ConnectionStore struct {
    Connections ConnectionMapper
    // contains filtered or unexported fields
}

ConnectionStore stores connections to remote nodes

func NewConnectionStore Uses

func NewConnectionStore(dialer SecureDialer, tlsConnectionCount metrics.Gauge) *ConnectionStore

NewConnectionStore creates a new ConnectionStore with the given SecureDialer

func (*ConnectionStore) Connection Uses

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 Uses

func (c *ConnectionStore) Disconnect(expectedServerCert []byte)

Disconnect closes the gRPC connection that is mapped to the given certificate

type Dialer Uses

type Dialer interface {
    Dial(endpointCriteria EndpointCriteria) (*grpc.ClientConn, error)
}

Dialer creates a gRPC connection to a remote address

type Dispatcher Uses

type Dispatcher interface {
    DispatchSubmit(ctx context.Context, request *orderer.SubmitRequest) error
    DispatchConsensus(ctx context.Context, request *orderer.ConsensusRequest) error
}

Dispatcher dispatches requests

type EndpointCriteria Uses

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 Uses

func EndpointconfigFromConfigBlock(block *common.Block) ([]EndpointCriteria, error)

EndpointconfigFromConfigBlock retrieves TLS CA certificates and endpoints from a config block.

type GenesisBlocks Uses

type GenesisBlocks []ChannelGenesisBlock

GenesisBlocks aggregates several ChannelGenesisBlocks

func (GenesisBlocks) Names Uses

func (gbs GenesisBlocks) Names() []string

Names returns the channel names all ChannelGenesisBlocks

type Handler Uses

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 Uses

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 Uses

func (stream *ImpatientStream) Recv() (*orderer.DeliverResponse, error)

Recv blocks until a response is received from the stream or the timeout expires.

type ImpatientStreamCreator Uses

type ImpatientStreamCreator func() (*ImpatientStream, error)

ImpatientStreamCreator creates an ImpatientStream

func NewImpatientStream Uses

func NewImpatientStream(conn *grpc.ClientConn, waitTimeout time.Duration) ImpatientStreamCreator

NewImpatientStream returns a ImpatientStreamCreator that creates impatientStreams.

type LedgerFactory Uses

type LedgerFactory interface {
    // GetOrCreate gets an existing ledger (if it exists)
    // or creates it if it does not
    GetOrCreate(chainID string) (LedgerWriter, error)
}

LedgerFactory retrieves or creates new ledgers by chainID

type LedgerInterceptor Uses

type LedgerInterceptor struct {
    Channel              string
    InterceptBlockCommit BlockCommitFunc
    LedgerWriter
}

LedgerInterceptor intercepts block commits.

func (*LedgerInterceptor) Append Uses

func (interceptor *LedgerInterceptor) Append(block *common.Block) error

Append commits a block into the ledger, and also fires the configured callback.

type LedgerWriter Uses

type LedgerWriter interface {
    // Append a new block to the ledger
    Append(block *common.Block) error

    // Height returns the number of blocks on the ledger
    Height() uint64
}

LedgerWriter allows the caller to write blocks and inspect the height

type MemberMapping Uses

type MemberMapping map[uint64]*Stub

MemberMapping defines NetworkMembers by their ID

func (MemberMapping) ByID Uses

func (mp MemberMapping) ByID(ID uint64) *Stub

ByID retrieves the Stub with the given ID from the MemberMapping

func (MemberMapping) LookupByClientCert Uses

func (mp MemberMapping) LookupByClientCert(cert []byte) *Stub

LookupByClientCert retrieves a Stub with the given client certificate

func (MemberMapping) Put Uses

func (mp MemberMapping) Put(stub *Stub)

Put inserts the given stub to the MemberMapping

func (MemberMapping) ServerCertificates Uses

func (mp MemberMapping) ServerCertificates() StringSet

ServerCertificates returns a set of the server certificates represented as strings

type MembersByChannel Uses

type MembersByChannel map[string]MemberMapping

MembersByChannel is a mapping from channel name to MemberMapping

type Metrics Uses

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 Uses

func NewMetrics(provider MetricsProvider) *Metrics

NewMetrics initializes new metrics for the cluster infrastructure.

type MetricsProvider Uses

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 NoopBlockVerifier Uses

type NoopBlockVerifier struct{}

NoopBlockVerifier doesn't verify block signatures

func (*NoopBlockVerifier) VerifyBlockSignature Uses

func (*NoopBlockVerifier) VerifyBlockSignature(sd []*common.SignedData, config *common.ConfigEnvelope) error

VerifyBlockSignature accepts all signatures over blocks.

type OperationType Uses

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
)

type PredicateDialer Uses

type PredicateDialer struct {
    comm.ClientConfig
    // contains filtered or unexported fields
}

PredicateDialer creates gRPC connections that are only established if the given predicate is fulfilled

func (*PredicateDialer) Dial Uses

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 Uses

func (dialer *PredicateDialer) UpdateRootCAs(serverRootCAs [][]byte)

type PullerConfig Uses

type PullerConfig struct {
    TLSKey              []byte
    TLSCert             []byte
    Timeout             time.Duration
    Signer              crypto.LocalSigner
    Channel             string
    MaxTotalBufferBytes int
}

PullerConfig configures a BlockPuller.

func PullerConfigFromTopLevelConfig Uses

func PullerConfigFromTopLevelConfig(systemChannel string, conf *localconfig.TopLevel, tlsKey, tlsCert []byte, signer crypto.LocalSigner) PullerConfig

PullerConfigFromTopLevelConfig creates a PullerConfig from a TopLevel config, and from a signer and TLS key cert pair. The PullerConfig's channel is initialized to be the system channel.

type RPC Uses

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 Uses

func (s *RPC) SendConsensus(destination uint64, msg *orderer.ConsensusRequest) error

Consensus passes the given ConsensusRequest message to the raft.Node instance.

func (*RPC) SendSubmit Uses

func (s *RPC) SendSubmit(destination uint64, request *orderer.SubmitRequest) error

SendSubmit sends a SubmitRequest to the given destination node.

type RemoteContext Uses

type RemoteContext struct {
    Metrics      *Metrics
    Channel      string
    SendBuffSize int

    Logger *flogging.FabricLogger

    Client    orderer.ClusterClient
    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 Uses

func (rc *RemoteContext) Abort()

Abort aborts the contexts the RemoteContext uses, thus effectively causes all operations that use this RemoteContext to terminate.

func (*RemoteContext) NewStream Uses

func (rc *RemoteContext) NewStream(timeout time.Duration) (*Stream, error)

NewStream creates a new stream. It is not thread safe, and Send() or Recv() block only until the timeout expires.

type RemoteNode Uses

type RemoteNode struct {
    // ID is unique among all members, and cannot be 0.
    ID  uint64
    // Endpoint is the endpoint of the node, denoted in %s:%d format
    Endpoint string
    // 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
}

RemoteNode represents a cluster member

func (RemoteNode) String Uses

func (rm RemoteNode) String() string

String returns a string representation of this RemoteNode

type RemoteVerifier Uses

type RemoteVerifier func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error

RemoteVerifier verifies the connection to the remote host

type Replicator Uses

type Replicator struct {
    DoNotPanicIfClusterNotReachable bool
    Filter                          ChannelPredicate
    SystemChannel                   string
    ChannelLister                   ChannelLister
    Logger                          *flogging.FabricLogger
    Puller                          *BlockPuller
    BootBlock                       *common.Block
    AmIPartOfChannel                SelfMembershipPredicate
    LedgerFactory                   LedgerFactory
}

Replicator replicates chains

func (*Replicator) IsReplicationNeeded Uses

func (r *Replicator) IsReplicationNeeded() (bool, error)

IsReplicationNeeded returns whether replication is needed, or the cluster node can resume standard boot flow.

func (*Replicator) PullChannel Uses

func (r *Replicator) PullChannel(channel string) error

PullChannel pulls the given channel from some orderer, and commits it to the ledger.

func (*Replicator) ReplicateChains Uses

func (r *Replicator) ReplicateChains() []string

ReplicateChains pulls chains and commits them. Returns the names of the chains replicated successfully.

type SecureDialer Uses

type SecureDialer interface {
    Dial(address string, verifyFunc RemoteVerifier) (*grpc.ClientConn, error)
}

SecureDialer connects to a remote address

type SelfMembershipPredicate Uses

type SelfMembershipPredicate func(configBlock *common.Block) error

SelfMembershipPredicate determines whether the caller is found in the given config block

type Service Uses

type Service struct {
    StreamCountReporter              *StreamCountReporter
    Dispatcher                       Dispatcher
    Logger                           *flogging.FabricLogger
    StepLogger                       *flogging.FabricLogger
    MinimumExpirationWarningInterval time.Duration
    CertExpWarningThreshold          time.Duration
}

Service defines the raft Service

func (*Service) Step Uses

func (s *Service) Step(stream orderer.Cluster_StepServer) error

Step passes an implementation-specific message to another cluster member.

type StandardDialer Uses

type StandardDialer struct {
    comm.ClientConfig
}

StandardDialer wraps an AtomicClientConfig, and provides a means to connect according to given EndpointCriteria.

func (*StandardDialer) Dial Uses

func (dialer *StandardDialer) Dial(endpointCriteria EndpointCriteria) (*grpc.ClientConn, error)

Dial dials an address according to the given EndpointCriteria

type StepClient Uses

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 StepStream Uses

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 Uses

type Stream struct {
    ID       uint64
    Channel  string
    NodeName string
    Endpoint string
    Logger   *flogging.FabricLogger
    Timeout  time.Duration
    orderer.Cluster_StepClient
    Cancel func(error)
    // contains filtered or unexported fields
}

Stream is used to send/receive messages to/from the remote cluster member.

func (*Stream) Canceled Uses

func (stream *Stream) Canceled() bool

Canceled returns whether the stream was canceled.

func (*Stream) Recv Uses

func (stream *Stream) Recv() (*orderer.StepResponse, error)

Recv receives a message from a remote cluster member.

func (*Stream) Send Uses

func (stream *Stream) Send(request *orderer.StepRequest) error

Send sends the given request to the remote cluster member.

type StreamCountReporter Uses

type StreamCountReporter struct {
    Metrics *Metrics
    // contains filtered or unexported fields
}

StreamCountReporter reports the number of streams currently connected to this node

func (*StreamCountReporter) Decrement Uses

func (scr *StreamCountReporter) Decrement()

func (*StreamCountReporter) Increment Uses

func (scr *StreamCountReporter) Increment()

type StreamOperation Uses

type StreamOperation func() (*orderer.StepResponse, error)

StreamOperation denotes an operation done by a stream, such a Send or Receive.

type StringSet Uses

type StringSet map[string]struct{}

StringSet is a set of strings

type Stub Uses

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 Uses

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) Active Uses

func (stub *Stub) Active() bool

Active returns whether the Stub is active or not

func (*Stub) Deactivate Uses

func (stub *Stub) Deactivate()

Deactivate deactivates the Stub and ceases all communication operations invoked on it.

type VerificationRegistry Uses

type VerificationRegistry struct {
    LoadVerifier       func(chain string) BlockVerifier
    Logger             *flogging.FabricLogger
    VerifierFactory    VerifierFactory
    VerifiersByChannel map[string]BlockVerifier
}

VerificationRegistry registers verifiers and retrieves them.

func (*VerificationRegistry) BlockCommitted Uses

func (vr *VerificationRegistry) BlockCommitted(block *common.Block, channel string)

BlockCommitted notifies the VerificationRegistry upon a block commit, which may trigger a registration of a verifier out of the block in case the block is a config block.

func (*VerificationRegistry) RegisterVerifier Uses

func (vr *VerificationRegistry) RegisterVerifier(chain string)

RegisterVerifier adds a verifier into the registry if applicable.

func (*VerificationRegistry) RetrieveVerifier Uses

func (vr *VerificationRegistry) RetrieveVerifier(channel string) BlockVerifier

RetrieveVerifier returns a BlockVerifier for the given channel, or nil if not found.

type VerifierFactory Uses

type VerifierFactory interface {
    // VerifierFromConfig creates a BlockVerifier from the given configuration.
    VerifierFromConfig(configuration *common.ConfigEnvelope, channel string) (BlockVerifier, error)
}

VerifierFactory creates BlockVerifiers.

type VerifierRetriever Uses

type VerifierRetriever interface {
    // RetrieveVerifier retrieves a BlockVerifier for the given channel.
    RetrieveVerifier(channel string) BlockVerifier
}

VerifierRetriever retrieves BlockVerifiers for channels.

Directories

PathSynopsis
mocks

Package cluster imports 33 packages (graph) and is imported by 4 packages. Updated 2019-06-18. Refresh now. Tools for package owners.