etcdraft

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

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

Chain implements consensus.Chain interface.

func NewChain

func NewChain(support consensus.ConsenterSupport, opts Options, observe chan<- uint64) (*Chain, error)

NewChain returns a new chain.

func (*Chain) Configure

func (c *Chain) Configure(env *common.Envelope, configSeq uint64) error

Configure submits config type transactions for ordering.

func (*Chain) Errored

func (c *Chain) Errored() <-chan struct{}

Errored returns a channel that closes when the chain stops.

func (*Chain) Halt

func (c *Chain) Halt()

Halt stops the chain.

func (*Chain) Order

func (c *Chain) Order(env *common.Envelope, configSeq uint64) error

Order submits normal type transactions for ordering.

func (*Chain) Start

func (c *Chain) Start()

Start instructs the orderer to begin serving the chain and keep it current.

func (*Chain) Submit

func (c *Chain) Submit(req *orderer.SubmitRequest, sender uint64) error

Submit forwards the incoming request to: - the local serveRequest goroutine if this is leader - the actual leader via the transport mechanism The call fails if there's no leader elected yet.

func (*Chain) WaitReady

func (c *Chain) WaitReady() error

WaitReady is currently a no-op.

type Dispatcher

type Dispatcher struct {
	Logger        *flogging.FabricLogger
	ChainSelector ReceiverGetter
}

Dispatcher dispatches Submit and Step requests to the designated per chain instances

func (*Dispatcher) OnStep

func (d *Dispatcher) OnStep(channel string, sender uint64, request *orderer.StepRequest) (*orderer.StepResponse, error)

OnStep notifies the Dispatcher for a reception of a StepRequest from a given sender on a given channel

func (*Dispatcher) OnSubmit

func (d *Dispatcher) OnSubmit(channel string, sender uint64, request *orderer.SubmitRequest) (*orderer.SubmitResponse, error)

OnSubmit notifies the Dispatcher for a reception of a SubmitRequest from a given sender on a given channel

type MessageReceiver

type MessageReceiver interface {
	// Step passes the given StepRequest message to the MessageReceiver
	Step(req *orderer.StepRequest, sender uint64) error

	// Submit passes the given SubmitRequest message to the MessageReceiver
	Submit(req *orderer.SubmitRequest, sender uint64) error
}

MessageReceiver receives messages

type Options

type Options struct {
	RaftID uint64

	Clock clock.Clock

	Storage Storage
	Logger  *flogging.FabricLogger

	TickInterval    time.Duration
	ElectionTick    int
	HeartbeatTick   int
	MaxSizePerMsg   uint64
	MaxInflightMsgs int
	Peers           []raft.Peer
}

Options contains all the configurations relevant to the chain.

type ReceiverGetter

type ReceiverGetter interface {
	// ReceiverByChain returns the MessageReceiver if it exists, or nil if it doesn't
	ReceiverByChain(channelID string) MessageReceiver
}

ReceiverGetter obtains instances of MessageReceiver given a channel ID

type Storage

type Storage interface {
	raft.Storage
	Append(entries []raftpb.Entry) error
}

Storage is currently backed by etcd/raft.MemoryStorage. This interface is defined to expose dependencies of fsm so that it may be swapped in the future. TODO(jay) Add other necessary methods to this interface once we need them in implementation, e.g. ApplySnapshot.

Directories

Path Synopsis
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.

Jump to

Keyboard shortcuts

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