wps

package
v0.11.4-beta.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: Apache-2.0 Imports: 4 Imported by: ? modules, 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"
	Event_ConnChange       = "connchange"
	Event_SysInfo          = "sysinfo"
	Event_ControllerStatus = "controllerstatus"
	Event_WaveObjUpdate    = "waveobj:update"
	Event_BlockFile        = "blockfile"
	Event_Config           = "config"
	Event_UserInput        = "userinput"
	Event_RouteGone        = "route:gone"
	Event_WorkspaceUpdate  = "workspace:update"
)
View Source
const (
	FileOp_Create     = "create"
	FileOp_Delete     = "delete"
	FileOp_Append     = "append"
	FileOp_Truncate   = "truncate"
	FileOp_Invalidate = "invalidate"
)
View Source
const MaxPersist = 4096
View Source
const ReMakeArrThreshold = 10 * 1024

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