forget method
Forgets location and removes every trace of it this device holds.
Call only after the user has confirmed what survey reported: the journal entries it removes are changes that never reached the remote.
Implementation
Future<TomForgottenLocation> forget(String location) async {
// The meta scope is decided against the *other* locations before this one
// is removed from the list it is compared with.
final metaScope = _exclusiveMetaScope(location);
final overrides = await _overridesUnder(location);
for (final locator in overrides) {
for (final registry in keyRegistries) {
registry.removeKeyFor(locator);
}
await keyStore?.removeOverride(locator);
}
final dropped =
await journal?.scrubLocation(location) ?? const <TomPendingCommit>[];
final scrub =
await cache?.scrubLocation(location, metaScope: metaScope) ??
const TomCacheScrub();
final persisted = await locations.forget(location);
return TomForgottenLocation(
location: location,
persisted: persisted,
journalEntriesRemoved: dropped.length,
keyOverridesRemoved: overrides.length,
cache: scrub,
);
}