ordering

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BroadcastReceive

func BroadcastReceive(broadcast Broadcast, addr string, responses chan common.Status, errs chan error)

BroadcastReceive waits until it receives the response from broadcast stream

func BroadcastSend

func BroadcastSend(broadcast Broadcast, envelope *common.Envelope) error

BroadcastSend sends transaction envelope to orderer Service

func BroadcastWaitForResponse

func BroadcastWaitForResponse(responses chan common.Status, errs chan error) (common.Status, error)

BroadcastWaitForResponse reads from response and errs chans until responses chan is closed

Types

type BFTBroadcaster added in v0.3.0

type BFTBroadcaster struct {
	Network Network
	// contains filtered or unexported fields
}

func NewBFTBroadcaster added in v0.3.0

func NewBFTBroadcaster(network Network, poolSize int, metrics *metrics.Metrics) *BFTBroadcaster

func (*BFTBroadcaster) Broadcast added in v0.3.0

func (o *BFTBroadcaster) Broadcast(context context.Context, env *common2.Envelope) error

type Broadcast

type Broadcast interface {
	Send(m *common.Envelope) error
	Recv() (*ab.BroadcastResponse, error)
	CloseSend() error
}

Broadcast defines the interface that abstracts grpc calls to broadcast transactions to orderer

type BroadcastFnc added in v0.3.0

type BroadcastFnc = func(context context.Context, env *common2.Envelope) error

type CFTBroadcaster added in v0.3.0

type CFTBroadcaster struct {
	Network Network
	// contains filtered or unexported fields
}

func NewCFTBroadcaster added in v0.3.0

func NewCFTBroadcaster(network Network, poolSize int, metrics *metrics.Metrics) *CFTBroadcaster

func (*CFTBroadcaster) Broadcast added in v0.3.0

func (o *CFTBroadcaster) Broadcast(context context.Context, env *common2.Envelope) error

type Client added in v0.3.0

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

Client implements OrdererClient interface

func NewClient added in v0.3.0

func NewClient(config *grpc2.ConnectionConfig) (*Client, error)

func (*Client) Certificate added in v0.3.0

func (oc *Client) Certificate() *tls.Certificate

func (*Client) Close added in v0.3.0

func (oc *Client) Close()

func (*Client) NewBroadcast added in v0.3.0

func (oc *Client) NewBroadcast(ctx context.Context, opts ...grpc.CallOption) (Broadcast, error)

NewBroadcast creates a Broadcast

type Connection added in v0.3.0

type Connection struct {
	Stream Broadcast
	Client *Client
	// contains filtered or unexported fields
}

func (*Connection) Recv added in v0.3.0

func (c *Connection) Recv() (*ab.BroadcastResponse, error)

func (*Connection) Send added in v0.3.0

func (c *Connection) Send(m *common.Envelope) error

type Network

type Network interface {
	Name() string
	PickOrderer() *grpc.ConnectionConfig
	Orderers() []*grpc.ConnectionConfig
	LocalMembership() driver.LocalMembership
	// Broadcast sends the passed blob to the ordering Service to be ordered
	Broadcast(context context2.Context, blob interface{}) error
	Channel(name string) (driver.Channel, error)
	SignerService() driver.SignerService
	Config() *config.Config
}

type OrdererClient

type OrdererClient interface {
	// NewBroadcast returns a Broadcast
	NewBroadcast(ctx context.Context, opts ...grpc.CallOption) (Broadcast, error)

	// Certificate returns tls certificate for the orderer client
	Certificate() *tls.Certificate

	Close()
}

OrdererClient defines the interface to create a Broadcast

type Service added in v0.3.0

type Service struct {
	SP      view2.ServiceProvider
	Network Network
	Metrics *metrics.Metrics

	Broadcasters   map[string]BroadcastFnc
	BroadcastMutex sync.RWMutex
	Broadcaster    BroadcastFnc
}

func NewService

func NewService(sp view2.ServiceProvider, network Network, poolSize int, metrics *metrics.Metrics) *Service

func (*Service) Broadcast added in v0.3.0

func (o *Service) Broadcast(ctx context2.Context, blob interface{}) error

func (*Service) SetConsensusType added in v0.3.0

func (o *Service) SetConsensusType(consensusType string) error

type Signer

type Signer interface {
	// Sign the message
	Sign(msg []byte) ([]byte, error)
}

type Transaction

type Transaction interface {
	Channel() string
	ID() string
	Creator() view.Identity
	Proposal() driver.Proposal
	ProposalResponses() []driver.ProposalResponse
	Bytes() ([]byte, error)
}

type ViewManager

type ViewManager interface {
	InitiateView(view view.View) (interface{}, error)
}

Jump to

Keyboard shortcuts

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