MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / RangeToLocalSet

Method RangeToLocalSet

pkg/joinserver/cleanup.go:34–48  ·  view source on GitHub ↗

RangeToLocalSet returns a set of devices that have data in the registry.

(ctx context.Context)

Source from the content-addressed store, hash-verified

32
33// RangeToLocalSet returns a set of devices that have data in the registry.
34func (cleaner *RegistryCleaner) RangeToLocalSet(ctx context.Context) error {
35 cleaner.LocalDeviceSet = make(map[string]struct{})
36 cleaner.LocalApplicationSet = make(map[string]struct{})
37 err := cleaner.DevRegistry.RangeByID(ctx, []string{"ids"}, func(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers, dev *ttnpb.EndDevice) bool {
38 cleaner.LocalDeviceSet[unique.ID(ctx, ids)] = struct{}{}
39 return true
40 })
41 if err != nil {
42 return err
43 }
44 return cleaner.AppAsRegistry.Range(ctx, []string{"application_server_id"}, func(ctx context.Context, ids *ttnpb.ApplicationIdentifiers, _ *ttnpb.ApplicationActivationSettings) bool {
45 cleaner.LocalApplicationSet[unique.ID(ctx, ids)] = struct{}{}
46 return true
47 })
48}
49
50// DeleteApplicationAndDeviceData deletes registry application data of all devices in the device id list.
51func (cleaner *RegistryCleaner) DeleteApplicationAndDeviceData(ctx context.Context, deviceList, applicationList []string) error {

Callers 7

TestJoinServerCleanupFunction · 0.95
NewJSRegistryCleanerFunction · 0.95
NewPubSubCleanerFunction · 0.95
NewPackagesCleanerFunction · 0.95
NewWebhookCleanerFunction · 0.95

Calls 3

IDFunction · 0.92
RangeByIDMethod · 0.65
RangeMethod · 0.65

Tested by 1

TestJoinServerCleanupFunction · 0.76