CleanData cleans registry device and application data.
(ctx context.Context, isDeviceSet, isApplicationSet map[string]struct{})
| 82 | |
| 83 | // CleanData cleans registry device and application data. |
| 84 | func (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 | } |