@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(_0xaf222){const _0x49effd={};return _0x49effd['gid']=_0xaf222['gid']||'all',{'get':(_0x2c8358,_0x2b080c)=>{const _0x2f73eb=[_0x2c8358],_0x2a83d2={'service':'status','method':'get'};global['distributi'+'on'][_0x49effd['gid']]['comm']['send'](_0x2f73eb,_0x2a83d2,(_0x2c0694,_0x33d7ff)=>{switch(_0x2c8358){case'heapTotal':const _0x297e00=Object['values'](_0x33d7ff)['reduce']((_0x1310f3,_0x19f39b)=>{return _0x1310f3+_0x19f39b;},-0xfb6+0x7e*0xc+0xa*0xfb);_0x2b080c(_0x2c0694,_0x297e00);break;case'nid':const _0x394095=Object['values'](_0x33d7ff)['reduce']((_0x26e757,_0x4187a4)=>{return _0x26e757['concat'](_0x4187a4);},[]);_0x2b080c(_0x2c0694,_0x394095);break;default:_0x2b080c(_0x2c0694,_0x33d7ff);break;}});},'spawn':(_0x41ef1d,_0x4b51b8)=>{_0x4b51b8=_0x4b51b8||function(){},global['distributi'+'on']['local']['status']['spawn'](_0x41ef1d,(_0x5aaae3,_0xd9dea9)=>{_0x5aaae3?_0x4b51b8(_0x5aaae3):global['distributi'+'on']['local']['groups']['add'](_0x49effd['gid'],_0x41ef1d,()=>{_0x4b51b8(null,_0xd9dea9);}),global['distributi'+'on'][_0x49effd['gid']]['comm']['send']([_0x49effd['gid'],_0x41ef1d],{'service':'groups','method':'add'},()=>{});});},'stop':_0x322fe9=>{global['distributi'+'on'][_0x49effd['gid']]['comm']['send']([],{'service':'status','method':'stop'},_0x322fe9);}};};module['exports']=status;
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(_0xd7907f,_0xed0098){log('[routes.ge'+'t]\x20Getting'+'\x20service:\x20'+JSON['stringify'](_0xd7907f));if(!_0xed0098)return;typeof _0xd7907f==='string'&&(_0xd7907f={'service':_0xd7907f});const _0x3ba868=_0xd7907f['service'],_0x5195df=_0xd7907f['gid'];if(_0x5195df&&_0x5195df!=='local')log('[routes.ge'+'t]\x20Found\x20d'+'istributed'+'\x20service:\x20'+_0x3ba868),_0xed0098(null,global['distributi'+'on'][_0x5195df][_0x3ba868]);else{if(_0x3ba868 in routesStore)log('[routes.ge'+'t]\x20Found\x20l'+'ocal\x20servi'+'ce:\x20'+_0x3ba868),_0xed0098(null,routesStore[_0x3ba868]);else{const _0x32adc9=global['toLocal']['get'](_0x3ba868);_0x32adc9?(log('[routes.ge'+'t]\x20Found\x20R'+'PC:\x20'+_0x3ba868),_0xed0098(null,{'call':_0x32adc9})):_0xed0098(new Error('Service\x20'+_0x3ba868+('\x20not\x20found'+'\x20in\x20routes')));}}}function put(_0x1f51cd,_0x4a907d,_0x41a465){log('[routes.pu'+'t]\x20Putting'+'\x20service:\x20'+_0x4a907d+'\x20'+JSON['stringify'](_0x1f51cd)),routesStore[_0x4a907d]=_0x1f51cd;_0x41a465&&_0x41a465(null,_0x4a907d);;}function rem(_0x451b3f,_0x3f58ab){const _0x5b8abb=routesStore[_0x451b3f];delete routesStore[_0x451b3f],_0x3f58ab(null,_0x5b8abb);};module['exports']={'get':get,'put':put,'rem':rem};
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(_0xed5bd,_0x2ae74d){_0x2ae74d=_0x2ae74d||function(){};if(_0xed5bd in global['nodeConfig']){_0x2ae74d(null,global['nodeConfig'][_0xed5bd]);return;}if(_0xed5bd in global['moreStatus']){_0x2ae74d(null,global['moreStatus'][_0xed5bd]);return;}if(_0xed5bd==='heapTotal'){_0x2ae74d(null,process['memoryUsag'+'e']()['heapTotal']);return;}if(_0xed5bd==='heapUsed'){_0x2ae74d(null,process['memoryUsag'+'e']()['heapUsed']);return;}_0x2ae74d(new Error('Status\x20key'+'\x20not\x20found'));};const fs=require('fs'),path=require('path'),{spawn,execSync}=require('child_proc'+'ess');function getDistribution(){let _0x498053=path['join'](process['cwd'](),'distributi'+'on.js');if(fs['existsSync'](_0x498053))return _0x498053;try{const _0x5d3be6=execSync('git\x20rev-pa'+'rse\x20--show'+'-toplevel',{'encoding':'utf8'})['trim']();_0x498053=path['join'](_0x5d3be6,'distributi'+'on.js');if(fs['existsSync'](_0x498053))return _0x498053;}catch(_0x3a5232){}_0x498053=path['join'](__dirname,'../../dist'+'ribution.j'+'s');if(fs['existsSync'](_0x498053))return _0x498053;return null;}const createSpawnedCb=function(_0x3abc12,_0x8164b8){const _0x3b55d4='\x0a\x20\x20\x20\x20let\x20o'+'nStart\x20=\x20'+_0x3abc12['toString']()+(';\x0a\x0a\x20\x20\x20\x20let'+'\x20callbackR'+'PC\x20=\x20')+global['distributi'+'on']['util']['wire']['createRPC'](global['distributi'+'on']['util']['wire']['toAsync'](_0x8164b8))['toString']()+(';\x0a\x0a\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.nodeC'+'onfig,\x20()\x20'+'=>\x20{});\x0a\x20\x20'+'\x20\x20}\x0a\x20\x20\x20\x20ca'+'tch\x20(e)\x20{\x0a'+'\x20\x20\x20\x20\x20\x20\x20\x20ca'+'llbackRPC('+'e,\x20null,\x20('+')\x20=>\x20{});\x0a'+'\x20\x20\x20\x20}\x0a\x20\x20\x20\x20');return new Function(_0x3b55d4);};status['spawn']=function(_0x2a33fe,_0x35a083){const _0x22934f=_0x2a33fe;_0x22934f['onStart']=_0x22934f['onStart']||function(){};if(!_0x22934f['port']||!_0x22934f['ip']){_0x35a083(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'](_0x22934f)),_0x22934f['onStart']=createSpawnedCb(_0x22934f['onStart'],_0x35a083);const _0x2fef42=getDistribution(),_0x4bc187=spawn('node',[_0x2fef42,'--config',global['distributi'+'on']['util']['serialize'](_0x22934f)],{'detached':!![],'stdio':'inherit'});_0x4bc187;},status['stop']=function(_0x21756f){_0x21756f=_0x21756f||function(){},_0x21756f(null,global['nodeConfig']),log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),global['distributi'+'on']['node']['server']['close'](),process['exit'](-0x12dd+-0x78d+0x1a6a);},module['exports']=status;
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']=new Map();function createRPC(_0x188a3c){const _0x374a92=global['distributi'+'on']['util']['id']['getID'](global['distributi'+'on']['util']['serialize'](_0x188a3c));global['toLocal']['set'](_0x374a92,_0x188a3c);let _0x487026='\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')+_0x374a92+('\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'+_0x374a92),new Function('...args',_0x487026);}function toAsync(_0x417259){log('Converting'+'\x20function\x20'+'to\x20async:\x20'+_0x417259['name']+':\x20'+_0x417259['toString']()['replace'](/\n/g,'|'));const _0x12fb5a=(..._0x4bd1d3)=>{const _0x4c1f50=_0x4bd1d3['pop']();try{const _0x1d6e1a=_0x417259(..._0x4bd1d3);_0x4c1f50(null,_0x1d6e1a);}catch(_0x384053){_0x4c1f50(_0x384053);}};return _0x12fb5a['toString']=()=>_0x417259['toString'](),_0x12fb5a;}module['exports']={'createRPC':createRPC,'toAsync':toAsync};
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 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brown-ds/distribution",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "A library for building distributed systems.",
5
5
  "main": "distribution.js",
6
6
  "useLibrary": false,