engine

package
v0.0.0-...-77adb20 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsensusEngine

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

ConsensusEngine is the actor that coordinates State, Service and Consensus

func NewConsensusEngine

func NewConsensusEngine(config config.Config,
	consensus consensus.Consensus,
	logger *logrus.Logger) (*ConsensusEngine, error)

NewConsensusEngine instantiates a new ConsensusEngine with coupled State, Service, and Consensus

func (*ConsensusEngine) Run

func (e *ConsensusEngine) Run() error

Run starts the engine's Service asynchronously and starts the Consensus system synchronously

type Engine

type Engine interface {
	Run()
}

type Handler

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

Implements proxy.ProxyHandler interface

func NewHandler

func NewHandler(state *state.State) *Handler

func (*Handler) CommitHandler

func (h *Handler) CommitHandler(block poset.Block) (stateHash []byte, err error)

Called when a new block is coming. This particular example just computes the stateHash incrementally with incoming blocks

func (*Handler) RestoreHandler

func (h *Handler) RestoreHandler(snapshot []byte) (stateHash []byte, err error)

Called when syncing with the network

func (*Handler) SnapshotHandler

func (h *Handler) SnapshotHandler(blockIndex int) (snapshot []byte, err error)

Called when syncing with the network

type InmemEngine

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

func NewInmemEngine

func NewInmemEngine(config config.Config, logger *logrus.Logger) (*InmemEngine, error)

func (*InmemEngine) Run

func (i *InmemEngine) Run() error

type InmemProxy

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

InmemProxy implements the AppProxy interface

func NewInmemProxy

func NewInmemProxy(state *state.State,
	service *service.Service,
	submitCh chan []byte,
	logger *logrus.Logger) *InmemProxy

NewInmemProxy initializes and return a new InmemProxy

func (*InmemProxy) CommitBlock

func (i *InmemProxy) CommitBlock(block poset.Block) ([]byte, error)

CommitBlock commits Block to the State and expects the resulting state hash

func (*InmemProxy) GetSnapshot

func (i *InmemProxy) GetSnapshot(blockIndex int64) ([]byte, error)

TODO - Implement these two functions

func (*InmemProxy) Restore

func (i *InmemProxy) Restore(snapshot []byte) error

func (*InmemProxy) SubmitCh

func (i *InmemProxy) SubmitCh() chan []byte

SubmitCh is the channel through which the Service sends transactions to the node.

func (*InmemProxy) SubmitInternalCh

func (i *InmemProxy) SubmitInternalCh() chan poset.InternalTransaction

type SocketEngine

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

func NewSocketEngine

func NewSocketEngine(config config.Config, logger *logrus.Logger) (*SocketEngine, error)

func (*SocketEngine) Run

func (s *SocketEngine) Run() error

Jump to

Keyboard shortcuts

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