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

Method CleanData

pkg/joinserver/cleanup.go:84–104  ·  view source on GitHub ↗

CleanData cleans registry device and application data.

(ctx context.Context, isDeviceSet, isApplicationSet map[string]struct{})

Source from the content-addressed store, hash-verified

82
83// CleanData cleans registry device and application data.
84func (cleaner *RegistryCleaner) CleanData(ctx context.Context, isDeviceSet, isApplicationSet map[string]struct{}) error {
85 devComplement := cleanup.ComputeSetComplement(isDeviceSet, cleaner.LocalDeviceSet)
86 devIds := make([]string, len(devComplement))
87 i := 0
88 for id := range devComplement {
89 devIds[i] = id
90 i++
91 }
92 appComplement := cleanup.ComputeSetComplement(isApplicationSet, cleaner.LocalApplicationSet)
93 appIds := make([]string, len(appComplement))
94 i = 0
95 for id := range appComplement {
96 appIds[i] = id
97 i++
98 }
99 err := cleaner.DeleteApplicationAndDeviceData(ctx, devIds, appIds)
100 if err != nil {
101 return err
102 }
103 return nil
104}

Callers 4

TestJoinServerCleanupFunction · 0.95
js_db.goFile · 0.45
ns_db.goFile · 0.45
as_db.goFile · 0.45

Calls 2

ComputeSetComplementFunction · 0.92

Tested by 1

TestJoinServerCleanupFunction · 0.76