consensus

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2016 License: Apache-2.0 Imports: 2 Imported by: 145

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Communicator

type Communicator interface {
	Broadcast(msg *pb.OpenchainMessage, peerType pb.PeerEndpoint_Type) error
	Unicast(msg *pb.OpenchainMessage, receiverHandle *pb.PeerID) error
}

Communicator is used to send messages to other validators

type Consenter

type Consenter interface {
	RecvMsg(msg *pb.OpenchainMessage, senderHandle *pb.PeerID) error
}

Consenter is used to receive messages from the network Every consensus plugin needs to implement this interface

type Executor

type Executor interface {
	BeginTxBatch(id interface{}) error
	ExecTxs(id interface{}, txs []*pb.Transaction) ([]byte, error)
	CommitTxBatch(id interface{}, metadata []byte) (*pb.Block, error)
	RollbackTxBatch(id interface{}) error
	PreviewCommitTxBatch(id interface{}, metadata []byte) (*pb.Block, error)
}

Executor is used to invoke transactions, potentially modifying the backing ledger

type Inquirer

type Inquirer interface {
	GetNetworkInfo() (self *pb.PeerEndpoint, network []*pb.PeerEndpoint, err error)
	GetNetworkHandles() (self *pb.PeerID, network []*pb.PeerID, err error)
}

Inquirer is used to retrieve info about the validating network

type Ledger

type Ledger interface {
	ReadOnlyLedger
	UtilLedger
	WritableLedger
}

Ledger is an unrestricted union of reads, utilities, and updates

type LedgerStack

type LedgerStack interface {
	Executor
	Ledger
	RemoteLedgers
}

LedgerStack serves as interface to the blockchain-oriented activities, such as executing transactions, querying, and updating the ledger

type ReadOnlyLedger

type ReadOnlyLedger interface {
	GetBlock(id uint64) (block *pb.Block, err error)
	GetCurrentStateHash() (stateHash []byte, err error)
	GetBlockchainSize() (uint64, error)
}

ReadOnlyLedger is used for interrogating the blockchain

type RemoteLedgers

type RemoteLedgers interface {
	GetRemoteBlocks(replicaID *pb.PeerID, start, finish uint64) (<-chan *pb.SyncBlocks, error)
	GetRemoteStateSnapshot(replicaID *pb.PeerID) (<-chan *pb.SyncStateSnapshot, error)
	GetRemoteStateDeltas(replicaID *pb.PeerID, start, finish uint64) (<-chan *pb.SyncStateDeltas, error)
}

RemoteLedgers is used to interrogate the blockchain of other replicas

type SecurityUtils

type SecurityUtils interface {
	Sign(msg []byte) ([]byte, error)
	Verify(peerID *pb.PeerID, signature []byte, message []byte) error
}

SecurityUtils is used to access the sign/verify methods from the crypto package

type Stack

type Stack interface {
	Inquirer
	Communicator
	SecurityUtils
	LedgerStack
}

Stack is the set of stack-facing methods available to the consensus plugin

type UtilLedger

type UtilLedger interface {
	HashBlock(block *pb.Block) ([]byte, error)
	VerifyBlockchain(start, finish uint64) (uint64, error)
}

UtilLedger contains additional useful utility functions for interrogating the blockchain

type WritableLedger

type WritableLedger interface {
	PutBlock(blockNumber uint64, block *pb.Block) error
	ApplyStateDelta(id interface{}, delta *statemgmt.StateDelta) error
	CommitStateDelta(id interface{}) error
	RollbackStateDelta(id interface{}) error
	EmptyState() error
}

WritableLedger is useful for updating the blockchain during state transfer

Directories

Path Synopsis
Package obcpbft is a generated protocol buffer package.
Package obcpbft is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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