Skip to content

Commit

Permalink
Merge b9fb725 into 3d61bdf
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino authored Aug 15, 2024
2 parents 3d61bdf + b9fb725 commit fb0e87f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion yarn-project/kv-store/src/lmdb/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ describe('AztecLmdbStore', () => {
};

it('forks a persistent store', async () => {
const path = join(await mkdtemp(join(tmpdir(), 'aztec-store-test-')), 'main.mdb');
const path = await mkdtemp(join(tmpdir(), 'aztec-store-test-'));
const store = AztecLmdbStore.open(path, false);
await itForks(store);
});

it('forks a persistent store with no path', async () => {
const store = AztecLmdbStore.open(undefined, false);
await itForks(store);
});

it('forks an ephemeral store', async () => {
const store = AztecLmdbStore.open(undefined, true);
await itForks(store);
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/kv-store/src/lmdb/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export class AztecLmdbStore implements AztecKVStore {
async fork() {
const baseDir = this.path ? dirname(this.path) : tmpdir();
this.#log.debug(`Forking store with basedir ${baseDir}`);
const forkPath = join(await mkdtemp(join(baseDir, 'aztec-store-fork-')), 'root.mdb');
const forkPath =
(await mkdtemp(join(baseDir, 'aztec-store-fork-'))) + (this.isEphemeral || !this.path ? '/data.mdb' : '');
this.#log.verbose(`Forking store to ${forkPath}`);
await this.#rootDb.backup(forkPath, false);
const forkDb = open(forkPath, { noSync: this.isEphemeral });
Expand Down

0 comments on commit fb0e87f

Please sign in to comment.