Documentation
¶
Overview ¶
Package client connects to the Fabric-X orderer. It combines the user identity and client-TLS material (user.Config) with the orderer connection information read from a config block (ordererconn.Info) to sign and send seek and broadcast envelopes to assemblers and routers.
Index ¶
- func ReadConfigBlock(path string) (*cb.Block, error)
- func SequenceFromBlock(block *cb.Block) (uint64, error)
- func WriteBlock(block *cb.Block, path string) error
- type Client
- func (c *Client) AssemblerEndpoints() []string
- func (c *Client) BroadcastToAllRouters(envelope *cb.Envelope) ([]RouterStatus, error)
- func (c *Client) ChannelID() string
- func (c *Client) FaultThreshold() int
- func (c *Client) FetchBlock(seek *ab.SeekInfo) (*cb.Block, error)
- func (c *Client) FetchLedgerStatus(ctx context.Context, endpoint string) (LedgerStatus, error)
- func (c *Client) NumParties() int
- type LedgerStatus
- type RouterStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadConfigBlock ¶
ReadConfigBlock reads and unmarshals a protobuf config block from path. It is shared by the commands that take a --current-block file.
func SequenceFromBlock ¶
SequenceFromBlock returns the config sequence recorded in a config block's configuration envelope. It reads the sequence field directly rather than building a channel config bundle, so it needs no BCCSP.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client sends signed seek and broadcast envelopes to the orderer using the user identity for signing and TLS.
func LoadFromFiles ¶
LoadFromFiles builds a Client from the user configuration YAML at configPath and the config block at blockPath, using csp to build the channel config bundle.
func LoadWithConnInfo ¶
LoadWithConnInfo builds a Client that dials the orderer described by info, signing with the identity in config.
func (*Client) AssemblerEndpoints ¶
AssemblerEndpoints returns the assembler endpoints the client targets, in config-block order.
func (*Client) BroadcastToAllRouters ¶
func (c *Client) BroadcastToAllRouters(envelope *cb.Envelope) ([]RouterStatus, error)
BroadcastToAllRouters sends a prepared envelope to every router and returns one RouterStatus per router, in endpoint order, reporting whether each router acknowledged the envelope. The envelope must already be built and signed by the caller (e.g. a prepared configuration transaction). It returns an error only when no routers are configured; individual router rejections and unreachable routers are carried in the returned statuses.
func (*Client) FaultThreshold ¶
FaultThreshold returns f, the number of faulty parties the network tolerates, derived from the number of parties: f = (n-1)/3.
func (*Client) FetchBlock ¶
FetchBlock seeks the block described by seek from the first reachable assembler, failing over to the next assembler on error.
func (*Client) FetchLedgerStatus ¶
FetchLedgerStatus returns the ledger status of a single assembler. It seeks the assembler's newest block (whose number is the ledger's last block), follows its last-config index to the config block, and reads that block's sequence. Unlike FetchBlock, it targets one endpoint and does not fail over, so callers (e.g. `fxadmin follow`) can track each assembler's ledger independently. ctx bounds the whole operation, including both underlying block fetches.
func (*Client) NumParties ¶
NumParties returns the number of parties in the network the client targets, as read from the config block's ARMA shared config.
type LedgerStatus ¶
LedgerStatus summarizes a single assembler's ledger: the number of its newest block (its height indicator), the config sequence of its last config block, and the last config block itself.
type RouterStatus ¶
RouterStatus is the outcome of broadcasting an envelope to a single router. Err is nil when the router acknowledged the envelope with status SUCCESS, and otherwise describes the rejection or the reason the router was unreachable.