@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
44 lines • 2.81 kB
JavaScript
import { CheckpointStateRepository } from "./repositories/checkpointState.js";
import { AttesterSlashingRepository, BLSToExecutionChangeRepository, BackfilledRanges, BestLightClientUpdateRepository, BlobSidecarsArchiveRepository, BlobSidecarsRepository, BlockArchiveRepository, BlockRepository, CheckpointHeaderRepository, DepositDataRootRepository, DepositEventRepository, Eth1DataRepository, ProposerSlashingRepository, StateArchiveRepository, SyncCommitteeRepository, SyncCommitteeWitnessRepository, VoluntaryExitRepository, } from "./repositories/index.js";
import { PreGenesisState, PreGenesisStateLastProcessedBlock } from "./single/index.js";
export class BeaconDb {
constructor(config, db) {
this.db = db;
// Warning: If code is ever run in the constructor, must change this stub to not extend 'packages/beacon-node/test/utils/stub/beaconDb.ts' -
this.block = new BlockRepository(config, db);
this.blockArchive = new BlockArchiveRepository(config, db);
this.blobSidecars = new BlobSidecarsRepository(config, db);
this.blobSidecarsArchive = new BlobSidecarsArchiveRepository(config, db);
this.stateArchive = new StateArchiveRepository(config, db);
this.checkpointState = new CheckpointStateRepository(config, db);
this.voluntaryExit = new VoluntaryExitRepository(config, db);
this.blsToExecutionChange = new BLSToExecutionChangeRepository(config, db);
this.proposerSlashing = new ProposerSlashingRepository(config, db);
this.attesterSlashing = new AttesterSlashingRepository(config, db);
this.depositEvent = new DepositEventRepository(config, db);
this.depositDataRoot = new DepositDataRootRepository(config, db);
this.eth1Data = new Eth1DataRepository(config, db);
this.preGenesisState = new PreGenesisState(config, db);
this.preGenesisStateLastProcessedBlock = new PreGenesisStateLastProcessedBlock(config, db);
// lightclient
this.bestLightClientUpdate = new BestLightClientUpdateRepository(config, db);
this.checkpointHeader = new CheckpointHeaderRepository(config, db);
this.syncCommittee = new SyncCommitteeRepository(config, db);
this.syncCommitteeWitness = new SyncCommitteeWitnessRepository(config, db);
this.backfilledRanges = new BackfilledRanges(config, db);
}
close() {
return this.db.close();
}
setMetrics(metrics) {
this.db.setMetrics(metrics);
}
async pruneHotDb() {
// Prune all hot blobs
await this.blobSidecars.batchDelete(await this.blobSidecars.keys());
// Prune all hot blocks
// TODO: Enable once it's deemed safe
// await this.block.batchDelete(await this.block.keys());
}
}
//# sourceMappingURL=beacon.js.map