redis

package
v0.0.0-...-5352646 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package redis provides Redis implementations of interfaces used by networkserver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationUplinkQueue

type ApplicationUplinkQueue struct {
	Redis  *ttnredis.Client
	MaxLen int64
	Group  string
	ID     string
	// contains filtered or unexported fields
}

func NewApplicationUplinkQueue

func NewApplicationUplinkQueue(cl *ttnredis.Client, maxLen int64, group, id string) *ApplicationUplinkQueue

NewApplicationUplinkQueue returns new application uplink queue.

func (*ApplicationUplinkQueue) Add

func (*ApplicationUplinkQueue) Subscribe

Subscribe ranges over q.uidUplinkKey(unique.ID(ctx, appID)) using f until ctx is done. Subscribe assumes that there's at most 1 active consumer in q.Group per stream at all times.

type DeviceRegistry

type DeviceRegistry struct {
	Redis *ttnredis.Client
}

DeviceRegistry is an implementation of networkserver.DeviceRegistry.

func (*DeviceRegistry) GetByEUI

func (r *DeviceRegistry) GetByEUI(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, context.Context, error)

GetByEUI gets device by joinEUI, devEUI.

func (*DeviceRegistry) GetByID

GetByID gets device by appID, devID.

func (*DeviceRegistry) RangeByAddr

func (r *DeviceRegistry) RangeByAddr(ctx context.Context, addr types.DevAddr, paths []string, f func(context.Context, *ttnpb.EndDevice) bool) error

RangeByAddr ranges over devices by addr.

func (*DeviceRegistry) SetByID

SetByID sets device by appID, devID.

type DownlinkTaskQueue

type DownlinkTaskQueue struct {
	*ttnredis.TaskQueue
}

DownlinkTaskQueue is an implementation of networkserver.DownlinkTaskQueue.

func NewDownlinkTaskQueue

func NewDownlinkTaskQueue(cl *ttnredis.Client, maxLen int64, group, id string) *DownlinkTaskQueue

NewDownlinkTaskQueue returns new downlink task queue.

func (*DownlinkTaskQueue) Add

func (q *DownlinkTaskQueue) Add(ctx context.Context, devID ttnpb.EndDeviceIdentifiers, startAt time.Time, replace bool) error

Add adds downlink task for device identified by devID at time startAt.

func (*DownlinkTaskQueue) Pop

Pop calls f on the earliest downlink task in the schedule, for which timestamp is in range [0, time.Now()], if such is available, otherwise it blocks until it is.

type UplinkDeduplicator

type UplinkDeduplicator struct {
	Redis *ttnredis.Client
}

UplinkDeduplicator is an implementation of networkserver.UplinkDeduplicator.

func NewUplinkDeduplicator

func NewUplinkDeduplicator(cl *ttnredis.Client) *UplinkDeduplicator

NewUplinkDeduplicator returns a new uplink deduplicator.

func (*UplinkDeduplicator) AccumulatedMetadata

func (d *UplinkDeduplicator) AccumulatedMetadata(ctx context.Context, up *ttnpb.UplinkMessage) ([]*ttnpb.RxMetadata, error)

DeduplicateUplink returns accumulated metadata for up.

func (d *UplinkDeduplicator) DeduplicateUplink(ctx context.Context, up *ttnpb.UplinkMessage, window time.Duration) (bool, error)

DeduplicateUplink deduplicates up for window. Since highest precision allowed by Redis is millisecondsm, window is truncated to milliseconds.

Jump to

Keyboard shortcuts

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