@brown-ds/distribution 0.1.12 → 0.1.14
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 status=function(
|
|
9
|
+
const status=function(_0x361efc){const _0x53485f={};return _0x53485f['gid']=_0x361efc['gid']||'all',{'get':(_0x486e4d,_0x166577)=>{const _0x2202e4=[_0x486e4d],_0x2031b2={'service':'status','method':'get'};global['distributi'+'on'][_0x53485f['gid']]['comm']['send'](_0x2202e4,_0x2031b2,(_0x4bd946,_0x5c9923)=>{switch(_0x486e4d){case'heapTotal':const _0x32b8e5=Object['values'](_0x5c9923)['reduce']((_0x88d14a,_0x19f390)=>{return _0x88d14a+_0x19f390;},-0x1561+0x420+0x1141);_0x166577(_0x4bd946,_0x32b8e5);break;case'nid':const _0x17b9ad=Object['values'](_0x5c9923)['reduce']((_0x4aa102,_0x30d543)=>{return _0x4aa102['concat'](_0x30d543);},[]);_0x166577(_0x4bd946,_0x17b9ad);break;default:_0x166577(_0x4bd946,_0x5c9923);break;}});},'spawn':(_0x1a4792,_0x1807e0)=>{_0x1807e0=_0x1807e0||function(){},global['distributi'+'on']['local']['status']['spawn'](_0x1a4792,(_0x1b39e2,_0x5e57a4)=>{_0x1b39e2?_0x1807e0(_0x1b39e2):global['distributi'+'on']['local']['groups']['add'](_0x53485f['gid'],_0x1a4792,()=>{_0x1807e0(null,_0x5e57a4);}),global['distributi'+'on'][_0x53485f['gid']]['comm']['send']([_0x53485f['gid'],_0x1a4792],{'service':'groups','method':'add'},()=>{});});},'stop':_0x532f5e=>{global['distributi'+'on'][_0x53485f['gid']]['comm']['send']([],{'service':'status','method':'stop'},_0x532f5e);}};};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'),routesStore=new Map();function get(
|
|
9
|
+
const log=require('../util/lo'+'g'),routesStore=new Map();function get(_0x3313fa,_0x95e876){log('[routes.ge'+'t]\x20Getting'+'\x20service:\x20'+JSON['stringify'](_0x3313fa));if(!_0x95e876)return;typeof _0x3313fa==='string'&&(_0x3313fa={'service':_0x3313fa});const _0x260761=_0x3313fa['service'],_0x54d5f3=_0x3313fa['gid'];if(_0x54d5f3&&_0x54d5f3!=='local')log('[routes.ge'+'t]\x20Found\x20d'+'istributed'+'\x20service:\x20'+_0x260761),_0x95e876(null,global['distributi'+'on'][_0x54d5f3][_0x260761]);else{if(_0x260761 in routesStore)log('[routes.ge'+'t]\x20Found\x20l'+'ocal\x20servi'+'ce:\x20'+_0x260761),_0x95e876(null,routesStore[_0x260761]);else{const _0x57d4b5=global['toLocal'][_0x260761];_0x57d4b5?(log('[routes.ge'+'t]\x20Found\x20R'+'PC:\x20'+_0x260761),_0x95e876(null,{'call':_0x57d4b5})):_0x95e876(new Error('Service\x20'+_0x260761+('\x20not\x20found'+'\x20in\x20routes')));}}}function put(_0x2dd48b,_0x506066,_0xabfbb8){log('[routes.pu'+'t]\x20Putting'+'\x20service:\x20'+_0x506066+'\x20'+JSON['stringify'](_0x2dd48b)),routesStore[_0x506066]=_0x2dd48b;_0xabfbb8&&_0xabfbb8(null,_0x506066);;}function rem(_0x1866c7,_0xee2305){const _0x348046=routesStore[_0x1866c7];delete routesStore[_0x1866c7],_0xee2305(null,_0x348046);};module['exports']={'get':get,'put':put,'rem':rem};
|
|
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'),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(_0x6711ec,_0x51806b){_0x51806b=_0x51806b||function(){};if(_0x6711ec in global['nodeConfig']){_0x51806b(null,global['nodeConfig'][_0x6711ec]);return;}if(_0x6711ec in global['moreStatus']){_0x51806b(null,global['moreStatus'][_0x6711ec]);return;}if(_0x6711ec==='heapTotal'){_0x51806b(null,process['memoryUsag'+'e']()['heapTotal']);return;}if(_0x6711ec==='heapUsed'){_0x51806b(null,process['memoryUsag'+'e']()['heapUsed']);return;}_0x51806b(new Error('Status\x20key'+'\x20not\x20found'));};const fs=require('fs'),path=require('path'),{spawn,execSync}=require('child_proc'+'ess');function getDistribution(){let _0x231cc6=path['join'](process['cwd'](),'distributi'+'on.js');if(fs['existsSync'](_0x231cc6))return _0x231cc6;try{const _0x4e250b=execSync('git\x20rev-pa'+'rse\x20--show'+'-toplevel',{'encoding':'utf8'})['trim']();_0x231cc6=path['join'](_0x4e250b,'distributi'+'on.js');if(fs['existsSync'](_0x231cc6))return _0x231cc6;}catch(_0x26ada5){}_0x231cc6=path['join'](__dirname,'../../dist'+'ribution.j'+'s');if(fs['existsSync'](_0x231cc6))return _0x231cc6;return null;}status['spawn']=function(_0x578d8f,_0x29a494){const _0x5614ec=function(_0x2df1f6,_0x511829){const _0x4b2e72='\x0a\x20\x20\x20\x20\x20\x20let'+'\x20onStart\x20='+'\x20'+_0x2df1f6['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'](_0x511829))['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(_0x4b2e72);},_0x237858=_0x578d8f;_0x237858['onStart']=_0x237858['onStart']||function(){};if(!_0x237858['port']||!_0x237858['ip']){_0x29a494(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'](_0x237858)),_0x237858['onStart']=_0x5614ec(_0x237858['onStart'],_0x29a494);const _0x44b8a7=getDistribution(),_0x1fcbfb=spawn('node',[_0x44b8a7,'--config',global['distributi'+'on']['util']['serialize'](_0x237858)],{'detached':!![],'stdio':'inherit'});_0x1fcbfb;},status['stop']=function(_0x582742){_0x582742=_0x582742||function(){},_0x582742(null,global['nodeConfig']),log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),global['distributi'+'on']['node']['server']['close'](),process['exit'](0xaa*0x1+0x794*-0x1+0x6ea);},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']=
|
|
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 */
|