Documentation ¶
Overview ¶
Package redis provides Redis implementations of interfaces used by networkserver.
Index ¶
- Constants
- 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
- func (q *ApplicationUplinkQueue) Add(ctx context.Context, ups ...*ttnpb.ApplicationUp) error
- func (q *ApplicationUplinkQueue) Close(ctx context.Context) error
- func (q *ApplicationUplinkQueue) Dispatch(ctx context.Context, consumerID string) error
- func (q *ApplicationUplinkQueue) Init(ctx context.Context) error
- func (q *ApplicationUplinkQueue) Pop(ctx context.Context, consumerID string, ...) error
- 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) Range(ctx context.Context, paths []string, ...) error
- func (r *DeviceRegistry) RangeByUplinkMatches(ctx context.Context, up *ttnpb.UplinkMessage, ...) 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) Dispatch(ctx context.Context, consumerID string) error
- func (q *DownlinkTaskQueue) Init(ctx context.Context) error
- func (q *DownlinkTaskQueue) Pop(ctx context.Context, consumerID string, ...) error
- type ScheduledDownlinkMatcher
- type UplinkDeduplicator
- type UplinkMatchPendingSession
- type UplinkMatchResult
- type UplinkMatchSession
Constants ¶
const SchemaVersion = 1
SchemaVersion is the Network Server database schema version. Bump when a migration is required.
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 string, minIdle time.Duration) *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) Dispatch ¶ added in v3.18.2
func (q *ApplicationUplinkQueue) Dispatch(ctx context.Context, consumerID string) error
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, consumerID string, f func(context.Context, *ttnpb.ApplicationIdentifiers, networkserver.ApplicationUplinkQueueDrainFunc) (time.Time, error)) error
type DeviceRegistry ¶
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) Range ¶ added in v3.16.0
func (r *DeviceRegistry) Range(ctx context.Context, paths []string, f func(context.Context, *ttnpb.EndDeviceIdentifiers, *ttnpb.EndDevice) bool) error
Range ranges over device uid keys in DeviceRegistry.
func (*DeviceRegistry) RangeByUplinkMatches ¶ added in v3.10.0
func (r *DeviceRegistry) RangeByUplinkMatches(ctx context.Context, up *ttnpb.UplinkMessage, 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 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) Dispatch ¶ added in v3.18.2
func (q *DownlinkTaskQueue) Dispatch(ctx context.Context, consumerID string) error
Dispatch dispatches the tasks in the queue.
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, consumerID string, 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 ScheduledDownlinkMatcher ¶ added in v3.13.3
ScheduledDownlinkMatcher is an implementation of networkserver.ScheduledDownlinkMatcher.
func (*ScheduledDownlinkMatcher) Add ¶ added in v3.13.3
func (m *ScheduledDownlinkMatcher) Add(ctx context.Context, down *ttnpb.DownlinkMessage) error
func (*ScheduledDownlinkMatcher) Match ¶ added in v3.13.3
func (m *ScheduledDownlinkMatcher) Match(ctx context.Context, ack *ttnpb.TxAcknowledgment) (*ttnpb.DownlinkMessage, error)
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, round uint64) ([]*ttnpb.RxMetadata, error)
AccumulatedMetadata returns accumulated metadata for up.
func (*UplinkDeduplicator) DeduplicateUplink ¶
func (d *UplinkDeduplicator) DeduplicateUplink(ctx context.Context, up *ttnpb.UplinkMessage, window time.Duration, round uint64) (bool, error)
DeduplicateUplink deduplicates up for window. Since highest precision allowed by Redis is milliseconds, 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 *ttnpb.BoolValue Supports32BitFCnt *ttnpb.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 *ttnpb.BoolValue Supports32BitFCnt *ttnpb.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.