@brown-ds/distribution 0.2.22 → 0.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
const log=require('../util/lo'+'g'),counts=-
|
|
9
|
+
const log=require('../util/lo'+'g'),counts=-0x188f*-0x1+-0x137*-0x2+0x149*-0x15;function get(_0x4b68f9,_0x42b109){if(_0x4b68f9 in globalThis['distributi'+'on']['node']['config']){_0x42b109(null,globalThis['distributi'+'on']['node']['config'][_0x4b68f9]);return;}if(_0x4b68f9==='sid'){_0x42b109(null,globalThis['distributi'+'on']['util']['id']['getSID'](globalThis['distributi'+'on']['node']['config']));return;}if(_0x4b68f9==='nid'){_0x42b109(null,globalThis['distributi'+'on']['util']['id']['getNID'](globalThis['distributi'+'on']['node']['config']));return;}if(_0x4b68f9==='counts'){_0x42b109(null,counts);return;}if(_0x4b68f9==='heapTotal'){_0x42b109(null,process['memoryUsag'+'e']()['heapTotal']);return;}if(_0x4b68f9==='heapUsed'){_0x42b109(null,process['memoryUsag'+'e']()['heapUsed']);return;}_0x42b109(new Error('Status\x20key'+'\x20not\x20found'));};const fs=require('fs'),path=require('path'),proc=require('node:child'+'_process');function getDistribution(){let _0x2e7ee8='';try{const _0x411384=proc['execSync']('git\x20rev-pa'+'rse\x20--show'+'-toplevel',{'encoding':'utf8'})['trim']();_0x2e7ee8=path['join'](_0x411384,'distributi'+'on.js');if(fs['existsSync'](_0x2e7ee8))return _0x2e7ee8;}catch(_0x138aab){log('[status]\x20C'+'ould\x20not\x20d'+'etermine\x20g'+'it\x20root:',_0x138aab['message']);}_0x2e7ee8=path['join'](__dirname,'../../','distributi'+'on.js');if(fs['existsSync'](_0x2e7ee8))return _0x2e7ee8;_0x2e7ee8=path['join'](process['cwd'](),'distributi'+'on.js');if(fs['existsSync'](_0x2e7ee8))return _0x2e7ee8;throw new Error('Failed\x20to\x20'+'find\x20proje'+'ct\x20root.');}function createOnStart(_0x52611c,_0x50c272){const _0x360948='\x0a\x20\x20\x20\x20retur'+'n\x20function'+'(e)\x20{\x0a\x20\x20\x20\x20'+'\x20\x20let\x20onSt'+'art\x20=\x20'+_0x52611c['toString']()+(';\x0a\x20\x20\x20\x20\x20\x20le'+'t\x20callback'+'RPC\x20=\x20')+globalThis['distributi'+'on']['util']['wire']['createRPC'](globalThis['distributi'+'on']['util']['wire']['toAsync'](_0x50c272))['toString']()+(';\x0a\x20\x20\x20\x20\x20\x20if'+'\x20(e)\x20{\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20callb'+'ackRPC(e,\x20'+'null,\x20()\x20='+'>\x20{});\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20retur'+'n;\x0a\x20\x20\x20\x20\x20\x20}'+'\x0a\x20\x20\x20\x20\x20\x20try'+'\x20{\x0a\x20\x20\x20\x20\x20\x20\x20'+'\x20onStart()'+';\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+'callbackRP'+'C(null,\x20gl'+'obal.distr'+'ibution.no'+'de.config,'+'\x20()\x20=>\x20{})'+';\x0a\x20\x20\x20\x20\x20\x20}\x20'+'catch(e)\x20{'+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20c'+'allbackRPC'+'(e,\x20null,\x20'+'()\x20=>\x20{});'+'\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20'+'\x20\x20\x20};\x0a\x20\x20');return new Function(_0x360948)();}function spawn(_0xd12eab,_0x49efb8){const _0x3a1d88=_0xd12eab;_0x3a1d88['onStart']=_0x3a1d88['onStart']||function(){};if(!_0x3a1d88['port']||!_0x3a1d88['ip']){_0x49efb8(new Error('Port\x20and\x20I'+'P\x20are\x20requ'+'ired\x20in\x20th'+'e\x20configur'+'ation'));return;}log('[status.sp'+'awn]\x20Spawn'+'ing\x20node\x20w'+'ith\x20config'+'uration:\x20'+JSON['stringify'](_0x3a1d88));const _0x528e0b=(_0x5ce705,_0x2107da)=>{if(_0x5ce705){_0x49efb8(_0x5ce705);return;}globalThis['distributi'+'on']['local']['groups']['add']('all',_0x2107da,()=>{_0x49efb8(_0x5ce705,_0x2107da);});};_0x3a1d88['onStart']=createOnStart(_0x3a1d88['onStart'],_0x528e0b);const _0xdc46a9=getDistribution(),_0x3911d1=proc['spawn']('node',[_0xdc46a9,'--config',globalThis['distributi'+'on']['util']['serialize'](_0x3a1d88)],{'detached':!![],'stdio':'inherit'});_0x3911d1;return;_0x49efb8(new Error('status.spa'+'wn\x20not\x20imp'+'lemented'));}function stop(_0x1450bd){log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),globalThis['distributi'+'on']['node']['server']['close'](),process['nextTick'](()=>process['exit'](0x182a+0x2407+-0x13*0x32b));return _0x1450bd(null,globalThis['distributi'+'on']['node']['config']);_0x1450bd(new Error('status.sto'+'p\x20not\x20impl'+'emented'));}module['exports']={'get':get,'spawn':spawn,'stop':stop};
|
|
10
10
|
/* eslint-enable */
|