messages

package
v0.0.0-...-8c33e52 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Request MessageType = "request"
	Reply   MessageType = "reply"
	Cancel  MessageType = "cancel"
	Flood   MessageType = "flood"
	Echo    MessageType = "echo"
	Short   MessageType = "short"

	Ask      CommandType = "ask"
	Detect   CommandType = "detect"
	Liberate CommandType = "liberate"
	Unknown  CommandType = "unknown"
)

Variables

This section is empty.

Functions

func BuildMessage

func BuildMessage(myId int, c clock.LogicalClock, messageType MessageType, weight float64, initiatorId int, initiatedAt int) string

Types

type CommandType

type CommandType string

func IdentifyCommand

func IdentifyCommand(command string) CommandType

type LiberateCommand

type LiberateCommand struct {
	ParentIds   []int
	LiberateAll bool
}

func ParseLiberateCommand

func ParseLiberateCommand(command string, numPorts int) *LiberateCommand

type Message

type Message struct {
	SenderId    int     `json:"id"`
	Text        string  `json:"type"`
	ClockStr    string  `json:"clock_str"`
	Weight      float64 `json:"weight"`
	InitiatorId int     `json:"initiator_id"`
	InitiatedAt int     `json:"initiated_at"`
}

func ParseMessage

func ParseMessage(msg string) (Message, error)

type MessageType

type MessageType string

func (MessageType) String

func (m MessageType) String() string

type RequestCommand

type RequestCommand struct {
	NeededReplies int
	ChildIds      []int
}

func ParseRequestCommand

func ParseRequestCommand(command string, numPorts int) *RequestCommand

Jump to

Keyboard shortcuts

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