sockets

package
v0.0.0-...-0bdedc6 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProbesConnected = stats.NewGauge32("api.probes.connected")
	UpdatesSent     = stats.NewCounter32("api.probes.updates-sent")
	CreatesSent     = stats.NewCounter32("api.probes.creates-sent")
	RemovesSent     = stats.NewCounter32("api.probes.removes-sent")
)
View Source
var (
	RefreshDuration = stats.NewMeter32("api.probes.refresh-duration", true)
)

Functions

func Emit

func Emit(id string, event string, payload interface{})

func InitCache

func InitCache(pub services.MetricsEventsPublisher)

func Refresh

func Refresh(id int64)

func Remove

func Remove(id string)

func Set

func Set(id string, sock *ProbeSocket)

func Shutdown

func Shutdown()

func UpdateProbe

func UpdateProbe(probe *m.ProbeDTO)

Types

type Cache

type Cache struct {
	sync.RWMutex
	Sockets map[string]*ProbeSocket
	// contains filtered or unexported fields
}

func (*Cache) Emit

func (c *Cache) Emit(id string, event string, payload interface{})

func (*Cache) Refresh

func (c *Cache) Refresh(id int64)

func (*Cache) Remove

func (c *Cache) Remove(id string)

func (*Cache) Set

func (c *Cache) Set(id string, sock *ProbeSocket)

func (*Cache) Shutdown

func (c *Cache) Shutdown()

func (*Cache) UpdateProbe

func (c *Cache) UpdateProbe(probe *m.ProbeDTO)

type ProbeSocket

type ProbeSocket struct {
	sync.Mutex
	*auth.User
	Probe   *m.ProbeDTO
	Socket  socketio.Socket
	Session *m.ProbeSession
	// contains filtered or unexported fields
}

func NewProbeSocket

func NewProbeSocket(user *auth.User, probe *m.ProbeDTO, so socketio.Socket, session *m.ProbeSession, heartbeatInterval time.Duration) *ProbeSocket

func (*ProbeSocket) EmitReady

func (p *ProbeSocket) EmitReady() error

func (*ProbeSocket) LastRefresh

func (p *ProbeSocket) LastRefresh() time.Time

func (*ProbeSocket) OnDisconnection

func (p *ProbeSocket) OnDisconnection()

func (*ProbeSocket) OnEvent

func (p *ProbeSocket) OnEvent(msg *schema.ProbeEvent)

func (*ProbeSocket) OnResults

func (p *ProbeSocket) OnResults(results []*schemaV0.MetricData)

func (*ProbeSocket) Refresh

func (p *ProbeSocket) Refresh()

func (*ProbeSocket) Remove

func (p *ProbeSocket) Remove() error

func (*ProbeSocket) Start

func (p *ProbeSocket) Start()

Jump to

Keyboard shortcuts

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