@brown-ds/distribution 0.0.41 → 0.0.43
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.
- package/distribution/all/comm.js +1 -1
- package/distribution/all/gossip.js +1 -1
- package/distribution/all/groups.js +1 -1
- package/distribution/all/mem.js +1 -1
- package/distribution/all/mr.js +1 -1
- package/distribution/all/routes.js +1 -1
- package/distribution/all/status.js +1 -1
- package/distribution/all/store.js +1 -1
- package/distribution/local/comm.js +1 -1
- package/distribution/local/gossip.js +1 -1
- package/distribution/local/groups.js +1 -1
- package/distribution/local/mem.js +1 -1
- package/distribution/local/node.js +1 -1
- package/distribution/local/routes.js +1 -1
- package/distribution/local/status.js +1 -1
- package/distribution/local/store.js +1 -1
- package/distribution/types.js +10 -0
- package/distribution/util/id.js +1 -1
- package/distribution/util/serialization.js +1 -1
- package/distribution/util/wire.js +1 -1
- package/distribution.js +2 -2
- package/package.json +2 -2
package/distribution/all/comm.js
CHANGED
|
@@ -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
|
-
|
|
9
|
+
function comm(_0x11980a){const _0x48f93e={};_0x48f93e['gid']=_0x11980a['gid']||'global';function _0x7695ef(_0x5b8d76,_0x17fa63,_0x147278){global['distributi'+'on']['local']['groups']['get'](_0x48f93e['gid'],(_0x5d59f3,_0x5c857c)=>{const _0x1c4e25=Object['keys'](_0x5c857c)['length'];if(_0x1c4e25===-0x392*0x9+0x2537+0x1*-0x515){_0x147278(new Error('No\x20nodes\x20f'+'ound'));return;}let _0x7fb3b2=0xe41*-0x1+0x13d*0x1+0xd04;const _0x547f91={},_0x576c2b={};for(const _0x2ff7b2 of Object['keys'](_0x5c857c)){const _0x7e519d=_0x5c857c[_0x2ff7b2],_0x4b7cc4={'node':{'ip':_0x7e519d['ip'],'port':_0x7e519d['port']},'service':_0x17fa63['service'],'method':_0x17fa63['method']};global['distributi'+'on']['local']['comm']['send'](_0x5b8d76,_0x4b7cc4,(_0x164c85,_0x38a301)=>{_0x164c85?_0x576c2b[_0x2ff7b2]=_0x164c85:_0x547f91[_0x2ff7b2]=_0x38a301,_0x7fb3b2+=0xb6c+0x14ea+-0x2055,_0x7fb3b2===_0x1c4e25&&_0x147278(_0x576c2b,_0x547f91);});}});}return{'send':_0x7695ef};};module['exports']=comm;
|
|
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 id=require('../util/id')
|
|
9
|
+
const id=require('../util/id'),gossip=function(_0x2b8b8c){const _0x475077={};return _0x475077['gid']=_0x2b8b8c['gid']||'global',_0x475077['subset']=_0x2b8b8c['subset']||function(_0x9ca960){return Math['ceil'](Math['log'](_0x9ca960['length']));},{'send':(_0x36ae05,_0x11cbb2,_0x881258)=>{global['distributi'+'on']['local']['groups']['get'](_0x475077['gid'],(_0x1002cc,_0x45cb3f)=>{const _0x3f1a4e=_0x475077['subset'](Object['keys'](_0x45cb3f)),_0x4a721a=function(_0x25671e){const _0x4baab8=new Set();while(_0x4baab8['size']<_0x3f1a4e){const _0x15b724=Math['floor'](Math['random']()*_0x25671e['length']);_0x4baab8['add'](_0x25671e[_0x15b724]);}return _0x4baab8;},_0x301671=_0x4a721a(Object['keys'](_0x45cb3f)),_0xffcb19={},_0x5d7f55={};let _0x139945=0x15*-0xb6+-0x9*0x258+0x2406;if(_0x36ae05['mid']&&_0x36ae05['gid']){}else _0x36ae05={'message':_0x36ae05,'remote':_0x11cbb2,'mid':id['getMID'](_0x36ae05),'gid':_0x475077['gid']};for(const _0x22723c of _0x301671){const _0x39d636=_0x45cb3f[_0x22723c],_0x6cf7e9={'node':{'ip':_0x39d636['ip'],'port':_0x39d636['port']},'service':'gossip','method':'recv'};global['distributi'+'on']['local']['comm']['send']([_0x36ae05],_0x6cf7e9,(_0x2916ad,_0x22f437)=>{_0x2916ad?_0x5d7f55[_0x22723c]=_0x2916ad:_0xffcb19[_0x22723c]=_0x22f437,_0x139945+=-0x60e+-0x5e7*-0x1+-0x1*-0x28,_0x139945===_0x3f1a4e&&(_0x881258&&_0x881258(_0x5d7f55,_0xffcb19));});}});},'at':(_0x5f1dcb,_0x2946f3,_0x19cee4)=>{const _0x3853f1=setInterval(_0x2946f3,_0x5f1dcb);_0x19cee4&&_0x19cee4(null,_0x3853f1);},'del':(_0x544c82,_0x68fcde)=>{clearInterval(_0x544c82),_0x68fcde&&_0x68fcde(null,_0x544c82);}};};module['exports']=gossip;
|
|
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 groups=function(
|
|
9
|
+
const groups=function(_0x27bdae){const _0x30ce69={};return _0x30ce69['gid']=_0x27bdae['gid']||'global',{'put':(_0x15e8b2,_0x343fca,_0x36a777)=>{global['distributi'+'on'][_0x30ce69['gid']]['comm']['send']([_0x15e8b2,_0x343fca],{'service':'groups','method':'put'},_0x36a777);},'del':(_0x302f70,_0x2e5da9)=>{global['distributi'+'on'][_0x30ce69['gid']]['comm']['send']([_0x302f70],{'service':'groups','method':'del'},_0x2e5da9);},'get':(_0x1b2b65,_0x7f4fa)=>{global['distributi'+'on'][_0x30ce69['gid']]['comm']['send']([_0x1b2b65],{'service':'groups','method':'get'},_0x7f4fa);},'add':(_0x406ecb,_0x4d7114,_0x41529c)=>{global['distributi'+'on'][_0x30ce69['gid']]['comm']['send']([_0x406ecb,_0x4d7114],{'service':'groups','method':'add'},_0x41529c);},'rem':(_0x417a3e,_0xb9879f,_0xa28bb0)=>{global['distributi'+'on'][_0x30ce69['gid']]['comm']['send']([_0x417a3e,_0xb9879f],{'service':'groups','method':'rem'},_0xa28bb0);}};};module['exports']=groups;
|
|
10
10
|
/* eslint-enable */
|
package/distribution/all/mem.js
CHANGED
|
@@ -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 distribution=global['distributi'+'on'],util=distribution['util'],log=require('../util/lo'+'g');function getNode(
|
|
9
|
+
const distribution=global['distributi'+'on'],util=distribution['util'],log=require('../util/lo'+'g');function getNode(_0x26f3a6,_0x2b13cd,_0x4bfe72){typeof _0x2b13cd==='object'&&(_0x2b13cd=_0x2b13cd['key']),distribution[_0x26f3a6['gid']]['status']['get']('nid',(_0x3a6f7d,_0xf28e9a)=>{const _0x551470=Object['values'](_0xf28e9a),_0x4d8f22=util['id']['getID'](_0x2b13cd),_0x9115a0=_0x26f3a6['hash'](_0x4d8f22,_0x551470),_0x2884cf=_0x9115a0['substring'](-0xa18+0x17d8+0xb*-0x140,-0x209f+-0x8*0x232+0x1b*0x1dc);distribution['local']['groups']['get'](_0x26f3a6['gid'],(_0x5d4297,_0x570ecc)=>{const _0x2b2a6d=_0x570ecc[_0x2884cf];log('[mem\x20(getN'+'ode)]\x20conf'+'iguration:'+'\x20'+JSON['stringify'](_0x2b13cd)+'group:\x20'+JSON['stringify'](_0x570ecc)+'\x20node:\x20'+JSON['stringify'](_0x2b2a6d)+'nid:\x20'+JSON['stringify'](_0x9115a0)+'\x20sid:\x20'+JSON['stringify'](_0x2884cf)),_0x4bfe72(_0x2b2a6d);});});}function normalize(_0xaaad88,_0x2f9851){const _0x59c477={};_0xaaad88===null&&(_0xaaad88={});if(typeof _0xaaad88==='string')_0x59c477['key']=_0xaaad88,_0x59c477['gid']=_0x2f9851,_0x59c477['action']='put';else typeof _0xaaad88==='object'&&(_0x59c477['key']=_0xaaad88['key'],_0x59c477['gid']=_0xaaad88['gid']||_0x2f9851,_0x59c477['action']=_0xaaad88['action']||'put');return _0x59c477;};const mem=function(_0x38b43c){const _0x4bfab0={};return _0x4bfab0['gid']=_0x38b43c['gid']||'all',_0x4bfab0['hash']=_0x38b43c['hash']||util['id']['naiveHash'],{'get':(_0x539cfb,_0x3ca648)=>{if(!_0x539cfb){const _0x200e56=[{'key':null,'gid':_0x4bfab0['gid']}];distribution[_0x4bfab0['gid']]['comm']['send'](_0x200e56,{'service':'mem','method':'get'},(_0x42d008,_0x39c873)=>{const _0x476352=Object['values'](_0x39c873)['reduce']((_0x56930c,_0x4f3838)=>_0x56930c['concat'](_0x4f3838),[]);_0x3ca648(_0x42d008,_0x476352);});return;}_0x539cfb=normalize(_0x539cfb,_0x4bfab0['gid']),getNode(_0x4bfab0,_0x539cfb,_0x5624e1=>{const _0x4867ef=[_0x539cfb],_0x550997={'service':'mem','method':'get','node':_0x5624e1};log('[all.mem.g'+'et]\x20config'+'uration:\x20'+JSON['stringify'](_0x539cfb)+'\x20node:\x20'+JSON['stringify'](global['nodeConfig'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x5624e1)),distribution['local']['comm']['send'](_0x4867ef,_0x550997,_0x3ca648);});},'put':(_0x1076c5,_0x14a720,_0x38b91b)=>{_0x14a720=_0x14a720||util['id']['getID'](_0x1076c5),_0x14a720=normalize(_0x14a720,_0x4bfab0['gid']),getNode(_0x4bfab0,_0x14a720,_0x173faa=>{const _0x318f69=[_0x1076c5,_0x14a720],_0x5ae861={'service':'mem','method':'put','node':_0x173faa};log('[all.mem.p'+'ut]\x20state:'+'\x20'+JSON['stringify'](_0x1076c5)+('configurat'+'ion:\x20')+JSON['stringify'](_0x14a720)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x173faa)),distribution['local']['comm']['send'](_0x318f69,_0x5ae861,_0x38b91b);});},'del':(_0x52f236,_0x2e1b23)=>{getNode(_0x4bfab0,_0x52f236,_0x35ab55=>{const _0x4d1b6a=[{'key':_0x52f236,'gid':_0x4bfab0['gid']}],_0x4b2839={'service':'mem','method':'del','node':_0x35ab55};distribution['local']['comm']['send'](_0x4d1b6a,_0x4b2839,_0x2e1b23);});},'reconf':(_0x1c0fef,_0x5d9a02)=>{distribution[_0x4bfab0['gid']]['mem']['get'](null,(_0x1ee8d4,_0x4375c9)=>{distribution[_0x4bfab0['gid']]['status']['get']('nid',(_0x1cbe31,_0x55e755)=>{const _0x181554=Object['values'](_0x55e755),_0x551028=Object['values'](_0x1c0fef)['map'](_0x5173d1=>util['id']['getNID'](_0x5173d1));log('[mem.recon'+'f\x20received'+'\x20'+_0x4375c9['length']+('\x20keys\x20from'+'\x20')+_0x55e755['length']+'\x20nodes');let _0x5eabca=0x19d1+-0xd1e+0xcb3*-0x1;const _0x54cbbe=()=>{_0x5eabca===_0x4375c9['length']&&_0x5d9a02();};if(_0x4375c9['length']===-0xd*0xd4+0x1ec*-0x1+0xcb0){_0x5d9a02();return;}for(const _0x27385f of _0x4375c9){const _0x57571b=util['id']['getID'](_0x27385f),_0x5539d0=_0x4bfab0['hash'](_0x57571b,_0x551028),_0x3e1524=_0x4bfab0['hash'](_0x57571b,_0x181554);log('[mem.recon'+'f]\x20old\x20nid'+':\x20'+_0x5539d0+'\x20new\x20nid:\x20'+_0x3e1524);if(_0x5539d0===_0x3e1524){_0x5eabca++,_0x54cbbe();continue;}const _0x392187=_0x1c0fef[_0x5539d0['substring'](-0x1*0x12bf+-0x4a3*0x8+0x37d7,0xd5*-0x3+-0xcf5+0xf79)],_0x4e2910=[{'key':_0x27385f,'gid':_0x4bfab0['gid']}],_0x4eef53={'service':'mem','method':'del','node':_0x392187};log('[mem.recon'+'f]\x20deletin'+'g\x20key\x20'+_0x27385f+'\x20from\x20'+JSON['stringify'](_0x4eef53)),distribution['local']['comm']['send'](_0x4e2910,_0x4eef53,(_0x216c58,_0x5a1e0a)=>{distribution[_0x4bfab0['gid']]['mem']['put'](_0x5a1e0a,_0x27385f,(_0xa9f57a,_0x5c1d7a)=>{_0x5eabca++,_0x54cbbe();});});}});});}};};module['exports']=mem;
|
|
10
10
|
/* eslint-enable */
|
package/distribution/all/mr.js
CHANGED
|
@@ -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 distribution=require('../../dist'+'ribution'),id=distribution['util']['id']
|
|
9
|
+
const distribution=require('../../dist'+'ribution'),id=distribution['util']['id'];function mr(_0x268e55={'gid':'all'}){const _0x6c6004={};_0x6c6004['gid']=_0x268e55['gid'];function _0x2bd47b(_0x2aa17d,_0x28f51e){const _0x45fd82=id['getSID'](_0x2aa17d),_0x5b2961={'mapper':_0x2aa17d['map'],'reducer':_0x2aa17d['reduce'],'map':function(_0x49f03e,_0x3f8333,_0x447526,_0x1577ba=()=>{}){if(_0x49f03e['length']==0x3c0+0x1546+-0x1906)_0x1577ba(null,{});else{const _0x2a713a=[];let _0x722c0e=0xb20*-0x1+0x1*0x1a26+-0xf06*0x1;_0x49f03e['forEach'](_0x8babd8=>{distribution[_0x3f8333]['store']['get'](_0x8babd8,(_0x3e9aa5,_0x1b0aa8)=>{_0x722c0e++;const _0x1b5fe4=this['mapper'](_0x8babd8,_0x1b0aa8);Array['isArray'](_0x1b5fe4)?_0x2a713a['push'](..._0x1b5fe4):_0x2a713a['push'](_0x1b5fe4),_0x722c0e==_0x49f03e['length']&&distribution['local']['store']['put'](_0x2a713a,_0x447526+'_map',(_0x36b568,_0x44ebfb)=>{_0x1577ba(_0x36b568,_0x2a713a);});});});}},'shuffle':function(_0x4a816f,_0x47c33c,_0x1b5f4d=function(){}){distribution['local']['store']['get'](_0x47c33c+'_map',(_0x59319a,_0x14ddd6)=>{if(!_0x59319a){let _0x4c3680=0x5fe+-0x2603+0x2005;_0x14ddd6['forEach'](_0x14a7c5=>{const [_0x22412e]=Object['keys'](_0x14a7c5);distribution[_0x4a816f]['mem']['put'](_0x14a7c5[_0x22412e],{'key':_0x22412e,'action':'append'},(_0x9c6a9b,_0x3afd32)=>{_0x4c3680++,_0x4c3680==_0x14ddd6['length']&&_0x1b5f4d(null,_0x14ddd6);});});}else _0x1b5f4d(_0x59319a,{});});},'reduce':function(_0xeeee1f,_0x17c32a,_0x21d61e){distribution['local']['mem']['get']({'key':null,'gid':_0xeeee1f},(_0x5677ed,_0x2057e4)=>{let _0x3e95cc=[],_0x4ca1b2=0x250*0xc+-0x24b5+0x8f5;_0x2057e4['length']==0x136*-0xd+-0xd62+0x1d20&&_0x21d61e(null,null),_0x2057e4['forEach'](_0x1e3bc0=>distribution['local']['mem']['get']({'key':_0x1e3bc0,'gid':_0xeeee1f},(_0x5a2fad,_0x17234d)=>{const _0x24272a=this['reducer'](_0x1e3bc0,_0x17234d);_0x3e95cc=_0x3e95cc['concat'](_0x24272a),_0x4ca1b2++,_0x4ca1b2==_0x2057e4['length']&&_0x21d61e(null,_0x3e95cc);}));});}},_0x20bb11=function(_0x1842ed,_0x37d2d4){const _0x36b480={};return Object['keys'](_0x37d2d4)['forEach'](_0x571a84=>{_0x36b480[_0x571a84]=[];}),_0x1842ed['forEach'](_0x169228=>{const _0x30d5c5=id['getID'](_0x169228),_0x53b5b2=id['naiveHash'](_0x30d5c5,Object['keys'](_0x37d2d4));_0x36b480[_0x53b5b2]['push'](_0x169228);}),_0x36b480;};distribution[_0x6c6004['gid']]['routes']['put'](_0x5b2961,'mr-'+_0x45fd82,(_0x2eaba0,_0x28a5c1)=>{distribution['local']['groups']['get'](_0x6c6004['gid'],(_0x2c64b3,_0x4092af)=>{const _0x45cdf2=_0x20bb11(_0x2aa17d['keys'],_0x4092af);let _0xe9489d=0x2634+-0xe78*0x1+-0x17bc;const _0x12d003=Object['keys'](_0x4092af)['length'],_0x3d12e5={'service':'mr-'+_0x45fd82,'method':'map'};for(const _0x3e246e in _0x4092af){_0x3d12e5['node']=_0x4092af[_0x3e246e];const _0xaccd98=[_0x45cdf2[_0x3e246e],_0x6c6004['gid'],_0x45fd82];distribution['local']['comm']['send'](_0xaccd98,_0x3d12e5,(_0x5f1fb4,_0x5d0dcb)=>{++_0xe9489d;if(_0xe9489d==_0x12d003){const _0x5a34c1={'service':'mr-'+_0x45fd82,'method':'shuffle'};distribution[_0x6c6004['gid']]['comm']['send']([_0x6c6004['gid'],_0x45fd82],_0x5a34c1,(_0x17e26c,_0x3f0000)=>{const _0x190e39={'service':'mr-'+_0x45fd82,'method':'reduce'};distribution[_0x6c6004['gid']]['comm']['send']([_0x6c6004['gid'],_0x45fd82],_0x190e39,(_0x35af5e,_0x112f24)=>{let _0xbdc3cf=[];for(const _0x434cc6 of Object['values'](_0x112f24)){_0x434cc6!==null&&(_0xbdc3cf=_0xbdc3cf['concat'](_0x434cc6));}_0x28f51e(null,_0xbdc3cf);return;distribution[_0x6c6004['gid']]['routes']['rem']('mr-'+_0x45fd82,(_0xa9864,_0x37a160)=>{});});});}});}});});}return{'exec':_0x2bd47b};};module['exports']=mr;
|
|
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
|
-
|
|
9
|
+
function routes(_0x31dc7b){const _0x2cf96f={};_0x2cf96f['gid']=_0x31dc7b['gid']||'global';function _0x19bf63(_0x4531dd,_0x25452c,_0x350fc7=()=>{}){global['distributi'+'on'][_0x2cf96f['gid']]['comm']['send']([_0x4531dd,_0x25452c],{'service':'routes','method':'put'},_0x350fc7);}function _0x5185d1(_0x475546,_0x2cc92a,_0x42a3a6=()=>{}){global['distributi'+'on'][_0x2cf96f['gid']]['comm']['send']([_0x2cc92a],{'service':'routes','method':'rem'},_0x42a3a6);}return{'put':_0x19bf63,'rem':_0x5185d1};}module['exports']=routes;
|
|
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 status=function(
|
|
9
|
+
const status=function(_0x2f9f6d){const _0x595f09={};return _0x595f09['gid']=_0x2f9f6d['gid']||'global',{'get':(_0x4db342,_0x50138c)=>{const _0x30e3b8=[_0x4db342],_0x417d50={'service':'status','method':'get'};global['distributi'+'on'][_0x595f09['gid']]['comm']['send'](_0x30e3b8,_0x417d50,(_0x3022e2,_0x1e2350)=>{switch(_0x4db342){case'heapTotal':const _0x5897f9=Object['values'](_0x1e2350)['reduce']((_0x29a1fd,_0x3f5cbb)=>{return _0x29a1fd+_0x3f5cbb;},-0xb0*-0x30+0x14d2+-0x35d2);_0x50138c(_0x3022e2,_0x5897f9);break;case'nid':const _0x319283=Object['values'](_0x1e2350)['reduce']((_0x2e3ed9,_0x337889)=>{return _0x2e3ed9['concat'](_0x337889);},[]);_0x50138c(_0x3022e2,_0x319283);break;default:_0x50138c(_0x3022e2,_0x1e2350);break;}});},'spawn':(_0x59acb8,_0x4e1380)=>{_0x4e1380=_0x4e1380||function(){},global['distributi'+'on']['local']['status']['spawn'](_0x59acb8,(_0x346449,_0x2ea56c)=>{_0x346449?_0x4e1380(_0x346449):global['distributi'+'on']['local']['groups']['add'](_0x595f09['gid'],_0x59acb8,()=>{_0x4e1380(null,_0x2ea56c);}),global['distributi'+'on'][_0x595f09['gid']]['comm']['send']([_0x595f09['gid'],_0x59acb8],{'service':'groups','method':'add'},()=>{});});},'stop':_0x2f11b1=>{global['distributi'+'on'][_0x595f09['gid']]['comm']['send']([],{'service':'status','method':'stop'},_0x2f11b1);}};};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 distribution=global['distributi'+'on'],util=distribution['util'],log=require('../util/lo'+'g');function getNode(
|
|
9
|
+
const distribution=global['distributi'+'on'],util=distribution['util'],log=require('../util/lo'+'g');function getNode(_0x53648e,_0x3b2bb8,_0x41ef09){distribution[_0x53648e['gid']]['status']['get']('nid',(_0x1c1059,_0x3edfa4)=>{const _0x4ea753=Object['values'](_0x3edfa4),_0x187076=util['id']['getID'](_0x3b2bb8),_0x3a3c2b=_0x53648e['hash'](_0x187076,_0x4ea753),_0x407c8a=_0x3a3c2b['substring'](0x12b7+-0x14e9*-0x1+0x13d0*-0x2,0x8a9+-0x253f+-0x989*-0x3);distribution['local']['groups']['get'](_0x53648e['gid'],(_0x3e3f75,_0x2b5e51)=>{const _0x4f5cc1=_0x2b5e51[_0x407c8a];_0x41ef09(_0x4f5cc1);});});}const store=function(_0x4e4ec0){const _0x197a1a={};return _0x197a1a['gid']=_0x4e4ec0['gid']||'all',_0x197a1a['hash']=_0x4e4ec0['hash']||util['id']['naiveHash'],{'get':(_0xa906dd,_0x3ca1d3)=>{if(!_0xa906dd){const _0x2d2a59=[{'key':null,'gid':_0x197a1a['gid']}];distribution[_0x197a1a['gid']]['comm']['send'](_0x2d2a59,{'service':'store','method':'get'},(_0x2ed589,_0x375d9d)=>{log('[all.store'+'.get\x20null\x20'+'given\x20as\x20k'+'ey.\x20keys:\x20'+JSON['stringify'](_0x375d9d)+'\x20errors:\x20'+JSON['stringify'](_0x2ed589));const _0x1012e9=Object['values'](_0x375d9d)['reduce']((_0x243e88,_0x26ac89)=>_0x243e88['concat'](_0x26ac89),[]);_0x3ca1d3(_0x2ed589,_0x1012e9);});return;}getNode(_0x197a1a,_0xa906dd,_0x133f90=>{const _0x5ebaee=[{'key':_0xa906dd,'gid':_0x197a1a['gid']}],_0x3eeb9b={'service':'store','method':'get','node':_0x133f90};distribution['local']['comm']['send'](_0x5ebaee,_0x3eeb9b,_0x3ca1d3);});},'put':(_0x4d3563,_0x3b6ade,_0x505a1d)=>{_0x3b6ade=_0x3b6ade||util['id']['getID'](_0x4d3563),getNode(_0x197a1a,_0x3b6ade,_0x2affd0=>{const _0x56d97c=[_0x4d3563,{'key':_0x3b6ade,'gid':_0x197a1a['gid']}],_0x2bd4d5={'service':'store','method':'put','node':_0x2affd0};log('[all.store'+'.put]:\x20(gi'+'d:\x20'+_0x197a1a['gid']+')\x20'+JSON['stringify'](_0x4d3563)+'\x20'+JSON['stringify'](_0x3b6ade)+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x2affd0)),distribution['local']['comm']['send'](_0x56d97c,_0x2bd4d5,_0x505a1d);});},'del':(_0x3f51e6,_0x43084e)=>{getNode(_0x197a1a,_0x3f51e6,_0x74d061=>{const _0x413627=[{'key':_0x3f51e6,'gid':_0x197a1a['gid']}],_0x4e7f92={'service':'store','method':'del','node':_0x74d061};distribution['local']['comm']['send'](_0x413627,_0x4e7f92,_0x43084e);});},'reconf':(_0x46e3ce,_0xb743e2)=>{distribution[_0x197a1a['gid']]['store']['get'](null,(_0xc413ea,_0x227b58)=>{distribution[_0x197a1a['gid']]['status']['get']('nid',(_0x21701d,_0x330ed8)=>{const _0x3225c9=Object['values'](_0x330ed8),_0x4ba48a=Object['values'](_0x46e3ce)['map'](_0xfef2bd=>util['id']['getNID'](_0xfef2bd));log('[store.rec'+'onf\x20receiv'+'ed\x20'+_0x227b58['length']+('\x20keys\x20from'+'\x20')+_0x330ed8['length']+'\x20nodes');let _0x32a5fa=0xb59+0x257f+-0xc*0x412;const _0xd8eced=()=>{_0x32a5fa===_0x227b58['length']&&_0xb743e2();};if(_0x227b58['length']===0x1d7d*0x1+-0x5ca+-0x17b3){_0xb743e2();return;}for(const _0x3ee72f of _0x227b58){const _0x4758c5=util['id']['getID'](_0x3ee72f),_0x3e2114=_0x197a1a['hash'](_0x4758c5,_0x4ba48a),_0x517751=_0x197a1a['hash'](_0x4758c5,_0x3225c9);log('[store.rec'+'onf]\x20old\x20n'+'id:\x20'+_0x3e2114+'\x20new\x20nid:\x20'+_0x517751);if(_0x3e2114===_0x517751){_0x32a5fa++,_0xd8eced();continue;}const _0x57e5ec=_0x46e3ce[_0x3e2114['substring'](0x15ff+-0x8e0*0x3+0x4a1,-0x1*0x170c+0x144e+0x2c3)],_0x461227=[{'key':_0x3ee72f,'gid':_0x197a1a['gid']}],_0x1eefb6={'service':'store','method':'del','node':_0x57e5ec};log('[store.rec'+'onf]\x20delet'+'ing\x20key\x20'+_0x3ee72f+'\x20from\x20'+JSON['stringify'](_0x1eefb6)),distribution['local']['comm']['send'](_0x461227,_0x1eefb6,(_0x552827,_0x4f086f)=>{distribution[_0x197a1a['gid']]['store']['put'](_0x4f086f,_0x3ee72f,(_0x3b5bc3,_0x9ef8f5)=>{_0x32a5fa++,_0xd8eced();});});}});});}};};module['exports']=store;
|
|
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 http=require('http'),serialization=require('../util/se'+'rializatio'+'n'),log=require('../util/lo'+'g')
|
|
9
|
+
const http=require('http'),serialization=require('../util/se'+'rializatio'+'n'),log=require('../util/lo'+'g');function send(_0x254632,_0x57d86e,_0x3b93bd=()=>{}){log('[comm.send'+']:\x20Sending'+'\x20'+JSON['stringify'](_0x254632)+'to\x20'+_0x57d86e['service']+':'+_0x57d86e['method']+'\x20on\x20'+_0x57d86e['node']['ip']+':'+_0x57d86e['node']['port']);if(!_0x254632 instanceof Array)throw new Error('Message\x20mu'+'st\x20be\x20an\x20a'+'rray');const _0x16cf3f=_0x57d86e['node'],_0x2bf455=_0x57d86e['service'],_0x5877d7=_0x57d86e['method'],_0x1bb10f=serialization['serialize'](_0x254632),_0x316fdd={'hostname':_0x16cf3f['ip'],'port':_0x16cf3f['port'],'path':'/'+_0x2bf455+'/'+_0x5877d7,'method':'PUT','headers':{'Content-Type':'applicatio'+'n/json','Content-Length':Buffer['byteLength'](_0x1bb10f)}},_0x18c69a=http['request'](_0x316fdd,_0x4f406e=>{let _0x2b2218='';_0x4f406e['on']('data',function(_0x44eb34){_0x2b2218+=_0x44eb34;}),_0x4f406e['on']('end',function(){_0x3b93bd&&_0x3b93bd(...serialization['deserializ'+'e'](_0x2b2218));}),_0x4f406e['on']('error',function(_0x20919a){_0x3b93bd&&_0x3b93bd(new Error('Error\x20on\x20r'+'esponse'));});});_0x18c69a['on']('error',function(_0x5e99d9){_0x3b93bd&&_0x3b93bd(new Error(_0x5e99d9));}),_0x18c69a['write'](_0x1bb10f),_0x18c69a['end']();}module['exports']={'send':send};
|
|
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 gossip={},messageStore={'messages':[],'push':function(
|
|
9
|
+
const gossip={},messageStore={'messages':[],'push':function(_0x1e4a08){const _0x4131d1=0x1424+-0x1*0xb75+0x8a5*-0x1;messageStore['messages']['push'](_0x1e4a08),messageStore['messages']['length']>_0x4131d1&&messageStore['messages']['shift']();},'has':function(_0x4e4e3d){return messageStore['messages']['includes'](_0x4e4e3d);}};gossip['recv']=function(_0x3c47a2,_0x1564eb){_0x1564eb=_0x1564eb||function(){};const _0x5b434c=_0x3c47a2['message'],_0x47c1b9=_0x3c47a2['remote'],_0x2de7ac=_0x3c47a2['mid'],_0x239dc2=_0x3c47a2['gid'];if(messageStore['has'](_0x2de7ac)){_0x1564eb(new Error('Message\x20al'+'ready\x20rece'+'ived'));return;}global['distributi'+'on'][_0x239dc2]['gossip']['send'](_0x3c47a2,_0x47c1b9),messageStore['push'](_0x2de7ac),_0x47c1b9['node']={'ip':global['nodeConfig']['ip'],'port':global['nodeConfig']['port']},global['distributi'+'on']['local']['comm']['send'](_0x5b434c,_0x47c1b9,(_0xe1360c,_0x59c2c0)=>{_0x1564eb(_0xe1360c,_0x59c2c0);});},module['exports']=gossip;
|
|
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 id=require('../util/id')
|
|
9
|
+
const id=require('../util/id'),groupsStore=new Map();groupsStore['all']={};const groups={};groups['get']=function(_0x4f24b4,_0x46442a){_0x46442a=_0x46442a||function(){},_0x4f24b4 in groupsStore?_0x46442a(null,groupsStore[_0x4f24b4]):_0x46442a(new Error('Group\x20'+_0x4f24b4+'\x20not\x20found'));},groups['put']=function(_0x5d6a20,_0x5979cf,_0x746bcf){_0x5979cf=_0x5979cf||{},typeof _0x5d6a20==='string'&&(_0x5d6a20={'gid':_0x5d6a20}),groupsStore[_0x5d6a20['gid']]=_0x5979cf,Object['keys'](_0x5979cf)['forEach'](_0x296273=>{groupsStore['all'][id['getSID'](_0x5979cf[_0x296273])]=_0x5979cf[_0x296273];}),global['distributi'+'on'][_0x5d6a20['gid']]={},global['distributi'+'on'][_0x5d6a20['gid']]['status']=require('../all/sta'+'tus')(_0x5d6a20),global['distributi'+'on'][_0x5d6a20['gid']]['comm']=require('../all/com'+'m')(_0x5d6a20),global['distributi'+'on'][_0x5d6a20['gid']]['gossip']=require('../all/gos'+'sip')(_0x5d6a20),global['distributi'+'on'][_0x5d6a20['gid']]['groups']=require('../all/gro'+'ups')(_0x5d6a20),global['distributi'+'on'][_0x5d6a20['gid']]['routes']=require('../all/rou'+'tes')(_0x5d6a20),global['distributi'+'on'][_0x5d6a20['gid']]['mem']=require('../all/mem')(_0x5d6a20),global['distributi'+'on'][_0x5d6a20['gid']]['store']=require('../all/sto'+'re')(_0x5d6a20),global['distributi'+'on'][_0x5d6a20['gid']]['mr']=require('../all/mr')(_0x5d6a20),_0x746bcf(null,_0x5979cf);},groups['del']=function(_0x14cfb8,_0x54cfe0){if(_0x14cfb8 in groupsStore){const _0x592791=groupsStore[_0x14cfb8];delete groupsStore[_0x14cfb8],_0x54cfe0(null,_0x592791);}else _0x54cfe0(new Error('Group\x20'+_0x14cfb8+'\x20not\x20found'));},groups['add']=function(_0x4c06d6,_0x2ac800,_0x256fa4){_0x256fa4=_0x256fa4||function(){},_0x4c06d6 in groupsStore?(!groupsStore[_0x4c06d6]&&(groupsStore[_0x4c06d6]={}),groupsStore[_0x4c06d6][id['getSID'](_0x2ac800)]=_0x2ac800,groupsStore['all'][id['getSID'](_0x2ac800)]=_0x2ac800,_0x256fa4&&_0x256fa4(null,groupsStore[_0x4c06d6])):_0x256fa4&&_0x256fa4(new Error('Group\x20'+_0x4c06d6+'\x20not\x20found'));},groups['rem']=function(_0x40e393,_0x3f6d29,_0x4ba908){_0x4ba908=_0x4ba908||function(){},_0x40e393 in groupsStore?(delete groupsStore[_0x40e393][_0x3f6d29],delete groupsStore['all'][_0x3f6d29],_0x4ba908(null,groupsStore[_0x40e393])):_0x4ba908(new Error('Group\x20'+_0x40e393+'\x20not\x20found'));},module['exports']=groups;
|
|
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 id=require('../util/id'),log=require('../util/lo'+'g'),kvStore={'store':new Map(),'get'(
|
|
9
|
+
const id=require('../util/id'),log=require('../util/lo'+'g'),kvStore={'store':new Map(),'get'(_0xd93ee){if(!this['store'][_0xd93ee['gid']])return undefined;return this['store'][_0xd93ee['gid']][_0xd93ee['key']];},'put'(_0x45027e,_0x4e8218){!this['store'][_0x45027e['gid']]&&(this['store'][_0x45027e['gid']]=new Map()),this['store'][_0x45027e['gid']][_0x45027e['key']]=_0x4e8218;},'append'(_0x1a77b9,_0x1c3d04){!this['get'](_0x1a77b9)&&this['put'](_0x1a77b9,[]),!Array['isArray'](this['get'](_0x1a77b9))&&this['put'](_0x1a77b9,[this['get'](_0x1a77b9)]),Array['isArray'](_0x1c3d04)?this['put'](_0x1a77b9,this['get'](_0x1a77b9)['concat'](_0x1c3d04)):this['store'][_0x1a77b9['gid']][_0x1a77b9['key']]['push'](_0x1c3d04);},'del'(_0x226963){if(!this['store'][_0x226963['gid']])return undefined;const _0x417f6e=this['store'][_0x226963['gid']][_0x226963['key']];return delete this['store'][_0x226963['gid']][_0x226963['key']],_0x417f6e;},'toString'(){let _0x42998c='';for(const _0x38089 in this['store']){_0x42998c+=_0x38089+':\x20'+JSON['stringify'](this['store'][_0x38089]);}return _0x42998c;}};function normalize(_0x263abd){const _0x28531d={};_0x263abd===null&&(_0x263abd={});if(typeof _0x263abd==='string')_0x28531d['key']=_0x263abd,_0x28531d['gid']='local',_0x28531d['action']='put';else typeof _0x263abd==='object'&&(_0x28531d['key']=_0x263abd['key'],_0x28531d['gid']=_0x263abd['gid'],_0x28531d['action']=_0x263abd['action']);return _0x28531d;};const mem={};mem['put']=function(_0x3b4691,_0x295b4d,_0x20c572){log('[mem.put]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x295b4d)+'state:\x20'+JSON['stringify'](_0x3b4691)+'\x20store:\x20'+kvStore['toString']()),_0x20c572=_0x20c572||function(){},_0x295b4d=normalize(_0x295b4d),_0x295b4d['key']=_0x295b4d['key']||id['getID'](_0x3b4691),_0x295b4d['gid']=_0x295b4d['gid']||'local',_0x295b4d['action']=_0x295b4d['action']||'put',kvStore[_0x295b4d['action']](_0x295b4d,_0x3b4691),log('[mem.put]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']()),_0x20c572&&_0x20c572(null,_0x3b4691);},mem['get']=function(_0x1d9e8e,_0x296b9a){log('[mem.get]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x1d9e8e)+'\x20store:\x20'+kvStore['toString']()),_0x296b9a=_0x296b9a||function(){},_0x1d9e8e=normalize(_0x1d9e8e),_0x1d9e8e['gid']=_0x1d9e8e['gid']||'local';if(!_0x1d9e8e['key']){let _0x31046b=kvStore['store'][_0x1d9e8e['gid']]||{};_0x31046b=Object['keys'](_0x31046b),_0x296b9a(null,_0x31046b);return;}const _0x11af33=kvStore['get'](_0x1d9e8e);_0x11af33?_0x296b9a(null,_0x11af33):_0x296b9a(new Error('Memory\x20key'+'\x20\x22'+_0x1d9e8e['key']+('\x22\x20\x0a\x20\x20\x20\x20\x20\x20\x20'+'\x20not\x20found'+'\x20for\x20')+_0x1d9e8e['gid']+'\x27s\x20store'));},mem['del']=function(_0x37c1bd,_0xbad4cf){log('[mem.del]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x37c1bd)+'\x20store:\x20'+kvStore['toString']()),_0xbad4cf=_0xbad4cf||function(){},_0x37c1bd=normalize(_0x37c1bd);const _0x59e224=kvStore['del'](_0x37c1bd);log('[mem.del]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']()),_0x59e224?_0xbad4cf(null,_0x59e224):_0xbad4cf(new Error('Memory\x20key'+'\x20\x22'+_0x37c1bd['key']+('\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+'not\x20found\x20'+'for\x20')+_0x37c1bd['gid']+'\x27s\x20store'));},module['exports']=mem;
|
|
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 http=require('http'),url=require('url'),log=require('../util/lo'+'g'),serialization=require('../util/se'+'rializatio'+'n');function isValidBody(
|
|
9
|
+
const http=require('http'),url=require('url'),log=require('../util/lo'+'g'),serialization=require('../util/se'+'rializatio'+'n');function isValidBody(_0x41792c){if(_0x41792c['length']===0x1b3+-0xbf8*-0x2+-0x19a3)return new Error('No\x20body');try{_0x41792c=JSON['parse'](_0x41792c);}catch(_0x3e40db){return _0x3e40db;}return undefined;}function endRequest(_0x25f287,_0x5027a3){_0x25f287['end'](serialization['serialize']([_0x5027a3]));}const start=function(_0x4c056c){const _0x5bcb25=http['createServ'+'er']((_0x159f99,_0x329caf)=>{if(_0x159f99['method']!=='PUT'){_0x329caf['end'](serialization['serialize'](new Error('Method\x20not'+'\x20allowed!')));return;}const _0x47ba5d=url['parse'](_0x159f99['url'])['pathname'],[,_0x20aef1,_0x45c8ac]=_0x47ba5d['split']('/');log('[server]\x20g'+'ot\x20request'+'\x20'+_0x20aef1+':'+_0x45c8ac+'\x20from\x20'+_0x159f99['connection']['remoteAddr'+'ess']);let _0xdbb187=[];_0x159f99['on']('data',_0x51179f=>{_0xdbb187['push'](_0x51179f);}),_0x159f99['on']('end',()=>{_0xdbb187=Buffer['concat'](_0xdbb187)['toString']();let _0x3c1562;if(_0x3c1562=isValidBody(_0xdbb187)){endRequest(_0x329caf,_0x3c1562);return;}_0xdbb187=JSON['parse'](_0xdbb187),_0xdbb187=serialization['deserializ'+'e'](_0xdbb187);const _0x2c8ef0=_0xdbb187;!Array['isArray'](_0x2c8ef0)&&endRequest(_0x329caf,new Error('Invalid\x20ar'+'gument\x20typ'+'e,\x20expecte'+'d\x20array,\x20g'+'ot\x20'+typeof _0x2c8ef0));const _0x130beb=_0x20aef1;global['distributi'+'on']['local']['routes']['get'](_0x130beb,(_0x52b93a,_0x4b0d62)=>{const _0x2e769a=(_0x1e4755,_0x2e6e36)=>{_0x329caf['end'](serialization['serialize']([_0x1e4755,_0x2e6e36]));};if(_0x52b93a){_0x2e769a(_0x52b93a);return;}if(!_0x4b0d62[_0x45c8ac]){_0x2e769a(new Error('Method\x20'+_0x45c8ac+('\x20not\x20found'+'\x20in\x20servic'+'e\x20')+_0x130beb));return;}log('[server]\x20\x20'+'Calling\x20se'+'rvice:\x20'+_0x130beb+':'+_0x45c8ac+('\x20with\x20args'+':\x20')+JSON['stringify'](_0x2c8ef0));_0x2c8ef0['length']===0x8fe+0xc73*0x2+-0x6c7*0x5&&_0x4b0d62[_0x45c8ac]['length']===0x1f42+-0x21*0x44+-0x167b&&_0x2c8ef0['push'](undefined);try{_0x4b0d62[_0x45c8ac](..._0x2c8ef0,_0x2e769a);}catch(_0x305022){_0x2e769a(_0x305022);}});});});_0x5bcb25['listen'](global['nodeConfig']['port'],global['nodeConfig']['ip'],()=>{log('Server\x20run'+'ning\x20at\x20ht'+'tp://'+global['nodeConfig']['ip']+':'+global['nodeConfig']['port']+'/'),global['distributi'+'on']['node']['server']=_0x5bcb25,_0x4c056c(_0x5bcb25);}),_0x5bcb25['on']('error',_0x13ff4b=>{log('Server\x20err'+'or:\x20'+_0x13ff4b);throw _0x13ff4b;});};module['exports']={'start':start};
|
|
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()
|
|
9
|
+
const log=require('../util/lo'+'g'),routesStore=new Map();function get(_0x448589,_0x55d83f=()=>{}){log('[routes.ge'+'t]\x20Getting'+'\x20service:\x20'+_0x448589);if(!_0x55d83f)return;if(_0x448589 in routesStore){log('[routes.ge'+'t]\x20Found\x20s'+'ervice:\x20'+_0x448589);const _0x58bd39=routesStore[_0x448589];_0x55d83f(null,_0x58bd39);}else{const _0x5bd949=global['toLocal']['get'](_0x448589);_0x5bd949?(log('[routes.ge'+'t]\x20Found\x20R'+'PC:\x20'+_0x448589),_0x55d83f(null,{'call':_0x5bd949})):_0x55d83f(new Error('Service\x20'+_0x448589+('\x20not\x20found'+'\x20in\x20routes')));}}function put(_0x23ea1a,_0xf5250a,_0x2d552a){log('[routes.pu'+'t]\x20Putting'+'\x20service:\x20'+_0xf5250a),routesStore[_0xf5250a]=_0x23ea1a;_0x2d552a&&_0x2d552a(null,_0xf5250a);;}function rem(_0xef4a40,_0x255f1e){const _0x2fad33=routesStore[_0xef4a40];delete routesStore[_0xef4a40],_0x255f1e(null,_0x2fad33);};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 id=require('../util/id'),log=require('../util/lo'+'g'),status={};global['moreStatus']={'sid':id['getSID'](global['nodeConfig']),'nid':id['getNID'](global['nodeConfig']),'counts':0x0},status['get']=function(
|
|
9
|
+
const id=require('../util/id'),log=require('../util/lo'+'g'),status={};global['moreStatus']={'sid':id['getSID'](global['nodeConfig']),'nid':id['getNID'](global['nodeConfig']),'counts':0x0},status['get']=function(_0x1be8dc,_0x4c0a93){_0x4c0a93=_0x4c0a93||function(){};if(_0x1be8dc in global['nodeConfig']){_0x4c0a93(null,global['nodeConfig'][_0x1be8dc]);return;}if(_0x1be8dc in global['moreStatus']){_0x4c0a93(null,global['moreStatus'][_0x1be8dc]);return;}if(_0x1be8dc==='heapTotal'){_0x4c0a93(null,process['memoryUsag'+'e']()['heapTotal']);return;}if(_0x1be8dc==='heapUsed'){_0x4c0a93(null,process['memoryUsag'+'e']()['heapUsed']);return;}_0x4c0a93(new Error('Status\x20key'+'\x20not\x20found'));};const path=require('path'),{spawn}=require('child_proc'+'ess'),wire=require('../util/wi'+'re'),createSpawnedCb=function(_0x2879fd,_0x27dd3e){const _0x14c6a3='\x0a\x20\x20\x20\x20let\x20o'+'nStart\x20=\x20'+_0x2879fd['toString']()+(';\x0a\x0a\x20\x20\x20\x20let'+'\x20callbackR'+'PC\x20=\x20')+wire['createRPC'](wire['toAsync'](_0x27dd3e))['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(_0x14c6a3);};status['spawn']=function(_0x20a828,_0x1e970c){const _0x428b72=_0x20a828;_0x428b72['onStart']=_0x428b72['onStart']||function(){};if(!_0x428b72['port']||!_0x428b72['ip']){_0x1e970c(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'](_0x428b72)),_0x428b72['onStart']=createSpawnedCb(_0x428b72['onStart'],_0x1e970c);const _0x50ef78=path['join'](__dirname,'../../dist'+'ribution.j'+'s'),_0x4b345b=spawn('node',[_0x50ef78,'--config',global['distributi'+'on']['util']['serialize'](_0x428b72)],{'detached':!![],'stdio':'inherit'});_0x4b345b;},status['stop']=function(_0x1c7ed2){_0x1c7ed2=_0x1c7ed2||function(){},_0x1c7ed2(null,global['nodeConfig']),log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),global['distributi'+'on']['node']['server']['close'](),process['exit'](0x11*0x10b+-0x1*-0x2335+-0x34f0);},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 fs=require('fs'),path=require('path'),id=require('../util/id'),serialization=require('../util/se'+'rializatio'+'n'),log=require('../util/lo'+'g'),baseFolder=path['join'](__dirname,'../../stor'+'e');!fs['existsSync'](baseFolder)&&fs['mkdirSync'](baseFolder);!fs['existsSync'](baseFolder+'/s-'+global['moreStatus']['sid'])&&fs['mkdirSync'](baseFolder+'/s-'+global['moreStatus']['sid']);function normalize(
|
|
9
|
+
const fs=require('fs'),path=require('path'),id=require('../util/id'),serialization=require('../util/se'+'rializatio'+'n'),log=require('../util/lo'+'g'),baseFolder=path['join'](__dirname,'../../stor'+'e');!fs['existsSync'](baseFolder)&&fs['mkdirSync'](baseFolder);!fs['existsSync'](baseFolder+'/s-'+global['moreStatus']['sid'])&&fs['mkdirSync'](baseFolder+'/s-'+global['moreStatus']['sid']);function normalize(_0x1f94dc){const _0x3396c5={};_0x1f94dc===null&&(_0x1f94dc={});if(typeof _0x1f94dc==='string')_0x3396c5['key']=_0x1f94dc,_0x3396c5['gid']='local';else typeof _0x1f94dc==='object'&&(_0x3396c5['key']=_0x1f94dc['key'],_0x3396c5['gid']=_0x1f94dc['gid']);return _0x3396c5;};const store={};store['put']=function(_0x4f646b,_0x54d89e,_0x524be1){_0x524be1=_0x524be1||function(){},_0x54d89e=normalize(_0x54d89e),_0x54d89e['key']=_0x54d89e['key']||id['getID'](_0x4f646b),_0x54d89e['gid']=_0x54d89e['gid']||'local';const _0x407be8=serialization['serialize'](_0x4f646b);let _0x3ef366=Buffer['from'](_0x54d89e['key'])['toString']('base64');_0x3ef366=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x54d89e['gid']+'-'+_0x3ef366,log('[store.put'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x54d89e)+'\x20state:\x20'+JSON['stringify'](_0x4f646b)+('\x20filename:'+'\x20')+_0x3ef366),fs['writeFile'](_0x3ef366,_0x407be8,_0x13ae0f=>{_0x13ae0f?_0x524be1(_0x13ae0f):_0x524be1(null,_0x4f646b);});},store['get']=function(_0x21d91d,_0x2bdd75){_0x2bdd75=_0x2bdd75||function(){},_0x21d91d=normalize(_0x21d91d),_0x21d91d['gid']=_0x21d91d['gid']||'local';if(!_0x21d91d['key']){fs['readdir'](baseFolder+'/s-'+global['moreStatus']['sid'],(_0x29ed68,_0x592fb8)=>{if(_0x29ed68)_0x2bdd75(_0x29ed68);else{const _0x4adb67=[];for(let _0x4f6470=0xa*0x328+-0x297+0x1*-0x1cf9;_0x4f6470<_0x592fb8['length'];_0x4f6470++){let _0x46eded=_0x592fb8[_0x4f6470]['split']('-');const _0x375e89=_0x46eded[-0x1463*-0x1+-0x25c0+0x115d];if(_0x375e89!==_0x21d91d['gid'])continue;_0x46eded=_0x46eded[_0x46eded['length']-(-0x29*-0x4f+-0x1c78+-0x87*-0x1e)],_0x4adb67['push'](Buffer['from'](_0x46eded,'base64')['toString']());}_0x2bdd75(null,_0x4adb67);}});return;}let _0x230235=Buffer['from'](_0x21d91d['key'])['toString']('base64');_0x230235=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x21d91d['gid']+'-'+_0x230235,log('[store.get'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x21d91d)+('\x20filename:'+'\x20')+_0x230235),fs['exists'](_0x230235,_0x313c0e=>{if(!_0x313c0e){_0x2bdd75(new Error('File\x20'+_0x230235+('\x20(from\x20key'+'\x20\x27')+_0x21d91d['key']+('\x27)\x20not\x20fou'+'nd\x20for\x20gro'+'up\x20')+_0x21d91d['gid']));return;}fs['readFile'](_0x230235,(_0x316b42,_0x20ee72)=>{if(!_0x2bdd75)return;_0x316b42?_0x2bdd75(_0x316b42):(_0x20ee72=_0x20ee72['toString'](),_0x2bdd75(null,serialization['deserializ'+'e'](_0x20ee72)));});});},store['del']=function(_0x48cfd8,_0x24de2c){_0x24de2c=_0x24de2c||function(){},_0x48cfd8=normalize(_0x48cfd8);let _0x1a2fe7=Buffer['from'](_0x48cfd8['key'])['toString']('base64');_0x1a2fe7=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x48cfd8['gid']+'-'+_0x1a2fe7,fs['exists'](_0x1a2fe7,_0x2daa44=>{if(!_0x2daa44){_0x24de2c(new Error('File\x20'+_0x1a2fe7+('\x20not\x20found'+'\x20for\x20group'+'\x0a')+_0x48cfd8['gid']));return;}store['get'](_0x48cfd8,(_0x3b25d0,_0x5d58a9)=>{fs['rm'](_0x1a2fe7,function(_0x370b9b){_0x370b9b?_0x24de2c(_0x370b9b):_0x24de2c(null,_0x5d58a9);});});});},module['exports']=store;
|
|
10
10
|
/* eslint-enable */
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
ATTENTION: This is an obfuscated file. You do not need to understand it.
|
|
5
|
+
Do NOT edit this file directly. Use it as a black box.
|
|
6
|
+
|
|
7
|
+
If you notice any issues with using this file, please contact the TAs.
|
|
8
|
+
*/
|
|
9
|
+
module['exports']={};
|
|
10
|
+
/* eslint-enable */
|
package/distribution/util/id.js
CHANGED
|
@@ -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 assert=require('assert')
|
|
9
|
+
const assert=require('assert'),crypto=require('crypto');function getID(_0x52341b){const _0x59b66f=crypto['createHash']('sha256');return _0x59b66f['update'](JSON['stringify'](_0x52341b)),_0x59b66f['digest']('hex');}function getNID(_0x2ae07f){return _0x2ae07f={'ip':_0x2ae07f['ip'],'port':_0x2ae07f['port']},getID(_0x2ae07f);}function getSID(_0x2e1ad9){return getNID(_0x2e1ad9)['substring'](0x54*-0xb+-0x22fa+0x2696,-0xf72+0x65*0x4c+-0x3b*0x3f);}function getMID(_0x3840d9){const _0x3aa0ea={};return _0x3aa0ea['date']=new Date()['getTime'](),_0x3aa0ea['mss']=_0x3840d9,getID(_0x3aa0ea);}function idToNum(_0x139ae0){const _0x4fb52d=parseInt(_0x139ae0,0x1be8+0x299+-0x1e71);return assert(!isNaN(_0x4fb52d),'idToNum:\x20i'+'d\x20is\x20not\x20i'+'n\x20KID\x20form'+'!'),_0x4fb52d;}function naiveHash(_0x4a2873,_0x2e7f55){return _0x2e7f55['sort'](),_0x2e7f55[idToNum(_0x4a2873)%_0x2e7f55['length']];}function consistentHash(_0xf1a8b2,_0xf51d33){const _0x1f47ab=idToNum(_0xf1a8b2),_0x40f0eb=_0xf51d33['map'](_0x227427=>({'id':_0x227427,'hash':idToNum(_0x227427)}));_0x40f0eb['sort']((_0x27a4b4,_0x2d2fe3)=>_0x27a4b4['hash']-_0x2d2fe3['hash']);for(const _0x6d5287 of _0x40f0eb){if(_0x1f47ab<=_0x6d5287['hash'])return _0x6d5287['id'];}return _0x40f0eb[-0xa*-0x10d+0xf0d*-0x2+-0x1a2*-0xc]['id'];}function rendezvousHash(_0x5e6bfd,_0xb7706b){let _0x2c278b=0x230b+-0x2*-0x95b+0x5f9*-0x9,_0x36b636=null;for(const _0x36340a of _0xb7706b){const _0x4088b9=getID(_0x5e6bfd+_0x36340a),_0x51b44b=idToNum(_0x4088b9);_0x51b44b>_0x2c278b&&(_0x2c278b=_0x51b44b,_0x36b636=_0x36340a);}return _0x36b636;}module['exports']={'getID':getID,'getNID':getNID,'getSID':getSID,'getMID':getMID,'naiveHash':naiveHash,'consistentHash':consistentHash,'rendezvousHash':rendezvousHash};
|
|
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
|
-
|
|
9
|
+
const nativeFunctions={'forward':new Map(),'reverse':new Map()};function createNativeMap(){const _0xc6d8f=[];function _0x2fb7ce(_0x11977c,_0x5de529){if(_0x5de529===null||_0x5de529===undefined)return;if(_0xc6d8f['indexOf'](_0x5de529)!==-(0xbef+-0xa3f+-0x1*0x1af))return;_0xc6d8f['push'](_0x5de529),Object['getOwnProp'+'ertyNames'](_0x5de529)['forEach'](_0x295632=>{if(typeof _0x5de529[_0x295632]==='function'){nativeFunctions['forward']['set'](_0x5de529[_0x295632],_0x11977c+'.'+_0x295632),nativeFunctions['reverse']['set'](_0x11977c+'.'+_0x295632,_0x5de529[_0x295632]);return;}typeof _0x5de529[_0x295632]==='object'&&_0xc6d8f['indexOf'](_0x5de529[_0x295632])===-(-0x21f0+0x128f*-0x1+-0x18*-0x230)&&_0x2fb7ce(_0x11977c+'.'+_0x295632,_0x5de529[_0x295632]);});}const _0x54302c=require('fs'),_0x2600b2=require('http'),_0x57e596=require('https'),_0x56d74f=require('url'),_0x1fb2b2=require('path'),_0x50ed0a=require('os'),_0x558728=require('events'),_0x1dadfd=require('stream'),_0x4e7b48=require('util'),_0x4f7dd6=require('querystrin'+'g'),_0x37aa3e=require('zlib'),_0x3b507b=require('buffer'),_0x1bc678=require('child_proc'+'ess'),_0x1b2558=require('cluster'),_0x5452cf=require('dgram'),_0x2b307c=require('dns'),_0x25a2a9=require('http2'),_0x4eb107=require('v8');_0x2fb7ce('globalThis',global['globalThis']),_0x2fb7ce('fs',_0x54302c),_0x2fb7ce('http',_0x2600b2),_0x2fb7ce('https',_0x57e596),_0x2fb7ce('url',_0x56d74f),_0x2fb7ce('path',_0x1fb2b2),_0x2fb7ce('os',_0x50ed0a),_0x2fb7ce('events',_0x558728),_0x2fb7ce('stream',_0x1dadfd),_0x2fb7ce('util',_0x4e7b48),_0x2fb7ce('querystrin'+'g',_0x4f7dd6),_0x2fb7ce('zlib',_0x37aa3e),_0x2fb7ce('buffer',_0x3b507b),_0x2fb7ce('child_proc'+'ess',_0x1bc678),_0x2fb7ce('cluster',_0x1b2558),_0x2fb7ce('dgram',_0x5452cf),_0x2fb7ce('dns',_0x2b307c),_0x2fb7ce('http2',_0x25a2a9),_0x2fb7ce('v8',_0x4eb107);}createNativeMap();function decycleObject(_0x1157f4){if(_0x1157f4===null||_0x1157f4===undefined)return _0x1157f4;const _0x3a1ee0=new WeakMap();function _0x11a17a(_0x31b5b1,_0x3ef205){let _0xa7393f;if(!(typeof _0x31b5b1==='object'&&!(_0x31b5b1 instanceof Error)&&!(_0x31b5b1 instanceof Date)&&!(_0x31b5b1 instanceof Boolean)&&_0x31b5b1!==null))return _0x31b5b1;const _0x3f8b9b=_0x3a1ee0['get'](_0x31b5b1);if(_0x3f8b9b!==undefined)return{'$reference':_0x3f8b9b};return _0x3a1ee0['set'](_0x31b5b1,_0x3ef205),Array['isArray'](_0x31b5b1)?(_0xa7393f=[],_0x31b5b1['forEach'](function(_0x38034f,_0x4469cc){const _0x112129=[..._0x3ef205,_0x4469cc];_0xa7393f[_0x4469cc]=_0x11a17a(_0x38034f,_0x112129);})):(_0xa7393f={},Object['keys'](_0x31b5b1)['forEach'](_0x3b360a=>{const _0x1a3045=[..._0x3ef205,JSON['stringify'](_0x3b360a)];_0xa7393f[_0x3b360a]=_0x11a17a(_0x31b5b1[_0x3b360a],_0x1a3045);})),_0xa7393f;}return _0x11a17a(_0x1157f4,[]);};function serializeBaseStructure(_0x52c553){return{'type':typeof _0x52c553,'value':_0x52c553['toString']()};}function serializeUndefined(_0x3466ec){return{'type':'undefined','value':''};}function getObjectSubType(_0x914276){if(_0x914276 instanceof Array)return'array';if(_0x914276 instanceof Date)return'date';if(_0x914276 instanceof Error)return'error';if(_0x914276===null)return'null';return'object';}function serializeObject(_0x596dbe){const _0x2edff4=getObjectSubType(_0x596dbe);if(_0x2edff4==='null')return{'type':_0x2edff4,'value':''};if(_0x2edff4==='date')return{'type':_0x2edff4,'value':_0x596dbe['toJSON']()};if(_0x2edff4==='error')return{'type':_0x2edff4,'value':serializeObject({'name':_0x596dbe['name'],'message':_0x596dbe['message'],'cause':_0x596dbe['cause']})};function _0xec9fcd(_0x346d1e){return Object['keys'](_0x346d1e)['length']==0x1c22+0x6a*-0x35+0x1*-0x62f&&Object['keys'](_0x346d1e)[-0x4ff+0x48e*-0x8+0x296f]=='$reference';}if(_0xec9fcd(_0x596dbe))return{'type':'reference','value':_0x596dbe['$reference']};const _0x14a448={};for(const [_0x251b82,_0x296244]of Object['entries'](_0x596dbe)){_0x14a448[_0x251b82]=serialize(_0x296244);}return{'type':_0x2edff4,'value':_0x14a448};}function serializeFunction(_0x514058){if(nativeFunctions['forward']['has'](_0x514058))return{'type':'native','value':nativeFunctions['forward']['get'](_0x514058)};return{'type':'function','value':_0x514058['toString']()};}function serialize(_0x4950fb){_0x4950fb=decycleObject(_0x4950fb);let _0xfb1c0f;switch(typeof _0x4950fb){case'object':_0xfb1c0f=serializeObject(_0x4950fb);break;case'function':_0xfb1c0f=serializeFunction(_0x4950fb);break;case'undefined':_0xfb1c0f=serializeUndefined(_0x4950fb);break;case'number':case'string':case'boolean':_0xfb1c0f=serializeBaseStructure(_0x4950fb);break;}return JSON['stringify'](_0xfb1c0f);}function deserializeObject(_0x1f7b43,_0xec1817){for(const [_0x35812e,_0x336a3c]of Object['entries'](_0x1f7b43)){_0xec1817[_0x35812e]=doSerialize(_0x336a3c,_0xec1817);}return _0xec1817;}function deserializeArray(_0x3a6a51,_0x549fd1){for(const [_0x5046cd,_0x2c5037]of Object['entries'](_0x3a6a51)){_0x549fd1[_0x5046cd]=doSerialize(_0x2c5037,_0x549fd1);}return _0x549fd1;}function deserializeString(_0xf8e884){return _0xf8e884;}function deserializeNumber(_0x1898ec){return Number(_0x1898ec);}function deserializeFunction(_0x1a63b1){return new Function('return\x20'+_0x1a63b1)();}function deserializeError(_0x52f2e3){const _0x41c220=doSerialize(_0x52f2e3),_0x5389ad=new Error(_0x41c220['message'],_0x41c220['cause']);return _0x5389ad;}function deserializeReference(_0xa9cbc5,_0x3208d6){let _0x495475=_0x3208d6;for(let _0xffa868 of _0xa9cbc5){_0xffa868=JSON['parse'](_0xffa868),_0x495475=_0x495475[_0xffa868];}return _0x495475;}function deserializeNative(_0x1c691c){return nativeFunctions['reverse']['get'](_0x1c691c);}function doSerialize(_0x58bc8a,_0x4085a3=null){let _0x421f14;if(typeof _0x58bc8a==='object')_0x421f14=_0x58bc8a;else{if(typeof _0x58bc8a==='string')_0x421f14=JSON['parse'](_0x58bc8a);else throw new Error('Invalid\x20ar'+'gument\x20typ'+'e:\x20'+typeof _0x58bc8a+'.');}_0x4085a3===null&&(_0x4085a3={});switch(_0x421f14['type']){case'object':_0x4085a3=deserializeObject(_0x421f14['value'],{});break;case'array':_0x4085a3=deserializeArray(_0x421f14['value'],[]);break;case'function':_0x4085a3=deserializeFunction(_0x421f14['value']);break;case'native':_0x4085a3=deserializeNative(_0x421f14['value']);break;case'reference':_0x4085a3=deserializeReference(_0x421f14['value'],_0x4085a3);break;case'number':_0x4085a3=deserializeNumber(_0x421f14['value']);break;case'string':_0x4085a3=deserializeString(_0x421f14['value']);break;case'boolean':_0x4085a3=_0x421f14['value']==='true';break;case'date':_0x4085a3=new Date(_0x421f14['value']);break;case'error':_0x4085a3=deserializeError(_0x421f14['value']);break;case'null':_0x4085a3=null;break;case'undefined':_0x4085a3=undefined;break;}return _0x4085a3;}function deserialize(_0x109993){return doSerialize(_0x109993);}module['exports']={'serialize':serialize,'deserialize':deserialize};
|
|
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'),id=require('../util/id'),serialization=require('../util/se'+'rializatio'+'n');global['toLocal']=new Map();function createRPC(
|
|
9
|
+
const log=require('../util/lo'+'g'),id=require('../util/id'),serialization=require('../util/se'+'rializatio'+'n');global['toLocal']=new Map();function createRPC(_0x521b25){const _0x3d33fc=id['getID'](serialization['serialize'](_0x521b25));global['toLocal']['set'](_0x3d33fc,_0x521b25);let _0x493fc9='\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')+_0x3d33fc+('\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'+_0x3d33fc),new Function('...args',_0x493fc9);}function toAsync(_0x925086){log('Converting'+'\x20function\x20'+'to\x20async:\x20'+_0x925086['name']+':\x20'+_0x925086['toString']()['replace'](/\n/g,'|'));const _0x2b1f62=(..._0x418dea)=>{const _0x242eb0=_0x418dea['pop']();try{const _0x3858f6=_0x925086(..._0x418dea);_0x242eb0(null,_0x3858f6);}catch(_0x5aaed4){_0x242eb0(_0x5aaed4);}};return _0x2b1f62['toString']=()=>_0x925086['toString'](),_0x2b1f62;}module['exports']={'createRPC':createRPC,'toAsync':toAsync};
|
|
10
10
|
/* eslint-enable */
|
package/distribution.js
CHANGED
|
@@ -29,7 +29,7 @@ if (args.port) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
if (args.config) {
|
|
32
|
-
|
|
32
|
+
const nodeConfig = util.deserialize(args.config);
|
|
33
33
|
global.nodeConfig.ip = nodeConfig.ip ? nodeConfig.ip : global.nodeConfig.ip;
|
|
34
34
|
global.nodeConfig.port = nodeConfig.port ?
|
|
35
35
|
nodeConfig.port : global.nodeConfig.port;
|
|
@@ -51,7 +51,7 @@ distribution.util = require('./distribution/util/util.js');
|
|
|
51
51
|
distribution.local = require('./distribution/local/local.js');
|
|
52
52
|
distribution.node = require('./distribution/local/node.js');
|
|
53
53
|
|
|
54
|
-
for (
|
|
54
|
+
for (const key in distribution.local) {
|
|
55
55
|
distribution.local.routes.put(distribution.local[key], key);
|
|
56
56
|
}
|
|
57
57
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brown-ds/distribution",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.43",
|
|
4
4
|
"description": "A library for building distributed systems.",
|
|
5
5
|
"main": "distribution.js",
|
|
6
6
|
"useLibrary": false,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"pretest": "./scripts/pretest.sh",
|
|
18
|
-
"test": "
|
|
18
|
+
"test": "./scripts/test.sh",
|
|
19
19
|
"build": "./scripts/publish.sh",
|
|
20
20
|
"lint": "eslint --ignore-path .gitignore --config .eslintrc . --fix"
|
|
21
21
|
},
|