redis

package
v3.11.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: Apache-2.0 Imports: 24 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

func ApplicationUplinkQueueUIDGenericUplinkKey added in v3.9.3

func ApplicationUplinkQueueUIDGenericUplinkKey(r keyer, uid string) string

func CurrentAddrKey added in v3.11.0

func CurrentAddrKey(addrKey string) string

func FieldKey added in v3.11.0

func FieldKey(addrKey string) string

func MarshalDeviceCurrentSession added in v3.11.0

func MarshalDeviceCurrentSession(dev *ttnpb.EndDevice) ([]byte, error)

func MarshalDevicePendingSession added in v3.11.0

func MarshalDevicePendingSession(dev *ttnpb.EndDevice) ([]byte, error)

func PendingAddrKey added in v3.11.0

func PendingAddrKey(addrKey string) string

func UIDKey added in v3.11.0

func UIDKey(r keyer, uid string) string

Types

type ApplicationUplinkQueue

type ApplicationUplinkQueue struct {
	// 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) Close added in v3.11.0

Close closes the ApplicationUplinkQueue.

func (*ApplicationUplinkQueue) Init added in v3.11.0

Init initializes the ApplicationUplinkQueue.

func (*ApplicationUplinkQueue) Pop added in v3.11.0

type DeviceRegistry

type DeviceRegistry struct {
	Redis   *ttnredis.Client
	LockTTL time.Duration
	// CompatibilityVersion denotes the lowest possible stack version the registry should be compatible with.
	CompatibilityVersion semver.Version
	// contains filtered or unexported fields
}

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) Init added in v3.8.4

func (r *DeviceRegistry) Init(ctx context.Context) error

func (*DeviceRegistry) RangeByUplinkMatches added in v3.10.0

func (r *DeviceRegistry) RangeByUplinkMatches(ctx context.Context, up *ttnpb.UplinkMessage, cacheTTL time.Duration, f func(context.Context, *networkserver.UplinkMatch) (bool, error)) error

RangeByUplinkMatches ranges over devices matching the uplink.

func (*DeviceRegistry) SetByID

SetByID sets device by appID, devID.

type DownlinkTaskQueue

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

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) Close added in v3.11.0

func (q *DownlinkTaskQueue) Close(ctx context.Context) error

Close closes the DownlinkTaskQueue.

func (*DownlinkTaskQueue) Init added in v3.11.0

func (q *DownlinkTaskQueue) Init(ctx context.Context) error

Init initializes the DownlinkTaskQueue.

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