Documentation
¶
Index ¶
- func NewCloseAll(n *onet.TreeNodeInstance) (onet.ProtocolInstance, error)
- func NewCount(n *onet.TreeNodeInstance) (onet.ProtocolInstance, error)
- type Close
- type CloseMsg
- type Count
- type CountMsg
- type NodeIsUp
- type PrepareClose
- type PrepareCloseMsg
- type PrepareCount
- type ProtocolCloseAll
- type ProtocolCount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCloseAll ¶
func NewCloseAll(n *onet.TreeNodeInstance) (onet.ProtocolInstance, error)
NewCloseAll will create a new protocol
Types ¶
type CloseMsg ¶
type CloseMsg struct { *onet.TreeNode Close }
CloseMsg is the wrapper for the Close message
type Count ¶
type Count struct {
Children int32
}
Count sends the number of children to the parent node.
type CountMsg ¶
type CountMsg struct { *onet.TreeNode Count }
CountMsg is wrapper around the Count-structure
type NodeIsUp ¶
type NodeIsUp struct{}
NodeIsUp - if it is received by the root it will reset the counter.
type PrepareCloseMsg ¶
type PrepareCloseMsg struct { *onet.TreeNode PrepareClose }
PrepareCloseMsg is the wrapper for the PrepareClose message
type PrepareCount ¶
PrepareCount is sent so that every node can contact the root to say the counting is still going on.
type ProtocolCloseAll ¶
type ProtocolCloseAll struct { *onet.TreeNodeInstance // Done receives a 'true' once the protocol is done. Done chan bool }
ProtocolCloseAll is the structure used to hold the Done-channel
func (*ProtocolCloseAll) FuncClose ¶
func (p *ProtocolCloseAll) FuncClose(c []CloseMsg) error
FuncClose is called from the leafs to the parents and up the tree. Everybody receiving all `Close`-messages from all children will close down all network communication.
func (*ProtocolCloseAll) FuncPrepareClose ¶
func (p *ProtocolCloseAll) FuncPrepareClose(pc PrepareCloseMsg) error
FuncPrepareClose sends a `PrepareClose`-message down the tree.
func (*ProtocolCloseAll) Start ¶
func (p *ProtocolCloseAll) Start() error
Start the protocol and waits for the `Close`-message to arrive back at the root-node.
type ProtocolCount ¶
type ProtocolCount struct { *onet.TreeNodeInstance Replies int Count chan int Quit chan bool PrepareCountChan chan struct { *onet.TreeNode PrepareCount } CountChan chan []CountMsg NodeIsUpChan chan struct { *onet.TreeNode NodeIsUp } // contains filtered or unexported fields }
ProtocolCount holds all channels. If a timeout occurs or the counting is done, the Count-channel receives the number of nodes reachable in the tree.
func (*ProtocolCount) Dispatch ¶
func (p *ProtocolCount) Dispatch() error
Dispatch listens for all channels and waits for a timeout in case nothing happens for a certain duration
func (*ProtocolCount) FuncC ¶
func (p *ProtocolCount) FuncC(cc []CountMsg)
FuncC creates a Count-message that will be received by all parents and count the total number of children
func (*ProtocolCount) FuncPC ¶
func (p *ProtocolCount) FuncPC()
FuncPC handles PrepareCount messages. These messages go down the tree and every node that receives one will reply with a 'NodeIsUp'-message
func (*ProtocolCount) SetTimeout ¶
func (p *ProtocolCount) SetTimeout(t time.Duration)
SetTimeout sets the new timeout
func (*ProtocolCount) Timeout ¶
func (p *ProtocolCount) Timeout() time.Duration
Timeout returns the current timeout