Documentation ¶
Overview ¶
Package announcer contains an implementation of a generic protocol announcer that can be used to determine live participants of an interactive protocol before executing the given protocol session.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterUnmarshaller ¶
func RegisterUnmarshaller(channel net.BroadcastChannel)
RegisterUnmarshaller initializes the given broadcast channel to be able to handle announcement messages by registering the required unmarshaller.
func UnreadyMembers ¶
func UnreadyMembers( readyMembers []group.MemberIndex, groupSize int, ) []group.MemberIndex
UnreadyMembers returns a list of member indexes that turned out to be unready during the announcement. The list is sorted in ascending order.
Types ¶
type Announcer ¶
type Announcer struct {
// contains filtered or unexported fields
}
Announcer is an implementation of the protocol announcer that performs the readiness announcement over the provided broadcast channel.
func New ¶
func New( protocolID string, broadcastChannel net.BroadcastChannel, membershipValidator *group.MembershipValidator, ) *Announcer
New creates a new instance of the Announcer. It expects a unique protocol identifier, a broadcast channel configured to mediate between group members, and a membership validator configured to validate the group membership of announcements senders.
func (*Announcer) Announce ¶
func (a *Announcer) Announce( ctx context.Context, memberIndex group.MemberIndex, sessionID string, ) ( []group.MemberIndex, error, )
Announce sends the member's readiness announcement for the given protocol session and listens for announcements from other group members. It returns a list of unique members indexes that are ready for the given attempt, including the executing member's index. The list is sorted in ascending order. This function blocks until the ctx passed as argument is done.