From: Documentation Bot Date: Mon, 4 Mar 2024 12:43:12 +0000 (+0000) Subject: docs: generate documentation X-Git-Tag: v3.1.22~17^2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=86de0a2d983a71579980758f52cf4c7f1c16abf8;p=poolifier.git docs: generate documentation --- diff --git a/docs/assets/icons.js b/docs/assets/icons.js new file mode 100644 index 00000000..b79c9e89 --- /dev/null +++ b/docs/assets/icons.js @@ -0,0 +1,15 @@ +(function(svg) { + svg.innerHTML = ``; + svg.style.display = 'none'; + if (location.protocol === 'file:') { + if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', updateUseElements); + else updateUseElements() + function updateUseElements() { + document.querySelectorAll('use').forEach(el => { + if (el.getAttribute('href').includes('#icon-')) { + el.setAttribute('href', el.getAttribute('href').replace(/.*#/, '#')); + } + }); + } + } +})(document.body.appendChild(document.createElementNS('http://www.w3.org/2000/svg', 'svg'))) \ No newline at end of file diff --git a/docs/assets/icons.svg b/docs/assets/icons.svg new file mode 100644 index 00000000..7dead611 --- /dev/null +++ b/docs/assets/icons.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/assets/main.js b/docs/assets/main.js index 3092fea0..7352c367 100644 --- a/docs/assets/main.js +++ b/docs/assets/main.js @@ -1,8 +1,8 @@ "use strict"; -"use strict";(()=>{var Ie=Object.create;var ne=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Pe(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Ie(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` - ${ce(l.parent,i)}.${d}`);let v=document.createElement("li");v.classList.value=l.classes??"";let f=document.createElement("a");f.href=r.base+l.url,f.innerHTML=u+d,v.append(f),e.appendChild(v)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var He={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>He[e])}var C=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",pe="mousemove",H="mouseup",J={x:0,y:0},fe=!1,ee=!1,Be=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(Be=!0,F="touchstart",pe="touchmove",H="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(pe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(H,()=>{ee=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends C{constructor(e){super(e),this.className=this.el.dataset.toggle||"",this.el.addEventListener(H,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(F,n=>this.onDocumentPointerDown(n)),document.addEventListener(H,n=>this.onDocumentPointerUp(n))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(e){D||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!D&&this.active&&e.target.closest(".col-sidebar")){let n=e.target.closest("a");if(n){let r=window.location.href;r.indexOf("#")!=-1&&(r=r.substring(0,r.indexOf("#"))),n.href.substring(0,r.length)==r&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends C{constructor(e){super(e),this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } -`,this.updateIndexHeadingVisibility()}fromLocalStorage(){let e=Q.getItem(this.key);return e?e==="true":this.el.checked}setLocalStorage(e){Q.setItem(this.key,e.toString()),this.value=e,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),this.updateIndexHeadingVisibility()}updateIndexHeadingVisibility(){let e=document.querySelector(".tsd-index-content"),n=e?.open;e&&(e.open=!0),document.querySelectorAll(".tsd-index-section").forEach(r=>{r.style.display="block";let i=Array.from(r.querySelectorAll(".tsd-index-link")).every(s=>s.offsetParent==null);r.style.display=i?"none":"block"}),e&&(e.open=n)}};var Z=class extends C{constructor(e){super(e),this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let n=Q.getItem(this.key);this.el.open=n?n==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let r=this.summary.querySelector("a");r&&r.addEventListener("click",()=>{location.assign(r.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.href===r.href&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); +"use strict";(()=>{var Ce=Object.create;var ne=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Pe(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Ce(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),y=s.str.charAt(1),p;y in s.node.edges?p=s.node.edges[y]:(p=new t.TokenSet,s.node.edges[y]=p),s.str.length==1&&(p.final=!0),i.push({node:p,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible()),document.body.style.display||this.scrollToHash()}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}showPage(){document.body.style.display&&(document.body.style.removeProperty("display"),this.scrollToHash())}scrollToHash(){if(location.hash){let e=document.getElementById(location.hash.substring(1));if(!e)return;e.scrollIntoView({behavior:"instant",block:"start"})}}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e&&!e.checkVisibility()){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` + ${ce(l.parent,i)}.${d}`);let y=document.createElement("li");y.classList.value=l.classes??"";let p=document.createElement("a");p.href=r.base+l.url,p.innerHTML=u+d,y.append(p),e.appendChild(y)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var He={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>He[e])}var I=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",fe="mousemove",H="mouseup",J={x:0,y:0},pe=!1,ee=!1,Be=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(Be=!0,F="touchstart",fe="touchmove",H="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(fe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(H,()=>{ee=!1});document.addEventListener("click",t=>{pe&&(t.preventDefault(),t.stopImmediatePropagation(),pe=!1)});var X=class extends I{constructor(e){super(e),this.className=this.el.dataset.toggle||"",this.el.addEventListener(H,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(F,n=>this.onDocumentPointerDown(n)),document.addEventListener(H,n=>this.onDocumentPointerUp(n))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(e){D||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!D&&this.active&&e.target.closest(".col-sidebar")){let n=e.target.closest("a");if(n){let r=window.location.href;r.indexOf("#")!=-1&&(r=r.substring(0,r.indexOf("#"))),n.href.substring(0,r.length)==r&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ye=document.head.appendChild(document.createElement("style"));ye.dataset.for="filters";var Y=class extends I{constructor(e){super(e),this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ye.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } +`,this.updateIndexHeadingVisibility()}fromLocalStorage(){let e=Q.getItem(this.key);return e?e==="true":this.el.checked}setLocalStorage(e){Q.setItem(this.key,e.toString()),this.value=e,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),this.updateIndexHeadingVisibility()}updateIndexHeadingVisibility(){let e=document.querySelector(".tsd-index-content"),n=e?.open;e&&(e.open=!0),document.querySelectorAll(".tsd-index-section").forEach(r=>{r.style.display="block";let i=Array.from(r.querySelectorAll(".tsd-index-link")).every(s=>s.offsetParent==null);r.style.display=i?"none":"block"}),e&&(e.open=n)}};var Z=class extends I{constructor(e){super(e),this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let n=Q.getItem(this.key);this.el.open=n?n==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let r=this.summary.querySelector("a");r&&r.addEventListener("click",()=>{location.assign(r.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ve(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ve(t.value)})}function ve(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.showPage(),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.pathname===r.pathname&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); /*! Bundled license information: lunr/lunr.js: diff --git a/docs/classes/AbstractPool.html b/docs/classes/AbstractPool.html index c3d367e6..fcb9ca49 100644 --- a/docs/classes/AbstractPool.html +++ b/docs/classes/AbstractPool.html @@ -1,117 +1,117 @@ -AbstractPool | poolifier - v3.1.21

Class AbstractPool<Worker, Data, Response>Abstract

Base class that implements some shared logic for all poolifier pools.

-

Type Parameters

  • Worker extends IWorker

    Type of worker which manages this pool.

    -
  • Data = unknown

    Type of data sent to the worker. This can only be structured-cloneable data.

    -
  • Response = unknown

    Type of execution response. This can only be structured-cloneable data.

    -

Hierarchy (view full)

Implements

Constructors

Properties

Accessors

Methods

addTaskFunction -addWorkerNode -afterTaskExecutionHook -afterWorkerNodeSetup -beforeTaskExecutionHook -buildTasksQueueOptions -cannotStealTask -checkAndEmitDynamicWorkerCreationEvents -checkAndEmitEmptyEvent -checkAndEmitReadyEvent -checkAndEmitTaskExecutionEvents -checkAndEmitTaskQueuingEvents -checkMessageWorkerId -checkMinimumNumberOfWorkers -checkPoolOptions -checkPoolType -checkValidWorkerChoiceStrategyOptions -chooseWorkerNode -createAndSetupDynamicWorkerNode -createAndSetupWorkerNode -createWorkerNode -deleteTaskFunctionWorkerUsages -dequeueTask -deregisterWorkerMessageListener -destroy -destroyWorkerNode -enableTasksQueue -enqueueTask -execute -executeTask -flagWorkerNodeAsNotReady -flushTasksQueue -flushTasksQueues -getWorkerInfo -getWorkerNodeKeyByWorkerId -handleTask -handleTaskExecutionResponse -handleWorkerNodeBackPressureEvent -handleWorkerNodeIdleEvent -handleWorkerReadyResponse -hasBackPressure -hasTaskFunction -initializeEventEmitter -internalBusy -isMain -isWorkerNodeBusy -listTaskFunctionNames -redistributeQueuedTasks -registerOnceWorkerMessageListener -registerWorkerMessageListener -removeTaskFunction -removeWorkerNode -resetTaskSequentiallyStolenStatisticsTaskFunctionWorkerUsage -resetTaskSequentiallyStolenStatisticsWorkerUsage -sendKillMessageToWorker -sendStartupMessageToWorker -sendStatisticsMessageToWorker -sendTaskFunctionOperationToWorker -sendTaskFunctionOperationToWorkers -sendToWorker -setDefaultTaskFunction -setTaskStealing -setTasksQueueOptions -setTasksQueueSize -setTasksStealingOnBackPressure -setWorkerChoiceStrategy -setWorkerChoiceStrategyOptions -setupHook -shallCreateDynamicWorker -shallExecuteTask -shallUpdateTaskFunctionWorkerUsage -start -tasksQueueSize -unsetTaskStealing -unsetTasksStealingOnBackPressure -updateTaskSequentiallyStolenStatisticsTaskFunctionWorkerUsage -updateTaskSequentiallyStolenStatisticsWorkerUsage -updateTaskStolenStatisticsWorkerUsage -workerMessageListener -workerNodeStealTask -

Constructors

Properties

destroying: boolean

Whether the pool is destroying or not.

-
emitter?: EventEmitterAsyncResource

Event emitter integrated with async resource on which events can be listened to. +AbstractPool | poolifier - v3.1.21

Class AbstractPool<Worker, Data, Response>Abstract

Base class that implements some shared logic for all poolifier pools.

+

Type Parameters

  • Worker extends IWorker

    Type of worker which manages this pool.

    +
  • Data = unknown

    Type of data sent to the worker. This can only be structured-cloneable data.

    +
  • Response = unknown

    Type of execution response. This can only be structured-cloneable data.

    +

Hierarchy (view full)

Implements

Constructors

Properties

Accessors

Methods

addTaskFunction +addWorkerNode +afterTaskExecutionHook +afterWorkerNodeSetup +beforeTaskExecutionHook +buildTasksQueueOptions +cannotStealTask +checkAndEmitDynamicWorkerCreationEvents +checkAndEmitEmptyEvent +checkAndEmitReadyEvent +checkAndEmitTaskExecutionEvents +checkAndEmitTaskQueuingEvents +checkMessageWorkerId +checkMinimumNumberOfWorkers +checkPoolOptions +checkPoolType +checkValidWorkerChoiceStrategyOptions +chooseWorkerNode +createAndSetupDynamicWorkerNode +createAndSetupWorkerNode +createWorkerNode +deleteTaskFunctionWorkerUsages +dequeueTask +deregisterWorkerMessageListener +destroy +destroyWorkerNode +enableTasksQueue +enqueueTask +execute +executeTask +flagWorkerNodeAsNotReady +flushTasksQueue +flushTasksQueues +getWorkerInfo +getWorkerNodeKeyByWorkerId +handleTask +handleTaskExecutionResponse +handleWorkerNodeBackPressureEvent +handleWorkerNodeIdleEvent +handleWorkerReadyResponse +hasBackPressure +hasTaskFunction +initializeEventEmitter +internalBusy +isMain +isWorkerNodeBusy +listTaskFunctionNames +redistributeQueuedTasks +registerOnceWorkerMessageListener +registerWorkerMessageListener +removeTaskFunction +removeWorkerNode +resetTaskSequentiallyStolenStatisticsTaskFunctionWorkerUsage +resetTaskSequentiallyStolenStatisticsWorkerUsage +sendKillMessageToWorker +sendStartupMessageToWorker +sendStatisticsMessageToWorker +sendTaskFunctionOperationToWorker +sendTaskFunctionOperationToWorkers +sendToWorker +setDefaultTaskFunction +setTaskStealing +setTasksQueueOptions +setTasksQueueSize +setTasksStealingOnBackPressure +setWorkerChoiceStrategy +setWorkerChoiceStrategyOptions +setupHook +shallCreateDynamicWorker +shallExecuteTask +shallUpdateTaskFunctionWorkerUsage +start +tasksQueueSize +unsetTaskStealing +unsetTasksStealingOnBackPressure +updateTaskSequentiallyStolenStatisticsTaskFunctionWorkerUsage +updateTaskSequentiallyStolenStatisticsWorkerUsage +updateTaskStolenStatisticsWorkerUsage +workerMessageListener +workerNodeStealTask +

Constructors

Properties

destroying: boolean

Whether the pool is destroying or not.

+
emitter?: EventEmitterAsyncResource

Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

Events that can currently be listened to:

    @@ -124,141 +124,106 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
  • 'taskError': Emitted when an error occurs while executing a task.
  • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
-
filePath: string

Path to the worker file.

-
maximumNumberOfWorkers?: number

Maximum number of workers that this pool manages.

-
minimumNumberOfWorkers: number

Minimum number of workers that this pool manages.

-

Options for the pool.

-
promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

The task execution response promise map:

+
filePath: string

Path to the worker file.

+
maximumNumberOfWorkers?: number

Maximum number of workers that this pool manages.

+
minimumNumberOfWorkers: number

Minimum number of workers that this pool manages.

+

Options for the pool.

+
promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

The task execution response promise map:

  • key: The message id of each submitted task.
  • value: An object that contains the worker, the execution response promise resolve and reject callbacks.

When we receive a message from the worker, we get a map entry with the promise resolve/reject bound to the message id.

-
readyEventEmitted: boolean

Whether the pool ready event has been emitted or not.

-
startTimestamp: number

The start timestamp of the pool.

-
started: boolean

Whether the pool is started or not.

-
starting: boolean

Whether the pool is starting or not.

-
taskFunctions: Map<string, TaskFunction<Data, Response>>

The task functions added at runtime map:

+
readyEventEmitted: boolean

Whether the pool ready event has been emitted or not.

+
startTimestamp: number

The start timestamp of the pool.

+
started: boolean

Whether the pool is started or not.

+
starting: boolean

Whether the pool is starting or not.

+
taskFunctions: Map<string, TaskFunction<Data, Response>>

The task functions added at runtime map:

  • key: The task function name.
  • value: The task function itself.
-
workerChoiceStrategyContext?: WorkerChoiceStrategyContext<Worker, Data, Response>

Worker choice strategy context referencing a worker choice algorithm implementation.

-
workerNodes: IWorkerNode<Worker, Data>[] = []

Pool worker nodes.

-

Accessors

workerChoiceStrategyContext?: WorkerChoiceStrategyContext<Worker, Data, Response>

Worker choice strategy context referencing a worker choice algorithm implementation.

+
workerNodes: IWorkerNode<Worker, Data>[] = []

Pool worker nodes.

+

Accessors

  • get type(): "fixed" | "dynamic"
  • The pool type.

    If it is 'dynamic', it provides the max property.

    -

    Returns "fixed" | "dynamic"

Methods

Methods

  • Hook executed after the worker task execution. Can be overridden.

    -

    Parameters

    • workerNodeKey: number

      The worker node key.

      -
    • message: MessageValue<Response, unknown>

      The received message.

      -

    Returns void

  • Method hooked up after a worker node has been newly created. +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • message: MessageValue<Response, unknown>

      The received message.

      +

    Returns void

  • Method hooked up after a worker node has been newly created. Can be overridden.

    -

    Parameters

    • workerNodeKey: number

      The newly created worker node key.

      -

    Returns void

  • Hook executed before the worker task execution. +

    Parameters

    • workerNodeKey: number

      The newly created worker node key.

      +

    Returns void

  • Hook executed before the worker task execution. Can be overridden.

    -

    Parameters

    • workerNodeKey: number

      The worker node key.

      -
    • task: Task<Data>

      The task to execute.

      -

    Returns void

  • Checks if the worker id sent in the received message from a worker is valid.

    -

    Parameters

  • Parameters

    • minimumNumberOfWorkers: undefined | number

    Returns void

  • Parameters

    • minimumNumberOfWorkers: undefined | number

    Returns void

  • Chooses a worker node for the next task.

    The default worker choice strategy uses a round robin algorithm to distribute the tasks.

    Returns number

    The chosen worker node key

    -
  • Creates a new, completely set up dynamic worker node.

    Returns number

    New, completely set up dynamic worker node key.

    -
  • Creates a new, completely set up worker node.

    Returns number

    New, completely set up worker node key.

    -
  • Deregisters a listener callback on the worker given its worker node key.

    -

    Type Parameters

    • Message

    Parameters

    • workerNodeKey: number

      The worker node key.

      -
    • listener: ((message) => void)

      The message listener callback.

      -

    Returns void

  • Terminates the worker node given its worker node key.

    -

    Parameters

    • workerNodeKey: number

      The worker node key.

      -

    Returns Promise<void>

  • Enables/disables the worker node tasks queue in this pool.

    -

    Parameters

    • enable: boolean

      Whether to enable or disable the worker node tasks queue.

      -
    • Optional tasksQueueOptions: TasksQueueOptions

      The worker node tasks queue options.

      -

    Returns void

  • Executes the specified function in the worker constructor with the task data input parameter.

    -

    Parameters

    • Optional data: Data

      The optional task input data for the specified task function. This can only be structured-cloneable data.

      -
    • Optional name: string

      The optional name of the task function to execute. If not specified, the default task function will be executed.

      -
    • Optional transferList: TransferListItem[]

      An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards.

      -

    Returns Promise<Response>

    Promise that will be fulfilled when the task is completed.

    -
  • Executes the given task on the worker given its worker node key.

    -

    Parameters

    • workerNodeKey: number

      The worker node key.

      -
    • task: Task<Data>

      The task to execute.

      -

    Returns void

  • Deregisters a listener callback on the worker given its worker node key.

    +

    Type Parameters

    • Message

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • listener: ((message) => void)

      The message listener callback.

      +

    Returns void

  • Terminates the worker node given its worker node key.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +

    Returns Promise<void>

  • Executes the given task on the worker given its worker node key.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • task: Task<Data>

      The task to execute.

      +

    Returns void

  • Gets the worker information given its worker node key.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

    Returns undefined | WorkerInfo

    The worker information.

    -
  • Gets the worker node key given its worker id.

    -

    Parameters

  • Gets the worker node key given its worker id.

    +

    Parameters

    • workerId: undefined | number

      The worker id.

    Returns number

    The worker node key if the worker id is found in the pool worker nodes, -1 otherwise.

    -
  • Whether the specified task function exists in this pool.

    -

    Parameters

    • name: string

      The name of the task function.

      -

    Returns boolean

    true if the task function exists, false otherwise.

    -
  • Whether worker nodes are executing concurrently their tasks quota or not.

    Returns boolean

    Worker nodes busyness boolean status.

    -
  • Registers once a listener callback on the worker given its worker node key.

    -

    Type Parameters

    • Message

    Parameters

    • workerNodeKey: number

      The worker node key.

      -
    • listener: ((message) => void)

      The message listener callback.

      -

    Returns void

  • Registers a listener callback on the worker given its worker node key.

    -

    Type Parameters

    • Message

    Parameters

    • workerNodeKey: number

      The worker node key.

      -
    • listener: ((message) => void)

      The message listener callback.

      -

    Returns void

  • Removes a task function from this pool.

    -

    Parameters

    • name: string

      The name of the task function.

      -

    Returns Promise<boolean>

    true if the task function was removed, false otherwise.

    -
  • Parameters

    • workerNodeKey: number
    • taskName: string

    Returns void

  • Sends the startup message to worker given its worker node key.

    -

    Parameters

    • workerNodeKey: number

      The worker node key.

      -

    Returns void

  • Sends the statistics message to worker given its worker node key.

    -

    Parameters

    • workerNodeKey: number

      The worker node key.

      -

    Returns void

  • Sends a message to worker given its worker node key.

    -

    Parameters

    • workerNodeKey: number

      The worker node key.

      -
    • message: MessageValue<Data, unknown>

      The message.

      -
    • Optional transferList: TransferListItem[]

      The optional array of transferable objects.

      -

    Returns void

  • Sets the default task function in this pool.

    -

    Parameters

    • name: string

      The name of the task function.

      -

    Returns Promise<boolean>

    true if the default task function was set, false otherwise.

    -
  • Sets the worker choice strategy in this pool.

    -

    Parameters

    • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

      The worker choice strategy.

      -
    • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

      The worker choice strategy options.

      -

    Returns void

  • Registers once a listener callback on the worker given its worker node key.

    +

    Type Parameters

    • Message

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • listener: ((message) => void)

      The message listener callback.

      +

    Returns void

  • Registers a listener callback on the worker given its worker node key.

    +

    Type Parameters

    • Message

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • listener: ((message) => void)

      The message listener callback.

      +

    Returns void

  • Parameters

    • workerNodeKey: number
    • taskName: string

    Returns void

  • Sends the startup message to worker given its worker node key.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +

    Returns void

  • Sends the statistics message to worker given its worker node key.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +

    Returns void

  • Sends a message to worker given its worker node key.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • message: MessageValue<Data, unknown>

      The message.

      +
    • Optional transferList: TransferListItem[]

      The optional array of transferable objects.

      +

    Returns void

  • Setup hook to execute code before worker nodes are created in the abstract constructor. Can be overridden.

    -

    Returns void

  • Conditions for dynamic worker creation.

    Returns boolean

    Whether to create a dynamic worker or not.

    -
  • Whether the worker node shall update its task function worker usage or not.

    -

    Parameters

  • Whether the worker node shall update its task function worker usage or not.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

    Returns boolean

    true if the worker node shall update its task function worker usage, false otherwise.

    -
  • Parameters

    • workerNodeKey: number
    • taskName: string

    Returns void

  • Parameters

    • workerNodeKey: number

    Returns void

  • Parameters

    • workerNodeKey: number
    • taskName: string

    Returns void

Generated using TypeDoc

\ No newline at end of file +
  • Parameters

    • workerNodeKey: number
    • taskName: string

    Returns void

  • Parameters

    • workerNodeKey: number

    Returns void

  • Parameters

    • workerNodeKey: number
    • taskName: string

    Returns void

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/AbstractWorker.html b/docs/classes/AbstractWorker.html index e54d1b0f..863a0df7 100644 --- a/docs/classes/AbstractWorker.html +++ b/docs/classes/AbstractWorker.html @@ -1,98 +1,98 @@ -AbstractWorker | poolifier - v3.1.21

Class AbstractWorker<MainWorker, Data, Response>Abstract

Base class that implements some shared logic for all poolifier workers.

-

Type Parameters

  • MainWorker extends Worker | MessagePort

    Type of main worker.

    -
  • Data = unknown

    Type of data this worker receives from pool's execution. This can only be structured-cloneable data.

    -
  • Response = unknown

    Type of response the worker sends back to the main worker. This can only be structured-cloneable data.

    -

Hierarchy (view full)

Constructors

Properties

activeInterval?: Timeout

Handler id of the activeInterval worker activity check.

-
id: number

Worker id.

-
isMain: undefined | boolean

Whether this is the main worker or not.

-
lastTaskTimestamp: number

Timestamp of the last task processed by this worker.

-
mainWorker: undefined | null | MainWorker

Reference to main worker.

-
opts: WorkerOptions = DEFAULT_WORKER_OPTIONS

Options for the worker.

-
statistics?: WorkerStatistics

Performance statistics computation requirements.

-
taskFunctions: Map<string, TaskFunction<Data, Response>>

Task function(s) processed by the worker when the pool's execution function is invoked.

-

Methods

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/CircularArray.html b/docs/classes/CircularArray.html index cf81e9d7..777d1fe7 100644 --- a/docs/classes/CircularArray.html +++ b/docs/classes/CircularArray.html @@ -1,184 +1,184 @@ -CircularArray | poolifier - v3.1.21

Class CircularArray<T>Internal

Array with a maximum length and shifting items when full.

-

Type Parameters

  • T

    Type of items.

    -

Hierarchy

  • Array<T>
    • CircularArray

Constructors

Properties

[unscopables]: {
    [unscopables]?: boolean;
    length?: boolean;
    [iterator]?: any;
    at?: any;
    concat?: any;
    copyWithin?: any;
    entries?: any;
    every?: any;
    fill?: any;
    filter?: any;
    find?: any;
    findIndex?: any;
    flat?: any;
    flatMap?: any;
    forEach?: any;
    includes?: any;
    indexOf?: any;
    join?: any;
    keys?: any;
    lastIndexOf?: any;
    map?: any;
    pop?: any;
    push?: any;
    reduce?: any;
    reduceRight?: any;
    reverse?: any;
    shift?: any;
    slice?: any;
    some?: any;
    sort?: any;
    splice?: any;
    toLocaleString?: any;
    toString?: any;
    unshift?: any;
    values?: any;
}

Is an object whose properties have the value 'true' +CircularArray | poolifier - v3.1.21

Class CircularArray<T>Internal

Array with a maximum length and shifting items when full.

+

Type Parameters

  • T

    Type of items.

    +

Hierarchy

  • Array<T>
    • CircularArray

Constructors

Properties

[unscopables]: {
    [unscopables]?: boolean;
    length?: boolean;
    [iterator]?: any;
    at?: any;
    concat?: any;
    copyWithin?: any;
    entries?: any;
    every?: any;
    fill?: any;
    filter?: any;
    find?: any;
    findIndex?: any;
    flat?: any;
    flatMap?: any;
    forEach?: any;
    includes?: any;
    indexOf?: any;
    join?: any;
    keys?: any;
    lastIndexOf?: any;
    map?: any;
    pop?: any;
    push?: any;
    reduce?: any;
    reduceRight?: any;
    reverse?: any;
    shift?: any;
    slice?: any;
    some?: any;
    sort?: any;
    splice?: any;
    toLocaleString?: any;
    toString?: any;
    unshift?: any;
    values?: any;
}

Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

Type declaration

  • Optional Readonly [unscopables]?: boolean

    Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

  • Optional length?: boolean

    Gets or sets the length of the array. This is a number one higher than the highest index in the array.

    -
length: number

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

-
size: number
[species]: ArrayConstructor

Methods

  • Iterator

    -

    Returns IterableIterator<T>

  • Returns the item located at the specified index.

    -

    Parameters

    • index: number

      The zero-based index of the desired code unit. A negative index will count back from the last item.

      -

    Returns undefined | T

  • Returns the this object after copying a section of the array identified by start and end +

length: number

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

+
size: number
[species]: ArrayConstructor

Methods

  • Iterator

    +

    Returns IterableIterator<T>

  • Returns the item located at the specified index.

    +

    Parameters

    • index: number

      The zero-based index of the desired code unit. A negative index will count back from the last item.

      +

    Returns undefined | T

  • Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

    -

    Parameters

    • target: number

      If target is negative, it is treated as length+target where length is the +

      Parameters

      • target: number

        If target is negative, it is treated as length+target where length is the length of the array.

        -
      • start: number

        If start is negative, it is treated as length+start. If end is negative, it +

      • start: number

        If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

        -
      • Optional end: number

        If not specified, length of the this object is used as its default value.

        -

      Returns this

  • Returns an iterable of key, value pairs for every entry in the array

    -

    Returns IterableIterator<[number, T]>

  • Determines whether all the members of an array satisfy the specified test.

    -

    Type Parameters

    • S

    Parameters

    • predicate: ((value, index, array) => value is S)

      A function that accepts up to three arguments. The every method calls +

    • Optional end: number

      If not specified, length of the this object is used as its default value.

      +

    Returns this

  • Returns an iterable of key, value pairs for every entry in the array

    +

    Returns IterableIterator<[number, T]>

  • Determines whether all the members of an array satisfy the specified test.

    +

    Type Parameters

    • S

    Parameters

    • predicate: ((value, index, array) => value is S)

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

      -
        • (value, index, array): value is S
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns value is S

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. +

        • (value, index, array): value is S
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns value is S

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      -

    Returns this is S[]

  • Determines whether all the members of an array satisfy the specified test.

    -

    Parameters

    • predicate: ((value, index, array) => unknown)

      A function that accepts up to three arguments. The every method calls +

    Returns this is S[]

  • Determines whether all the members of an array satisfy the specified test.

    +

    Parameters

    • predicate: ((value, index, array) => unknown)

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

      -
        • (value, index, array): unknown
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns unknown

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. +

        • (value, index, array): unknown
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns unknown

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      -

    Returns boolean

  • Changes all array elements from start to end index to a static value and returns the modified array

    -

    Parameters

    • value: T

      value to fill array section with

      -
    • Optional start: number

      index to start filling the array at. If start is negative, it is treated as +

    Returns boolean

  • Changes all array elements from start to end index to a static value and returns the modified array

    +

    Parameters

    • value: T

      value to fill array section with

      +
    • Optional start: number

      index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

      -
    • Optional end: number

      index to stop filling the array at. If end is negative, it is treated as +

    • Optional end: number

      index to stop filling the array at. If end is negative, it is treated as length+end.

      -

    Returns this

  • Returns the elements of an array that meet the condition specified in a callback function.

    -

    Type Parameters

    • S

    Parameters

    • predicate: ((value, index, array) => value is S)

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      -
        • (value, index, array): value is S
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns value is S

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      -

    Returns S[]

  • Returns the elements of an array that meet the condition specified in a callback function.

    -

    Parameters

    • predicate: ((value, index, array) => unknown)

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      -
        • (value, index, array): unknown
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns unknown

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      -

    Returns T[]

  • Returns the value of the first element in the array where predicate is true, and undefined +

Returns this

  • Returns the elements of an array that meet the condition specified in a callback function.

    +

    Type Parameters

    • S

    Parameters

    • predicate: ((value, index, array) => value is S)

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      +
        • (value, index, array): value is S
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns value is S

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      +

    Returns S[]

  • Returns the elements of an array that meet the condition specified in a callback function.

    +

    Parameters

    • predicate: ((value, index, array) => unknown)

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      +
        • (value, index, array): unknown
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns unknown

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      +

    Returns T[]

  • Returns the value of the first element in the array where predicate is true, and undefined otherwise.

    -

    Type Parameters

    • S

    Parameters

    • predicate: ((value, index, obj) => value is S)

      find calls predicate once for each element of the array, in ascending +

      Type Parameters

      • S

      Parameters

      • predicate: ((value, index, obj) => value is S)

        find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

        -
          • (value, index, obj): value is S
          • Parameters

            • value: T
            • index: number
            • obj: T[]

            Returns value is S

      • Optional thisArg: any

        If provided, it will be used as the this value for each invocation of +

          • (value, index, obj): value is S
          • Parameters

            • value: T
            • index: number
            • obj: T[]

            Returns value is S

      • Optional thisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

        -

      Returns undefined | S

    • Parameters

      • predicate: ((value, index, obj) => unknown)
          • (value, index, obj): unknown
          • Parameters

            • value: T
            • index: number
            • obj: T[]

            Returns unknown

      • Optional thisArg: any

      Returns undefined | T

  • Returns the index of the first element in the array where predicate is true, and -1 +

Returns undefined | S

  • Parameters

    • predicate: ((value, index, obj) => unknown)
        • (value, index, obj): unknown
        • Parameters

          • value: T
          • index: number
          • obj: T[]

          Returns unknown

    • Optional thisArg: any

    Returns undefined | T

    • Returns the index of the first element in the array where predicate is true, and -1 otherwise.

      -

      Parameters

      • predicate: ((value, index, obj) => unknown)

        find calls predicate once for each element of the array, in ascending +

        Parameters

        • predicate: ((value, index, obj) => unknown)

          find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

          -
            • (value, index, obj): unknown
            • Parameters

              • value: T
              • index: number
              • obj: T[]

              Returns unknown

        • Optional thisArg: any

          If provided, it will be used as the this value for each invocation of +

            • (value, index, obj): unknown
            • Parameters

              • value: T
              • index: number
              • obj: T[]

              Returns unknown

        • Optional thisArg: any

          If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

          -

        Returns number

    • Returns a new array with all sub-array elements concatenated into it recursively up to the +

    Returns number

    • Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

      -

      Type Parameters

      • A

      • D extends number = 1

      Parameters

      • this: A
      • Optional depth: D

        The maximum recursion depth

        -

      Returns FlatArray<A, D>[]

    • Calls a defined callback function on each element of an array. Then, flattens the result into +

      Type Parameters

      • A
      • D extends number = 1

      Parameters

      • this: A
      • Optional depth: D

        The maximum recursion depth

        +

      Returns FlatArray<A, D>[]

    • Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.

      -

      Type Parameters

      • U

      • This = undefined

      Parameters

      • callback: ((this, value, index, array) => U | readonly U[])

        A function that accepts up to three arguments. The flatMap method calls the +

        Type Parameters

        • U
        • This = undefined

        Parameters

        • callback: ((this, value, index, array) => U | readonly U[])

          A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array.

          -
            • (this, value, index, array): U | readonly U[]
            • Parameters

              • this: This
              • value: T
              • index: number
              • array: T[]

              Returns U | readonly U[]

        • Optional thisArg: This

          An object to which the this keyword can refer in the callback function. If +

            • (this, value, index, array): U | readonly U[]
            • Parameters

              • this: This
              • value: T
              • index: number
              • array: T[]

              Returns U | readonly U[]

        • Optional thisArg: This

          An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value.

          -

        Returns U[]

    • Performs the specified action for each element in an array.

      -

      Parameters

      • callbackfn: ((value, index, array) => void)

        A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

        -
          • (value, index, array): void
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns void

      • Optional thisArg: any

        An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

        -

      Returns void

    • Determines whether an array includes a certain element, returning true or false as appropriate.

      -

      Parameters

      • searchElement: T

        The element to search for.

        -
      • Optional fromIndex: number

        The position in this array at which to begin searching for searchElement.

        -

      Returns boolean

    • Returns the index of the first occurrence of a value in an array, or -1 if it is not present.

      -

      Parameters

      • searchElement: T

        The value to locate in the array.

        -
      • Optional fromIndex: number

        The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

        -

      Returns number

    • Adds all the elements of an array into a string, separated by the specified separator string.

      -

      Parameters

      • Optional separator: string

        A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

        -

      Returns string

    • Returns an iterable of keys in the array

      -

      Returns IterableIterator<number>

    • Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.

      -

      Parameters

      • searchElement: T

        The value to locate in the array.

        -
      • Optional fromIndex: number

        The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.

        -

      Returns number

    • Calls a defined callback function on each element of an array, and returns an array that contains the results.

      -

      Type Parameters

      • U

      Parameters

      • callbackfn: ((value, index, array) => U)

        A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        -
          • (value, index, array): U
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns U

      • Optional thisArg: any

        An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

        -

      Returns U[]

    • Removes the last element from an array and returns it. +

    Returns U[]

    • Performs the specified action for each element in an array.

      +

      Parameters

      • callbackfn: ((value, index, array) => void)

        A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

        +
          • (value, index, array): void
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns void

      • Optional thisArg: any

        An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

        +

      Returns void

    • Determines whether an array includes a certain element, returning true or false as appropriate.

      +

      Parameters

      • searchElement: T

        The element to search for.

        +
      • Optional fromIndex: number

        The position in this array at which to begin searching for searchElement.

        +

      Returns boolean

    • Returns the index of the first occurrence of a value in an array, or -1 if it is not present.

      +

      Parameters

      • searchElement: T

        The value to locate in the array.

        +
      • Optional fromIndex: number

        The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

        +

      Returns number

    • Adds all the elements of an array into a string, separated by the specified separator string.

      +

      Parameters

      • Optional separator: string

        A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

        +

      Returns string

    • Returns an iterable of keys in the array

      +

      Returns IterableIterator<number>

    • Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.

      +

      Parameters

      • searchElement: T

        The value to locate in the array.

        +
      • Optional fromIndex: number

        The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.

        +

      Returns number

    • Calls a defined callback function on each element of an array, and returns an array that contains the results.

      +

      Type Parameters

      • U

      Parameters

      • callbackfn: ((value, index, array) => U)

        A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        +
          • (value, index, array): U
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns U

      • Optional thisArg: any

        An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

        +

      Returns U[]

    • Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

      -

      Returns undefined | T

    • Parameters

      • Rest ...items: T[]

      Returns number

      Inherit Doc

    • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      -

      Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => T)

        A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        -
          • (previousValue, currentValue, currentIndex, array): T
          • Parameters

            • previousValue: T
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns T

      Returns T

    • Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => T)
          • (previousValue, currentValue, currentIndex, array): T
          • Parameters

            • previousValue: T
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns T

      • initialValue: T

      Returns T

    • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      -

      Type Parameters

      • U

      Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => U)

        A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        -
          • (previousValue, currentValue, currentIndex, array): U
          • Parameters

            • previousValue: U
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns U

      • initialValue: U

        If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

        -

      Returns U

    • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      -

      Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => T)

        A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        -
          • (previousValue, currentValue, currentIndex, array): T
          • Parameters

            • previousValue: T
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns T

      Returns T

    • Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => T)
          • (previousValue, currentValue, currentIndex, array): T
          • Parameters

            • previousValue: T
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns T

      • initialValue: T

      Returns T

    • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      -

      Type Parameters

      • U

      Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => U)

        A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        -
          • (previousValue, currentValue, currentIndex, array): U
          • Parameters

            • previousValue: U
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns U

      • initialValue: U

        If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

        -

      Returns U

    • Reverses the elements in an array in place. +

      Returns undefined | T

    • Parameters

      • Rest ...items: T[]

      Returns number

      Inherit Doc

    • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      +

      Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => T)

        A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        +
          • (previousValue, currentValue, currentIndex, array): T
          • Parameters

            • previousValue: T
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns T

      Returns T

    • Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => T)
          • (previousValue, currentValue, currentIndex, array): T
          • Parameters

            • previousValue: T
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns T

      • initialValue: T

      Returns T

    • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      +

      Type Parameters

      • U

      Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => U)

        A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        +
          • (previousValue, currentValue, currentIndex, array): U
          • Parameters

            • previousValue: U
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns U

      • initialValue: U

        If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

        +

      Returns U

    • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      +

      Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => T)

        A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        +
          • (previousValue, currentValue, currentIndex, array): T
          • Parameters

            • previousValue: T
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns T

      Returns T

    • Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => T)
          • (previousValue, currentValue, currentIndex, array): T
          • Parameters

            • previousValue: T
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns T

      • initialValue: T

      Returns T

    • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      +

      Type Parameters

      • U

      Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => U)

        A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        +
          • (previousValue, currentValue, currentIndex, array): U
          • Parameters

            • previousValue: U
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns U

      • initialValue: U

        If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

        +

      Returns U

    • Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array.

      -

      Returns T[]

    • Removes the first element from an array and returns it. +

      Returns T[]

    • Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

      -

      Returns undefined | T

    • Returns a copy of a section of an array. +

      Returns undefined | T

    • Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array.

      -

      Parameters

      • Optional start: number

        The beginning index of the specified portion of the array. +

        Parameters

        • Optional start: number

          The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.

          -
        • Optional end: number

          The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. +

        • Optional end: number

          The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the array.

          -

        Returns T[]

    • Determines whether the specified callback function returns true for any element of an array.

      -

      Parameters

      • predicate: ((value, index, array) => unknown)

        A function that accepts up to three arguments. The some method calls +

      Returns T[]

    • Determines whether the specified callback function returns true for any element of an array.

      +

      Parameters

      • predicate: ((value, index, array) => unknown)

        A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

        -
          • (value, index, array): unknown
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns unknown

      • Optional thisArg: any

        An object to which the this keyword can refer in the predicate function. +

          • (value, index, array): unknown
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns unknown

      • Optional thisArg: any

        An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

        -

      Returns boolean

    • Sorts an array in place. +

    Returns boolean

    • Sorts an array in place. This method mutates the array and returns a reference to the same array.

      -

      Parameters

      • Optional compareFn: ((a, b) => number)

        Function used to determine the order of the elements. It is expected to return +

        Parameters

        • Optional compareFn: ((a, b) => number)

          Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.

          [11,2,22,1].sort((a, b) => a - b)
           
          -
            • (a, b): number
            • Parameters

              Returns number

        Returns this

    • Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

      -

      Returns string

    • Returns a string representation of an array.

      -

      Returns string

    • Parameters

      • Rest ...items: T[]

      Returns number

      Inherit Doc

    • Returns an iterable of values in the array

      -

      Returns IterableIterator<T>

    • Creates an array from an array-like object.

      -

      Type Parameters

      • T

      Parameters

      • arrayLike: ArrayLike<T>

        An array-like object to convert to an array.

        -

      Returns T[]

    • Creates an array from an iterable object.

      -

      Type Parameters

      • T

      • U

      Parameters

      • arrayLike: ArrayLike<T>

        An array-like object to convert to an array.

        -
      • mapfn: ((v, k) => U)

        A mapping function to call on every element of the array.

        -
          • (v, k): U
          • Parameters

            • v: T
            • k: number

            Returns U

      • Optional thisArg: any

        Value of 'this' used to invoke the mapfn.

        -

      Returns U[]

    • Creates an array from an iterable object.

      -

      Type Parameters

      • T

      Parameters

      • iterable: Iterable<T> | ArrayLike<T>

        An iterable object to convert to an array.

        -

      Returns T[]

    • Creates an array from an iterable object.

      -

      Type Parameters

      • T

      • U

      Parameters

      • iterable: Iterable<T> | ArrayLike<T>

        An iterable object to convert to an array.

        -
      • mapfn: ((v, k) => U)

        A mapping function to call on every element of the array.

        -
          • (v, k): U
          • Parameters

            • v: T
            • k: number

            Returns U

      • Optional thisArg: any

        Value of 'this' used to invoke the mapfn.

        -

      Returns U[]

    • Parameters

      • arg: any

      Returns arg is any[]

    • Returns a new array from a set of elements.

      -

      Type Parameters

      • T

      Parameters

      • Rest ...items: T[]

        A set of elements to include in the new array object.

        -

      Returns T[]

    Generated using TypeDoc

    \ No newline at end of file +
      • (a, b): number
      • Parameters

        Returns number

    Returns this

    • Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

      +

      Returns string

    • Returns a string representation of an array.

      +

      Returns string

    • Parameters

      • Rest ...items: T[]

      Returns number

      Inherit Doc

    • Returns an iterable of values in the array

      +

      Returns IterableIterator<T>

    • Creates an array from an array-like object.

      +

      Type Parameters

      • T

      Parameters

      • arrayLike: ArrayLike<T>

        An array-like object to convert to an array.

        +

      Returns T[]

    • Creates an array from an iterable object.

      +

      Type Parameters

      • T
      • U

      Parameters

      • arrayLike: ArrayLike<T>

        An array-like object to convert to an array.

        +
      • mapfn: ((v, k) => U)

        A mapping function to call on every element of the array.

        +
          • (v, k): U
          • Parameters

            • v: T
            • k: number

            Returns U

      • Optional thisArg: any

        Value of 'this' used to invoke the mapfn.

        +

      Returns U[]

    • Creates an array from an iterable object.

      +

      Type Parameters

      • T

      Parameters

      • iterable: Iterable<T> | ArrayLike<T>

        An iterable object to convert to an array.

        +

      Returns T[]

    • Creates an array from an iterable object.

      +

      Type Parameters

      • T
      • U

      Parameters

      • iterable: Iterable<T> | ArrayLike<T>

        An iterable object to convert to an array.

        +
      • mapfn: ((v, k) => U)

        A mapping function to call on every element of the array.

        +
          • (v, k): U
          • Parameters

            • v: T
            • k: number

            Returns U

      • Optional thisArg: any

        Value of 'this' used to invoke the mapfn.

        +

      Returns U[]

    • Parameters

      • arg: any

      Returns arg is any[]

    • Returns a new array from a set of elements.

      +

      Type Parameters

      • T

      Parameters

      • Rest ...items: T[]

        A set of elements to include in the new array object.

        +

      Returns T[]

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/ClusterWorker.html b/docs/classes/ClusterWorker.html index 52c4e2d4..60a63dc4 100644 --- a/docs/classes/ClusterWorker.html +++ b/docs/classes/ClusterWorker.html @@ -1,82 +1,82 @@ -ClusterWorker | poolifier - v3.1.21

    Class ClusterWorker<Data, Response>

    A cluster worker used by a poolifier ClusterPool.

    +ClusterWorker | poolifier - v3.1.21

    Class ClusterWorker<Data, Response>

    A cluster worker used by a poolifier ClusterPool.

    When this worker is inactive for more than the given maxInactiveTime, it will send a termination request to its main worker.

    If you use a DynamicClusterPool the extra workers that were created will be terminated, but the minimum number of workers will be guaranteed.

    Author

    Christopher Quadflieg

    Since

    2.0.0

    -

    Type Parameters

    • Data = unknown

      Type of data this worker receives from pool's execution. This can only be structured-cloneable data.

      -
    • Response = unknown

      Type of response the worker sends back to the main worker. This can only be structured-cloneable data.

      -

    Hierarchy (view full)

    Constructors

    Properties

    activeInterval?: Timeout

    Handler id of the activeInterval worker activity check.

    -
    isMain: undefined | boolean

    Whether this is the main worker or not.

    -
    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    -
    opts: WorkerOptions = DEFAULT_WORKER_OPTIONS

    Options for the worker.

    -
    statistics?: WorkerStatistics

    Performance statistics computation requirements.

    -
    taskFunctions: Map<string, TaskFunction<Data, Response>>

    Task function(s) processed by the worker when the pool's execution function is invoked.

    -

    Accessors

    Methods

    Type Parameters

    • Data = unknown

      Type of data this worker receives from pool's execution. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of response the worker sends back to the main worker. This can only be structured-cloneable data.

      +

    Hierarchy (view full)

    Constructors

    Properties

    activeInterval?: Timeout

    Handler id of the activeInterval worker activity check.

    +
    isMain: undefined | boolean

    Whether this is the main worker or not.

    +
    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    +
    opts: WorkerOptions = DEFAULT_WORKER_OPTIONS

    Options for the worker.

    +
    statistics?: WorkerStatistics

    Performance statistics computation requirements.

    +
    taskFunctions: Map<string, TaskFunction<Data, Response>>

    Task function(s) processed by the worker when the pool's execution function is invoked.

    +

    Accessors

    Methods

    • Handles an error and convert it to a string so it can be sent back to the main worker.

      +

      Parameters

      • error: string | Error

        The error raised by the worker.

      Returns string

      The error message.

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/Deque.html b/docs/classes/Deque.html index aa982fe2..3bbc7786 100644 --- a/docs/classes/Deque.html +++ b/docs/classes/Deque.html @@ -1,42 +1,42 @@ -Deque | poolifier - v3.1.21

    Class Deque<T>Internal

    Deque. +Deque | poolifier - v3.1.21

    Class Deque<T>Internal

    Deque. Implemented with a doubly linked list.

    -

    Type Parameters

    • T

      Type of deque data.

      -

    Constructors

    Properties

    maxSize: number

    The maximum size of the deque.

    -
    size: number

    The size of the deque.

    -

    Methods

    • Returns an iterator for the deque.

      +

    Type Parameters

    • T

      Type of deque data.

      +

    Constructors

    Properties

    maxSize: number

    The maximum size of the deque.

    +
    size: number

    The size of the deque.

    +

    Methods

    • Returns an backward iterator for the deque.

      +
    • Peeks at the first data.

      Returns undefined | T

      The first data or undefined if the deque is empty.

      -
    • Peeks at the last data.

      Returns undefined | T

      The last data or undefined if the deque is empty.

      -
    • Pops data from the deque.

      Returns undefined | T

      The popped data or undefined if the deque is empty.

      -
    • Appends data to the deque.

      -

      Parameters

    • Appends data to the deque.

      +

      Parameters

      • data: T

        Data to append.

      Returns number

      The new size of the deque.

      -
    • Shifts data from the deque.

      Returns undefined | T

      The shifted data or undefined if the deque is empty.

      -
    • Prepends data to the deque.

      -

      Parameters

    • Prepends data to the deque.

      +

      Parameters

      • data: T

        Data to prepend.

      Returns number

      The new size of the deque.

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/DynamicClusterPool.html b/docs/classes/DynamicClusterPool.html index 438e4c18..31822142 100644 --- a/docs/classes/DynamicClusterPool.html +++ b/docs/classes/DynamicClusterPool.html @@ -1,65 +1,65 @@ -DynamicClusterPool | poolifier - v3.1.21

    Class DynamicClusterPool<Data, Response>

    A cluster pool with a dynamic number of workers, but a guaranteed minimum number of workers.

    +DynamicClusterPool | poolifier - v3.1.21

    Class DynamicClusterPool<Data, Response>

    A cluster pool with a dynamic number of workers, but a guaranteed minimum number of workers.

    This cluster pool creates new workers when the others are busy, up to the maximum number of workers. When the maximum number of workers is reached and workers are busy, an event is emitted. If you want to listen to this event, use the pool's emitter.

    Author

    Christopher Quadflieg

    Since

    2.0.0

    -

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      -
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      -

    Hierarchy (view full)

    Constructors

    Properties

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. +

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      +

    Hierarchy (view full)

    Constructors

    Properties

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

    Events that can currently be listened to:

      @@ -72,106 +72,71 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
    • 'taskError': Emitted when an error occurs while executing a task.
    • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
    -
    filePath: string

    Path to the worker file.

    -
    maximumNumberOfWorkers?: number

    Maximum number of workers that this pool manages.

    -
    minimumNumberOfWorkers: number

    Minimum number of workers that this pool manages.

    -
    opts: PoolOptions<Worker>

    Options for the pool.

    -
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

    The task execution response promise map:

    +
    filePath: string

    Path to the worker file.

    +
    maximumNumberOfWorkers?: number

    Maximum number of workers that this pool manages.

    +
    minimumNumberOfWorkers: number

    Minimum number of workers that this pool manages.

    +
    opts: PoolOptions<Worker>

    Options for the pool.

    +
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

    The task execution response promise map:

    • key: The message id of each submitted task.
    • value: An object that contains the worker, the execution response promise resolve and reject callbacks.

    When we receive a message from the worker, we get a map entry with the promise resolve/reject bound to the message id.

    -
    workerChoiceStrategyContext?: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy context referencing a worker choice algorithm implementation.

    -
    workerNodes: IWorkerNode<Worker, Data>[] = []

    Pool worker nodes.

    -

    Accessors

    workerChoiceStrategyContext?: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy context referencing a worker choice algorithm implementation.

    +
    workerNodes: IWorkerNode<Worker, Data>[] = []

    Pool worker nodes.

    +

    Accessors

    • get busy(): boolean
    • Whether the pool is busy or not.

      The pool busyness boolean status.

      -

      Returns boolean

    • get full(): boolean
    • Whether the pool is full or not.

      The pool filling boolean status.

      -

      Returns boolean

    • get type(): "fixed" | "dynamic"
    • The pool type.

      If it is 'dynamic', it provides the max property.

      -

      Returns "fixed" | "dynamic"

    • get utilization(): number
    • The approximate pool utilization.

      +

      Returns "fixed" | "dynamic"

    • get utilization(): number
    • The approximate pool utilization.

      Returns number

      The pool utilization.

      -
    • get worker(): "thread" | "cluster"
    • The worker type.

      -

      Returns "thread" | "cluster"

    Methods

    • Hook executed after the worker task execution. +

    • get worker(): "thread" | "cluster"
    • The worker type.

      +

      Returns "thread" | "cluster"

    Methods

    • Executes the specified function in the worker constructor with the task data input parameter.

      -

      Parameters

      • Optional data: Data

        The optional task input data for the specified task function. This can only be structured-cloneable data.

        -
      • Optional name: string

        The optional name of the task function to execute. If not specified, the default task function will be executed.

        -
      • Optional transferList: TransferListItem[]

        An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards.

        -

      Returns Promise<Response>

      Promise that will be fulfilled when the task is completed.

      -
    • Sets the worker choice strategy in this pool.

      -

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The worker choice strategy.

        -
      • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

        The worker choice strategy options.

        -

      Returns void

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/DynamicThreadPool.html b/docs/classes/DynamicThreadPool.html index 51007eb6..25d1f796 100644 --- a/docs/classes/DynamicThreadPool.html +++ b/docs/classes/DynamicThreadPool.html @@ -1,65 +1,65 @@ -DynamicThreadPool | poolifier - v3.1.21

    Class DynamicThreadPool<Data, Response>

    A thread pool with a dynamic number of threads, but a guaranteed minimum number of threads.

    +DynamicThreadPool | poolifier - v3.1.21

    Class DynamicThreadPool<Data, Response>

    A thread pool with a dynamic number of threads, but a guaranteed minimum number of threads.

    This thread pool creates new threads when the others are busy, up to the maximum number of threads. When the maximum number of threads is reached and workers are busy, an event is emitted. If you want to listen to this event, use the pool's emitter.

    Author

    Alessandro Pio Ardizio

    Since

    0.0.1

    -

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      -
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      -

    Hierarchy (view full)

    Constructors

    Properties

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. +

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      +

    Hierarchy (view full)

    Constructors

    Properties

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

    Events that can currently be listened to:

      @@ -72,107 +72,72 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
    • 'taskError': Emitted when an error occurs while executing a task.
    • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
    -
    filePath: string

    Path to the worker file.

    -
    maximumNumberOfWorkers?: number

    Maximum number of workers that this pool manages.

    -
    minimumNumberOfWorkers: number

    Minimum number of workers that this pool manages.

    -
    opts: PoolOptions<Worker>

    Options for the pool.

    -
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

    The task execution response promise map:

    +
    filePath: string

    Path to the worker file.

    +
    maximumNumberOfWorkers?: number

    Maximum number of workers that this pool manages.

    +
    minimumNumberOfWorkers: number

    Minimum number of workers that this pool manages.

    +
    opts: PoolOptions<Worker>

    Options for the pool.

    +
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

    The task execution response promise map:

    • key: The message id of each submitted task.
    • value: An object that contains the worker, the execution response promise resolve and reject callbacks.

    When we receive a message from the worker, we get a map entry with the promise resolve/reject bound to the message id.

    -
    workerChoiceStrategyContext?: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy context referencing a worker choice algorithm implementation.

    -
    workerNodes: IWorkerNode<Worker, Data>[] = []

    Pool worker nodes.

    -

    Accessors

    workerChoiceStrategyContext?: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy context referencing a worker choice algorithm implementation.

    +
    workerNodes: IWorkerNode<Worker, Data>[] = []

    Pool worker nodes.

    +

    Accessors

    • get busy(): boolean
    • Whether the pool is busy or not.

      The pool busyness boolean status.

      -

      Returns boolean

    • get full(): boolean
    • Whether the pool is full or not.

      The pool filling boolean status.

      -

      Returns boolean

    • get type(): "fixed" | "dynamic"
    • The pool type.

      If it is 'dynamic', it provides the max property.

      -

      Returns "fixed" | "dynamic"

    • get utilization(): number
    • The approximate pool utilization.

      +

      Returns "fixed" | "dynamic"

    • get utilization(): number
    • The approximate pool utilization.

      Returns number

      The pool utilization.

      -
    • get worker(): "thread" | "cluster"
    • The worker type.

      -

      Returns "thread" | "cluster"

    Methods

    • Hook executed after the worker task execution. +

    • get worker(): "thread" | "cluster"
    • The worker type.

      +

      Returns "thread" | "cluster"

    Methods

    • Executes the specified function in the worker constructor with the task data input parameter.

      -

      Parameters

      • Optional data: Data

        The optional task input data for the specified task function. This can only be structured-cloneable data.

        -
      • Optional name: string

        The optional name of the task function to execute. If not specified, the default task function will be executed.

        -
      • Optional transferList: TransferListItem[]

        An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards.

        -

      Returns Promise<Response>

      Promise that will be fulfilled when the task is completed.

      -
    • Sends a message to worker given its worker node key.

      -

      Parameters

      • workerNodeKey: number

        The worker node key.

        -
      • message: MessageValue<Data, unknown>

        The message.

        -
      • Optional transferList: TransferListItem[]

        The optional array of transferable objects.

        -

      Returns void

    • Sets the worker choice strategy in this pool.

      -

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The worker choice strategy.

        -
      • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

        The worker choice strategy options.

        -

      Returns void

    • Sends a message to worker given its worker node key.

      +

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • message: MessageValue<Data, unknown>

        The message.

        +
      • Optional transferList: TransferListItem[]

        The optional array of transferable objects.

        +

      Returns void

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index ca0bffe4..0449c929 100644 --- a/docs/classes/FixedClusterPool.html +++ b/docs/classes/FixedClusterPool.html @@ -1,62 +1,62 @@ -FixedClusterPool | poolifier - v3.1.21

    Class FixedClusterPool<Data, Response>

    A cluster pool with a fixed number of workers.

    +FixedClusterPool | poolifier - v3.1.21

    Class FixedClusterPool<Data, Response>

    A cluster pool with a fixed number of workers.

    Author

    Christopher Quadflieg

    Since

    2.0.0

    -

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      -
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      -

    Hierarchy (view full)

    Constructors

    Properties

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. +

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      +

    Hierarchy (view full)

    Constructors

    Properties

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

    Events that can currently be listened to:

      @@ -69,106 +69,71 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
    • 'taskError': Emitted when an error occurs while executing a task.
    • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
    -
    filePath: string

    Path to the worker file.

    -
    maximumNumberOfWorkers?: number

    Maximum number of workers that this pool manages.

    -
    minimumNumberOfWorkers: number

    Minimum number of workers that this pool manages.

    -
    opts: PoolOptions<Worker>

    Options for the pool.

    -
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

    The task execution response promise map:

    +
    filePath: string

    Path to the worker file.

    +
    maximumNumberOfWorkers?: number

    Maximum number of workers that this pool manages.

    +
    minimumNumberOfWorkers: number

    Minimum number of workers that this pool manages.

    +
    opts: PoolOptions<Worker>

    Options for the pool.

    +
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

    The task execution response promise map:

    • key: The message id of each submitted task.
    • value: An object that contains the worker, the execution response promise resolve and reject callbacks.

    When we receive a message from the worker, we get a map entry with the promise resolve/reject bound to the message id.

    -
    workerChoiceStrategyContext?: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy context referencing a worker choice algorithm implementation.

    -
    workerNodes: IWorkerNode<Worker, Data>[] = []

    Pool worker nodes.

    -

    Accessors

    workerChoiceStrategyContext?: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy context referencing a worker choice algorithm implementation.

    +
    workerNodes: IWorkerNode<Worker, Data>[] = []

    Pool worker nodes.

    +

    Accessors

    • get busy(): boolean
    • Whether the pool is busy or not.

      The pool busyness boolean status.

      -

      Returns boolean

    • get full(): boolean
    • Whether the pool is full or not.

      The pool filling boolean status.

      -

      Returns boolean

    • get type(): "fixed" | "dynamic"
    • The pool type.

      If it is 'dynamic', it provides the max property.

      -

      Returns "fixed" | "dynamic"

    • get utilization(): number
    • The approximate pool utilization.

      +

      Returns "fixed" | "dynamic"

    • get utilization(): number
    • The approximate pool utilization.

      Returns number

      The pool utilization.

      -
    • get worker(): "thread" | "cluster"
    • The worker type.

      -

      Returns "thread" | "cluster"

    Methods

    • Hook executed after the worker task execution. +

    • get worker(): "thread" | "cluster"
    • The worker type.

      +

      Returns "thread" | "cluster"

    Methods

    • Executes the specified function in the worker constructor with the task data input parameter.

      -

      Parameters

      • Optional data: Data

        The optional task input data for the specified task function. This can only be structured-cloneable data.

        -
      • Optional name: string

        The optional name of the task function to execute. If not specified, the default task function will be executed.

        -
      • Optional transferList: TransferListItem[]

        An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards.

        -

      Returns Promise<Response>

      Promise that will be fulfilled when the task is completed.

      -
    • Whether the specified task function exists in this pool.

      -

      Parameters

      • name: string

        The name of the task function.

        -

      Returns boolean

      true if the task function exists, false otherwise.

      -
    • Removes a task function from this pool.

      -

      Parameters

      • name: string

        The name of the task function.

        -

      Returns Promise<boolean>

      true if the task function was removed, false otherwise.

      -
    • Sets the default task function in this pool.

      -

      Parameters

      • name: string

        The name of the task function.

        -

      Returns Promise<boolean>

      true if the default task function was set, false otherwise.

      -
    • Sets the worker choice strategy in this pool.

      -

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The worker choice strategy.

        -
      • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

        The worker choice strategy options.

        -

      Returns void

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index 0ef1362e..2413fd7b 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -1,62 +1,62 @@ -FixedThreadPool | poolifier - v3.1.21

    Class FixedThreadPool<Data, Response>

    A thread pool with a fixed number of threads.

    +FixedThreadPool | poolifier - v3.1.21

    Class FixedThreadPool<Data, Response>

    A thread pool with a fixed number of threads.

    Author

    Alessandro Pio Ardizio

    Since

    0.0.1

    -

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      -
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      -

    Hierarchy (view full)

    Constructors

    Properties

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. +

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      +

    Hierarchy (view full)

    Constructors

    Properties

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

    Events that can currently be listened to:

      @@ -69,107 +69,72 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
    • 'taskError': Emitted when an error occurs while executing a task.
    • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
    -
    filePath: string

    Path to the worker file.

    -
    maximumNumberOfWorkers?: number

    Maximum number of workers that this pool manages.

    -
    minimumNumberOfWorkers: number

    Minimum number of workers that this pool manages.

    -
    opts: PoolOptions<Worker>

    Options for the pool.

    -
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

    The task execution response promise map:

    +
    filePath: string

    Path to the worker file.

    +
    maximumNumberOfWorkers?: number

    Maximum number of workers that this pool manages.

    +
    minimumNumberOfWorkers: number

    Minimum number of workers that this pool manages.

    +
    opts: PoolOptions<Worker>

    Options for the pool.

    +
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

    The task execution response promise map:

    • key: The message id of each submitted task.
    • value: An object that contains the worker, the execution response promise resolve and reject callbacks.

    When we receive a message from the worker, we get a map entry with the promise resolve/reject bound to the message id.

    -
    workerChoiceStrategyContext?: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy context referencing a worker choice algorithm implementation.

    -
    workerNodes: IWorkerNode<Worker, Data>[] = []

    Pool worker nodes.

    -

    Accessors

    workerChoiceStrategyContext?: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy context referencing a worker choice algorithm implementation.

    +
    workerNodes: IWorkerNode<Worker, Data>[] = []

    Pool worker nodes.

    +

    Accessors

    • get busy(): boolean
    • Whether the pool is busy or not.

      The pool busyness boolean status.

      -

      Returns boolean

    • get full(): boolean
    • Whether the pool is full or not.

      The pool filling boolean status.

      -

      Returns boolean

    • get type(): "fixed" | "dynamic"
    • The pool type.

      If it is 'dynamic', it provides the max property.

      -

      Returns "fixed" | "dynamic"

    • get utilization(): number
    • The approximate pool utilization.

      +

      Returns "fixed" | "dynamic"

    • get utilization(): number
    • The approximate pool utilization.

      Returns number

      The pool utilization.

      -
    • get worker(): "thread" | "cluster"
    • The worker type.

      -

      Returns "thread" | "cluster"

    Methods

    • Hook executed after the worker task execution. +

    • get worker(): "thread" | "cluster"
    • The worker type.

      +

      Returns "thread" | "cluster"

    Methods

    • Executes the specified function in the worker constructor with the task data input parameter.

      -

      Parameters

      • Optional data: Data

        The optional task input data for the specified task function. This can only be structured-cloneable data.

        -
      • Optional name: string

        The optional name of the task function to execute. If not specified, the default task function will be executed.

        -
      • Optional transferList: TransferListItem[]

        An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards.

        -

      Returns Promise<Response>

      Promise that will be fulfilled when the task is completed.

      -
    • Whether the specified task function exists in this pool.

      -

      Parameters

      • name: string

        The name of the task function.

        -

      Returns boolean

      true if the task function exists, false otherwise.

      -
    • Removes a task function from this pool.

      -

      Parameters

      • name: string

        The name of the task function.

        -

      Returns Promise<boolean>

      true if the task function was removed, false otherwise.

      -
    • Sends a message to worker given its worker node key.

      -

      Parameters

      • workerNodeKey: number

        The worker node key.

        -
      • message: MessageValue<Data, unknown>

        The message.

        -
      • Optional transferList: TransferListItem[]

        The optional array of transferable objects.

        -

      Returns void

    • Sets the default task function in this pool.

      -

      Parameters

      • name: string

        The name of the task function.

        -

      Returns Promise<boolean>

      true if the default task function was set, false otherwise.

      -
    • Sets the worker choice strategy in this pool.

      -

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The worker choice strategy.

        -
      • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

        The worker choice strategy options.

        -

      Returns void

    • Sends a message to worker given its worker node key.

      +

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • message: MessageValue<Data, unknown>

        The message.

        +
      • Optional transferList: TransferListItem[]

        The optional array of transferable objects.

        +

      Returns void

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/ThreadWorker.html b/docs/classes/ThreadWorker.html index fc092ca1..ad62d1c2 100644 --- a/docs/classes/ThreadWorker.html +++ b/docs/classes/ThreadWorker.html @@ -1,84 +1,84 @@ -ThreadWorker | poolifier - v3.1.21

    Class ThreadWorker<Data, Response>

    A thread worker used by a poolifier ThreadPool.

    +ThreadWorker | poolifier - v3.1.21

    Class ThreadWorker<Data, Response>

    A thread worker used by a poolifier ThreadPool.

    When this worker is inactive for more than the given maxInactiveTime, it will send a termination request to its main thread.

    If you use a DynamicThreadPool the extra workers that were created will be terminated, but the minimum number of workers will be guaranteed.

    Author

    Alessandro Pio Ardizio

    Since

    0.0.1

    -

    Type Parameters

    • Data = unknown

      Type of data this worker receives from pool's execution. This can only be structured-cloneable data.

      -
    • Response = unknown

      Type of response the worker sends back to the main thread. This can only be structured-cloneable data.

      -

    Hierarchy (view full)

    Constructors

    Properties

    activeInterval?: Timeout

    Handler id of the activeInterval worker activity check.

    -
    isMain: undefined | boolean

    Whether this is the main worker or not.

    -
    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    -
    opts: WorkerOptions = DEFAULT_WORKER_OPTIONS

    Options for the worker.

    -
    port?: MessagePort

    Message port used to communicate with the main worker.

    -
    statistics?: WorkerStatistics

    Performance statistics computation requirements.

    -
    taskFunctions: Map<string, TaskFunction<Data, Response>>

    Task function(s) processed by the worker when the pool's execution function is invoked.

    -

    Accessors

    Methods

    Type Parameters

    • Data = unknown

      Type of data this worker receives from pool's execution. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of response the worker sends back to the main thread. This can only be structured-cloneable data.

      +

    Hierarchy (view full)

    Constructors

    Properties

    activeInterval?: Timeout

    Handler id of the activeInterval worker activity check.

    +
    isMain: undefined | boolean

    Whether this is the main worker or not.

    +
    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    +
    opts: WorkerOptions = DEFAULT_WORKER_OPTIONS

    Options for the worker.

    +
    port?: MessagePort

    Message port used to communicate with the main worker.

    +
    statistics?: WorkerStatistics

    Performance statistics computation requirements.

    +
    taskFunctions: Map<string, TaskFunction<Data, Response>>

    Task function(s) processed by the worker when the pool's execution function is invoked.

    +

    Accessors

    Methods

    • Handles an error and convert it to a string so it can be sent back to the main worker.

      +

      Parameters

      • error: string | Error

        The error raised by the worker.

      Returns string

      The error message.

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/WorkerChoiceStrategyContext.html b/docs/classes/WorkerChoiceStrategyContext.html index fdd70a7e..4759457a 100644 --- a/docs/classes/WorkerChoiceStrategyContext.html +++ b/docs/classes/WorkerChoiceStrategyContext.html @@ -1,46 +1,46 @@ -WorkerChoiceStrategyContext | poolifier - v3.1.21

    Class WorkerChoiceStrategyContext<Worker, Data, Response>

    The worker choice strategy context.

    -

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      -
    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      -
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      -

    Constructors

    Properties

    retries: number

    The maximum number of worker choice strategy execution retries.

    -
    retriesCount: number

    The number of worker choice strategy execution retries.

    -
    workerChoiceStrategies: Map<"ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN", IWorkerChoiceStrategy>

    The worker choice strategy instances registered in the context.

    -
    workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN" = WorkerChoiceStrategies.ROUND_ROBIN

    The worker choice strategy.

    -

    Methods

    • Sets the worker choice strategy to use in the context.

      +

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The worker choice strategy to set.

        +

      Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/availableParallelism.html b/docs/functions/availableParallelism.html index 2a69950f..68ed10d9 100644 --- a/docs/functions/availableParallelism.html +++ b/docs/functions/availableParallelism.html @@ -1,4 +1,4 @@ -availableParallelism | poolifier - v3.1.21

    Function availableParallelism

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/hierarchy.html b/docs/hierarchy.html index 2abdd358..5129cc42 100644 --- a/docs/hierarchy.html +++ b/docs/hierarchy.html @@ -1 +1 @@ -poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 0a5579dc..d1f4f8bc 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,67 +1,67 @@ -poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/EventLoopUtilizationMeasurementStatistics.html b/docs/interfaces/EventLoopUtilizationMeasurementStatistics.html index 2a52fea2..b04d38a3 100644 --- a/docs/interfaces/EventLoopUtilizationMeasurementStatistics.html +++ b/docs/interfaces/EventLoopUtilizationMeasurementStatistics.html @@ -1,5 +1,5 @@ -EventLoopUtilizationMeasurementStatistics | poolifier - v3.1.21

    Interface EventLoopUtilizationMeasurementStatisticsInternal

    Event loop utilization measurement statistics.

    -
    interface EventLoopUtilizationMeasurementStatistics {
        active: MeasurementStatistics;
        idle: MeasurementStatistics;
        utilization?: number;
    }

    Properties

    Properties

    utilization?: number

    Generated using TypeDoc

    \ No newline at end of file +EventLoopUtilizationMeasurementStatistics | poolifier - v3.1.21

    Interface EventLoopUtilizationMeasurementStatisticsInternal

    Event loop utilization measurement statistics.

    +
    interface EventLoopUtilizationMeasurementStatistics {
        active: MeasurementStatistics;
        idle: MeasurementStatistics;
        utilization?: number;
    }

    Properties

    Properties

    utilization?: number

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/ILinkedListNode.html b/docs/interfaces/ILinkedListNode.html index c704b080..36967f26 100644 --- a/docs/interfaces/ILinkedListNode.html +++ b/docs/interfaces/ILinkedListNode.html @@ -1,6 +1,6 @@ -ILinkedListNode | poolifier - v3.1.21

    Interface ILinkedListNode<T>Internal

    Linked list node interface.

    -
    interface ILinkedListNode<T> {
        data: T;
        next?: ILinkedListNode<T>;
        prev?: ILinkedListNode<T>;
    }

    Type Parameters

    • T

      Type of linked list node data.

      -

    Properties

    Properties

    data: T

    Generated using TypeDoc

    \ No newline at end of file +ILinkedListNode | poolifier - v3.1.21

    Interface ILinkedListNode<T>Internal

    Linked list node interface.

    +
    interface ILinkedListNode<T> {
        data: T;
        next?: ILinkedListNode<T>;
        prev?: ILinkedListNode<T>;
    }

    Type Parameters

    • T

      Type of linked list node data.

      +

    Properties

    Properties

    data: T

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/IPool.html b/docs/interfaces/IPool.html index 551e2459..615fc4f1 100644 --- a/docs/interfaces/IPool.html +++ b/docs/interfaces/IPool.html @@ -1,39 +1,31 @@ -IPool | poolifier - v3.1.21

    Interface IPool<Worker, Data, Response>

    Contract definition for a poolifier pool.

    -
    interface IPool<Worker, Data, Response> {
        addTaskFunction: ((name, fn) => Promise<boolean>);
        destroy: (() => Promise<void>);
        emitter?: EventEmitterAsyncResource;
        enableTasksQueue: ((enable, tasksQueueOptions?) => void);
        execute: ((data?, name?, transferList?) => Promise<Response>);
        hasTaskFunction: ((name) => boolean);
        info: PoolInfo;
        listTaskFunctionNames: (() => string[]);
        removeTaskFunction: ((name) => Promise<boolean>);
        setDefaultTaskFunction: ((name) => Promise<boolean>);
        setTasksQueueOptions: ((tasksQueueOptions) => void);
        setWorkerChoiceStrategy: ((workerChoiceStrategy, workerChoiceStrategyOptions?) => void);
        setWorkerChoiceStrategyOptions: ((workerChoiceStrategyOptions) => void);
        start: (() => void);
        workerNodes: IWorkerNode<Worker, Data>[];
    }

    Type Parameters

    • Worker extends IWorker

      Type of worker which manages this pool.

      -
    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      -
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      -

    Implemented by

    Properties

    addTaskFunction: ((name, fn) => Promise<boolean>)

    Adds a task function to this pool. +IPool | poolifier - v3.1.21

    Interface IPool<Worker, Data, Response>

    Contract definition for a poolifier pool.

    +
    interface IPool<Worker, Data, Response> {
        addTaskFunction: ((name, fn) => Promise<boolean>);
        destroy: (() => Promise<void>);
        emitter?: EventEmitterAsyncResource;
        enableTasksQueue: ((enable, tasksQueueOptions?) => void);
        execute: ((data?, name?, transferList?) => Promise<Response>);
        hasTaskFunction: ((name) => boolean);
        info: PoolInfo;
        listTaskFunctionNames: (() => string[]);
        removeTaskFunction: ((name) => Promise<boolean>);
        setDefaultTaskFunction: ((name) => Promise<boolean>);
        setTasksQueueOptions: ((tasksQueueOptions) => void);
        setWorkerChoiceStrategy: ((workerChoiceStrategy, workerChoiceStrategyOptions?) => void);
        setWorkerChoiceStrategyOptions: ((workerChoiceStrategyOptions) => void);
        start: (() => void);
        workerNodes: IWorkerNode<Worker, Data>[];
    }

    Type Parameters

    • Worker extends IWorker

      Type of worker which manages this pool.

      +
    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      +

    Implemented by

    Properties

    addTaskFunction: ((name, fn) => Promise<boolean>)

    Adds a task function to this pool. If a task function with the same name already exists, it will be overwritten.

    -

    Type declaration

    Param: name

    The name of the task function.

    -

    Param: fn

    The task function.

    -

    Returns

    true if the task function was added, false otherwise.

    +

    Type declaration

      • (name, fn): Promise<boolean>
      • Parameters

        Returns Promise<boolean>

    Returns

    true if the task function was added, false otherwise.

    Throws

    https://nodejs.org/api/errors.html#class-typeerror If the name parameter is not a string or an empty string.

    Throws

    https://nodejs.org/api/errors.html#class-typeerror If the fn parameter is not a function.

    -
    destroy: (() => Promise<void>)

    Terminates all workers in this pool.

    -

    Type declaration

      • (): Promise<void>
      • Terminates all workers in this pool.

        -

        Returns Promise<void>

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. +

    destroy: (() => Promise<void>)

    Terminates all workers in this pool.

    +

    Type declaration

      • (): Promise<void>
      • Returns Promise<void>

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

    Events that can currently be listened to:

      @@ -46,60 +38,33 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
    • 'taskError': Emitted when an error occurs while executing a task.
    • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
    -
    enableTasksQueue: ((enable, tasksQueueOptions?) => void)

    Enables/disables the worker node tasks queue in this pool.

    -

    Type declaration

      • (enable, tasksQueueOptions?): void
      • Enables/disables the worker node tasks queue in this pool.

        -

        Parameters

        • enable: boolean

          Whether to enable or disable the worker node tasks queue.

          -
        • Optional tasksQueueOptions: TasksQueueOptions

          The worker node tasks queue options.

          -

        Returns void

    Param: enable

    Whether to enable or disable the worker node tasks queue.

    -

    Param: tasksQueueOptions

    The worker node tasks queue options.

    -
    execute: ((data?, name?, transferList?) => Promise<Response>)

    Executes the specified function in the worker constructor with the task data input parameter.

    -

    Type declaration

      • (data?, name?, transferList?): Promise<Response>
      • Executes the specified function in the worker constructor with the task data input parameter.

        -

        Parameters

        • Optional data: Data

          The optional task input data for the specified task function. This can only be structured-cloneable data.

          -
        • Optional name: string

          The optional name of the task function to execute. If not specified, the default task function will be executed.

          -
        • Optional transferList: TransferListItem[]

          An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards.

          -

        Returns Promise<Response>

        Promise that will be fulfilled when the task is completed.

        -

    Param: data

    The optional task input data for the specified task function. This can only be structured-cloneable data.

    -

    Param: name

    The optional name of the task function to execute. If not specified, the default task function will be executed.

    -

    Param: transferList

    An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards.

    -

    Returns

    Promise that will be fulfilled when the task is completed.

    -
    hasTaskFunction: ((name) => boolean)

    Whether the specified task function exists in this pool.

    -

    Type declaration

      • (name): boolean
      • Whether the specified task function exists in this pool.

        -

        Parameters

        • name: string

          The name of the task function.

          -

        Returns boolean

        true if the task function exists, false otherwise.

        -

    Param: name

    The name of the task function.

    -

    Returns

    true if the task function exists, false otherwise.

    -
    info: PoolInfo

    Pool information.

    -
    listTaskFunctionNames: (() => string[])

    Lists the names of task function available in this pool.

    -

    Type declaration

      • (): string[]
      • Lists the names of task function available in this pool.

        -

        Returns string[]

        The names of task function available in this pool.

        -

    Returns

    The names of task function available in this pool.

    -
    removeTaskFunction: ((name) => Promise<boolean>)

    Removes a task function from this pool.

    -

    Type declaration

      • (name): Promise<boolean>
      • Removes a task function from this pool.

        -

        Parameters

        • name: string

          The name of the task function.

          -

        Returns Promise<boolean>

        true if the task function was removed, false otherwise.

        -

    Param: name

    The name of the task function.

    -

    Returns

    true if the task function was removed, false otherwise.

    -
    setDefaultTaskFunction: ((name) => Promise<boolean>)

    Sets the default task function in this pool.

    -

    Type declaration

      • (name): Promise<boolean>
      • Sets the default task function in this pool.

        -

        Parameters

        • name: string

          The name of the task function.

          -

        Returns Promise<boolean>

        true if the default task function was set, false otherwise.

        -

    Param: name

    The name of the task function.

    -

    Returns

    true if the default task function was set, false otherwise.

    -
    setTasksQueueOptions: ((tasksQueueOptions) => void)

    Sets the worker node tasks queue options in this pool.

    -

    Type declaration

      • (tasksQueueOptions): void
      • Sets the worker node tasks queue options in this pool.

        -

        Parameters

        Returns void

    Param: tasksQueueOptions

    The worker node tasks queue options.

    -
    setWorkerChoiceStrategy: ((workerChoiceStrategy, workerChoiceStrategyOptions?) => void)

    Sets the worker choice strategy in this pool.

    -

    Type declaration

      • (workerChoiceStrategy, workerChoiceStrategyOptions?): void
      • Sets the worker choice strategy in this pool.

        -

        Parameters

        • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

          The worker choice strategy.

          -
        • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

          The worker choice strategy options.

          -

        Returns void

    Param: workerChoiceStrategy

    The worker choice strategy.

    -

    Param: workerChoiceStrategyOptions

    The worker choice strategy options.

    -
    setWorkerChoiceStrategyOptions: ((workerChoiceStrategyOptions) => void)

    Sets the worker choice strategy options in this pool.

    -

    Type declaration

      • (workerChoiceStrategyOptions): void
      • Sets the worker choice strategy options in this pool.

        -

        Parameters

        Returns void

    Param: workerChoiceStrategyOptions

    The worker choice strategy options.

    -
    start: (() => void)

    Starts the minimum number of workers in this pool.

    -

    Type declaration

      • (): void
      • Starts the minimum number of workers in this pool.

        -

        Returns void

    workerNodes: IWorkerNode<Worker, Data>[]

    Pool worker nodes.

    -

    Generated using TypeDoc

    \ No newline at end of file +
    enableTasksQueue: ((enable, tasksQueueOptions?) => void)

    Enables/disables the worker node tasks queue in this pool.

    +

    Type declaration

      • (enable, tasksQueueOptions?): void
      • Parameters

        • enable: boolean

          Whether to enable or disable the worker node tasks queue.

          +
        • Optional tasksQueueOptions: TasksQueueOptions

          The worker node tasks queue options.

          +

        Returns void

    execute: ((data?, name?, transferList?) => Promise<Response>)

    Executes the specified function in the worker constructor with the task data input parameter.

    +

    Type declaration

      • (data?, name?, transferList?): Promise<Response>
      • Parameters

        • Optional data: Data

          The optional task input data for the specified task function. This can only be structured-cloneable data.

          +
        • Optional name: string

          The optional name of the task function to execute. If not specified, the default task function will be executed.

          +
        • Optional transferList: TransferListItem[]

          An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards.

          +

        Returns Promise<Response>

    Returns

    Promise that will be fulfilled when the task is completed.

    +
    hasTaskFunction: ((name) => boolean)

    Whether the specified task function exists in this pool.

    +

    Type declaration

      • (name): boolean
      • Parameters

        • name: string

          The name of the task function.

          +

        Returns boolean

    Returns

    true if the task function exists, false otherwise.

    +
    info: PoolInfo

    Pool information.

    +
    listTaskFunctionNames: (() => string[])

    Lists the names of task function available in this pool.

    +

    Type declaration

      • (): string[]
      • Returns string[]

    Returns

    The names of task function available in this pool.

    +
    removeTaskFunction: ((name) => Promise<boolean>)

    Removes a task function from this pool.

    +

    Type declaration

      • (name): Promise<boolean>
      • Parameters

        • name: string

          The name of the task function.

          +

        Returns Promise<boolean>

    Returns

    true if the task function was removed, false otherwise.

    +
    setDefaultTaskFunction: ((name) => Promise<boolean>)

    Sets the default task function in this pool.

    +

    Type declaration

      • (name): Promise<boolean>
      • Parameters

        • name: string

          The name of the task function.

          +

        Returns Promise<boolean>

    Returns

    true if the default task function was set, false otherwise.

    +
    setTasksQueueOptions: ((tasksQueueOptions) => void)

    Sets the worker node tasks queue options in this pool.

    +

    Type declaration

      • (tasksQueueOptions): void
      • Parameters

        Returns void

    setWorkerChoiceStrategy: ((workerChoiceStrategy, workerChoiceStrategyOptions?) => void)

    Sets the worker choice strategy in this pool.

    +

    Type declaration

      • (workerChoiceStrategy, workerChoiceStrategyOptions?): void
      • Parameters

        • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

          The worker choice strategy.

          +
        • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

          The worker choice strategy options.

          +

        Returns void

    setWorkerChoiceStrategyOptions: ((workerChoiceStrategyOptions) => void)

    Sets the worker choice strategy options in this pool.

    +

    Type declaration

      • (workerChoiceStrategyOptions): void
      • Parameters

        Returns void

    start: (() => void)

    Starts the minimum number of workers in this pool.

    +

    Type declaration

      • (): void
      • Returns void

    workerNodes: IWorkerNode<Worker, Data>[]

    Pool worker nodes.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/IWorker.html b/docs/interfaces/IWorker.html index 3e1f4eb6..d8cef72b 100644 --- a/docs/interfaces/IWorker.html +++ b/docs/interfaces/IWorker.html @@ -1,112 +1,99 @@ -IWorker | poolifier - v3.1.21

    Interface IWorker

    Worker interface.

    -
    interface IWorker {
        disconnect?: (() => void);
        id?: number;
        kill?: ((signal?) => void);
        on: ((event, handler) => this);
        once: ((event, handler) => this);
        terminate?: (() => Promise<number>);
        threadId?: number;
        unref?: (() => void);
        [captureRejectionSymbol]?(error, event, ...args): void;
        addListener(eventName, listener): this;
        emit(eventName, ...args): boolean;
        eventNames(): (string | symbol)[];
        getMaxListeners(): number;
        listenerCount(eventName, listener?): number;
        listeners(eventName): Function[];
        off(eventName, listener): this;
        prependListener(eventName, listener): this;
        prependOnceListener(eventName, listener): this;
        rawListeners(eventName): Function[];
        removeAllListeners(event?): this;
        removeListener(eventName, listener): this;
        setMaxListeners(n): this;
    }

    Hierarchy

    • EventEmitter
      • IWorker

    Properties

    disconnect?: (() => void)

    Cluster worker disconnect.

    -

    Type declaration

      • (): void
      • Cluster worker disconnect.

        -

        Returns void

    id?: number

    Cluster worker id.

    -
    kill?: ((signal?) => void)

    Cluster worker kill.

    -

    Type declaration

      • (signal?): void
      • Cluster worker kill.

        -

        Parameters

        • Optional signal: string

        Returns void

    on: ((event, handler) => this)

    Registers an event handler.

    -

    Type declaration

      • (event, handler): this
      • Registers an event handler.

        -

        Parameters

        Returns this

    Param: event

    The event.

    -

    Param: handler

    The event handler.

    -
    once: ((event, handler) => this)

    Registers once an event handler.

    -

    Type declaration

      • (event, handler): this
      • Registers once an event handler.

        -

        Parameters

        Returns this

    Param: event

    The event.

    -

    Param: handler

    The event handler.

    -
    terminate?: (() => Promise<number>)

    Stop all JavaScript execution in the worker thread as soon as possible. +IWorker | poolifier - v3.1.21

    Interface IWorker

    Worker interface.

    +
    interface IWorker {
        disconnect?: (() => void);
        id?: number;
        kill?: ((signal?) => void);
        on: ((event, handler) => this);
        once: ((event, handler) => this);
        terminate?: (() => Promise<number>);
        threadId?: number;
        unref?: (() => void);
        [captureRejectionSymbol]?<K>(error, event, ...args): void;
        addListener<K>(eventName, listener): this;
        emit<K>(eventName, ...args): boolean;
        eventNames(): (string | symbol)[];
        getMaxListeners(): number;
        listenerCount<K>(eventName, listener?): number;
        listeners<K>(eventName): Function[];
        off<K>(eventName, listener): this;
        prependListener<K>(eventName, listener): this;
        prependOnceListener<K>(eventName, listener): this;
        rawListeners<K>(eventName): Function[];
        removeAllListeners(event?): this;
        removeListener<K>(eventName, listener): this;
        setMaxListeners(n): this;
    }

    Hierarchy

    • EventEmitter
      • IWorker

    Properties

    disconnect?: (() => void)

    Cluster worker disconnect.

    +

    Type declaration

      • (): void
      • Returns void

    id?: number

    Cluster worker id.

    +
    kill?: ((signal?) => void)

    Cluster worker kill.

    +

    Type declaration

      • (signal?): void
      • Parameters

        • Optional signal: string

        Returns void

    on: ((event, handler) => this)

    Registers an event handler.

    +

    Type declaration

      • (event, handler): this
      • Parameters

        Returns this

    once: ((event, handler) => this)

    Registers once an event handler.

    +

    Type declaration

      • (event, handler): this
      • Parameters

        Returns this

    terminate?: (() => Promise<number>)

    Stop all JavaScript execution in the worker thread as soon as possible. Returns a Promise for the exit code that is fulfilled when the 'exit' event is emitted.

    -

    Type declaration

      • (): Promise<number>
      • Stop all JavaScript execution in the worker thread as soon as possible. -Returns a Promise for the exit code that is fulfilled when the 'exit' event is emitted.

        -

        Returns Promise<number>

    threadId?: number

    Worker thread worker id.

    -
    unref?: (() => void)

    Calling unref() on a worker allows the thread to exit if this is the only -active handle in the event system. If the worker is already unref()ed callingunref() again has no effect.

    -

    Type declaration

      • (): void
      • Calling unref() on a worker allows the thread to exit if this is the only +

        Type declaration

          • (): Promise<number>
          • Returns Promise<number>

    threadId?: number

    Worker thread worker id.

    +
    unref?: (() => void)

    Calling unref() on a worker allows the thread to exit if this is the only active handle in the event system. If the worker is already unref()ed callingunref() again has no effect.

    -

    Returns void

    Since

    v10.5.0

    -

    Since

    v10.5.0

    -

    Methods

    • Parameters

      • error: Error
      • event: string
      • Rest ...args: any[]

      Returns void

    • Alias for emitter.on(eventName, listener).

      -

      Parameters

      • eventName: string | symbol
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v0.1.26

      -
    • Synchronously calls each of the listeners registered for the event namedeventName, in the order they were registered, passing the supplied arguments +

      Type declaration

        • (): void
        • Returns void

      Since

      v10.5.0

      +

    Methods

    • Type Parameters

      • K

      Parameters

      • error: Error
      • event: string | symbol
      • Rest ...args: AnyRest

      Returns void

    • Alias for emitter.on(eventName, listener).

      +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v0.1.26

      +
    • Synchronously calls each of the listeners registered for the event namedeventName, in the order they were registered, passing the supplied arguments to each.

      Returns true if the event had listeners, false otherwise.

      import { EventEmitter } from 'node:events';
      const myEmitter = new EventEmitter();

      // First listener
      myEmitter.on('event', function firstListener() {
      console.log('Helloooo! first listener');
      });
      // Second listener
      myEmitter.on('event', function secondListener(arg1, arg2) {
      console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
      });
      // Third listener
      myEmitter.on('event', function thirdListener(...args) {
      const parameters = args.join(', ');
      console.log(`event with parameters ${parameters} in third listener`);
      });

      console.log(myEmitter.listeners('event'));

      myEmitter.emit('event', 1, 2, 3, 4, 5);

      // Prints:
      // [
      // [Function: firstListener],
      // [Function: secondListener],
      // [Function: thirdListener]
      // ]
      // Helloooo! first listener
      // event with parameters 1, 2 in second listener
      // event with parameters 1, 2, 3, 4, 5 in third listener
      -

      Parameters

      • eventName: string | symbol
      • Rest ...args: any[]

      Returns boolean

      Since

      v0.1.26

      -
    • Returns an array listing the events for which the emitter has registered +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • Rest ...args: AnyRest

      Returns boolean

      Since

      v0.1.26

      +
    • Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

      import { EventEmitter } from 'node:events';

      const myEE = new EventEmitter();
      myEE.on('foo', () => {});
      myEE.on('bar', () => {});

      const sym = Symbol('symbol');
      myEE.on(sym, () => {});

      console.log(myEE.eventNames());
      // Prints: [ 'foo', 'bar', Symbol(symbol) ]

      Returns (string | symbol)[]

      Since

      v6.0.0

      -
    • Returns the current max listener value for the EventEmitter which is either +

    • Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to defaultMaxListeners.

      Returns number

      Since

      v1.0.0

      -
    • Returns the number of listeners listening for the event named eventName. +

    • Returns the number of listeners listening for the event named eventName. If listener is provided, it will return how many times the listener is found in the list of the listeners of the event.

      -

      Parameters

      • eventName: string | symbol

        The name of the event being listened for

        -
      • Optional listener: Function

        The event handler function

        +

        Type Parameters

        • K

        Parameters

        • eventName: string | symbol

          The name of the event being listened for

          +
        • Optional listener: Function

          The event handler function

        Returns number

        Since

        v3.2.0

        -
    • Returns a copy of the array of listeners for the event named eventName.

      +
    • Returns a copy of the array of listeners for the event named eventName.

      server.on('connection', (stream) => {
      console.log('someone connected!');
      });
      console.log(util.inspect(server.listeners('connection')));
      // Prints: [ [Function] ]
      -

      Parameters

      • eventName: string | symbol

      Returns Function[]

      Since

      v0.1.26

      -
    • Alias for emitter.removeListener().

      -

      Parameters

      • eventName: string | symbol
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v10.0.0

      -
    • Adds the listener function to the beginning of the listeners array for the +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

      Returns Function[]

      Since

      v0.1.26

      +
    • Alias for emitter.removeListener().

      +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v10.0.0

      +
    • Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventNameand listener will result in the listener being added, and called, multiple times.

      server.prependListener('connection', (stream) => {
      console.log('someone connected!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      -

      Parameters

      • eventName: string | symbol

        The name of the event.

        -
      • listener: ((...args) => void)

        The callback function

        -
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v6.0.0

      -
    • Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event.

        +
      • listener: ((...args) => void)

        The callback function

        +
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v6.0.0

      +
    • Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

      server.prependOnceListener('connection', (stream) => {
      console.log('Ah, we have our first user!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      -

      Parameters

      • eventName: string | symbol

        The name of the event.

        -
      • listener: ((...args) => void)

        The callback function

        -
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v6.0.0

      -
    • Returns a copy of the array of listeners for the event named eventName, +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event.

        +
      • listener: ((...args) => void)

        The callback function

        +
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v6.0.0

      +
    • Returns a copy of the array of listeners for the event named eventName, including any wrappers (such as those created by .once()).

      import { EventEmitter } from 'node:events';
      const emitter = new EventEmitter();
      emitter.once('log', () => console.log('log once'));

      // Returns a new Array with a function `onceWrapper` which has a property
      // `listener` which contains the original listener bound above
      const listeners = emitter.rawListeners('log');
      const logFnWrapper = listeners[0];

      // Logs "log once" to the console and does not unbind the `once` event
      logFnWrapper.listener();

      // Logs "log once" to the console and removes the listener
      logFnWrapper();

      emitter.on('log', () => console.log('log persistently'));
      // Will return a new Array with a single function bound by `.on()` above
      const newListeners = emitter.rawListeners('log');

      // Logs "log persistently" twice
      newListeners[0]();
      emitter.emit('log');
      -

      Parameters

      • eventName: string | symbol

      Returns Function[]

      Since

      v9.4.0

      -
    • Removes all listeners, or those of the specified eventName.

      +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

      Returns Function[]

      Since

      v9.4.0

      +
    • Removes all listeners, or those of the specified eventName.

      It is bad practice to remove listeners added elsewhere in the code, particularly when the EventEmitter instance was created by some other component or module (e.g. sockets or file streams).

      Returns a reference to the EventEmitter, so that calls can be chained.

      -

      Parameters

      • Optional event: string | symbol

      Returns this

      Since

      v0.1.26

      -
    • Removes the specified listener from the listener array for the event namedeventName.

      +

      Parameters

      • Optional event: string | symbol

      Returns this

      Since

      v0.1.26

      +
    • Removes the specified listener from the listener array for the event namedeventName.

      const callback = (stream) => {
      console.log('someone connected!');
      };
      server.on('connection', callback);
      // ...
      server.removeListener('connection', callback);

      removeListener() will remove, at most, one instance of a listener from the @@ -129,11 +116,11 @@ recently added instance. In the example the once('ping')lis

      import { EventEmitter } from 'node:events';
      const ee = new EventEmitter();

      function pong() {
      console.log('pong');
      }

      ee.on('ping', pong);
      ee.once('ping', pong);
      ee.removeListener('ping', pong);

      ee.emit('ping');
      ee.emit('ping');

      Returns a reference to the EventEmitter, so that calls can be chained.

      -

      Parameters

      • eventName: string | symbol
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v0.1.26

      -
    • By default EventEmitters will print a warning if more than 10 listeners are +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v0.1.26

      +
    • By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set toInfinity (or 0) to indicate an unlimited number of listeners.

      Returns a reference to the EventEmitter, so that calls can be chained.

      -

      Parameters

      • n: number

      Returns this

      Since

      v0.3.5

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Parameters

    • n: number

    Returns this

    Since

    v0.3.5

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/IWorkerChoiceStrategy.html b/docs/interfaces/IWorkerChoiceStrategy.html index 6bc84d0e..aa2ba76f 100644 --- a/docs/interfaces/IWorkerChoiceStrategy.html +++ b/docs/interfaces/IWorkerChoiceStrategy.html @@ -1,39 +1,25 @@ -IWorkerChoiceStrategy | poolifier - v3.1.21

    Interface IWorkerChoiceStrategyInternal

    Worker choice strategy interface.

    -
    interface IWorkerChoiceStrategy {
        choose: (() => undefined | number);
        remove: ((workerNodeKey) => boolean);
        reset: (() => boolean);
        setOptions: ((opts) => void);
        strategyPolicy: StrategyPolicy;
        taskStatisticsRequirements: TaskStatisticsRequirements;
        update: ((workerNodeKey) => boolean);
    }

    Properties

    choose: (() => undefined | number)

    Chooses a worker node in the pool and returns its key. +IWorkerChoiceStrategy | poolifier - v3.1.21

    Interface IWorkerChoiceStrategyInternal

    Worker choice strategy interface.

    +
    interface IWorkerChoiceStrategy {
        choose: (() => undefined | number);
        remove: ((workerNodeKey) => boolean);
        reset: (() => boolean);
        setOptions: ((opts) => void);
        strategyPolicy: StrategyPolicy;
        taskStatisticsRequirements: TaskStatisticsRequirements;
        update: ((workerNodeKey) => boolean);
    }

    Properties

    choose: (() => undefined | number)

    Chooses a worker node in the pool and returns its key. If no worker nodes are not eligible, undefined is returned. If undefined is returned, the caller retry.

    -

    Type declaration

      • (): undefined | number
      • Chooses a worker node in the pool and returns its key. -If no worker nodes are not eligible, undefined is returned. -If undefined is returned, the caller retry.

        -

        Returns undefined | number

        The worker node key or undefined.

        -

    Returns

    The worker node key or undefined.

    -
    remove: ((workerNodeKey) => boolean)

    Removes the worker node key from strategy internals.

    -

    Type declaration

      • (workerNodeKey): boolean
      • Removes the worker node key from strategy internals.

        -

        Parameters

        • workerNodeKey: number

          The worker node key.

          -

        Returns boolean

        true if the worker node key is removed, false otherwise.

        -

    Param: workerNodeKey

    The worker node key.

    -

    Returns

    true if the worker node key is removed, false otherwise.

    -
    reset: (() => boolean)

    Resets strategy internals.

    -

    Type declaration

      • (): boolean
      • Resets strategy internals.

        -

        Returns boolean

        true if the reset is successful, false otherwise.

        -

    Returns

    true if the reset is successful, false otherwise.

    -
    setOptions: ((opts) => void)

    Sets the worker choice strategy options.

    -

    Type declaration

      • (opts): void
      • Sets the worker choice strategy options.

        -

        Parameters

        Returns void

    Param: opts

    The worker choice strategy options.

    -
    strategyPolicy: StrategyPolicy

    Strategy policy.

    -
    taskStatisticsRequirements: TaskStatisticsRequirements

    Tasks statistics requirements.

    -
    update: ((workerNodeKey) => boolean)

    Updates the worker node key strategy internals. -This is called after a task has been executed on a worker node.

    -

    Type declaration

    remove: ((workerNodeKey) => boolean)

    Removes the worker node key from strategy internals.

    +

    Type declaration

      • (workerNodeKey): boolean
      • Parameters

        • workerNodeKey: number

          The worker node key.

          +

        Returns boolean

    Returns

    true if the worker node key is removed, false otherwise.

    +
    reset: (() => boolean)

    Resets strategy internals.

    +

    Type declaration

      • (): boolean
      • Returns boolean

    Returns

    true if the reset is successful, false otherwise.

    +
    setOptions: ((opts) => void)

    Sets the worker choice strategy options.

    +

    Type declaration

    strategyPolicy: StrategyPolicy

    Strategy policy.

    +
    taskStatisticsRequirements: TaskStatisticsRequirements

    Tasks statistics requirements.

    +
    update: ((workerNodeKey) => boolean)

    Updates the worker node key strategy internals. This is called after a task has been executed on a worker node.

    -

    Parameters

    • workerNodeKey: number

    Returns boolean

    true if the update is successful, false otherwise.

    -

    Returns

    true if the update is successful, false otherwise.

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Type declaration

      • (workerNodeKey): boolean
      • Parameters

        • workerNodeKey: number

        Returns boolean

    Returns

    true if the update is successful, false otherwise.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/IWorkerNode.html b/docs/interfaces/IWorkerNode.html index 04b816a5..6f7eacda 100644 --- a/docs/interfaces/IWorkerNode.html +++ b/docs/interfaces/IWorkerNode.html @@ -1,136 +1,107 @@ -IWorkerNode | poolifier - v3.1.21

    Interface IWorkerNode<Worker, Data>Internal

    Worker node interface.

    -
    interface IWorkerNode<Worker, Data> {
        clearTasksQueue: (() => void);
        deleteTaskFunctionWorkerUsage: ((name) => boolean);
        dequeueTask: (() => undefined | Task<Data>);
        enqueueTask: ((task) => number);
        getTaskFunctionWorkerUsage: ((name) => undefined | WorkerUsage);
        hasBackPressure: (() => boolean);
        info: WorkerInfo;
        messageChannel?: MessageChannel;
        popTask: (() => undefined | Task<Data>);
        registerOnceWorkerEventHandler: ((event, handler) => void);
        registerWorkerEventHandler: ((event, handler) => void);
        resetUsage: (() => void);
        strategyData?: StrategyData;
        tasksQueueBackPressureSize: number;
        tasksQueueSize: (() => number);
        terminate: (() => Promise<void>);
        unshiftTask: ((task) => number);
        usage: WorkerUsage;
        worker: Worker;
        [captureRejectionSymbol]?(error, event, ...args): void;
        addListener(eventName, listener): this;
        emit(eventName, ...args): boolean;
        eventNames(): (string | symbol)[];
        getMaxListeners(): number;
        listenerCount(eventName, listener?): number;
        listeners(eventName): Function[];
        off(eventName, listener): this;
        on(eventName, listener): this;
        once(eventName, listener): this;
        prependListener(eventName, listener): this;
        prependOnceListener(eventName, listener): this;
        rawListeners(eventName): Function[];
        removeAllListeners(event?): this;
        removeListener(eventName, listener): this;
        setMaxListeners(n): this;
    }

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      -
    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      -

    Hierarchy

    • EventEmitter
      • IWorkerNode

    Properties

    clearTasksQueue: (() => void)

    Clears tasks queue.

    -

    Type declaration

      • (): void
      • Clears tasks queue.

        -

        Returns void

    deleteTaskFunctionWorkerUsage: ((name) => boolean)

    Deletes task function worker usage statistics.

    -

    Type declaration

      • (name): boolean
      • Deletes task function worker usage statistics.

        -

        Parameters

        • name: string

          The task function name.

          -

        Returns boolean

        true if the task function worker usage statistics were deleted, false otherwise.

        -

    Param: name

    The task function name.

    -

    Returns

    true if the task function worker usage statistics were deleted, false otherwise.

    -
    dequeueTask: (() => undefined | Task<Data>)

    Dequeue task.

    -

    Type declaration

      • (): undefined | Task<Data>
      • Dequeue task.

        -

        Returns undefined | Task<Data>

        The dequeued task.

        -

    Returns

    The dequeued task.

    -
    enqueueTask: ((task) => number)

    Enqueue task.

    -

    Type declaration

      • (task): number
      • Enqueue task.

        -

        Parameters

        Returns number

        The tasks queue size.

        -

    Param: task

    The task to queue.

    -

    Returns

    The tasks queue size.

    -
    getTaskFunctionWorkerUsage: ((name) => undefined | WorkerUsage)

    Gets task function worker usage statistics.

    -

    Type declaration

      • (name): undefined | WorkerUsage
      • Gets task function worker usage statistics.

        -

        Parameters

        • name: string

          The task function name.

          -

        Returns undefined | WorkerUsage

        The task function worker usage statistics if the task function worker usage statistics are initialized, undefined otherwise.

        -

    Param: name

    The task function name.

    -

    Returns

    The task function worker usage statistics if the task function worker usage statistics are initialized, undefined otherwise.

    -
    hasBackPressure: (() => boolean)

    Whether the worker node has back pressure (i.e. its tasks queue is full).

    -

    Type declaration

      • (): boolean
      • Whether the worker node has back pressure (i.e. its tasks queue is full).

        -

        Returns boolean

        true if the worker node has back pressure, false otherwise.

        -

    Returns

    true if the worker node has back pressure, false otherwise.

    -

    Worker info.

    -
    messageChannel?: MessageChannel

    Message channel (worker thread only).

    -
    popTask: (() => undefined | Task<Data>)

    Pops a task from the tasks queue.

    -

    Type declaration

      • (): undefined | Task<Data>
      • Pops a task from the tasks queue.

        -

        Returns undefined | Task<Data>

        The popped task.

        -

    Returns

    The popped task.

    -
    registerOnceWorkerEventHandler: ((event, handler) => void)

    Registers once a worker event handler.

    -

    Type declaration

      • (event, handler): void
      • Registers once a worker event handler.

        -

        Parameters

        Returns void

    Param: event

    The event.

    -

    Param: handler

    The event handler.

    -
    registerWorkerEventHandler: ((event, handler) => void)

    Registers a worker event handler.

    -

    Type declaration

      • (event, handler): void
      • Registers a worker event handler.

        -

        Parameters

        Returns void

    Param: event

    The event.

    -

    Param: handler

    The event handler.

    -
    resetUsage: (() => void)

    Resets usage statistics.

    -

    Type declaration

      • (): void
      • Resets usage statistics.

        -

        Returns void

    strategyData?: StrategyData

    Worker choice strategy data. +IWorkerNode | poolifier - v3.1.21

    Interface IWorkerNode<Worker, Data>Internal

    Worker node interface.

    +
    interface IWorkerNode<Worker, Data> {
        clearTasksQueue: (() => void);
        deleteTaskFunctionWorkerUsage: ((name) => boolean);
        dequeueTask: (() => undefined | Task<Data>);
        enqueueTask: ((task) => number);
        getTaskFunctionWorkerUsage: ((name) => undefined | WorkerUsage);
        hasBackPressure: (() => boolean);
        info: WorkerInfo;
        messageChannel?: MessageChannel;
        popTask: (() => undefined | Task<Data>);
        registerOnceWorkerEventHandler: ((event, handler) => void);
        registerWorkerEventHandler: ((event, handler) => void);
        resetUsage: (() => void);
        strategyData?: StrategyData;
        tasksQueueBackPressureSize: number;
        tasksQueueSize: (() => number);
        terminate: (() => Promise<void>);
        unshiftTask: ((task) => number);
        usage: WorkerUsage;
        worker: Worker;
        [captureRejectionSymbol]?<K>(error, event, ...args): void;
        addListener<K>(eventName, listener): this;
        emit<K>(eventName, ...args): boolean;
        eventNames(): (string | symbol)[];
        getMaxListeners(): number;
        listenerCount<K>(eventName, listener?): number;
        listeners<K>(eventName): Function[];
        off<K>(eventName, listener): this;
        on<K>(eventName, listener): this;
        once<K>(eventName, listener): this;
        prependListener<K>(eventName, listener): this;
        prependOnceListener<K>(eventName, listener): this;
        rawListeners<K>(eventName): Function[];
        removeAllListeners(event?): this;
        removeListener<K>(eventName, listener): this;
        setMaxListeners(n): this;
    }

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +
    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      +

    Hierarchy

    • EventEmitter
      • IWorkerNode

    Properties

    clearTasksQueue: (() => void)

    Clears tasks queue.

    +

    Type declaration

      • (): void
      • Returns void

    deleteTaskFunctionWorkerUsage: ((name) => boolean)

    Deletes task function worker usage statistics.

    +

    Type declaration

      • (name): boolean
      • Parameters

        • name: string

          The task function name.

          +

        Returns boolean

    Returns

    true if the task function worker usage statistics were deleted, false otherwise.

    +
    dequeueTask: (() => undefined | Task<Data>)

    Dequeue task.

    +

    Type declaration

    Returns

    The dequeued task.

    +
    enqueueTask: ((task) => number)

    Enqueue task.

    +

    Type declaration

      • (task): number
      • Parameters

        Returns number

    Returns

    The tasks queue size.

    +
    getTaskFunctionWorkerUsage: ((name) => undefined | WorkerUsage)

    Gets task function worker usage statistics.

    +

    Type declaration

    Returns

    The task function worker usage statistics if the task function worker usage statistics are initialized, undefined otherwise.

    +
    hasBackPressure: (() => boolean)

    Whether the worker node has back pressure (i.e. its tasks queue is full).

    +

    Type declaration

      • (): boolean
      • Returns boolean

    Returns

    true if the worker node has back pressure, false otherwise.

    +

    Worker info.

    +
    messageChannel?: MessageChannel

    Message channel (worker thread only).

    +
    popTask: (() => undefined | Task<Data>)

    Pops a task from the tasks queue.

    +

    Type declaration

    Returns

    The popped task.

    +
    registerOnceWorkerEventHandler: ((event, handler) => void)

    Registers once a worker event handler.

    +

    Type declaration

      • (event, handler): void
      • Parameters

        Returns void

    registerWorkerEventHandler: ((event, handler) => void)

    Registers a worker event handler.

    +

    Type declaration

      • (event, handler): void
      • Parameters

        Returns void

    resetUsage: (() => void)

    Resets usage statistics.

    +

    Type declaration

      • (): void
      • Returns void

    strategyData?: StrategyData

    Worker choice strategy data. This is used to store data that are specific to the worker choice strategy.

    -
    tasksQueueBackPressureSize: number

    Tasks queue back pressure size. +

    tasksQueueBackPressureSize: number

    Tasks queue back pressure size. This is the number of tasks that can be enqueued before the worker node has back pressure.

    -
    tasksQueueSize: (() => number)

    Tasks queue size.

    -

    Type declaration

      • (): number
      • Tasks queue size.

        -

        Returns number

        The tasks queue size.

        -

    Returns

    The tasks queue size.

    -
    terminate: (() => Promise<void>)

    Terminates the worker node.

    -

    Type declaration

      • (): Promise<void>
      • Terminates the worker node.

        -

        Returns Promise<void>

    unshiftTask: ((task) => number)

    Prepends a task to the tasks queue.

    -

    Type declaration

      • (task): number
      • Prepends a task to the tasks queue.

        -

        Parameters

        Returns number

        The tasks queue size.

        -

    Param: task

    The task to prepend.

    -

    Returns

    The tasks queue size.

    -

    Worker usage statistics.

    -
    worker: Worker

    Worker.

    -

    Methods

    • Parameters

      • error: Error
      • event: string
      • Rest ...args: any[]

      Returns void

    • Alias for emitter.on(eventName, listener).

      -

      Parameters

      • eventName: string | symbol
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v0.1.26

      -
    • Synchronously calls each of the listeners registered for the event namedeventName, in the order they were registered, passing the supplied arguments +

    tasksQueueSize: (() => number)

    Tasks queue size.

    +

    Type declaration

      • (): number
      • Returns number

    Returns

    The tasks queue size.

    +
    terminate: (() => Promise<void>)

    Terminates the worker node.

    +

    Type declaration

      • (): Promise<void>
      • Returns Promise<void>

    unshiftTask: ((task) => number)

    Prepends a task to the tasks queue.

    +

    Type declaration

      • (task): number
      • Parameters

        Returns number

    Returns

    The tasks queue size.

    +

    Worker usage statistics.

    +
    worker: Worker

    Worker.

    +

    Methods

    • Type Parameters

      • K

      Parameters

      • error: Error
      • event: string | symbol
      • Rest ...args: AnyRest

      Returns void

    • Alias for emitter.on(eventName, listener).

      +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v0.1.26

      +
    • Synchronously calls each of the listeners registered for the event namedeventName, in the order they were registered, passing the supplied arguments to each.

      Returns true if the event had listeners, false otherwise.

      import { EventEmitter } from 'node:events';
      const myEmitter = new EventEmitter();

      // First listener
      myEmitter.on('event', function firstListener() {
      console.log('Helloooo! first listener');
      });
      // Second listener
      myEmitter.on('event', function secondListener(arg1, arg2) {
      console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
      });
      // Third listener
      myEmitter.on('event', function thirdListener(...args) {
      const parameters = args.join(', ');
      console.log(`event with parameters ${parameters} in third listener`);
      });

      console.log(myEmitter.listeners('event'));

      myEmitter.emit('event', 1, 2, 3, 4, 5);

      // Prints:
      // [
      // [Function: firstListener],
      // [Function: secondListener],
      // [Function: thirdListener]
      // ]
      // Helloooo! first listener
      // event with parameters 1, 2 in second listener
      // event with parameters 1, 2, 3, 4, 5 in third listener
      -

      Parameters

      • eventName: string | symbol
      • Rest ...args: any[]

      Returns boolean

      Since

      v0.1.26

      -
    • Returns an array listing the events for which the emitter has registered +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • Rest ...args: AnyRest

      Returns boolean

      Since

      v0.1.26

      +
    • Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

      import { EventEmitter } from 'node:events';

      const myEE = new EventEmitter();
      myEE.on('foo', () => {});
      myEE.on('bar', () => {});

      const sym = Symbol('symbol');
      myEE.on(sym, () => {});

      console.log(myEE.eventNames());
      // Prints: [ 'foo', 'bar', Symbol(symbol) ]

      Returns (string | symbol)[]

      Since

      v6.0.0

      -
    • Returns the current max listener value for the EventEmitter which is either +

    • Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to defaultMaxListeners.

      Returns number

      Since

      v1.0.0

      -
    • Returns the number of listeners listening for the event named eventName. +

    • Returns the number of listeners listening for the event named eventName. If listener is provided, it will return how many times the listener is found in the list of the listeners of the event.

      -

      Parameters

      • eventName: string | symbol

        The name of the event being listened for

        -
      • Optional listener: Function

        The event handler function

        +

        Type Parameters

        • K

        Parameters

        • eventName: string | symbol

          The name of the event being listened for

          +
        • Optional listener: Function

          The event handler function

        Returns number

        Since

        v3.2.0

        -
    • Returns a copy of the array of listeners for the event named eventName.

      +
    • Returns a copy of the array of listeners for the event named eventName.

      server.on('connection', (stream) => {
      console.log('someone connected!');
      });
      console.log(util.inspect(server.listeners('connection')));
      // Prints: [ [Function] ]
      -

      Parameters

      • eventName: string | symbol

      Returns Function[]

      Since

      v0.1.26

      -
    • Alias for emitter.removeListener().

      -

      Parameters

      • eventName: string | symbol
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v10.0.0

      -
    • Adds the listener function to the end of the listeners array for the +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

      Returns Function[]

      Since

      v0.1.26

      +
    • Alias for emitter.removeListener().

      +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v10.0.0

      +
    • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventNameand listener will result in the listener being added, and called, multiple times.

      @@ -141,10 +112,10 @@ times.

      event listener to the beginning of the listeners array.

      import { EventEmitter } from 'node:events';
      const myEE = new EventEmitter();
      myEE.on('foo', () => console.log('a'));
      myEE.prependListener('foo', () => console.log('b'));
      myEE.emit('foo');
      // Prints:
      // b
      // a
      -

      Parameters

      • eventName: string | symbol

        The name of the event.

        -
      • listener: ((...args) => void)

        The callback function

        -
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v0.1.101

      -
    • Adds a one-timelistener function for the event named eventName. The +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event.

        +
      • listener: ((...args) => void)

        The callback function

        +
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v0.1.101

      +
    • Adds a one-timelistener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

      server.once('connection', (stream) => {
      console.log('Ah, we have our first user!');
      });
      @@ -153,39 +124,39 @@ next time eventName is triggered, this listener is removed and then event listener to the beginning of the listeners array.

      import { EventEmitter } from 'node:events';
      const myEE = new EventEmitter();
      myEE.once('foo', () => console.log('a'));
      myEE.prependOnceListener('foo', () => console.log('b'));
      myEE.emit('foo');
      // Prints:
      // b
      // a
      -

      Parameters

      • eventName: string | symbol

        The name of the event.

        -
      • listener: ((...args) => void)

        The callback function

        -
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v0.3.0

      -
    • Adds the listener function to the beginning of the listeners array for the +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event.

        +
      • listener: ((...args) => void)

        The callback function

        +
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v0.3.0

      +
    • Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventNameand listener will result in the listener being added, and called, multiple times.

      server.prependListener('connection', (stream) => {
      console.log('someone connected!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      -

      Parameters

      • eventName: string | symbol

        The name of the event.

        -
      • listener: ((...args) => void)

        The callback function

        -
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v6.0.0

      -
    • Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event.

        +
      • listener: ((...args) => void)

        The callback function

        +
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v6.0.0

      +
    • Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

      server.prependOnceListener('connection', (stream) => {
      console.log('Ah, we have our first user!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      -

      Parameters

      • eventName: string | symbol

        The name of the event.

        -
      • listener: ((...args) => void)

        The callback function

        -
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v6.0.0

      -
    • Returns a copy of the array of listeners for the event named eventName, +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event.

        +
      • listener: ((...args) => void)

        The callback function

        +
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v6.0.0

      +
    • Returns a copy of the array of listeners for the event named eventName, including any wrappers (such as those created by .once()).

      import { EventEmitter } from 'node:events';
      const emitter = new EventEmitter();
      emitter.once('log', () => console.log('log once'));

      // Returns a new Array with a function `onceWrapper` which has a property
      // `listener` which contains the original listener bound above
      const listeners = emitter.rawListeners('log');
      const logFnWrapper = listeners[0];

      // Logs "log once" to the console and does not unbind the `once` event
      logFnWrapper.listener();

      // Logs "log once" to the console and removes the listener
      logFnWrapper();

      emitter.on('log', () => console.log('log persistently'));
      // Will return a new Array with a single function bound by `.on()` above
      const newListeners = emitter.rawListeners('log');

      // Logs "log persistently" twice
      newListeners[0]();
      emitter.emit('log');
      -

      Parameters

      • eventName: string | symbol

      Returns Function[]

      Since

      v9.4.0

      -
    • Removes all listeners, or those of the specified eventName.

      +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

      Returns Function[]

      Since

      v9.4.0

      +
    • Removes all listeners, or those of the specified eventName.

      It is bad practice to remove listeners added elsewhere in the code, particularly when the EventEmitter instance was created by some other component or module (e.g. sockets or file streams).

      Returns a reference to the EventEmitter, so that calls can be chained.

      -

      Parameters

      • Optional event: string | symbol

      Returns this

      Since

      v0.1.26

      -
    • Removes the specified listener from the listener array for the event namedeventName.

      +

      Parameters

      • Optional event: string | symbol

      Returns this

      Since

      v0.1.26

      +
    • Removes the specified listener from the listener array for the event namedeventName.

      const callback = (stream) => {
      console.log('someone connected!');
      };
      server.on('connection', callback);
      // ...
      server.removeListener('connection', callback);

      removeListener() will remove, at most, one instance of a listener from the @@ -208,11 +179,11 @@ recently added instance. In the example the once('ping')lis

      import { EventEmitter } from 'node:events';
      const ee = new EventEmitter();

      function pong() {
      console.log('pong');
      }

      ee.on('ping', pong);
      ee.once('ping', pong);
      ee.removeListener('ping', pong);

      ee.emit('ping');
      ee.emit('ping');

      Returns a reference to the EventEmitter, so that calls can be chained.

      -

      Parameters

      • eventName: string | symbol
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v0.1.26

      -
    • By default EventEmitters will print a warning if more than 10 listeners are +

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • listener: ((...args) => void)
          • (...args): void
          • Parameters

            • Rest ...args: any[]

            Returns void

      Returns this

      Since

      v0.1.26

      +
    • By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set toInfinity (or 0) to indicate an unlimited number of listeners.

      Returns a reference to the EventEmitter, so that calls can be chained.

      -

      Parameters

      • n: number

      Returns this

      Since

      v0.3.5

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Parameters

    • n: number

    Returns this

    Since

    v0.3.5

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/MeasurementOptions.html b/docs/interfaces/MeasurementOptions.html index 0bb3a907..7ce15033 100644 --- a/docs/interfaces/MeasurementOptions.html +++ b/docs/interfaces/MeasurementOptions.html @@ -1,4 +1,4 @@ -MeasurementOptions | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +MeasurementOptions | poolifier - v3.1.21

    Interface MeasurementOptions

    Measurement options.

    +
    interface MeasurementOptions {
        median: boolean;
    }

    Properties

    Properties

    median: boolean

    Set measurement median.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/MeasurementStatistics.html b/docs/interfaces/MeasurementStatistics.html index b1e9d5d2..0e7c96b8 100644 --- a/docs/interfaces/MeasurementStatistics.html +++ b/docs/interfaces/MeasurementStatistics.html @@ -1,14 +1,14 @@ -MeasurementStatistics | poolifier - v3.1.21

    Interface MeasurementStatisticsInternal

    Measurement statistics.

    -
    interface MeasurementStatistics {
        aggregate?: number;
        average?: number;
        history: CircularArray<number>;
        maximum?: number;
        median?: number;
        minimum?: number;
    }

    Properties

    aggregate?: number

    Measurement aggregate.

    -
    average?: number

    Measurement average.

    -
    history: CircularArray<number>

    Measurement history.

    -
    maximum?: number

    Measurement maximum.

    -
    median?: number

    Measurement median.

    -
    minimum?: number

    Measurement minimum.

    -

    Generated using TypeDoc

    \ No newline at end of file +MeasurementStatistics | poolifier - v3.1.21

    Interface MeasurementStatisticsInternal

    Measurement statistics.

    +
    interface MeasurementStatistics {
        aggregate?: number;
        average?: number;
        history: CircularArray<number>;
        maximum?: number;
        median?: number;
        minimum?: number;
    }

    Properties

    aggregate?: number

    Measurement aggregate.

    +
    average?: number

    Measurement average.

    +
    history: CircularArray<number>

    Measurement history.

    +
    maximum?: number

    Measurement maximum.

    +
    median?: number

    Measurement median.

    +
    minimum?: number

    Measurement minimum.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/MeasurementStatisticsRequirements.html b/docs/interfaces/MeasurementStatisticsRequirements.html index 566567be..e312b77e 100644 --- a/docs/interfaces/MeasurementStatisticsRequirements.html +++ b/docs/interfaces/MeasurementStatisticsRequirements.html @@ -1,8 +1,8 @@ -MeasurementStatisticsRequirements | poolifier - v3.1.21

    Interface MeasurementStatisticsRequirementsInternal

    Measurement statistics requirements.

    -
    interface MeasurementStatisticsRequirements {
        aggregate: boolean;
        average: boolean;
        median: boolean;
    }

    Properties

    Properties

    aggregate: boolean

    Requires measurement aggregate.

    -
    average: boolean

    Requires measurement average.

    -
    median: boolean

    Requires measurement median.

    -

    Generated using TypeDoc

    \ No newline at end of file +MeasurementStatisticsRequirements | poolifier - v3.1.21

    Interface MeasurementStatisticsRequirementsInternal

    Measurement statistics requirements.

    +
    interface MeasurementStatisticsRequirements {
        aggregate: boolean;
        average: boolean;
        median: boolean;
    }

    Properties

    Properties

    aggregate: boolean

    Requires measurement aggregate.

    +
    average: boolean

    Requires measurement average.

    +
    median: boolean

    Requires measurement median.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/MessageValue.html b/docs/interfaces/MessageValue.html index 81eafa67..42d7ac7c 100644 --- a/docs/interfaces/MessageValue.html +++ b/docs/interfaces/MessageValue.html @@ -1,45 +1,45 @@ -MessageValue | poolifier - v3.1.21

    Interface MessageValue<Data, ErrorData>Internal

    Message object that is passed between main worker and worker.

    -
    interface MessageValue<Data, ErrorData> {
        checkActive?: boolean;
        data?: Data;
        kill?: true | "success" | "SOFT" | "HARD" | "failure";
        name?: string;
        port?: MessagePort;
        ready?: boolean;
        statistics?: WorkerStatistics;
        taskFunction?: string;
        taskFunctionName?: string;
        taskFunctionNames?: string[];
        taskFunctionOperation?: "add" | "default" | "remove";
        taskFunctionOperationStatus?: boolean;
        taskId?: string;
        taskPerformance?: TaskPerformance;
        timestamp?: number;
        transferList?: TransferListItem[];
        workerError?: WorkerError<ErrorData>;
        workerId?: number;
    }

    Type Parameters

    • Data = unknown

      Type of data sent to the worker or execution response. This can only be structured-cloneable data.

      -
    • ErrorData = unknown

      Type of data sent to the worker triggering an error. This can only be structured-cloneable data.

      -

    Hierarchy (view full)

    Properties

    checkActive?: boolean

    Whether the worker starts or stops its activity check.

    -
    data?: Data

    Task input data that will be passed to the worker.

    -
    kill?: true | "success" | "SOFT" | "HARD" | "failure"

    Kill code.

    -
    name?: string

    Task name.

    -
    port?: MessagePort

    Message port.

    -
    ready?: boolean

    Whether the worker is ready or not.

    -
    statistics?: WorkerStatistics

    Whether the worker computes the given statistics or not.

    -
    taskFunction?: string

    Task function serialized to string.

    -
    taskFunctionName?: string

    Task function name.

    -
    taskFunctionNames?: string[]

    Task function names.

    -
    taskFunctionOperation?: "add" | "default" | "remove"

    Task function operation:

    +MessageValue | poolifier - v3.1.21

    Interface MessageValue<Data, ErrorData>Internal

    Message object that is passed between main worker and worker.

    +
    interface MessageValue<Data, ErrorData> {
        checkActive?: boolean;
        data?: Data;
        kill?: true | "success" | "SOFT" | "HARD" | "failure";
        name?: string;
        port?: MessagePort;
        ready?: boolean;
        statistics?: WorkerStatistics;
        taskFunction?: string;
        taskFunctionName?: string;
        taskFunctionNames?: string[];
        taskFunctionOperation?: "add" | "default" | "remove";
        taskFunctionOperationStatus?: boolean;
        taskId?: string;
        taskPerformance?: TaskPerformance;
        timestamp?: number;
        transferList?: TransferListItem[];
        workerError?: WorkerError<ErrorData>;
        workerId?: number;
    }

    Type Parameters

    • Data = unknown

      Type of data sent to the worker or execution response. This can only be structured-cloneable data.

      +
    • ErrorData = unknown

      Type of data sent to the worker triggering an error. This can only be structured-cloneable data.

      +

    Hierarchy (view full)

    Properties

    checkActive?: boolean

    Whether the worker starts or stops its activity check.

    +
    data?: Data

    Task input data that will be passed to the worker.

    +
    kill?: true | "success" | "SOFT" | "HARD" | "failure"

    Kill code.

    +
    name?: string

    Task name.

    +
    port?: MessagePort

    Message port.

    +
    ready?: boolean

    Whether the worker is ready or not.

    +
    statistics?: WorkerStatistics

    Whether the worker computes the given statistics or not.

    +
    taskFunction?: string

    Task function serialized to string.

    +
    taskFunctionName?: string

    Task function name.

    +
    taskFunctionNames?: string[]

    Task function names.

    +
    taskFunctionOperation?: "add" | "default" | "remove"

    Task function operation:

    • 'add' - Add a task function.
    • 'remove' - Remove a task function.
    • 'default' - Set a task function as default.
    -
    taskFunctionOperationStatus?: boolean

    Whether the task function operation is successful or not.

    -
    taskId?: string

    Task UUID.

    -
    taskPerformance?: TaskPerformance

    Task performance.

    -
    timestamp?: number

    Timestamp.

    -
    transferList?: TransferListItem[]

    Array of transferable objects.

    -
    workerError?: WorkerError<ErrorData>

    Worker error.

    -
    workerId?: number

    Worker id.

    -

    Generated using TypeDoc

    \ No newline at end of file +
    taskFunctionOperationStatus?: boolean

    Whether the task function operation is successful or not.

    +
    taskId?: string

    Task UUID.

    +
    taskPerformance?: TaskPerformance

    Task performance.

    +
    timestamp?: number

    Timestamp.

    +
    transferList?: TransferListItem[]

    Array of transferable objects.

    +
    workerError?: WorkerError<ErrorData>

    Worker error.

    +
    workerId?: number

    Worker id.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/PoolInfo.html b/docs/interfaces/PoolInfo.html index 77713a1b..f1d2c78a 100644 --- a/docs/interfaces/PoolInfo.html +++ b/docs/interfaces/PoolInfo.html @@ -1,30 +1,30 @@ -PoolInfo | poolifier - v3.1.21

    Interface PoolInfo

    Pool information.

    -
    interface PoolInfo {
        backPressure?: boolean;
        busyWorkerNodes: number;
        executedTasks: number;
        executingTasks: number;
        failedTasks: number;
        idleWorkerNodes: number;
        maxQueuedTasks?: number;
        maxSize: number;
        minSize: number;
        queuedTasks?: number;
        ready: boolean;
        runTime?: {
            average?: number;
            maximum: number;
            median?: number;
            minimum: number;
        };
        started: boolean;
        stealingWorkerNodes?: number;
        stolenTasks?: number;
        strategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN";
        strategyRetries: number;
        type: "fixed" | "dynamic";
        utilization?: number;
        version: string;
        waitTime?: {
            average?: number;
            maximum: number;
            median?: number;
            minimum: number;
        };
        worker: "thread" | "cluster";
        workerNodes: number;
    }

    Properties

    backPressure?: boolean
    busyWorkerNodes: number

    Pool busy worker nodes.

    -
    executedTasks: number
    executingTasks: number
    failedTasks: number
    idleWorkerNodes: number

    Pool idle worker nodes.

    -
    maxQueuedTasks?: number
    maxSize: number
    minSize: number
    queuedTasks?: number
    ready: boolean
    runTime?: {
        average?: number;
        maximum: number;
        median?: number;
        minimum: number;
    }

    Type declaration

    • Optional Readonly average?: number
    • Readonly maximum: number
    • Optional Readonly median?: number
    • Readonly minimum: number
    started: boolean
    stealingWorkerNodes?: number

    Pool stealing worker nodes.

    -
    stolenTasks?: number
    strategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
    strategyRetries: number
    type: "fixed" | "dynamic"
    utilization?: number

    Pool utilization.

    -
    version: string
    waitTime?: {
        average?: number;
        maximum: number;
        median?: number;
        minimum: number;
    }

    Type declaration

    • Optional Readonly average?: number
    • Readonly maximum: number
    • Optional Readonly median?: number
    • Readonly minimum: number
    worker: "thread" | "cluster"
    workerNodes: number

    Pool total worker nodes.

    -

    Generated using TypeDoc

    \ No newline at end of file +PoolInfo | poolifier - v3.1.21

    Interface PoolInfo

    Pool information.

    +
    interface PoolInfo {
        backPressure?: boolean;
        busyWorkerNodes: number;
        executedTasks: number;
        executingTasks: number;
        failedTasks: number;
        idleWorkerNodes: number;
        maxQueuedTasks?: number;
        maxSize: number;
        minSize: number;
        queuedTasks?: number;
        ready: boolean;
        runTime?: {
            average?: number;
            maximum: number;
            median?: number;
            minimum: number;
        };
        started: boolean;
        stealingWorkerNodes?: number;
        stolenTasks?: number;
        strategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN";
        strategyRetries: number;
        type: "fixed" | "dynamic";
        utilization?: number;
        version: string;
        waitTime?: {
            average?: number;
            maximum: number;
            median?: number;
            minimum: number;
        };
        worker: "thread" | "cluster";
        workerNodes: number;
    }

    Properties

    backPressure?: boolean
    busyWorkerNodes: number

    Pool busy worker nodes.

    +
    executedTasks: number
    executingTasks: number
    failedTasks: number
    idleWorkerNodes: number

    Pool idle worker nodes.

    +
    maxQueuedTasks?: number
    maxSize: number
    minSize: number
    queuedTasks?: number
    ready: boolean
    runTime?: {
        average?: number;
        maximum: number;
        median?: number;
        minimum: number;
    }

    Type declaration

    • Optional Readonly average?: number
    • Readonly maximum: number
    • Optional Readonly median?: number
    • Readonly minimum: number
    started: boolean
    stealingWorkerNodes?: number

    Pool stealing worker nodes.

    +
    stolenTasks?: number
    strategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
    strategyRetries: number
    type: "fixed" | "dynamic"
    utilization?: number

    Pool utilization.

    +
    version: string
    waitTime?: {
        average?: number;
        maximum: number;
        median?: number;
        minimum: number;
    }

    Type declaration

    • Optional Readonly average?: number
    • Readonly maximum: number
    • Optional Readonly median?: number
    • Readonly minimum: number
    worker: "thread" | "cluster"
    workerNodes: number

    Pool total worker nodes.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/PoolOptions.html b/docs/interfaces/PoolOptions.html index db2f1086..ab1d70f4 100644 --- a/docs/interfaces/PoolOptions.html +++ b/docs/interfaces/PoolOptions.html @@ -1,46 +1,46 @@ -PoolOptions | poolifier - v3.1.21

    Interface PoolOptions<Worker>

    Options for a poolifier pool.

    -
    interface PoolOptions<Worker> {
        enableEvents?: boolean;
        enableTasksQueue?: boolean;
        env?: Record<string, unknown>;
        errorHandler?: ErrorHandler<Worker>;
        exitHandler?: ExitHandler<Worker>;
        messageHandler?: MessageHandler<Worker>;
        onlineHandler?: OnlineHandler<Worker>;
        restartWorkerOnError?: boolean;
        settings?: ClusterSettings;
        startWorkers?: boolean;
        tasksQueueOptions?: TasksQueueOptions;
        workerChoiceStrategy?: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN";
        workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions;
        workerOptions?: WorkerOptions;
    }

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      -

    Properties

    enableEvents?: boolean

    Pool events integrated with async resource emission.

    +PoolOptions | poolifier - v3.1.21

    Interface PoolOptions<Worker>

    Options for a poolifier pool.

    +
    interface PoolOptions<Worker> {
        enableEvents?: boolean;
        enableTasksQueue?: boolean;
        env?: Record<string, unknown>;
        errorHandler?: ErrorHandler<Worker>;
        exitHandler?: ExitHandler<Worker>;
        messageHandler?: MessageHandler<Worker>;
        onlineHandler?: OnlineHandler<Worker>;
        restartWorkerOnError?: boolean;
        settings?: ClusterSettings;
        startWorkers?: boolean;
        tasksQueueOptions?: TasksQueueOptions;
        workerChoiceStrategy?: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN";
        workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions;
        workerOptions?: WorkerOptions;
    }

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +

    Properties

    enableEvents?: boolean

    Pool events integrated with async resource emission.

    Default Value

    true
     
    -
    enableTasksQueue?: boolean

    Pool worker node tasks queue.

    +
    enableTasksQueue?: boolean

    Pool worker node tasks queue.

    Default Value

    false
     
    -
    env?: Record<string, unknown>

    Key/value pairs to add to worker process environment.

    +
    env?: Record<string, unknown>

    Key/value pairs to add to worker process environment.

    errorHandler?: ErrorHandler<Worker>

    A function that will listen for error event on each worker.

    +
    errorHandler?: ErrorHandler<Worker>

    A function that will listen for error event on each worker.

    Default Value

    () => {}

    -
    exitHandler?: ExitHandler<Worker>

    A function that will listen for exit event on each worker.

    +
    exitHandler?: ExitHandler<Worker>

    A function that will listen for exit event on each worker.

    Default Value

    () => {}

    -
    messageHandler?: MessageHandler<Worker>

    A function that will listen for message event on each worker.

    +
    messageHandler?: MessageHandler<Worker>

    A function that will listen for message event on each worker.

    Default Value

    () => {}

    -
    onlineHandler?: OnlineHandler<Worker>

    A function that will listen for online event on each worker.

    +
    onlineHandler?: OnlineHandler<Worker>

    A function that will listen for online event on each worker.

    Default Value

    () => {}

    -
    restartWorkerOnError?: boolean

    Restart worker on error.

    -
    settings?: ClusterSettings

    Cluster settings.

    +
    restartWorkerOnError?: boolean

    Restart worker on error.

    +
    settings?: ClusterSettings

    Cluster settings.

    startWorkers?: boolean

    Whether to start the minimum number of workers at pool initialization.

    +
    startWorkers?: boolean

    Whether to start the minimum number of workers at pool initialization.

    Default Value

    true
     
    -
    tasksQueueOptions?: TasksQueueOptions

    Pool worker node tasks queue options.

    -
    workerChoiceStrategy?: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

    The worker choice strategy to use in this pool.

    +
    tasksQueueOptions?: TasksQueueOptions

    Pool worker node tasks queue options.

    +
    workerChoiceStrategy?: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

    The worker choice strategy to use in this pool.

    Default Value

    WorkerChoiceStrategies.ROUND_ROBIN
     
    -
    workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions

    The worker choice strategy options.

    -
    workerOptions?: WorkerOptions

    Worker options.

    +
    workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions

    The worker choice strategy options.

    +
    workerOptions?: WorkerOptions

    Worker options.

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/PromiseResponseWrapper.html b/docs/interfaces/PromiseResponseWrapper.html index c78d21b7..609d4538 100644 --- a/docs/interfaces/PromiseResponseWrapper.html +++ b/docs/interfaces/PromiseResponseWrapper.html @@ -1,13 +1,11 @@ -PromiseResponseWrapper | poolifier - v3.1.21

    Interface PromiseResponseWrapper<Response>Internal

    An object holding the task execution response promise resolve/reject callbacks.

    -
    interface PromiseResponseWrapper<Response> {
        asyncResource?: AsyncResource;
        reject: ((reason?) => void);
        resolve: ((value) => void);
        workerNodeKey: number;
    }

    Type Parameters

    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      -

    Properties

    asyncResource?: AsyncResource

    The asynchronous resource used to track the task execution.

    -
    reject: ((reason?) => void)

    Reject callback to reject the promise.

    -

    Type declaration

      • (reason?): void
      • Reject callback to reject the promise.

        -

        Parameters

        • Optional reason: unknown

        Returns void

    resolve: ((value) => void)

    Resolve callback to fulfill the promise.

    -

    Type declaration

      • (value): void
      • Resolve callback to fulfill the promise.

        -

        Parameters

        Returns void

    workerNodeKey: number

    The worker node key executing the task.

    -

    Generated using TypeDoc

    \ No newline at end of file +PromiseResponseWrapper | poolifier - v3.1.21

    Interface PromiseResponseWrapper<Response>Internal

    An object holding the task execution response promise resolve/reject callbacks.

    +
    interface PromiseResponseWrapper<Response> {
        asyncResource?: AsyncResource;
        reject: ((reason?) => void);
        resolve: ((value) => void);
        workerNodeKey: number;
    }

    Type Parameters

    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      +

    Properties

    asyncResource?: AsyncResource

    The asynchronous resource used to track the task execution.

    +
    reject: ((reason?) => void)

    Reject callback to reject the promise.

    +

    Type declaration

      • (reason?): void
      • Parameters

        • Optional reason: unknown

        Returns void

    resolve: ((value) => void)

    Resolve callback to fulfill the promise.

    +

    Type declaration

    workerNodeKey: number

    The worker node key executing the task.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/StrategyData.html b/docs/interfaces/StrategyData.html index e4bd13b4..5e0615e9 100644 --- a/docs/interfaces/StrategyData.html +++ b/docs/interfaces/StrategyData.html @@ -1,3 +1,3 @@ -StrategyData | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +StrategyData | poolifier - v3.1.21

    Interface StrategyDataInternal

    Worker choice strategy data.

    +
    interface StrategyData {
        virtualTaskEndTimestamp?: number;
    }

    Properties

    virtualTaskEndTimestamp?: number

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/StrategyPolicy.html b/docs/interfaces/StrategyPolicy.html index 98f9fadf..4e13fe1a 100644 --- a/docs/interfaces/StrategyPolicy.html +++ b/docs/interfaces/StrategyPolicy.html @@ -1,6 +1,6 @@ -StrategyPolicy | poolifier - v3.1.21

    Interface StrategyPolicyInternal

    Strategy policy.

    -
    interface StrategyPolicy {
        dynamicWorkerReady: boolean;
        dynamicWorkerUsage: boolean;
    }

    Properties

    dynamicWorkerReady: boolean

    Expects the newly created dynamic worker to be flagged as ready.

    -
    dynamicWorkerUsage: boolean

    Expects tasks execution on the newly created dynamic worker.

    -

    Generated using TypeDoc

    \ No newline at end of file +StrategyPolicy | poolifier - v3.1.21

    Interface StrategyPolicyInternal

    Strategy policy.

    +
    interface StrategyPolicy {
        dynamicWorkerReady: boolean;
        dynamicWorkerUsage: boolean;
    }

    Properties

    dynamicWorkerReady: boolean

    Expects the newly created dynamic worker to be flagged as ready.

    +
    dynamicWorkerUsage: boolean

    Expects tasks execution on the newly created dynamic worker.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/Task.html b/docs/interfaces/Task.html index 5da3b49a..204a7b8b 100644 --- a/docs/interfaces/Task.html +++ b/docs/interfaces/Task.html @@ -1,13 +1,13 @@ -Task | poolifier - v3.1.21

    Interface Task<Data>Internal

    Message object that is passed as a task between main worker and worker.

    -
    interface Task<Data> {
        data?: Data;
        name?: string;
        taskId?: string;
        timestamp?: number;
        transferList?: TransferListItem[];
    }

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      -

    Hierarchy (view full)

    Properties

    data?: Data

    Task input data that will be passed to the worker.

    -
    name?: string

    Task name.

    -
    taskId?: string

    Task UUID.

    -
    timestamp?: number

    Timestamp.

    -
    transferList?: TransferListItem[]

    Array of transferable objects.

    -

    Generated using TypeDoc

    \ No newline at end of file +Task | poolifier - v3.1.21

    Interface Task<Data>Internal

    Message object that is passed as a task between main worker and worker.

    +
    interface Task<Data> {
        data?: Data;
        name?: string;
        taskId?: string;
        timestamp?: number;
        transferList?: TransferListItem[];
    }

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      +

    Hierarchy (view full)

    Properties

    data?: Data

    Task input data that will be passed to the worker.

    +
    name?: string

    Task name.

    +
    taskId?: string

    Task UUID.

    +
    timestamp?: number

    Timestamp.

    +
    transferList?: TransferListItem[]

    Array of transferable objects.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/TaskFunctionOperationResult.html b/docs/interfaces/TaskFunctionOperationResult.html index d7a0830c..f73f7567 100644 --- a/docs/interfaces/TaskFunctionOperationResult.html +++ b/docs/interfaces/TaskFunctionOperationResult.html @@ -1,4 +1,4 @@ -TaskFunctionOperationResult | poolifier - v3.1.21

    Interface TaskFunctionOperationResult

    Task function operation result.

    -
    interface TaskFunctionOperationResult {
        error?: Error;
        status: boolean;
    }

    Properties

    Properties

    error?: Error
    status: boolean

    Generated using TypeDoc

    \ No newline at end of file +TaskFunctionOperationResult | poolifier - v3.1.21

    Interface TaskFunctionOperationResult

    Task function operation result.

    +
    interface TaskFunctionOperationResult {
        error?: Error;
        status: boolean;
    }

    Properties

    Properties

    error?: Error
    status: boolean

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/TaskPerformance.html b/docs/interfaces/TaskPerformance.html index d6d208ac..8c4ddef1 100644 --- a/docs/interfaces/TaskPerformance.html +++ b/docs/interfaces/TaskPerformance.html @@ -1,10 +1,10 @@ -TaskPerformance | poolifier - v3.1.21

    Interface TaskPerformanceInternal

    Task performance.

    -
    interface TaskPerformance {
        elu?: EventLoopUtilization;
        name: string;
        runTime?: number;
        timestamp: number;
    }

    Properties

    Properties

    elu?: EventLoopUtilization

    Task event loop utilization.

    -
    name: string

    Task name.

    -
    runTime?: number

    Task runtime.

    -
    timestamp: number

    Task performance timestamp.

    -

    Generated using TypeDoc

    \ No newline at end of file +TaskPerformance | poolifier - v3.1.21

    Interface TaskPerformanceInternal

    Task performance.

    +
    interface TaskPerformance {
        elu?: EventLoopUtilization;
        name: string;
        runTime?: number;
        timestamp: number;
    }

    Properties

    Properties

    elu?: EventLoopUtilization

    Task event loop utilization.

    +
    name: string

    Task name.

    +
    runTime?: number

    Task runtime.

    +
    timestamp: number

    Task performance timestamp.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/TaskStatistics.html b/docs/interfaces/TaskStatistics.html index 23d7c4df..b46420b6 100644 --- a/docs/interfaces/TaskStatistics.html +++ b/docs/interfaces/TaskStatistics.html @@ -1,16 +1,16 @@ -TaskStatistics | poolifier - v3.1.21

    Interface TaskStatisticsInternal

    Task statistics.

    -
    interface TaskStatistics {
        executed: number;
        executing: number;
        failed: number;
        maxQueued?: number;
        queued: number;
        sequentiallyStolen: number;
        stolen: number;
    }

    Properties

    executed: number

    Number of executed tasks.

    -
    executing: number

    Number of executing tasks.

    -
    failed: number

    Number of failed tasks.

    -
    maxQueued?: number

    Maximum number of queued tasks.

    -
    queued: number

    Number of queued tasks.

    -
    sequentiallyStolen: number

    Number of sequentially stolen tasks.

    -
    stolen: number

    Number of stolen tasks.

    -

    Generated using TypeDoc

    \ No newline at end of file +TaskStatistics | poolifier - v3.1.21

    Interface TaskStatisticsInternal

    Task statistics.

    +
    interface TaskStatistics {
        executed: number;
        executing: number;
        failed: number;
        maxQueued?: number;
        queued: number;
        sequentiallyStolen: number;
        stolen: number;
    }

    Properties

    executed: number

    Number of executed tasks.

    +
    executing: number

    Number of executing tasks.

    +
    failed: number

    Number of failed tasks.

    +
    maxQueued?: number

    Maximum number of queued tasks.

    +
    queued: number

    Number of queued tasks.

    +
    sequentiallyStolen: number

    Number of sequentially stolen tasks.

    +
    stolen: number

    Number of stolen tasks.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/TaskStatisticsRequirements.html b/docs/interfaces/TaskStatisticsRequirements.html index fd5b409d..e99b4dd9 100644 --- a/docs/interfaces/TaskStatisticsRequirements.html +++ b/docs/interfaces/TaskStatisticsRequirements.html @@ -1,8 +1,8 @@ -TaskStatisticsRequirements | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +TaskStatisticsRequirements | poolifier - v3.1.21

    Interface TaskStatisticsRequirementsInternal

    Pool worker node worker usage statistics requirements.

    +
    interface TaskStatisticsRequirements {
        elu: MeasurementStatisticsRequirements;
        runTime: MeasurementStatisticsRequirements;
        waitTime: MeasurementStatisticsRequirements;
    }

    Properties

    Properties

    Tasks event loop utilization requirements.

    +

    Tasks runtime requirements.

    +

    Tasks wait time requirements.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/TasksQueueOptions.html b/docs/interfaces/TasksQueueOptions.html index 277fa62d..791cfdc8 100644 --- a/docs/interfaces/TasksQueueOptions.html +++ b/docs/interfaces/TasksQueueOptions.html @@ -1,22 +1,22 @@ -TasksQueueOptions | poolifier - v3.1.21

    Interface TasksQueueOptions

    Worker node tasks queue options.

    -
    interface TasksQueueOptions {
        concurrency?: number;
        size?: number;
        taskStealing?: boolean;
        tasksFinishedTimeout?: number;
        tasksStealingOnBackPressure?: boolean;
    }

    Properties

    concurrency?: number

    Maximum number of tasks that can be executed concurrently on a worker node.

    +TasksQueueOptions | poolifier - v3.1.21

    Interface TasksQueueOptions

    Worker node tasks queue options.

    +
    interface TasksQueueOptions {
        concurrency?: number;
        size?: number;
        taskStealing?: boolean;
        tasksFinishedTimeout?: number;
        tasksStealingOnBackPressure?: boolean;
    }

    Properties

    concurrency?: number

    Maximum number of tasks that can be executed concurrently on a worker node.

    Default Value

    1
     
    -
    size?: number

    Maximum tasks queue size per worker node flagging it as back pressured.

    +
    size?: number

    Maximum tasks queue size per worker node flagging it as back pressured.

    Default Value

    (pool maximum size)^2
     
    -
    taskStealing?: boolean

    Whether to enable task stealing on idle.

    +
    taskStealing?: boolean

    Whether to enable task stealing on idle.

    Default Value

    true
     
    -
    tasksFinishedTimeout?: number

    Queued tasks finished timeout in milliseconds at worker node termination.

    +
    tasksFinishedTimeout?: number

    Queued tasks finished timeout in milliseconds at worker node termination.

    Default Value

    2000
     
    -
    tasksStealingOnBackPressure?: boolean

    Whether to enable tasks stealing under back pressure.

    +
    tasksStealingOnBackPressure?: boolean

    Whether to enable tasks stealing under back pressure.

    Default Value

    true
     
    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerChoiceStrategyOptions.html b/docs/interfaces/WorkerChoiceStrategyOptions.html index d65c7acc..341e208f 100644 --- a/docs/interfaces/WorkerChoiceStrategyOptions.html +++ b/docs/interfaces/WorkerChoiceStrategyOptions.html @@ -1,21 +1,21 @@ -WorkerChoiceStrategyOptions | poolifier - v3.1.21

    Interface WorkerChoiceStrategyOptions

    Worker choice strategy options.

    -
    interface WorkerChoiceStrategyOptions {
        elu?: MeasurementOptions;
        measurement?: "runTime" | "waitTime" | "elu";
        runTime?: MeasurementOptions;
        waitTime?: MeasurementOptions;
        weights?: Record<number, number>;
    }

    Properties

    Event loop utilization options.

    +WorkerChoiceStrategyOptions | poolifier - v3.1.21

    Interface WorkerChoiceStrategyOptions

    Worker choice strategy options.

    +
    interface WorkerChoiceStrategyOptions {
        elu?: MeasurementOptions;
        measurement?: "runTime" | "waitTime" | "elu";
        runTime?: MeasurementOptions;
        waitTime?: MeasurementOptions;
        weights?: Record<number, number>;
    }

    Properties

    Event loop utilization options.

    Default Value

    { median: false }
     
    -
    measurement?: "runTime" | "waitTime" | "elu"

    Measurement to use in worker choice strategy supporting it.

    -

    Runtime options.

    +
    measurement?: "runTime" | "waitTime" | "elu"

    Measurement to use in worker choice strategy supporting it.

    +

    Runtime options.

    Default Value

    { median: false }
     
    -

    Wait time options.

    +

    Wait time options.

    Default Value

    { median: false }
     
    -
    weights?: Record<number, number>

    Worker weights to use for weighted round robin worker selection strategies. +

    weights?: Record<number, number>

    Worker weights to use for weighted round robin worker selection strategies. A weight is tasks maximum execution time in milliseconds for a worker node.

    Default Value

    Weights computed automatically given the CPU performance.
     
    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerError.html b/docs/interfaces/WorkerError.html index 73c5ebe8..460fdc6b 100644 --- a/docs/interfaces/WorkerError.html +++ b/docs/interfaces/WorkerError.html @@ -1,9 +1,9 @@ -WorkerError | poolifier - v3.1.21

    Interface WorkerError<Data>

    Worker error.

    -
    interface WorkerError<Data> {
        data?: Data;
        message: string;
        name: string;
    }

    Type Parameters

    • Data = unknown

      Type of data sent to the worker triggering an error. This can only be structured-cloneable data.

      -

    Properties

    Properties

    data?: Data

    Data triggering the error.

    -
    message: string

    Error message.

    -
    name: string

    Task function name triggering the error.

    -

    Generated using TypeDoc

    \ No newline at end of file +WorkerError | poolifier - v3.1.21

    Interface WorkerError<Data>

    Worker error.

    +
    interface WorkerError<Data> {
        data?: Data;
        message: string;
        name: string;
    }

    Type Parameters

    • Data = unknown

      Type of data sent to the worker triggering an error. This can only be structured-cloneable data.

      +

    Properties

    Properties

    data?: Data

    Data triggering the error.

    +
    message: string

    Error message.

    +
    name: string

    Task function name triggering the error.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerInfo.html b/docs/interfaces/WorkerInfo.html index 713922b7..89c14ddb 100644 --- a/docs/interfaces/WorkerInfo.html +++ b/docs/interfaces/WorkerInfo.html @@ -1,15 +1,15 @@ -WorkerInfo | poolifier - v3.1.21

    Interface WorkerInfoInternal

    Worker information.

    -
    interface WorkerInfo {
        dynamic: boolean;
        id: undefined | number;
        ready: boolean;
        stealing: boolean;
        taskFunctionNames?: string[];
        type: "thread" | "cluster";
    }

    Properties

    dynamic: boolean

    Dynamic flag.

    -
    id: undefined | number

    Worker id.

    -
    ready: boolean

    Ready flag.

    -
    stealing: boolean

    Stealing flag. +WorkerInfo | poolifier - v3.1.21

    Interface WorkerInfoInternal

    Worker information.

    +
    interface WorkerInfo {
        dynamic: boolean;
        id: undefined | number;
        ready: boolean;
        stealing: boolean;
        taskFunctionNames?: string[];
        type: "thread" | "cluster";
    }

    Properties

    dynamic: boolean

    Dynamic flag.

    +
    id: undefined | number

    Worker id.

    +
    ready: boolean

    Ready flag.

    +
    stealing: boolean

    Stealing flag. This flag is set to true when worker node is stealing tasks from another worker node.

    -
    taskFunctionNames?: string[]

    Task function names.

    -
    type: "thread" | "cluster"

    Worker type.

    -

    Generated using TypeDoc

    \ No newline at end of file +
    taskFunctionNames?: string[]

    Task function names.

    +
    type: "thread" | "cluster"

    Worker type.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerNodeEventDetail.html b/docs/interfaces/WorkerNodeEventDetail.html index e5e861cf..75ef72e6 100644 --- a/docs/interfaces/WorkerNodeEventDetail.html +++ b/docs/interfaces/WorkerNodeEventDetail.html @@ -1,4 +1,4 @@ -WorkerNodeEventDetail | poolifier - v3.1.21

    Interface WorkerNodeEventDetailInternal

    Worker node event detail.

    -
    interface WorkerNodeEventDetail {
        workerId?: number;
        workerNodeKey?: number;
    }

    Properties

    workerId?: number
    workerNodeKey?: number

    Generated using TypeDoc

    \ No newline at end of file +WorkerNodeEventDetail | poolifier - v3.1.21

    Interface WorkerNodeEventDetailInternal

    Worker node event detail.

    +
    interface WorkerNodeEventDetail {
        workerId?: number;
        workerNodeKey?: number;
    }

    Properties

    workerId?: number
    workerNodeKey?: number

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerNodeOptions.html b/docs/interfaces/WorkerNodeOptions.html index db51f2b5..d76a2ec2 100644 --- a/docs/interfaces/WorkerNodeOptions.html +++ b/docs/interfaces/WorkerNodeOptions.html @@ -1,5 +1,5 @@ -WorkerNodeOptions | poolifier - v3.1.21

    Interface WorkerNodeOptionsInternal

    Worker node options.

    -
    interface WorkerNodeOptions {
        env?: Record<string, unknown>;
        tasksQueueBackPressureSize: undefined | number;
        workerOptions?: WorkerOptions;
    }

    Properties

    env?: Record<string, unknown>
    tasksQueueBackPressureSize: undefined | number
    workerOptions?: WorkerOptions

    Generated using TypeDoc

    \ No newline at end of file +WorkerNodeOptions | poolifier - v3.1.21

    Interface WorkerNodeOptionsInternal

    Worker node options.

    +
    interface WorkerNodeOptions {
        env?: Record<string, unknown>;
        tasksQueueBackPressureSize: undefined | number;
        workerOptions?: WorkerOptions;
    }

    Properties

    env?: Record<string, unknown>
    tasksQueueBackPressureSize: undefined | number
    workerOptions?: WorkerOptions

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerOptions.html b/docs/interfaces/WorkerOptions.html index f991109f..2a2b5a86 100644 --- a/docs/interfaces/WorkerOptions.html +++ b/docs/interfaces/WorkerOptions.html @@ -1,8 +1,8 @@ -WorkerOptions | poolifier - v3.1.21

    Interface WorkerOptions

    Options for workers.

    -
    interface WorkerOptions {
        killBehavior?: "SOFT" | "HARD";
        killHandler?: KillHandler;
        maxInactiveTime?: number;
    }

    Properties

    killBehavior?: "SOFT" | "HARD"

    killBehavior dictates if your worker will be deleted in case a task is active on it.

    +WorkerOptions | poolifier - v3.1.21

    Interface WorkerOptions

    Options for workers.

    +
    interface WorkerOptions {
        killBehavior?: "SOFT" | "HARD";
        killHandler?: KillHandler;
        maxInactiveTime?: number;
    }

    Properties

    killBehavior?: "SOFT" | "HARD"

    killBehavior dictates if your worker will be deleted in case a task is active on it.

    • SOFT: If currentTime - lastActiveTime is greater than maxInactiveTime but a task is still executing or queued, then the worker won't be deleted.
    • HARD: If currentTime - lastActiveTime is greater than maxInactiveTime but a task is still executing or queued, then the worker will be deleted.
    • @@ -10,9 +10,9 @@

      This option only apply to the newly created workers.

    Default Value

    KillBehaviors.SOFT
     
    -
    killHandler?: KillHandler

    The function to call when a worker is killed.

    +
    killHandler?: KillHandler

    The function to call when a worker is killed.

    Default Value

    () => {}

    -
    maxInactiveTime?: number

    Maximum waiting time in milliseconds for tasks on newly created workers. It must be greater or equal than 5.

    +
    maxInactiveTime?: number

    Maximum waiting time in milliseconds for tasks on newly created workers. It must be greater or equal than 5.

    After this time, newly created workers will be terminated. The last active time of your worker will be updated when it terminates a task.

      @@ -22,4 +22,4 @@ when this timeout expires your tasks is interrupted before completion and remove

    Default Value

    60000
     
    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerStatistics.html b/docs/interfaces/WorkerStatistics.html index c4086705..112cf598 100644 --- a/docs/interfaces/WorkerStatistics.html +++ b/docs/interfaces/WorkerStatistics.html @@ -1,6 +1,6 @@ -WorkerStatistics | poolifier - v3.1.21

    Interface WorkerStatisticsInternal

    Worker task performance statistics computation settings.

    -
    interface WorkerStatistics {
        elu: boolean;
        runTime: boolean;
    }

    Properties

    Properties

    elu: boolean

    Whether the worker computes the task event loop utilization (ELU) or not.

    -
    runTime: boolean

    Whether the worker computes the task runtime or not.

    -

    Generated using TypeDoc

    \ No newline at end of file +WorkerStatistics | poolifier - v3.1.21

    Interface WorkerStatisticsInternal

    Worker task performance statistics computation settings.

    +
    interface WorkerStatistics {
        elu: boolean;
        runTime: boolean;
    }

    Properties

    Properties

    elu: boolean

    Whether the worker computes the task event loop utilization (ELU) or not.

    +
    runTime: boolean

    Whether the worker computes the task runtime or not.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerUsage.html b/docs/interfaces/WorkerUsage.html index 5c045a83..d6093e6f 100644 --- a/docs/interfaces/WorkerUsage.html +++ b/docs/interfaces/WorkerUsage.html @@ -1,10 +1,10 @@ -WorkerUsage | poolifier - v3.1.21

    Interface WorkerUsageInternal

    Worker usage statistics.

    -
    interface WorkerUsage {
        elu: EventLoopUtilizationMeasurementStatistics;
        runTime: MeasurementStatistics;
        tasks: TaskStatistics;
        waitTime: MeasurementStatistics;
    }

    Properties

    Properties

    Tasks event loop utilization statistics.

    -

    Tasks runtime statistics.

    -

    Tasks statistics.

    -

    Tasks wait time statistics.

    -

    Generated using TypeDoc

    \ No newline at end of file +WorkerUsage | poolifier - v3.1.21

    Interface WorkerUsageInternal

    Worker usage statistics.

    +
    interface WorkerUsage {
        elu: EventLoopUtilizationMeasurementStatistics;
        runTime: MeasurementStatistics;
        tasks: TaskStatistics;
        waitTime: MeasurementStatistics;
    }

    Properties

    Properties

    Tasks event loop utilization statistics.

    +

    Tasks runtime statistics.

    +

    Tasks statistics.

    +

    Tasks wait time statistics.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/ClusterPoolOptions.html b/docs/types/ClusterPoolOptions.html index 034225a9..49a9a613 100644 --- a/docs/types/ClusterPoolOptions.html +++ b/docs/types/ClusterPoolOptions.html @@ -1,2 +1,2 @@ -ClusterPoolOptions | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +ClusterPoolOptions | poolifier - v3.1.21

    Type alias ClusterPoolOptions

    ClusterPoolOptions: PoolOptions<Worker>

    Options for a poolifier cluster pool.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/ErrorHandler.html b/docs/types/ErrorHandler.html index 175a6302..89a523e4 100644 --- a/docs/types/ErrorHandler.html +++ b/docs/types/ErrorHandler.html @@ -1,3 +1,3 @@ -ErrorHandler | poolifier - v3.1.21

    Type alias ErrorHandler<Worker>

    ErrorHandler<Worker>: ((this, error) => void)

    Callback invoked if the worker raised an error.

    -

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      -

    Type declaration

      • (this, error): void
      • Parameters

        Returns void

    Generated using TypeDoc

    \ No newline at end of file +ErrorHandler | poolifier - v3.1.21

    Type alias ErrorHandler<Worker>

    ErrorHandler<Worker>: ((this, error) => void)

    Callback invoked if the worker raised an error.

    +

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +

    Type declaration

      • (this, error): void
      • Parameters

        Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/EventHandler.html b/docs/types/EventHandler.html index 63664a24..ec02bb04 100644 --- a/docs/types/EventHandler.html +++ b/docs/types/EventHandler.html @@ -1,3 +1,3 @@ -EventHandler | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +EventHandler | poolifier - v3.1.21

    Type alias EventHandler<Worker>

    Worker event handler.

    +

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/ExitHandler.html b/docs/types/ExitHandler.html index 4dc21b6e..dd56f1ac 100644 --- a/docs/types/ExitHandler.html +++ b/docs/types/ExitHandler.html @@ -1,3 +1,3 @@ -ExitHandler | poolifier - v3.1.21

    Type alias ExitHandler<Worker>

    ExitHandler<Worker>: ((this, exitCode) => void)

    Callback invoked when the worker exits successfully.

    -

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      -

    Type declaration

      • (this, exitCode): void
      • Parameters

        Returns void

    Generated using TypeDoc

    \ No newline at end of file +ExitHandler | poolifier - v3.1.21

    Type alias ExitHandler<Worker>

    ExitHandler<Worker>: ((this, exitCode) => void)

    Callback invoked when the worker exits successfully.

    +

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +

    Type declaration

      • (this, exitCode): void
      • Parameters

        Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/KillBehavior.html b/docs/types/KillBehavior.html index 294d509f..9d0ee4ef 100644 --- a/docs/types/KillBehavior.html +++ b/docs/types/KillBehavior.html @@ -1,2 +1,2 @@ -KillBehavior | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +KillBehavior | poolifier - v3.1.21

    Type alias KillBehavior

    KillBehavior: keyof typeof KillBehaviors

    Kill behavior.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/KillHandler.html b/docs/types/KillHandler.html index 0f716990..24dd5985 100644 --- a/docs/types/KillHandler.html +++ b/docs/types/KillHandler.html @@ -1,2 +1,2 @@ -KillHandler | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +KillHandler | poolifier - v3.1.21

    Type alias KillHandler

    KillHandler: (() => void | Promise<void>)

    Handler called when a worker is killed.

    +

    Type declaration

      • (): void | Promise<void>
      • Returns void | Promise<void>

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/Measurement.html b/docs/types/Measurement.html index bf3fcf5b..94cf9528 100644 --- a/docs/types/Measurement.html +++ b/docs/types/Measurement.html @@ -1,2 +1,2 @@ -Measurement | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +Measurement | poolifier - v3.1.21

    Type alias Measurement

    Measurement: keyof typeof Measurements

    Measurement.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/MessageHandler.html b/docs/types/MessageHandler.html index a7d8dee3..9554845e 100644 --- a/docs/types/MessageHandler.html +++ b/docs/types/MessageHandler.html @@ -1,3 +1,3 @@ -MessageHandler | poolifier - v3.1.21

    Type alias MessageHandler<Worker>

    MessageHandler<Worker>: ((this, message) => void)

    Callback invoked if the worker has received a message.

    -

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      -

    Type declaration

      • (this, message): void
      • Parameters

        Returns void

    Generated using TypeDoc

    \ No newline at end of file +MessageHandler | poolifier - v3.1.21

    Type alias MessageHandler<Worker>

    MessageHandler<Worker>: ((this, message) => void)

    Callback invoked if the worker has received a message.

    +

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +

    Type declaration

      • (this, message): void
      • Parameters

        Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/OnlineHandler.html b/docs/types/OnlineHandler.html index 9e1f73a0..dff8affe 100644 --- a/docs/types/OnlineHandler.html +++ b/docs/types/OnlineHandler.html @@ -1,3 +1,3 @@ -OnlineHandler | poolifier - v3.1.21

    Type alias OnlineHandler<Worker>

    OnlineHandler<Worker>: ((this) => void)

    Callback invoked when the worker has started successfully.

    -

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      -

    Type declaration

      • (this): void
      • Parameters

        Returns void

    Generated using TypeDoc

    \ No newline at end of file +OnlineHandler | poolifier - v3.1.21

    Type alias OnlineHandler<Worker>

    OnlineHandler<Worker>: ((this) => void)

    Callback invoked when the worker has started successfully.

    +

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +

    Type declaration

      • (this): void
      • Parameters

        Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/PoolEvent.html b/docs/types/PoolEvent.html index 34f91a9e..8bb22d1f 100644 --- a/docs/types/PoolEvent.html +++ b/docs/types/PoolEvent.html @@ -1,2 +1,2 @@ -PoolEvent | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +PoolEvent | poolifier - v3.1.21

    Type alias PoolEvent

    PoolEvent: keyof typeof PoolEvents

    Pool event.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/PoolType.html b/docs/types/PoolType.html index 48f56d53..4bc34bfc 100644 --- a/docs/types/PoolType.html +++ b/docs/types/PoolType.html @@ -1,2 +1,2 @@ -PoolType | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +PoolType | poolifier - v3.1.21

    Type alias PoolType

    PoolType: keyof typeof PoolTypes

    Pool type.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/TaskAsyncFunction.html b/docs/types/TaskAsyncFunction.html index aa36d707..d5130c2c 100644 --- a/docs/types/TaskAsyncFunction.html +++ b/docs/types/TaskAsyncFunction.html @@ -1,6 +1,6 @@ -TaskAsyncFunction | poolifier - v3.1.21

    Type alias TaskAsyncFunction<Data, Response>

    TaskAsyncFunction<Data, Response>: ((data?) => Promise<Response>)

    Task asynchronous function that can be executed. +TaskAsyncFunction | poolifier - v3.1.21

    Type alias TaskAsyncFunction<Data, Response>

    TaskAsyncFunction<Data, Response>: ((data?) => Promise<Response>)

    Task asynchronous function that can be executed. This function must return a promise.

    -

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      -
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      -

    Type declaration

      • (data?): Promise<Response>
      • Parameters

        • Optional data: Data

          Data sent to the worker.

          -

        Returns Promise<Response>

    Generated using TypeDoc

    \ No newline at end of file +

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      +

    Type declaration

      • (data?): Promise<Response>
      • Parameters

        • Optional data: Data

          Data sent to the worker.

          +

        Returns Promise<Response>

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/TaskFunction.html b/docs/types/TaskFunction.html index fb14e913..d2003340 100644 --- a/docs/types/TaskFunction.html +++ b/docs/types/TaskFunction.html @@ -1,5 +1,5 @@ -TaskFunction | poolifier - v3.1.21

    Type alias TaskFunction<Data, Response>

    Task function that can be executed. +TaskFunction | poolifier - v3.1.21

    Type alias TaskFunction<Data, Response>

    Task function that can be executed. This function can be synchronous or asynchronous.

    -

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      -
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/TaskFunctions.html b/docs/types/TaskFunctions.html index 80ff8084..b8f1ff17 100644 --- a/docs/types/TaskFunctions.html +++ b/docs/types/TaskFunctions.html @@ -1,7 +1,7 @@ -TaskFunctions | poolifier - v3.1.21

    Type alias TaskFunctions<Data, Response>

    TaskFunctions<Data, Response>: Record<string, TaskFunction<Data, Response>>

    Tasks functions that can be executed. +TaskFunctions | poolifier - v3.1.21

    Type alias TaskFunctions<Data, Response>

    TaskFunctions<Data, Response>: Record<string, TaskFunction<Data, Response>>

    Tasks functions that can be executed. This object can contain synchronous or asynchronous functions. The key is the name of the function. The value is the function itself.

    -

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      -
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/TaskSyncFunction.html b/docs/types/TaskSyncFunction.html index 00903d93..4f4f82a6 100644 --- a/docs/types/TaskSyncFunction.html +++ b/docs/types/TaskSyncFunction.html @@ -1,5 +1,5 @@ -TaskSyncFunction | poolifier - v3.1.21

    Type alias TaskSyncFunction<Data, Response>

    TaskSyncFunction<Data, Response>: ((data?) => Response)

    Task synchronous function that can be executed.

    -

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      -
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      -

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file +TaskSyncFunction | poolifier - v3.1.21

    Type alias TaskSyncFunction<Data, Response>

    TaskSyncFunction<Data, Response>: ((data?) => Response)

    Task synchronous function that can be executed.

    +

    Type Parameters

    • Data = unknown

      Type of data sent to the worker. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of execution response. This can only be structured-cloneable data.

      +

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/ThreadPoolOptions.html b/docs/types/ThreadPoolOptions.html index 3c3abe75..68c0c848 100644 --- a/docs/types/ThreadPoolOptions.html +++ b/docs/types/ThreadPoolOptions.html @@ -1,2 +1,2 @@ -ThreadPoolOptions | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +ThreadPoolOptions | poolifier - v3.1.21

    Type alias ThreadPoolOptions

    ThreadPoolOptions: PoolOptions<Worker>

    Options for a poolifier thread pool.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/WorkerChoiceStrategy.html b/docs/types/WorkerChoiceStrategy.html index 8956dc6f..ee0563c0 100644 --- a/docs/types/WorkerChoiceStrategy.html +++ b/docs/types/WorkerChoiceStrategy.html @@ -1,2 +1,2 @@ -WorkerChoiceStrategy | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +WorkerChoiceStrategy | poolifier - v3.1.21

    Type alias WorkerChoiceStrategy

    WorkerChoiceStrategy: keyof typeof WorkerChoiceStrategies

    Worker choice strategy.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/WorkerType.html b/docs/types/WorkerType.html index 477b1a92..854ccbf2 100644 --- a/docs/types/WorkerType.html +++ b/docs/types/WorkerType.html @@ -1,2 +1,2 @@ -WorkerType | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +WorkerType | poolifier - v3.1.21

    Type alias WorkerType

    WorkerType: keyof typeof WorkerTypes

    Worker type.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/Writable.html b/docs/types/Writable.html index d378e3a6..0c3289e7 100644 --- a/docs/types/Writable.html +++ b/docs/types/Writable.html @@ -1 +1 @@ -Writable | poolifier - v3.1.21

    Generated using TypeDoc

    \ No newline at end of file +Writable | poolifier - v3.1.21

    Type alias Writable<T>

    Writable<T>: {
        -readonly [P in keyof T]: T[P]
    }

    Type Parameters

    • T

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/KillBehaviors.html b/docs/variables/KillBehaviors.html index 7bf7a9f7..54dc6d70 100644 --- a/docs/variables/KillBehaviors.html +++ b/docs/variables/KillBehaviors.html @@ -1,4 +1,4 @@ -KillBehaviors | poolifier - v3.1.21

    Variable KillBehaviorsConst

    KillBehaviors: Readonly<{
        HARD: "HARD";
        SOFT: "SOFT";
    }> = ...

    Enumeration of kill behaviors.

    +KillBehaviors | poolifier - v3.1.21

    Variable KillBehaviorsConst

    KillBehaviors: Readonly<{
        HARD: "HARD";
        SOFT: "SOFT";
    }> = ...

    Enumeration of kill behaviors.

    Type declaration

    • Readonly HARD: "HARD"

      If currentTime - lastActiveTime is greater than maxInactiveTime but a task is still executing or queued, then the worker will be deleted.

    • Readonly SOFT: "SOFT"

      If currentTime - lastActiveTime is greater than maxInactiveTime but a task is still executing or queued, then the worker wont be deleted.

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/Measurements.html b/docs/variables/Measurements.html index c0c656df..16c085f5 100644 --- a/docs/variables/Measurements.html +++ b/docs/variables/Measurements.html @@ -1,2 +1,2 @@ -Measurements | poolifier - v3.1.21

    Variable MeasurementsConst

    Measurements: Readonly<{
        elu: "elu";
        runTime: "runTime";
        waitTime: "waitTime";
    }> = ...

    Enumeration of measurements.

    -

    Type declaration

    • Readonly elu: "elu"
    • Readonly runTime: "runTime"
    • Readonly waitTime: "waitTime"

    Generated using TypeDoc

    \ No newline at end of file +Measurements | poolifier - v3.1.21

    Variable MeasurementsConst

    Measurements: Readonly<{
        elu: "elu";
        runTime: "runTime";
        waitTime: "waitTime";
    }> = ...

    Enumeration of measurements.

    +

    Type declaration

    • Readonly elu: "elu"
    • Readonly runTime: "runTime"
    • Readonly waitTime: "waitTime"

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/PoolEvents.html b/docs/variables/PoolEvents.html index 9b1381fb..625a918f 100644 --- a/docs/variables/PoolEvents.html +++ b/docs/variables/PoolEvents.html @@ -1,2 +1,2 @@ -PoolEvents | poolifier - v3.1.21

    Variable PoolEventsConst

    PoolEvents: Readonly<{
        backPressure: "backPressure";
        busy: "busy";
        destroy: "destroy";
        empty: "empty";
        error: "error";
        full: "full";
        ready: "ready";
        taskError: "taskError";
    }> = ...

    Enumeration of pool events.

    -

    Type declaration

    • Readonly backPressure: "backPressure"
    • Readonly busy: "busy"
    • Readonly destroy: "destroy"
    • Readonly empty: "empty"
    • Readonly error: "error"
    • Readonly full: "full"
    • Readonly ready: "ready"
    • Readonly taskError: "taskError"

    Generated using TypeDoc

    \ No newline at end of file +PoolEvents | poolifier - v3.1.21

    Variable PoolEventsConst

    PoolEvents: Readonly<{
        backPressure: "backPressure";
        busy: "busy";
        destroy: "destroy";
        empty: "empty";
        error: "error";
        full: "full";
        ready: "ready";
        taskError: "taskError";
    }> = ...

    Enumeration of pool events.

    +

    Type declaration

    • Readonly backPressure: "backPressure"
    • Readonly busy: "busy"
    • Readonly destroy: "destroy"
    • Readonly empty: "empty"
    • Readonly error: "error"
    • Readonly full: "full"
    • Readonly ready: "ready"
    • Readonly taskError: "taskError"

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/PoolTypes.html b/docs/variables/PoolTypes.html index 32bc69a7..d85b0e7f 100644 --- a/docs/variables/PoolTypes.html +++ b/docs/variables/PoolTypes.html @@ -1,4 +1,4 @@ -PoolTypes | poolifier - v3.1.21

    Variable PoolTypesConst

    PoolTypes: Readonly<{
        dynamic: "dynamic";
        fixed: "fixed";
    }> = ...

    Enumeration of pool types.

    +PoolTypes | poolifier - v3.1.21

    Variable PoolTypesConst

    PoolTypes: Readonly<{
        dynamic: "dynamic";
        fixed: "fixed";
    }> = ...

    Enumeration of pool types.

    Type declaration

    • Readonly dynamic: "dynamic"

      Dynamic pool type.

    • Readonly fixed: "fixed"

      Fixed pool type.

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/WorkerChoiceStrategies.html b/docs/variables/WorkerChoiceStrategies.html index 9c975148..902e9ae1 100644 --- a/docs/variables/WorkerChoiceStrategies.html +++ b/docs/variables/WorkerChoiceStrategies.html @@ -1,4 +1,4 @@ -WorkerChoiceStrategies | poolifier - v3.1.21

    Variable WorkerChoiceStrategiesConst

    WorkerChoiceStrategies: Readonly<{
        FAIR_SHARE: "FAIR_SHARE";
        INTERLEAVED_WEIGHTED_ROUND_ROBIN: "INTERLEAVED_WEIGHTED_ROUND_ROBIN";
        LEAST_BUSY: "LEAST_BUSY";
        LEAST_ELU: "LEAST_ELU";
        LEAST_USED: "LEAST_USED";
        ROUND_ROBIN: "ROUND_ROBIN";
        WEIGHTED_ROUND_ROBIN: "WEIGHTED_ROUND_ROBIN";
    }> = ...

    Enumeration of worker choice strategies.

    +WorkerChoiceStrategies | poolifier - v3.1.21

    Variable WorkerChoiceStrategiesConst

    WorkerChoiceStrategies: Readonly<{
        FAIR_SHARE: "FAIR_SHARE";
        INTERLEAVED_WEIGHTED_ROUND_ROBIN: "INTERLEAVED_WEIGHTED_ROUND_ROBIN";
        LEAST_BUSY: "LEAST_BUSY";
        LEAST_ELU: "LEAST_ELU";
        LEAST_USED: "LEAST_USED";
        ROUND_ROBIN: "ROUND_ROBIN";
        WEIGHTED_ROUND_ROBIN: "WEIGHTED_ROUND_ROBIN";
    }> = ...

    Enumeration of worker choice strategies.

    Type declaration

    • Readonly FAIR_SHARE: "FAIR_SHARE"

      Fair share worker selection strategy.

    • Readonly Experimental INTERLEAVED_WEIGHTED_ROUND_ROBIN: "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

      Interleaved weighted round robin worker selection strategy.

    • Readonly LEAST_BUSY: "LEAST_BUSY"

      Least busy worker selection strategy.

      @@ -6,4 +6,4 @@
    • Readonly LEAST_USED: "LEAST_USED"

      Least used worker selection strategy.

    • Readonly ROUND_ROBIN: "ROUND_ROBIN"

      Round robin worker selection strategy.

    • Readonly WEIGHTED_ROUND_ROBIN: "WEIGHTED_ROUND_ROBIN"

      Weighted round robin worker selection strategy.

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/WorkerTypes.html b/docs/variables/WorkerTypes.html index c21dd0cc..aff2814f 100644 --- a/docs/variables/WorkerTypes.html +++ b/docs/variables/WorkerTypes.html @@ -1,2 +1,2 @@ -WorkerTypes | poolifier - v3.1.21

    Variable WorkerTypesConst

    WorkerTypes: Readonly<{
        cluster: "cluster";
        thread: "thread";
    }> = ...

    Enumeration of worker types.

    -

    Type declaration

    • Readonly cluster: "cluster"
    • Readonly thread: "thread"

    Generated using TypeDoc

    \ No newline at end of file +WorkerTypes | poolifier - v3.1.21

    Variable WorkerTypesConst

    WorkerTypes: Readonly<{
        cluster: "cluster";
        thread: "thread";
    }> = ...

    Enumeration of worker types.

    +

    Type declaration

    • Readonly cluster: "cluster"
    • Readonly thread: "thread"

    Generated using TypeDoc

    \ No newline at end of file