1 line
219 KiB
Plaintext
1 line
219 KiB
Plaintext
|
{"version":3,"file":"index.cjs","sources":["../native.js","../util/when.js","../write.js","../util/RangeIterable.js","../keys.js","../read.js","../caching.js","../open.js","../level.js","../index.js","../node-index.js"],"sourcesContent":["import { dirname, join, default as pathModule } from 'path';\nimport { fileURLToPath } from 'url';\nimport loadNAPI from 'node-gyp-build-optional-packages';\nexport let Env, Txn, Dbi, Compression, Cursor, getAddress, getBufferAddress, createBufferForAddress, clearKeptObjects, globalBuffer, setGlobalBuffer, arch, fs, os, onExit, tmpdir, lmdbError, path, EventEmitter, orderedBinary, MsgpackrEncoder, WeakLRUCache, setEnvMap, getEnvMap, getByBinary, detachBuffer, startRead, setReadCallback, write, position, iterate, prefetch, resetTxn, getCurrentValue, getCurrentShared, getStringByBinary, getSharedByBinary, getSharedBuffer, compress;\npath = pathModule;\nlet dirName = dirname(fileURLToPath(import.meta.url)).replace(/dist$/, '');\nexport let nativeAddon = loadNAPI(dirName);\n\nif (process.isBun && false) {\n\tconst { linkSymbols, FFIType } = require('bun:ffi');\n\tlet lmdbLib = linkSymbols({\n\t\tgetByBinary: {\n\t\t\targs: [FFIType.f64, FFIType.u32],\n\t\t\treturns: FFIType.u32,\n\t\t\tptr: nativeAddon.getByBinaryPtr\n\t\t},\n\t\titerate: {\n\t\t\targs: [FFIType.f64],\n\t\t\treturns: FFIType.i32,\n\t\t\tptr: nativeAddon.iteratePtr,\n\t\t},\n\t\tposition: {\n\t\t\targs: [FFIType.f64, FFIType.u32, FFIType.u32, FFIType.u32, FFIType.f64],\n\t\t\treturns: FFIType.i32,\n\t\t\tptr: nativeAddon.positionPtr,\n\t\t},\n\t\twrite: {\n\t\t\targs: [FFIType.f64, FFIType.f64],\n\t\t\treturns: FFIType.i32,\n\t\t\tptr: nativeAddon.writePtr,\n\t\t},\n\t\tresetTxn: {\n\t\t\targs: [FFIType.f64],\n\t\t\treturns: FFIType.void,\n\t\t\tptr: nativeAddon.resetTxnPtr,\n\t\t}\n\t});\n\tfor (let key in lmdbLib.symbols) {\n\t\tnativeAddon[key] = lmdbLib.symbols[key].native;\n\t}\n}\nsetNativeFunctions(nativeAddon);\n\t\nexport function setNativeFunctions(externals) {\n\tEnv = externals.Env;\n\tTxn = externals.Txn;\n\tDbi = externals.Dbi;\n\tCompression = externals.Compression;\n\tgetAddress = externals.getAddress;\n\tgetBufferAddress = externals.getBufferAddress;\n\tcreateBufferForAddress = externals.createBufferForAddress;\n\tclearKeptObjects = externals.clearKeptObjects || function() {};\n\tgetByBinary = externals.getByBinary;\n\tdetachBuffer = externals.detachBuffer;\n\tstartRead = externals.startRead;\n\tsetReadCallback = externals.setReadCallback;\n\tsetGlobalBuffer = externals.setGlobalBuffer;\n\tglobalBuffer = externals.globalBuffer;\n\tgetSharedBuffer = externals.getSharedBuffer;\n\tprefetch = externals.prefetch;\n\titerate = externals.iterate;\n\tposition = externals.position;\n\tresetTxn = externals.resetTxn;\n\tgetCurrentValue = externals.getCurrentValue;\n\tgetCurrentShared = externals.getCurrentShared;\n\tgetStringByBinary = externals.getStringByBinary;\n\tgetSharedByBinary = externals.getSharedByBinary;\n\twrite = externals.write;\n\tcompress = externals.compress;\n\tCursor = externals.Cursor;\n\tlmdbError = externals.lmdbError;\n\tif (externals.tmpdir)\n tmpdir = externals.tmpdir\n}\nexport function setExternals(externals) {\n\tarch = externals.arch;\n\tfs = externals.fs;\n\tEventEmitter = externals.EventEmitter;\n\torderedBinary = externals.orderedBinary;\n\tMsgpackrEncoder = externals.MsgpackrEncoder;\n\tWeakLRUCache = externals.WeakLRUCache;\n\ttmpdir = externals.tmpdir;\n os = externals.os;\n\tonExit = externals.onExit;\n}\n","export function when(promise, callback, errback) {\n if (promise && promise.then) {\n return errback ?\n promise.then(callback, errback) :\n promise.then(callback);\n }\n return callback(promise);\n}\n","import { getAddress, getBufferAddress, write, compress, lmdbError } from './native.js';\nimport { when } from './util/when.js';\nvar backpressureArray;\n\nconst WAITING_OPERATION = 0x2000000;\nconst BACKPRESSURE_THRESHOLD = 300000;\nconst TXN_DELIMITER = 0x8000000;\nconst TXN_COMMITTED = 0x10000000;\nconst TXN_FLUSHED = 0x20000000;\nconst TXN_FAILED = 0
|