contract

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package contract is the streaming extension's dashboard contract contributor. It is the slice (f) migration target — a parallel implementation of the streaming dashboard surface using the new declarative contract instead of templ rendering. Both paths coexist during the migration window:

/dashboard/ext/streaming/...      (legacy templ contributor — slice f keeps unchanged)
/dashboard/contract/streaming-contract/...  (this package — new contract path)

See SLICE_F_DESIGN.md in extensions/dashboard/contract/ for the design spec.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(disp *dispatcher.Dispatcher, contractReg dashcontract.Registry, wreg dashcontract.WardenRegistry, deps Deps) error

Register loads the embedded manifest, validates it, registers it with the dashboard contract registry, and wires the per-intent handlers against the dispatcher.

Types

type ChannelInfo

type ChannelInfo struct {
	ID              string `json:"id"`
	Name            string `json:"name"`
	SubscriberCount int    `json:"subscriberCount"`
	MessageCount    int64  `json:"messageCount"`
}

ChannelInfo is one row of channels.list.

type ChannelsList

type ChannelsList struct {
	Channels []ChannelInfo `json:"channels"`
}

type CommandResult

type CommandResult struct {
	OK      bool   `json:"ok"`
	Message string `json:"message,omitempty"`
	// ID is set on creation commands (e.g. rooms.create) so the React shell
	// can navigate to the new resource.
	ID string `json:"id,omitempty"`
}

CommandResult is the uniform payload returned by every mutation. Empty when the command produced no body but succeeded.

type ConfigProvider

type ConfigProvider func() streaming.Config

ConfigProvider returns the live streaming Config snapshot.

type ConfigSummary

type ConfigSummary struct {
	BackendType string         `json:"backendType,omitempty"`
	Distributed bool           `json:"distributed"`
	NodeID      string         `json:"nodeID,omitempty"`
	Features    map[string]any `json:"features"`
	Limits      map[string]any `json:"limits"`
	Timeouts    map[string]any `json:"timeouts"`
}

ConfigSummary is the wire shape for the config query intent. Slice (f)'s settings page is read-only; it surfaces the most relevant fields without echoing every internal toggle.

type ConnectionInfo

type ConnectionInfo struct {
	ConnID        string    `json:"connID"`
	UserID        string    `json:"userID"`
	Transport     string    `json:"transport"`
	JoinedRooms   []string  `json:"joinedRooms"`
	Subscriptions []string  `json:"subscriptions"`
	LastActivity  time.Time `json:"lastActivity"`
	Status        string    `json:"status"`
}

ConnectionInfo is the wire shape for one row in connections.list.

type ConnectionsList

type ConnectionsList struct {
	Connections []ConnectionInfo `json:"connections"`
}

ConnectionsList wraps a slice of ConnectionInfo for resource.list compatibility.

type CreateRoomInput

type CreateRoomInput struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Owner       string `json:"owner"`
	Private     bool   `json:"private"`
}

type DeleteRoomInput

type DeleteRoomInput struct {
	ID string `json:"id"`
}

type Deps

type Deps struct {
	Manager ManagerProvider
	Config  ConfigProvider
}

Deps bundles the data sources every handler needs.

type KickConnectionInput

type KickConnectionInput struct {
	ConnID string `json:"connID"`
	Reason string `json:"reason"`
}

type ManagerProvider

type ManagerProvider func() streaming.Manager

ManagerProvider returns the streaming Manager. Resolved at call time so the contributor's lifecycle can be independent of the dashboard's startup order (the manager may not be ready when contract handlers are registered).

type MemberInfo

type MemberInfo struct {
	UserID      string    `json:"userID"`
	Role        string    `json:"role"`
	JoinedAt    time.Time `json:"joinedAt"`
	Permissions []string  `json:"permissions"`
}

MemberInfo is one row of rooms.members.

type MembersList

type MembersList struct {
	Members []MemberInfo `json:"members"`
}

type ModerationEntry

type ModerationEntry struct {
	Timestamp time.Time      `json:"timestamp"`
	Action    string         `json:"action"`
	ActorID   string         `json:"actorID"`
	TargetID  string         `json:"targetID"`
	Reason    string         `json:"reason"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

ModerationEntry is one row of rooms.moderation.

type ModerationLog

type ModerationLog struct {
	Entries []ModerationEntry `json:"entries"`
}

type PresenceInfo

type PresenceInfo struct {
	UserID       string    `json:"userID"`
	Status       string    `json:"status"`
	CustomStatus string    `json:"customStatus,omitempty"`
	LastSeen     time.Time `json:"lastSeen"`
	Rooms        []string  `json:"rooms"`
}

PresenceInfo is one row of presence.list.

type PresenceList

type PresenceList struct {
	Presence []PresenceInfo `json:"presence"`
}

type RoomDetailInput

type RoomDetailInput struct {
	ID string `json:"id"`
}

RoomDetailInput is the input for rooms.detail.

type RoomInfo

type RoomInfo struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Owner       string    `json:"owner"`
	Members     int       `json:"members"`
	Private     bool      `json:"private"`
	Archived    bool      `json:"archived"`
	Created     time.Time `json:"created"`
	Updated     time.Time `json:"updated"`
}

RoomInfo is the wire shape for rooms.list rows.

type RoomsList

type RoomsList struct {
	Rooms []RoomInfo `json:"rooms"`
}

type SendMessageInput

type SendMessageInput struct {
	RoomID  string `json:"roomID"`
	UserID  string `json:"userID"`
	Content string `json:"content"`
}

type SetPresenceInput

type SetPresenceInput struct {
	UserID string `json:"userID"`
	Status string `json:"status"`
}

type StatsResponse

type StatsResponse struct {
	TotalConnections int     `json:"totalConnections"`
	TotalRooms       int     `json:"totalRooms"`
	TotalChannels    int     `json:"totalChannels"`
	TotalMessages    int64   `json:"totalMessages"`
	OnlineUsers      int     `json:"onlineUsers"`
	MessagesPerSec   float64 `json:"messagesPerSec"`
	UptimeSeconds    int64   `json:"uptimeSeconds"`
	MemoryBytes      int64   `json:"memoryBytes"`
}

StatsResponse is the wire shape for the stats query intent.

Jump to

Keyboard shortcuts

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