services

package
v0.0.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const LoggingInterval = 100

LoggingInterval is the interval for logging processing progress

Variables

This section is empty.

Functions

func NewDeviceEventNotification added in v0.0.5

func NewDeviceEventNotification(event *models.Event) *models.DeviceEventNotification

NewDeviceEventNotification creates a new notification from an event.

Types

type LocationProcessor

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

LocationProcessor processes device location messages and stores them in Psql

func NewLocationProcessor

func NewLocationProcessor(tsClient *timescaledb.Client, ruleRegistry *registry.RuleRegistry, logger *zap.Logger) *LocationProcessor

NewLocationProcessor creates a new location processor

func (*LocationProcessor) GetStats

func (p *LocationProcessor) GetStats() map[string]interface{}

GetStats returns processor statistics

func (*LocationProcessor) OnOrgCreated

func (p *LocationProcessor) OnOrgCreated(ctx context.Context, orgSlug string) error

OnOrgCreated is invoked when a new organization is created. It ensures any organization-specific setup is performed, such as creating a dedicated DB schema.

func (*LocationProcessor) OnOrgDeleted

func (p *LocationProcessor) OnOrgDeleted(ctx context.Context, orgSlug string) error

OnOrgDeleted is invoked when an organization is deleted. It performs cleanup for organization-specific resources such as dropping the DB schema.

func (*LocationProcessor) ProcessLNSAlertEvent added in v0.0.5

func (p *LocationProcessor) ProcessLNSAlertEvent(ctx context.Context, event *models.Event) error

func (*LocationProcessor) ProcessTelemetry

func (p *LocationProcessor) ProcessTelemetry(ctx context.Context, payload *models.TelemetryPayload) error

ProcessTelemetry processes the entity-centric telemetry payload and stores it in the entities schema.

func (*LocationProcessor) ProcessTelemetryAndTriggerAutomations added in v0.0.4

func (p *LocationProcessor) ProcessTelemetryAndTriggerAutomations(ctx context.Context, msg *models.DeviceLocationMessage) error

ProcessTelemetryAndTriggerAutomations processes a device telemetry message and triggers any matched automation events

type NotificationService added in v0.0.5

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

NotificationService delivers device event notifications via web push.

func NewNotificationService added in v0.0.5

func NewNotificationService(store SubscriptionStore, logger *zap.Logger, cfg config.Notifications) *NotificationService

NewNotificationService creates a notification service.

func (*NotificationService) Enabled added in v0.0.5

func (s *NotificationService) Enabled() bool

Enabled reports whether delivery is fully configured.

func (*NotificationService) NotifyEvent added in v0.0.5

func (s *NotificationService) NotifyEvent(ctx context.Context, event *models.Event, orgSlug string) error

func (*NotificationService) SetSender added in v0.0.5

func (s *NotificationService) SetSender(sender PushSender)

SetSender overrides the web push sender, mainly for tests.

type PushSender added in v0.0.5

type PushSender interface {
	SendNotification(payload []byte, subscription *webpush.Subscription, options *webpush.Options) (*http.Response, error)
}

PushSender sends web push payloads to browser subscriptions.

type SubscriptionStore added in v0.0.5

type SubscriptionStore interface {
	GetPushSubscriptionsByUserIDs(ctx context.Context, orgSlug string, userIDs []string) ([]*models.PushSubscription, error)
	DeletePushSubscriptionById(ctx context.Context, orgSlug, userID, subscriptionID string) error
}

SubscriptionStore provides access to push subscriptions.

Jump to

Keyboard shortcuts

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