Documentation ¶
Index ¶
- Constants
- Variables
- func NewChannel(mspId, chanName string, peerPool api.PeerPool, orderer api.Orderer, ...) api.Channel
- func NewFromGRPC(conn *grpc.ClientConn, identity msp.SigningIdentity, tlsCertHash []byte, ...) (api.Peer, error)
- func NewPeer(dialCtx context.Context, c config.ConnectionConfig, ...) (api.Peer, error)
- func StrategyGRPC(d time.Duration) api.PeerPoolCheckStrategy
- type Channel
- type Client
- func (c *Client) Blocks(ctx context.Context, channel string, identity msp.SigningIdentity, ...) (blocks <-chan *common.Block, closer func() error, _ error)
- func (c *Client) Channel(name string) api.Channel
- func (c *Client) CryptoSuite() crypto.Suite
- func (c *Client) CurrentIdentity() msp.SigningIdentity
- func (c *Client) CurrentMspPeers() []api.Peer
- func (c *Client) Events(ctx context.Context, channel string, chaincode string, ...) (events ..., closer func() error, err error)
- func (c *Client) FabricV2() bool
- func (c *Client) Invoke(ctx context.Context, channel string, ccName string, args [][]byte, ...) (*fabPeer.Response, string, error)
- func (c *Client) PeerPool() api.PeerPool
- func (c *Client) Query(ctx context.Context, channel string, chaincode string, args [][]byte, ...) (*fabPeer.Response, error)
- type ErrUnexpectedStatus
- type Opt
- func WithConfigRaw(config config.Config) Opt
- func WithConfigYaml(configPath string) Opt
- func WithCrypto(crypto crypto.Suite) Opt
- func WithDefaultSigner(signer msp.SigningIdentity) Opt
- func WithDiscoverySigner(signer msp.SigningIdentity) Opt
- func WithFabricV2(fabricV2 bool) Opt
- func WithLogger(log *zap.Logger) Opt
- func WithOrderer(orderer api.Orderer) Opt
- func WithPeerPool(pool api.PeerPool) Opt
- func WithPeers(mspID string, peers []config.ConnectionConfig) Opt
- func WithSigner(signer msp.SigningIdentity) Opt
- type Orderer
- func (o *Orderer) Broadcast(ctx context.Context, envelope *common.Envelope) (resp *fabricOrderer.BroadcastResponse, err error)
- func (o *Orderer) Deliver(ctx context.Context, envelope *common.Envelope) (block *common.Block, err error)
- func (o *Orderer) GetConfigBlock(ctx context.Context, signer msp.SigningIdentity, channelName string) (*common.Block, error)
- type PeerPool
- func (p *PeerPool) Add(mspId string, peer api.Peer, peerChecker api.PeerPoolCheckStrategy) error
- func (p *PeerPool) Close() error
- func (p *PeerPool) DeliverClient(mspId string, identity msp.SigningIdentity) (api.DeliverClient, error)
- func (p *PeerPool) EndorseOnMSP(ctx context.Context, mspID string, proposal *peerproto.SignedProposal) (*peerproto.ProposalResponse, error)
- func (p *PeerPool) EndorseOnMSPs(ctx context.Context, mspIDs []string, proposal *peerproto.SignedProposal) ([]*peerproto.ProposalResponse, error)
- func (p *PeerPool) FirstReadyPeer(mspId string) (api.Peer, error)
- func (p *PeerPool) GetMSPPeers(mspID string) []api.Peer
- func (p *PeerPool) GetPeers() map[string][]api.Peer
Constants ¶
const ( ErrEmptyConfig = errors.Error(`empty config`) ErrInvalidPEMStructure = errors.Error(`invalid PEM structure`) ErrNoPeersForMSP = errors.Error(`no peers for MSP`) ErrMSPNotFound = errors.Error(`MSP not found`) ErrPeerNotReady = errors.Error(`peer not ready`) )
const ( // FnShowMaxLength limit to show fn name (args[0]) in debug and error messages FnShowMaxLength = 100 PeerDefaultDialTimeout = 5 * time.Second PeerDefaultEndorseTimeout = 5 * time.Second )
const (
OrdererDefaultDialTimeout = 5 * time.Second
)
Variables ¶
var ( ErrEmptyMSPConfig = errors.New(`empty MSP config`) ErrDiscoveryConnectionRequired = errors.New(`discovery connection required`) ErrDiscoverySignerRequired = errors.New(`discovery signer required`) )
var DefaultLogger, _ = zap.NewDevelopment()
var ErrEndorsingMSPsRequired = errors.New(`endorsing MSPs required`)
Functions ¶
func NewChannel ¶ added in v0.7.4
func NewFromGRPC ¶ added in v0.7.4
func NewFromGRPC(conn *grpc.ClientConn, identity msp.SigningIdentity, tlsCertHash []byte, logger *zap.Logger, endorseDefaultTimeout time.Duration) (api.Peer, error)
NewFromGRPC allows initializing peer from existing GRPC connection
func NewPeer ¶ added in v0.7.4
func NewPeer(dialCtx context.Context, c config.ConnectionConfig, identity msp.SigningIdentity, logger *zap.Logger) (api.Peer, error)
NewPeer returns new peer instance based on peer config
func StrategyGRPC ¶ added in v0.10.0
func StrategyGRPC(d time.Duration) api.PeerPoolCheckStrategy
Types ¶
type Channel ¶ added in v0.7.4
type Channel struct {
// contains filtered or unexported fields
}
type Client ¶ added in v0.10.0
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CryptoSuite ¶ added in v0.10.0
func (*Client) CurrentIdentity ¶ added in v0.10.0
func (c *Client) CurrentIdentity() msp.SigningIdentity
func (*Client) CurrentMspPeers ¶ added in v0.10.0
type ErrUnexpectedStatus ¶ added in v0.7.4
type ErrUnexpectedStatus struct {
// contains filtered or unexported fields
}
func (*ErrUnexpectedStatus) Error ¶ added in v0.7.4
func (e *ErrUnexpectedStatus) Error() string
type Opt ¶ added in v0.10.0
Opt describes opt which will be applied to coreOptions
func WithConfigRaw ¶
WithConfigRaw allows passing to Client created config instance
func WithConfigYaml ¶
WithConfigYaml allows passing path to YAML configuration file
func WithCrypto ¶ added in v0.6.3
WithCrypto allows to init Client crypto suite.
func WithDefaultSigner ¶ added in v0.10.0
func WithDefaultSigner(signer msp.SigningIdentity) Opt
func WithDiscoverySigner ¶ added in v0.10.0
func WithDiscoverySigner(signer msp.SigningIdentity) Opt
func WithFabricV2 ¶ added in v0.6.3
WithFabricV2 toggles Client to use fabric version 2.
func WithLogger ¶
WithLogger allows to pass custom copy of zap.Logger insteadof logger.DefaultLogger
func WithOrderer ¶
WithOrderer allows using custom instance of orderer in Client
func WithPeerPool ¶
WithPeerPool allows adding custom peer pool
func WithPeers ¶ added in v0.6.3
func WithPeers(mspID string, peers []config.ConnectionConfig) Opt
WithPeers allows to init Client with peers for specified mspID.
func WithSigner ¶ added in v0.10.0
func WithSigner(signer msp.SigningIdentity) Opt
type Orderer ¶ added in v0.7.4
type Orderer struct {
// contains filtered or unexported fields
}
func NewOrderer ¶ added in v0.7.4
func NewOrdererFromGRPC ¶ added in v0.7.4
func NewOrdererFromGRPC(conn *grpc.ClientConn) (*Orderer, error)
NewOrdererFromGRPC allows initializing orderer from existing GRPC connection
func (*Orderer) Broadcast ¶ added in v0.7.4
func (o *Orderer) Broadcast(ctx context.Context, envelope *common.Envelope) (resp *fabricOrderer.BroadcastResponse, err error)
type PeerPool ¶ added in v0.7.4
type PeerPool struct {
// contains filtered or unexported fields
}
func (*PeerPool) DeliverClient ¶ added in v0.7.4
func (p *PeerPool) DeliverClient(mspId string, identity msp.SigningIdentity) (api.DeliverClient, error)
func (*PeerPool) EndorseOnMSP ¶ added in v0.7.4
func (p *PeerPool) EndorseOnMSP(ctx context.Context, mspID string, proposal *peerproto.SignedProposal) (*peerproto.ProposalResponse, error)
EndorseOnMSP finds first ready peer in pool for specified mspId , endorses proposal and returns proposal response - no load balancing between msp peers - no data is not sent to the orderer
func (*PeerPool) EndorseOnMSPs ¶ added in v0.7.4
func (p *PeerPool) EndorseOnMSPs(ctx context.Context, mspIDs []string, proposal *peerproto.SignedProposal) ([]*peerproto.ProposalResponse, error)