Documentation ¶
Overview ¶
Package redis provides Redis implementations of interfaces used by networkserver.
Index ¶
- func ApplicationUplinkQueueUIDGenericUplinkKey(r keyer, uid string) string
- func CurrentAddrKey(addrKey string) string
- func FieldKey(addrKey string) string
- func MarshalDeviceCurrentSession(dev *ttnpb.EndDevice) ([]byte, error)
- func MarshalDevicePendingSession(dev *ttnpb.EndDevice) ([]byte, error)
- func PendingAddrKey(addrKey string) string
- func UIDKey(r keyer, uid string) string
- type ApplicationUplinkQueue
- type DeviceRegistry
- func (r *DeviceRegistry) GetByEUI(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, context.Context, error)
- func (r *DeviceRegistry) GetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, ...) (*ttnpb.EndDevice, context.Context, error)
- func (r *DeviceRegistry) Init(ctx context.Context) error
- func (r *DeviceRegistry) RangeByUplinkMatches(ctx context.Context, up *ttnpb.UplinkMessage, cacheTTL time.Duration, ...) error
- func (r *DeviceRegistry) SetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, ...) (*ttnpb.EndDevice, context.Context, error)
- type DownlinkTaskQueue
- func (q *DownlinkTaskQueue) Add(ctx context.Context, devID ttnpb.EndDeviceIdentifiers, startAt time.Time, ...) error
- func (q *DownlinkTaskQueue) Close(ctx context.Context) error
- func (q *DownlinkTaskQueue) Init(ctx context.Context) error
- func (q *DownlinkTaskQueue) Pop(ctx context.Context, ...) error
- type UplinkDeduplicator
- type UplinkMatchPendingSession
- type UplinkMatchResult
- type UplinkMatchSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplicationUplinkQueueUIDGenericUplinkKey ¶ added in v3.9.3
func CurrentAddrKey ¶ added in v3.11.0
func MarshalDeviceCurrentSession ¶ added in v3.11.0
func MarshalDevicePendingSession ¶ added in v3.11.0
func PendingAddrKey ¶ added in v3.11.0
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 (q *ApplicationUplinkQueue) Add(ctx context.Context, ups ...*ttnpb.ApplicationUp) error
func (*ApplicationUplinkQueue) Close ¶ added in v3.11.0
func (q *ApplicationUplinkQueue) Close(ctx context.Context) error
Close closes the ApplicationUplinkQueue.
func (*ApplicationUplinkQueue) Init ¶ added in v3.11.0
func (q *ApplicationUplinkQueue) Init(ctx context.Context) error
Init initializes the ApplicationUplinkQueue.
func (*ApplicationUplinkQueue) Pop ¶ added in v3.11.0
func (q *ApplicationUplinkQueue) Pop(ctx context.Context, f func(context.Context, ttnpb.ApplicationIdentifiers, networkserver.ApplicationUplinkQueueRangeFunc) (time.Time, error)) error
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 ¶
func (r *DeviceRegistry) GetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, context.Context, error)
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 ¶
func (r *DeviceRegistry) SetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(ctx context.Context, pb *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, context.Context, error)
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 ¶
func (q *DownlinkTaskQueue) Pop(ctx context.Context, f func(context.Context, ttnpb.EndDeviceIdentifiers, time.Time) (time.Time, error)) error
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 ¶
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 (*UplinkDeduplicator) DeduplicateUplink ¶
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 ¶ added in v3.11.0
type UplinkMatchPendingSession struct { FNwkSIntKey *ttnpb.KeyEnvelope LoRaWANVersion ttnpb.MACVersion }
func (*UplinkMatchPendingSession) DecodeMsgpack ¶ added in v3.11.0
func (v *UplinkMatchPendingSession) DecodeMsgpack(dec *msgpack.Decoder) error
DecodeMsgpack implements msgpack.CustomDecoder interface.
func (UplinkMatchPendingSession) EncodeMsgpack ¶ added in v3.11.0
func (v UplinkMatchPendingSession) EncodeMsgpack(enc *msgpack.Encoder) error
EncodeMsgpack implements msgpack.CustomEncoder interface.
type UplinkMatchResult ¶ added in v3.11.0
type UplinkMatchResult struct { FNwkSIntKey *ttnpb.KeyEnvelope ResetsFCnt *pbtypes.BoolValue Supports32BitFCnt *pbtypes.BoolValue UID string LoRaWANVersion ttnpb.MACVersion LastFCnt uint32 IsPending bool }
func (*UplinkMatchResult) DecodeMsgpack ¶ added in v3.11.0
func (v *UplinkMatchResult) DecodeMsgpack(dec *msgpack.Decoder) error
DecodeMsgpack implements msgpack.CustomDecoder interface.
func (UplinkMatchResult) EncodeMsgpack ¶ added in v3.11.0
func (v UplinkMatchResult) EncodeMsgpack(enc *msgpack.Encoder) error
EncodeMsgpack implements msgpack.CustomEncoder interface.
type UplinkMatchSession ¶ added in v3.11.0
type UplinkMatchSession struct { FNwkSIntKey *ttnpb.KeyEnvelope ResetsFCnt *pbtypes.BoolValue Supports32BitFCnt *pbtypes.BoolValue LoRaWANVersion ttnpb.MACVersion LastFCnt uint32 }
func (*UplinkMatchSession) DecodeMsgpack ¶ added in v3.11.0
func (v *UplinkMatchSession) DecodeMsgpack(dec *msgpack.Decoder) error
DecodeMsgpack implements msgpack.CustomDecoder interface.
func (UplinkMatchSession) EncodeMsgpack ¶ added in v3.11.0
func (v UplinkMatchSession) EncodeMsgpack(enc *msgpack.Encoder) error
EncodeMsgpack implements msgpack.CustomEncoder interface.