@brown-ds/distribution 0.1.23 → 0.2.15

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 comm=require('./comm'),groups=require('./groups'),routes=require('./routes'),status=require('./status'),gossip=require('./gossip'),mem=require('./mem'),store=require('./store'),mr=require('./mr');module['exports']={'comm':comm,'groups':groups,'status':status,'routes':routes,'gossip':gossip,'mem':mem,'store':store,'mr':mr};
9
+ const comm=require('./comm.js'),groups=require('./groups.j'+'s'),routes=require('./routes.j'+'s'),status=require('./status.j'+'s'),gossip=require('./gossip.j'+'s'),mem=require('./mem.js'),store=require('./store.js'),mr=require('./mr.js');function setup(_0x7eeca4){return{'comm':comm(_0x7eeca4),'groups':groups(_0x7eeca4),'status':status(_0x7eeca4),'routes':routes(_0x7eeca4),'gossip':gossip(_0x7eeca4),'mem':mem(_0x7eeca4),'store':store(_0x7eeca4),'mr':mr(_0x7eeca4)};}module['exports']={'comm':comm,'groups':groups,'status':status,'routes':routes,'gossip':gossip,'mem':mem,'store':store,'mr':mr,'setup':setup};
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 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;
9
+ function comm(_0x2019ba){const _0x285313={};_0x285313['gid']=_0x2019ba['gid']||'all';function _0x577a6a(_0x2056fd,_0x124d3c,_0x1f2069){globalThis['distributi'+'on']['local']['groups']['get'](_0x285313['gid'],(_0x2d1099,_0x592d32)=>{if(!_0x592d32){_0x1f2069(_0x2d1099);return;}const _0x208bd1=Object['keys'](_0x592d32)['length'];if(_0x208bd1===0x1f82+-0x5d*0x6+-0x1d54){_0x1f2069(new Error('No\x20nodes\x20i'+'n\x20group\x20'+_0x285313['gid']+'\x20found!'));return;}let _0x502634=0x1*-0x210e+0xaf2+-0x587*-0x4;const _0x34ae1c={},_0x4e14df={};for(const _0x5d24fd of Object['keys'](_0x592d32)){const _0x3ca66f=_0x592d32[_0x5d24fd],_0x21dcd4={'node':{'ip':_0x3ca66f['ip'],'port':_0x3ca66f['port']},'service':_0x124d3c['service'],'method':_0x124d3c['method'],'gid':_0x124d3c['gid']||'local'};globalThis['distributi'+'on']['local']['comm']['send'](_0x2056fd,_0x21dcd4,(_0x504bd9,_0x213b4a)=>{_0x504bd9?_0x4e14df[_0x5d24fd]=_0x504bd9:_0x34ae1c[_0x5d24fd]=_0x213b4a;_0x502634+=-0xb*0x2+0x31c+-0x305;if(_0x502634===_0x208bd1)return _0x1f2069(_0x4e14df,_0x34ae1c);});}});}return{'send':_0x577a6a};}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 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;
9
+ const log=require('../util/lo'+'g.js');function gossip(_0x2e8714){const _0x7e53d4={};_0x7e53d4['gid']=_0x2e8714['gid']||'all',_0x7e53d4['subset']=_0x2e8714['subset']||function(_0x20afd8){return Math['ceil'](Math['log'](_0x20afd8['length']));};function _0xd2ee67(_0x5e6e2c,_0x2583fb,_0x260c70){log('[gossip]\x20s'+'end:\x20'+JSON['stringify'](_0x5e6e2c)+'\x20to\x20'+JSON['stringify'](_0x2583fb)),globalThis['distributi'+'on']['local']['groups']['get'](_0x7e53d4['gid'],(_0x40ec02,_0x254654)=>{if(_0x254654===null){_0x260c70(_0x40ec02);return;}const _0x31f282=_0x7e53d4['subset'](Object['keys'](_0x254654)),_0x35c471=function(_0x24343d){const _0x2c0088={};while(Object['keys'](_0x2c0088)['length']<_0x31f282){const _0x416c36=Math['floor'](Math['random']()*_0x24343d['length']);_0x2c0088[_0x24343d[_0x416c36]]=!![];}return _0x2c0088;},_0x58ba0f=_0x35c471(Object['keys'](_0x254654));log('[gossip]\x20g'+'ossipNodes'+':\x20'+JSON['stringify'](Object['keys'](_0x58ba0f))+'\x20length:\x20'+Object['keys'](_0x58ba0f)['length']);const _0xdb8b6d={},_0x257fd6={};let _0xad14ff=0x11fc+0x1419+-0x2615;if(_0x5e6e2c['mid']&&_0x5e6e2c['gid']){}else _0x5e6e2c={'message':_0x5e6e2c,'remote':_0x2583fb,'mid':globalThis['distributi'+'on']['util']['id']['getMID'](_0x5e6e2c),'gid':_0x7e53d4['gid']};for(const _0x4d1cb2 of Object['keys'](_0x58ba0f)){const _0x3c96d0=_0x254654[_0x4d1cb2];log('[gossip]\x20s'+'end\x20to\x20nod'+'e:\x20'+JSON['stringify'](_0x3c96d0));const _0x2257f8={'node':{'ip':_0x3c96d0['ip'],'port':_0x3c96d0['port']},'service':'gossip','method':'recv'};globalThis['distributi'+'on']['local']['comm']['send']([_0x5e6e2c],_0x2257f8,(_0x22d19f,_0x3a5b9a)=>{_0x22d19f?_0x257fd6[_0x4d1cb2]=_0x22d19f:_0xdb8b6d[_0x4d1cb2]=_0x3a5b9a;_0xad14ff+=-0x574+-0x13*0x13f+0x1d22;if(_0xad14ff===_0x31f282){if(_0x260c70)return _0x260c70(_0x257fd6,_0xdb8b6d);}});}});}function _0x2bbb66(_0xd34712,_0x2b936b,_0x5ed2b4){const _0x59e8c4=setInterval(_0x2b936b,_0xd34712);if(_0x5ed2b4)return _0x5ed2b4(null,_0x59e8c4);}function _0x2abdd4(_0x9fd6bc,_0x4d2bc2){clearInterval(_0x9fd6bc);if(_0x4d2bc2)return _0x4d2bc2(null,_0x9fd6bc);}return{'send':_0xd2ee67,'at':_0x2bbb66,'del':_0x2abdd4};}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(_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;
9
+ function groups(_0x56f623){const _0x1e2557={'gid':_0x56f623['gid']||'all'};function _0x58d492(_0x16d1c7,_0x256730,_0x702a44){globalThis['distributi'+'on'][_0x1e2557['gid']]['comm']['send']([_0x16d1c7,_0x256730],{'service':'groups','method':'put'},_0x702a44);}function _0x217abb(_0x484944,_0x3477a6){globalThis['distributi'+'on'][_0x1e2557['gid']]['comm']['send']([_0x484944],{'service':'groups','method':'del'},_0x3477a6);}function _0x29759b(_0x1a8c92,_0xe15ee){globalThis['distributi'+'on'][_0x1e2557['gid']]['comm']['send']([_0x1a8c92],{'service':'groups','method':'get'},_0xe15ee);}function _0x57983c(_0x4b1b7c,_0x3ad8e7,_0x151be6){globalThis['distributi'+'on'][_0x1e2557['gid']]['comm']['send']([_0x4b1b7c,_0x3ad8e7],{'service':'groups','method':'add'},_0x151be6);}function _0x598c1c(_0x1770db,_0x29cbfe,_0x341c6c){globalThis['distributi'+'on'][_0x1e2557['gid']]['comm']['send']([_0x1770db,_0x29cbfe],{'service':'groups','method':'rem'},_0x341c6c);}return{'put':_0x58d492,'del':_0x217abb,'get':_0x29759b,'add':_0x57983c,'rem':_0x598c1c};}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 log=require('../util/lo'+'g');function getNode(_0x111c3c,_0xa9948c,_0xc3dd54){typeof _0xa9948c==='object'&&(_0xa9948c=_0xa9948c['key']),global['distributi'+'on'][_0x111c3c['gid']]['status']['get']('nid',(_0x18d379,_0x261442)=>{const _0x5e0440=Object['values'](_0x261442),_0x3397dc=global['distributi'+'on']['util']['id']['getID'](_0xa9948c),_0x3c226d=_0x111c3c['hash'](_0x3397dc,_0x5e0440),_0x40c654=_0x3c226d['substring'](0x140b+0x1a7*0x11+0xca*-0x3d,0xab7*0x1+0x447*-0x7+0x133f);global['distributi'+'on']['local']['groups']['get'](_0x111c3c['gid'],(_0x4018df,_0xc7ce06)=>{const _0x39da56=_0xc7ce06[_0x40c654];log('[mem\x20(getN'+'ode)]\x20conf'+'iguration:'+'\x20'+JSON['stringify'](_0xa9948c)+'group:\x20'+JSON['stringify'](_0xc7ce06)+'\x20node:\x20'+JSON['stringify'](_0x39da56)+'nid:\x20'+JSON['stringify'](_0x3c226d)+'\x20sid:\x20'+JSON['stringify'](_0x40c654)),_0xc3dd54(_0x39da56);});});}function normalize(_0x541312,_0x2bbfc8){const _0x1f1576={};_0x541312===null&&(_0x541312={});if(typeof _0x541312==='string')_0x1f1576['key']=_0x541312,_0x1f1576['gid']=_0x2bbfc8,_0x1f1576['action']='put';else typeof _0x541312==='object'&&(_0x1f1576['key']=_0x541312['key'],_0x1f1576['gid']=_0x541312['gid']||_0x2bbfc8,_0x1f1576['action']=_0x541312['action']||'put');return _0x1f1576;};function mem(_0x2a6eef){const _0x5936df={};return _0x5936df['gid']=_0x2a6eef['gid']||'all',_0x5936df['hash']=_0x2a6eef['hash']||global['distributi'+'on']['util']['id']['naiveHash'],{'get':(_0x2b3a80,_0x2313c9)=>{if(!_0x2b3a80){const _0x55a4bd=[{'key':null,'gid':_0x5936df['gid']}];global['distributi'+'on'][_0x5936df['gid']]['comm']['send'](_0x55a4bd,{'service':'mem','method':'get'},(_0x5210dc,_0x5285f1)=>{const _0x562538=Object['values'](_0x5285f1)['reduce']((_0x1fce90,_0xf5b981)=>_0x1fce90['concat'](_0xf5b981),[]);_0x2313c9(_0x5210dc,_0x562538);});return;}_0x2b3a80=normalize(_0x2b3a80,_0x5936df['gid']),getNode(_0x5936df,_0x2b3a80,_0x88428c=>{const _0x1799a8=[_0x2b3a80],_0x4e40a8={'service':'mem','method':'get','node':_0x88428c};log('[all.mem.g'+'et]\x20config'+'uration:\x20'+JSON['stringify'](_0x2b3a80)+'\x20node:\x20'+JSON['stringify'](global['nodeConfig'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x88428c)),global['distributi'+'on']['local']['comm']['send'](_0x1799a8,_0x4e40a8,_0x2313c9);});},'put':(_0x29f53f,_0x505ad7,_0x47f532)=>{_0x505ad7=_0x505ad7||global['distributi'+'on']['util']['id']['getID'](_0x29f53f),_0x505ad7=normalize(_0x505ad7,_0x5936df['gid']),getNode(_0x5936df,_0x505ad7,_0x59dedd=>{const _0x5c9cad=[_0x29f53f,_0x505ad7],_0x4ff479={'service':'mem','method':'put','node':_0x59dedd};log('[all.mem.p'+'ut]\x20state:'+'\x20'+JSON['stringify'](_0x29f53f)+('configurat'+'ion:\x20')+JSON['stringify'](_0x505ad7)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x59dedd)),global['distributi'+'on']['local']['comm']['send'](_0x5c9cad,_0x4ff479,_0x47f532);});},'del':(_0x3b333b,_0x71fcd8)=>{getNode(_0x5936df,_0x3b333b,_0x3ed0ca=>{const _0x121508=[{'key':_0x3b333b,'gid':_0x5936df['gid']}],_0x3a2c7f={'service':'mem','method':'del','node':_0x3ed0ca};global['distributi'+'on']['local']['comm']['send'](_0x121508,_0x3a2c7f,_0x71fcd8);});},'reconf':(_0x391133,_0xbbb31e)=>{log('[mem.recon'+'f]\x20configu'+'ration:\x20'+JSON['stringify'](_0x391133)+'\x20gid:\x20'+_0x5936df['gid']),global['distributi'+'on']['local']['groups']['get'](_0x5936df['gid'],(_0x211621,_0x548a2c)=>{global['distributi'+'on']['local']['groups']['put'](_0x5936df['gid'],_0x391133,(_0x37c8f7,_0xbd0007)=>{global['distributi'+'on'][_0x5936df['gid']]['mem']['get'](null,(_0x23848d,_0x43218e)=>{global['distributi'+'on']['local']['groups']['put'](_0x5936df['gid'],_0x548a2c,(_0x59b1cf,_0x38b439)=>{global['distributi'+'on'][_0x5936df['gid']]['status']['get']('nid',(_0x428317,_0x3e436e)=>{const _0x3d6258=Object['values'](_0x3e436e),_0x1c1bfe=Object['values'](_0x391133)['map'](_0x42df17=>global['distributi'+'on']['util']['id']['getNID'](_0x42df17));log('[mem.recon'+'f\x20received'+'\x20'+_0x43218e['length']+('\x20keys\x20from'+'\x20')+_0x3e436e['length']+'\x20nodes');let _0x24186a=0xbd7+0x1ba9+-0x2780;const _0x1af374=()=>{_0x24186a===_0x43218e['length']&&_0xbbb31e();};if(_0x43218e['length']===0xe0b*0x2+-0x3c*-0x31+-0x2792){_0xbbb31e();return;}for(const _0x2c5404 of _0x43218e){const _0x27a536=global['distributi'+'on']['util']['id']['getID'](_0x2c5404),_0x16d7f8=_0x5936df['hash'](_0x27a536,_0x1c1bfe),_0x2a9707=_0x5936df['hash'](_0x27a536,_0x3d6258);log('[mem.recon'+'f]\x20old\x20nid'+':\x20'+_0x16d7f8+'\x20new\x20nid:\x20'+_0x2a9707);if(_0x16d7f8===_0x2a9707){_0x24186a++,_0x1af374();continue;}const _0x296cb9=_0x391133[_0x16d7f8['substring'](0xdf5+-0x5*0x607+0x102e,-0x1ca8+0x2*0xee6+-0x11f)],_0x552db6=[{'key':_0x2c5404,'gid':_0x5936df['gid']}],_0x417f4a={'service':'mem','method':'del','node':_0x296cb9};log('[mem.recon'+'f]\x20deletin'+'g\x20key\x20'+_0x2c5404+'\x20from\x20'+JSON['stringify'](_0x417f4a)),global['distributi'+'on']['local']['comm']['send'](_0x552db6,_0x417f4a,(_0x178310,_0x1261fa)=>{global['distributi'+'on'][_0x5936df['gid']]['mem']['put'](_0x1261fa,_0x2c5404,(_0x55017c,_0x2de173)=>{_0x24186a++,_0x1af374();});});}});});});});});}};};module['exports']=mem;
9
+ const log=require('../util/lo'+'g.js'),id=require('../util/id'+'.js');function normalize(_0x591c23,_0x20082e){if(_0x591c23===null)return{'key':null,'gid':_0x20082e,'action':'put'};else return typeof _0x591c23==='string'?{'key':_0x591c23,'gid':_0x20082e,'action':'put'}:_0x591c23;}function mem(_0x356653){const _0x196bbd={};_0x196bbd['gid']=_0x356653['gid']||'all',_0x196bbd['hash']=_0x356653['hash']||id['naiveHash'];function _0x5b04f0(_0x23d0a8,_0x4ad4d1){log('[all.mem.g'+'et]\x20config'+'uration:\x20'+JSON['stringify'](_0x23d0a8)+'\x20context:\x20'+JSON['stringify'](_0x196bbd)),_0x23d0a8=normalize(_0x23d0a8,_0x196bbd['gid']),_0x23d0a8['gid']=_0x23d0a8['gid']||_0x196bbd['gid'];const _0x119b8a={'service':'mem','method':'get'},_0x577f36=[_0x23d0a8];if(!_0x23d0a8['key']){globalThis['distributi'+'on'][_0x196bbd['gid']]['comm']['send'](_0x577f36,_0x119b8a,(_0x22554e,_0x1f7e60)=>{const _0x1b51ed=Object['values'](_0x1f7e60)['reduce']((_0x1bd2fe,_0x39aa0c)=>_0x1bd2fe['concat'](_0x39aa0c),[]);_0x4ad4d1(_0x22554e,_0x1b51ed);});return;}const _0x288021=_0x23d0a8['key'];if(_0x288021===null){_0x4ad4d1(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x577f36,_0x119b8a,{'key':_0x288021},_0x196bbd,_0x4ad4d1);}function _0x2728a8(_0x254a67,_0x154f9e,_0x33d4d4){log('[all.mem.p'+'ut]\x20state:'+'\x20'+JSON['stringify'](_0x254a67)+('\x20configura'+'tion:\x20')+JSON['stringify'](_0x154f9e)),_0x154f9e=_0x154f9e||globalThis['distributi'+'on']['util']['id']['getID'](_0x254a67),_0x154f9e=normalize(_0x154f9e,_0x196bbd['gid']),_0x154f9e['gid']=_0x154f9e['gid']||_0x196bbd['gid'];const _0x3519e7={'service':'mem','method':'put'},_0x415567=[_0x254a67,_0x154f9e],_0x303888=_0x154f9e['key'];if(_0x303888===null){_0x33d4d4(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x415567,_0x3519e7,{'key':_0x303888},_0x196bbd,_0x33d4d4);}function _0x4adf94(_0x2aede1,_0x3c4fb6){log('[all.mem.d'+'el]\x20config'+'uration:\x20'+JSON['stringify'](_0x2aede1)),_0x2aede1=normalize(_0x2aede1,_0x196bbd['gid']),_0x2aede1['gid']=_0x2aede1['gid']||_0x196bbd['gid'];const _0x2bb8f7={'service':'mem','method':'del'},_0x5e54fe=[_0x2aede1],_0x21dee8=_0x2aede1['key'];if(_0x21dee8===null){_0x3c4fb6(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x5e54fe,_0x2bb8f7,{'key':_0x21dee8},_0x196bbd,_0x3c4fb6);}function _0x22bb56(_0x572579,_0x3b7c89){log('[mem.recon'+'f]\x20configu'+'ration:\x20'+JSON['stringify'](_0x572579)+'\x20gid:\x20'+_0x196bbd['gid']),globalThis['distributi'+'on']['local']['groups']['get'](_0x196bbd['gid'],(_0x4120d2,_0x2bc999)=>{if(!_0x2bc999){_0x3b7c89(_0x4120d2);return;}globalThis['distributi'+'on']['local']['groups']['put'](_0x196bbd['gid'],_0x572579,(_0x2194b0,_0x411fcc)=>{globalThis['distributi'+'on'][_0x196bbd['gid']]['mem']['get'](null,(_0x6ee088,_0x24f514)=>{globalThis['distributi'+'on']['local']['groups']['put'](_0x196bbd['gid'],_0x2bc999,(_0x3f0344,_0x2d8cf0)=>{globalThis['distributi'+'on'][_0x196bbd['gid']]['status']['get']('nid',(_0xb514ce,_0x96f40f)=>{const _0x2ee36e=Object['values'](_0x96f40f),_0xc4b120=Object['values'](_0x572579)['map'](_0x107508=>globalThis['distributi'+'on']['util']['id']['getNID'](_0x107508));log('[mem.recon'+'f\x20received'+'\x20'+_0x24f514['length']+('\x20keys\x20from'+'\x20')+_0x96f40f['length']+'\x20nodes');let _0x1e85c2=0x2134+0x1701+-0x3835*0x1;const _0x3b61f0=()=>{if(_0x1e85c2===_0x24f514['length'])return _0x3b7c89(null);};if(_0x24f514['length']===0x1878+0x50*-0x5f+0x2*0x29c)return _0x3b7c89(null);for(const _0x250562 of _0x24f514){const _0x25d18a=globalThis['distributi'+'on']['util']['id']['getID'](_0x250562),_0x3514a1=_0x196bbd['hash'](_0x25d18a,_0xc4b120),_0x392cbf=_0x196bbd['hash'](_0x25d18a,_0x2ee36e);log('[mem.recon'+'f]\x20old\x20nid'+':\x20'+_0x3514a1+'\x20new\x20nid:\x20'+_0x392cbf);if(_0x3514a1===_0x392cbf){_0x1e85c2++,_0x3b61f0();continue;}const _0x54967f=_0x572579[_0x3514a1['substring'](-0x1*-0x7a+0x1*0x1861+-0x18db,0x92f+0x13c5+0x9*-0x337)],_0x401ab4=[{'key':_0x250562,'gid':_0x196bbd['gid']}],_0x4a9164={'service':'mem','method':'del','node':_0x54967f};log('[mem.recon'+'f]\x20deletin'+'g\x20key\x20'+_0x250562+'\x20from\x20'+JSON['stringify'](_0x4a9164)),globalThis['distributi'+'on']['local']['comm']['send'](_0x401ab4,_0x4a9164,(_0x3ca5e3,_0x5338c0)=>{globalThis['distributi'+'on'][_0x196bbd['gid']]['mem']['put'](_0x5338c0,_0x250562,(_0x526b36,_0x356fa2)=>{_0x1e85c2++,_0x3b61f0();});});}});});});});});}return{'get':_0x5b04f0,'put':_0x2728a8,'del':_0x4adf94,'reconf':_0x22bb56};}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(_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;
9
+ const distribution=globalThis['distributi'+'on'],id=distribution['util']['id'];function mr(_0xf4cbb9){const _0x707940={'gid':_0xf4cbb9['gid']||'all'};function _0x270ccb(_0x2ad961,_0x56453d){const _0x2358ea=id['getID'](_0x2ad961),_0x302c1f={'mapper':_0x2ad961['map'],'reducer':_0x2ad961['reduce'],'map':function(_0x2c273e,_0x4724c8,_0x15a73e,_0x109504){if(_0x2c273e['length']==0x185b+0xd99+-0x1*0x25f4){_0x109504(null,[]);return;}else{const _0x1df933=[];let _0xef08f0=-0x1*-0x14bf+0x15a6+-0x2a65;_0x2c273e['forEach'](_0x5c82d2=>{globalThis['distributi'+'on'][_0x4724c8]['store']['get'](_0x5c82d2,(_0x344efc,_0x527f89)=>{_0xef08f0++;const _0xe5371e=this['mapper'](_0x5c82d2,_0x527f89);Array['isArray'](_0xe5371e)?_0x1df933['push'](..._0xe5371e):_0x1df933['push'](_0xe5371e),_0xef08f0==_0x2c273e['length']&&distribution['local']['store']['put'](_0x1df933,_0x15a73e+'_map',(_0x1d3f23,_0x2ef5a7)=>{_0x109504(_0x1d3f23,_0x1df933);});});});}},'shuffle':function(_0x52b2b6,_0x30e894,_0x52ec8f){distribution['local']['store']['get'](_0x30e894+'_map',(_0x5bfdcd,_0x1c98c7)=>{if(!_0x5bfdcd){let _0xfa8489=-0x2472*-0x1+0x25c+0x1367*-0x2;_0x1c98c7['forEach'](_0xd51477=>{const [_0x336acc]=Object['keys'](_0xd51477);distribution[_0x52b2b6]['mem']['put'](_0xd51477[_0x336acc],{'key':_0x336acc,'action':'append','gid':_0x52b2b6},(_0x4073b0,_0x159ae0)=>{_0xfa8489++;if(_0xfa8489==_0x1c98c7['length'])return _0x52ec8f(null,_0x1c98c7);});});}else return _0x52ec8f(_0x5bfdcd,{});});},'reduce':function(_0x49655b,_0x34b3ac,_0x3d0b83){distribution['local']['mem']['get']({'key':null,'gid':_0x49655b},(_0x429ace,_0x532376)=>{let _0x20d7dd=[],_0xce52=0x206b*0x1+-0x15c+-0x1f0f;if(_0x532376['length']==-0xc9c+0x1*-0x1107+0x1da3)return _0x3d0b83(null,null);_0x532376['forEach'](_0x269e79=>distribution['local']['mem']['get']({'key':_0x269e79,'gid':_0x49655b},(_0x44780d,_0x2f72cc)=>{const _0x1e3f1f=this['reducer'](_0x269e79,_0x2f72cc);_0x20d7dd=_0x20d7dd['concat'](_0x1e3f1f),_0xce52++;if(_0xce52==_0x532376['length'])return _0x3d0b83(null,_0x20d7dd);}));});}},_0x375723=function(_0x18ac26,_0x228163){const _0x57b67c={};return Object['keys'](_0x228163)['forEach'](_0x37e364=>{_0x57b67c[_0x37e364]=[];}),_0x18ac26['forEach'](_0x278e6c=>{const _0x483b40=id['getID'](_0x278e6c),_0x233b95=id['naiveHash'](_0x483b40,Object['keys'](_0x228163));_0x57b67c[_0x233b95]['push'](_0x278e6c);}),_0x57b67c;};distribution[_0x707940['gid']]['routes']['put'](_0x302c1f,'mr-'+_0x2358ea,(_0x48d608,_0xf9afc9)=>{distribution['local']['groups']['get'](_0x707940['gid'],(_0x283c57,_0x31d1ce)=>{if(!_0x31d1ce){_0x56453d(_0x283c57);return;}const _0x88a35e=_0x375723(_0x2ad961['keys'],_0x31d1ce);let _0x25a06e=-0xeaa+-0x24cb+0x3375*0x1;const _0xdd60e1=Object['keys'](_0x31d1ce)['length'],_0x99ab6e={'service':'mr-'+_0x2358ea,'method':'map'};for(const _0xf9a29e in _0x31d1ce){const _0x58617b=[_0x88a35e[_0xf9a29e],_0x707940['gid'],_0x2358ea];distribution['local']['comm']['send'](_0x58617b,{'node':_0x31d1ce[_0xf9a29e],..._0x99ab6e},(_0xb945ed,_0x4124a2)=>{++_0x25a06e;if(_0x25a06e==_0xdd60e1){const _0x5620b6={'service':'mr-'+_0x2358ea,'method':'shuffle'};distribution[_0x707940['gid']]['comm']['send']([_0x707940['gid'],_0x2358ea],_0x5620b6,(_0x3c6981,_0x546c28)=>{const _0xe0f533={'service':'mr-'+_0x2358ea,'method':'reduce'};distribution[_0x707940['gid']]['comm']['send']([_0x707940['gid'],_0x2358ea],_0xe0f533,(_0x2fd6f4,_0x15805c)=>{let _0x1b85c8=[];for(const _0x247847 of Object['values'](_0x15805c)){_0x247847!==null&&(_0x1b85c8=_0x1b85c8['concat'](_0x247847));}_0x56453d(null,_0x1b85c8);return;});});}});}});});}return{'exec':_0x270ccb};}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(_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;
9
+ function routes(_0x513848){const _0x4603d3={};_0x4603d3['gid']=_0x513848['gid']||'all';function _0x2afdbd(_0x109390,_0x50e101,_0x45a542){globalThis['distributi'+'on'][_0x4603d3['gid']]['comm']['send']([_0x109390,_0x50e101],{'service':'routes','method':'put'},_0x45a542);}function _0x22234e(_0x5744d0,_0xc676ed){globalThis['distributi'+'on'][_0x4603d3['gid']]['comm']['send']([_0x5744d0],{'service':'routes','method':'rem'},_0xc676ed);}return{'put':_0x2afdbd,'rem':_0x22234e};}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(_0x1e3b46){const _0x3b1b54={};return _0x3b1b54['gid']=_0x1e3b46['gid']||'all',{'get':(_0xc7f557,_0x30190d)=>{const _0x3e3351=[_0xc7f557],_0x6d04b1={'service':'status','method':'get'};global['distributi'+'on'][_0x3b1b54['gid']]['comm']['send'](_0x3e3351,_0x6d04b1,(_0x738f8,_0xed0db9)=>{switch(_0xc7f557){case'heapTotal':const _0x349f74=Object['values'](_0xed0db9)['reduce']((_0x36089f,_0x232364)=>{return _0x36089f+_0x232364;},0x8d1*0x1+0x1dbd*0x1+-0x7b6*0x5);_0x30190d(_0x738f8,_0x349f74);break;case'nid':const _0x3b4cf1=Object['values'](_0xed0db9)['reduce']((_0x14780c,_0x32de0a)=>{return _0x14780c['concat'](_0x32de0a);},[]);_0x30190d(_0x738f8,_0x3b4cf1);break;default:_0x30190d(_0x738f8,_0xed0db9);break;}});},'spawn':(_0x528840,_0x1fbc49)=>{_0x1fbc49=_0x1fbc49||function(){},global['distributi'+'on']['local']['status']['spawn'](_0x528840,(_0x19d3d4,_0x39ecdd)=>{_0x19d3d4?_0x1fbc49(_0x19d3d4):global['distributi'+'on']['local']['groups']['add'](_0x3b1b54['gid'],_0x528840,()=>{_0x1fbc49(null,_0x39ecdd);}),global['distributi'+'on'][_0x3b1b54['gid']]['comm']['send']([_0x3b1b54['gid'],_0x528840],{'service':'groups','method':'add'},()=>{});});},'stop':_0x13f4f2=>{global['distributi'+'on'][_0x3b1b54['gid']]['comm']['send']([],{'service':'status','method':'stop'},()=>{global['distributi'+'on']['local']['status']['stop'](_0x13f4f2);});}};};module['exports']=status;
9
+ function status(_0x543e8f){const _0x30aea1={};_0x30aea1['gid']=_0x543e8f['gid']||'all';function _0x4657fd(_0x81d5fe,_0x39c5e3){const _0x202a65=[_0x81d5fe],_0x1b1a26={'service':'status','method':'get'};globalThis['distributi'+'on'][_0x30aea1['gid']]['comm']['send'](_0x202a65,_0x1b1a26,(_0xef2e3e,_0x27ae26)=>{switch(_0x81d5fe){case'heapTotal':const _0x53e3d1=Object['values'](_0x27ae26)['reduce']((_0x46c7b4,_0x56cc4b)=>{return _0x46c7b4+_0x56cc4b;},-0x24*-0x68+-0x165c+0x7bc);return _0x39c5e3(_0xef2e3e,_0x53e3d1);break;case'nid':const _0x1bb02d=Object['values'](_0x27ae26)['reduce']((_0x2eff33,_0x5ce96f)=>{return _0x2eff33['concat'](_0x5ce96f);},[]);return _0x39c5e3(_0xef2e3e,_0x1bb02d);break;default:return _0x39c5e3(_0xef2e3e,_0x27ae26);break;}});}function _0x1575b2(_0x1fdcdc,_0x535956){globalThis['distributi'+'on']['local']['status']['spawn'](_0x1fdcdc,(_0x5a2284,_0x89795f)=>{globalThis['distributi'+'on'][_0x30aea1['gid']]['comm']['send']([_0x30aea1['gid'],_0x1fdcdc],{'service':'groups','method':'add'},()=>{});if(_0x5a2284)return _0x535956(_0x5a2284);globalThis['distributi'+'on']['local']['groups']['add'](_0x30aea1['gid'],_0x1fdcdc,()=>{return _0x535956(null,_0x89795f);});});}function _0x5ee009(_0x1354c7){globalThis['distributi'+'on'][_0x30aea1['gid']]['comm']['send']([],{'service':'status','method':'stop'},()=>{globalThis['distributi'+'on']['local']['status']['stop'](_0x1354c7);});}return{'get':_0x4657fd,'stop':_0x5ee009,'spawn':_0x1575b2};}module['exports']=status;
10
10
  /* eslint-enable */
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
6
6
 
7
7
  If you notice any issues with using this file, please contact the TAs.
8
8
  */
9
- const log=require('../util/lo'+'g');function getNode(_0x21fc30,_0x42c639,_0x1ad957){typeof _0x42c639==='object'&&(_0x42c639=_0x42c639['key']),global['distributi'+'on'][_0x21fc30['gid']]['status']['get']('nid',(_0x55324c,_0x16e6fe)=>{const _0x2d9c65=Object['values'](_0x16e6fe),_0x134bf9=global['distributi'+'on']['util']['id']['getID'](_0x42c639),_0x17dc6e=_0x21fc30['hash'](_0x134bf9,_0x2d9c65),_0x4cae62=_0x17dc6e['substring'](0x135f+-0x26fe+0x139f,0x41f+0x2182+0x259c*-0x1);global['distributi'+'on']['local']['groups']['get'](_0x21fc30['gid'],(_0x121969,_0x3aeb0e)=>{const _0x339dbf=_0x3aeb0e[_0x4cae62];log('[store\x20(ge'+'tNode)]\x20co'+'nfiguratio'+'n:\x20'+JSON['stringify'](_0x42c639)+'group:\x20'+JSON['stringify'](_0x3aeb0e)+'\x20node:\x20'+JSON['stringify'](_0x339dbf)+'nid:\x20'+JSON['stringify'](_0x17dc6e)+'\x20sid:\x20'+JSON['stringify'](_0x4cae62)),_0x1ad957(_0x339dbf);});});}function normalize(_0x10fcce,_0x337439){const _0x28b31b={};_0x10fcce===null&&(_0x10fcce={});if(typeof _0x10fcce==='string')_0x28b31b['key']=_0x10fcce,_0x28b31b['gid']=_0x337439,_0x28b31b['action']='put';else typeof _0x10fcce==='object'&&(_0x28b31b['key']=_0x10fcce['key'],_0x28b31b['gid']=_0x10fcce['gid']||_0x337439,_0x28b31b['action']=_0x10fcce['action']||'put');return _0x28b31b;};function store(_0x5ba65d){const _0x560400={};return _0x560400['gid']=_0x5ba65d['gid']||'all',_0x560400['hash']=_0x5ba65d['hash']||global['distributi'+'on']['util']['id']['naiveHash'],{'get':(_0x5ca58b,_0xb2d2d0)=>{if(!_0x5ca58b){const _0x581c03=[{'key':null,'gid':_0x560400['gid']}];global['distributi'+'on'][_0x560400['gid']]['comm']['send'](_0x581c03,{'service':'store','method':'get'},(_0xd82776,_0x5c34f0)=>{const _0x3b64c9=Object['values'](_0x5c34f0)['reduce']((_0x16afaa,_0x2cc3c9)=>_0x16afaa['concat'](_0x2cc3c9),[]);_0xb2d2d0(_0xd82776,_0x3b64c9);});return;}_0x5ca58b=normalize(_0x5ca58b,_0x560400['gid']),getNode(_0x560400,_0x5ca58b,_0x49a7df=>{const _0x1dc45c=[_0x5ca58b],_0x5b7657={'service':'store','method':'get','node':_0x49a7df};log('[all.store'+'.get]\x20conf'+'iguration:'+'\x20'+JSON['stringify'](_0x5ca58b)+'\x20node:\x20'+JSON['stringify'](global['nodeConfig'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x49a7df)),global['distributi'+'on']['local']['comm']['send'](_0x1dc45c,_0x5b7657,_0xb2d2d0);});},'put':(_0x3c26b,_0x1cd92c,_0x1e0393)=>{_0x1cd92c=_0x1cd92c||global['distributi'+'on']['util']['id']['getID'](_0x3c26b),_0x1cd92c=normalize(_0x1cd92c,_0x560400['gid']),getNode(_0x560400,_0x1cd92c,_0x51df7f=>{const _0x1065b5=[_0x3c26b,_0x1cd92c],_0x3535e0={'service':'store','method':'put','node':_0x51df7f};log('[all.store'+'.put]\x20stat'+'e:\x20'+JSON['stringify'](_0x3c26b)+('configurat'+'ion:\x20')+JSON['stringify'](_0x1cd92c)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x51df7f)),global['distributi'+'on']['local']['comm']['send'](_0x1065b5,_0x3535e0,_0x1e0393);});},'del':(_0x2f5012,_0x169b9c)=>{getNode(_0x560400,_0x2f5012,_0x1cc661=>{const _0x553f84=[{'key':_0x2f5012,'gid':_0x560400['gid']}],_0x143f9d={'service':'store','method':'del','node':_0x1cc661};global['distributi'+'on']['local']['comm']['send'](_0x553f84,_0x143f9d,_0x169b9c);});},'reconf':(_0x226cc9,_0x2a23b1)=>{log('[store.rec'+'onf]\x20confi'+'guration:\x20'+JSON['stringify'](_0x226cc9)+'\x20gid:\x20'+_0x560400['gid']),global['distributi'+'on']['local']['groups']['get'](_0x560400['gid'],(_0x598d36,_0xb4a9a5)=>{global['distributi'+'on']['local']['groups']['put'](_0x560400['gid'],_0x226cc9,(_0x35827c,_0x31855c)=>{global['distributi'+'on'][_0x560400['gid']]['store']['get'](null,(_0x240421,_0xbe9ae6)=>{global['distributi'+'on']['local']['groups']['put'](_0x560400['gid'],_0xb4a9a5,(_0x43d5d9,_0x5f3fae)=>{global['distributi'+'on'][_0x560400['gid']]['status']['get']('nid',(_0x37863f,_0xd6ffea)=>{const _0x433615=Object['values'](_0xd6ffea),_0x584f0f=Object['values'](_0x226cc9)['map'](_0x533edd=>global['distributi'+'on']['util']['id']['getNID'](_0x533edd));log('[store.rec'+'onf\x20receiv'+'ed\x20'+_0xbe9ae6['length']+('\x20keys\x20from'+'\x20')+_0xd6ffea['length']+'\x20nodes');let _0x3f9805=-0x1610+0x88c+-0x4*-0x361;const _0x2caf05=()=>{_0x3f9805===_0xbe9ae6['length']&&_0x2a23b1();};if(_0xbe9ae6['length']===-0x2*0x841+0x12a7+-0x225){_0x2a23b1();return;}for(const _0x58ee53 of _0xbe9ae6){const _0x592d54=global['distributi'+'on']['util']['id']['getID'](_0x58ee53),_0x469cf6=_0x560400['hash'](_0x592d54,_0x584f0f),_0x5defc8=_0x560400['hash'](_0x592d54,_0x433615);log('[store.rec'+'onf]\x20old\x20n'+'id:\x20'+_0x469cf6+'\x20new\x20nid:\x20'+_0x5defc8);if(_0x469cf6===_0x5defc8){_0x3f9805++,_0x2caf05();continue;}const _0x5c63cf=_0x226cc9[_0x469cf6['substring'](0x87d*-0x3+0x1c2a+-0x1*0x2b3,0xbe6*-0x1+0x1*0x1fc5+-0x4d*0x42)],_0x47c76e=[{'key':_0x58ee53,'gid':_0x560400['gid']}],_0x39fa14={'service':'store','method':'del','node':_0x5c63cf};log('[store.rec'+'onf]\x20delet'+'ing\x20key\x20'+_0x58ee53+'\x20from\x20'+JSON['stringify'](_0x39fa14)),global['distributi'+'on']['local']['comm']['send'](_0x47c76e,_0x39fa14,(_0x52f0b8,_0x13bdd2)=>{global['distributi'+'on'][_0x560400['gid']]['store']['put'](_0x13bdd2,_0x58ee53,(_0x316341,_0x4e0d62)=>{_0x3f9805++,_0x2caf05();});});}});});});});});}};};module['exports']=store;
9
+ const log=require('../util/lo'+'g.js'),id=require('../util/id'+'.js');function getNode(_0x54f2ab,_0x104310,_0x417e49){const _0x286a0c=_0x104310&&typeof _0x104310==='object'?_0x104310['key']:_0x104310;globalThis['distributi'+'on'][_0x54f2ab['gid']]['status']['get']('nid',(_0x1bb184,_0x1094d6)=>{const _0x4ce8c6=Object['values'](_0x1094d6),_0x170a06=globalThis['distributi'+'on']['util']['id']['getID'](_0x286a0c),_0x884c49=_0x54f2ab['hash'](_0x170a06,_0x4ce8c6),_0x3b2660=_0x884c49['substring'](0x756+0xf51+0x16a7*-0x1,0x2*-0xe35+0x674+0x15fb);globalThis['distributi'+'on']['local']['groups']['get'](_0x54f2ab['gid'],(_0x417d10,_0x1e541a)=>{if(!_0x1e541a)return _0x417e49(_0x417d10);else{const _0x5a6480=_0x1e541a[_0x3b2660];return log('[store\x20(ge'+'tNode)]\x20co'+'nfiguratio'+'n:\x20'+JSON['stringify'](_0x104310)+'group:\x20'+JSON['stringify'](_0x1e541a)+'\x20node:\x20'+JSON['stringify'](_0x5a6480)+'nid:\x20'+JSON['stringify'](_0x884c49)+'\x20sid:\x20'+JSON['stringify'](_0x3b2660)),_0x417e49(null,_0x5a6480);}});});}function normalize(_0x58ddde,_0x2fc7b5){if(_0x58ddde===null)return{'key':null,'gid':_0x2fc7b5,'action':'put'};else return typeof _0x58ddde==='string'?{'key':_0x58ddde,'gid':_0x2fc7b5,'action':'put'}:_0x58ddde;}function store(_0x4ce0c4){const _0x342ef9={'gid':_0x4ce0c4['gid']||'all','hash':_0x4ce0c4['hash']||id['naiveHash'],'subset':_0x4ce0c4['subset']};function _0x5eee3b(_0x31d5d4,_0x45697f){if(!_0x31d5d4){const _0x4f822c=[{'key':null,'gid':_0x342ef9['gid']}];globalThis['distributi'+'on'][_0x342ef9['gid']]['comm']['send'](_0x4f822c,{'service':'store','method':'get'},(_0x24701d,_0x59d7ae)=>{const _0x27749b=Object['values'](_0x59d7ae)['reduce']((_0x3ffffc,_0x80eed9)=>_0x3ffffc['concat'](_0x80eed9),[]);_0x45697f(_0x24701d,_0x27749b);});return;}_0x31d5d4=normalize(_0x31d5d4,_0x342ef9['gid']),getNode(_0x342ef9,_0x31d5d4,(_0x4b8867,_0x524904)=>{if(!_0x524904){_0x45697f(_0x4b8867);return;}const _0x3578bd=[_0x31d5d4],_0x3061cf={'service':'store','method':'get','node':_0x524904};log('[all.store'+'.get]confi'+'guration:\x20'+JSON['stringify'](_0x31d5d4)+'node:\x20'+JSON['stringify'](globalThis['distributi'+'on']['node']['config'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x524904)),globalThis['distributi'+'on']['local']['comm']['send'](_0x3578bd,_0x3061cf,_0x45697f);});}function _0x258e41(_0x2d3ff1,_0x469b5e,_0x41fd2b){_0x469b5e=_0x469b5e||globalThis['distributi'+'on']['util']['id']['getID'](_0x2d3ff1),_0x469b5e=normalize(_0x469b5e,_0x342ef9['gid']),getNode(_0x342ef9,_0x469b5e,(_0x15be48,_0x14b088)=>{if(!_0x14b088){_0x41fd2b(_0x15be48);return;}const _0x2e5ef8=[_0x2d3ff1,_0x469b5e],_0x4a465f={'service':'store','method':'put','node':_0x14b088};log('[all.store'+'.put]\x20stat'+'e:\x20'+JSON['stringify'](_0x2d3ff1)+('configurat'+'ion:\x20')+JSON['stringify'](_0x469b5e)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x14b088)),globalThis['distributi'+'on']['local']['comm']['send'](_0x2e5ef8,_0x4a465f,_0x41fd2b);});}function _0x43d7ee(_0x5e4181,_0x599c54){getNode(_0x342ef9,_0x5e4181,(_0x3e7c40,_0x2e63a2)=>{if(!_0x2e63a2){_0x599c54(_0x3e7c40);return;}const _0x3af5a1=[{'key':_0x5e4181,'gid':_0x342ef9['gid']}],_0x1dc4d1={'service':'store','method':'del','node':_0x2e63a2};globalThis['distributi'+'on']['local']['comm']['send'](_0x3af5a1,_0x1dc4d1,_0x599c54);});}function _0x125e7f(_0x24a30c,_0xa57bbb){log('[store.rec'+'onf]\x20confi'+'guration:\x20'+JSON['stringify'](_0x24a30c)+'\x20gid:\x20'+_0x342ef9['gid']),globalThis['distributi'+'on']['local']['groups']['get'](_0x342ef9['gid'],(_0x3617a4,_0x16ec7c)=>{if(!_0x16ec7c){_0xa57bbb(_0x3617a4);return;}globalThis['distributi'+'on']['local']['groups']['put'](_0x342ef9['gid'],_0x24a30c,(_0x3b0ae4,_0x30e7ab)=>{globalThis['distributi'+'on'][_0x342ef9['gid']]['store']['get'](null,(_0x14b1ba,_0x731a19)=>{globalThis['distributi'+'on']['local']['groups']['put'](_0x342ef9['gid'],_0x16ec7c,(_0x148482,_0xe6899f)=>{globalThis['distributi'+'on'][_0x342ef9['gid']]['status']['get']('nid',(_0xa49683,_0x25087d)=>{const _0x1c4cfb=Object['values'](_0x25087d),_0x47f47e=Object['values'](_0x24a30c)['map'](_0xc416e7=>globalThis['distributi'+'on']['util']['id']['getNID'](_0xc416e7));log('[store.rec'+'onf\x20receiv'+'ed\x20'+_0x731a19['length']+('\x20keys\x20from'+'\x20')+_0x25087d['length']+'\x20nodes');let _0xa392ee=-0x657+-0x26b*0x4+-0x1003*-0x1;const _0x43432d=()=>{if(_0xa392ee===_0x731a19['length'])return _0xa57bbb(null);};if(_0x731a19['length']===-0xb43*-0x1+-0x12da*-0x1+0x1e1d*-0x1)return _0xa57bbb(null);for(const _0x4cda3e of _0x731a19){const _0x18d567=globalThis['distributi'+'on']['util']['id']['getID'](_0x4cda3e),_0x138fb2=_0x342ef9['hash'](_0x18d567,_0x47f47e),_0x9791cf=_0x342ef9['hash'](_0x18d567,_0x1c4cfb);log('[store.rec'+'onf]\x20old\x20n'+'id:\x20'+_0x138fb2+'\x20new\x20nid:\x20'+_0x9791cf);if(_0x138fb2===_0x9791cf){_0xa392ee++,_0x43432d();continue;}const _0x48e3af=_0x24a30c[_0x138fb2['substring'](0x1b5*0x14+-0x17*-0x65+-0x2b37,0x324+-0x1*-0x18c5+0x4*-0x6f9)],_0x2a66f7=[{'key':_0x4cda3e,'gid':_0x342ef9['gid']}],_0x465828={'service':'store','method':'del','node':_0x48e3af};log('[store.rec'+'onf]\x20delet'+'ing\x20key\x20'+_0x4cda3e+'\x20from\x20'+JSON['stringify'](_0x465828)),globalThis['distributi'+'on']['local']['comm']['send'](_0x2a66f7,_0x465828,(_0x4628e6,_0x3ef34a)=>{globalThis['distributi'+'on'][_0x342ef9['gid']]['store']['put'](_0x3ef34a,_0x4cda3e,(_0x2dd16d,_0x53a8b6)=>{_0xa392ee++,_0x43432d();});});}});});});});});}return{'get':_0x5eee3b,'put':_0x258e41,'del':_0x43d7ee,'reconf':_0x125e7f};}module['exports']=store;
10
10
  /* eslint-enable */
@@ -0,0 +1,20 @@
1
+ import { GroupServices } from "./all/all.js";
2
+ import { Node } from "./types.js";
3
+ import { Server, IncomingMessage, ServerResponse } from "http";
4
+
5
+ export {};
6
+
7
+ declare global {
8
+ var distribution: {
9
+ util: typeof import("./util/util.js"),
10
+ local: typeof import('./local/local.js'),
11
+ all: GroupServices,
12
+ node: {
13
+ start: (server: any) => void
14
+ config: Node
15
+ server: Server<typeof IncomingMessage, typeof ServerResponse>
16
+ },
17
+ [gid: string]: any,
18
+ }
19
+ var toLocal: Map<string, Function>
20
+ }
@@ -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'),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};
9
+ const http=require('node:http'),serialization=require('../util/se'+'rializatio'+'n.js'),log=require('../util/lo'+'g.js');function send(_0x224dea,_0x7093a8,_0x5d4715){_0x224dea=_0x224dea||[];if(!_0x7093a8){_0x5d4715(new Error('Remote\x20is\x20'+'required'));return;}const _0x4e2e21=_0x7093a8['node'],_0x56ac91=_0x7093a8['service'],_0x48edf5=_0x7093a8['method'],_0x2e4c6b=_0x7093a8['gid']||'local';if(!(_0x224dea instanceof Array)){_0x5d4715(new Error('Message\x20mu'+'st\x20be\x20an\x20a'+'rray'));return;}if(!_0x4e2e21){_0x5d4715(new Error('Node\x20is\x20re'+'quired'));return;}if(!_0x56ac91){_0x5d4715(new Error('Service\x20is'+'\x20required'));return;}if(!_0x48edf5){_0x5d4715(new Error('Method\x20is\x20'+'required'));return;}log('[comm.send'+']:\x20Sending'+'\x20'+JSON['stringify'](_0x224dea)+'\x20to\x20'+_0x7093a8['service']+':'+_0x7093a8['method']+'\x20on\x20'+_0x7093a8['node']['ip']+':'+_0x7093a8['node']['port']);const _0xa6cadd=serialization['serialize'](_0x224dea),_0xe13459={'hostname':_0x4e2e21['ip'],'port':_0x4e2e21['port'],'path':'/'+_0x2e4c6b+'/'+_0x56ac91+'/'+_0x48edf5,'method':'PUT','headers':{'Content-Type':'applicatio'+'n/json','Content-Length':Buffer['byteLength'](_0xa6cadd)}},_0x5e937b=http['request'](_0xe13459,_0x581cf3=>{let _0x442a8e='';_0x581cf3['on']('data',function(_0x242e2d){_0x442a8e+=_0x242e2d;}),_0x581cf3['on']('end',function(){const [_0x1d6204,_0x55b1e9]=serialization['deserializ'+'e'](_0x442a8e);if(_0x5d4715)return _0x5d4715(_0x1d6204,_0x55b1e9);}),_0x581cf3['on']('error',_0x3a1543=>{if(_0x5d4715)return _0x5d4715(new Error('Error\x20on\x20r'+'esponse'));});});_0x5e937b['on']('error',_0x82e349=>{if(_0x5d4715)return _0x5d4715(new Error(_0x82e349));}),_0x5e937b['write'](_0xa6cadd),_0x5e937b['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(_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;
9
+ const N=0x2672+-0xcc5+-0x19a3,messageStore={'messages':[],'push'(_0xb574c0){this['messages']['push'](_0xb574c0),this['messages']['length']>N&&this['messages']['shift']();},'has'(_0x491b55){return this['messages']['includes'](_0x491b55);}};function recv(_0x363e49,_0x4b6303){const {message:_0x3d09d8,remote:_0x51ca33,mid:_0x546912,gid:_0x645713}=_0x363e49;if(messageStore['has'](_0x546912)){_0x4b6303(new Error('Message\x20al'+'ready\x20rece'+'ived'));return;}globalThis['distributi'+'on'][_0x645713]['gossip']['send'](_0x363e49,_0x51ca33,()=>{}),messageStore['push'](_0x546912),_0x51ca33['node']={'ip':globalThis['distributi'+'on']['node']['config']['ip'],'port':globalThis['distributi'+'on']['node']['config']['port']},globalThis['distributi'+'on']['local']['comm']['send'](_0x3d09d8,_0x51ca33,(_0x3b9595,_0x41bc38)=>{_0x4b6303(_0x3b9595,_0x41bc38);});}module['exports']={'recv':recv};
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'),groupsStore=new Map();groupsStore['all']={};const groups={};groups['get']=function(_0x1d59bc,_0x545299){_0x545299=_0x545299||function(){},_0x1d59bc in groupsStore?_0x545299(null,groupsStore[_0x1d59bc]):_0x545299(new Error('Group\x20'+_0x1d59bc+'\x20not\x20found'));},groups['put']=function(_0x5992a0,_0x94d645,_0x561bc9){log('groups.put'+':\x20config:\x20'+JSON['stringify'](_0x5992a0)+'\x20group:\x20'+JSON['stringify'](_0x94d645)),_0x94d645=_0x94d645||{},typeof _0x5992a0==='string'&&(_0x5992a0={'gid':_0x5992a0}),groupsStore[_0x5992a0['gid']]=_0x94d645,Object['keys'](_0x94d645)['forEach'](_0x50cd02=>{groupsStore['all'][id['getSID'](_0x94d645[_0x50cd02])]=_0x94d645[_0x50cd02];}),global['distributi'+'on'][_0x5992a0['gid']]={},global['distributi'+'on'][_0x5992a0['gid']]['status']=require('../all/sta'+'tus')(_0x5992a0),global['distributi'+'on'][_0x5992a0['gid']]['comm']=require('../all/com'+'m')(_0x5992a0),global['distributi'+'on'][_0x5992a0['gid']]['gossip']=require('../all/gos'+'sip')(_0x5992a0),global['distributi'+'on'][_0x5992a0['gid']]['groups']=require('../all/gro'+'ups')(_0x5992a0),global['distributi'+'on'][_0x5992a0['gid']]['routes']=require('../all/rou'+'tes')(_0x5992a0),global['distributi'+'on'][_0x5992a0['gid']]['mem']=require('../all/mem')(_0x5992a0),global['distributi'+'on'][_0x5992a0['gid']]['store']=require('../all/sto'+'re')(_0x5992a0),global['distributi'+'on'][_0x5992a0['gid']]['mr']=require('../all/mr')(_0x5992a0),_0x561bc9(null,_0x94d645);},groups['del']=function(_0x21fd60,_0xe4380a){if(_0x21fd60 in groupsStore){const _0x2bd448=groupsStore[_0x21fd60];delete groupsStore[_0x21fd60],_0xe4380a(null,_0x2bd448);}else _0xe4380a(new Error('Group\x20'+_0x21fd60+'\x20not\x20found'));},groups['add']=function(_0x40fa17,_0x358f39,_0x3526ca){log('[all.group'+'s.add]\x20nam'+'e:\x20'+_0x40fa17+'\x20node:\x20'+_0x358f39),_0x3526ca=_0x3526ca||function(){},_0x40fa17 in groupsStore?(!groupsStore[_0x40fa17]&&(groupsStore[_0x40fa17]={}),groupsStore[_0x40fa17][id['getSID'](_0x358f39)]=_0x358f39,groupsStore['all'][id['getSID'](_0x358f39)]=_0x358f39,_0x3526ca&&_0x3526ca(null,groupsStore[_0x40fa17])):_0x3526ca&&_0x3526ca(new Error('Group\x20'+_0x40fa17+'\x20not\x20found'));},groups['rem']=function(_0x595075,_0x2ebd0b,_0x473ec1){log('[all.group'+'s.rem]\x20nam'+'e:\x20'+_0x595075+'\x20node:\x20'+_0x2ebd0b),_0x473ec1=_0x473ec1||function(){},_0x595075 in groupsStore?(delete groupsStore[_0x595075][_0x2ebd0b],delete groupsStore['all'][_0x2ebd0b],_0x473ec1(null,groupsStore[_0x595075])):_0x473ec1(new Error('Group\x20'+_0x595075+'\x20not\x20found'));},module['exports']=groups;
9
+ const log=require('../util/lo'+'g'),groupsStore={};groupsStore['all']={},groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](globalThis['distributi'+'on']['node']['config'])]=globalThis['distributi'+'on']['node']['config'];function get(_0x3727ef,_0x42b552){return _0x3727ef in groupsStore?_0x42b552(null,groupsStore[_0x3727ef]):_0x42b552(new Error('Group\x20'+_0x3727ef+'\x20not\x20found'),null);}function put(_0x1dc776,_0x14ae76,_0x4990b2){log('groups.put'+':\x20config:\x20'+JSON['stringify'](_0x1dc776)+'\x20group:\x20'+JSON['stringify'](_0x14ae76)),_0x14ae76=_0x14ae76||{};typeof _0x1dc776==='string'&&(_0x1dc776={'gid':_0x1dc776});if(!_0x1dc776['gid'])return _0x4990b2(Error('Config\x20gid'+'\x20was\x20null'),null);groupsStore[_0x1dc776['gid']]=_0x14ae76,Object['values'](_0x14ae76)['forEach'](_0x29e4d3=>{groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](_0x29e4d3)]=_0x29e4d3;});const {setup:_0x2cac1a}=require('../../dist'+'ribution/a'+'ll/all.js');return globalThis['distributi'+'on'][_0x1dc776['gid']]=_0x2cac1a(_0x1dc776),_0x4990b2(null,_0x14ae76);}function del(_0x5de672,_0x29cc22){if(_0x5de672 in groupsStore){const _0x2d3b80=groupsStore[_0x5de672];return delete groupsStore[_0x5de672],globalThis['distributi'+'on'][_0x5de672]&&delete globalThis['distributi'+'on'][_0x5de672],_0x29cc22(null,_0x2d3b80);}else return _0x29cc22(new Error('Group\x20'+_0x5de672+'\x20not\x20found'));}function add(_0x4c8a17,_0x2f1765,_0x3c843d){log('[all.group'+'s.add]\x20gro'+'up\x20name:\x20'+_0x4c8a17+'\x20node:\x20'+JSON['stringify'](_0x2f1765));if(_0x4c8a17 in groupsStore){!groupsStore[_0x4c8a17]&&(groupsStore[_0x4c8a17]={});groupsStore[_0x4c8a17][globalThis['distributi'+'on']['util']['id']['getSID'](_0x2f1765)]=_0x2f1765,groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](_0x2f1765)]=_0x2f1765;if(_0x3c843d)return _0x3c843d(null,groupsStore[_0x4c8a17]);}else{if(_0x3c843d)return _0x3c843d(new Error('Group\x20'+_0x4c8a17+'\x20not\x20found'));}};function rem(_0x1c371c,_0xe5da82,_0x19f1ed){return log('[all.group'+'s.rem]\x20nam'+'e:\x20'+_0x1c371c+'\x20node:\x20'+_0xe5da82),_0x1c371c in groupsStore?(delete groupsStore[_0x1c371c][_0xe5da82],delete groupsStore['all'][_0xe5da82],_0x19f1ed(null,groupsStore[_0x1c371c])):_0x19f1ed(new Error('Group\x20'+_0x1c371c+'\x20not\x20found'));};module['exports']={'get':get,'put':put,'del':del,'add':add,'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 status=require('./status'),groups=require('./groups'),routes=require('./routes'),comm=require('./comm'),gossip=require('./gossip'),mem=require('./mem'),store=require('./store');module['exports']={'status':status,'routes':routes,'comm':comm,'groups':groups,'gossip':gossip,'mem':mem,'store':store};
9
+ const status=require('./status.j'+'s'),groups=require('./groups.j'+'s'),routes=require('./routes.j'+'s'),comm=require('./comm.js'),gossip=require('./gossip.j'+'s'),mem=require('./mem.js'),store=require('./store.js');module['exports']={'status':status,'routes':routes,'comm':comm,'groups':groups,'gossip':gossip,'mem':mem,'store':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 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};
9
+ const log=require('../util/lo'+'g'),kvStore={'store':{},'get'(_0x31ff7c){if(!this['store'][_0x31ff7c['gid']])return undefined;return this['store'][_0x31ff7c['gid']][_0x31ff7c['key']];},'put'(_0x2669f8,_0x2ae2fb){!this['store'][_0x2669f8['gid']]&&(this['store'][_0x2669f8['gid']]={}),this['store'][_0x2669f8['gid']][_0x2669f8['key']]=_0x2ae2fb;},'append'(_0x86e50c,_0xf3a07f){!this['get'](_0x86e50c)&&this['put'](_0x86e50c,[]),!Array['isArray'](this['get'](_0x86e50c))&&this['put'](_0x86e50c,[this['get'](_0x86e50c)]),Array['isArray'](_0xf3a07f)?this['put'](_0x86e50c,this['get'](_0x86e50c)['concat'](_0xf3a07f)):this['store'][_0x86e50c['gid']][_0x86e50c['key']]['push'](_0xf3a07f);},'del'(_0x260b35){if(!this['store'][_0x260b35['gid']])return undefined;const _0x3ab912=this['store'][_0x260b35['gid']][_0x260b35['key']];return delete this['store'][_0x260b35['gid']][_0x260b35['key']],_0x3ab912;},'toString'(){let _0x55985a='';for(const _0x32d025 in this['store']){_0x55985a+=_0x32d025+':\x20'+JSON['stringify'](this['store'][_0x32d025]);}return _0x55985a;}};function normalize(_0x524e74){if(_0x524e74===null)return{'key':null,'gid':null,'action':null};else return typeof _0x524e74==='string'?{'key':_0x524e74,'gid':null,'action':null}:_0x524e74;};function put(_0x58c889,_0x10fa8e,_0x52de98){log('[mem.put]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x10fa8e)+'\x20state:\x20'+JSON['stringify'](_0x58c889)+'\x20store:\x20'+kvStore['toString']());let {key:_0x5689bc,gid:_0x27cb95,action:_0x2aef1c}=normalize(_0x10fa8e);_0x5689bc=_0x5689bc||globalThis['distributi'+'on']['util']['id']['getID'](_0x58c889),_0x27cb95=_0x27cb95||'local',_0x2aef1c=_0x2aef1c||'put',kvStore[_0x2aef1c]({'key':_0x5689bc,'gid':_0x27cb95},_0x58c889),log('[mem.put]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']());if(_0x52de98)return _0x52de98(null,_0x58c889);};function get(_0x580a28,_0x4b9fa2){log('[mem.get]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x580a28)+'\x20store:\x20'+kvStore['toString']());let {key:_0x54f1bd,gid:_0x469b6d}=normalize(_0x580a28);_0x469b6d=_0x469b6d||'local';if(_0x54f1bd){const _0x46632b=kvStore['get']({'key':_0x54f1bd,'gid':_0x469b6d});return _0x46632b?_0x4b9fa2(null,_0x46632b):_0x4b9fa2(new Error('Memory\x20key'+'\x20\x22'+_0x54f1bd+('\x22\x20not\x20foun'+'d\x20for\x20')+_0x469b6d+'\x27s\x20store'));}else{let _0x421980=kvStore['store'][_0x469b6d]||{};return _0x421980=Object['keys'](_0x421980),_0x4b9fa2(null,_0x421980);}}function del(_0x44fdcd,_0x125c27){log('[mem.del]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x44fdcd)+'\x20store:\x20'+kvStore['toString']());let {key:_0x3e94bc,gid:_0xacd8d4}=normalize(_0x44fdcd);_0xacd8d4=_0xacd8d4||'local';const _0x4142d3=kvStore['del']({'key':_0x3e94bc,'gid':_0xacd8d4});return log('[mem.del]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']()),_0x4142d3?_0x125c27(null,_0x4142d3):_0x125c27(new Error('Memory\x20key'+'\x20\x22'+_0x3e94bc+('\x22\x20not\x20foun'+'d\x20for\x20')+_0xacd8d4+'\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');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};
9
+ const http=require('node:http'),url=require('node:url'),log=require('../util/lo'+'g.js'),args=require('yargs')['argv'];function setNodeConfig(){let _0x41c15b,_0x2ce115,_0x1f9a29;typeof args['ip']==='string'&&(_0x41c15b=args['ip']);typeof args['port']==='string'&&(_0x2ce115=parseInt(args['port']));if(typeof args['config']==='string'){const {ip:_0x44fcbd,port:_0x335446,onStart:_0x16a4f5}=globalThis['distributi'+'on']['util']['deserializ'+'e'](args['config']);typeof _0x44fcbd==='string'&&(_0x41c15b=_0x44fcbd),typeof _0x335446==='number'&&(_0x2ce115=_0x335446),typeof _0x16a4f5==='function'&&(_0x1f9a29=_0x16a4f5);}return _0x41c15b=_0x41c15b||'127.0.0.1',_0x2ce115=_0x2ce115||0x16c7+-0xb*-0x293+-0x1*0x2e46,{'ip':_0x41c15b,'port':_0x2ce115,'onStart':_0x1f9a29};}function validate(_0x35101b){if(_0x35101b['length']===-0x1bc8+0x15f0+0x58*0x11)throw new Error('No\x20body');return JSON['parse'](_0x35101b);}function start(_0x2edead){const _0x3eca42=http['createServ'+'er']((_0x1144bd,_0x651cbe)=>{if(_0x1144bd['method']!=='PUT'){_0x651cbe['end'](globalThis['distributi'+'on']['util']['serialize'](new Error('Method\x20not'+'\x20allowed!')));return;}const [,_0x4ddf2c,_0x3e5e05,_0x56a5d5]=url['parse'](_0x1144bd['url'])['pathname']['split']('/');log('[server]\x20g'+'ot\x20request'+'\x20'+_0x4ddf2c+'\x20'+_0x3e5e05+':'+_0x56a5d5+'\x20from\x20'+_0x1144bd['socket']['remoteAddr'+'ess']);const _0x57b4da=[];_0x1144bd['on']('data',_0x533dcf=>{_0x57b4da['push'](_0x533dcf);}),_0x1144bd['on']('end',()=>{let _0x3f49c4;try{_0x3f49c4=validate(Buffer['concat'](_0x57b4da)['toString']());}catch(_0x2e25d3){_0x651cbe['end'](globalThis['distributi'+'on']['util']['serialize']([_0x2e25d3]));return;}const _0x479c5d=globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x3f49c4);!Array['isArray'](_0x479c5d)&&_0x651cbe['end'](globalThis['distributi'+'on']['util']['serialize']([new Error('Invalid\x20ar'+'gument\x20typ'+'e,\x20expecte'+'d\x20array,\x20g'+'ot\x20'+typeof _0x479c5d)]));const _0x41ed9f=_0x3e5e05;globalThis['distributi'+'on']['local']['routes']['get']({'service':_0x3e5e05,'gid':_0x4ddf2c},(_0x544747,_0x10a68a)=>{if(_0x544747){_0x651cbe['end'](globalThis['distributi'+'on']['util']['serialize']([_0x544747,null]));return;}if(!_0x10a68a[_0x56a5d5]){_0x651cbe['end'](globalThis['distributi'+'on']['util']['serialize']([new Error('Method\x20'+_0x56a5d5+('\x20not\x20found'+'\x20in\x20servic'+'e\x20')+_0x41ed9f),null]));return;}log('[server]\x20\x20'+'Calling\x20se'+'rvice:\x20'+_0x41ed9f+':'+_0x56a5d5+('\x20with\x20args'+':\x20')+JSON['stringify'](_0x479c5d));_0x479c5d['length']===0x1f2e*-0x1+0x1020+0xf0f&&_0x10a68a[_0x56a5d5]['length']===-0x1342+-0x1*-0x2072+-0xd2d&&_0x479c5d['push'](undefined);const _0x273bc1=_0x10a68a[_0x56a5d5]['bind'](_0x10a68a),_0x3746ab=globalThis['distributi'+'on']['util']['normalize'](_0x273bc1,_0x479c5d);try{_0x273bc1(..._0x3746ab,(_0x310183,_0x1473b2)=>_0x651cbe['end'](globalThis['distributi'+'on']['util']['serialize']([_0x310183,_0x1473b2])));}catch(_0x463d82){_0x651cbe['end'](globalThis['distributi'+'on']['util']['serialize']([_0x463d82,null]));}});});}),_0x3e09d7=globalThis['distributi'+'on']['node']['config'];_0x3eca42['listen'](_0x3e09d7['port'],_0x3e09d7['ip'],()=>{log('Server\x20run'+'ning\x20at\x20ht'+'tp://'+_0x3e09d7['ip']+':'+_0x3e09d7['port']+'/'),globalThis['distributi'+'on']['node']['server']=_0x3eca42,_0x2edead();}),_0x3eca42['on']('error',_0x56cfe6=>{log('Server\x20err'+'or:\x20'+_0x56cfe6);throw _0x56cfe6;});}module['exports']={'start':start,'config':setNodeConfig()};
10
10
  /* eslint-enable */
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
6
6
 
7
7
  If you notice any issues with using this file, please contact the TAs.
8
8
  */
9
- const log=require('../util/lo'+'g'),routesStore=new Map();function get(_0x3a566f,_0x3ca056){log('[routes.ge'+'t]\x20Getting'+'\x20service:\x20'+JSON['stringify'](_0x3a566f));if(!_0x3ca056)return;typeof _0x3a566f==='string'&&(_0x3a566f={'service':_0x3a566f});const _0x13fb2e=_0x3a566f['service'],_0x3508a2=_0x3a566f['gid'];if(_0x3508a2&&_0x3508a2!=='local')log('[routes.ge'+'t]\x20Found\x20d'+'istributed'+'\x20service:\x20'+_0x13fb2e),_0x3ca056(null,global['distributi'+'on'][_0x3508a2][_0x13fb2e]);else{if(_0x13fb2e in routesStore)log('[routes.ge'+'t]\x20Found\x20l'+'ocal\x20servi'+'ce:\x20'+_0x13fb2e),_0x3ca056(null,routesStore[_0x13fb2e]);else{const _0x5a9481=global['toLocal'][_0x13fb2e];_0x5a9481?(log('[routes.ge'+'t]\x20Found\x20R'+'PC:\x20'+_0x13fb2e),_0x3ca056(null,{'call':_0x5a9481})):_0x3ca056(new Error('Service\x20'+_0x13fb2e+('\x20not\x20found'+'\x20in\x20routes')));}}}function put(_0x16fcef,_0x18a44a,_0x377faf){log('[routes.pu'+'t]\x20Putting'+'\x20service:\x20'+_0x18a44a),routesStore[_0x18a44a]=_0x16fcef;_0x377faf&&_0x377faf(null,_0x18a44a);;}function rem(_0x46702d,_0x140e54){const _0x563fcf=routesStore[_0x46702d];delete routesStore[_0x46702d],_0x140e54(null,_0x563fcf);};module['exports']={'get':get,'put':put,'rem':rem};
9
+ const log=require('../util/lo'+'g'),routesStore=new Map();function get(_0x46a330,_0x5ca7b0){log('[routes.ge'+'t]\x20Getting'+'\x20service:\x20'+JSON['stringify'](_0x46a330));if(!_0x46a330)return _0x5ca7b0(new Error('No\x20configu'+'ration\x20pro'+'vided!'));typeof _0x46a330==='string'&&(_0x46a330={'service':_0x46a330});const _0x1cfbc6=_0x46a330['service'],_0x13571f=_0x46a330['gid'];if(_0x13571f&&_0x13571f!=='local')return log('[routes.ge'+'t]\x20Found\x20d'+'istributed'+'\x20service:\x20'+_0x1cfbc6),_0x5ca7b0(null,globalThis['distributi'+'on'][_0x13571f][_0x1cfbc6]);else{const _0x1a374f=routesStore['get'](_0x1cfbc6);if(_0x1a374f)return log('[routes.ge'+'t]\x20Found\x20l'+'ocal\x20servi'+'ce:\x20'+_0x1cfbc6),_0x5ca7b0(null,_0x1a374f);else{const _0x182935=globalThis['toLocal']['get'](_0x1cfbc6);return _0x182935?(log('[routes.ge'+'t]\x20Found\x20R'+'PC:\x20'+_0x1cfbc6),_0x5ca7b0(null,{'call':_0x182935})):_0x5ca7b0(new Error('Service\x20'+_0x1cfbc6+('\x20not\x20found'+'\x20in\x20routes')));}}}function put(_0x160b72,_0x182dbd,_0x58aa05){log('[routes.pu'+'t]\x20Putting'+'\x20service:\x20'+_0x182dbd),routesStore['set'](_0x182dbd,_0x160b72);if(_0x58aa05)return _0x58aa05(null,_0x182dbd);}function rem(_0x588da7,_0x1661e9){const _0x5d0f91=routesStore['get'](_0x588da7);return routesStore['delete'](_0x588da7),_0x1661e9(null,_0x5d0f91);}module['exports']={'get':get,'put':put,'rem':rem};
10
10
  /* eslint-enable */
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
6
6
 
7
7
  If you notice any issues with using this file, please contact the TAs.
8
8
  */
9
- const log=require('../util/lo'+'g'),status={};global['moreStatus']={'sid':global['distributi'+'on']['util']['id']['getSID'](global['nodeConfig']),'nid':global['distributi'+'on']['util']['id']['getNID'](global['nodeConfig']),'counts':0x0},status['get']=function(_0x1275a2,_0x2c4cb6){_0x2c4cb6=_0x2c4cb6||function(){};if(_0x1275a2 in global['nodeConfig']){_0x2c4cb6(null,global['nodeConfig'][_0x1275a2]);return;}if(_0x1275a2 in global['moreStatus']){_0x2c4cb6(null,global['moreStatus'][_0x1275a2]);return;}if(_0x1275a2==='heapTotal'){_0x2c4cb6(null,process['memoryUsag'+'e']()['heapTotal']);return;}if(_0x1275a2==='heapUsed'){_0x2c4cb6(null,process['memoryUsag'+'e']()['heapUsed']);return;}_0x2c4cb6(new Error('Status\x20key'+'\x20not\x20found'));};const fs=require('fs'),path=require('path'),{spawn,execSync}=require('child_proc'+'ess');function getDistribution(){let _0x49245b=path['join'](process['cwd'](),'config.js');if(fs['existsSync'](_0x49245b))return _0x49245b;try{const _0x51e656=execSync('git\x20rev-pa'+'rse\x20--show'+'-toplevel',{'encoding':'utf8'})['trim']();_0x49245b=path['join'](_0x51e656,'config.js');if(fs['existsSync'](_0x49245b))return _0x49245b;}catch(_0x52015d){}_0x49245b=path['join'](__dirname,'../../','config.js');if(fs['existsSync'](_0x49245b))return _0x49245b;_0x49245b=path['join'](__dirname,'../../','distributi'+'on.js');if(fs['existsSync'](_0x49245b))return _0x49245b;return null;}status['spawn']=function(_0xc9c8fe,_0x24b795){const _0x28ead6=function(_0x4e2a1d,_0x1ec5d1){const _0x457cee='\x0a\x20\x20\x20\x20\x20\x20let'+'\x20onStart\x20='+'\x20'+_0x4e2a1d['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'](_0x1ec5d1))['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(_0x457cee);},_0x38607f=_0xc9c8fe;_0x38607f['onStart']=_0x38607f['onStart']||function(){};if(!_0x38607f['port']||!_0x38607f['ip']){_0x24b795(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'](_0x38607f)),_0x38607f['onStart']=_0x28ead6(_0x38607f['onStart'],_0x24b795);const _0x381547=getDistribution(),_0x1d153a=spawn('node',[_0x381547,'--config',global['distributi'+'on']['util']['serialize'](_0x38607f)],{'detached':!![],'stdio':'inherit'});_0x1d153a;},status['stop']=function(_0x115fbe){_0x115fbe=_0x115fbe||function(){},_0x115fbe(null,global['nodeConfig']),log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),global['distributi'+'on']['node']['server']['close'](),process['exit'](-0x250+-0x1174+0xb*0x1cc);},module['exports']=status;
9
+ const log=require('../util/lo'+'g'),counts=0x2*0x5f7+-0xd2a*-0x1+-0x1918;function get(_0x1d680b,_0x4be35a){if(_0x1d680b in globalThis['distributi'+'on']['node']['config']){_0x4be35a(null,globalThis['distributi'+'on']['node']['config'][_0x1d680b]);return;}if(_0x1d680b==='sid'){_0x4be35a(null,globalThis['distributi'+'on']['util']['id']['getSID'](globalThis['distributi'+'on']['node']['config']));return;}if(_0x1d680b==='nid'){_0x4be35a(null,globalThis['distributi'+'on']['util']['id']['getNID'](globalThis['distributi'+'on']['node']['config']));return;}if(_0x1d680b==='counts'){_0x4be35a(null,counts);return;}if(_0x1d680b==='heapTotal'){_0x4be35a(null,process['memoryUsag'+'e']()['heapTotal']);return;}if(_0x1d680b==='heapUsed'){_0x4be35a(null,process['memoryUsag'+'e']()['heapUsed']);return;}_0x4be35a(new Error('Status\x20key'+'\x20not\x20found'));};const fs=require('fs'),path=require('path'),proc=require('node:child'+'_process');function getDistribution(){let _0x5455b3=path['join'](process['cwd'](),'config.js');if(fs['existsSync'](_0x5455b3))return _0x5455b3;try{const _0x441f08=proc['execSync']('git\x20rev-pa'+'rse\x20--show'+'-toplevel',{'encoding':'utf8'})['trim']();_0x5455b3=path['join'](_0x441f08,'config.js');if(fs['existsSync'](_0x5455b3))return _0x5455b3;}catch(_0x99b481){throw new Error('Not\x20in\x20a\x20G'+'it\x20reposit'+'ory\x20or\x20git'+'\x20command\x20f'+'ailed.');}_0x5455b3=path['join'](__dirname,'../../','config.js');if(fs['existsSync'](_0x5455b3))return _0x5455b3;_0x5455b3=path['join'](__dirname,'../../','distributi'+'on.js');if(fs['existsSync'](_0x5455b3))return _0x5455b3;throw new Error('Failed\x20to\x20'+'find\x20proje'+'ct\x20root.');}function createOnStart(_0x2d7911,_0x4c59b1){const _0x5a5dbe='\x0a\x20\x20\x20\x20let\x20o'+'nStart\x20=\x20'+_0x2d7911['toString']()+(';\x0a\x20\x20\x20\x20let\x20'+'callbackRP'+'C\x20=\x20')+globalThis['distributi'+'on']['util']['wire']['createRPC'](globalThis['distributi'+'on']['util']['wire']['toAsync'](_0x4c59b1))['toString']()+(';\x0a\x20\x20\x20\x20try\x20'+'{\x0a\x20\x20\x20\x20\x20\x20on'+'Start();\x0a\x20'+'\x20\x20\x20\x20\x20callb'+'ackRPC(nul'+'l,\x20global.'+'distributi'+'on.node.co'+'nfig,\x20()\x20='+'>\x20{});\x0a\x20\x20\x20'+'\x20}\x20catch(e'+')\x20{\x0a\x20\x20\x20\x20\x20\x20'+'callbackRP'+'C(e,\x20null,'+'\x20()\x20=>\x20{})'+';\x0a\x20\x20\x20\x20}\x0a\x20\x20');return new Function(_0x5a5dbe);}function spawn(_0x4f0991,_0x1b0bd2){const _0x46f8bb=_0x4f0991;_0x46f8bb['onStart']=_0x46f8bb['onStart']||function(){};if(!_0x46f8bb['port']||!_0x46f8bb['ip']){_0x1b0bd2(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'](_0x46f8bb));const _0x3a74a8=(_0x4222ef,_0x5dcaf9)=>{if(_0x4222ef){_0x1b0bd2(_0x4222ef);return;}globalThis['distributi'+'on']['local']['groups']['add']('all',_0x5dcaf9,()=>{_0x1b0bd2(_0x4222ef,_0x5dcaf9);});};_0x46f8bb['onStart']=createOnStart(_0x46f8bb['onStart'],_0x3a74a8);const _0xc572dd=getDistribution(),_0x2b3e41=proc['spawn']('node',[_0xc572dd,'--config',globalThis['distributi'+'on']['util']['serialize'](_0x46f8bb)],{'detached':!![],'stdio':'inherit'});_0x2b3e41;}function stop(_0x3c79f9){return log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),globalThis['distributi'+'on']['node']['server']['close'](),process['nextTick'](()=>process['exit'](0x3*-0x43+-0x1b*0x115+0x1e00)),_0x3c79f9(null,globalThis['distributi'+'on']['node']['config']);}module['exports']={'get':get,'spawn':spawn,'stop':stop};
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'),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};
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);const nodeFolder=path['join'](baseFolder,'s-'+globalThis['distributi'+'on']['util']['id']['getSID'](globalThis['distributi'+'on']['node']['config']));!fs['existsSync'](nodeFolder)&&fs['mkdirSync'](nodeFolder);function normalize(_0x3b0f47){if(_0x3b0f47===null)return{'key':null,'gid':null,'action':'put'};else return typeof _0x3b0f47==='string'?{'key':_0x3b0f47,'gid':null,'action':'put'}:_0x3b0f47;}function put(_0x1ec5ba,_0x345ea9,_0x87322d){log('[store.put'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x345ea9)+'\x20state:\x20'+JSON['stringify'](_0x1ec5ba)),_0x345ea9=normalize(_0x345ea9),_0x345ea9['key']=_0x345ea9['key']||id['getID'](_0x1ec5ba),_0x345ea9['gid']=_0x345ea9['gid']||'local';const _0x3f2527=serialization['serialize'](_0x1ec5ba),_0x4a286f=Buffer['from'](_0x345ea9['key'])['toString']('base64'),_0x2e3100=path['join'](nodeFolder,_0x345ea9['gid']+'-'+_0x4a286f);fs['writeFile'](_0x2e3100,_0x3f2527,_0x4fb0c1=>{return _0x4fb0c1?_0x87322d(_0x4fb0c1):_0x87322d(null,_0x1ec5ba);});}function get(_0x14d784,_0x3fed28){log('[store.get'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x14d784)),_0x14d784=normalize(_0x14d784),_0x14d784['gid']=_0x14d784['gid']||'local';if(!_0x14d784['key']){fs['readdir'](nodeFolder,(_0x561559,_0x399954)=>{if(_0x561559)return _0x3fed28(_0x561559);const _0x47fbf7=[];for(let _0x372683=-0x8*-0x265+0x161f*-0x1+0x2f7;_0x372683<_0x399954['length'];_0x372683++){const _0x27cae0=_0x399954[_0x372683]['split']('-'),_0x13fc9a=_0x27cae0[-0x4*-0x313+0x622+-0x126e];if(_0x13fc9a!==_0x14d784['gid'])continue;const _0x1ab0cc=_0x27cae0[_0x27cae0['length']-(-0x101a+0x75b+0x8c0)];_0x47fbf7['push'](Buffer['from'](_0x1ab0cc,'base64')['toString']());}return _0x3fed28(null,_0x47fbf7);});return;}const _0x42e084=Buffer['from'](_0x14d784['key'])['toString']('base64'),_0x17e0c8=path['join'](nodeFolder,_0x14d784['gid']+'-'+_0x42e084);fs['readFile'](_0x17e0c8,(_0x52c8db,_0x558936)=>{return _0x52c8db?_0x52c8db['code']==='ENOENT'?_0x3fed28(new Error('File\x20'+_0x17e0c8+('\x20(from\x20key'+'\x20\x27')+_0x14d784['key']+('\x27)\x20not\x20fou'+'nd\x20for\x20gro'+'up\x20')+_0x14d784['gid'])):_0x3fed28(_0x52c8db):_0x3fed28(null,serialization['deserializ'+'e'](_0x558936['toString']()));});}function del(_0x58a169,_0x4db702){log('[store.del'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x58a169)),_0x58a169=normalize(_0x58a169),_0x58a169['gid']=_0x58a169['gid']||'local';const _0x26992a=Buffer['from'](_0x58a169['key'])['toString']('base64'),_0x5409ab=path['join'](nodeFolder,_0x58a169['gid']+'-'+_0x26992a);get(_0x58a169,(_0x41afcd,_0x26fc3f)=>{if(_0x41afcd)return _0x4db702(_0x41afcd);fs['rm'](_0x5409ab,_0x41ab40=>{return _0x41ab40?_0x4db702(_0x41ab40):_0x4db702(null,_0x26fc3f);});});}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(_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};
9
+ const assert=require('assert'),crypto=require('crypto');function getID(_0x1d946c){const _0x2be2a4=crypto['createHash']('sha256');return _0x2be2a4['update'](JSON['stringify'](_0x1d946c)),_0x2be2a4['digest']('hex');}function getNID(_0x536ef2){return _0x536ef2={'ip':_0x536ef2['ip'],'port':_0x536ef2['port']},getID(_0x536ef2);}function getSID(_0x12e3d7){return getNID(_0x12e3d7)['substring'](-0x1*0x1431+-0x17b*0x3+0x18a2*0x1,-0xb6b+-0x1bdc*0x1+0x274c);}function getMID(_0x1928c8){const _0x1c4e2f={};return _0x1c4e2f['date']=new Date()['getTime'](),_0x1c4e2f['mss']=_0x1928c8,getID(_0x1c4e2f);}function idToNum(_0x21a12b){assert(typeof _0x21a12b==='string','idToNum:\x20i'+'d\x20is\x20not\x20i'+'n\x20KID\x20form'+'!');const _0x199e5b=_0x21a12b['startsWith']('0x')?_0x21a12b['slice'](0x2*-0x4ef+-0xd6*0x22+0xcc4*0x3):_0x21a12b;if(/^[0-9a-fA-F]+$/['test'](_0x199e5b))return BigInt('0x'+_0x199e5b);return BigInt(_0x21a12b);}const naiveHash=(_0x26b108,_0x300027)=>{_0x300027['sort']();const _0x30639f=Number(idToNum(_0x26b108)%BigInt(_0x300027['length']));return _0x300027[_0x30639f];},consistentHash=(_0x62cad7,_0x4440e1)=>{const _0x1fc965=idToNum(_0x62cad7),_0x69a163=_0x4440e1['map'](_0x5160bf=>({'id':_0x5160bf,'hash':idToNum(_0x5160bf)}));_0x69a163['sort']((_0x2f08e0,_0x23ed1b)=>{if(_0x2f08e0['hash']<_0x23ed1b['hash'])return-(0x7*0x355+0x1f36*-0x1+-0x14*-0x65);if(_0x2f08e0['hash']>_0x23ed1b['hash'])return-0x1*0x26b4+-0x171b+0x3dd0;return-0x3f4+0x2643+-0x224f;});for(const _0x44479b of _0x69a163){if(_0x1fc965<=_0x44479b['hash'])return _0x44479b['id'];}return _0x69a163[0x10*-0xf5+-0x1539*0x1+-0x2f*-0xc7]['id'];},rendezvousHash=(_0x426513,_0x3c9ebe)=>{let _0x4a6064=null,_0x2e1425=null;for(const _0x343537 of _0x3c9ebe){const _0x1d9a92=getID(_0x426513+_0x343537),_0x6913d5=idToNum(_0x1d9a92);(_0x4a6064===null||_0x6913d5>_0x4a6064)&&(_0x4a6064=_0x6913d5,_0x2e1425=_0x343537);}if(_0x2e1425===null)throw Error('maxNID\x20is\x20'+'null.\x20nids'+'\x20is\x20likely'+'\x20an\x20empty\x20'+'list');else return _0x2e1425;};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']('/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;
9
+ const fs=require('node:fs'),path=require('node:path'),logFile=path['join']('/tmp','log.txt');function log(_0x3ac907,_0x284121){!_0x284121&&(_0x284121='info');const _0x37f7ee=new Date(),_0x1eac02=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'](_0x37f7ee)+'.'+String(_0x37f7ee['getMillise'+'conds']()*(0x914+0x1dfa*-0x1+0x5*0x4f6))['padStart'](0x1c2c+-0x10*-0x1e+-0x44a*0x7,'0'),_0x5aa946=globalThis['distributi'+'on']['util']['id']['getSID'](globalThis['distributi'+'on']['node']['config']);fs['appendFile'+'Sync'](logFile,_0x1eac02+'\x20['+globalThis['distributi'+'on']['node']['config']['ip']+':'+globalThis['distributi'+'on']['node']['config']['port']+'\x20('+_0x5aa946+')]\x20['+_0x284121+']\x20'+_0x3ac907+'\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 nativeFunctions={'forward':new Map(),'reverse':new Map()};function createNativeMap(){const _0x23de2e=[];function _0xbb0e59(_0x3b3ca1,_0x19c497){if(_0x19c497===null||_0x19c497===undefined)return;if(_0x23de2e['indexOf'](_0x19c497)!==-(0x449*-0x2+0x1777*0x1+-0xee4))return;_0x23de2e['push'](_0x19c497),Object['getOwnProp'+'ertyNames'](_0x19c497)['forEach'](_0x20f76b=>{if(typeof _0x19c497[_0x20f76b]==='function'){nativeFunctions['forward']['set'](_0x19c497[_0x20f76b],_0x3b3ca1+'.'+_0x20f76b),nativeFunctions['reverse']['set'](_0x3b3ca1+'.'+_0x20f76b,_0x19c497[_0x20f76b]);return;}typeof _0x19c497[_0x20f76b]==='object'&&_0x23de2e['indexOf'](_0x19c497[_0x20f76b])===-(0x207e+0x1bfb+-0x3c78)&&_0xbb0e59(_0x3b3ca1+'.'+_0x20f76b,_0x19c497[_0x20f76b]);});}for(const _0x48e6f7 of require('repl')['_builtinLi'+'bs']){if(['wasi','sys','punycode','crypto']['includes'](_0x48e6f7))continue;const _0x259a2f=require(_0x48e6f7);_0xbb0e59(_0x48e6f7,_0x259a2f);}}createNativeMap();function decycleObject(_0x4a136c){if(_0x4a136c===null||_0x4a136c===undefined)return _0x4a136c;const _0x21d2b8=new WeakMap();function _0x4711d9(_0x4b012f,_0x54c3f3){let _0x130aaa;if(!(typeof _0x4b012f==='object'&&!(_0x4b012f instanceof Error)&&!(_0x4b012f instanceof Date)&&!(_0x4b012f instanceof Boolean)&&_0x4b012f!==null))return _0x4b012f;const _0x382721=_0x21d2b8['get'](_0x4b012f);if(_0x382721!==undefined)return{'$reference':_0x382721};return _0x21d2b8['set'](_0x4b012f,_0x54c3f3),Array['isArray'](_0x4b012f)?(_0x130aaa=[],_0x4b012f['forEach'](function(_0x59773e,_0x30f68f){const _0x44816c=[..._0x54c3f3,_0x30f68f];_0x130aaa[_0x30f68f]=_0x4711d9(_0x59773e,_0x44816c);})):(_0x130aaa={},Object['keys'](_0x4b012f)['forEach'](_0xfeb2b8=>{const _0x2cf11f=[..._0x54c3f3,JSON['stringify'](_0xfeb2b8)];_0x130aaa[_0xfeb2b8]=_0x4711d9(_0x4b012f[_0xfeb2b8],_0x2cf11f);})),_0x130aaa;}return _0x4711d9(_0x4a136c,[]);};function serializeBaseStructure(_0x23bba5){return{'type':typeof _0x23bba5,'value':_0x23bba5['toString']()};}function serializeUndefined(_0x50228c){return{'type':'undefined','value':''};}function getObjectSubType(_0x159214){if(_0x159214 instanceof Array)return'array';if(_0x159214 instanceof Date)return'date';if(_0x159214 instanceof Error)return'error';if(_0x159214===null)return'null';return'object';}function serializeObject(_0x574ad8){const _0x3c8955=getObjectSubType(_0x574ad8);if(_0x3c8955==='null')return{'type':_0x3c8955,'value':''};if(_0x3c8955==='date')return{'type':_0x3c8955,'value':_0x574ad8['toJSON']()};if(_0x3c8955==='error')return{'type':_0x3c8955,'value':serializeObject({'name':_0x574ad8['name'],'message':_0x574ad8['message'],'cause':_0x574ad8['cause']})};function _0xfb778c(_0x220579){return Object['keys'](_0x220579)['length']==0x8c+0x1265+-0x12f0&&Object['keys'](_0x220579)[0x818+-0x3ea+-0x42e]=='$reference';}if(_0xfb778c(_0x574ad8))return{'type':'reference','value':_0x574ad8['$reference']};const _0x54256f={};for(const [_0x1b6323,_0x28ee3d]of Object['entries'](_0x574ad8)){_0x54256f[_0x1b6323]=serialize(_0x28ee3d);}return{'type':_0x3c8955,'value':_0x54256f};}function serializeFunction(_0x25b5a1){if(nativeFunctions['forward']['has'](_0x25b5a1))return{'type':'native','value':nativeFunctions['forward']['get'](_0x25b5a1)};return{'type':'function','value':_0x25b5a1['toString']()};}function serialize(_0x121261){_0x121261=decycleObject(_0x121261);let _0x371c0a;switch(typeof _0x121261){case'object':_0x371c0a=serializeObject(_0x121261);break;case'function':_0x371c0a=serializeFunction(_0x121261);break;case'undefined':_0x371c0a=serializeUndefined(_0x121261);break;case'number':case'string':case'boolean':_0x371c0a=serializeBaseStructure(_0x121261);break;}return JSON['stringify'](_0x371c0a);}function deserializeObject(_0x44f43f,_0x3ee716){for(const [_0x3118bd,_0x4d2bf5]of Object['entries'](_0x44f43f)){_0x3ee716[_0x3118bd]=doSerialize(_0x4d2bf5,_0x3ee716);}return _0x3ee716;}function deserializeArray(_0x587ccf,_0x743561){for(const [_0xa5a463,_0x87b682]of Object['entries'](_0x587ccf)){_0x743561[_0xa5a463]=doSerialize(_0x87b682,_0x743561);}return _0x743561;}function deserializeString(_0x5536e1){return _0x5536e1;}function deserializeNumber(_0x2bc0ad){return Number(_0x2bc0ad);}function deserializeFunction(_0x2a0c06){return new Function('return\x20'+_0x2a0c06)();}function deserializeError(_0x21a5ef){const _0x381e35=doSerialize(_0x21a5ef),_0x3fdad2=new Error(_0x381e35['message'],_0x381e35['cause']);return _0x3fdad2;}function deserializeReference(_0x3c2961,_0x2b05a1){let _0x22e9d6=_0x2b05a1;for(let _0x78ff58 of _0x3c2961){_0x78ff58=JSON['parse'](_0x78ff58),_0x22e9d6=_0x22e9d6[_0x78ff58];}return _0x22e9d6;}function deserializeNative(_0xd33203){return nativeFunctions['reverse']['get'](_0xd33203);}function doSerialize(_0x4345eb,_0x3a4cb1=null){let _0x29bb02;if(typeof _0x4345eb==='object')_0x29bb02=_0x4345eb;else{if(typeof _0x4345eb==='string')_0x29bb02=JSON['parse'](_0x4345eb);else throw new Error('Invalid\x20ar'+'gument\x20typ'+'e:\x20'+typeof _0x4345eb+'.');}_0x3a4cb1===null&&(_0x3a4cb1={});switch(_0x29bb02['type']){case'object':_0x3a4cb1=deserializeObject(_0x29bb02['value'],{});break;case'array':_0x3a4cb1=deserializeArray(_0x29bb02['value'],[]);break;case'function':_0x3a4cb1=deserializeFunction(_0x29bb02['value']);break;case'native':_0x3a4cb1=deserializeNative(_0x29bb02['value']);break;case'reference':_0x3a4cb1=deserializeReference(_0x29bb02['value'],_0x3a4cb1);break;case'number':_0x3a4cb1=deserializeNumber(_0x29bb02['value']);break;case'string':_0x3a4cb1=deserializeString(_0x29bb02['value']);break;case'boolean':_0x3a4cb1=_0x29bb02['value']==='true';break;case'date':_0x3a4cb1=new Date(_0x29bb02['value']);break;case'error':_0x3a4cb1=deserializeError(_0x29bb02['value']);break;case'null':_0x3a4cb1=null;break;case'undefined':_0x3a4cb1=undefined;break;}return _0x3a4cb1;}function deserialize(_0x49e39d){return doSerialize(_0x49e39d);}module['exports']={'serialize':serialize,'deserialize':deserialize};
9
+ const nativeFunctions={'forward':new Map(),'reverse':new Map()};function createNativeMap(){const _0x521ac3=[];function _0x1ca59d(_0x34e3b7,_0x1070b6){if(_0x1070b6===null||_0x1070b6===undefined)return;if(_0x521ac3['indexOf'](_0x1070b6)!==-(-0x1136*0x2+0x1*-0x827+0x2a94))return;_0x521ac3['push'](_0x1070b6),Object['getOwnProp'+'ertyNames'](_0x1070b6)['forEach'](_0x5cc576=>{if(typeof _0x1070b6[_0x5cc576]==='function'){nativeFunctions['forward']['set'](_0x1070b6[_0x5cc576],_0x34e3b7+'.'+_0x5cc576),nativeFunctions['reverse']['set'](_0x34e3b7+'.'+_0x5cc576,_0x1070b6[_0x5cc576]);return;}typeof _0x1070b6[_0x5cc576]==='object'&&_0x521ac3['indexOf'](_0x1070b6[_0x5cc576])===-(0x380+0x18b*0x2+-0x695)&&_0x1ca59d(_0x34e3b7+'.'+_0x5cc576,_0x1070b6[_0x5cc576]);});}for(const _0x5c2140 of require('repl')['_builtinLi'+'bs']){if(['wasi','sys','punycode','crypto']['includes'](_0x5c2140))continue;const _0x1d6bb8=require(_0x5c2140);_0x1ca59d(_0x5c2140,_0x1d6bb8);}}createNativeMap();function decycleObject(_0x2cd70e){if(_0x2cd70e===null||_0x2cd70e===undefined)return _0x2cd70e;const _0x59c57c=new WeakMap();function _0x55592c(_0x1b4883,_0x275489){let _0x585c56;if(!(typeof _0x1b4883==='object'&&!(_0x1b4883 instanceof Error)&&!(_0x1b4883 instanceof Date)&&!(_0x1b4883 instanceof Boolean)&&_0x1b4883!==null))return _0x1b4883;const _0x3d21f5=_0x59c57c['get'](_0x1b4883);if(_0x3d21f5!==undefined)return{'$reference':_0x3d21f5};return _0x59c57c['set'](_0x1b4883,_0x275489),Array['isArray'](_0x1b4883)?(_0x585c56=[],_0x1b4883['forEach'](function(_0x1113ee,_0x29f358){const _0x5b9b02=[..._0x275489,_0x29f358];_0x585c56[_0x29f358]=_0x55592c(_0x1113ee,_0x5b9b02);})):(_0x585c56={},Object['keys'](_0x1b4883)['forEach'](_0x33e506=>{const _0x3af39d=[..._0x275489,JSON['stringify'](_0x33e506)];_0x585c56[_0x33e506]=_0x55592c(_0x1b4883[_0x33e506],_0x3af39d);})),_0x585c56;}return _0x55592c(_0x2cd70e,[]);}function serializeBaseStructure(_0x24e35a){return{'type':typeof _0x24e35a,'value':_0x24e35a['toString']()};}function serializeBigInt(_0x491991){return{'type':'bigint','value':_0x491991['toString']()};}function serializeUndefined(_0x5a7c5c){return{'type':'undefined','value':''};}function serializeObject(_0x14786a){if(_0x14786a===null)return{'type':'null','value':''};else{if(_0x14786a instanceof Date)return{'type':'date','value':_0x14786a['toJSON']()};else{if(_0x14786a instanceof Error)return{'type':'error','value':serializeObject({'name':_0x14786a['name'],'message':_0x14786a['message'],'cause':_0x14786a['cause']})};}}if(_0x14786a['$reference']!==undefined&&Object['keys'](_0x14786a)['length']===0x1735+0x515+-0x1c49)return{'type':'reference','value':_0x14786a['$reference']};const _0x26aca4=Object['fromEntrie'+'s'](Object['entries'](_0x14786a)['map'](([_0xeaad49,_0x2a39a6])=>[_0xeaad49,serialize(_0x2a39a6)]));return{'type':_0x14786a instanceof Array?'array':'object','value':_0x26aca4};}function serializeFunction(_0x2d7641){const _0x817517=nativeFunctions['forward']['get'](_0x2d7641);return _0x817517===undefined?{'type':'function','value':_0x2d7641['toString']()}:{'type':'native','value':_0x817517};}function serialize(_0x1d4031){_0x1d4031=decycleObject(_0x1d4031);let _0x184a3f;switch(typeof _0x1d4031){case'object':_0x184a3f=serializeObject(_0x1d4031);break;case'function':_0x184a3f=serializeFunction(_0x1d4031);break;case'undefined':_0x184a3f=serializeUndefined(_0x1d4031);break;case'number':case'string':case'boolean':_0x184a3f=serializeBaseStructure(_0x1d4031);break;case'bigint':_0x184a3f=serializeBigInt(_0x1d4031);break;}return JSON['stringify'](_0x184a3f);}function deserializeObject(_0x434b82,_0x1f1e23){for(const [_0x6f6fbd,_0x5b95cb]of Object['entries'](_0x434b82)){_0x1f1e23[_0x6f6fbd]=doSerialize(_0x5b95cb,_0x1f1e23);}return _0x1f1e23;}function deserializeArray(_0x4778df,_0x1aea16){for(const [_0x4acc26,_0x2c3849]of Object['entries'](_0x4778df)){_0x1aea16[Number(_0x4acc26)]=doSerialize(_0x2c3849,_0x1aea16);}return _0x1aea16;}function deserializeString(_0x360abb){return _0x360abb;}function deserializeNumber(_0xcf130){return Number(_0xcf130);}function deserializeFunction(_0xc4aa1){return new Function('return\x20'+_0xc4aa1)();}function deserializeError(_0x497d13){const _0x377a7c=doSerialize(_0x497d13),_0x1df15f=new Error(_0x377a7c['message'],_0x377a7c['cause']);return _0x1df15f;}function deserializeReference(_0x1fcda7,_0xb9f95d){let _0x2653a2=_0xb9f95d;for(const _0x389f07 of _0x1fcda7){_0x2653a2=_0x2653a2[JSON['parse'](_0x389f07)];}return _0x2653a2;}function deserializeNative(_0x5e99d3){const _0x270340=nativeFunctions['reverse']['get'](_0x5e99d3);if(_0x270340===undefined)throw Error('Function\x20n'+'ot\x20found\x20i'+'n\x20native\x20f'+'unction\x20ma'+'p');return _0x270340;}function deserializeReferences(_0x26db98,_0x54061c){if(typeof _0x26db98!=='object'||_0x26db98===null)return _0x26db98;if(_0x26db98['type']==='reference')return deserializeReference(_0x26db98['value'],_0x54061c);if(Array['isArray'](_0x26db98))for(let _0x1782da=0x182c+0x1eda+-0x3706;_0x1782da<_0x26db98['length'];_0x1782da++){_0x26db98[_0x1782da]=deserializeReferences(_0x26db98[_0x1782da],_0x54061c);}else for(const [_0x4764c3,_0x137568]of Object['entries'](_0x26db98)){_0x26db98[_0x4764c3]=deserializeReferences(_0x137568,_0x54061c);}return _0x26db98;}function doSerialize(_0x157e49,_0x3e00bd=null){let _0x170e99;if(typeof _0x157e49==='object')_0x170e99=_0x157e49;else{if(typeof _0x157e49==='string')_0x170e99=JSON['parse'](_0x157e49);else throw new Error('Invalid\x20ar'+'gument\x20typ'+'e:\x20'+typeof _0x157e49+'.');}_0x3e00bd===null&&(_0x3e00bd={});switch(_0x170e99['type']){case'object':return deserializeObject(_0x170e99['value'],{});case'array':return deserializeArray(_0x170e99['value'],[]);case'function':return deserializeFunction(_0x170e99['value']);case'native':return deserializeNative(_0x170e99['value']);case'reference':return _0x170e99;case'number':return deserializeNumber(_0x170e99['value']);case'string':return deserializeString(_0x170e99['value']);case'boolean':return _0x170e99['value']==='true';case'bigint':return BigInt(_0x170e99['value']);case'date':return new Date(_0x170e99['value']);case'error':return deserializeError(_0x170e99['value']);case'null':return null;case'undefined':return undefined;default:throw new Error('Invalid\x20se'+'rialized\x20o'+'bject\x20type');}}function deserialize(_0x493bde){const _0x2c387d=doSerialize(_0x493bde);return deserializeReferences(_0x2c387d,_0x2c387d),_0x2c387d;}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 serialization=require('./serializ'+'ation'),id=require('./id'),wire=require('./wire');module['exports']={'serialize':serialization['serialize'],'deserialize':serialization['deserializ'+'e'],'id':id,'wire':wire};
9
+ const serialization=require('./serializ'+'ation.js'),id=require('./id.js'),wire=require('./wire.js');function normalize(_0x4552bb,_0x4eb303){const _0x8ae455=[..._0x4eb303];if(_0x4eb303['length']<_0x4552bb['length']-(-0x1808+-0x6d4+-0x1edd*-0x1)){const _0x57a91d=_0x4552bb['length']-_0x4eb303['length']-(-0x13a2+0x1d7e+-0x9db);for(let _0x1a2262=-0x122b*-0x1+0x2463+-0x368e;_0x1a2262<_0x57a91d;_0x1a2262++){_0x8ae455['push'](undefined);}}return _0x8ae455;}module['exports']={'normalize':normalize,'serialize':serialization['serialize'],'deserialize':serialization['deserializ'+'e'],'id':id,'wire':wire};
10
10
  /* eslint-enable */
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
6
6
 
7
7
  If you notice any issues with using this file, please contact the TAs.
8
8
  */
9
- const log=require('../util/lo'+'g');global['toLocal']={};function createRPC(_0x3ae44e){const _0x1dfb0f=global['distributi'+'on']['util']['id']['getID'](global['distributi'+'on']['util']['serialize'](_0x3ae44e));global['toLocal'][_0x1dfb0f]=_0x3ae44e;let _0x5e3e84='\x0a\x20\x20\x20\x20const'+'\x20callback\x20'+'=\x20args.pop'+'();\x0a\x0a\x20\x20\x20\x20l'+'et\x20remote\x20'+'=\x20{node:\x20'+JSON['stringify'](global['nodeConfig'])+(',\x20service:'+'\x20\x27')+_0x1dfb0f+('\x27,\x20method:'+'\x20\x27call\x27};\x0a'+'\x20\x20\x20\x20let\x20me'+'ssage\x20=\x20ar'+'gs;\x0a\x0a\x20\x20\x20\x20d'+'istributio'+'n.local.co'+'mm.send(me'+'ssage,\x20rem'+'ote,\x20(erro'+'r,\x20respons'+'e)\x20=>\x20{\x0a\x20\x20'+'\x20\x20\x20\x20if\x20(er'+'ror)\x20{\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20callb'+'ack(error)'+';\x0a\x20\x20\x20\x20\x20\x20}\x20'+'else\x20{\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20callb'+'ack(null,\x20'+'response);'+'\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20'+'\x20\x20\x20});\x0a\x20\x20');return log('Created\x20RP'+'C\x20with\x20id:'+'\x20'+_0x1dfb0f),new Function('...args',_0x5e3e84);}function toAsync(_0x2bb40c){log('Converting'+'\x20function\x20'+'to\x20async:\x20'+_0x2bb40c['name']+':\x20'+_0x2bb40c['toString']()['replace'](/\n/g,'|'));const _0x325ec7=(..._0x25ef91)=>{const _0x9f9f84=_0x25ef91['pop']();try{const _0x53c47c=_0x2bb40c(..._0x25ef91);_0x9f9f84(null,_0x53c47c);}catch(_0x5703b1){_0x9f9f84(_0x5703b1);}};return _0x325ec7['toString']=()=>_0x2bb40c['toString'](),_0x325ec7;}module['exports']={'createRPC':createRPC,'toAsync':toAsync};
9
+ const log=require('../util/lo'+'g.js');globalThis['toLocal']=new Map();function createRPC(_0x5a49bc){const _0xd49be6=globalThis['distributi'+'on']['util']['id']['getID'](globalThis['distributi'+'on']['util']['serialize'](_0x5a49bc));globalThis['toLocal']['set'](_0xd49be6,_0x5a49bc);let _0x5b135b='\x0a\x20\x20\x20\x20const'+'\x20callback\x20'+'=\x20args.pop'+'();\x0a\x0a\x20\x20\x20\x20l'+'et\x20remote\x20'+'=\x20{node:\x20'+JSON['stringify'](globalThis['distributi'+'on']['node']['config'])+(',\x20service:'+'\x20\x27')+_0xd49be6+('\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'+_0xd49be6),new Function('...args',_0x5b135b);}function toAsync(_0x452d3c){log('Converting'+'\x20function\x20'+'to\x20async:\x20'+_0x452d3c['name']+':\x20'+_0x452d3c['toString']()['replace'](/\n/g,'|'));const _0x435fd5=(..._0x1a3ffa)=>{const _0x5d5c1b=_0x1a3ffa['pop']();try{const _0xa98c6b=_0x452d3c(..._0x1a3ffa);return _0x5d5c1b(null,_0xa98c6b);}catch(_0x3447e7){return _0x5d5c1b(_0x3447e7);}};return _0x435fd5['toString']=()=>_0x452d3c['toString'](),_0x435fd5;}function dispatchMessage(_0x1b7acb,_0xc332d7,{key:_0x3f2260},_0xab9960,_0x2d849a){globalThis['distributi'+'on'][_0xab9960['gid']]['status']['get']('nid',(_0x41504c,_0x5e270a)=>{const _0x27ad58=Object['values'](_0x5e270a),_0x494ea5=globalThis['distributi'+'on']['util']['id']['getID'](_0x3f2260),_0x437604=_0xab9960['hash'](_0x494ea5,_0x27ad58),_0xdd0985=_0x437604['substring'](0x1153+0x10d6+-0x2229,-0x1f*0xc9+-0x1*-0x168b+0x1d1);globalThis['distributi'+'on']['local']['groups']['get'](_0xab9960['gid'],(_0x2aee21,_0x481548)=>{if(_0x481548){const _0x512fe4=_0x481548[_0xdd0985];globalThis['distributi'+'on']['local']['comm']['send'](_0x1b7acb,{..._0xc332d7,'node':_0x512fe4},_0x2d849a);}else return _0x2d849a(_0x2aee21);});});}module['exports']={'createRPC':createRPC,'toAsync':toAsync,'dispatchMessage':dispatchMessage};
10
10
  /* eslint-enable */
package/distribution.js CHANGED
@@ -1,86 +1,72 @@
1
1
  #!/usr/bin/env node
2
+ /**
3
+ * @typedef {import("./distribution/types.js").Node} Node
4
+ */
2
5
 
3
- const util = require('./distribution/util/util.js');
4
6
  const log = require('./distribution/util/log.js');
5
- const args = require('yargs').argv;
6
7
 
7
- // Default configuration
8
- global.nodeConfig = global.nodeConfig || {
9
- ip: '127.0.0.1',
10
- port: 1234,
11
- onStart: () => {
12
- console.log(`Node started!`);
13
- },
14
- };
15
-
16
- /*
17
- You can pass "ip" and "port" arguments directly.
18
- Use this to startup nodes from the terminal.
19
-
20
- Usage:
21
- ./distribution.js --ip '127.0.0.1' --port 1234 # Start node on localhost:1234
22
- */
23
- if (args.ip) {
24
- global.nodeConfig.ip = args.ip;
25
- }
26
-
27
- if (args.port) {
28
- global.nodeConfig.port = parseInt(args.port);
29
- }
8
+ /**
9
+ * @param {Node} [config]
10
+ */
11
+ function bootstrap(config) {
12
+ if (globalThis.distribution) {
13
+ log('global.distribution has already been setup');
14
+ return;
15
+ }
30
16
 
31
- if (args.config) {
32
- const nodeConfig = util.deserialize(args.config);
33
- global.nodeConfig.ip = nodeConfig.ip ? nodeConfig.ip : global.nodeConfig.ip;
34
- global.nodeConfig.port = nodeConfig.port ?
35
- nodeConfig.port : global.nodeConfig.port;
36
- global.nodeConfig.onStart = nodeConfig.onStart ?
37
- nodeConfig.onStart : global.nodeConfig.onStart;
38
- }
17
+ // @ts-ignore This is the first time globalThis.distribution is being initialized, so the object does not have all the necessary properties.
18
+ globalThis.distribution = {};
19
+ globalThis.distribution.util = require('./distribution/util/util.js');
20
+ // @ts-ignore node.server is lazily initialized.
21
+ globalThis.distribution.node = require('./distribution/local/node.js');
22
+ globalThis.distribution.local = require('./distribution/local/local.js');
39
23
 
40
- const distribution = function(config) {
41
24
  if (config) {
42
- global.nodeConfig = config;
43
- this.nodeConfig = config;
25
+ globalThis.distribution.node.config = config;
44
26
  }
45
27
 
46
- return global.distribution;
47
- };
28
+ for (const [key, service] of Object.entries(globalThis.distribution.local)) {
29
+ globalThis.distribution.local.routes.put(service, key, () => {});
30
+ }
48
31
 
49
- // Don't overwrite the distribution object if it already exists
50
- if (global.distribution === undefined) {
51
- global.distribution = distribution;
52
- }
32
+ const {setup} = require('./distribution/all/all.js');
33
+ globalThis.distribution.all = setup({gid: 'all'});
53
34
 
54
- distribution.util = require('./distribution/util/util.js');
55
- distribution.local = require('./distribution/local/local.js');
56
- distribution.node = require('./distribution/local/node.js');
35
+ /* Overrides when missing functionality from previous milestone or extra credit is needed */
57
36
 
58
- for (const key in distribution.local) {
59
- distribution.local.routes.put(distribution.local[key], key);
37
+ // For M3, when missing RPC, its path through routes, and status.{spawn, stop}
38
+ /*
39
+ globalThis.distribution.util.wire.createRPC = require('@brown-ds/distribution').util.wire.createRPC;
40
+ globalThis.distribution.local.routes.get = require('@brown-ds/distribution').local.routes.get;
41
+ globalThis.distribution.local.status.spawn = require('@brown-ds/distribution').local.status.spawn;
42
+ globalThis.distribution.local.status.stop = require('@brown-ds/distribution').local.status.stop;
43
+ */
60
44
  }
61
45
 
62
- /* Initialize distribution object */
63
- distribution['all'] = {};
64
- distribution['all'].status =
65
- require('./distribution/all/status')({gid: 'all'});
66
- distribution['all'].comm =
67
- require('./distribution/all/comm')({gid: 'all'});
68
- distribution['all'].gossip =
69
- require('./distribution/all/gossip')({gid: 'all'});
70
- distribution['all'].groups =
71
- require('./distribution/all/groups')({gid: 'all'});
72
- distribution['all'].routes =
73
- require('./distribution/all/routes')({gid: 'all'});
74
- distribution['all'].mem =
75
- require('./distribution/all/mem')({gid: 'all'});
76
- distribution['all'].store =
77
- require('./distribution/all/store')({gid: 'all'});
46
+ /*
47
+ This logic determines which implementation of the distribution library to use.
48
+ It can either be:
49
+ 1. The reference implementation from the library @brown-ds/distribution
50
+ 2. Your own, local implementation
78
51
 
79
- distribution.node.config = global.nodeConfig;
80
- module.exports = distribution;
52
+ Which one to be used by the tests is determined by the value of the property "useLibrary" in the package.json file.
53
+ */
54
+ // @ts-ignore JSON import resolved at runtime.
55
+ const {useLibrary} = require('./package.json');
56
+ // @ts-ignore Optional dependency for reference implementation.
57
+ const distribution = useLibrary ? require('@brown-ds/distribution') : bootstrap;
81
58
 
82
59
  /* The following code is run when distribution.js is run directly */
83
60
  if (require.main === module) {
84
- log(`[node] Starting node with configuration: ${JSON.stringify(global.nodeConfig)}`);
85
- distribution.node.start(global.nodeConfig.onStart);
61
+ distribution();
62
+ // __start_solution__
63
+ log(
64
+ `[node] Starting node with configuration: ${
65
+ JSON.stringify(globalThis.distribution.node.config)
66
+ }`,
67
+ );
68
+ // __end_solution__
69
+ globalThis.distribution.node.start(globalThis.distribution.node.config.onStart || (() => {}));
86
70
  }
71
+
72
+ module.exports = distribution;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brown-ds/distribution",
3
- "version": "0.1.23",
3
+ "version": "0.2.15",
4
4
  "description": "A library for building distributed systems.",
5
5
  "main": "distribution.js",
6
6
  "useLibrary": false,
@@ -10,36 +10,115 @@
10
10
  "devDependencies": {
11
11
  "eslint": "^8.55.0",
12
12
  "eslint-config-google": "^0.14.0",
13
+ "eslint-plugin-n": "^16.6.2",
13
14
  "javascript-obfuscator": "^4.1.0",
14
- "jest": "^27.4.7"
15
+ "jest": "^27.4.7",
16
+ "typescript": "^5.8.3"
15
17
  },
16
18
  "scripts": {
17
- "pretest": "./scripts/pretest.sh",
18
19
  "test": "./scripts/test.sh",
19
- "build": "./scripts/publish.sh",
20
- "lint": "eslint --ignore-path .gitignore --config .eslintrc . --fix"
20
+ "lint": "./scripts/lint.sh"
21
21
  },
22
22
  "author": "",
23
23
  "license": "ISC",
24
24
  "dependencies": {
25
25
  "yargs": "^17.7.2"
26
26
  },
27
- "report": {
28
- "hours": 999,
29
- "loc": 999,
30
- "dev": {
31
- "cpu-no": 999,
32
- "mem-gb": 999,
33
- "ssd-gb": 999
27
+ "report": [
28
+ {
29
+ "milestone": "M1",
30
+ "hours": 999,
31
+ "loc": 999,
32
+ "dev": {
33
+ "cpu-no": 999,
34
+ "mem-gb": 999,
35
+ "ssd-gb": 999
36
+ },
37
+ "throughput": {
38
+ "dev": [],
39
+ "aws": []
40
+ },
41
+ "latency": {
42
+ "dev": [],
43
+ "aws": []
44
+ },
45
+ "dloc": -99
34
46
  },
35
- "throughput": {
36
- "dev": [],
37
- "aws": []
47
+ {
48
+ "milestone": "M2",
49
+ "hours": 999,
50
+ "loc": 999,
51
+ "dev": {
52
+ "cpu-no": 999,
53
+ "mem-gb": 999,
54
+ "ssd-gb": 999
55
+ },
56
+ "throughput": {
57
+ "dev": [],
58
+ "aws": []
59
+ },
60
+ "latency": {
61
+ "dev": [],
62
+ "aws": []
63
+ },
64
+ "dloc": -99
38
65
  },
39
- "latency": {
40
- "dev": [],
41
- "aws": []
66
+ {
67
+ "milestone": "M3",
68
+ "hours": 999,
69
+ "loc": 999,
70
+ "dev": {
71
+ "cpu-no": 999,
72
+ "mem-gb": 999,
73
+ "ssd-gb": 999
74
+ },
75
+ "throughput": {
76
+ "dev": [],
77
+ "aws": []
78
+ },
79
+ "latency": {
80
+ "dev": [],
81
+ "aws": []
82
+ },
83
+ "dloc": -99
42
84
  },
43
- "dloc": -99
44
- }
85
+ {
86
+ "milestone": "M4",
87
+ "hours": 999,
88
+ "loc": 999,
89
+ "dev": {
90
+ "cpu-no": 999,
91
+ "mem-gb": 999,
92
+ "ssd-gb": 999
93
+ },
94
+ "throughput": {
95
+ "dev": [],
96
+ "aws": []
97
+ },
98
+ "latency": {
99
+ "dev": [],
100
+ "aws": []
101
+ },
102
+ "dloc": -99
103
+ },
104
+ {
105
+ "milestone": "M5",
106
+ "hours": 999,
107
+ "loc": 999,
108
+ "dev": {
109
+ "cpu-no": 999,
110
+ "mem-gb": 999,
111
+ "ssd-gb": 999
112
+ },
113
+ "throughput": {
114
+ "dev": [],
115
+ "aws": []
116
+ },
117
+ "latency": {
118
+ "dev": [],
119
+ "aws": []
120
+ },
121
+ "dloc": -99
122
+ }
123
+ ]
45
124
  }