wps

package
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

wave pubsub system

Index

Constants

View Source
const (
	Event_BlockClose          = "blockclose"           // type: string
	Event_ConnChange          = "connchange"           // type: wshrpc.ConnStatus
	Event_SysInfo             = "sysinfo"              // type: wshrpc.TimeSeriesData
	Event_ControllerStatus    = "controllerstatus"     // type: *blockcontroller.BlockControllerRuntimeStatus
	Event_BuilderStatus       = "builderstatus"        // type: wshrpc.BuilderStatusData
	Event_BuilderOutput       = "builderoutput"        // type: map[string]any
	Event_WaveObjUpdate       = "waveobj:update"       // type: waveobj.WaveObjUpdate
	Event_BlockFile           = "blockfile"            // type: *WSFileEventData
	Event_Config              = "config"               // type: wconfig.WatcherUpdate
	Event_UserInput           = "userinput"            // type: *userinput.UserInputRequest
	Event_RouteDown           = "route:down"           // type: none
	Event_RouteUp             = "route:up"             // type: none
	Event_WorkspaceUpdate     = "workspace:update"     // type: none
	Event_WaveAIRateLimit     = "waveai:ratelimit"     // type: *uctypes.RateLimitInfo
	Event_WaveAppAppGoUpdated = "waveapp:appgoupdated" // type: none
	Event_TsunamiUpdateMeta   = "tsunami:updatemeta"   // type: wshrpc.AppMeta
	Event_AIModeConfig        = "waveai:modeconfig"    // type: wconfig.AIModeConfigUpdate
	Event_BlockJobStatus      = "block:jobstatus"      // type: wshrpc.BlockJobStatusData
	Event_Badge               = "badge"                // type: baseds.BadgeEvent
)

IMPORTANT: When adding a new event constant, you MUST also:

  1. Add a "// type: <TypeName>" comment (use "none" if no data is sent)
  2. Add the constant to AllEvents below
  3. Add an entry to WaveEventDataTypes in pkg/tsgen/tsgenevent.go - Use reflect.TypeOf(YourType{}) for value types - Use reflect.TypeOf((*YourType)(nil)) for pointer types - Use nil if no data is sent for the event
View Source
const (
	FileOp_Create     = "create"
	FileOp_Delete     = "delete"
	FileOp_Append     = "append"
	FileOp_Truncate   = "truncate"
	FileOp_Invalidate = "invalidate"
)
View Source
const MaxPersist = 4096

Variables

View Source
var Broker = &BrokerType{
	Lock:       &sync.Mutex{},
	SubMap:     make(map[string]*BrokerSubscription),
	PersistMap: make(map[persistKey]*persistEventWrap),
}

Functions

This section is empty.

Types

type BrokerSubscription

type BrokerSubscription struct {
	AllSubs   []string            // routeids subscribed to "all" events
	ScopeSubs map[string][]string // routeids subscribed to specific scopes
	StarSubs  map[string][]string // routeids subscribed to star scope (scopes with "*" or "**" in them)
}

func (*BrokerSubscription) IsEmpty

func (bs *BrokerSubscription) IsEmpty() bool

type BrokerType

type BrokerType struct {
	Lock       *sync.Mutex
	Client     Client
	SubMap     map[string]*BrokerSubscription
	PersistMap map[persistKey]*persistEventWrap
}

func (*BrokerType) GetClient

func (b *BrokerType) GetClient() Client

func (*BrokerType) Publish

func (b *BrokerType) Publish(event WaveEvent)

func (*BrokerType) ReadEventHistory

func (b *BrokerType) ReadEventHistory(eventType string, scope string, maxItems int) []*WaveEvent

does not take wildcards, use "" for all

func (*BrokerType) SendUpdateEvents

func (b *BrokerType) SendUpdateEvents(updates waveobj.UpdatesRtnType)

func (*BrokerType) SetClient

func (b *BrokerType) SetClient(client Client)

func (*BrokerType) Subscribe

func (b *BrokerType) Subscribe(subRouteId string, sub SubscriptionRequest)

if already subscribed, this will *resubscribe* with the new subscription (remove the old one, and replace with this one)

func (*BrokerType) Unsubscribe

func (b *BrokerType) Unsubscribe(subRouteId string, eventName string)

func (*BrokerType) UnsubscribeAll

func (b *BrokerType) UnsubscribeAll(subRouteId string)

type Client

type Client interface {
	SendEvent(routeId string, event WaveEvent)
}

type SubscriptionRequest

type SubscriptionRequest struct {
	Event     string   `json:"event"`
	Scopes    []string `json:"scopes,omitempty"`
	AllScopes bool     `json:"allscopes,omitempty"`
}

type WSFileEventData

type WSFileEventData struct {
	ZoneId   string `json:"zoneid"`
	FileName string `json:"filename"`
	FileOp   string `json:"fileop"`
	Data64   string `json:"data64"`
}

type WaveEvent

type WaveEvent struct {
	Event   string   `json:"event"`
	Scopes  []string `json:"scopes,omitempty"`
	Sender  string   `json:"sender,omitempty"`
	Persist int      `json:"persist,omitempty"`
	Data    any      `json:"data,omitempty"`
}

func (WaveEvent) HasScope

func (e WaveEvent) HasScope(scope string) bool

Jump to

Keyboard shortcuts

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