Help us shape the future of Go! Take the 2026 Go Developer Survey

messaging

package
v0.0.0-...-9f9ffe7 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2018 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event uint

Event an event identifier.

const (
	// Event called when a node connects
	EventConnect Event = iota

	// Event called when a node disconnects cleanly
	EventDisconnect

	// Event called when a node shuts down cleanly
	EventShutdown

	// Event called when a node is lost due to connection loss/crash
	EventLoss

	// Event called when an update is available
	EventAvailable
)

type EventMessage

type EventMessage struct {
	// Event the event const that this corresponds to
	Event Event `json:"event"`
	// Any data that belongs to the event.
	Data []string `json:"data"`
}

EventMessage a message containing an event and it's data.

type Message

type Message struct {
	// ID an ID to only forward once
	ID uuid.UUID
	// SourceID the ID of the sender so we can traceback.
	SourceID string
	// Type the type of message this is.
	Type MessageType
	// Data the JSON data
	Data []byte
	// Message the message we contain
	Message interface{}
	// Already marshaled json
	Cache []byte
}

Message an abstract, the message to be sent/received/forwarded.

func (Message) MarshalJSON

func (m Message) MarshalJSON() ([]byte, error)

func (*Message) UnmarshalJSON

func (m *Message) UnmarshalJSON(b []byte) error

type MessageType

type MessageType uint

The message type

const (
	TypeMessageUnknown MessageType = iota
	TypeMessageEvent
	TypeMessageRebootEstablish
)

type RebootEstablishMessage

type RebootEstablishMessage struct {
	// RebootAfter I will reboot after this time after the previous server has come up.
	RebootAfter time.Duration `json:"reboot_after"`
	// DeadAfter Consider me dead after this duration of not coming back up
	DeadAfter time.Duration `json:"dead_after"`
}

RebootEstablishMessage a message to establish this instances reboot timings.

Jump to

Keyboard shortcuts

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