cluster

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatMessage

type ChatMessage struct {
	SourceNode string          `json:"source_node"`
	ChannelID  string          `json:"channel_id"`
	Payload    json.RawMessage `json:"payload"`
}

ChatMessage carries channel chat payloads across nodes.

type Mesh

type Mesh struct {
	// contains filtered or unexported fields
}

Mesh routes realtime social payloads across nodes via Redis Pub/Sub.

func NewMesh

func NewMesh(rdb *redis.Client, nodeID string, logger *zap.Logger) *Mesh

NewMesh creates a cluster mesh router.

func (*Mesh) PublishChat

func (m *Mesh) PublishChat(ctx context.Context, msg ChatMessage) error

PublishChat broadcasts chat to all nodes.

func (*Mesh) PublishParty

func (m *Mesh) PublishParty(ctx context.Context, msg PartyMessage) error

PublishParty broadcasts a party event to all peer nodes.

func (*Mesh) PublishPresence

func (m *Mesh) PublishPresence(ctx context.Context, msg PresenceEventMessage) error

PublishPresence broadcasts a presence event to all peer nodes.

func (*Mesh) PublishStreamBroadcast

func (m *Mesh) PublishStreamBroadcast(ctx context.Context, msg StreamSendMessage) error

PublishStreamBroadcast publishes stream payloads to all peer nodes.

func (*Mesh) PublishStreamSend

func (m *Mesh) PublishStreamSend(ctx context.Context, targetNode string, msg StreamSendMessage) error

PublishStreamSend publishes a stream payload to a target node.

func (*Mesh) SetChatHandler

func (m *Mesh) SetChatHandler(fn func(ChatMessage))

func (*Mesh) SetPartyHandler

func (m *Mesh) SetPartyHandler(fn func(PartyMessage))

func (*Mesh) SetPresenceHandler

func (m *Mesh) SetPresenceHandler(fn func(PresenceEventMessage))

func (*Mesh) SetStreamHandler

func (m *Mesh) SetStreamHandler(fn func(StreamSendMessage))

func (*Mesh) Start

func (m *Mesh) Start(ctx context.Context)

Start subscribes to node-specific mesh channels.

func (*Mesh) Stop

func (m *Mesh) Stop()

type PartyMessage

type PartyMessage struct {
	SourceNode string          `json:"source_node"`
	PartyID    string          `json:"party_id"`
	Payload    json.RawMessage `json:"payload"`
}

PartyMessage carries party events across nodes.

type PresenceEventMessage

type PresenceEventMessage struct {
	SourceNode string          `json:"source_node"`
	Kind       string          `json:"kind"` // join|leave|update
	Payload    json.RawMessage `json:"payload"`
}

PresenceEventMessage carries cross-node status join/leave/update payloads.

type StreamSendMessage

type StreamSendMessage struct {
	SourceNode string   `json:"source_node"`
	Mode       int16    `json:"mode"`
	Subject    string   `json:"subject"`
	Subcontext string   `json:"subcontext"`
	Label      string   `json:"label"`
	Data       string   `json:"data"`
	SessionIDs []string `json:"session_ids,omitempty"`
}

StreamSendMessage fans out stream payloads to peer nodes.

Jump to

Keyboard shortcuts

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