robust

package
v0.0.0-...-e7dcbf3 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MessageOffset uint64

XXX(1.0): replace MessageOffset with 7804071725000000000 (2217-04-20 23:42:05) MessageOffset will be added to all robust.Message ids. We need an offset because message ids must be monotonically increasing, and RobustIRC used to use UNIX nano timestamps. For new networks, the offset doesn’t hurt, and it’s configurable in case networks need to transition back and forth between the old and the new mechanism. See also issue #150.

Functions

func IdFromRaftIndex

func IdFromRaftIndex(index uint64) uint64

Types

type Id

type Id struct {
	Id    uint64
	Reply uint64
}

func (*Id) String

func (i *Id) String() string

type Message

type Message struct {
	Id      Id
	Session Id
	Type    Type
	Data    string

	// UnixNano is set by the server which accepts the message.
	UnixNano int64

	// InterestingFor is a map from session ids (only the Id part of a
	// robust.Id, since Reply is always unset for sessions) to a bool
	// that signals whether the session is interested in the message.
	// InterestingFor gets set once in SendMessages and stays
	// constant.
	InterestingFor map[uint64]bool `json:"-"`

	// List of all servers currently in the network. Only present when
	// Type == robust.Ping.
	Servers []string `json:",omitempty"`

	// Current master, as a hint for the proxy (may save one redirect).
	Currentmaster string `json:",omitempty"`

	// ClientMessageId sent by client. Only present when Type ==
	// robust.IRCFromClient
	ClientMessageId uint64 `json:",omitempty"`

	// Revision is the config file revision. Only present when Type ==
	// robust.Config
	Revision uint64 `json:",omitempty"`

	// RemoteAddr is the network address that sent the request.
	RemoteAddr string `json:",omitempty"`
}

func NewMessageFromBytes

func NewMessageFromBytes(b []byte, index uint64) Message

func (*Message) CopyToProtoMessage

func (m *Message) CopyToProtoMessage(dst *pb.RobustMessage)

CopyToProtoMessage writes the message to dst, assuming that dst is a fully allocated RobustMessage.

func (*Message) PrivacyFilter

func (m *Message) PrivacyFilter() string

func (*Message) ProtoMessage

func (m *Message) ProtoMessage() *pb.RobustMessage

func (*Message) Timestamp

func (m *Message) Timestamp() time.Time

func (*Message) TimestampString

func (m *Message) TimestampString() string

type Type

type Type int64
const (
	CreateSession Type = iota
	DeleteSession
	IRCFromClient
	IRCToClient
	Ping
	MessageOfDeath
	Config
	State
	Any
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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