ordererconn

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Cft client support for crash fault tolerance.
	Cft = "CFT"
	// Bft client support for byzantine fault tolerance.
	Bft = "BFT"
	// DefaultConsensus default fault tolerance.
	DefaultConsensus = Cft

	// Broadcast support by endpoint.
	Broadcast = "broadcast"
	// Deliver support by endpoint.
	Deliver = "deliver"
)

Variables

View Source
var (
	ErrEmptyConnectionConfig = errors.New("empty connection config")
	ErrEmptyEndpoint         = errors.New("empty endpoint")
	ErrNoEndpoints           = errors.New("no endpoints")
)

Errors that may be returned when updating a configuration.

View Source
var (
	ErrInvalidEndpointKey = errors.New("invalid endpoint key")
	ErrInvalidEndpoint    = errors.New("invalid endpoint")
)

Orderer endpoints errors.

View Source
var ErrNoConnections = errors.New("no connections found")

ErrNoConnections may be returned when trying to get the next connection.

Functions

func NewIdentitySigner

func NewIdentitySigner(config *IdentityConfig) (msp.SigningIdentity, error)

NewIdentitySigner instantiate a signer for the given identity.

func ValidateConfig

func ValidateConfig(c *Config) error

ValidateConfig validate the configuration.

func ValidateConnectionConfig

func ValidateConnectionConfig(c *ConnectionConfig) error

ValidateConnectionConfig validate the configuration.

Types

type Config

type Config struct {
	Connection    ConnectionConfig `mapstructure:"connection"`
	ConsensusType string           `mapstructure:"consensus-type"`
	ChannelID     string           `mapstructure:"channel-id"`
	Identity      *IdentityConfig  `mapstructure:"identity"`
}

Config for the orderer-client.

type ConnFilter

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

ConnFilter is used to filter connections.

func WithAPI

func WithAPI(api string) ConnFilter

WithAPI filters for API.

func WithID

func WithID(id uint32) ConnFilter

WithID filters for ID.

type ConnectionConfig

type ConnectionConfig struct {
	Endpoints []*Endpoint              `mapstructure:"endpoints"`
	TLS       connection.TLSConfig     `mapstructure:"tls"`
	Retry     *connection.RetryProfile `mapstructure:"reconnect"`
}

ConnectionConfig contains the endpoints, CAs, and retry profile.

type ConnectionManager

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

ConnectionManager packs all the orderer connections. Its connections can be updated via the Update() method. This will increase the config version, allowing a connection instance to identify a connection update and fetch the new connections.

func (*ConnectionManager) CloseConnections added in v0.1.7

func (c *ConnectionManager) CloseConnections()

CloseConnections closes all the connections.

func (*ConnectionManager) GetConnection

func (c *ConnectionManager) GetConnection(filters ...ConnFilter) (*grpc.ClientConn, uint64)

GetConnection returns a connection given filters.

func (*ConnectionManager) GetConnectionPerID

func (c *ConnectionManager) GetConnectionPerID(filters ...ConnFilter) (map[uint32]*grpc.ClientConn, uint64)

GetConnectionPerID returns a connection given filters per ID.

func (*ConnectionManager) IsStale

func (c *ConnectionManager) IsStale(configVersion uint64) bool

IsStale checks if the given OrdererConnectionResiliencyManager is stale. If nil is given, it returns true.

func (*ConnectionManager) Update

func (c *ConnectionManager) Update(config *ConnectionConfig) error

Update updates the connection configs. This will close all connections, forcing the clients to reload.

type Endpoint

type Endpoint struct {
	connection.Endpoint `mapstructure:",squash" yaml:",inline"`
	// ID is the concenter's ID (party).
	ID    uint32 `mapstructure:"id" json:"id,omitempty" yaml:"id,omitempty"`
	MspID string `mapstructure:"msp-id" json:"msp-id,omitempty" yaml:"msp-id,omitempty"`
	// API should be broadcast and/or deliver.
	API []string `mapstructure:"api" json:"api,omitempty" yaml:"api,omitempty"`
}

Endpoint defines a party's endpoint.

func NewEndpoints

func NewEndpoints(id uint32, msp string, configs ...*connection.ServerConfig) []*Endpoint

NewEndpoints is a helper function to generate a list of Endpoint(s) from ServerConfig(s).

func ParseEndpoint

func ParseEndpoint(valueRaw string) (*Endpoint, error)

ParseEndpoint parses a string according to the following schema order (the first that succeeds). Schema 1: JSON. Schema 2: YAML. Schema 3: [id=ID,][msp-id=MspID,][broadcast,][deliver,][host=Host,][port=Port,][Host:Port].

func (*Endpoint) String

func (e *Endpoint) String() string

String returns a deterministic representation of the endpoint.

func (*Endpoint) SupportsAPI

func (e *Endpoint) SupportsAPI(api string) bool

SupportsAPI returns true if this endpoint supports API. It also returns true if no APIs are specified, as we cannot know.

type IdentityConfig

type IdentityConfig struct {
	// MspID indicates to which MSP this client belongs to.
	MspID  string               `mapstructure:"msp-id" yaml:"msp-id"`
	MSPDir string               `mapstructure:"msp-dir" yaml:"msp-dir"`
	BCCSP  *factory.FactoryOpts `mapstructure:"bccsp" yaml:"bccsp"`
}

IdentityConfig defines the orderer's MSP.

Jump to

Keyboard shortcuts

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