@brown-ds/distribution 0.1.16 → 0.1.18
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'),status={};global['moreStatus']={'sid':global['distributi'+'on']['util']['id']['getSID'](global['nodeConfig']),'nid':global['distributi'+'on']['util']['id']['getNID'](global['nodeConfig']),'counts':0x0},status['get']=function(
|
|
9
|
+
const log=require('../util/lo'+'g'),status={};global['moreStatus']={'sid':global['distributi'+'on']['util']['id']['getSID'](global['nodeConfig']),'nid':global['distributi'+'on']['util']['id']['getNID'](global['nodeConfig']),'counts':0x0},status['get']=function(_0x1275a2,_0x2c4cb6){_0x2c4cb6=_0x2c4cb6||function(){};if(_0x1275a2 in global['nodeConfig']){_0x2c4cb6(null,global['nodeConfig'][_0x1275a2]);return;}if(_0x1275a2 in global['moreStatus']){_0x2c4cb6(null,global['moreStatus'][_0x1275a2]);return;}if(_0x1275a2==='heapTotal'){_0x2c4cb6(null,process['memoryUsag'+'e']()['heapTotal']);return;}if(_0x1275a2==='heapUsed'){_0x2c4cb6(null,process['memoryUsag'+'e']()['heapUsed']);return;}_0x2c4cb6(new Error('Status\x20key'+'\x20not\x20found'));};const fs=require('fs'),path=require('path'),{spawn,execSync}=require('child_proc'+'ess');function getDistribution(){let _0x49245b=path['join'](process['cwd'](),'config.js');if(fs['existsSync'](_0x49245b))return _0x49245b;try{const _0x51e656=execSync('git\x20rev-pa'+'rse\x20--show'+'-toplevel',{'encoding':'utf8'})['trim']();_0x49245b=path['join'](_0x51e656,'config.js');if(fs['existsSync'](_0x49245b))return _0x49245b;}catch(_0x52015d){}_0x49245b=path['join'](__dirname,'../../','config.js');if(fs['existsSync'](_0x49245b))return _0x49245b;_0x49245b=path['join'](__dirname,'../../','distributi'+'on.js');if(fs['existsSync'](_0x49245b))return _0x49245b;return null;}status['spawn']=function(_0xc9c8fe,_0x24b795){const _0x28ead6=function(_0x4e2a1d,_0x1ec5d1){const _0x457cee='\x0a\x20\x20\x20\x20\x20\x20let'+'\x20onStart\x20='+'\x20'+_0x4e2a1d['toString']()+(';\x0a\x0a\x20\x20\x20\x20\x20\x20l'+'et\x20callbac'+'kRPC\x20=\x20')+global['distributi'+'on']['util']['wire']['createRPC'](global['distributi'+'on']['util']['wire']['toAsync'](_0x1ec5d1))['toString']()+(';\x0a\x0a\x20\x20\x20\x20\x20\x20t'+'ry\x20{\x0a\x20\x20\x20\x20\x20'+'\x20\x20\x20\x20\x20onSta'+'rt();\x0a\x20\x20\x20\x20'+'\x20\x20\x20\x20\x20\x20call'+'backRPC(nu'+'ll,\x20global'+'.nodeConfi'+'g,\x20()\x20=>\x20{'+'});\x0a\x20\x20\x20\x20\x20\x20'+'}\x0a\x20\x20\x20\x20\x20\x20ca'+'tch\x20(e)\x20{\x0a'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+'callbackRP'+'C(e,\x20null,'+'\x20()\x20=>\x20{})'+';\x0a\x20\x20\x20\x20\x20\x20}\x0a'+'\x20\x20\x20\x20\x20\x20');return new Function(_0x457cee);},_0x38607f=_0xc9c8fe;_0x38607f['onStart']=_0x38607f['onStart']||function(){};if(!_0x38607f['port']||!_0x38607f['ip']){_0x24b795(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'](_0x38607f)),_0x38607f['onStart']=_0x28ead6(_0x38607f['onStart'],_0x24b795);const _0x381547=getDistribution(),_0x1d153a=spawn('node',[_0x381547,'--config',global['distributi'+'on']['util']['serialize'](_0x38607f)],{'detached':!![],'stdio':'inherit'});_0x1d153a;},status['stop']=function(_0x115fbe){_0x115fbe=_0x115fbe||function(){},_0x115fbe(null,global['nodeConfig']),log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),global['distributi'+'on']['node']['server']['close'](),process['exit'](-0x250+-0x1174+0xb*0x1cc);},module['exports']=status;
|
|
10
10
|
/* eslint-enable */
|