Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultCryptoSuite() api.CryptoSuite
- func New(identity api.Identity, opts ...CoreOpt) (api.Core, error)
- 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)
- type Channel
- type CoreOpt
- func WithConfigRaw(config config.Config) CoreOpt
- func WithConfigYaml(configPath string) CoreOpt
- func WithContext(ctx context.Context) CoreOpt
- func WithCrypto(cc config.CryptoConfig) CoreOpt
- func WithFabricV2(fabricV2 bool) CoreOpt
- func WithLogger(log *zap.Logger) CoreOpt
- func WithOrderer(orderer api.Orderer) CoreOpt
- func WithPeerPool(pool api.PeerPool) CoreOpt
- func WithPeers(mspID string, peers []config.ConnectionConfig) CoreOpt
- type ErrUnexpectedStatus
- 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 ( // 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 DefaultLogger, _ = zap.NewDevelopment()
var ErrEndorsingMSPsRequired = errors.New(`endorsing MSPs required`)
Functions ¶
func DefaultCryptoSuite ¶ added in v0.7.3
func DefaultCryptoSuite() api.CryptoSuite
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
Types ¶
type Channel ¶ added in v0.7.4
type Channel struct {
// contains filtered or unexported fields
}
type CoreOpt ¶
type CoreOpt func(c *core) error
CoreOpt describes opt which will be applied to coreOptions
func WithConfigRaw ¶
WithConfigRaw allows passing to core created config instance
func WithConfigYaml ¶
WithConfigYaml allows passing path to YAML configuration file
func WithContext ¶
WithContext allows passing custom context. Otherwise, context.Background is used
func WithCrypto ¶ added in v0.6.3
func WithCrypto(cc config.CryptoConfig) CoreOpt
WithCrypto allows to init core crypto suite.
func WithFabricV2 ¶ added in v0.6.3
WithFabricV2 toggles core 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 core
func WithPeerPool ¶
WithPeerPool allows adding custom peer pool
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 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)