Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions yarn-project/kv-store/src/lmdb/store.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createDebugLogger } from '@aztec/foundation/log';

import { mkdirSync } from 'fs';
import { mkdtemp } from 'fs/promises';
import { mkdtemp, rm } from 'fs/promises';
import { type Database, type Key, type RootDatabase, open } from 'lmdb';
import { tmpdir } from 'os';
import { dirname, join } from 'path';
Expand Down Expand Up @@ -150,9 +150,13 @@ export class AztecLmdbStore implements AztecKVStore {
await this.#rootDb.clearAsync();
}

/** Deletes this store */
/** Deletes this store and removes the database files from disk */
async delete() {
await this.#rootDb.drop();
if (this.path) {
await rm(this.path, { recursive: true, force: true });
this.#log.verbose(`Deleted database files at ${this.path}`);
}
}

estimateSize(): { bytes: number } {
Expand Down