client

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FnShowMaxLength limit to show fn name (args[0]) in debug and error messages
	FnShowMaxLength = 100

	PeerDefaultDialTimeout    = 5 * time.Second
	PeerDefaultEndorseTimeout = 5 * time.Second
)
View Source
const (
	OrdererDefaultDialTimeout = 5 * time.Second
)

Variables

View Source
var DefaultLogger, _ = zap.NewDevelopment()
View Source
var ErrEndorsingMSPsRequired = errors.New(`endorsing MSPs required`)

Functions

func DefaultCryptoSuite

func DefaultCryptoSuite() api.CryptoSuite

func New

func New(identity api.Identity, opts ...CoreOpt) (api.Core, error)

func NewChannel

func NewChannel(
	mspId, chanName string,
	peerPool api.PeerPool,
	orderer api.Orderer,
	dp api.DiscoveryProvider,
	identity msp.SigningIdentity,
	fabricV2 bool,
	log *zap.Logger,
) api.Channel

func NewFromGRPC

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

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

Types

type Channel

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

func (*Channel) Chaincode

func (c *Channel) Chaincode(serviceDiscCtx context.Context, ccName string) (api.Chaincode, error)

Chaincode - returns interface with actions over chaincode ctx is necessary for service discovery

func (*Channel) Join

func (c *Channel) Join(ctx context.Context) error

type CoreOpt

type CoreOpt func(c *core) error

CoreOpt describes opt which will be applied to coreOptions

func WithConfigRaw

func WithConfigRaw(config config.Config) CoreOpt

WithConfigRaw allows passing to core created config instance

func WithConfigYaml

func WithConfigYaml(configPath string) CoreOpt

WithConfigYaml allows passing path to YAML configuration file

func WithContext

func WithContext(ctx context.Context) CoreOpt

WithContext allows passing custom context. Otherwise, context.Background is used

func WithCrypto

func WithCrypto(cc config.CryptoConfig) CoreOpt

WithCrypto allows to init core crypto suite.

func WithFabricV2

func WithFabricV2(fabricV2 bool) CoreOpt

WithFabricV2 toggles core to use fabric version 2.

func WithLogger

func WithLogger(log *zap.Logger) CoreOpt

WithLogger allows to pass custom copy of zap.Logger insteadof logger.DefaultLogger

func WithOrderer

func WithOrderer(orderer api.Orderer) CoreOpt

WithOrderer allows using custom instance of orderer in core

func WithPeerPool

func WithPeerPool(pool api.PeerPool) CoreOpt

WithPeerPool allows adding custom peer pool

func WithPeers

func WithPeers(mspID string, peers []config.ConnectionConfig) CoreOpt

WithPeers allows to init core with peers for specified mspID.

type ErrUnexpectedStatus

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

func (*ErrUnexpectedStatus) Error

func (e *ErrUnexpectedStatus) Error() string

type Orderer

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

func NewOrderer

func NewOrderer(dialCtx context.Context, c config.ConnectionConfig, logger *zap.Logger) (*Orderer, error)

func NewOrdererFromGRPC

func NewOrdererFromGRPC(conn *grpc.ClientConn) (*Orderer, error)

NewOrdererFromGRPC allows initializing orderer from existing GRPC connection

func (*Orderer) Broadcast

func (o *Orderer) Broadcast(ctx context.Context, envelope *common.Envelope) (resp *fabricOrderer.BroadcastResponse, err error)

func (*Orderer) Deliver

func (o *Orderer) Deliver(ctx context.Context, envelope *common.Envelope) (block *common.Block, err error)

func (*Orderer) GetConfigBlock

func (o *Orderer) GetConfigBlock(ctx context.Context, signer msp.SigningIdentity, channelName string) (*common.Block, error)

GetConfigBlock returns config block by channel name

type PeerPool

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

func NewPeerPool

func NewPeerPool(ctx context.Context, log *zap.Logger) *PeerPool

func (*PeerPool) Add

func (p *PeerPool) Add(mspId string, peer api.Peer, peerChecker api.PeerPoolCheckStrategy) error

func (*PeerPool) Close

func (p *PeerPool) Close() error

func (*PeerPool) DeliverClient

func (p *PeerPool) DeliverClient(mspId string, identity msp.SigningIdentity) (api.DeliverClient, error)

func (*PeerPool) EndorseOnMSP

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

func (p *PeerPool) EndorseOnMSPs(ctx context.Context, mspIDs []string, proposal *peerproto.SignedProposal) ([]*peerproto.ProposalResponse, error)

func (*PeerPool) FirstReadyPeer

func (p *PeerPool) FirstReadyPeer(mspId string) (api.Peer, error)

func (*PeerPool) GetMSPPeers

func (p *PeerPool) GetMSPPeers(mspID string) []api.Peer

func (*PeerPool) GetPeers

func (p *PeerPool) GetPeers() map[string][]api.Peer

Directories

Path Synopsis
system
Package system is a reverse proxy.
Package system is a reverse proxy.

Jump to

Keyboard shortcuts

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