UNPKG

vrack-db

Version:

This is an In Memory database designed for storing time series (graphs).

15 lines (14 loc) 578 B
"use strict"; /* * Copyright © 2023 Boris Bobylev. All rights reserved. * Licensed under the Apache License, Version 2.0 */ Object.defineProperty(exports, "__esModule", { value: true }); const buffer_1 = require("buffer"); const POINT_SIZE = 8; class Uint64Storage { constructor(points) { this.buffer = buffer_1.Buffer.alloc(points * POINT_SIZE); } readBuffer(index) { return Number(this.buffer.readBigUInt64LE(index * POINT_SIZE)); } writeBuffer(index, value) { this.buffer.writeBigUInt64LE(BigInt(value), index * POINT_SIZE); } } exports.default = Uint64Storage;