client

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 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 added in v0.7.3

func DefaultCryptoSuite() api.CryptoSuite

func New added in v0.7.4

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

func NewChannel added in v0.7.4

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 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

Types

type Channel added in v0.7.4

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

func (*Channel) Chaincode added in v0.7.4

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 added in v0.7.4

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 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

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 added in v0.6.3

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

WithPeers allows to init core with peers for specified mspID.

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 NewOrderer(dialCtx context.Context, c config.ConnectionConfig, logger *zap.Logger) (*Orderer, error)

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)

func (*Orderer) Deliver added in v0.7.4

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

func (*Orderer) GetConfigBlock added in v0.7.4

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

GetConfigBlock returns config block by channel name

type PeerPool added in v0.7.4

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

func NewPeerPool added in v0.7.4

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

func (*PeerPool) Add added in v0.7.4

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

func (*PeerPool) Close added in v0.7.4

func (p *PeerPool) Close() error

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)

func (*PeerPool) FirstReadyPeer added in v0.7.4

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

func (*PeerPool) GetMSPPeers added in v0.7.4

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

func (*PeerPool) GetPeers added in v0.7.4

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