@brown-ds/distribution 0.1.11 → 0.1.13

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 id=require('../util/id'),gossip=function(_0x5881d0){const _0x14c554={};return _0x14c554['gid']=_0x5881d0['gid']||'all',_0x14c554['subset']=_0x5881d0['subset']||function(_0x45bde4){return Math['ceil'](Math['log'](_0x45bde4['length']));},{'send':(_0x4c0709,_0x297eae,_0x39f455)=>{global['distributi'+'on']['local']['groups']['get'](_0x14c554['gid'],(_0x1d8b46,_0x4af764)=>{const _0x56706a=_0x14c554['subset'](Object['keys'](_0x4af764)),_0x56993e=function(_0x51c801){const _0x31d3b4=new Set();while(_0x31d3b4['size']<_0x56706a){const _0x9f16cf=Math['floor'](Math['random']()*_0x51c801['length']);_0x31d3b4['add'](_0x51c801[_0x9f16cf]);}return _0x31d3b4;},_0x5f2612=_0x56993e(Object['keys'](_0x4af764)),_0xac0201={},_0x375c03={};let _0x41835c=0x218c+0x41*0x3b+0x3*-0x102d;if(_0x4c0709['mid']&&_0x4c0709['gid']){}else _0x4c0709={'message':_0x4c0709,'remote':_0x297eae,'mid':id['getMID'](_0x4c0709),'gid':_0x14c554['gid']};for(const _0x5cb364 of _0x5f2612){const _0x1bc24f=_0x4af764[_0x5cb364],_0xe1d943={'node':{'ip':_0x1bc24f['ip'],'port':_0x1bc24f['port']},'service':'gossip','method':'recv'};global['distributi'+'on']['local']['comm']['send']([_0x4c0709],_0xe1d943,(_0x29db60,_0x1baa3e)=>{_0x29db60?_0x375c03[_0x5cb364]=_0x29db60:_0xac0201[_0x5cb364]=_0x1baa3e,_0x41835c+=-0x15b+0x13*-0x16b+0x1c4d,_0x41835c===_0x56706a&&(_0x39f455&&_0x39f455(_0x375c03,_0xac0201));});}});},'at':(_0x2f1c5f,_0x2fc0a5,_0x15af38)=>{const _0x3cd429=setInterval(_0x2fc0a5,_0x2f1c5f);_0x15af38&&_0x15af38(null,_0x3cd429);},'del':(_0x4a563a,_0x1a607f)=>{clearInterval(_0x4a563a),_0x1a607f&&_0x1a607f(null,_0x4a563a);}};};module['exports']=gossip;
9
+ const gossip=function(_0x363baf){const _0xaec938={};return _0xaec938['gid']=_0x363baf['gid']||'all',_0xaec938['subset']=_0x363baf['subset']||function(_0x3c0177){return Math['ceil'](Math['log'](_0x3c0177['length']));},{'send':(_0x1fd28f,_0x241fd9,_0x19ecda)=>{global['distributi'+'on']['local']['groups']['get'](_0xaec938['gid'],(_0x45d2ff,_0x17247f)=>{const _0x586949=_0xaec938['subset'](Object['keys'](_0x17247f)),_0x20addc=function(_0x58e9be){const _0x584e81=new Set();while(_0x584e81['size']<_0x586949){const _0x3d5b72=Math['floor'](Math['random']()*_0x58e9be['length']);_0x584e81['add'](_0x58e9be[_0x3d5b72]);}return _0x584e81;},_0x563e94=_0x20addc(Object['keys'](_0x17247f)),_0x506770={},_0x5602b1={};let _0x42d0bc=-0x1*-0x1de3+0xe42+-0x2c25;if(_0x1fd28f['mid']&&_0x1fd28f['gid']){}else _0x1fd28f={'message':_0x1fd28f,'remote':_0x241fd9,'mid':global['distributi'+'on']['util']['id']['getMID'](_0x1fd28f),'gid':_0xaec938['gid']};for(const _0x21a65e of _0x563e94){const _0x49309d=_0x17247f[_0x21a65e],_0x57bb71={'node':{'ip':_0x49309d['ip'],'port':_0x49309d['port']},'service':'gossip','method':'recv'};global['distributi'+'on']['local']['comm']['send']([_0x1fd28f],_0x57bb71,(_0xe3a903,_0x451b60)=>{_0xe3a903?_0x5602b1[_0x21a65e]=_0xe3a903:_0x506770[_0x21a65e]=_0x451b60,_0x42d0bc+=-0x8*-0x38b+-0xb2+-0x1ba5,_0x42d0bc===_0x586949&&(_0x19ecda&&_0x19ecda(_0x5602b1,_0x506770));});}});},'at':(_0x1e0c30,_0x40c9bf,_0x1713b9)=>{const _0x39beb0=setInterval(_0x40c9bf,_0x1e0c30);_0x1713b9&&_0x1713b9(null,_0x39beb0);},'del':(_0x37e59b,_0x54f7b8)=>{clearInterval(_0x37e59b),_0x54f7b8&&_0x54f7b8(null,_0x37e59b);}};};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 distribution=global['distributi'+'on'],util=distribution['util'],log=require('../util/lo'+'g');function getNode(_0x3ba64f,_0x2c9ee5,_0x30b3a1){typeof _0x2c9ee5==='object'&&(_0x2c9ee5=_0x2c9ee5['key']),distribution[_0x3ba64f['gid']]['status']['get']('nid',(_0x1e2529,_0x33b0f8)=>{const _0x4cf427=Object['values'](_0x33b0f8),_0x10c42a=util['id']['getID'](_0x2c9ee5),_0x2075a7=_0x3ba64f['hash'](_0x10c42a,_0x4cf427),_0x224ecf=_0x2075a7['substring'](-0x2b*-0xe6+-0x2f*0xbb+-0x44d,0x26b5+-0x1*-0xf1+-0x27a1);distribution['local']['groups']['get'](_0x3ba64f['gid'],(_0x4313d3,_0x361168)=>{const _0x4de3ae=_0x361168[_0x224ecf];log('[mem\x20(getN'+'ode)]\x20conf'+'iguration:'+'\x20'+JSON['stringify'](_0x2c9ee5)+'group:\x20'+JSON['stringify'](_0x361168)+'\x20node:\x20'+JSON['stringify'](_0x4de3ae)+'nid:\x20'+JSON['stringify'](_0x2075a7)+'\x20sid:\x20'+JSON['stringify'](_0x224ecf)),_0x30b3a1(_0x4de3ae);});});}function normalize(_0x204615,_0x39f633){const _0x3580d0={};_0x204615===null&&(_0x204615={});if(typeof _0x204615==='string')_0x3580d0['key']=_0x204615,_0x3580d0['gid']=_0x39f633,_0x3580d0['action']='put';else typeof _0x204615==='object'&&(_0x3580d0['key']=_0x204615['key'],_0x3580d0['gid']=_0x204615['gid']||_0x39f633,_0x3580d0['action']=_0x204615['action']||'put');return _0x3580d0;};function mem(_0x4da3ff){const _0x42ed82={};return _0x42ed82['gid']=_0x4da3ff['gid']||'all',_0x42ed82['hash']=_0x4da3ff['hash']||util['id']['naiveHash'],{'get':(_0x256b00,_0x32d4f9)=>{if(!_0x256b00){const _0x1f6564=[{'key':null,'gid':_0x42ed82['gid']}];distribution[_0x42ed82['gid']]['comm']['send'](_0x1f6564,{'service':'mem','method':'get'},(_0x3e5078,_0x1eb776)=>{const _0x159334=Object['values'](_0x1eb776)['reduce']((_0x33062f,_0x2b3920)=>_0x33062f['concat'](_0x2b3920),[]);_0x32d4f9(_0x3e5078,_0x159334);});return;}_0x256b00=normalize(_0x256b00,_0x42ed82['gid']),getNode(_0x42ed82,_0x256b00,_0x237fa2=>{const _0x57f5f7=[_0x256b00],_0x1c44f6={'service':'mem','method':'get','node':_0x237fa2};log('[all.mem.g'+'et]\x20config'+'uration:\x20'+JSON['stringify'](_0x256b00)+'\x20node:\x20'+JSON['stringify'](global['nodeConfig'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x237fa2)),distribution['local']['comm']['send'](_0x57f5f7,_0x1c44f6,_0x32d4f9);});},'put':(_0x113743,_0x328c86,_0x4b7004)=>{_0x328c86=_0x328c86||util['id']['getID'](_0x113743),_0x328c86=normalize(_0x328c86,_0x42ed82['gid']),getNode(_0x42ed82,_0x328c86,_0x4d9acd=>{const _0x18817a=[_0x113743,_0x328c86],_0x57ae35={'service':'mem','method':'put','node':_0x4d9acd};log('[all.mem.p'+'ut]\x20state:'+'\x20'+JSON['stringify'](_0x113743)+('configurat'+'ion:\x20')+JSON['stringify'](_0x328c86)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x4d9acd)),distribution['local']['comm']['send'](_0x18817a,_0x57ae35,_0x4b7004);});},'del':(_0xa12052,_0x2a7439)=>{getNode(_0x42ed82,_0xa12052,_0x22b652=>{const _0x327271=[{'key':_0xa12052,'gid':_0x42ed82['gid']}],_0x4838d8={'service':'mem','method':'del','node':_0x22b652};distribution['local']['comm']['send'](_0x327271,_0x4838d8,_0x2a7439);});},'reconf':(_0x25fd4d,_0x12bb17)=>{distribution[_0x42ed82['gid']]['mem']['get'](null,(_0xa873d3,_0x651583)=>{distribution[_0x42ed82['gid']]['status']['get']('nid',(_0x48643a,_0x8bd506)=>{const _0x3dc7fe=Object['values'](_0x8bd506),_0x163a21=Object['values'](_0x25fd4d)['map'](_0x5ea3e6=>util['id']['getNID'](_0x5ea3e6));log('[mem.recon'+'f\x20received'+'\x20'+_0x651583['length']+('\x20keys\x20from'+'\x20')+_0x8bd506['length']+'\x20nodes');let _0x4456b6=0x18d+-0x504+0x377;const _0x8db5eb=()=>{_0x4456b6===_0x651583['length']&&_0x12bb17();};if(_0x651583['length']===-0x2040+0x8b2+0x178e){_0x12bb17();return;}for(const _0x47fffc of _0x651583){const _0x17bfa9=util['id']['getID'](_0x47fffc),_0x101786=_0x42ed82['hash'](_0x17bfa9,_0x163a21),_0x3bc0bf=_0x42ed82['hash'](_0x17bfa9,_0x3dc7fe);log('[mem.recon'+'f]\x20old\x20nid'+':\x20'+_0x101786+'\x20new\x20nid:\x20'+_0x3bc0bf);if(_0x101786===_0x3bc0bf){_0x4456b6++,_0x8db5eb();continue;}const _0x44c3f4=_0x25fd4d[_0x101786['substring'](-0xac1+-0x7e9+0x12aa,0xee8*-0x1+0x14ee+-0x601)],_0x1b69f5=[{'key':_0x47fffc,'gid':_0x42ed82['gid']}],_0xc01f25={'service':'mem','method':'del','node':_0x44c3f4};log('[mem.recon'+'f]\x20deletin'+'g\x20key\x20'+_0x47fffc+'\x20from\x20'+JSON['stringify'](_0xc01f25)),distribution['local']['comm']['send'](_0x1b69f5,_0xc01f25,(_0x2d47fd,_0x5af87d)=>{distribution[_0x42ed82['gid']]['mem']['put'](_0x5af87d,_0x47fffc,(_0x1e9731,_0xba6e06)=>{_0x4456b6++,_0x8db5eb();});});}});});}};};module['exports']=mem;
9
+ const log=require('../util/lo'+'g');function getNode(_0x3ac292,_0x1d2ed4,_0x315152){typeof _0x1d2ed4==='object'&&(_0x1d2ed4=_0x1d2ed4['key']),global['distributi'+'on'][_0x3ac292['gid']]['status']['get']('nid',(_0x158d8a,_0xedcb32)=>{const _0x6f5a63=Object['values'](_0xedcb32),_0x1f7669=global['distributi'+'on']['util']['id']['getID'](_0x1d2ed4),_0x33c989=_0x3ac292['hash'](_0x1f7669,_0x6f5a63),_0x5a973f=_0x33c989['substring'](0x1e82+0x358+-0x4d6*0x7,0xb*-0xb7+0x19c3+0x11e1*-0x1);global['distributi'+'on']['local']['groups']['get'](_0x3ac292['gid'],(_0x2d2fe5,_0x3419ca)=>{const _0x360f11=_0x3419ca[_0x5a973f];log('[mem\x20(getN'+'ode)]\x20conf'+'iguration:'+'\x20'+JSON['stringify'](_0x1d2ed4)+'group:\x20'+JSON['stringify'](_0x3419ca)+'\x20node:\x20'+JSON['stringify'](_0x360f11)+'nid:\x20'+JSON['stringify'](_0x33c989)+'\x20sid:\x20'+JSON['stringify'](_0x5a973f)),_0x315152(_0x360f11);});});}function normalize(_0x17494b,_0x1fedc4){const _0x4a04c7={};_0x17494b===null&&(_0x17494b={});if(typeof _0x17494b==='string')_0x4a04c7['key']=_0x17494b,_0x4a04c7['gid']=_0x1fedc4,_0x4a04c7['action']='put';else typeof _0x17494b==='object'&&(_0x4a04c7['key']=_0x17494b['key'],_0x4a04c7['gid']=_0x17494b['gid']||_0x1fedc4,_0x4a04c7['action']=_0x17494b['action']||'put');return _0x4a04c7;};function mem(_0x43de2f){const _0x56c810={};return _0x56c810['gid']=_0x43de2f['gid']||'all',_0x56c810['hash']=_0x43de2f['hash']||global['distributi'+'on']['util']['id']['naiveHash'],{'get':(_0x1a9046,_0x5bcd16)=>{if(!_0x1a9046){const _0x261fd2=[{'key':null,'gid':_0x56c810['gid']}];global['distributi'+'on'][_0x56c810['gid']]['comm']['send'](_0x261fd2,{'service':'mem','method':'get'},(_0x31534c,_0x5270d0)=>{const _0x8e3144=Object['values'](_0x5270d0)['reduce']((_0x510818,_0xa4bccf)=>_0x510818['concat'](_0xa4bccf),[]);_0x5bcd16(_0x31534c,_0x8e3144);});return;}_0x1a9046=normalize(_0x1a9046,_0x56c810['gid']),getNode(_0x56c810,_0x1a9046,_0x340d90=>{const _0x5468b3=[_0x1a9046],_0x37300e={'service':'mem','method':'get','node':_0x340d90};log('[all.mem.g'+'et]\x20config'+'uration:\x20'+JSON['stringify'](_0x1a9046)+'\x20node:\x20'+JSON['stringify'](global['nodeConfig'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x340d90)),global['distributi'+'on']['local']['comm']['send'](_0x5468b3,_0x37300e,_0x5bcd16);});},'put':(_0x4edcda,_0x13a371,_0x55080f)=>{_0x13a371=_0x13a371||global['distributi'+'on']['util']['id']['getID'](_0x4edcda),_0x13a371=normalize(_0x13a371,_0x56c810['gid']),getNode(_0x56c810,_0x13a371,_0x4d29bf=>{const _0x1c8c89=[_0x4edcda,_0x13a371],_0x399f1d={'service':'mem','method':'put','node':_0x4d29bf};log('[all.mem.p'+'ut]\x20state:'+'\x20'+JSON['stringify'](_0x4edcda)+('configurat'+'ion:\x20')+JSON['stringify'](_0x13a371)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x4d29bf)),global['distributi'+'on']['local']['comm']['send'](_0x1c8c89,_0x399f1d,_0x55080f);});},'del':(_0x2a9e48,_0x38b525)=>{getNode(_0x56c810,_0x2a9e48,_0x14669d=>{const _0x3c224a=[{'key':_0x2a9e48,'gid':_0x56c810['gid']}],_0x16c9f5={'service':'mem','method':'del','node':_0x14669d};global['distributi'+'on']['local']['comm']['send'](_0x3c224a,_0x16c9f5,_0x38b525);});},'reconf':(_0xf1bd05,_0xb3bc1c)=>{global['distributi'+'on'][_0x56c810['gid']]['mem']['get'](null,(_0x568572,_0x2e9a75)=>{global['distributi'+'on'][_0x56c810['gid']]['status']['get']('nid',(_0x455575,_0x59da2a)=>{const _0x52e00a=Object['values'](_0x59da2a),_0xfb18b0=Object['values'](_0xf1bd05)['map'](_0x183043=>global['distributi'+'on']['util']['id']['getNID'](_0x183043));log('[mem.recon'+'f\x20received'+'\x20'+_0x2e9a75['length']+('\x20keys\x20from'+'\x20')+_0x59da2a['length']+'\x20nodes');let _0x256f9b=-0xffa*-0x1+0x260f+-0x3609;const _0xcd0d46=()=>{_0x256f9b===_0x2e9a75['length']&&_0xb3bc1c();};if(_0x2e9a75['length']===0x4*0x8b1+0x1*-0x1f0c+-0x2*0x1dc){_0xb3bc1c();return;}for(const _0x254dff of _0x2e9a75){const _0x604a18=global['distributi'+'on']['util']['id']['getID'](_0x254dff),_0x5d4fa8=_0x56c810['hash'](_0x604a18,_0xfb18b0),_0x4ec856=_0x56c810['hash'](_0x604a18,_0x52e00a);log('[mem.recon'+'f]\x20old\x20nid'+':\x20'+_0x5d4fa8+'\x20new\x20nid:\x20'+_0x4ec856);if(_0x5d4fa8===_0x4ec856){_0x256f9b++,_0xcd0d46();continue;}const _0x41f7eb=_0xf1bd05[_0x5d4fa8['substring'](0xb3+-0x1*0xebb+-0x382*-0x4,-0x6*-0x275+-0x1b4d+0xc94)],_0x4229ee=[{'key':_0x254dff,'gid':_0x56c810['gid']}],_0x1e063b={'service':'mem','method':'del','node':_0x41f7eb};log('[mem.recon'+'f]\x20deletin'+'g\x20key\x20'+_0x254dff+'\x20from\x20'+JSON['stringify'](_0x1e063b)),global['distributi'+'on']['local']['comm']['send'](_0x4229ee,_0x1e063b,(_0x418360,_0x1009ce)=>{global['distributi'+'on'][_0x56c810['gid']]['mem']['put'](_0x1009ce,_0x254dff,(_0x641d25,_0x96fc42)=>{_0x256f9b++,_0xcd0d46();});});}});});}};};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 distribution=require('../../dist'+'ribution'),id=distribution['util']['id'];function mr(_0x2a500f){const _0x2e7d58={'gid':_0x2a500f['gid']||'all'};function _0x13037d(_0x946ac,_0x4b7208){const _0x57cbe5=id['getSID'](_0x946ac),_0x2375b3={'mapper':_0x946ac['map'],'reducer':_0x946ac['reduce'],'map':function(_0x306fc9,_0x4db300,_0x58d274,_0x48922c){if(_0x306fc9['length']==0x2*0x3f8+-0x26ad+0x1*0x1ebd)_0x48922c(null,{});else{const _0x507762=[];let _0x20543a=0x1*0x6cb+0x236c+-0x2a37;_0x306fc9['forEach'](_0x5bad0f=>{distribution[_0x4db300]['store']['get'](_0x5bad0f,(_0x1bc3fa,_0x2aa78a)=>{_0x20543a++;const _0x169602=this['mapper'](_0x5bad0f,_0x2aa78a);Array['isArray'](_0x169602)?_0x507762['push'](..._0x169602):_0x507762['push'](_0x169602),_0x20543a==_0x306fc9['length']&&distribution['local']['store']['put'](_0x507762,_0x58d274+'_map',(_0x3e655c,_0x1c316f)=>{_0x48922c(_0x3e655c,_0x507762);});});});}},'shuffle':function(_0x2fa648,_0x4bbf20,_0x310f41){distribution['local']['store']['get'](_0x4bbf20+'_map',(_0x43b865,_0x55dbef)=>{if(!_0x43b865){let _0x4c2c48=-0x8d1+0x8a3+-0x17*-0x2;_0x55dbef['forEach'](_0x410bcd=>{const [_0x3b4c70]=Object['keys'](_0x410bcd);distribution[_0x2fa648]['mem']['put'](_0x410bcd[_0x3b4c70],{'key':_0x3b4c70,'action':'append'},(_0x15ac1b,_0x29fe9a)=>{_0x4c2c48++,_0x4c2c48==_0x55dbef['length']&&_0x310f41(null,_0x55dbef);});});}else _0x310f41(_0x43b865,{});});},'reduce':function(_0x5118b0,_0x2c1797,_0x43e2e6){distribution['local']['mem']['get']({'key':null,'gid':_0x5118b0},(_0x1959bf,_0x5672ab)=>{let _0x10b95d=[],_0x33d7e1=0x20da+0x20cd+-0x157*0x31;_0x5672ab['length']==-0x1*0xa2c+-0x1f8d+0x1*0x29b9&&_0x43e2e6(null,null),_0x5672ab['forEach'](_0xd63414=>distribution['local']['mem']['get']({'key':_0xd63414,'gid':_0x5118b0},(_0x45237b,_0x52e8a5)=>{const _0x57103a=this['reducer'](_0xd63414,_0x52e8a5);_0x10b95d=_0x10b95d['concat'](_0x57103a),_0x33d7e1++,_0x33d7e1==_0x5672ab['length']&&_0x43e2e6(null,_0x10b95d);}));});}},_0x3007f6=function(_0x58c29c,_0x1fecd6){const _0x44a4ca={};return Object['keys'](_0x1fecd6)['forEach'](_0x52832e=>{_0x44a4ca[_0x52832e]=[];}),_0x58c29c['forEach'](_0x1f6de0=>{const _0x15ec0f=id['getID'](_0x1f6de0),_0x5d6561=id['naiveHash'](_0x15ec0f,Object['keys'](_0x1fecd6));_0x44a4ca[_0x5d6561]['push'](_0x1f6de0);}),_0x44a4ca;};distribution[_0x2e7d58['gid']]['routes']['put'](_0x2375b3,'mr-'+_0x57cbe5,(_0xab799b,_0x389290)=>{distribution['local']['groups']['get'](_0x2e7d58['gid'],(_0x208fce,_0x47a2a8)=>{const _0x5edfc0=_0x3007f6(_0x946ac['keys'],_0x47a2a8);let _0x52a088=-0xd7*-0x7+-0xa23+0x221*0x2;const _0x1d8bce=Object['keys'](_0x47a2a8)['length'],_0x463428={'service':'mr-'+_0x57cbe5,'method':'map'};for(const _0x589447 in _0x47a2a8){_0x463428['node']=_0x47a2a8[_0x589447];const _0x70fa4b=[_0x5edfc0[_0x589447],_0x2e7d58['gid'],_0x57cbe5];distribution['local']['comm']['send'](_0x70fa4b,_0x463428,(_0x51194d,_0x14314b)=>{++_0x52a088;if(_0x52a088==_0x1d8bce){const _0x277d74={'service':'mr-'+_0x57cbe5,'method':'shuffle'};distribution[_0x2e7d58['gid']]['comm']['send']([_0x2e7d58['gid'],_0x57cbe5],_0x277d74,(_0x391d2b,_0x18fd20)=>{const _0x33515f={'service':'mr-'+_0x57cbe5,'method':'reduce'};distribution[_0x2e7d58['gid']]['comm']['send']([_0x2e7d58['gid'],_0x57cbe5],_0x33515f,(_0x9782f2,_0x43583e)=>{let _0x39ff20=[];for(const _0x6308a1 of Object['values'](_0x43583e)){_0x6308a1!==null&&(_0x39ff20=_0x39ff20['concat'](_0x6308a1));}_0x4b7208(null,_0x39ff20);return;distribution[_0x2e7d58['gid']]['routes']['rem']('mr-'+_0x57cbe5,(_0x20e508,_0x197f38)=>{});});});}});}});});}return{'exec':_0x13037d};};module['exports']=mr;
9
+ const distribution=require('../../dist'+'ribution'),id=distribution['util']['id'];function mr(_0x91efe5){const _0xbc9aa={'gid':_0x91efe5['gid']||'all'};function _0x346c00(_0x3e1907,_0x3a646f){const _0x3d59cc=id['getID'](_0x3e1907),_0x2d3792={'mapper':_0x3e1907['map'],'reducer':_0x3e1907['reduce'],'map':function(_0x33b05e,_0x42f13a,_0x1db202,_0x1ea0bb){if(_0x33b05e['length']==0x1*0x1d39+0xd*0x25e+0x3bff*-0x1){_0x1ea0bb(null,[]);return;}else{const _0x317713=[];let _0x1a0fd2=-0x3*-0x4d5+-0x2238+-0x21*-0x99;_0x33b05e['forEach'](_0x34a98f=>{distribution[_0x42f13a]['store']['get'](_0x34a98f,(_0x21bc0c,_0x33ac07)=>{_0x1a0fd2++;const _0x1f8fac=this['mapper'](_0x34a98f,_0x33ac07);Array['isArray'](_0x1f8fac)?_0x317713['push'](..._0x1f8fac):_0x317713['push'](_0x1f8fac),_0x1a0fd2==_0x33b05e['length']&&distribution['local']['store']['put'](_0x317713,_0x1db202+'_map',(_0x3778ef,_0x31bc78)=>{_0x1ea0bb(_0x3778ef,_0x317713);});});});}},'shuffle':function(_0x31a211,_0x3b7dda,_0x492d22){distribution['local']['store']['get'](_0x3b7dda+'_map',(_0x21b907,_0x4a1fa9)=>{if(!_0x21b907){let _0xc8e54a=-0x13*-0x14b+-0x1*-0x49f+0x1d30*-0x1;_0x4a1fa9['forEach'](_0x18e867=>{const [_0x2f98d3]=Object['keys'](_0x18e867);distribution[_0x31a211]['mem']['put'](_0x18e867[_0x2f98d3],{'key':_0x2f98d3,'action':'append'},(_0x468c9f,_0x331470)=>{_0xc8e54a++,_0xc8e54a==_0x4a1fa9['length']&&_0x492d22(null,_0x4a1fa9);});});}else _0x492d22(_0x21b907,{});});},'reduce':function(_0x4e0ddb,_0xaeaeb1,_0x52b618){distribution['local']['mem']['get']({'key':null,'gid':_0x4e0ddb},(_0x272c7d,_0x504820)=>{let _0x46c073=[],_0x347a9c=-0x173b+-0xb*0x11f+0x2390*0x1;_0x504820['length']==-0x1*0x11bf+0x8d9*0x1+-0x86*-0x11&&_0x52b618(null,null),_0x504820['forEach'](_0x5522b7=>distribution['local']['mem']['get']({'key':_0x5522b7,'gid':_0x4e0ddb},(_0x175794,_0x462b8c)=>{const _0xb7dd39=this['reducer'](_0x5522b7,_0x462b8c);_0x46c073=_0x46c073['concat'](_0xb7dd39),_0x347a9c++,_0x347a9c==_0x504820['length']&&_0x52b618(null,_0x46c073);}));});}},_0x161946=function(_0x5bae3d,_0xdf12d5){const _0x4fd950={};return Object['keys'](_0xdf12d5)['forEach'](_0x167a83=>{_0x4fd950[_0x167a83]=[];}),_0x5bae3d['forEach'](_0x6678f9=>{const _0x47c661=id['getID'](_0x6678f9),_0x517d5f=id['naiveHash'](_0x47c661,Object['keys'](_0xdf12d5));_0x4fd950[_0x517d5f]['push'](_0x6678f9);}),_0x4fd950;};distribution[_0xbc9aa['gid']]['routes']['put'](_0x2d3792,'mr-'+_0x3d59cc,(_0x56d927,_0x185dc6)=>{distribution['local']['groups']['get'](_0xbc9aa['gid'],(_0x3eaf6d,_0x381426)=>{const _0x162883=_0x161946(_0x3e1907['keys'],_0x381426);let _0x5eb0c1=-0x1a83+-0x1096+0x2b19;const _0x509059=Object['keys'](_0x381426)['length'],_0x23a9b9={'service':'mr-'+_0x3d59cc,'method':'map'};for(const _0x2064db in _0x381426){const _0x448872=[_0x162883[_0x2064db],_0xbc9aa['gid'],_0x3d59cc];distribution['local']['comm']['send'](_0x448872,{'node':_0x381426[_0x2064db],..._0x23a9b9},(_0x1d5911,_0x328b27)=>{++_0x5eb0c1;if(_0x5eb0c1==_0x509059){const _0x23db66={'service':'mr-'+_0x3d59cc,'method':'shuffle'};distribution[_0xbc9aa['gid']]['comm']['send']([_0xbc9aa['gid'],_0x3d59cc],_0x23db66,(_0x2d1def,_0xc57f5c)=>{const _0x5c226c={'service':'mr-'+_0x3d59cc,'method':'reduce'};distribution[_0xbc9aa['gid']]['comm']['send']([_0xbc9aa['gid'],_0x3d59cc],_0x5c226c,(_0x1751aa,_0x33a63e)=>{let _0x5283f9=[];for(const _0x3f0c1a of Object['values'](_0x33a63e)){_0x3f0c1a!==null&&(_0x5283f9=_0x5283f9['concat'](_0x3f0c1a));}_0x3a646f(null,_0x5283f9);return;});});}});}});});}return{'exec':_0x346c00};};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
- 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;
9
+ const log=require('../util/lo'+'g');function getNode(_0x4e17be,_0x36ca18,_0x1a1744){global['distributi'+'on'][_0x4e17be['gid']]['status']['get']('nid',(_0x45715c,_0x4ae44d)=>{const _0x494ad1=Object['values'](_0x4ae44d),_0x3cf102=global['distributi'+'on']['util']['id']['getID'](_0x36ca18),_0x366ec9=_0x4e17be['hash'](_0x3cf102,_0x494ad1),_0x26e338=_0x366ec9['substring'](-0x1061*0x1+0x923+0x2*0x39f,0x1681*-0x1+-0x4c3*-0x1+0x11c3);global['distributi'+'on']['local']['groups']['get'](_0x4e17be['gid'],(_0x5bae1a,_0x26e22a)=>{const _0xecf4fa=_0x26e22a[_0x26e338];_0x1a1744(_0xecf4fa);});});}const store=function(_0x14d3d){const _0x27c5a5={};return _0x27c5a5['gid']=_0x14d3d['gid']||'all',_0x27c5a5['hash']=_0x14d3d['hash']||global['distributi'+'on']['util']['id']['naiveHash'],{'get':(_0x4fc5ef,_0x5a6081)=>{if(!_0x4fc5ef){const _0x487602=[{'key':null,'gid':_0x27c5a5['gid']}];global['distributi'+'on'][_0x27c5a5['gid']]['comm']['send'](_0x487602,{'service':'store','method':'get'},(_0x2c03a2,_0x14dd6a)=>{log('[all.store'+'.get\x20null\x20'+'given\x20as\x20k'+'ey.\x20keys:\x20'+JSON['stringify'](_0x14dd6a)+'\x20errors:\x20'+JSON['stringify'](_0x2c03a2));const _0x1cd07c=Object['values'](_0x14dd6a)['reduce']((_0xe5c384,_0xf23a91)=>_0xe5c384['concat'](_0xf23a91),[]);_0x5a6081(_0x2c03a2,_0x1cd07c);});return;}getNode(_0x27c5a5,_0x4fc5ef,_0x3f8d2b=>{const _0x395cae=[{'key':_0x4fc5ef,'gid':_0x27c5a5['gid']}],_0xab0ccd={'service':'store','method':'get','node':_0x3f8d2b};global['distributi'+'on']['local']['comm']['send'](_0x395cae,_0xab0ccd,_0x5a6081);});},'put':(_0x115347,_0x4c58a6,_0x56c5ba)=>{_0x4c58a6=_0x4c58a6||global['distributi'+'on']['util']['id']['getID'](_0x115347),getNode(_0x27c5a5,_0x4c58a6,_0x180f28=>{const _0x2800ba=[_0x115347,{'key':_0x4c58a6,'gid':_0x27c5a5['gid']}],_0x14613c={'service':'store','method':'put','node':_0x180f28};log('[all.store'+'.put]:\x20(gi'+'d:\x20'+_0x27c5a5['gid']+')\x20'+JSON['stringify'](_0x115347)+'\x20'+JSON['stringify'](_0x4c58a6)+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x180f28)),global['distributi'+'on']['local']['comm']['send'](_0x2800ba,_0x14613c,_0x56c5ba);});},'del':(_0x52bf0d,_0x5b2d40)=>{getNode(_0x27c5a5,_0x52bf0d,_0x58d07f=>{const _0x5a2106=[{'key':_0x52bf0d,'gid':_0x27c5a5['gid']}],_0x29eb0e={'service':'store','method':'del','node':_0x58d07f};global['distributi'+'on']['local']['comm']['send'](_0x5a2106,_0x29eb0e,_0x5b2d40);});},'reconf':(_0x17a4a7,_0x1703e9)=>{global['distributi'+'on'][_0x27c5a5['gid']]['store']['get'](null,(_0x385d5c,_0x3fa5ce)=>{global['distributi'+'on'][_0x27c5a5['gid']]['status']['get']('nid',(_0x444294,_0x4f0c5c)=>{const _0x1fa341=Object['values'](_0x4f0c5c),_0x417ccf=Object['values'](_0x17a4a7)['map'](_0x2a3d6e=>global['distributi'+'on']['util']['id']['getNID'](_0x2a3d6e));log('[store.rec'+'onf\x20receiv'+'ed\x20'+_0x3fa5ce['length']+('\x20keys\x20from'+'\x20')+_0x4f0c5c['length']+'\x20nodes');let _0x5069d8=-0xc8c+0x1a72+-0xde6;const _0x3b8200=()=>{_0x5069d8===_0x3fa5ce['length']&&_0x1703e9();};if(_0x3fa5ce['length']===-0xd45+0x1*0x1d1b+0x1*-0xfd6){_0x1703e9();return;}for(const _0x1388f5 of _0x3fa5ce){const _0x543d78=global['distributi'+'on']['util']['id']['getID'](_0x1388f5),_0x481aec=_0x27c5a5['hash'](_0x543d78,_0x417ccf),_0x26d790=_0x27c5a5['hash'](_0x543d78,_0x1fa341);log('[store.rec'+'onf]\x20old\x20n'+'id:\x20'+_0x481aec+'\x20new\x20nid:\x20'+_0x26d790);if(_0x481aec===_0x26d790){_0x5069d8++,_0x3b8200();continue;}const _0x141e21=_0x17a4a7[_0x481aec['substring'](0xe61+0x97e+-0x17df,0x16d*-0x16+-0x7*0x359+0x36d2)],_0x286e99=[{'key':_0x1388f5,'gid':_0x27c5a5['gid']}],_0x5d74e5={'service':'store','method':'del','node':_0x141e21};log('[store.rec'+'onf]\x20delet'+'ing\x20key\x20'+_0x1388f5+'\x20from\x20'+JSON['stringify'](_0x5d74e5)),global['distributi'+'on']['local']['comm']['send'](_0x286e99,_0x5d74e5,(_0x26cbbe,_0x22f106)=>{global['distributi'+'on'][_0x27c5a5['gid']]['store']['put'](_0x22f106,_0x1388f5,(_0x53c3b8,_0x3c4b0b)=>{_0x5069d8++,_0x3b8200();});});}});});}};};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');function send(_0x300bcb,_0x3023ca,_0x34e3b3){log('[comm.send'+']:\x20Sending'+'\x20'+JSON['stringify'](_0x300bcb)+'to\x20'+_0x3023ca['service']+':'+_0x3023ca['method']+'\x20on\x20'+_0x3023ca['node']['ip']+':'+_0x3023ca['node']['port']);if(!_0x300bcb instanceof Array)throw new Error('Message\x20mu'+'st\x20be\x20an\x20a'+'rray');const _0x35595c=_0x3023ca['node'],_0x184741=_0x3023ca['service'],_0x4a4e97=_0x3023ca['method'],_0x4e0578=_0x3023ca['gid']||'local',_0x5cfefb=serialization['serialize'](_0x300bcb),_0x20ba86={'hostname':_0x35595c['ip'],'port':_0x35595c['port'],'path':'/'+_0x4e0578+'/'+_0x184741+'/'+_0x4a4e97,'method':'PUT','headers':{'Content-Type':'applicatio'+'n/json','Content-Length':Buffer['byteLength'](_0x5cfefb)}},_0x4aedd9=http['request'](_0x20ba86,_0x42eaf5=>{let _0x367027='';_0x42eaf5['on']('data',function(_0x5ca18f){_0x367027+=_0x5ca18f;}),_0x42eaf5['on']('end',function(){_0x34e3b3&&_0x34e3b3(...serialization['deserializ'+'e'](_0x367027));}),_0x42eaf5['on']('error',function(_0x190227){_0x34e3b3&&_0x34e3b3(new Error('Error\x20on\x20r'+'esponse'));});});_0x4aedd9['on']('error',function(_0x33f3a1){_0x34e3b3&&_0x34e3b3(new Error(_0x33f3a1));}),_0x4aedd9['write'](_0x5cfefb),_0x4aedd9['end']();}module['exports']={'send':send};
9
+ const http=require('http'),log=require('../util/lo'+'g');function send(_0x246bd4,_0x3c69da,_0x2ca3d2){log('[comm.send'+']:\x20Sending'+'\x20'+JSON['stringify'](_0x246bd4)+'to\x20'+_0x3c69da['service']+':'+_0x3c69da['method']+'\x20on\x20'+_0x3c69da['node']['ip']+':'+_0x3c69da['node']['port']);if(!_0x246bd4 instanceof Array)throw new Error('Message\x20mu'+'st\x20be\x20an\x20a'+'rray');const _0x33dff5=_0x3c69da['node'],_0x3ea0e5=_0x3c69da['service'],_0x2ba62c=_0x3c69da['method'],_0x5c343b=_0x3c69da['gid']||'local',_0x1c6a54=global['distributi'+'on']['util']['serialize'](_0x246bd4),_0x8930d4={'hostname':_0x33dff5['ip'],'port':_0x33dff5['port'],'path':'/'+_0x5c343b+'/'+_0x3ea0e5+'/'+_0x2ba62c,'method':'PUT','headers':{'Content-Type':'applicatio'+'n/json','Content-Length':Buffer['byteLength'](_0x1c6a54)}},_0x464390=http['request'](_0x8930d4,_0x2b1db1=>{let _0x2e4319='';_0x2b1db1['on']('data',function(_0x2b1b7b){_0x2e4319+=_0x2b1b7b;}),_0x2b1db1['on']('end',function(){_0x2ca3d2&&_0x2ca3d2(...global['distributi'+'on']['util']['deserializ'+'e'](_0x2e4319));}),_0x2b1db1['on']('error',function(_0x16e6b5){_0x2ca3d2&&_0x2ca3d2(new Error('Error\x20on\x20r'+'esponse'));});});_0x464390['on']('error',function(_0x36322f){_0x2ca3d2&&_0x2ca3d2(new Error(_0x36322f));}),_0x464390['write'](_0x1c6a54),_0x464390['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 id=require('../util/id'),log=require('../util/lo'+'g'),kvStore={'store':new Map(),'get'(_0x26585a){if(!this['store'][_0x26585a['gid']])return undefined;return this['store'][_0x26585a['gid']][_0x26585a['key']];},'put'(_0xe29537,_0x43c1f7){!this['store'][_0xe29537['gid']]&&(this['store'][_0xe29537['gid']]=new Map()),this['store'][_0xe29537['gid']][_0xe29537['key']]=_0x43c1f7;},'append'(_0x16d74a,_0x18f333){!this['get'](_0x16d74a)&&this['put'](_0x16d74a,[]),!Array['isArray'](this['get'](_0x16d74a))&&this['put'](_0x16d74a,[this['get'](_0x16d74a)]),Array['isArray'](_0x18f333)?this['put'](_0x16d74a,this['get'](_0x16d74a)['concat'](_0x18f333)):this['store'][_0x16d74a['gid']][_0x16d74a['key']]['push'](_0x18f333);},'del'(_0x588206){if(!this['store'][_0x588206['gid']])return undefined;const _0x1c68b0=this['store'][_0x588206['gid']][_0x588206['key']];return delete this['store'][_0x588206['gid']][_0x588206['key']],_0x1c68b0;},'toString'(){let _0x5b2567='';for(const _0x2347a3 in this['store']){_0x5b2567+=_0x2347a3+':\x20'+JSON['stringify'](this['store'][_0x2347a3]);}return _0x5b2567;}};function normalize(_0x60e5f6){const _0x1ac61a={};_0x60e5f6===null&&(_0x60e5f6={});if(typeof _0x60e5f6==='string')_0x1ac61a['key']=_0x60e5f6,_0x1ac61a['gid']='local',_0x1ac61a['action']='put';else typeof _0x60e5f6==='object'&&(_0x1ac61a['key']=_0x60e5f6['key'],_0x1ac61a['gid']=_0x60e5f6['gid'],_0x1ac61a['action']=_0x60e5f6['action']);return _0x1ac61a;};function put(_0x40b1c3,_0x400283,_0x3d8828){log('[mem.put]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x400283)+'state:\x20'+JSON['stringify'](_0x40b1c3)+'\x20store:\x20'+kvStore['toString']()),_0x3d8828=_0x3d8828||function(){},_0x400283=normalize(_0x400283),_0x400283['key']=_0x400283['key']||id['getID'](_0x40b1c3),_0x400283['gid']=_0x400283['gid']||'local',_0x400283['action']=_0x400283['action']||'put',kvStore[_0x400283['action']](_0x400283,_0x40b1c3),log('[mem.put]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']()),_0x3d8828&&_0x3d8828(null,_0x40b1c3);};function get(_0x10d1ff,_0x201974){log('[mem.get]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x10d1ff)+'\x20store:\x20'+kvStore['toString']()),_0x201974=_0x201974||function(){},_0x10d1ff=normalize(_0x10d1ff),_0x10d1ff['gid']=_0x10d1ff['gid']||'local';if(!_0x10d1ff['key']){let _0x4e192e=kvStore['store'][_0x10d1ff['gid']]||{};_0x4e192e=Object['keys'](_0x4e192e),_0x201974(null,_0x4e192e);return;}const _0x360c2e=kvStore['get'](_0x10d1ff);_0x360c2e?_0x201974(null,_0x360c2e):_0x201974(new Error('Memory\x20key'+'\x20\x22'+_0x10d1ff['key']+('\x22\x20\x0a\x20\x20\x20\x20\x20\x20\x20'+'\x20not\x20found'+'\x20for\x20')+_0x10d1ff['gid']+'\x27s\x20store'));}function del(_0x53b5c6,_0x214f32){log('[mem.del]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x53b5c6)+'\x20store:\x20'+kvStore['toString']()),_0x214f32=_0x214f32||function(){},_0x53b5c6=normalize(_0x53b5c6);const _0x27a824=kvStore['del'](_0x53b5c6);log('[mem.del]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']()),_0x27a824?_0x214f32(null,_0x27a824):_0x214f32(new Error('Memory\x20key'+'\x20\x22'+_0x53b5c6['key']+('\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+'not\x20found\x20'+'for\x20')+_0x53b5c6['gid']+'\x27s\x20store'));};module['exports']={'put':put,'get':get,'del':del};
9
+ const log=require('../util/lo'+'g'),kvStore={'store':new Map(),'get'(_0x3f38ad){if(!this['store'][_0x3f38ad['gid']])return undefined;return this['store'][_0x3f38ad['gid']][_0x3f38ad['key']];},'put'(_0x25f423,_0x917dcf){!this['store'][_0x25f423['gid']]&&(this['store'][_0x25f423['gid']]=new Map()),this['store'][_0x25f423['gid']][_0x25f423['key']]=_0x917dcf;},'append'(_0x4e9e05,_0x3d2779){!this['get'](_0x4e9e05)&&this['put'](_0x4e9e05,[]),!Array['isArray'](this['get'](_0x4e9e05))&&this['put'](_0x4e9e05,[this['get'](_0x4e9e05)]),Array['isArray'](_0x3d2779)?this['put'](_0x4e9e05,this['get'](_0x4e9e05)['concat'](_0x3d2779)):this['store'][_0x4e9e05['gid']][_0x4e9e05['key']]['push'](_0x3d2779);},'del'(_0x1ab02c){if(!this['store'][_0x1ab02c['gid']])return undefined;const _0x46c34a=this['store'][_0x1ab02c['gid']][_0x1ab02c['key']];return delete this['store'][_0x1ab02c['gid']][_0x1ab02c['key']],_0x46c34a;},'toString'(){let _0x42e291='';for(const _0x4ebe47 in this['store']){_0x42e291+=_0x4ebe47+':\x20'+JSON['stringify'](this['store'][_0x4ebe47]);}return _0x42e291;}};function normalize(_0x24d948){const _0x5ce18d={};_0x24d948===null&&(_0x24d948={});if(typeof _0x24d948==='string')_0x5ce18d['key']=_0x24d948,_0x5ce18d['gid']='local',_0x5ce18d['action']='put';else typeof _0x24d948==='object'&&(_0x5ce18d['key']=_0x24d948['key'],_0x5ce18d['gid']=_0x24d948['gid'],_0x5ce18d['action']=_0x24d948['action']);return _0x5ce18d;};function put(_0x66645d,_0x591845,_0x1f5a6d){log('[mem.put]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x591845)+'state:\x20'+JSON['stringify'](_0x66645d)+'\x20store:\x20'+kvStore['toString']()),_0x1f5a6d=_0x1f5a6d||function(){},_0x591845=normalize(_0x591845),_0x591845['key']=_0x591845['key']||global['distributi'+'on']['util']['id']['getID'](_0x66645d),_0x591845['gid']=_0x591845['gid']||'local',_0x591845['action']=_0x591845['action']||'put',kvStore[_0x591845['action']](_0x591845,_0x66645d),log('[mem.put]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']()),_0x1f5a6d&&_0x1f5a6d(null,_0x66645d);};function get(_0x11cffa,_0x11c9af){log('[mem.get]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x11cffa)+'\x20store:\x20'+kvStore['toString']()),_0x11c9af=_0x11c9af||function(){},_0x11cffa=normalize(_0x11cffa),_0x11cffa['gid']=_0x11cffa['gid']||'local';if(!_0x11cffa['key']){let _0x4ef0ff=kvStore['store'][_0x11cffa['gid']]||{};_0x4ef0ff=Object['keys'](_0x4ef0ff),_0x11c9af(null,_0x4ef0ff);return;}const _0x387e75=kvStore['get'](_0x11cffa);_0x387e75?_0x11c9af(null,_0x387e75):_0x11c9af(new Error('Memory\x20key'+'\x20\x22'+_0x11cffa['key']+('\x22\x20\x0a\x20\x20\x20\x20\x20\x20\x20'+'\x20not\x20found'+'\x20for\x20')+_0x11cffa['gid']+'\x27s\x20store'));}function del(_0x97f270,_0x4d0673){log('[mem.del]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x97f270)+'\x20store:\x20'+kvStore['toString']()),_0x4d0673=_0x4d0673||function(){},_0x97f270=normalize(_0x97f270);const _0x56e060=kvStore['del'](_0x97f270);log('[mem.del]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']()),_0x56e060?_0x4d0673(null,_0x56e060):_0x4d0673(new Error('Memory\x20key'+'\x20\x22'+_0x97f270['key']+('\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+'not\x20found\x20'+'for\x20')+_0x97f270['gid']+'\x27s\x20store'));};module['exports']={'put':put,'get':get,'del':del};
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(_0x175148){if(_0x175148['length']===0x540+-0x8*-0x401+-0x2548)return new Error('No\x20body');try{_0x175148=JSON['parse'](_0x175148);}catch(_0x2f1a42){return _0x2f1a42;}return undefined;}function endRequest(_0x24502b,_0x56db04){_0x24502b['end'](serialization['serialize']([_0x56db04]));}const start=function(_0x22ef28){const _0x2a061d=http['createServ'+'er']((_0x23b90e,_0x15816c)=>{if(_0x23b90e['method']!=='PUT'){_0x15816c['end'](serialization['serialize'](new Error('Method\x20not'+'\x20allowed!')));return;}const _0x235830=url['parse'](_0x23b90e['url'])['pathname'],[,_0xfd1c82,_0x2e4af7,_0x5bf34b]=_0x235830['split']('/');log('[server]\x20g'+'ot\x20request'+'\x20'+_0xfd1c82+'\x20'+_0x2e4af7+':'+_0x5bf34b+'\x20from\x20'+_0x23b90e['connection']['remoteAddr'+'ess']);let _0x18ed27=[];_0x23b90e['on']('data',_0x593970=>{_0x18ed27['push'](_0x593970);}),_0x23b90e['on']('end',()=>{_0x18ed27=Buffer['concat'](_0x18ed27)['toString']();let _0x5cf18f;if(_0x5cf18f=isValidBody(_0x18ed27)){endRequest(_0x15816c,_0x5cf18f);return;}_0x18ed27=JSON['parse'](_0x18ed27),_0x18ed27=serialization['deserializ'+'e'](_0x18ed27);const _0x1497d3=_0x18ed27;!Array['isArray'](_0x1497d3)&&endRequest(_0x15816c,new Error('Invalid\x20ar'+'gument\x20typ'+'e,\x20expecte'+'d\x20array,\x20g'+'ot\x20'+typeof _0x1497d3));const _0xc071a0=_0x2e4af7;global['distributi'+'on']['local']['routes']['get']({'service':_0x2e4af7,'gid':_0xfd1c82},(_0x1fbece,_0x12f4d1)=>{const _0x56148b=(_0x8d5f4b,_0x2d5fe7)=>{_0x15816c['end'](serialization['serialize']([_0x8d5f4b,_0x2d5fe7]));};if(_0x1fbece){_0x56148b(_0x1fbece);return;}if(!_0x12f4d1[_0x5bf34b]){_0x56148b(new Error('Method\x20'+_0x5bf34b+('\x20not\x20found'+'\x20in\x20servic'+'e\x20')+_0xc071a0));return;}log('[server]\x20\x20'+'Calling\x20se'+'rvice:\x20'+_0xc071a0+':'+_0x5bf34b+('\x20with\x20args'+':\x20')+JSON['stringify'](_0x1497d3));_0x1497d3['length']===0xcb3*-0x1+-0x2702*-0x1+0x7*-0x3c2&&_0x12f4d1[_0x5bf34b]['length']===-0xadf+-0x92c*0x2+0x1d3a&&_0x1497d3['push'](undefined);try{_0x12f4d1[_0x5bf34b](..._0x1497d3,_0x56148b);}catch(_0x4def7f){_0x56148b(_0x4def7f);}});});});_0x2a061d['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']=_0x2a061d,_0x22ef28(_0x2a061d);}),_0x2a061d['on']('error',_0x285242=>{log('Server\x20err'+'or:\x20'+_0x285242);throw _0x285242;});};module['exports']={'start':start};
9
+ const http=require('http'),url=require('url'),log=require('../util/lo'+'g');function isValidBody(_0x528814){if(_0x528814['length']===0x5*-0x4db+0x975+-0x2*-0x769)return new Error('No\x20body');try{_0x528814=JSON['parse'](_0x528814);}catch(_0x29ed5e){return _0x29ed5e;}return undefined;}function endRequest(_0x2d3f07,_0x4b607b){_0x2d3f07['end'](global['distributi'+'on']['util']['serialize']([_0x4b607b]));}const start=function(_0x454a6e){const _0x328c99=http['createServ'+'er']((_0x176a9e,_0x1f674e)=>{if(_0x176a9e['method']!=='PUT'){_0x1f674e['end'](global['distributi'+'on']['util']['serialize'](new Error('Method\x20not'+'\x20allowed!')));return;}const _0x596d31=url['parse'](_0x176a9e['url'])['pathname'],[,_0x144188,_0x5623cc,_0x4864e3]=_0x596d31['split']('/');log('[server]\x20g'+'ot\x20request'+'\x20'+_0x144188+'\x20'+_0x5623cc+':'+_0x4864e3+'\x20from\x20'+_0x176a9e['connection']['remoteAddr'+'ess']);let _0x24cad9=[];_0x176a9e['on']('data',_0x5d1396=>{_0x24cad9['push'](_0x5d1396);}),_0x176a9e['on']('end',()=>{_0x24cad9=Buffer['concat'](_0x24cad9)['toString']();let _0xeea35f;if(_0xeea35f=isValidBody(_0x24cad9)){endRequest(_0x1f674e,_0xeea35f);return;}_0x24cad9=JSON['parse'](_0x24cad9),_0x24cad9=global['distributi'+'on']['util']['deserializ'+'e'](_0x24cad9);const _0x332e8f=_0x24cad9;!Array['isArray'](_0x332e8f)&&endRequest(_0x1f674e,new Error('Invalid\x20ar'+'gument\x20typ'+'e,\x20expecte'+'d\x20array,\x20g'+'ot\x20'+typeof _0x332e8f));const _0x12f4b5=_0x5623cc;global['distributi'+'on']['local']['routes']['get']({'service':_0x5623cc,'gid':_0x144188},(_0x29a423,_0x20bbf6)=>{const _0x646fba=(_0x4247a6,_0x1834e1)=>{_0x1f674e['end'](global['distributi'+'on']['util']['serialize']([_0x4247a6,_0x1834e1]));};if(_0x29a423){_0x646fba(_0x29a423);return;}if(!_0x20bbf6[_0x4864e3]){_0x646fba(new Error('Method\x20'+_0x4864e3+('\x20not\x20found'+'\x20in\x20servic'+'e\x20')+_0x12f4b5));return;}log('[server]\x20\x20'+'Calling\x20se'+'rvice:\x20'+_0x12f4b5+':'+_0x4864e3+('\x20with\x20args'+':\x20')+JSON['stringify'](_0x332e8f));_0x332e8f['length']===-0x2042*0x1+0xef8+-0x13*-0xe9&&_0x20bbf6[_0x4864e3]['length']===-0x1*-0x19b3+0x8f*0x3+-0x1b5d&&_0x332e8f['push'](undefined);try{_0x20bbf6[_0x4864e3](..._0x332e8f,_0x646fba);}catch(_0x4b9618){_0x646fba(_0x4b9618);}});});});_0x328c99['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']=_0x328c99,_0x454a6e(_0x328c99);}),_0x328c99['on']('error',_0x563d01=>{log('Server\x20err'+'or:\x20'+_0x563d01);throw _0x563d01;});};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 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(_0x2b5ce7,_0x5ee026){_0x5ee026=_0x5ee026||function(){};if(_0x2b5ce7 in global['nodeConfig']){_0x5ee026(null,global['nodeConfig'][_0x2b5ce7]);return;}if(_0x2b5ce7 in global['moreStatus']){_0x5ee026(null,global['moreStatus'][_0x2b5ce7]);return;}if(_0x2b5ce7==='heapTotal'){_0x5ee026(null,process['memoryUsag'+'e']()['heapTotal']);return;}if(_0x2b5ce7==='heapUsed'){_0x5ee026(null,process['memoryUsag'+'e']()['heapUsed']);return;}_0x5ee026(new Error('Status\x20key'+'\x20not\x20found'));};const path=require('path'),{spawn}=require('child_proc'+'ess'),wire=require('../util/wi'+'re'),createSpawnedCb=function(_0x5d134e,_0x4dae95){const _0x1a5ad8='\x0a\x20\x20\x20\x20let\x20o'+'nStart\x20=\x20'+_0x5d134e['toString']()+(';\x0a\x0a\x20\x20\x20\x20let'+'\x20callbackR'+'PC\x20=\x20')+wire['createRPC'](wire['toAsync'](_0x4dae95))['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(_0x1a5ad8);};status['spawn']=function(_0x3f1a05,_0x6d6fee){const _0x383824=_0x3f1a05;_0x383824['onStart']=_0x383824['onStart']||function(){};if(!_0x383824['port']||!_0x383824['ip']){_0x6d6fee(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'](_0x383824)),_0x383824['onStart']=createSpawnedCb(_0x383824['onStart'],_0x6d6fee);const _0x57dd81=path['join'](__dirname,'../../dist'+'ribution.j'+'s'),_0x51bab0=spawn('node',[_0x57dd81,'--config',global['distributi'+'on']['util']['serialize'](_0x383824)],{'detached':!![],'stdio':'inherit'});_0x51bab0;},status['stop']=function(_0x9812ba){_0x9812ba=_0x9812ba||function(){},_0x9812ba(null,global['nodeConfig']),log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),global['distributi'+'on']['node']['server']['close'](),process['exit'](0x1599+-0x2510+-0x6b*-0x25);},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 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(_0x118f7e){const _0x3fd6db={};_0x118f7e===null&&(_0x118f7e={});if(typeof _0x118f7e==='string')_0x3fd6db['key']=_0x118f7e,_0x3fd6db['gid']='local';else typeof _0x118f7e==='object'&&(_0x3fd6db['key']=_0x118f7e['key'],_0x3fd6db['gid']=_0x118f7e['gid']);return _0x3fd6db;};function put(_0x36bd7c,_0x219bb1,_0x4cfea1){_0x4cfea1=_0x4cfea1||function(){},_0x219bb1=normalize(_0x219bb1),_0x219bb1['key']=_0x219bb1['key']||id['getID'](_0x36bd7c),_0x219bb1['gid']=_0x219bb1['gid']||'local';const _0x40a15f=serialization['serialize'](_0x36bd7c);let _0xb22032=Buffer['from'](_0x219bb1['key'])['toString']('base64');_0xb22032=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x219bb1['gid']+'-'+_0xb22032,log('[store.put'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x219bb1)+'\x20state:\x20'+JSON['stringify'](_0x36bd7c)+('\x20filename:'+'\x20')+_0xb22032),fs['writeFile'](_0xb22032,_0x40a15f,_0x3bcd97=>{_0x3bcd97?_0x4cfea1(_0x3bcd97):_0x4cfea1(null,_0x36bd7c);});}function get(_0x13325a,_0x1dabf5){_0x1dabf5=_0x1dabf5||function(){},_0x13325a=normalize(_0x13325a),_0x13325a['gid']=_0x13325a['gid']||'local';if(!_0x13325a['key']){fs['readdir'](baseFolder+'/s-'+global['moreStatus']['sid'],(_0x25bc24,_0x146254)=>{if(_0x25bc24)_0x1dabf5(_0x25bc24);else{const _0x5bb71e=[];for(let _0x2a63fe=0x351+0x112c+-0x147d;_0x2a63fe<_0x146254['length'];_0x2a63fe++){let _0x4dfc03=_0x146254[_0x2a63fe]['split']('-');const _0x286ecc=_0x4dfc03[0x1*-0x18f4+-0xf55+0x2849];if(_0x286ecc!==_0x13325a['gid'])continue;_0x4dfc03=_0x4dfc03[_0x4dfc03['length']-(0x76b*0x3+-0x8*-0x371+-0x31c8)],_0x5bb71e['push'](Buffer['from'](_0x4dfc03,'base64')['toString']());}_0x1dabf5(null,_0x5bb71e);}});return;}let _0x3fc3f0=Buffer['from'](_0x13325a['key'])['toString']('base64');_0x3fc3f0=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x13325a['gid']+'-'+_0x3fc3f0,log('[store.get'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x13325a)+('\x20filename:'+'\x20')+_0x3fc3f0),fs['readFile'](_0x3fc3f0,(_0xf9236e,_0x53a4f4)=>{_0xf9236e?_0xf9236e['code']==='ENOENT'?_0x1dabf5(new Error('File\x20'+_0x3fc3f0+('\x20(from\x20key'+'\x20\x27')+_0x13325a['key']+('\x27)\x20not\x20fou'+'nd\x20for\x20gro'+'up\x20')+_0x13325a['gid'])):_0x1dabf5(_0xf9236e):_0x1dabf5(null,serialization['deserializ'+'e'](_0x53a4f4['toString']()));});}function del(_0x337936,_0x19b174){_0x19b174=_0x19b174||function(){},_0x337936=normalize(_0x337936);let _0x8e6929=Buffer['from'](_0x337936['key'])['toString']('base64');_0x8e6929=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x337936['gid']+'-'+_0x8e6929,get(_0x337936,(_0x5986f4,_0x4aa473)=>{if(_0x5986f4){_0x19b174(_0x5986f4);return;}fs['rm'](_0x8e6929,_0x543c5a=>{_0x543c5a?_0x19b174(_0x543c5a):_0x19b174(null,_0x4aa473);});});}module['exports']={'put':put,'get':get,'del':del};
9
+ const fs=require('fs'),path=require('path'),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(_0x2f8ccc){const _0x4720e3={};_0x2f8ccc===null&&(_0x2f8ccc={});if(typeof _0x2f8ccc==='string')_0x4720e3['key']=_0x2f8ccc,_0x4720e3['gid']='local';else typeof _0x2f8ccc==='object'&&(_0x4720e3['key']=_0x2f8ccc['key'],_0x4720e3['gid']=_0x2f8ccc['gid']);return _0x4720e3;};function put(_0x51c272,_0x4c65bb,_0x1836ed){_0x1836ed=_0x1836ed||function(){},_0x4c65bb=normalize(_0x4c65bb),_0x4c65bb['key']=_0x4c65bb['key']||global['distributi'+'on']['util']['id']['getID'](_0x51c272),_0x4c65bb['gid']=_0x4c65bb['gid']||'local';const _0xceb37=global['distributi'+'on']['util']['serialize'](_0x51c272);let _0xf6717f=Buffer['from'](_0x4c65bb['key'])['toString']('base64');_0xf6717f=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x4c65bb['gid']+'-'+_0xf6717f,log('[store.put'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x4c65bb)+'\x20state:\x20'+JSON['stringify'](_0x51c272)+('\x20filename:'+'\x20')+_0xf6717f),fs['writeFile'](_0xf6717f,_0xceb37,_0x13b631=>{_0x13b631?_0x1836ed(_0x13b631):_0x1836ed(null,_0x51c272);});}function get(_0x42161f,_0x347c86){_0x347c86=_0x347c86||function(){},_0x42161f=normalize(_0x42161f),_0x42161f['gid']=_0x42161f['gid']||'local';if(!_0x42161f['key']){fs['readdir'](baseFolder+'/s-'+global['moreStatus']['sid'],(_0x115b0a,_0x290e03)=>{if(_0x115b0a)_0x347c86(_0x115b0a);else{const _0x4cc450=[];for(let _0x2f9db0=0x979*0x2+-0x2659*0x1+0x1367;_0x2f9db0<_0x290e03['length'];_0x2f9db0++){let _0x30e0f3=_0x290e03[_0x2f9db0]['split']('-');const _0x291d46=_0x30e0f3[-0xdb4+-0x1f4a+0x2cfe];if(_0x291d46!==_0x42161f['gid'])continue;_0x30e0f3=_0x30e0f3[_0x30e0f3['length']-(0xf11+0x1673+-0x2583)],_0x4cc450['push'](Buffer['from'](_0x30e0f3,'base64')['toString']());}_0x347c86(null,_0x4cc450);}});return;}let _0x23570c=Buffer['from'](_0x42161f['key'])['toString']('base64');_0x23570c=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x42161f['gid']+'-'+_0x23570c,log('[store.get'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x42161f)+('\x20filename:'+'\x20')+_0x23570c),fs['readFile'](_0x23570c,(_0x2a82f5,_0x16a4b8)=>{_0x2a82f5?_0x2a82f5['code']==='ENOENT'?_0x347c86(new Error('File\x20'+_0x23570c+('\x20(from\x20key'+'\x20\x27')+_0x42161f['key']+('\x27)\x20not\x20fou'+'nd\x20for\x20gro'+'up\x20')+_0x42161f['gid'])):_0x347c86(_0x2a82f5):_0x347c86(null,global['distributi'+'on']['util']['deserializ'+'e'](_0x16a4b8['toString']()));});}function del(_0x51af6f,_0x2d287b){_0x2d287b=_0x2d287b||function(){},_0x51af6f=normalize(_0x51af6f);let _0x177b2b=Buffer['from'](_0x51af6f['key'])['toString']('base64');_0x177b2b=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x51af6f['gid']+'-'+_0x177b2b,get(_0x51af6f,(_0x52fc68,_0x3831cf)=>{if(_0x52fc68){_0x2d287b(_0x52fc68);return;}fs['rm'](_0x177b2b,_0x204d84=>{_0x204d84?_0x2d287b(_0x204d84):_0x2d287b(null,_0x3831cf);});});}module['exports']={'put':put,'get':get,'del':del};
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 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};
9
+ const assert=require('assert'),crypto=require('crypto');function getID(_0x13974b){const _0x3e4be4=crypto['createHash']('sha256');return _0x3e4be4['update'](JSON['stringify'](_0x13974b)),_0x3e4be4['digest']('hex');}function getNID(_0x44b3e4){return _0x44b3e4={'ip':_0x44b3e4['ip'],'port':_0x44b3e4['port']},getID(_0x44b3e4);}function getSID(_0x61db2c){return getNID(_0x61db2c)['substring'](0xbaf+0x1*-0x143d+-0x1e*-0x49,0x385+0x1c9b+-0x201b);}function getMID(_0x5c61b5){const _0x272c7f={};return _0x272c7f['date']=new Date()['getTime'](),_0x272c7f['mss']=_0x5c61b5,getID(_0x272c7f);}function idToNum(_0x11fd4d){const _0xc93d4=parseInt(_0x11fd4d,0x14ca+-0x11bf*-0x1+-0x2679);return assert(!isNaN(_0xc93d4),'idToNum:\x20i'+'d\x20is\x20not\x20i'+'n\x20KID\x20form'+'!'),_0xc93d4;}function naiveHash(_0x1e9971,_0x5b5783){return _0x5b5783['sort'](),_0x5b5783[idToNum(_0x1e9971)%_0x5b5783['length']];}function consistentHash(_0x17c44b,_0x1dbb51){const _0xc2e84b=idToNum(_0x17c44b),_0x105a1f=_0x1dbb51['map'](_0x40a33d=>({'id':_0x40a33d,'hash':idToNum(_0x40a33d)}));_0x105a1f['sort']((_0x597b7e,_0x3e64f8)=>_0x597b7e['hash']-_0x3e64f8['hash']);for(const _0x271d2f of _0x105a1f){if(_0xc2e84b<=_0x271d2f['hash'])return _0x271d2f['id'];}return _0x105a1f[-0x1d*0x5e+-0x16fe+0x21a4]['id'];}function rendezvousHash(_0x353174,_0x55c6e5){let _0x4cb99a=0x17*-0x121+-0x11*0x143+0x2f6a,_0x1f7177=null;for(const _0xf279e3 of _0x55c6e5){const _0xc693ab=getID(_0x353174+_0xf279e3),_0x9576ec=idToNum(_0xc693ab);_0x9576ec>_0x4cb99a&&(_0x4cb99a=_0x9576ec,_0x1f7177=_0xf279e3);}return _0x1f7177;}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
- const fs=require('fs'),path=require('path'),logFile=path['join'](__dirname,'../../','log.txt');function log(_0x145967,_0x512029){_0x512029===undefined&&(_0x512029='info');const _0x4b9050=new Date(),_0x380d91=new Intl['DateTimeFo'+'rmat']('en-GB',{'day':'2-digit','month':'2-digit','year':'numeric','hour':'2-digit','minute':'2-digit','second':'2-digit','hour12':![]})['format'](_0x4b9050)+'.'+String(_0x4b9050['getMillise'+'conds']()*(-0x6*0x4da+-0x4*-0x16+0x20ac))['padStart'](-0x304+-0x6*-0x26e+-0xb8a,'0');fs['appendFile'+'Sync'](logFile,_0x380d91+'\x20['+global['nodeConfig']['ip']+':'+global['nodeConfig']['port']+'('+global['moreStatus']['sid']+')]\x20['+_0x512029+']\x20'+_0x145967+'\x0a');}module['exports']=log;
9
+ const fs=require('fs'),path=require('path'),logFile=path['join']('/tmp','log.txt');function log(_0x14abef,_0x1e23ce){_0x1e23ce===undefined&&(_0x1e23ce='info');const _0x587c21=new Date(),_0x6dec24=new Intl['DateTimeFo'+'rmat']('en-GB',{'day':'2-digit','month':'2-digit','year':'numeric','hour':'2-digit','minute':'2-digit','second':'2-digit','hour12':![]})['format'](_0x587c21)+'.'+String(_0x587c21['getMillise'+'conds']()*(-0x1607+-0x24fa+0xc95*0x5))['padStart'](0x127d*-0x2+0xc18+0x63a*0x4,'0');fs['appendFile'+'Sync'](logFile,_0x6dec24+'\x20['+global['nodeConfig']['ip']+':'+global['nodeConfig']['port']+'('+global['moreStatus']['sid']+')]\x20['+_0x1e23ce+']\x20'+_0x14abef+'\x0a');}module['exports']=log;
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(_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};
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};
10
10
  /* eslint-enable */
package/distribution.js CHANGED
@@ -46,7 +46,11 @@ const distribution = function(config) {
46
46
  return global.distribution;
47
47
  };
48
48
 
49
- global.distribution = distribution;
49
+ // Don't overwrite the distribution object if it already exists
50
+ if (global.distribution === undefined) {
51
+ global.distribution = distribution;
52
+ }
53
+
50
54
  distribution.util = require('./distribution/util/util.js');
51
55
  distribution.local = require('./distribution/local/local.js');
52
56
  distribution.node = require('./distribution/local/node.js');
@@ -73,7 +77,7 @@ distribution['all'].store =
73
77
  require('./distribution/all/store')({gid: 'all'});
74
78
 
75
79
  distribution.node.config = global.nodeConfig;
76
- module.exports = global.distribution;
80
+ module.exports = distribution;
77
81
 
78
82
  /* The following code is run when distribution.js is run directly */
79
83
  if (require.main === module) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brown-ds/distribution",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "A library for building distributed systems.",
5
5
  "main": "distribution.js",
6
6
  "useLibrary": false,