Files

29 lines
852 B
JavaScript
Raw Permalink Normal View History

import fs from 'node:fs';
import { ShardedSnapshot } from '../src/core/shards/ShardedSnapshot.js';
import path from 'node:path';
import { FileShardStorage } from '../src/core/shards/FileShardStorage.js';
const manifestPath = process.argv[2];
if (!manifestPath) {
console.error('Usage: node new-eval/sharded-snapshot-query.js <manifest.json>');
process.exit(1);
}
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
const storage = new FileShardStorage(path.dirname(manifestPath));
const snapshot = new ShardedSnapshot(manifest, storage, { cacheLimit: 8 });
snapshot.initializeSync();
async function run() {
const relationId = 0;
const srcId = 0;
const dstId = 0;
const edge = snapshot.findEdgeSync(srcId, relationId, dstId);
console.log({ edge });
}
run().catch((err) => {
console.error(err);
process.exit(1);
});