simplebft

package
v1.0.0-alpha2 Latest Latest
Warning

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

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

Documentation

Overview

Package simplebft is a generated protocol buffer package.

It is generated from these files:

simplebft/simplebft.proto

It has these top-level messages:

Config
MultiChainMsg
Msg
Request
SeqView
BatchHeader
Batch
Preprepare
Subject
ViewChange
Signed
NewView
Checkpoint
Hello

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	Header     []byte            `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	Payloads   [][]byte          `protobuf:"bytes,2,rep,name=payloads,proto3" json:"payloads,omitempty"`
	Signatures map[uint64][]byte `` /* 148-byte string literal not displayed */
}

func (*Batch) DecodeHeader

func (b *Batch) DecodeHeader() *BatchHeader

func (*Batch) Descriptor

func (*Batch) Descriptor() ([]byte, []int)

func (*Batch) GetSignatures

func (m *Batch) GetSignatures() map[uint64][]byte

func (*Batch) Hash

func (b *Batch) Hash() []byte

Hash returns the hash of the Batch.

func (*Batch) ProtoMessage

func (*Batch) ProtoMessage()

func (*Batch) Reset

func (m *Batch) Reset()

func (*Batch) String

func (m *Batch) String() string

type BatchHeader

type BatchHeader struct {
	Seq      uint64 `protobuf:"varint,1,opt,name=seq" json:"seq,omitempty"`
	PrevHash []byte `protobuf:"bytes,2,opt,name=prev_hash,json=prevHash,proto3" json:"prev_hash,omitempty"`
	DataHash []byte `protobuf:"bytes,3,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"`
}

func (*BatchHeader) Descriptor

func (*BatchHeader) Descriptor() ([]byte, []int)

func (*BatchHeader) ProtoMessage

func (*BatchHeader) ProtoMessage()

func (*BatchHeader) Reset

func (m *BatchHeader) Reset()

func (*BatchHeader) String

func (m *BatchHeader) String() string

type Canceller

type Canceller interface {
	Cancel()
}

Canceller allows cancelling of a scheduled timer event.

type Checkpoint

type Checkpoint struct {
	Seq       uint64 `protobuf:"varint,1,opt,name=seq" json:"seq,omitempty"`
	Digest    []byte `protobuf:"bytes,2,opt,name=digest,proto3" json:"digest,omitempty"`
	Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
}

func (*Checkpoint) Descriptor

func (*Checkpoint) Descriptor() ([]byte, []int)

func (*Checkpoint) ProtoMessage

func (*Checkpoint) ProtoMessage()

func (*Checkpoint) Reset

func (m *Checkpoint) Reset()

func (*Checkpoint) String

func (m *Checkpoint) String() string

type Config

type Config struct {
	N                  uint64 `protobuf:"varint,1,opt,name=n" json:"n,omitempty"`
	F                  uint64 `protobuf:"varint,2,opt,name=f" json:"f,omitempty"`
	BatchDurationNsec  uint64 `protobuf:"varint,3,opt,name=batch_duration_nsec,json=batchDurationNsec" json:"batch_duration_nsec,omitempty"`
	BatchSizeBytes     uint64 `protobuf:"varint,4,opt,name=batch_size_bytes,json=batchSizeBytes" json:"batch_size_bytes,omitempty"`
	RequestTimeoutNsec uint64 `protobuf:"varint,5,opt,name=request_timeout_nsec,json=requestTimeoutNsec" json:"request_timeout_nsec,omitempty"`
}

func (*Config) Descriptor

func (*Config) Descriptor() ([]byte, []int)

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (m *Config) Reset()

func (*Config) String

func (m *Config) String() string

type Hello

type Hello struct {
	Batch   *Batch   `protobuf:"bytes,1,opt,name=batch" json:"batch,omitempty"`
	NewView *NewView `protobuf:"bytes,2,opt,name=new_view,json=newView" json:"new_view,omitempty"`
}

func (*Hello) Descriptor

func (*Hello) Descriptor() ([]byte, []int)

func (*Hello) GetBatch

func (m *Hello) GetBatch() *Batch

func (*Hello) GetNewView

func (m *Hello) GetNewView() *NewView

func (*Hello) ProtoMessage

func (*Hello) ProtoMessage()

func (*Hello) Reset

func (m *Hello) Reset()

func (*Hello) String

func (m *Hello) String() string

type Msg

type Msg struct {
	// Types that are valid to be assigned to Type:
	//	*Msg_Request
	//	*Msg_Preprepare
	//	*Msg_Prepare
	//	*Msg_Commit
	//	*Msg_ViewChange
	//	*Msg_NewView
	//	*Msg_Checkpoint
	//	*Msg_Hello
	Type isMsg_Type `protobuf_oneof:"type"`
}

func (*Msg) Descriptor

func (*Msg) Descriptor() ([]byte, []int)

func (*Msg) GetCheckpoint

func (m *Msg) GetCheckpoint() *Checkpoint

func (*Msg) GetCommit

func (m *Msg) GetCommit() *Subject

func (*Msg) GetHello

func (m *Msg) GetHello() *Hello

func (*Msg) GetNewView

func (m *Msg) GetNewView() *NewView

func (*Msg) GetPrepare

func (m *Msg) GetPrepare() *Subject

func (*Msg) GetPreprepare

func (m *Msg) GetPreprepare() *Preprepare

func (*Msg) GetRequest

func (m *Msg) GetRequest() *Request

func (*Msg) GetType

func (m *Msg) GetType() isMsg_Type

func (*Msg) GetViewChange

func (m *Msg) GetViewChange() *Signed

func (*Msg) ProtoMessage

func (*Msg) ProtoMessage()

func (*Msg) Reset

func (m *Msg) Reset()

func (*Msg) String

func (m *Msg) String() string

func (*Msg) XXX_OneofFuncs

func (*Msg) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type Msg_Checkpoint

type Msg_Checkpoint struct {
	Checkpoint *Checkpoint `protobuf:"bytes,7,opt,name=checkpoint,oneof"`
}

type Msg_Commit

type Msg_Commit struct {
	Commit *Subject `protobuf:"bytes,4,opt,name=commit,oneof"`
}

type Msg_Hello

type Msg_Hello struct {
	Hello *Hello `protobuf:"bytes,8,opt,name=hello,oneof"`
}

type Msg_NewView

type Msg_NewView struct {
	NewView *NewView `protobuf:"bytes,6,opt,name=new_view,json=newView,oneof"`
}

type Msg_Prepare

type Msg_Prepare struct {
	Prepare *Subject `protobuf:"bytes,3,opt,name=prepare,oneof"`
}

type Msg_Preprepare

type Msg_Preprepare struct {
	Preprepare *Preprepare `protobuf:"bytes,2,opt,name=preprepare,oneof"`
}

type Msg_Request

type Msg_Request struct {
	Request *Request `protobuf:"bytes,1,opt,name=request,oneof"`
}

type Msg_ViewChange

type Msg_ViewChange struct {
	ViewChange *Signed `protobuf:"bytes,5,opt,name=view_change,json=viewChange,oneof"`
}

type MultiChainMsg

type MultiChainMsg struct {
	ChainID string `protobuf:"bytes,1,opt,name=chainID" json:"chainID,omitempty"`
	Msg     *Msg   `protobuf:"bytes,2,opt,name=msg" json:"msg,omitempty"`
}

func (*MultiChainMsg) Descriptor

func (*MultiChainMsg) Descriptor() ([]byte, []int)

func (*MultiChainMsg) GetMsg

func (m *MultiChainMsg) GetMsg() *Msg

func (*MultiChainMsg) ProtoMessage

func (*MultiChainMsg) ProtoMessage()

func (*MultiChainMsg) Reset

func (m *MultiChainMsg) Reset()

func (*MultiChainMsg) String

func (m *MultiChainMsg) String() string

type NewView

type NewView struct {
	View  uint64             `protobuf:"varint,1,opt,name=view" json:"view,omitempty"`
	Vset  map[uint64]*Signed `` /* 129-byte string literal not displayed */
	Xset  *Subject           `protobuf:"bytes,3,opt,name=xset" json:"xset,omitempty"`
	Batch *Batch             `protobuf:"bytes,4,opt,name=batch" json:"batch,omitempty"`
}

func (*NewView) Descriptor

func (*NewView) Descriptor() ([]byte, []int)

func (*NewView) GetBatch

func (m *NewView) GetBatch() *Batch

func (*NewView) GetVset

func (m *NewView) GetVset() map[uint64]*Signed

func (*NewView) GetXset

func (m *NewView) GetXset() *Subject

func (*NewView) ProtoMessage

func (*NewView) ProtoMessage()

func (*NewView) Reset

func (m *NewView) Reset()

func (*NewView) String

func (m *NewView) String() string

type Preprepare

type Preprepare struct {
	Seq   *SeqView `protobuf:"bytes,1,opt,name=seq" json:"seq,omitempty"`
	Batch *Batch   `protobuf:"bytes,2,opt,name=batch" json:"batch,omitempty"`
}

func (*Preprepare) Descriptor

func (*Preprepare) Descriptor() ([]byte, []int)

func (*Preprepare) GetBatch

func (m *Preprepare) GetBatch() *Batch

func (*Preprepare) GetSeq

func (m *Preprepare) GetSeq() *SeqView

func (*Preprepare) ProtoMessage

func (*Preprepare) ProtoMessage()

func (*Preprepare) Reset

func (m *Preprepare) Reset()

func (*Preprepare) String

func (m *Preprepare) String() string

type Receiver

type Receiver interface {
	Receive(msg *Msg, src uint64)
	Request(req []byte)
	Connection(replica uint64)
	GetChainId() string
}

Receiver defines the API that is exposed by SBFT to the system.

type Request

type Request struct {
	Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
}

func (*Request) Descriptor

func (*Request) Descriptor() ([]byte, []int)

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

type SBFT

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

SBFT is a simplified PBFT implementation.

func New

func New(id uint64, chainID string, config *Config, sys System) (*SBFT, error)

New creates a new SBFT instance.

func (*SBFT) Connection

func (s *SBFT) Connection(replica uint64)

Connection is an event from system to notify a new connection with replica. On connection, we send our latest (weak) checkpoint, and we expect to receive one from replica.

func (*SBFT) GetChainId

func (s *SBFT) GetChainId() string

func (*SBFT) Receive

func (s *SBFT) Receive(m *Msg, src uint64)

Receive is the ingress method for SBFT messages.

func (*SBFT) Request

func (s *SBFT) Request(req []byte)

Request proposes a new request to the BFT network.

type SeqView

type SeqView struct {
	View uint64 `protobuf:"varint,1,opt,name=view" json:"view,omitempty"`
	Seq  uint64 `protobuf:"varint,2,opt,name=seq" json:"seq,omitempty"`
}

func (*SeqView) Descriptor

func (*SeqView) Descriptor() ([]byte, []int)

func (*SeqView) ProtoMessage

func (*SeqView) ProtoMessage()

func (*SeqView) Reset

func (m *SeqView) Reset()

func (*SeqView) String

func (m *SeqView) String() string

type Signed

type Signed struct {
	Data      []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
}

func (*Signed) Descriptor

func (*Signed) Descriptor() ([]byte, []int)

func (*Signed) ProtoMessage

func (*Signed) ProtoMessage()

func (*Signed) Reset

func (m *Signed) Reset()

func (*Signed) String

func (m *Signed) String() string

type Subject

type Subject struct {
	Seq    *SeqView `protobuf:"bytes,1,opt,name=seq" json:"seq,omitempty"`
	Digest []byte   `protobuf:"bytes,2,opt,name=digest,proto3" json:"digest,omitempty"`
}

func (*Subject) Descriptor

func (*Subject) Descriptor() ([]byte, []int)

func (*Subject) GetSeq

func (m *Subject) GetSeq() *SeqView

func (*Subject) ProtoMessage

func (*Subject) ProtoMessage()

func (*Subject) Reset

func (m *Subject) Reset()

func (*Subject) String

func (m *Subject) String() string

type System

type System interface {
	Send(chainId string, msg *Msg, dest uint64)
	Timer(d time.Duration, f func()) Canceller
	Deliver(chainId string, batch *Batch, committers []filter.Committer)
	AddReceiver(chainId string, receiver Receiver)
	Persist(chainId string, key string, data proto.Message)
	Restore(chainId string, key string, out proto.Message) bool
	LastBatch(chainId string) *Batch
	Sign(data []byte) []byte
	CheckSig(data []byte, src uint64, sig []byte) error
	Reconnect(chainId string, replica uint64)
	Validate(chainID string, req *Request) ([][]*Request, [][]filter.Committer, bool)
	Cut(chainID string) ([]*Request, []filter.Committer)
}

System defines the API that needs to be provided for SBFT.

type ViewChange

type ViewChange struct {
	View       uint64     `protobuf:"varint,1,opt,name=view" json:"view,omitempty"`
	Pset       []*Subject `protobuf:"bytes,2,rep,name=pset" json:"pset,omitempty"`
	Qset       []*Subject `protobuf:"bytes,3,rep,name=qset" json:"qset,omitempty"`
	Checkpoint *Batch     `protobuf:"bytes,4,opt,name=checkpoint" json:"checkpoint,omitempty"`
}

func (*ViewChange) Descriptor

func (*ViewChange) Descriptor() ([]byte, []int)

func (*ViewChange) GetCheckpoint

func (m *ViewChange) GetCheckpoint() *Batch

func (*ViewChange) GetPset

func (m *ViewChange) GetPset() []*Subject

func (*ViewChange) GetQset

func (m *ViewChange) GetQset() []*Subject

func (*ViewChange) ProtoMessage

func (*ViewChange) ProtoMessage()

func (*ViewChange) Reset

func (m *ViewChange) Reset()

func (*ViewChange) String

func (m *ViewChange) String() string

Jump to

Keyboard shortcuts

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