Skip to content

Commit

Permalink
feat: modify all SwingStore uses to reflect constructor renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
FUDCo committed Jun 3, 2021
1 parent 1c986ba commit 9cda6a4
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 32 deletions.
6 changes: 3 additions & 3 deletions packages/SwingSet/src/hostStorage.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @ts-check
import { initSwingStore as initSimpleSwingStore } from '@agoric/swing-store-simple';
import { initSimpleSwingStore } from '@agoric/swing-store-simple';
import {
initSwingStore as initLMDBSwingStore,
openSwingStore as openLMDBSwingStore,
initLMDBSwingStore,
openLMDBSwingStore,
} from '@agoric/swing-store-lmdb';

import { assert, details as X } from '@agoric/assert';
Expand Down
4 changes: 2 additions & 2 deletions packages/SwingSet/test/test-clist.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { test } from '../tools/prepare-test-env-ava';

// eslint-disable-next-line import/order
import { initSwingStore } from '@agoric/swing-store-simple';
import { initSimpleSwingStore } from '@agoric/swing-store-simple';
import { makeDummySlogger } from '../src/kernel/slogger';
import makeKernelKeeper from '../src/kernel/state/kernelKeeper';
import { wrapStorage } from '../src/kernel/state/storageWrapper';

test(`clist reachability`, async t => {
const slog = makeDummySlogger({});
const hostStorage = initSwingStore();
const hostStorage = initSimpleSwingStore();
const { enhancedCrankBuffer: s } = wrapStorage(hostStorage.kvStore);

const kk = makeKernelKeeper(s, hostStorage.streamStore, slog);
Expand Down
16 changes: 8 additions & 8 deletions packages/SwingSet/test/test-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test } from '../tools/prepare-test-env-ava';

// eslint-disable-next-line import/order
import {
initSwingStore,
initSimpleSwingStore,
getAllState,
setAllState,
} from '@agoric/swing-store-simple';
Expand Down Expand Up @@ -68,12 +68,12 @@ function testStorage(t, s, getState, commit) {
}

test('storageInMemory', t => {
const store = initSwingStore();
const store = initSimpleSwingStore();
testStorage(t, store.kvStore, () => getAllState(store).kvStuff, null);
});

function buildHostDBAndGetState() {
const store = initSwingStore();
const store = initSimpleSwingStore();
const hostDB = buildHostDBInMemory(store.kvStore);
return { hostDB, getState: () => getAllState(store).kvStuff };
}
Expand Down Expand Up @@ -119,13 +119,13 @@ test('blockBuffer fulfills storage API', t => {
});

test('guardStorage fulfills storage API', t => {
const store = initSwingStore();
const store = initSimpleSwingStore();
const guardedHostStorage = guardStorage(store.kvStore);
testStorage(t, guardedHostStorage, () => getAllState(store).kvStuff, null);
});

test('crankBuffer fulfills storage API', t => {
const store = initSwingStore();
const store = initSimpleSwingStore();
const { crankBuffer, commitCrank } = buildCrankBuffer(store.kvStore);
testStorage(t, crankBuffer, () => getAllState(store).kvStuff, commitCrank);
});
Expand Down Expand Up @@ -186,7 +186,7 @@ test('crankBuffer can abortCrank', t => {
});

test('storage helpers', t => {
const store = initSwingStore();
const store = initSimpleSwingStore();
const s = addHelpers(store.kvStore);

s.set('foo.0', 'f0');
Expand Down Expand Up @@ -236,7 +236,7 @@ test('storage helpers', t => {
});

function buildKeeperStorageInMemory() {
const store = initSwingStore();
const store = initSimpleSwingStore();
const { kvStore, streamStore } = store;
const { enhancedCrankBuffer, commitCrank } = wrapStorage(kvStore);
return {
Expand All @@ -248,7 +248,7 @@ function buildKeeperStorageInMemory() {
}

function duplicateKeeper(getState) {
const store = initSwingStore();
const store = initSimpleSwingStore();
const { kvStore, streamStore } = store;
setAllState(store, { kvStuff: getState(), streamStuff: new Map() });
const { enhancedCrankBuffer } = wrapStorage(kvStore);
Expand Down
4 changes: 2 additions & 2 deletions packages/SwingSet/tools/db-delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import '@agoric/install-ses';
import process from 'process';
import { openSwingStore } from '@agoric/swing-store-lmdb';
import { openLMDBSwingStore } from '@agoric/swing-store-lmdb';

const log = console.log;

Expand Down Expand Up @@ -47,7 +47,7 @@ function run() {
const stateDBDir = argv.shift();
const key = argv.shift();

const { kvStore, commit } = openSwingStore(stateDBDir);
const { kvStore, commit } = openLMDBSwingStore(stateDBDir);

if (range) {
for (const k of kvStore.getKeys(`${key}.`, `${key}/`)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/SwingSet/tools/db-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import '@agoric/install-ses';
import process from 'process';
import { openSwingStore } from '@agoric/swing-store-lmdb';
import { openLMDBSwingStore } from '@agoric/swing-store-lmdb';

const log = console.log;

Expand Down Expand Up @@ -58,7 +58,7 @@ function run() {
const stateDBDir = argv.shift();
const key = argv.shift();

const { kvStore } = openSwingStore(stateDBDir);
const { kvStore } = openLMDBSwingStore(stateDBDir);

function pkv(k) {
const value = kvStore.get(k);
Expand Down
4 changes: 2 additions & 2 deletions packages/SwingSet/tools/db-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import '@agoric/install-ses';
import process from 'process';
import { openSwingStore } from '@agoric/swing-store-lmdb';
import { openLMDBSwingStore } from '@agoric/swing-store-lmdb';

const log = console.log;

Expand Down Expand Up @@ -33,7 +33,7 @@ function run() {
const key = argv.shift();
const value = argv.shift();

const { kvStore, commit } = openSwingStore(stateDBDir);
const { kvStore, commit } = openLMDBSwingStore(stateDBDir);

kvStore.set(key, value);
commit();
Expand Down
4 changes: 2 additions & 2 deletions packages/SwingSet/tools/replace-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import '@agoric/install-ses';
import process from 'process';
import { openSwingStore } from '@agoric/swing-store-lmdb';
import { openLMDBSwingStore } from '@agoric/swing-store-lmdb';
import bundleSource from '@agoric/bundle-source';

const log = console.log;
Expand Down Expand Up @@ -35,7 +35,7 @@ async function run() {
const stateDBDir = argv.shift();
const srcPath = argv.shift();

const { kvStore, commit } = openSwingStore(stateDBDir);
const { kvStore, commit } = openLMDBSwingStore(stateDBDir);
log(`will use ${srcPath} in ${stateDBDir} for ${bundleName}`);

if (bundleName === 'kernel') {
Expand Down
4 changes: 2 additions & 2 deletions packages/cosmic-swingset/src/launch-chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
loadSwingsetConfigFile,
} from '@agoric/swingset-vat';
import { assert, details as X } from '@agoric/assert';
import { openSwingStore } from '@agoric/swing-store-lmdb';
import { openLMDBSwingStore } from '@agoric/swing-store-lmdb';
import {
DEFAULT_METER_PROVIDER,
exportKernelStats,
Expand Down Expand Up @@ -97,7 +97,7 @@ export async function launch(
) {
console.info('Launching SwingSet kernel');

const { kvStore, streamStore, commit } = openSwingStore(kernelStateDBDir);
const { kvStore, streamStore, commit } = openLMDBSwingStore(kernelStateDBDir);
const hostStorage = {
kvStore,
streamStore,
Expand Down
4 changes: 2 additions & 2 deletions packages/solo/src/reset-state.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';
import fs from 'fs';

import { initSwingStore } from '@agoric/swing-store-lmdb';
import { initLMDBSwingStore } from '@agoric/swing-store-lmdb';

export default async function resetState(basedir) {
const mailboxStateFile = path.resolve(
Expand All @@ -10,7 +10,7 @@ export default async function resetState(basedir) {
);
fs.writeFileSync(mailboxStateFile, `{}\n`);
const kernelStateDBDir = path.join(basedir, 'swingset-kernel-state');
const { commit, close } = initSwingStore(kernelStateDBDir);
const { commit, close } = initLMDBSwingStore(kernelStateDBDir);
commit();
close();
}
4 changes: 2 additions & 2 deletions packages/solo/src/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
buildPlugin,
buildTimer,
} from '@agoric/swingset-vat';
import { openSwingStore } from '@agoric/swing-store-lmdb';
import { openLMDBSwingStore } from '@agoric/swing-store-lmdb';
import { connectToFakeChain } from '@agoric/cosmic-swingset/src/sim-chain';
import { makeWithQueue } from '@agoric/vats/src/queue';

Expand Down Expand Up @@ -134,7 +134,7 @@ async function buildSwingset(
plugin: { ...plugin.endowments },
};

const { kvStore, streamStore, commit } = openSwingStore(kernelStateDBDir);
const { kvStore, streamStore, commit } = openLMDBSwingStore(kernelStateDBDir);
const hostStorage = {
kvStore,
streamStore,
Expand Down
4 changes: 2 additions & 2 deletions packages/swingset-runner/src/kerneldump.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import path from 'path';
import process from 'process';

import { openSwingStore } from '@agoric/swing-store-lmdb';
import { openLMDBSwingStore } from '@agoric/swing-store-lmdb';

import { dumpStore } from './dumpstore';
import { auditRefCounts } from './auditstore';
Expand Down Expand Up @@ -106,7 +106,7 @@ export function main() {
if (!kernelStateDBDir) {
fail(`can't find a database at ${target}`, false);
}
const swingStore = openSwingStore(kernelStateDBDir);
const swingStore = openLMDBSwingStore(kernelStateDBDir);
if (justStats) {
const rawStats = JSON.parse(swingStore.kvStore.get('kernelStats'));
const cranks = Number(swingStore.kvStore.get('crankNumber'));
Expand Down
6 changes: 3 additions & 3 deletions packages/swingset-runner/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import {
import { buildLoopbox } from '@agoric/swingset-vat/src/devices/loopbox';
import engineGC from '@agoric/swingset-vat/src/engine-gc';

import { initSwingStore as initSimpleSwingStore } from '@agoric/swing-store-simple';
import { initSimpleSwingStore } from '@agoric/swing-store-simple';
import {
initSwingStore as initLMDBSwingStore,
openSwingStore as openLMDBSwingStore,
initLMDBSwingStore,
openLMDBSwingStore,
} from '@agoric/swing-store-lmdb';

import { dumpStore } from './dumpstore';
Expand Down

0 comments on commit 9cda6a4

Please sign in to comment.