Documentation ¶
Overview ¶
package gpa stands for generic pure (distributed) algorithm.
Index ¶
- type AckHandler
- type BasicMessage
- type GPA
- type Input
- type Message
- type MsgWrapper
- func (w *MsgWrapper) DelegateInput(subsystem byte, index int, input Input) (GPA, OutMessages, error)
- func (w *MsgWrapper) DelegateMessage(msg *WrappingMsg) (GPA, OutMessages, error)
- func (w *MsgWrapper) UnmarshalMessage(data []byte) (Message, error)
- func (w *MsgWrapper) WrapMessage(subsystem byte, index int, msg Message) Message
- func (w *MsgWrapper) WrapMessages(subsystem byte, index int, msgs OutMessages) OutMessages
- type NodeID
- type OutMessages
- type Output
- type OwnHandler
- type TestContext
- func (tc *TestContext) AddInputs(inputs map[NodeID]Input)
- func (tc *TestContext) MsgCounts() (int, int)
- func (tc *TestContext) NumberOfOutputs() int
- func (tc *TestContext) NumberOfOutputsPredicate(outNum int) func() bool
- func (tc *TestContext) OutOfMessagesPredicate() func() bool
- func (tc *TestContext) PrintAllStatusStrings(prefix string, logFunc func(format string, args ...any))
- func (tc *TestContext) RunAll()
- func (tc *TestContext) RunUntil(predicate func() bool)
- func (tc *TestContext) WithCall(call func() []Message) *TestContext
- func (tc *TestContext) WithInput(nodeID NodeID, input Input) *TestContext
- func (tc *TestContext) WithInputChannel(inputCh <-chan map[NodeID]Input) *TestContext
- func (tc *TestContext) WithInputProbability(inputProb float64) *TestContext
- func (tc *TestContext) WithInputs(inputs map[NodeID]Input) *TestContext
- func (tc *TestContext) WithMessage(msg Message) *TestContext
- func (tc *TestContext) WithMessageChannel(msgCh <-chan Message) *TestContext
- func (tc *TestContext) WithMessageDeliveryProbability(msgDeliveryProb float64) *TestContext
- func (tc *TestContext) WithMessages(msgs []Message) *TestContext
- func (tc *TestContext) WithOutputHandler(outputHandler func(nodeID NodeID, output Output)) *TestContext
- type TestMessage
- type WrappingMsg
- func (m *WrappingMsg) Index() int
- func (m *WrappingMsg) MarshalBinary() ([]byte, error)
- func (m *WrappingMsg) Recipient() NodeID
- func (m *WrappingMsg) SetSender(sender NodeID)
- func (m *WrappingMsg) Subsystem() byte
- func (m *WrappingMsg) UnmarshalBinary(data []byte) error
- func (m *WrappingMsg) Wrapped() Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AckHandler ¶
type AckHandler interface { GPA MakeTickInput(time.Time) Input NestedMessage(msg Message) OutMessages NestedCall(c func(GPA) OutMessages) OutMessages }
func NewAckHandler ¶
func NewAckHandler(me NodeID, nested GPA, resendPeriod time.Duration) AckHandler
type BasicMessage ¶ added in v1.0.3
type BasicMessage struct {
// contains filtered or unexported fields
}
func NewBasicMessage ¶ added in v1.0.3
func NewBasicMessage(recipient NodeID) BasicMessage
func (*BasicMessage) Recipient ¶ added in v1.0.3
func (msg *BasicMessage) Recipient() NodeID
func (*BasicMessage) Sender ¶ added in v1.0.3
func (msg *BasicMessage) Sender() NodeID
func (*BasicMessage) SetSender ¶ added in v1.0.3
func (msg *BasicMessage) SetSender(sender NodeID)
type GPA ¶
type GPA interface { Input(inp Input) OutMessages // Can return nil for NoMessages. Message(msg Message) OutMessages // Can return nil for NoMessages. Output() Output StatusString() string // Status of the protocol as a string. UnmarshalMessage(data []byte) (Message, error) }
Generic interface for functional style distributed algorithms. GPA stands for Generic Pure Algorithm.
func MakeTestSilentNode ¶
func MakeTestSilentNode() GPA
func NewOwnHandler ¶
func NewOwnHandlerWithOutPredicate ¶ added in v1.0.3
func NewTestRound ¶
type Message ¶
type Message interface { encoding.BinaryMarshaler encoding.BinaryUnmarshaler Recipient() NodeID // The sender should indicate the recipient. SetSender(NodeID) // The transport later will set a validated sender for a message. }
type MsgWrapper ¶
type MsgWrapper struct {
// contains filtered or unexported fields
}
MsgWrapper can be used to compose an algorithm out of other abstractions. These messages are meant to wrap and route the messages of the sub-algorithms.
func NewMsgWrapper ¶
func (*MsgWrapper) DelegateInput ¶ added in v1.0.3
func (w *MsgWrapper) DelegateInput(subsystem byte, index int, input Input) (GPA, OutMessages, error)
func (*MsgWrapper) DelegateMessage ¶ added in v1.0.3
func (w *MsgWrapper) DelegateMessage(msg *WrappingMsg) (GPA, OutMessages, error)
func (*MsgWrapper) UnmarshalMessage ¶
func (w *MsgWrapper) UnmarshalMessage(data []byte) (Message, error)
func (*MsgWrapper) WrapMessage ¶
func (w *MsgWrapper) WrapMessage(subsystem byte, index int, msg Message) Message
func (*MsgWrapper) WrapMessages ¶
func (w *MsgWrapper) WrapMessages(subsystem byte, index int, msgs OutMessages) OutMessages
type OutMessages ¶
type OutMessages interface { // // Add single message to the out messages. Add(msg Message) OutMessages // // Add several messages. AddMany(msgs []Message) OutMessages // // Add all the messages collected to other OutMessages. // The added OutMsgs object is marked done here. AddAll(msgs OutMessages) OutMessages // // Mark this instance as freezed, after this it cannot be appended. Done() OutMessages // // Returns a number of elements in the collection. Count() int // // Iterates over the collection, stops on first error. // Collection can be appended while iterating. Iterate(callback func(msg Message) error) error // // Iterated over the collection. // Collection can be appended while iterating. MustIterate(callback func(msg Message)) // // Returns contents of the collection as an array of messages. AsArray() []Message }
A buffer for collecting out messages. It is used to decrease array reallocations, if a slice would be used directly. Additionally, you can safely append to the OutMessages while you iterate over it. It should be implemented as a deep-list, allowing efficient appends and iterations.
func NoMessages ¶
func NoMessages() OutMessages
A convenience function to return from the Input or Message functions in GPA.
type OwnHandler ¶
type OwnHandler struct {
// contains filtered or unexported fields
}
OwnHandler is a GPA instance handling own messages immediately.
The idea is instead of checking if a message for myself in the actual protocols, one just send a message, and this handler passes it back as an ordinary message.
func (*OwnHandler) Input ¶
func (o *OwnHandler) Input(input Input) OutMessages
func (*OwnHandler) Message ¶
func (o *OwnHandler) Message(msg Message) OutMessages
func (*OwnHandler) Output ¶
func (o *OwnHandler) Output() Output
func (*OwnHandler) StatusString ¶
func (o *OwnHandler) StatusString() string
func (*OwnHandler) UnmarshalMessage ¶
func (o *OwnHandler) UnmarshalMessage(data []byte) (Message, error)
type TestContext ¶
type TestContext struct {
// contains filtered or unexported fields
}
Imitates a cluster of nodes and the medium performing the message exchange. Inputs are processes in-order for each node individually.
func NewTestContext ¶
func NewTestContext(nodes map[NodeID]GPA) *TestContext
func (*TestContext) AddInputs ¶
func (tc *TestContext) AddInputs(inputs map[NodeID]Input)
Will add new inputs to the existing set. The inputs will be overridden, if exist for the same nodes.
func (*TestContext) MsgCounts ¶ added in v1.0.3
func (tc *TestContext) MsgCounts() (int, int)
func (*TestContext) NumberOfOutputs ¶
func (tc *TestContext) NumberOfOutputs() int
Returns a number of non-nil outputs.
func (*TestContext) NumberOfOutputsPredicate ¶
func (tc *TestContext) NumberOfOutputsPredicate(outNum int) func() bool
Will run until there will be at least outNum of non-nil outputs generated.
func (*TestContext) OutOfMessagesPredicate ¶
func (tc *TestContext) OutOfMessagesPredicate() func() bool
Will run until all the messages will be processed.
func (*TestContext) PrintAllStatusStrings ¶ added in v1.0.3
func (tc *TestContext) PrintAllStatusStrings(prefix string, logFunc func(format string, args ...any))
func (*TestContext) RunAll ¶
func (tc *TestContext) RunAll()
func (*TestContext) RunUntil ¶
func (tc *TestContext) RunUntil(predicate func() bool)
func (*TestContext) WithCall ¶
func (tc *TestContext) WithCall(call func() []Message) *TestContext
func (*TestContext) WithInput ¶ added in v1.0.3
func (tc *TestContext) WithInput(nodeID NodeID, input Input) *TestContext
func (*TestContext) WithInputChannel ¶ added in v1.0.3
func (tc *TestContext) WithInputChannel(inputCh <-chan map[NodeID]Input) *TestContext
func (*TestContext) WithInputProbability ¶
func (tc *TestContext) WithInputProbability(inputProb float64) *TestContext
func (*TestContext) WithInputs ¶
func (tc *TestContext) WithInputs(inputs map[NodeID]Input) *TestContext
func (*TestContext) WithMessage ¶ added in v1.0.3
func (tc *TestContext) WithMessage(msg Message) *TestContext
func (*TestContext) WithMessageChannel ¶ added in v1.0.3
func (tc *TestContext) WithMessageChannel(msgCh <-chan Message) *TestContext
func (*TestContext) WithMessageDeliveryProbability ¶
func (tc *TestContext) WithMessageDeliveryProbability(msgDeliveryProb float64) *TestContext
func (*TestContext) WithMessages ¶
func (tc *TestContext) WithMessages(msgs []Message) *TestContext
func (*TestContext) WithOutputHandler ¶ added in v1.0.3
func (tc *TestContext) WithOutputHandler(outputHandler func(nodeID NodeID, output Output)) *TestContext
type TestMessage ¶
type TestMessage struct { ID int // contains filtered or unexported fields }
Just a message for test cases.
func (*TestMessage) MarshalBinary ¶
func (m *TestMessage) MarshalBinary() ([]byte, error)
func (*TestMessage) Recipient ¶
func (m *TestMessage) Recipient() NodeID
func (*TestMessage) SetSender ¶
func (m *TestMessage) SetSender(sender NodeID)
func (*TestMessage) UnmarshalBinary ¶
func (m *TestMessage) UnmarshalBinary(data []byte) error
type WrappingMsg ¶
type WrappingMsg struct {
// contains filtered or unexported fields
}
The message that contains another, and its routing info.
func NewWrappingMsg ¶
func NewWrappingMsg(msgType, subsystem byte, index int, wrapped Message) *WrappingMsg
func (*WrappingMsg) Index ¶
func (m *WrappingMsg) Index() int
func (*WrappingMsg) MarshalBinary ¶
func (m *WrappingMsg) MarshalBinary() ([]byte, error)
func (*WrappingMsg) Recipient ¶
func (m *WrappingMsg) Recipient() NodeID
func (*WrappingMsg) SetSender ¶
func (m *WrappingMsg) SetSender(sender NodeID)
func (*WrappingMsg) Subsystem ¶
func (m *WrappingMsg) Subsystem() byte
func (*WrappingMsg) UnmarshalBinary ¶
func (m *WrappingMsg) UnmarshalBinary(data []byte) error
func (*WrappingMsg) Wrapped ¶
func (m *WrappingMsg) Wrapped() Message
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
aba
|
|
craig
TODO: That's Craig's "Good-Case-Coin-Free" ABA consensus.
|
TODO: That's Craig's "Good-Case-Coin-Free" ABA consensus. |
Here we implement the Asynchronous Common Subset algorithm from the HBBFT paper:
|
Here we implement the Asynchronous Common Subset algorithm from the HBBFT paper: |
package acss implements "Asynchronous Complete Secret Sharing" as described in
|
package acss implements "Asynchronous Complete Secret Sharing" as described in |
crypto
This package is a copy of <https://github.com/Wollac/async.go/tree/main/pkg/acss/crypto>
|
This package is a copy of <https://github.com/Wollac/async.go/tree/main/pkg/acss/crypto> |
nonce
nonce package implements NonceDKG as described in <https://github.com/iotaledger/crypto-tss/>.
|
nonce package implements NonceDKG as described in <https://github.com/iotaledger/crypto-tss/>. |
cc
|
|
blssig
blssig package implements a Common Coin (CC) based on a BLS Threshold signatures as described in the Appendix C of
|
blssig package implements a Common Coin (CC) based on a BLS Threshold signatures as described in the Appendix C of |
semi
semi package implements a Common Coin (CC) that produces deterministic values only for some of the rounds.
|
semi package implements a Common Coin (CC) that produces deterministic values only for some of the rounds. |
rbc
|
|
bracha
package bracha implements Bracha's Reliable Broadcast.
|
package bracha implements Bracha's Reliable Broadcast. |