redis

package
v0.0.0-...-60b8695 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 21 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

func ApplicationUplinkQueueUIDGenericUplinkKey(r keyer, uid string) string

func CurrentAddrKey

func CurrentAddrKey(addrKey string) string

func FieldKey

func FieldKey(addrKey string) string

func MarshalDeviceCurrentSession

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

func MarshalDevicePendingSession

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

func PendingAddrKey

func PendingAddrKey(addrKey string) string

func UIDKey

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, minIdle time.Duration) *ApplicationUplinkQueue

NewApplicationUplinkQueue returns new application uplink queue.

func (*ApplicationUplinkQueue) Add

func (*ApplicationUplinkQueue) Close

Close closes the ApplicationUplinkQueue.

func (*ApplicationUplinkQueue) Init

Init initializes the ApplicationUplinkQueue.

type DeviceRegistry

type DeviceRegistry struct {
	Redis   *ttnredis.Client
	LockTTL time.Duration
	// 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

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

func (*DeviceRegistry) RangeByUplinkMatches

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

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

Close closes the DownlinkTaskQueue.

func (*DownlinkTaskQueue) Init

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.

type UplinkMatchPendingSession

type UplinkMatchPendingSession struct {
	FNwkSIntKey    *ttnpb.KeyEnvelope
	LoRaWANVersion ttnpb.MACVersion
}

func (*UplinkMatchPendingSession) DecodeMsgpack

func (v *UplinkMatchPendingSession) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements msgpack.CustomDecoder interface.

func (UplinkMatchPendingSession) EncodeMsgpack

func (v UplinkMatchPendingSession) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder interface.

type UplinkMatchResult

type UplinkMatchResult struct {
	FNwkSIntKey       *ttnpb.KeyEnvelope
	ResetsFCnt        *ttnpb.BoolValue
	Supports32BitFCnt *ttnpb.BoolValue
	UID               string
	LoRaWANVersion    ttnpb.MACVersion
	LastFCnt          uint32
	IsPending         bool
}

func (*UplinkMatchResult) DecodeMsgpack

func (v *UplinkMatchResult) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements msgpack.CustomDecoder interface.

func (UplinkMatchResult) EncodeMsgpack

func (v UplinkMatchResult) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder interface.

type UplinkMatchSession

type UplinkMatchSession struct {
	FNwkSIntKey       *ttnpb.KeyEnvelope
	ResetsFCnt        *ttnpb.BoolValue
	Supports32BitFCnt *ttnpb.BoolValue
	LoRaWANVersion    ttnpb.MACVersion
	LastFCnt          uint32
}

func (*UplinkMatchSession) DecodeMsgpack

func (v *UplinkMatchSession) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements msgpack.CustomDecoder interface.

func (UplinkMatchSession) EncodeMsgpack

func (v UplinkMatchSession) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder interface.

Jump to

Keyboard shortcuts

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