Documentation ¶
Index ¶
- type ProcessList
- type ProcessListItem
- type ProcessListMgr
- func (plMgr *ProcessListMgr) AddMyProcessListItem(msg wire.FtmInternalMsg, hash *wire.ShaHash, msgType byte) (ack *wire.MsgAcknowledgement, err error)
- func (plMgr *ProcessListMgr) AddToOrphanProcessList(plItem *ProcessListItem) error
- func (plMgr *ProcessListMgr) AddToOtherProcessList(plItem *ProcessListItem) error
- func (plMgr *ProcessListMgr) InitProcessListFromOrphanMap() error
- func (plMgr *ProcessListMgr) IsMyPListExceedingLimit() bool
- func (plMgr *ProcessListMgr) SignAck(bytes []byte) (sig common.Signature)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProcessList ¶
type ProcessList struct {
// contains filtered or unexported fields
}
Process list contains a list of valid confirmation messages and is used for consensus building
func (*ProcessList) AddToProcessList ¶
func (pl *ProcessList) AddToProcessList(pli *ProcessListItem) error
Add the process list entry in the right slot
func (*ProcessList) GetPLItems ¶
func (pl *ProcessList) GetPLItems() []*ProcessListItem
Get Process lit items
type ProcessListItem ¶
type ProcessListItem struct { Ack *wire.MsgAcknowledgement Msg wire.FtmInternalMsg MsgHash *wire.ShaHash }
Process list contains a list of valid confirmation messages and is used for consensus building
type ProcessListMgr ¶
type ProcessListMgr struct { sync.RWMutex MyProcessList *ProcessList OtherProcessLists []*ProcessList NextDBlockHeight uint32 // Orphan process list map to hold our of order confirmation messages // key: MsgAcknowledgement.MsgHash.String() OrphanPLMap map[string]*ProcessListItem // contains filtered or unexported fields }
Process list contains a list of valid confirmation messages and is used for consensus building
func NewProcessListMgr ¶
func NewProcessListMgr(height uint32, otherPLSize int, plSizeHint uint, privKey common.PrivateKey) *ProcessListMgr
create a new process list
func (*ProcessListMgr) AddMyProcessListItem ¶
func (plMgr *ProcessListMgr) AddMyProcessListItem(msg wire.FtmInternalMsg, hash *wire.ShaHash, msgType byte) (ack *wire.MsgAcknowledgement, err error)
Create a new process list item and add it to the MyProcessList
func (*ProcessListMgr) AddToOrphanProcessList ¶
func (plMgr *ProcessListMgr) AddToOrphanProcessList(plItem *ProcessListItem) error
TODO: Added to OtherPL[0] - to be improved after milestone 1
func (*ProcessListMgr) AddToOtherProcessList ¶
func (plMgr *ProcessListMgr) AddToOtherProcessList(plItem *ProcessListItem) error
TODO: Added to OtherPL[0] - to be improved after milestone 1
func (*ProcessListMgr) InitProcessListFromOrphanMap ¶
func (plMgr *ProcessListMgr) InitProcessListFromOrphanMap() error
Add a factom transaction to the my process list Each of the federated servers has one MyProcessList func (plMgr *ProcessListMgr) AddToMyProcessList(plItem *ProcessListItem, msgType byte) error {
// Come up with the right process list index for the new item index := uint32(len(plMgr.MyProcessList.plItems)) if index > 0 { lastPlItem := plMgr.MyProcessList.plItems[index-1] if lastPlItem.Ack == nil { return errors.New("Invalid process list.") } if index != lastPlItem.Ack.Index+1 { return errors.New("Invalid process list index.") } } msgAck := wire.NewMsgAcknowledgement(plMgr.NextDBlockHeight, index, plItem.MsgHash, msgType) //msgAck.Affirmation = plItem.msgHash.Bytes plItem.Ack = msgAck //Add the item into my process list plMgr.MyProcessList.AddToProcessList(plItem) //Broadcast the plitem into the network?? return nil }
Initialize the process list from the orphan process list map Out of order Ack messages are stored in OrphanPLMap
func (*ProcessListMgr) IsMyPListExceedingLimit ¶
func (plMgr *ProcessListMgr) IsMyPListExceedingLimit() bool
Check if the number of process list items is exceeding the size limit