manage

package
v3.2.10 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

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

func NewCount

func NewCount(n *onet.TreeNodeInstance) (onet.ProtocolInstance, error)

NewCount returns a new protocolInstance

Types

type Close

type Close struct{}

Close is sent to the parent just before the node shuts down

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 PrepareClose

type PrepareClose struct{}

PrepareClose is sent down the tree until the nodes

type PrepareCloseMsg

type PrepareCloseMsg struct {
	*onet.TreeNode
	PrepareClose
}

PrepareCloseMsg is the wrapper for the PrepareClose message

type PrepareCount

type PrepareCount struct {
	Timeout time.Duration
}

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) Start

func (p *ProtocolCount) Start() error

Start the protocol

func (*ProtocolCount) Timeout

func (p *ProtocolCount) Timeout() time.Duration

Timeout returns the current timeout

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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