bus

package
v8.7.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ErrorEvent            = "error"
	UnlockCoreEvent       = "unlock-core"
	CreateObjectEvent     = "create-object"
	UpdateObjectEvent     = "update-object"
	DeleteObjectEvent     = "delete-object"
	TaskStatusUpdateEvent = "task-status-update"
	TaskLogUpdateEvent    = "task-log-update"
	TenantInviteEvent     = "tenant-invite"
	TenantBanishEvent     = "tenant-banish"
	HealthUpdateEvent     = "health-update"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

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

func New

func New(n, backlog int) *Bus

func (*Bus) DumpState

func (b *Bus) DumpState() Metrics

func (*Bus) Register

func (b *Bus) Register(queues []string) (chan Event, int64, error)

func (*Bus) Send

func (b *Bus) Send(event, typ string, thing interface{}, queues ...string)

func (*Bus) SendError

func (b *Bus) SendError(err error, queues ...string)

func (*Bus) SendEvent

func (b *Bus) SendEvent(queues []string, ev Event)

func (*Bus) Unregister

func (b *Bus) Unregister(id int64)

Unregister causes the bus to stop routing events to the handler with the given ID. The channel returned from the matching call to register is closed. Multiple calls to Unregister with the same id are idempotent.

type Event

type Event struct {
	Event string      `json:"event"`
	Queue string      `json:"queue"`
	Type  string      `json:"type,omitempty"`
	Data  interface{} `json:"data"`
}

type MetricSlot

type MetricSlot struct {
	ID         int64    `json:"id"`
	Queued     int      `json:"queued"`
	MostQueued int      `json:"most_queued"`
	Index      int      `json:"index"`
	ACLs       []string `json:"acls"`
}

type Metrics

type Metrics struct {
	Configuration struct {
		MaxSlots int `json:"max_slots"`
		Backlog  int `json:"backlog"`
	} `json:"configuration"`
	Connections struct {
		Lifetime int64 `json:"lifetime"`
		Current  int64 `json:"current"`
		Dropped  int64 `json:"dropped"`
	} `json:"connections"`
	Events   map[string]int64 `json:"events"`
	Messages map[string]int64 `json:"messages"`

	Slots []MetricSlot `json:"clients"`
}

Jump to

Keyboard shortcuts

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