Lines Matching refs:state

46 const state = Object.create(null);
56 state.verbose = 2;
64 if(state.verbose>level) loggers[level]("OPFS asyncer:",...args);
73 for(k in state.opIds){
84 for(k in state.opIds){
144 let dh = state.rootDir;
205 Atomics.wait(state.sabOPView, state.opIds.retry, 0, ms);
262 Atomics.store(state.sabOPView, state.opIds.rc, value);
263 Atomics.notify(state.sabOPView, state.opIds.rc);
346 state.s11n.storeException(2,e);
347 rc = state.sq3Codes.SQLITE_IOERR;
373 state.s11n.storeException(2,e);
374 rc = state.sq3Codes.SQLITE_IOERR;
396 state.s11n.serialize();
397 rc = state.sq3Codes.SQLITE_NOTFOUND;
436 state.s11n.storeException(2,e);
437 rc = state.sq3Codes.SQLITE_IOERR_DELETE;
450 state.s11n.serialize(Number(rc));
453 state.s11n.storeException(2,e);
454 rc = state.sq3Codes.SQLITE_IOERR;
473 state.s11n.storeException(1,e);
474 rc = state.sq3Codes.SQLITE_IOERR_LOCK;
486 const deleteOnClose = (state.sq3Codes.SQLITE_OPEN_DELETEONCLOSE & flags);
487 const create = (state.sq3Codes.SQLITE_OPEN_CREATE & flags);
494 state.s11n.storeException(1,e);
495 storeAndNotify(opName, state.sq3Codes.SQLITE_NOTFOUND);
514 sabView: state.sabFileBufView,
516 ? false : (state.sq3Codes.SQLITE_OPEN_READONLY & flags),
523 state.s11n.storeException(1,e);
524 storeAndNotify(opName, state.sq3Codes.SQLITE_IOERR);
542 rc = state.sq3Codes.SQLITE_IOERR_SHORT_READ;
547 state.s11n.storeException(1,e);
548 rc = state.sq3Codes.SQLITE_IOERR_READ;
562 state.s11n.storeException(2,e);
563 rc = state.sq3Codes.SQLITE_IOERR_FSYNC;
581 state.s11n.storeException(2,e);
582 rc = state.sq3Codes.SQLITE_IOERR_TRUNCATE;
593 if( state.sq3Codes.SQLITE_LOCK_NONE===lockType
598 state.s11n.storeException(1,e);
599 rc = state.sq3Codes.SQLITE_IOERR_UNLOCK;
618 ) ? 0 : state.sq3Codes.SQLITE_IOERR_WRITE;
621 state.s11n.storeException(1,e);
622 rc = state.sq3Codes.SQLITE_IOERR_WRITE;
635 if(state.s11n) return state.s11n;
638 viewU8 = new Uint8Array(state.sabIO, state.sabS11nOffset, state.sabS11nSize),
639 viewDV = new DataView(state.sabIO, state.sabS11nOffset, state.sabS11nSize);
640 state.s11n = Object.create(null);
659 state.s11n.deserialize = function(clear=false){
673 v = viewDV[t.getter](offset, state.littleEndian);
676 n = viewDV.getInt32(offset, state.littleEndian);
689 state.s11n.serialize = function(...args){
708 viewDV[t.setter](offset, args[i], state.littleEndian);
712 viewDV.setInt32(offset, s.byteLength, state.littleEndian);
725 state.s11n.storeException = state.asyncS11nExceptions
727 if(priority<=state.asyncS11nExceptions){
728 state.s11n.serialize([e.name,': ',e.message].join(""));
733 return state.s11n;
738 for(let k of Object.keys(state.opIds)){
742 opHandlers[state.opIds[k]] = o;
755 state.sabOPView, state.opIds.whichOp, 0, waitTime
767 const opId = Atomics.load(state.sabOPView, state.opIds.whichOp);
768 Atomics.store(state.sabOPView, state.opIds.whichOp, 0);
770 const args = state.s11n.deserialize(
786 state.rootDir = d;
792 state.littleEndian = opt.littleEndian;
793 state.asyncS11nExceptions = opt.asyncS11nExceptions;
794 state.verbose = opt.verbose ?? 2;
795 state.fileBufferSize = opt.fileBufferSize;
796 state.sabS11nOffset = opt.sabS11nOffset;
797 state.sabS11nSize = opt.sabS11nSize;
798 state.sabOP = opt.sabOP;
799 state.sabOPView = new Int32Array(state.sabOP);
800 state.sabIO = opt.sabIO;
801 state.sabFileBufView = new Uint8Array(state.sabIO, 0, state.fileBufferSize);
802 state.sabS11nView = new Uint8Array(state.sabIO, state.sabS11nOffset, state.sabS11nSize);
803 state.opIds = opt.opIds;
804 state.sq3Codes = opt.sq3Codes;
806 if(!Number.isFinite(state.opIds[k])){
812 log("init state",state);