Documentation ¶
Index ¶
- type Block
- type Event
- type EventSource
- type Events
- type EventsByPeer
- func (ee EventsByPeer) Add(events EventsByPeer) (changed bool)
- func (ee EventsByPeer) AddOne(event hash.Event, creator hash.Peer) (changed bool)
- func (ee EventsByPeer) Contains(node hash.Peer, event hash.Event) bool
- func (ee EventsByPeer) Each() map[hash.Event]hash.Peer
- func (ee EventsByPeer) String() string
- func (ee EventsByPeer) ToWire() []*wire.EventDescr
- type FlagTable
- type Frame
- func (f *Frame) AddClothoCandidate(event hash.Event, creator hash.Peer)
- func (f *Frame) AddRootsOf(event hash.Event, roots EventsByPeer)
- func (f *Frame) GetRootsOf(event hash.Event) EventsByPeer
- func (f *Frame) Save()
- func (f *Frame) SetAtropos(clotho hash.Event, consensusTime inter.Timestamp)
- func (f *Frame) SetBalances(balances hash.Hash) bool
- func (f *Frame) ToWire() *wire.Frame
- type Poset
- func (p *Poset) Bootstrap()
- func (p *Poset) FrameOfEvent(event hash.Event) (frame *Frame, isRoot bool)
- func (p *Poset) GetEvent(h hash.Event) *Event
- func (p *Poset) GetGenesisHash() hash.Hash
- func (p *Poset) GetTransaction(h hash.Transaction) *inter.InternalTransaction
- func (p *Poset) GetTransactionCount(h hash.Peer) uint64
- func (p *Poset) HasEvent(h hash.Event) bool
- func (p *Poset) PushEvent(e hash.Event)
- func (p *Poset) StakeOf(addr hash.Peer) uint64
- func (p *Poset) Start()
- func (p *Poset) Stop()
- type State
- type Store
- func (s *Store) ApplyGenesis(balances map[hash.Peer]uint64) error
- func (s *Store) Close()
- func (s *Store) GetBlock(n uint64) *Block
- func (s *Store) GetEventFrame(e hash.Event) *uint64
- func (s *Store) GetFrame(n uint64) *Frame
- func (s *Store) GetState() *State
- func (s *Store) SetBlock(b *Block)
- func (s *Store) SetEventFrame(e hash.Event, frame uint64)
- func (s *Store) SetFrame(f *Frame)
- func (s *Store) SetState(st *State)
- func (s *Store) StateDB(from hash.Hash) *state.DB
- type TimestampsByEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Index uint64 Events hash.EventsSlice }
Block is a chain block.
type EventSource ¶
type Events ¶
type Events []*Event
Events is a ordered slice of events.
type EventsByPeer ¶
EventsByNode is a event hashes grouped by creator. ( creator --> event hashes )
func WireToEventsByPeer ¶
func WireToEventsByPeer(arr []*wire.EventDescr) EventsByPeer
WireToEventsByPeer converts from wire.
func (EventsByPeer) Add ¶
func (ee EventsByPeer) Add(events EventsByPeer) (changed bool)
Add unions events into one.
func (EventsByPeer) Each ¶
func (ee EventsByPeer) Each() map[hash.Event]hash.Peer
Each returns range of all events.
func (EventsByPeer) String ¶
func (ee EventsByPeer) String() string
String returns human readable string representation.
func (EventsByPeer) ToWire ¶
func (ee EventsByPeer) ToWire() []*wire.EventDescr
ToWire converts to simple slice.
type FlagTable ¶
type FlagTable map[hash.Event]EventsByPeer
FlagTable stores the reachability of each event to the roots. It helps to select root without using path searching algorithms. Zero-hash is a self-parent root. ( event hash --> root creator --> root hashes )
func WireToFlagTable ¶
WireToFlagTable converts from wire.
func (FlagTable) EventKnows ¶
EventKnows return true if e knows event of node.
type Frame ¶
type Frame struct { Index uint64 FlagTable FlagTable ClothoCandidates EventsByPeer Atroposes TimestampsByEvent Balances hash.Hash // contains filtered or unexported fields }
Frame is a consensus tables for frame.
func (*Frame) AddClothoCandidate ¶
AddClothoCandidate adds event into ClothoCandidates list.
func (*Frame) AddRootsOf ¶
func (f *Frame) AddRootsOf(event hash.Event, roots EventsByPeer)
AddRootsOf appends known roots for event.
func (*Frame) GetRootsOf ¶
func (f *Frame) GetRootsOf(event hash.Event) EventsByPeer
GetRootsOf returns known roots of event. For read only, please.
func (*Frame) SetAtropos ¶
SetAtropos makes Atropos from Clotho and consensus time.
func (*Frame) SetBalances ¶
SetBalances saves PoS-balances state.
type Poset ¶
type Poset struct { NewBlockCh chan uint64 logger.Instance // contains filtered or unexported fields }
Poset processes events to get consensus.
func New ¶
func New(store *Store, input EventSource) *Poset
New creates Poset instance. It does not start any process.
func (*Poset) FrameOfEvent ¶
FrameOfEvent returns unfinished frame where event is in.
func (*Poset) GetGenesisHash ¶
func (*Poset) GetTransaction ¶
func (p *Poset) GetTransaction(h hash.Transaction) *inter.InternalTransaction
GetTransaction returns transaction by hash.
func (*Poset) GetTransactionCount ¶
GetTransactionCount returns transaction count for peer.
type Store ¶
Store is a poset persistent storage working over physical key-value database. TODO: cache tables with LRU.
func (*Store) ApplyGenesis ¶
ApplyGenesis stores initial state.
func (*Store) GetEventFrame ¶
GetEventFrame returns frame num of event.
func (*Store) SetEventFrame ¶
SetEventFrame stores frame num of event.
type TimestampsByEvent ¶
TimestampsByEvent is a timestamps by event index.
func WireToTimestampsByEvent ¶
func WireToTimestampsByEvent(arr map[string]uint64) TimestampsByEvent
WireToTimestampsByEvent converts from wire.
func (TimestampsByEvent) ToWire ¶
func (tt TimestampsByEvent) ToWire() map[string]uint64
ToWire converts to simple slice.