clear method
Drop all data from this bundle's stores while keeping the underlying connections (Hive boxes etc.) open. Idempotent. Intended for cheap per-test isolation.
Implementation
@override
Future<void> clear() async {
if (_closed) {
throw StateError(
'Cannot clear a closed HiveAtPersistenceBundle for $atSign');
}
// Order: keystore, commit log (via keystore), access log,
// notification keystore. Caller-visible state and in-memory
// caches are reset; underlying Hive boxes stay open for fast
// reuse in subsequent tests.
await keyValueStore.clear();
final commitLog = keyValueStore.commitLog;
if (commitLog is HiveAtCommitLog) {
await commitLog.commitLogKeyStore.getBox().clear();
}
await accessLog?.clear();
await notificationKeystore?.clear();
}