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) Init(ctx context.Context) error
- func (q *ApplicationUplinkQueue) Pop(ctx context.Context, consumerID string, limit int, ...) error
- type DeviceRegistry
- func (r *DeviceRegistry) BatchDelete(ctx context.Context, appIDs *ttnpb.ApplicationIdentifiers, deviceIDs []string) ([]*ttnpb.EndDeviceIdentifiers, error)
- func (r *DeviceRegistry) BatchGetByID(ctx context.Context, appID *ttnpb.ApplicationIdentifiers, deviceIDs []string, ...) ([]*ttnpb.EndDevice, error)
- 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 UplinkMatchSession
Constants ¶
const DeviceSchemaVersion = 1
DeviceSchemaVersion is the Network Server database schema version regarding the devices namespace. Bump when a migration is required to the devices namespace.
const UnsupportedDeviceMigrationVersionBreakpoint = 1
UnsupportedDeviceMigrationVersionBreakpoint indicates the breakpoint for versions that cannot be auto-migrated to latest. Use v3.24.0 of The Things Stack to migrate to a supported SchemaVersion before migrating to latest.
const UplinkSchemaVersion = 1
UplinkSchemaVersion is the Network Server database schema version regarding the uplink namespace. Bump when a migration is required to the uplink namespace.
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
}
ApplicationUplinkQueue is an implementation of ApplicationUplinkQueue.
func NewApplicationUplinkQueue ¶
func NewApplicationUplinkQueue( cl *ttnredis.Client, maxLen int64, groupID 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
Add implements ApplicationUplinkQueue interface.
func (*ApplicationUplinkQueue) Close ¶ added in v3.11.0
func (q *ApplicationUplinkQueue) Close(ctx context.Context) error
Close removes all consumers from the consumer group.
type DeviceRegistry ¶
DeviceRegistry is an implementation of networkserver.DeviceRegistry.
func (*DeviceRegistry) BatchDelete ¶ added in v3.27.0
func (r *DeviceRegistry) BatchDelete( ctx context.Context, appIDs *ttnpb.ApplicationIdentifiers, deviceIDs []string, ) ([]*ttnpb.EndDeviceIdentifiers, error)
BatchDelete implements DeviceRegistry. This function deletes all the devices in a single transaction.
func (*DeviceRegistry) BatchGetByID ¶ added in v3.28.1
func (r *DeviceRegistry) BatchGetByID( ctx context.Context, appID *ttnpb.ApplicationIdentifiers, deviceIDs []string, paths []string, ) ([]*ttnpb.EndDevice, error)
BatchGetByID gets devices by appID, deviceIDs.
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, streamBlockLimit time.Duration, ) *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, limit int, 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 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.