deliver

package
v0.0.0-...-3d6c228 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractChannelHeaderCertHash

func ExtractChannelHeaderCertHash(msg proto.Message) []byte

ExtractChannelHeaderCertHash extracts the TLS cert hash from a channel header.

Types

type Chain

type Chain interface {
	// Sequence returns the current config sequence number, can be used to detect config changes
	Sequence() uint64

	// PolicyManager returns the current policy manager as specified by the chain configuration
	PolicyManager() policies.Manager

	// Reader returns the chain Reader for the chain
	Reader() blockledger.Reader

	// Errored returns a channel which closes when the backing consenter has errored
	Errored() <-chan struct{}
}

Chain encapsulates chain operations and data.

type ChainManager

type ChainManager interface {
	GetChain(chainID string) Chain
}

ChainManager provides a way for the Handler to look up the Chain.

type Filtered

type Filtered interface {
	IsFiltered() bool
}

Filtered is a marker interface that indicates a response sender is configured to send filtered blocks

type Handler

type Handler struct {
	ExpirationCheckFunc func(identityBytes []byte) time.Time
	ChainManager        ChainManager
	TimeWindow          time.Duration
	BindingInspector    Inspector
	Metrics             *Metrics
}

Handler handles server requests.

func NewHandler

func NewHandler(cm ChainManager, timeWindow time.Duration, mutualTLS bool, metrics *Metrics, expirationCheckDisabled bool) *Handler

NewHandler creates an implementation of the Handler interface.

func (*Handler) Handle

func (h *Handler) Handle(ctx context.Context, srv *Server) error

Handle receives incoming deliver requests.

type Inspector

type Inspector interface {
	Inspect(context.Context, proto.Message) error
}

Inspector verifies an appropriate binding between the message and the context.

type InspectorFunc

type InspectorFunc func(context.Context, proto.Message) error

The InspectorFunc is an adapter that allows the use of an ordinary function as an Inspector.

func (InspectorFunc) Inspect

func (inspector InspectorFunc) Inspect(ctx context.Context, p proto.Message) error

Inspect calls inspector(ctx, p)

type PolicyChecker

type PolicyChecker interface {
	CheckPolicy(envelope *cb.Envelope, channelID string) error
}

PolicyChecker checks the envelope against the policy logic supplied by the function.

type PolicyCheckerFunc

type PolicyCheckerFunc func(envelope *cb.Envelope, channelID string) error

The PolicyCheckerFunc is an adapter that allows the use of an ordinary function as a PolicyChecker.

func (PolicyCheckerFunc) CheckPolicy

func (pcf PolicyCheckerFunc) CheckPolicy(envelope *cb.Envelope, channelID string) error

CheckPolicy calls pcf(envelope, channelID)

type Receiver

type Receiver interface {
	Recv() (*cb.Envelope, error)
}

Receiver is used to receive enveloped seek requests.

type ResponseSender

type ResponseSender interface {
	SendStatusResponse(status cb.Status) error
	SendBlockResponse(block *cb.Block) error
}

ResponseSender defines the interface a handler must implement to send responses.

type Server

type Server struct {
	Receiver
	PolicyChecker
	ResponseSender
}

Server is a polymorphic structure to support generalization of this handler to be able to deliver different type of responses.

Jump to

Keyboard shortcuts

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