store

package
v2.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DevicesSubscriptionQuery

type DevicesSubscriptionQuery struct {
	SubscriptionID string
	LastCheck      time.Time
}

type Store

type Store interface {
	SaveSubscription(ctx context.Context, sub Subscription) error
	PopSubscription(ctx context.Context, subscriptionID string) (Subscription, error)
	LoadSubscriptions(ctx context.Context, query SubscriptionQuery, h SubscriptionHandler) error
	IncrementSubscriptionSequenceNumber(ctx context.Context, subscriptionID string) (uint64, error)
	SetInitialized(ctx context.Context, subscriptionID string) error
}

type Subscription

type Subscription struct {
	ID             string // Id
	URL            string // href
	CorrelationID  string // uuid
	Type           Type
	Accept         []string // application/json or application/vnd.ocf+cbor
	EventTypes     events.EventTypes
	DeviceID       string // filled for device and resource events
	Href           string // filled for resource events
	SequenceNumber uint64
	SigningSecret  string
	Initialized    bool // need to send initialize events
	AccessToken    string
}

type SubscriptionHandler

type SubscriptionHandler interface {
	Handle(ctx context.Context, iter SubscriptionIter) (err error)
}

type SubscriptionIter

type SubscriptionIter interface {
	Next(ctx context.Context, sub *Subscription) bool
	Err() error
}

type SubscriptionQuery

type SubscriptionQuery struct {
	SubscriptionID string
	DeviceID       string
	Href           string
	Type           Type
}

type Type

type Type string
const (
	Type_Devices  Type = "devices"
	Type_Device   Type = "device"
	Type_Resource Type = "resource"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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