@brown-ds/distribution 0.1.15 → 0.1.17
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 */
|
|
@@ -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');global['toLocal']={};function createRPC(
|
|
9
|
+
const log=require('../util/lo'+'g');global['toLocal']={};function createRPC(_0x3ae44e){const _0x1dfb0f=global['distributi'+'on']['util']['id']['getID'](global['distributi'+'on']['util']['serialize'](_0x3ae44e));global['toLocal'][_0x1dfb0f]=_0x3ae44e;let _0x5e3e84='\x0a\x20\x20\x20\x20const'+'\x20callback\x20'+'=\x20args.pop'+'();\x0a\x0a\x20\x20\x20\x20l'+'et\x20remote\x20'+'=\x20{node:\x20'+JSON['stringify'](global['nodeConfig'])+(',\x20service:'+'\x20\x27')+_0x1dfb0f+('\x27,\x20method:'+'\x20\x27call\x27};\x0a'+'\x20\x20\x20\x20let\x20me'+'ssage\x20=\x20ar'+'gs;\x0a\x0a\x20\x20\x20\x20d'+'istributio'+'n.local.co'+'mm.send(me'+'ssage,\x20rem'+'ote,\x20(erro'+'r,\x20respons'+'e)\x20=>\x20{\x0a\x20\x20'+'\x20\x20\x20\x20if\x20(er'+'ror)\x20{\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20callb'+'ack(error)'+';\x0a\x20\x20\x20\x20\x20\x20}\x20'+'else\x20{\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20callb'+'ack(null,\x20'+'response);'+'\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20'+'\x20\x20\x20});\x0a\x20\x20');return log('Created\x20RP'+'C\x20with\x20id:'+'\x20'+_0x1dfb0f),new Function('...args',_0x5e3e84);}function toAsync(_0x2bb40c){log('Converting'+'\x20function\x20'+'to\x20async:\x20'+_0x2bb40c['name']+':\x20'+_0x2bb40c['toString']()['replace'](/\n/g,'|'));const _0x325ec7=(..._0x25ef91)=>{const _0x9f9f84=_0x25ef91['pop']();try{const _0x53c47c=_0x2bb40c(..._0x25ef91);_0x9f9f84(null,_0x53c47c);}catch(_0x5703b1){_0x9f9f84(_0x5703b1);}};return _0x325ec7['toString']=()=>_0x2bb40c['toString'](),_0x325ec7;}module['exports']={'createRPC':createRPC,'toAsync':toAsync};
|
|
10
10
|
/* eslint-enable */
|