import { Repository } from "@lodestar/db";
import { ssz } from "@lodestar/types";
import { bytesToInt } from "@lodestar/utils";
import { Bucket, getBucketNameByValue } from "../buckets.js";
/**
 * Slot to slot ranges that ensure that block range is fully backfilled
 *
 * If node starts backfilling at slots 1000, and backfills to 800, there will be an entry
 * 1000 -> 800
 *
 * When the node is backfilling if it starts at 1200 and backfills to 1000, it will find this sequence and,
 * jump directly to 800 and delete the key 1000.
 */
export class BackfilledRanges extends Repository {
    constructor(config, db) {
        const bucket = Bucket.backfilled_ranges;
        super(config, db, bucket, ssz.Slot, getBucketNameByValue(bucket));
    }
    decodeKey(data) {
        return bytesToInt(super.decodeKey(data), "be");
    }
    getId(_value) {
        throw new Error("Cannot get the db key from slot");
    }
}
//# sourceMappingURL=backfilledRanges.js.map