order

package
v1.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ID                 uint64
	RepoRoot           string
	StoragePath        string
	PluginPath         string
	PeerMgr            peermgr.PeerManager
	PrivKey            crypto.PrivateKey
	Logger             logrus.FieldLogger
	Nodes              map[uint64]types.Address
	Applied            uint64
	Digest             string
	GetTransactionFunc func(hash types.Hash) (*pb.Transaction, error)
	GetChainMetaFunc   func() *pb.ChainMeta
}

func GenerateConfig

func GenerateConfig(opts ...Option) (*Config, error)

type Option

type Option func(*Config)

func WithApplied

func WithApplied(height uint64) Option

func WithDigest

func WithDigest(digest string) Option

func WithGetChainMetaFunc

func WithGetChainMetaFunc(f func() *pb.ChainMeta) Option

func WithGetTransactionFunc

func WithGetTransactionFunc(f func(hash types.Hash) (*pb.Transaction, error)) Option

func WithID

func WithID(id uint64) Option

func WithLogger

func WithLogger(logger logrus.FieldLogger) Option

func WithNodes

func WithNodes(nodes map[uint64]types.Address) Option

func WithPeerManager

func WithPeerManager(peerMgr peermgr.PeerManager) Option

func WithPluginPath

func WithPluginPath(path string) Option

func WithPrivKey

func WithPrivKey(privKey crypto.PrivateKey) Option

func WithRepoRoot

func WithRepoRoot(path string) Option

func WithStoragePath

func WithStoragePath(path string) Option

type Order

type Order interface {
	// Start the order service.
	Start() error

	// Stop means frees the resources which were allocated for this service.
	Stop()

	// Prepare means send transaction to the consensus engine
	Prepare(tx *pb.Transaction) error

	// Commit recv blocks form Order and commit it by order
	Commit() chan *pb.Block

	// Step send msg to the consensus engine
	Step(ctx context.Context, msg []byte) error

	// Ready means whether order has finished electing leader
	Ready() bool

	// ReportState means block was persisted and report it to the consensus engine
	ReportState(height uint64, hash types.Hash)

	// Quorum means minimum number of nodes in the cluster that can work
	Quorum() uint64
}

type ReqLookUp

type ReqLookUp struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewReqLookUp

func NewReqLookUp(storage storage.Storage, logger logrus.FieldLogger) (*ReqLookUp, error)

func (*ReqLookUp) Add

func (r *ReqLookUp) Add(key []byte)

func (*ReqLookUp) Build

func (r *ReqLookUp) Build() error

func (*ReqLookUp) LookUp

func (r *ReqLookUp) LookUp(key []byte) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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