Documentation ¶
Overview ¶
Package redis provides Redis implementations of interfaces used by networkserver.
Index ¶
- 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) RangeByAddr(ctx context.Context, addr types.DevAddr, paths []string, ...) error
- func (r *DeviceRegistry) SetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, ...) (*ttnpb.EndDevice, context.Context, error)
- type DownlinkTaskQueue
- type UplinkDeduplicator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationUplinkQueue ¶
type ApplicationUplinkQueue struct { Redis *ttnredis.Client MaxLen int64 Group string ID string // 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) Subscribe ¶
func (q *ApplicationUplinkQueue) Subscribe(ctx context.Context, appID ttnpb.ApplicationIdentifiers, f func(context.Context, *ttnpb.ApplicationUp) error) error
Subscribe ranges over q.uidUplinkKey(unique.ID(ctx, appID)) using f until ctx is done. Subscribe assumes that there's at most 1 active consumer in q.Group per stream at all times.
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) RangeByAddr ¶
func (r *DeviceRegistry) RangeByAddr(ctx context.Context, addr types.DevAddr, paths []string, f func(context.Context, *ttnpb.EndDevice) bool) error
RangeByAddr ranges over devices by addr.
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 ¶
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) Pop ¶
func (q *DownlinkTaskQueue) Pop(ctx context.Context, f func(context.Context, ttnpb.EndDeviceIdentifiers, 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.