@brown-ds/distribution 0.1.0 → 0.1.2
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
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
|
-
function comm(
|
|
9
|
+
function comm(_0x24ccfd){const _0x352aee={};_0x352aee['gid']=_0x24ccfd['gid']||'all';function _0x10652b(_0x2b9a36,_0x3501c2,_0xb35c4f){global['distributi'+'on']['local']['groups']['get'](_0x352aee['gid'],(_0x6f2180,_0x4fbe1f)=>{const _0x343aa5=Object['keys'](_0x4fbe1f)['length'];if(_0x343aa5===-0x2583+0x1*0x1f1f+0x664){_0xb35c4f(new Error('No\x20nodes\x20f'+'ound'));return;}let _0x1146be=0xac1*0x1+0x3*0xaf6+-0x2ba3;const _0x22d70b={},_0x4e1530={};for(const _0x38a727 of Object['keys'](_0x4fbe1f)){const _0x236a9e=_0x4fbe1f[_0x38a727],_0x154c3b={'node':{'ip':_0x236a9e['ip'],'port':_0x236a9e['port']},'service':_0x3501c2['service'],'method':_0x3501c2['method'],'gid':_0x3501c2['gid']||'local'};global['distributi'+'on']['local']['comm']['send'](_0x2b9a36,_0x154c3b,(_0x4f1b5b,_0x3ae06a)=>{_0x4f1b5b?_0x4e1530[_0x38a727]=_0x4f1b5b:_0x22d70b[_0x38a727]=_0x3ae06a,_0x1146be+=0x1be5+0xd*0x106+-0x2932,_0x1146be===_0x343aa5&&_0xb35c4f(_0x4e1530,_0x22d70b);});}});}return{'send':_0x10652b};};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'),gossip=function(
|
|
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;
|
|
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(_0x261c11){const _0x949b56={};return _0x949b56['gid']=_0x261c11['gid']||'all',{'put':(_0x1ed41f,_0x4a2e32,_0x229550)=>{global['distributi'+'on'][_0x949b56['gid']]['comm']['send']([_0x1ed41f,_0x4a2e32],{'service':'groups','method':'put'},_0x229550);},'del':(_0x2acebb,_0x3d6319)=>{global['distributi'+'on'][_0x949b56['gid']]['comm']['send']([_0x2acebb],{'service':'groups','method':'del'},_0x3d6319);},'get':(_0x22fb11,_0x179b52)=>{global['distributi'+'on'][_0x949b56['gid']]['comm']['send']([_0x22fb11],{'service':'groups','method':'get'},_0x179b52);},'add':(_0x3852b4,_0x1326db,_0x2d20de)=>{global['distributi'+'on'][_0x949b56['gid']]['comm']['send']([_0x3852b4,_0x1326db],{'service':'groups','method':'add'},_0x2d20de);},'rem':(_0x2d03db,_0x474a81,_0x55326c)=>{global['distributi'+'on'][_0x949b56['gid']]['comm']['send']([_0x2d03db,_0x474a81],{'service':'groups','method':'rem'},_0x55326c);}};};module['exports']=groups;
|
|
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'];function mr(
|
|
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;
|
|
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
|
-
function routes(
|
|
9
|
+
function routes(_0x46acf0){const _0x46b597={};_0x46b597['gid']=_0x46acf0['gid']||'all';function _0x3b2713(_0x4c6473,_0x5a853b,_0xe15cfe=()=>{}){global['distributi'+'on'][_0x46b597['gid']]['comm']['send']([_0x4c6473,_0x5a853b],{'service':'routes','method':'put'},_0xe15cfe);}function _0x3af36c(_0x20a579,_0x8817f7,_0x1859ac=()=>{}){global['distributi'+'on'][_0x46b597['gid']]['comm']['send']([_0x8817f7],{'service':'routes','method':'rem'},_0x1859ac);}return{'put':_0x3b2713,'rem':_0x3af36c};}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(_0x361efc){const _0x53485f={};return _0x53485f['gid']=_0x361efc['gid']||'all',{'get':(_0x486e4d,_0x166577)=>{const _0x2202e4=[_0x486e4d],_0x2031b2={'service':'status','method':'get'};global['distributi'+'on'][_0x53485f['gid']]['comm']['send'](_0x2202e4,_0x2031b2,(_0x4bd946,_0x5c9923)=>{switch(_0x486e4d){case'heapTotal':const _0x32b8e5=Object['values'](_0x5c9923)['reduce']((_0x88d14a,_0x19f390)=>{return _0x88d14a+_0x19f390;},-0x1561+0x420+0x1141);_0x166577(_0x4bd946,_0x32b8e5);break;case'nid':const _0x17b9ad=Object['values'](_0x5c9923)['reduce']((_0x4aa102,_0x30d543)=>{return _0x4aa102['concat'](_0x30d543);},[]);_0x166577(_0x4bd946,_0x17b9ad);break;default:_0x166577(_0x4bd946,_0x5c9923);break;}});},'spawn':(_0x1a4792,_0x1807e0)=>{_0x1807e0=_0x1807e0||function(){},global['distributi'+'on']['local']['status']['spawn'](_0x1a4792,(_0x1b39e2,_0x5e57a4)=>{_0x1b39e2?_0x1807e0(_0x1b39e2):global['distributi'+'on']['local']['groups']['add'](_0x53485f['gid'],_0x1a4792,()=>{_0x1807e0(null,_0x5e57a4);}),global['distributi'+'on'][_0x53485f['gid']]['comm']['send']([_0x53485f['gid'],_0x1a4792],{'service':'groups','method':'add'},()=>{});});},'stop':_0x532f5e=>{global['distributi'+'on'][_0x53485f['gid']]['comm']['send']([],{'service':'status','method':'stop'},_0x532f5e);}};};module['exports']=status;
|
|
10
10
|
/* eslint-enable */
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brown-ds/distribution",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A library for building distributed systems.",
|
|
5
5
|
"main": "distribution.js",
|
|
6
|
-
"useLibrary":
|
|
6
|
+
"useLibrary": false,
|
|
7
7
|
"directories": {
|
|
8
8
|
"test": "test"
|
|
9
9
|
},
|