Documentation
¶
Index ¶
- Constants
- Variables
- func NewIdentitySigner(config *IdentityConfig) (msp.SigningIdentity, error)
- func ValidateConfig(c *Config) error
- func ValidateConnectionConfig(c *ConnectionConfig) error
- type Config
- type ConnFilter
- type ConnectionConfig
- type ConnectionManager
- func (c *ConnectionManager) CloseConnections()
- func (c *ConnectionManager) GetConnection(filters ...ConnFilter) (*grpc.ClientConn, uint64)
- func (c *ConnectionManager) GetConnectionPerID(filters ...ConnFilter) (map[uint32]*grpc.ClientConn, uint64)
- func (c *ConnectionManager) IsStale(configVersion uint64) bool
- func (c *ConnectionManager) Update(config *ConnectionConfig) error
- type Endpoint
- type IdentityConfig
Constants ¶
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 ¶
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.
var ( ErrInvalidEndpointKey = errors.New("invalid endpoint key") ErrInvalidEndpoint = errors.New("invalid endpoint") )
Orderer endpoints errors.
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 ¶
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.
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 ¶
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) SupportsAPI ¶
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.