Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
171 KiB

{"version":3,"file":"index.cjs","sources":["../external.js","../util/when.js","../write.js","../level.js","../caching.js","../util/RangeIterable.js","../keys.js","../read.js","../open.js","../node-index.js"],"sourcesContent":["export let Env, Compression, Cursor, getAddress, clearKeptObjects, setGlobalBuffer,\r\n\trequire, arch, fs, os, onExit, tmpdir, lmdbError, path, EventEmitter, orderedBinary, MsgpackrEncoder, WeakLRUCache, isWorkerThread;\r\nexport function setNativeFunctions(externals) {\r\n\tEnv = externals.Env;\r\n\tCompression = externals.Compression;\r\n\tgetAddress = externals.getAddress;\r\n\tclearKeptObjects = externals.clearKeptObjects;\r\n\tsetGlobalBuffer = externals.setGlobalBuffer;\r\n\tCursor = externals.Cursor;\r\n\tlmdbError = externals.lmdbError;\r\n\tif (externals.tmpdir)\r\n tmpdir = externals.tmpdir\r\n}\r\nexport function setExternals(externals) {\r\n\trequire = externals.require;\r\n\tarch = externals.arch;\r\n\tfs = externals.fs;\r\n\tpath = externals.path;\r\n\tEventEmitter = externals.EventEmitter;\r\n\torderedBinary = externals.orderedBinary;\r\n\tMsgpackrEncoder = externals.MsgpackrEncoder;\r\n\tWeakLRUCache = externals.WeakLRUCache;\r\n\ttmpdir = externals.tmpdir;\r\n os = externals.os;\r\n\tonExit = externals.onExit;\r\n\tisWorkerThread = externals.isWorkerThread;\r\n}\r\n","export function when(promise, callback, errback) {\r\n if (promise && promise.then) {\r\n return errback ?\r\n promise.then(callback, errback) :\r\n promise.then(callback);\r\n }\r\n return callback(promise);\r\n}\r\n","import { getAddress, onExit } from './external.js';\r\nimport { when } from './util/when.js';\r\nvar backpressureArray;\r\n\r\nconst WAITING_OPERATION = 0x2000000;\r\nconst BACKPRESSURE_THRESHOLD = 100000;\r\nconst TXN_DELIMITER = 0x8000000;\r\nconst TXN_COMMITTED = 0x10000000;\r\nconst TXN_FLUSHED = 0x20000000;\r\nconst TXN_FAILED = 0x40000000;\r\nexport const FAILED_CONDITION = 0x4000000;\r\nconst REUSE_BUFFER_MODE = 512;\r\nconst RESET_BUFFER_MODE = 1024;\r\n\r\nconst SYNC_PROMISE_SUCCESS = Promise.resolve(true);\r\nconst SYNC_PROMISE_FAIL = Promise.resolve(false);\r\nSYNC_PROMISE_SUCCESS.isSync = true;\r\nSYNC_PROMISE_FAIL.isSync = true;\r\nconst PROMISE_SUCCESS = Promise.resolve(true);\r\nexport const ABORT = {};\r\nexport const IF_EXISTS = 3.542694326329068e-103;\r\nconst CALLBACK_THREW = {};\r\nconst LocalSharedArrayBuffer = typeof Deno != 'undefined' ? ArrayBuffer : SharedArrayBuffer; // Deno can't handle SharedArrayBuffer as an FFI argument due to https://github.com/denoland/deno/issues/12678\r\nconst ByteArray = typeof Buffer != 'undefined' ? Buffer.from : Uint8Array;\r\nconst queueTask = typeof setImmediate != 'undefined' ? setImmediate : setTimeout; // TODO: Or queueMicrotask?\r\n//let debugLog = []\r\nconst WRITE_BUFFER_SIZE = 0x10000;\r\nvar log = [];\r\nexport function addWriteMethods(LMDBStore, { env, fixedBuffer, resetReadTxn, useWritemap, maxKeySize,\r\n\teventTurnBatching, txnStartThreshold, batchStartThreshold, overlappingSync, commitDelay, separateFlushed, maxFlushDelay }) {\r\n\t// stands for write instructions\r\n\tvar dynamicBytes;\r\n\tfunction allocateInstructionBuffer() {\r\n\t\t// Must use a shared buffer on older node in order to use Atomics, and it is also more correct since we are \r\n\t\t// indeed accessing and modifying it from another thread (in C). However, Deno can't handle it for\r\n\t\t// FFI so aliased above\r\n\t\tlet buffer = new LocalSharedArrayBuffer(WRITE_BUFFER_SIZE);\r\n\t\tdynamicBytes = new ByteArray(buffer);\r\n\t\tlet uint32 = dynamicBytes.uint32 = new Uint32Array(buffer, 0, WRITE_BUFFER_SIZE >> 2);\r\n\t\tuint32[0] = 0;\r\n\t\tdynamicBytes.float64 = new Float64Array(buffer, 0, WRITE_BUFFER_SIZE >> 3);\r\n\t\tbuffer.address = getAddress(dynamicBytes);\r\n\t\tuint32.address = buffer.address + uint32.byteOffset;\r\n\t\tdynamicBytes.position = 0;\r\n\t\treturn dynamicBytes;\r\n\t}\r\n\tvar newBufferThreshold = (WRITE_BUFFER_SIZE - maxKeySize - 64) >> 3; // need to reserve more room if we do inline values\r\n\tvar outstandingWrit