@brown-ds/distribution 0.2.23 → 0.2.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/distribution/all/gossip.js +1 -1
- package/distribution/all/groups.js +1 -1
- package/distribution/all/mem.js +1 -1
- package/distribution/all/mr.js +1 -1
- package/distribution/all/routes.js +1 -1
- package/distribution/all/store.js +1 -1
- package/distribution/local/comm.js +1 -1
- package/distribution/local/gossip.js +1 -1
- package/distribution/local/groups.js +1 -1
- package/distribution/local/mem.js +1 -1
- package/distribution/local/routes.js +1 -1
- package/distribution/local/status.js +1 -1
- package/distribution/local/store.js +1 -1
- package/distribution/util/id.js +1 -1
- package/distribution/util/serialization.js +1 -1
- package/package.json +1 -1
|
@@ -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.js');function gossip(
|
|
9
|
+
const log=require('../util/lo'+'g.js');function gossip(_0xed951e){const _0x262117={};_0x262117['gid']=_0xed951e['gid']||'all',_0x262117['subset']=_0xed951e['subset']||function(_0x421417){return Math['ceil'](Math['log'](_0x421417['length']));};function _0x45f6a8(_0x3b4d96,_0x361731,_0x35002c){log('[gossip]\x20s'+'end:\x20'+JSON['stringify'](_0x3b4d96)+'\x20to\x20'+JSON['stringify'](_0x361731)),globalThis['distributi'+'on']['local']['groups']['get'](_0x262117['gid'],(_0x1bf167,_0x1c7539)=>{if(_0x1c7539===null){_0x35002c(_0x1bf167);return;}const _0x543e8d=_0x262117['subset'](Object['keys'](_0x1c7539)),_0x3fe720=function(_0x3731f8){const _0x4ead01={};while(Object['keys'](_0x4ead01)['length']<_0x543e8d){const _0x124bd3=Math['floor'](Math['random']()*_0x3731f8['length']);_0x4ead01[_0x3731f8[_0x124bd3]]=!![];}return _0x4ead01;},_0x11ed49=_0x3fe720(Object['keys'](_0x1c7539));log('[gossip]\x20g'+'ossipNodes'+':\x20'+JSON['stringify'](Object['keys'](_0x11ed49))+'\x20length:\x20'+Object['keys'](_0x11ed49)['length']);const _0x275d7f={},_0x35b0f8={};let _0x19a08e=0xc11*0x3+0x1ba6*-0x1+-0xc7*0xb;if(_0x3b4d96['mid']&&_0x3b4d96['gid']){}else _0x3b4d96={'message':_0x3b4d96,'remote':_0x361731,'mid':globalThis['distributi'+'on']['util']['id']['getMID'](_0x3b4d96),'gid':_0x262117['gid']};for(const _0x5b53a1 of Object['keys'](_0x11ed49)){const _0x250d27=_0x1c7539[_0x5b53a1];log('[gossip]\x20s'+'end\x20to\x20nod'+'e:\x20'+JSON['stringify'](_0x250d27));const _0x4a59c1={'node':{'ip':_0x250d27['ip'],'port':_0x250d27['port']},'service':'gossip','method':'recv'};globalThis['distributi'+'on']['local']['comm']['send']([_0x3b4d96],_0x4a59c1,(_0x64cec7,_0x7c8a60)=>{_0x64cec7?_0x35b0f8[_0x5b53a1]=_0x64cec7:_0x275d7f[_0x5b53a1]=_0x7c8a60;_0x19a08e+=0x7ae+-0xfc3*-0x1+0xc*-0x1f4;if(_0x19a08e===_0x543e8d){if(_0x35002c)return _0x35002c(_0x35b0f8,_0x275d7f);}});}});return;return _0x35002c(new Error('gossip.sen'+'d\x20not\x20impl'+'emented'));}function _0xc3c863(_0x4a3ce7,_0x45358e,_0x1d123d){const _0x38d87c=setInterval(_0x45358e,_0x4a3ce7);if(_0x1d123d)return _0x1d123d(null,_0x38d87c);return;return _0x1d123d(new Error('gossip.at\x20'+'not\x20implem'+'ented'));}function _0x59cfa1(_0xbdbec1,_0x1ed85f){clearInterval(_0xbdbec1);if(_0x1ed85f)return _0x1ed85f(null,_0xbdbec1);return;return _0x1ed85f(new Error('gossip.del'+'\x20not\x20imple'+'mented'));}return{'send':_0x45f6a8,'at':_0xc3c863,'del':_0x59cfa1};}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
|
-
function groups(
|
|
9
|
+
function groups(_0x13afa7){const _0x2d32dd={'gid':_0x13afa7['gid']||'all'};function _0x175869(_0x1baf1c,_0x49e936,_0x371df3){globalThis['distributi'+'on'][_0x2d32dd['gid']]['comm']['send']([_0x1baf1c,_0x49e936],{'service':'groups','method':'put'},_0x371df3);return;return _0x371df3(new Error('groups.put'+'\x20not\x20imple'+'mented'));}function _0x2348c5(_0x4b4cf4,_0x3f1660){globalThis['distributi'+'on'][_0x2d32dd['gid']]['comm']['send']([_0x4b4cf4],{'service':'groups','method':'del'},_0x3f1660);return;return _0x3f1660(new Error('groups.del'+'\x20not\x20imple'+'mented'));}function _0x476441(_0x465ba2,_0x2b551e){globalThis['distributi'+'on'][_0x2d32dd['gid']]['comm']['send']([_0x465ba2],{'service':'groups','method':'get'},_0x2b551e);return;return _0x2b551e(new Error('groups.get'+'\x20not\x20imple'+'mented'));}function _0x1cb83f(_0x2c8b39,_0x19947a,_0x7d4d45){globalThis['distributi'+'on'][_0x2d32dd['gid']]['comm']['send']([_0x2c8b39,_0x19947a],{'service':'groups','method':'add'},_0x7d4d45);return;return _0x7d4d45(new Error('groups.add'+'\x20not\x20imple'+'mented'));}function _0x48706(_0x223cb9,_0x5a7d85,_0x30965c){globalThis['distributi'+'on'][_0x2d32dd['gid']]['comm']['send']([_0x223cb9,_0x5a7d85],{'service':'groups','method':'rem'},_0x30965c);return;return _0x30965c(new Error('groups.rem'+'\x20not\x20imple'+'mented'));}return{'put':_0x175869,'del':_0x2348c5,'get':_0x476441,'add':_0x1cb83f,'rem':_0x48706};}module['exports']=groups;
|
|
10
10
|
/* eslint-enable */
|
package/distribution/all/mem.js
CHANGED
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
const log=require('../util/lo'+'g.js');function normalize(
|
|
9
|
+
const log=require('../util/lo'+'g.js');function normalize(_0x13affd,_0x76bd10){if(_0x13affd===null)return{'key':null,'gid':_0x76bd10,'action':'put'};else return typeof _0x13affd==='string'?{'key':_0x13affd,'gid':_0x76bd10,'action':'put'}:_0x13affd;}function mem(_0x1024b5){const _0x4f5929={};_0x4f5929['gid']=_0x1024b5['gid']||'all',_0x4f5929['hash']=_0x1024b5['hash']||globalThis['distributi'+'on']['util']['id']['naiveHash'];function _0x392d50(_0xf82396,_0x435aa6){log('[all.mem.g'+'et]\x20config'+'uration:\x20'+JSON['stringify'](_0xf82396)+'\x20context:\x20'+JSON['stringify'](_0x4f5929)),_0xf82396=normalize(_0xf82396,_0x4f5929['gid']),_0xf82396['gid']=_0xf82396['gid']||_0x4f5929['gid'];const _0x2beeb9={'service':'mem','method':'get'},_0x472a67=[_0xf82396];if(!_0xf82396['key']){globalThis['distributi'+'on'][_0x4f5929['gid']]['comm']['send'](_0x472a67,_0x2beeb9,(_0x4c4b39,_0xcc78f3)=>{const _0x4b25de=Object['values'](_0xcc78f3)['reduce']((_0x31bcd7,_0x4023ad)=>_0x31bcd7['concat'](_0x4023ad),[]);_0x435aa6(_0x4c4b39,_0x4b25de);});return;}const _0x143d73=_0xf82396['key'];if(_0x143d73===null){_0x435aa6(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x472a67,_0x2beeb9,{'key':_0x143d73},_0x4f5929,_0x435aa6);return;return _0x435aa6(new Error('mem.get\x20no'+'t\x20implemen'+'ted'));}function _0x3039da(_0x2ebf20,_0x59fc6d,_0x1ab067){log('[all.mem.p'+'ut]\x20state:'+'\x20'+JSON['stringify'](_0x2ebf20)+('\x20configura'+'tion:\x20')+JSON['stringify'](_0x59fc6d)),_0x59fc6d=_0x59fc6d||globalThis['distributi'+'on']['util']['id']['getID'](_0x2ebf20),_0x59fc6d=normalize(_0x59fc6d,_0x4f5929['gid']),_0x59fc6d['gid']=_0x59fc6d['gid']||_0x4f5929['gid'];const _0x91dcde={'service':'mem','method':'put'},_0x2c698e=[_0x2ebf20,_0x59fc6d],_0x3eb079=_0x59fc6d['key'];if(_0x3eb079===null){_0x1ab067(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x2c698e,_0x91dcde,{'key':_0x3eb079},_0x4f5929,_0x1ab067);return;return _0x1ab067(new Error('mem.put\x20no'+'t\x20implemen'+'ted'));}function _0x551bbe(_0x1ebde5,_0x2cd4b9){log('[all.mem.d'+'el]\x20config'+'uration:\x20'+JSON['stringify'](_0x1ebde5)),_0x1ebde5=normalize(_0x1ebde5,_0x4f5929['gid']),_0x1ebde5['gid']=_0x1ebde5['gid']||_0x4f5929['gid'];const _0x5318ba={'service':'mem','method':'del'},_0x429048=[_0x1ebde5],_0xe59d5a=_0x1ebde5['key'];if(_0xe59d5a===null){_0x2cd4b9(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x429048,_0x5318ba,{'key':_0xe59d5a},_0x4f5929,_0x2cd4b9);return;return _0x2cd4b9(new Error('mem.del\x20no'+'t\x20implemen'+'ted'));}function _0x3b6520(_0x4a2e20,_0x12aca9){log('[mem.recon'+'f]\x20configu'+'ration:\x20'+JSON['stringify'](_0x4a2e20)+'\x20gid:\x20'+_0x4f5929['gid']),globalThis['distributi'+'on']['local']['groups']['get'](_0x4f5929['gid'],(_0x384dc1,_0x2fb2b1)=>{if(!_0x2fb2b1){_0x12aca9(_0x384dc1);return;}globalThis['distributi'+'on']['local']['groups']['put'](_0x4f5929['gid'],_0x4a2e20,(_0x1e18f9,_0x614b96)=>{globalThis['distributi'+'on'][_0x4f5929['gid']]['mem']['get'](null,(_0xd487e9,_0x4887fa)=>{globalThis['distributi'+'on']['local']['groups']['put'](_0x4f5929['gid'],_0x2fb2b1,(_0x35b12a,_0x55d9ff)=>{globalThis['distributi'+'on'][_0x4f5929['gid']]['status']['get']('nid',(_0x54a0e1,_0x116ebb)=>{const _0x37158c=Object['values'](_0x116ebb),_0x5bb94d=Object['values'](_0x4a2e20)['map'](_0x2024f8=>globalThis['distributi'+'on']['util']['id']['getNID'](_0x2024f8));log('[mem.recon'+'f\x20received'+'\x20'+_0x4887fa['length']+('\x20keys\x20from'+'\x20')+_0x116ebb['length']+'\x20nodes');let _0x34e63f=0x1511+-0x1fb0+0xa9f;const _0x1636ec=()=>{if(_0x34e63f===_0x4887fa['length'])return _0x12aca9(null);};if(_0x4887fa['length']===0x1292+0x17c+-0x140e)return _0x12aca9(null);for(const _0x16b1d3 of _0x4887fa){const _0x5c23ce=globalThis['distributi'+'on']['util']['id']['getID'](_0x16b1d3),_0x25777d=_0x4f5929['hash'](_0x5c23ce,_0x5bb94d),_0x43d56e=_0x4f5929['hash'](_0x5c23ce,_0x37158c);log('[mem.recon'+'f]\x20old\x20nid'+':\x20'+_0x25777d+'\x20new\x20nid:\x20'+_0x43d56e);if(_0x25777d===_0x43d56e){_0x34e63f++,_0x1636ec();continue;}const _0x3774b9=_0x4a2e20[_0x25777d['substring'](0x17b*-0x11+0x1682+0x2a9*0x1,-0x5db*0x3+-0x23+0xd*0x15d)],_0x1c033e=[{'key':_0x16b1d3,'gid':_0x4f5929['gid']}],_0x56647e={'service':'mem','method':'del','node':_0x3774b9};log('[mem.recon'+'f]\x20deletin'+'g\x20key\x20'+_0x16b1d3+'\x20from\x20'+JSON['stringify'](_0x56647e)),globalThis['distributi'+'on']['local']['comm']['send'](_0x1c033e,_0x56647e,(_0x5a6b59,_0x4742a3)=>{globalThis['distributi'+'on'][_0x4f5929['gid']]['mem']['put'](_0x4742a3,_0x16b1d3,(_0x508f81,_0x29859e)=>{_0x34e63f++,_0x1636ec();});});}});});});});});return;return _0x12aca9(new Error('mem.reconf'+'\x20not\x20imple'+'mented'));}return{'get':_0x392d50,'put':_0x3039da,'del':_0x551bbe,'reconf':_0x3b6520};}module['exports']=mem;
|
|
10
10
|
/* eslint-enable */
|
package/distribution/all/mr.js
CHANGED
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
const distribution=globalThis['distributi'+'on'],id=distribution['util']['id'];function mr(
|
|
9
|
+
const distribution=globalThis['distributi'+'on'],id=distribution['util']['id'];function mr(_0x53fdf5){const _0x2e073b={'gid':_0x53fdf5['gid']||'all'};function _0x375dd2(_0x30fe58,_0x7c6412){const _0x473fd1=id['getID'](_0x30fe58),_0x206bce={'mapper':_0x30fe58['map'],'reducer':_0x30fe58['reduce'],'map':function(_0x3eb462,_0x1415c3,_0x353967,_0x1c23bc){if(_0x3eb462['length']==0x2*-0x9a7+0x24c7*-0x1+0x3815){_0x1c23bc(null,[]);return;}else{const _0x1a43f3=[];let _0xea1278=0x2683+0x121f*0x1+-0x38a2;_0x3eb462['forEach'](_0x3f391b=>{globalThis['distributi'+'on'][_0x1415c3]['store']['get'](_0x3f391b,(_0x50f109,_0x3e0495)=>{_0xea1278++;const _0x487f72=this['mapper'](_0x3f391b,_0x3e0495);Array['isArray'](_0x487f72)?_0x1a43f3['push'](..._0x487f72):_0x1a43f3['push'](_0x487f72),_0xea1278==_0x3eb462['length']&&distribution['local']['store']['put'](_0x1a43f3,_0x353967+'_map',(_0x4f0612,_0x408d9e)=>{_0x1c23bc(_0x4f0612,_0x1a43f3);});});});}},'shuffle':function(_0x5ece1e,_0x5a807d,_0x2c21ec){distribution['local']['store']['get'](_0x5a807d+'_map',(_0x114763,_0x48df1d)=>{if(!_0x114763){let _0x3b9810=0x19d+-0x5*-0x665+-0x599*0x6;_0x48df1d['forEach'](_0x46ed8a=>{const [_0x37e90a]=Object['keys'](_0x46ed8a);distribution[_0x5ece1e]['mem']['put'](_0x46ed8a[_0x37e90a],{'key':_0x37e90a,'action':'append','gid':_0x5ece1e},(_0x90ca69,_0x381c37)=>{_0x3b9810++;if(_0x3b9810==_0x48df1d['length'])return _0x2c21ec(null,_0x48df1d);});});}else return _0x2c21ec(_0x114763,{});});},'reduce':function(_0x182b15,_0x335121,_0x276198){distribution['local']['mem']['get']({'key':null,'gid':_0x182b15},(_0xb17b97,_0x2241f2)=>{let _0x2318d2=[],_0x201040=-0x1*-0x6a2+-0xb6*-0x3+-0xc*0xbb;if(_0x2241f2['length']==0xcd9+0xecf*0x1+-0x1ba8)return _0x276198(null,null);_0x2241f2['forEach'](_0x1b9a85=>distribution['local']['mem']['get']({'key':_0x1b9a85,'gid':_0x182b15},(_0x596ee6,_0x5b2ed0)=>{const _0xa81146=this['reducer'](_0x1b9a85,_0x5b2ed0);_0x2318d2=_0x2318d2['concat'](_0xa81146),_0x201040++;if(_0x201040==_0x2241f2['length'])return _0x276198(null,_0x2318d2);}));});}},_0x27b4a0=function(_0x567508,_0x4cc380){const _0x25d09a={};return Object['keys'](_0x4cc380)['forEach'](_0xd9cab7=>{_0x25d09a[_0xd9cab7]=[];}),_0x567508['forEach'](_0x53bf95=>{const _0xdc1fea=id['getID'](_0x53bf95),_0x3c31aa=id['naiveHash'](_0xdc1fea,Object['keys'](_0x4cc380));_0x25d09a[_0x3c31aa]['push'](_0x53bf95);}),_0x25d09a;};distribution[_0x2e073b['gid']]['routes']['put'](_0x206bce,'mr-'+_0x473fd1,(_0x228736,_0x84eff2)=>{distribution['local']['groups']['get'](_0x2e073b['gid'],(_0x2f9687,_0x50a215)=>{if(!_0x50a215){_0x7c6412(_0x2f9687);return;}const _0x1ea321=_0x27b4a0(_0x30fe58['keys'],_0x50a215);let _0x843e6a=0xc8c+-0xe*-0x14+-0xda4;const _0x13e409=Object['keys'](_0x50a215)['length'],_0x411548={'service':'mr-'+_0x473fd1,'method':'map'};for(const _0x537e81 in _0x50a215){const _0x4193bb=[_0x1ea321[_0x537e81],_0x2e073b['gid'],_0x473fd1];distribution['local']['comm']['send'](_0x4193bb,{'node':_0x50a215[_0x537e81],..._0x411548},(_0x12bf09,_0x2d9be3)=>{++_0x843e6a;if(_0x843e6a==_0x13e409){const _0x56f58c={'service':'mr-'+_0x473fd1,'method':'shuffle'};distribution[_0x2e073b['gid']]['comm']['send']([_0x2e073b['gid'],_0x473fd1],_0x56f58c,(_0x20c2dc,_0x2b7b57)=>{const _0x3cc6ef={'service':'mr-'+_0x473fd1,'method':'reduce'};distribution[_0x2e073b['gid']]['comm']['send']([_0x2e073b['gid'],_0x473fd1],_0x3cc6ef,(_0x5b4cd1,_0x4772d8)=>{let _0x195e5a=[];for(const _0x2bf2eb of Object['values'](_0x4772d8)){_0x2bf2eb!==null&&(_0x195e5a=_0x195e5a['concat'](_0x2bf2eb));}_0x7c6412(null,_0x195e5a);return;});});}});}});});return;return _0x7c6412(new Error('mr.exec\x20no'+'t\x20implemen'+'ted'));}return{'exec':_0x375dd2};}module['exports']=mr;
|
|
10
10
|
/* eslint-enable */
|
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
function routes(
|
|
9
|
+
function routes(_0xd22c){const _0x2fce7e={};_0x2fce7e['gid']=_0xd22c['gid']||'all';function _0x2a4c53(_0x4bb287,_0x4c200e,_0x68c2e2){globalThis['distributi'+'on'][_0x2fce7e['gid']]['comm']['send']([_0x4bb287,_0x4c200e],{'service':'routes','method':'put'},_0x68c2e2);return;return _0x68c2e2(new Error('routes.put'+'\x20not\x20imple'+'mented'));}function _0x81ab89(_0xd0a584,_0x3bcf62){globalThis['distributi'+'on'][_0x2fce7e['gid']]['comm']['send']([_0xd0a584],{'service':'routes','method':'rem'},_0x3bcf62);return;return _0x3bcf62(new Error('routes.rem'+'\x20not\x20imple'+'mented'));}return{'put':_0x2a4c53,'rem':_0x81ab89};}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 log=require('../util/lo'+'g.js');function getNode(
|
|
9
|
+
const log=require('../util/lo'+'g.js');function getNode(_0x1de661,_0x24d5f0,_0x28af9d){const _0x15363d=_0x24d5f0&&typeof _0x24d5f0==='object'?_0x24d5f0['key']:_0x24d5f0;globalThis['distributi'+'on'][_0x1de661['gid']]['status']['get']('nid',(_0x3dd193,_0x1b7cfb)=>{const _0x285dc5=Object['values'](_0x1b7cfb),_0x453505=globalThis['distributi'+'on']['util']['id']['getID'](_0x15363d),_0x1d2a3f=_0x1de661['hash'](_0x453505,_0x285dc5),_0x1a412c=_0x1d2a3f['substring'](0x46*-0xe+-0xa*-0xc4+-0x3d4,-0x1ef7+-0x1fd5+-0x3ed1*-0x1);globalThis['distributi'+'on']['local']['groups']['get'](_0x1de661['gid'],(_0x187315,_0x580f04)=>{if(!_0x580f04)return _0x28af9d(_0x187315);else{const _0x5e76ae=_0x580f04[_0x1a412c];return log('[store\x20(ge'+'tNode)]\x20co'+'nfiguratio'+'n:\x20'+JSON['stringify'](_0x24d5f0)+'group:\x20'+JSON['stringify'](_0x580f04)+'\x20node:\x20'+JSON['stringify'](_0x5e76ae)+'nid:\x20'+JSON['stringify'](_0x1d2a3f)+'\x20sid:\x20'+JSON['stringify'](_0x1a412c)),_0x28af9d(null,_0x5e76ae);}});});}function normalize(_0x163895,_0x3c4f62){if(_0x163895===null)return{'key':null,'gid':_0x3c4f62,'action':'put'};else return typeof _0x163895==='string'?{'key':_0x163895,'gid':_0x3c4f62,'action':'put'}:_0x163895;}function store(_0x167984){const _0x16f33e={'gid':_0x167984['gid']||'all','hash':_0x167984['hash']||globalThis['distributi'+'on']['util']['id']['naiveHash'],'subset':_0x167984['subset']};function _0x10eab0(_0x2ef6b7,_0x38ef93){if(!_0x2ef6b7){const _0x17ea1c=[{'key':null,'gid':_0x16f33e['gid']}];globalThis['distributi'+'on'][_0x16f33e['gid']]['comm']['send'](_0x17ea1c,{'service':'store','method':'get'},(_0x4a2e4d,_0x178482)=>{const _0x29f2dc=Object['values'](_0x178482)['reduce']((_0x24e18b,_0x2b1ab4)=>_0x24e18b['concat'](_0x2b1ab4),[]);_0x38ef93(_0x4a2e4d,_0x29f2dc);});return;}_0x2ef6b7=normalize(_0x2ef6b7,_0x16f33e['gid']),getNode(_0x16f33e,_0x2ef6b7,(_0x2fa49e,_0x175203)=>{if(!_0x175203){_0x38ef93(_0x2fa49e);return;}const _0x307ff0=[_0x2ef6b7],_0x39c751={'service':'store','method':'get','node':_0x175203};log('[all.store'+'.get]confi'+'guration:\x20'+JSON['stringify'](_0x2ef6b7)+'node:\x20'+JSON['stringify'](globalThis['distributi'+'on']['node']['config'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x175203)),globalThis['distributi'+'on']['local']['comm']['send'](_0x307ff0,_0x39c751,_0x38ef93);});return;return _0x38ef93(new Error('store.get\x20'+'not\x20implem'+'ented'));}function _0xb8a2c2(_0x46c1d8,_0x3db568,_0x2fc7d4){_0x3db568=_0x3db568||globalThis['distributi'+'on']['util']['id']['getID'](_0x46c1d8),_0x3db568=normalize(_0x3db568,_0x16f33e['gid']),getNode(_0x16f33e,_0x3db568,(_0x57a329,_0x4cfaf5)=>{if(!_0x4cfaf5){_0x2fc7d4(_0x57a329);return;}const _0x36a221=[_0x46c1d8,_0x3db568],_0x27fa35={'service':'store','method':'put','node':_0x4cfaf5};log('[all.store'+'.put]\x20stat'+'e:\x20'+JSON['stringify'](_0x46c1d8)+('configurat'+'ion:\x20')+JSON['stringify'](_0x3db568)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x4cfaf5)),globalThis['distributi'+'on']['local']['comm']['send'](_0x36a221,_0x27fa35,_0x2fc7d4);});return;return _0x2fc7d4(new Error('store.put\x20'+'not\x20implem'+'ented'));}function _0x35f63d(_0x251e9e,_0x310679){getNode(_0x16f33e,_0x251e9e,(_0x100c81,_0x2bfec2)=>{if(!_0x2bfec2){_0x310679(_0x100c81);return;}const _0x3b78c7=[{'key':_0x251e9e,'gid':_0x16f33e['gid']}],_0x59b50f={'service':'store','method':'del','node':_0x2bfec2};globalThis['distributi'+'on']['local']['comm']['send'](_0x3b78c7,_0x59b50f,_0x310679);});return;return _0x310679(new Error('store.del\x20'+'not\x20implem'+'ented'));}function _0x319cf7(_0x3b9ecb,_0x38b6e8){log('[store.rec'+'onf]\x20confi'+'guration:\x20'+JSON['stringify'](_0x3b9ecb)+'\x20gid:\x20'+_0x16f33e['gid']),globalThis['distributi'+'on']['local']['groups']['get'](_0x16f33e['gid'],(_0xb5991f,_0x31995e)=>{if(!_0x31995e){_0x38b6e8(_0xb5991f);return;}globalThis['distributi'+'on']['local']['groups']['put'](_0x16f33e['gid'],_0x3b9ecb,(_0xa9fad1,_0x359f20)=>{globalThis['distributi'+'on'][_0x16f33e['gid']]['store']['get'](null,(_0x59ad7f,_0x461adf)=>{globalThis['distributi'+'on']['local']['groups']['put'](_0x16f33e['gid'],_0x31995e,(_0x3a7608,_0x392309)=>{globalThis['distributi'+'on'][_0x16f33e['gid']]['status']['get']('nid',(_0x413fe7,_0x1b3c9d)=>{const _0x4c3b12=Object['values'](_0x1b3c9d),_0x43ddad=Object['values'](_0x3b9ecb)['map'](_0x34d599=>globalThis['distributi'+'on']['util']['id']['getNID'](_0x34d599));log('[store.rec'+'onf\x20receiv'+'ed\x20'+_0x461adf['length']+('\x20keys\x20from'+'\x20')+_0x1b3c9d['length']+'\x20nodes');let _0x5a990f=-0x35e+0x53*-0x17+0xad3;const _0xfcd7de=()=>{if(_0x5a990f===_0x461adf['length'])return _0x38b6e8(null);};if(_0x461adf['length']===-0x1f29+-0x8*-0x11f+0x1631)return _0x38b6e8(null);for(const _0x2e69f4 of _0x461adf){const _0x2c2a50=globalThis['distributi'+'on']['util']['id']['getID'](_0x2e69f4),_0x543052=_0x16f33e['hash'](_0x2c2a50,_0x43ddad),_0x268cd0=_0x16f33e['hash'](_0x2c2a50,_0x4c3b12);log('[store.rec'+'onf]\x20old\x20n'+'id:\x20'+_0x543052+'\x20new\x20nid:\x20'+_0x268cd0);if(_0x543052===_0x268cd0){_0x5a990f++,_0xfcd7de();continue;}const _0x23d5c7=_0x3b9ecb[_0x543052['substring'](-0x1*-0xa7b+-0xf53*-0x1+-0xce7*0x2,0x2083+0x16f7+0x1*-0x3775)],_0x21600b=[{'key':_0x2e69f4,'gid':_0x16f33e['gid']}],_0x6f378e={'service':'store','method':'del','node':_0x23d5c7};log('[store.rec'+'onf]\x20delet'+'ing\x20key\x20'+_0x2e69f4+'\x20from\x20'+JSON['stringify'](_0x6f378e)),globalThis['distributi'+'on']['local']['comm']['send'](_0x21600b,_0x6f378e,(_0x4f778a,_0x11da82)=>{globalThis['distributi'+'on'][_0x16f33e['gid']]['store']['put'](_0x11da82,_0x2e69f4,(_0x23ad1a,_0x12dab4)=>{_0x5a990f++,_0xfcd7de();});});}});});});});});return;return _0x38b6e8(new Error('store.reco'+'nf\x20not\x20imp'+'lemented'));}return{'get':_0x10eab0,'put':_0xb8a2c2,'del':_0x35f63d,'reconf':_0x319cf7};}module['exports']=store;
|
|
10
10
|
/* eslint-enable */
|
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
const http=require('node:http'),log=require('../util/lo'+'g.js');function createGuardedCallback(
|
|
9
|
+
const http=require('node:http'),log=require('../util/lo'+'g.js');function createGuardedCallback(_0x2b0d0a){let _0x4d4299=-0x2*-0x70a+-0x278*-0xb+-0x293c;function _0x257e21(_0x49d050,_0x592541){_0x4d4299+=0x26b7+0x5*0x4b5+-0x1*0x3e3f;if(_0x4d4299>-0x11*0x149+0x6f*0x1+0x156b){log('Warning:\x20C'+'allback\x20fu'+'nction\x20cal'+'led\x20'+_0x4d4299+'\x20times');return;}if(_0x2b0d0a!==undefined){_0x2b0d0a(_0x49d050,_0x592541);return;}}return _0x257e21;}function send(_0x4f68b0,_0x51eca9,_0x403dbc){_0x403dbc=createGuardedCallback(_0x403dbc);if(_0x51eca9===undefined){_0x403dbc(new Error('Remote\x20is\x20'+'required'));return;}if(_0x51eca9?.['node']?.['ip']===undefined||_0x51eca9?.['node']?.['port']===undefined){_0x403dbc(new Error('Remote\x20nod'+'e\x20IP\x20and\x20p'+'ort\x20requir'+'ed'));return;}if(_0x51eca9?.['service']===undefined){_0x403dbc(new Error('Remote\x20ser'+'vice\x20is\x20re'+'quired'));return;}if(_0x51eca9?.['method']===undefined){_0x403dbc(new Error('Remote\x20met'+'hod\x20is\x20req'+'uired'));return;}if(!(_0x4f68b0 instanceof Array)){_0x403dbc(new Error('Message\x20mu'+'st\x20be\x20an\x20a'+'rray\x20of\x20ar'+'guments'));return;}const _0x3e15cb=_0x51eca9['node'],_0x54402a=_0x51eca9['service'],_0xea0f43=_0x51eca9['method'],_0x119530=_0x51eca9['gid']||'local';log('[comm.send'+']:\x20Sending'+'\x20'+JSON['stringify'](_0x4f68b0)+'\x20to\x20'+_0x51eca9['service']+':'+_0x51eca9['method']+'\x20on\x20'+_0x51eca9['node']['ip']+':'+_0x51eca9['node']['port']);const _0x453a77=globalThis['distributi'+'on']['util']['serialize'](_0x4f68b0),_0x37c092={'hostname':_0x3e15cb['ip'],'port':_0x3e15cb['port'],'path':'/'+_0x119530+'/'+_0x54402a+'/'+_0xea0f43,'method':'PUT','headers':{'Content-Type':'applicatio'+'n/json','Content-Length':Buffer['byteLength'](_0x453a77)}},_0x4045c9=http['request'](_0x37c092,_0x50b48f=>{let _0x5cbef9='';_0x50b48f['on']('data',function(_0x550a00){_0x5cbef9+=_0x550a00;}),_0x50b48f['on']('end',function(){let _0xd40dff=undefined,_0x17f3ca=undefined;try{const _0x4409a1=globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x5cbef9);_0xd40dff=_0x4409a1[0xb0a+-0x3b9*0x3+-0x1*-0x21],_0x17f3ca=_0x4409a1[0x1eb6+-0x1e0e+-0xa7*0x1];}catch(_0x28a0eb){let _0x21ae3b=_0x5cbef9['slice'](0x12*0x1cd+0x819+-0x2883,-0x267b+0x7*0x2fb+-0x2*-0xac3);_0x5cbef9['length']>0x442+0x1322+-0x137c&&(_0x21ae3b+='...');_0x403dbc(new Error('Failed\x20to\x20'+'deserializ'+'e\x20HTTP\x20res'+'ponse:\x20'+_0x21ae3b));return;}_0x403dbc(_0xd40dff,_0x17f3ca);return;}),_0x50b48f['on']('error',_0x2688c0=>{_0x403dbc(new Error('HTTP\x20respo'+'nse\x20error:'+'\x20'+_0x2688c0?.['message']));return;});});_0x4045c9['on']('error',_0x42ae41=>{_0x403dbc(new Error('HTTP\x20reque'+'st\x20error:\x20'+_0x42ae41?.['message']));return;}),_0x4045c9['write'](_0x453a77),_0x4045c9['end']();return;return _0x403dbc(new Error('comm.send\x20'+'not\x20implem'+'ented'));}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 N=
|
|
9
|
+
const N=0x1d02+-0xce5*-0x2+-0x36c2,messageStore={'messages':[],'push'(_0x5d4445){this['messages']['push'](_0x5d4445),this['messages']['length']>N&&this['messages']['shift']();},'has'(_0x266857){return this['messages']['includes'](_0x266857);}};function recv(_0x1d6d7b,_0x37cee1){const {message:_0x26cf48,remote:_0x473923,mid:_0x2ceb5d,gid:_0x3053dc}=_0x1d6d7b;if(messageStore['has'](_0x2ceb5d)){_0x37cee1(new Error('Message\x20al'+'ready\x20rece'+'ived'));return;}globalThis['distributi'+'on'][_0x3053dc]['gossip']['send'](_0x1d6d7b,_0x473923,()=>{}),messageStore['push'](_0x2ceb5d),_0x473923['node']={'ip':globalThis['distributi'+'on']['node']['config']['ip'],'port':globalThis['distributi'+'on']['node']['config']['port']},globalThis['distributi'+'on']['local']['comm']['send'](_0x26cf48,_0x473923,(_0x14b840,_0x4f9710)=>{_0x37cee1(_0x14b840,_0x4f9710);});return;return _0x37cee1(new Error('gossip.rec'+'v\x20not\x20impl'+'emented'));}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'),groupsStore={};groupsStore['all']={},groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](globalThis['distributi'+'on']['node']['config'])]=globalThis['distributi'+'on']['node']['config'];function get(
|
|
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(_0x5748d0,_0x5b311d){return _0x5748d0 in groupsStore?_0x5b311d(null,groupsStore[_0x5748d0]):_0x5b311d(new Error('Group\x20'+_0x5748d0+'\x20not\x20found'),null);return _0x5b311d(new Error('groups.get'+'\x20not\x20imple'+'mented'));}function put(_0xcee79c,_0x51fd4c,_0x4b2b48){log('groups.put'+':\x20config:\x20'+JSON['stringify'](_0xcee79c)+'\x20group:\x20'+JSON['stringify'](_0x51fd4c)),_0x51fd4c=_0x51fd4c||{};typeof _0xcee79c==='string'&&(_0xcee79c={'gid':_0xcee79c});if(!_0xcee79c['gid'])return _0x4b2b48(Error('Config\x20gid'+'\x20was\x20null'),null);groupsStore[_0xcee79c['gid']]=_0x51fd4c,Object['values'](_0x51fd4c)['forEach'](_0xfc3f1b=>{groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](_0xfc3f1b)]=_0xfc3f1b;});const {setup:_0x18b3ee}=require('../../dist'+'ribution/a'+'ll/all.js');globalThis['distributi'+'on'][_0xcee79c['gid']]=_0x18b3ee(_0xcee79c);return _0x4b2b48(null,_0x51fd4c);return _0x4b2b48(new Error('groups.put'+'\x20not\x20imple'+'mented'));}function del(_0x382b9b,_0x364ed3){if(_0x382b9b in groupsStore){const _0x2a528f=groupsStore[_0x382b9b];return delete groupsStore[_0x382b9b],globalThis['distributi'+'on'][_0x382b9b]&&delete globalThis['distributi'+'on'][_0x382b9b],_0x364ed3(null,_0x2a528f);}else return _0x364ed3(new Error('Group\x20'+_0x382b9b+'\x20not\x20found'));return _0x364ed3(new Error('groups.del'+'\x20not\x20imple'+'mented'));}function add(_0x149d92,_0x5165ee,_0x443236){log('[all.group'+'s.add]\x20gro'+'up\x20name:\x20'+_0x149d92+'\x20node:\x20'+JSON['stringify'](_0x5165ee));if(_0x149d92 in groupsStore){!groupsStore[_0x149d92]&&(groupsStore[_0x149d92]={});groupsStore[_0x149d92][globalThis['distributi'+'on']['util']['id']['getSID'](_0x5165ee)]=_0x5165ee,groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](_0x5165ee)]=_0x5165ee;if(_0x443236)return _0x443236(null,groupsStore[_0x149d92]);}else{if(_0x443236)return _0x443236(new Error('Group\x20'+_0x149d92+'\x20not\x20found'));}return;return _0x443236(new Error('groups.add'+'\x20not\x20imple'+'mented'));};function rem(_0x421508,_0x363eca,_0x20828b){log('[all.group'+'s.rem]\x20nam'+'e:\x20'+_0x421508+'\x20node:\x20'+_0x363eca);return _0x421508 in groupsStore?(delete groupsStore[_0x421508][_0x363eca],delete groupsStore['all'][_0x363eca],_0x20828b(null,groupsStore[_0x421508])):_0x20828b(new Error('Group\x20'+_0x421508+'\x20not\x20found'));return _0x20828b(new Error('groups.rem'+'\x20not\x20imple'+'mented'));};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 log=require('../util/lo'+'g'),kvStore={'store':{},'get'(
|
|
9
|
+
const log=require('../util/lo'+'g'),kvStore={'store':{},'get'(_0x5aa73a){if(!this['store'][_0x5aa73a['gid']])return undefined;return this['store'][_0x5aa73a['gid']][_0x5aa73a['key']];},'put'(_0xf5d67f,_0x2895ce){!this['store'][_0xf5d67f['gid']]&&(this['store'][_0xf5d67f['gid']]={}),this['store'][_0xf5d67f['gid']][_0xf5d67f['key']]=_0x2895ce;},'append'(_0x32e330,_0x3055e7){!this['get'](_0x32e330)&&this['put'](_0x32e330,[]),!Array['isArray'](this['get'](_0x32e330))&&this['put'](_0x32e330,[this['get'](_0x32e330)]),Array['isArray'](_0x3055e7)?this['put'](_0x32e330,this['get'](_0x32e330)['concat'](_0x3055e7)):this['store'][_0x32e330['gid']][_0x32e330['key']]['push'](_0x3055e7);},'del'(_0x86ae5d){if(!this['store'][_0x86ae5d['gid']])return undefined;const _0x635988=this['store'][_0x86ae5d['gid']][_0x86ae5d['key']];return delete this['store'][_0x86ae5d['gid']][_0x86ae5d['key']],_0x635988;},'toString'(){let _0x4229f4='';for(const _0x5d498c in this['store']){_0x4229f4+=_0x5d498c+':\x20'+JSON['stringify'](this['store'][_0x5d498c]);}return _0x4229f4;}};function normalize(_0x57caaa){if(_0x57caaa===null)return{'key':null,'gid':null,'action':null};else return typeof _0x57caaa==='string'?{'key':_0x57caaa,'gid':null,'action':null}:_0x57caaa;};function put(_0x15cbdd,_0x53d7ff,_0x500cc5){log('[mem.put]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x53d7ff)+'\x20state:\x20'+JSON['stringify'](_0x15cbdd)+'\x20store:\x20'+kvStore['toString']());let {key:_0x2d9e3a,gid:_0x25df00,action:_0xb8954a}=normalize(_0x53d7ff);_0x2d9e3a=_0x2d9e3a||globalThis['distributi'+'on']['util']['id']['getID'](_0x15cbdd),_0x25df00=_0x25df00||'local',_0xb8954a=_0xb8954a||'put',kvStore[_0xb8954a]({'key':_0x2d9e3a,'gid':_0x25df00},_0x15cbdd),log('[mem.put]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']());if(_0x500cc5)return _0x500cc5(null,_0x15cbdd);return;return _0x500cc5(new Error('mem.put\x20no'+'t\x20implemen'+'ted'));};function get(_0x2355f1,_0x18fbe7){log('[mem.get]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x2355f1)+'\x20store:\x20'+kvStore['toString']());let {key:_0x40f2d1,gid:_0x2c958b}=normalize(_0x2355f1);_0x2c958b=_0x2c958b||'local';if(_0x40f2d1){const _0x5ba27a=kvStore['get']({'key':_0x40f2d1,'gid':_0x2c958b});return _0x5ba27a?_0x18fbe7(null,_0x5ba27a):_0x18fbe7(new Error('Memory\x20key'+'\x20\x22'+_0x40f2d1+('\x22\x20not\x20foun'+'d\x20for\x20')+_0x2c958b+'\x27s\x20store'));}else{let _0x2d5b05=kvStore['store'][_0x2c958b]||{};return _0x2d5b05=Object['keys'](_0x2d5b05),_0x18fbe7(null,_0x2d5b05);}return;return _0x18fbe7(new Error('mem.get\x20no'+'t\x20implemen'+'ted'));}function del(_0x29ca8e,_0x33fa07){log('[mem.del]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x29ca8e)+'\x20store:\x20'+kvStore['toString']());let {key:_0x5dc147,gid:_0x5caab1}=normalize(_0x29ca8e);_0x5caab1=_0x5caab1||'local';const _0x466918=kvStore['del']({'key':_0x5dc147,'gid':_0x5caab1});log('[mem.del]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']());return _0x466918?_0x33fa07(null,_0x466918):_0x33fa07(new Error('Memory\x20key'+'\x20\x22'+_0x5dc147+('\x22\x20not\x20foun'+'d\x20for\x20')+_0x5caab1+'\x27s\x20store'));return;return _0x33fa07(new Error('mem.del\x20no'+'t\x20implemen'+'ted'));};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 log=require('../util/lo'+'g'),routesStore=new Map();function get(
|
|
9
|
+
const log=require('../util/lo'+'g'),routesStore=new Map();function get(_0x3c878b,_0x2d8a42){log('[routes.ge'+'t]\x20Getting'+'\x20service:\x20'+JSON['stringify'](_0x3c878b));if(!_0x3c878b)return _0x2d8a42(new Error('No\x20configu'+'ration\x20pro'+'vided!'));typeof _0x3c878b==='string'&&(_0x3c878b={'service':_0x3c878b});const _0x7cc0c2=_0x3c878b['service'],_0x1d7c39=_0x3c878b['gid'];if(_0x1d7c39&&_0x1d7c39!=='local')return log('[routes.ge'+'t]\x20Found\x20d'+'istributed'+'\x20service:\x20'+_0x7cc0c2),_0x2d8a42(null,globalThis['distributi'+'on'][_0x1d7c39][_0x7cc0c2]);else{const _0x33155b=routesStore['get'](_0x7cc0c2);if(_0x33155b)return log('[routes.ge'+'t]\x20Found\x20l'+'ocal\x20servi'+'ce:\x20'+_0x7cc0c2),_0x2d8a42(null,_0x33155b);else{const _0x2f3260=globalThis['toLocal']['get'](_0x7cc0c2);return _0x2f3260?(log('[routes.ge'+'t]\x20Found\x20R'+'PC:\x20'+_0x7cc0c2),_0x2d8a42(null,{'call':_0x2f3260})):_0x2d8a42(new Error('Service\x20'+_0x7cc0c2+('\x20not\x20found'+'\x20in\x20routes')));}}return _0x2d8a42(new Error('routes.get'+'\x20not\x20imple'+'mented'));}function put(_0xf948d0,_0x194d97,_0xa8d9f8){log('[routes.pu'+'t]\x20Putting'+'\x20service:\x20'+_0x194d97),routesStore['set'](_0x194d97,_0xf948d0);return _0xa8d9f8(null,_0x194d97);return _0xa8d9f8(new Error('routes.put'+'\x20not\x20imple'+'mented'));}function rem(_0x485265,_0x567b0f){const _0xd2df8c=routesStore['get'](_0x485265);routesStore['delete'](_0x485265);return _0x567b0f(null,_0xd2df8c);return _0x567b0f(new Error('routes.rem'+'\x20not\x20imple'+'mented'));}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'),counts
|
|
9
|
+
const log=require('../util/lo'+'g'),counts=0x8a8*-0x1+0x2537+-0x985*0x3;function get(_0x1a50b3,_0x30db05){if(_0x1a50b3 in globalThis['distributi'+'on']['node']['config']){_0x30db05(null,globalThis['distributi'+'on']['node']['config'][_0x1a50b3]);return;}if(_0x1a50b3==='sid'){_0x30db05(null,globalThis['distributi'+'on']['util']['id']['getSID'](globalThis['distributi'+'on']['node']['config']));return;}if(_0x1a50b3==='nid'){_0x30db05(null,globalThis['distributi'+'on']['util']['id']['getNID'](globalThis['distributi'+'on']['node']['config']));return;}if(_0x1a50b3==='counts'){_0x30db05(null,counts);return;}if(_0x1a50b3==='heapTotal'){_0x30db05(null,process['memoryUsag'+'e']()['heapTotal']);return;}if(_0x1a50b3==='heapUsed'){_0x30db05(null,process['memoryUsag'+'e']()['heapUsed']);return;}return _0x30db05(new Error('Status\x20key'+'\x20not\x20found'));return _0x30db05(new Error('status.get'+'\x20not\x20imple'+'mented'));};const fs=require('fs'),path=require('path'),proc=require('node:child'+'_process');function getDistribution(){let _0x1136ce='';try{const _0x5ef89a=proc['execSync']('git\x20rev-pa'+'rse\x20--show'+'-toplevel',{'encoding':'utf8'})['trim']();_0x1136ce=path['join'](_0x5ef89a,'distributi'+'on.js');if(fs['existsSync'](_0x1136ce))return _0x1136ce;}catch(_0xdddb85){log('[status]\x20C'+'ould\x20not\x20d'+'etermine\x20g'+'it\x20root:',_0xdddb85['message']);}_0x1136ce=path['join'](__dirname,'../../','distributi'+'on.js');if(fs['existsSync'](_0x1136ce))return _0x1136ce;_0x1136ce=path['join'](process['cwd'](),'distributi'+'on.js');if(fs['existsSync'](_0x1136ce))return _0x1136ce;throw new Error('Failed\x20to\x20'+'find\x20proje'+'ct\x20root.');}function createOnStart(_0x15e5ae,_0x5d1f67){const _0x525c88='\x0a\x20\x20\x20\x20retur'+'n\x20function'+'(e)\x20{\x0a\x20\x20\x20\x20'+'\x20\x20let\x20onSt'+'art\x20=\x20'+_0x15e5ae['toString']()+(';\x0a\x20\x20\x20\x20\x20\x20le'+'t\x20callback'+'RPC\x20=\x20')+globalThis['distributi'+'on']['util']['wire']['createRPC'](globalThis['distributi'+'on']['util']['wire']['toAsync'](_0x5d1f67))['toString']()+(';\x0a\x20\x20\x20\x20\x20\x20if'+'\x20(e)\x20{\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20callb'+'ackRPC(e,\x20'+'null,\x20()\x20='+'>\x20{});\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20retur'+'n;\x0a\x20\x20\x20\x20\x20\x20}'+'\x0a\x20\x20\x20\x20\x20\x20try'+'\x20{\x0a\x20\x20\x20\x20\x20\x20\x20'+'\x20onStart()'+';\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+'callbackRP'+'C(null,\x20gl'+'obal.distr'+'ibution.no'+'de.config,'+'\x20()\x20=>\x20{})'+';\x0a\x20\x20\x20\x20\x20\x20}\x20'+'catch(e)\x20{'+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20c'+'allbackRPC'+'(e,\x20null,\x20'+'()\x20=>\x20{});'+'\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20'+'\x20\x20\x20};\x0a\x20\x20');return new Function(_0x525c88)();}function spawn(_0x1e1257,_0x427366){const _0x549ffe=_0x1e1257;_0x549ffe['onStart']=_0x549ffe['onStart']||function(){};if(!_0x549ffe['port']||!_0x549ffe['ip']){_0x427366(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'](_0x549ffe));const _0x189e4c=(_0x3a9f27,_0xfc46c8)=>{if(_0x3a9f27){_0x427366(_0x3a9f27);return;}globalThis['distributi'+'on']['local']['groups']['add']('all',_0xfc46c8,()=>{_0x427366(_0x3a9f27,_0xfc46c8);});};_0x549ffe['onStart']=createOnStart(_0x549ffe['onStart'],_0x189e4c);const _0x199ff3=getDistribution();log('[status.sp'+'awn]\x20Using'+'\x20distribut'+'ion\x20path:\x20'+_0x199ff3);const _0x1f1f23=proc['spawn']('node',[_0x199ff3,'--config',globalThis['distributi'+'on']['util']['serialize'](_0x549ffe)],{'detached':!![],'stdio':'inherit'});_0x1f1f23;return;_0x427366(new Error('status.spa'+'wn\x20not\x20imp'+'lemented'));}function stop(_0x46a0a8){log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),globalThis['distributi'+'on']['node']['server']['close'](),process['nextTick'](()=>process['exit'](-0x16eb*0x1+-0x2*0xc6e+0x2fc7));return _0x46a0a8(null,globalThis['distributi'+'on']['node']['config']);_0x46a0a8(new Error('status.sto'+'p\x20not\x20impl'+'emented'));}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);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(
|
|
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);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(_0x2e334a){if(_0x2e334a===null)return{'key':null,'gid':null,'action':'put'};else return typeof _0x2e334a==='string'?{'key':_0x2e334a,'gid':null,'action':'put'}:_0x2e334a;}function put(_0x4ec3e5,_0x550b25,_0x4f84e5){log('[store.put'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x550b25)+'\x20state:\x20'+JSON['stringify'](_0x4ec3e5)),_0x550b25=normalize(_0x550b25),_0x550b25['key']=_0x550b25['key']||globalThis['distributi'+'on']['util']['id']['getID'](_0x4ec3e5),_0x550b25['gid']=_0x550b25['gid']||'local';const _0x11c45f=globalThis['distributi'+'on']['util']['serialize'](_0x4ec3e5),_0x5e766c=Buffer['from'](_0x550b25['key'])['toString']('base64'),_0x4f4ec0=path['join'](nodeFolder,_0x550b25['gid']+'-'+_0x5e766c);fs['writeFile'](_0x4f4ec0,_0x11c45f,_0x4f7adb=>{return _0x4f7adb?_0x4f84e5(_0x4f7adb):_0x4f84e5(null,_0x4ec3e5);});return;return _0x4f84e5(new Error('store.put\x20'+'not\x20implem'+'ented'));}function get(_0x1014f3,_0x423047){log('[store.get'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x1014f3)),_0x1014f3=normalize(_0x1014f3),_0x1014f3['gid']=_0x1014f3['gid']||'local';if(!_0x1014f3['key']){fs['readdir'](nodeFolder,(_0x422361,_0x4b570e)=>{if(_0x422361)return _0x423047(_0x422361);const _0x16120c=[];for(let _0x4d414c=0x1f2d*0x1+0x193d+0x6*-0x967;_0x4d414c<_0x4b570e['length'];_0x4d414c++){const _0x5ce055=_0x4b570e[_0x4d414c]['split']('-'),_0x237633=_0x5ce055[-0x1244+0x1f+0x5*0x3a1];if(_0x237633!==_0x1014f3['gid'])continue;const _0x341e7c=_0x5ce055[_0x5ce055['length']-(0x63*-0x23+-0x15e2+0x236c)];_0x16120c['push'](Buffer['from'](_0x341e7c,'base64')['toString']());}return _0x423047(null,_0x16120c);});return;}const _0x50d4d6=Buffer['from'](_0x1014f3['key'])['toString']('base64'),_0x3c02a1=path['join'](nodeFolder,_0x1014f3['gid']+'-'+_0x50d4d6);fs['readFile'](_0x3c02a1,(_0x54785b,_0x529a35)=>{return _0x54785b?_0x54785b['code']==='ENOENT'?_0x423047(new Error('File\x20'+_0x3c02a1+('\x20(from\x20key'+'\x20\x27')+_0x1014f3['key']+('\x27)\x20not\x20fou'+'nd\x20for\x20gro'+'up\x20')+_0x1014f3['gid'])):_0x423047(_0x54785b):_0x423047(null,globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x529a35['toString']()));});return;return _0x423047(new Error('store.get\x20'+'not\x20implem'+'ented'));}function del(_0x3ba923,_0x45a8ea){log('[store.del'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x3ba923)),_0x3ba923=normalize(_0x3ba923),_0x3ba923['gid']=_0x3ba923['gid']||'local';const _0x2fea1a=Buffer['from'](_0x3ba923['key'])['toString']('base64'),_0x213b6a=path['join'](nodeFolder,_0x3ba923['gid']+'-'+_0x2fea1a);get(_0x3ba923,(_0x220f79,_0x1fb5ce)=>{if(_0x220f79)return _0x45a8ea(_0x220f79);fs['rm'](_0x213b6a,_0x25358d=>{return _0x25358d?_0x45a8ea(_0x25358d):_0x45a8ea(null,_0x1fb5ce);});});return;return _0x45a8ea(new Error('store.del\x20'+'not\x20implem'+'ented'));}module['exports']={'put':put,'get':get,'del':del};
|
|
10
10
|
/* eslint-enable */
|
package/distribution/util/id.js
CHANGED
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
const assert=require('assert'),crypto=require('crypto');function getID(
|
|
9
|
+
const assert=require('assert'),crypto=require('crypto');function getID(_0x4782ce){const _0x201020=crypto['createHash']('sha256');return _0x201020['update'](JSON['stringify'](_0x4782ce)),_0x201020['digest']('hex');}function getNID(_0x2d8636){return _0x2d8636={'ip':_0x2d8636['ip'],'port':_0x2d8636['port']},getID(_0x2d8636);}function getSID(_0x33ed95){return getNID(_0x33ed95)['substring'](-0x2*0xe05+-0x5d4+-0x6*-0x5a5,-0x1cc0+0x1030+-0xc95*-0x1);}function getMID(_0xee8490){const _0x41d748={};return _0x41d748['date']=new Date()['getTime'](),_0x41d748['mss']=_0xee8490,getID(_0x41d748);}function idToNum(_0x359a0e){assert(typeof _0x359a0e==='string','idToNum:\x20i'+'d\x20is\x20not\x20i'+'n\x20KID\x20form'+'!');const _0x521aa2=_0x359a0e['startsWith']('0x')?_0x359a0e['slice'](-0x12fb*-0x2+0x22ad+-0x48a1):_0x359a0e;if(/^[0-9a-fA-F]+$/['test'](_0x521aa2))return BigInt('0x'+_0x521aa2);return BigInt(_0x359a0e);}const naiveHash=(_0x1c8137,_0x28ed80)=>{_0x28ed80['sort']();const _0x148019=Number(idToNum(_0x1c8137)%BigInt(_0x28ed80['length']));return _0x28ed80[_0x148019];},consistentHash=(_0x61260a,_0x2a45c1)=>{const _0x62fa12=idToNum(_0x61260a),_0x575565=_0x2a45c1['map'](_0x48adc3=>({'id':_0x48adc3,'hash':idToNum(_0x48adc3)}));_0x575565['sort']((_0x38f1a1,_0x187a05)=>{if(_0x38f1a1['hash']<_0x187a05['hash'])return-(-0x4*0x4fd+-0x3e*-0x86+-0xc7f*0x1);if(_0x38f1a1['hash']>_0x187a05['hash'])return-0xdab+-0x1ac9+0x2875;return 0x157b+0x2487+-0x3a02;});for(const _0x14855b of _0x575565){if(_0x62fa12<=_0x14855b['hash'])return _0x14855b['id'];}return _0x575565[0x10*0x3b+-0x18d0+0x1520]['id'];},rendezvousHash=(_0x3db221,_0x4b615b)=>{let _0x41b857=null,_0x41639e=null;for(const _0x15b2ca of _0x4b615b){const _0x5e0fce=getID(_0x3db221+_0x15b2ca),_0x584d14=idToNum(_0x5e0fce);(_0x41b857===null||_0x584d14>_0x41b857)&&(_0x41b857=_0x584d14,_0x41639e=_0x15b2ca);}if(_0x41639e===null)throw Error('maxNID\x20is\x20'+'null.\x20nids'+'\x20is\x20likely'+'\x20an\x20empty\x20'+'list');else return _0x41639e;};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 nativeFunctions={'forward':new Map(),'reverse':new Map()};function createNativeMap(){const
|
|
9
|
+
const nativeFunctions={'forward':new Map(),'reverse':new Map()};function createNativeMap(){const _0x14db7c=[];function _0xc568ec(_0x9633c3,_0x2a391c){if(_0x2a391c===null||_0x2a391c===undefined)return;if(_0x14db7c['indexOf'](_0x2a391c)!==-(0xa53+-0x14c0+-0x3*-0x37a))return;_0x14db7c['push'](_0x2a391c),Object['getOwnProp'+'ertyNames'](_0x2a391c)['forEach'](_0x14aee6=>{if(typeof _0x2a391c[_0x14aee6]==='function'){nativeFunctions['forward']['set'](_0x2a391c[_0x14aee6],_0x9633c3+'.'+_0x14aee6),nativeFunctions['reverse']['set'](_0x9633c3+'.'+_0x14aee6,_0x2a391c[_0x14aee6]);return;}typeof _0x2a391c[_0x14aee6]==='object'&&_0x14db7c['indexOf'](_0x2a391c[_0x14aee6])===-(-0xaa+-0x12bd*-0x1+0x909*-0x2)&&_0xc568ec(_0x9633c3+'.'+_0x14aee6,_0x2a391c[_0x14aee6]);});}for(const _0x3178d9 of require('repl')['_builtinLi'+'bs']){if(['wasi','sys','punycode','crypto']['includes'](_0x3178d9))continue;const _0x4eda68=require(_0x3178d9);_0xc568ec(_0x3178d9,_0x4eda68);}}createNativeMap();function decycleObject(_0x11dc48){if(_0x11dc48===null||_0x11dc48===undefined)return _0x11dc48;const _0x3450d6=new WeakMap();function _0x117782(_0x2c0bb9,_0x4f42ef){let _0x4239b;if(!(typeof _0x2c0bb9==='object'&&!(_0x2c0bb9 instanceof Error)&&!(_0x2c0bb9 instanceof Date)&&!(_0x2c0bb9 instanceof Boolean)&&_0x2c0bb9!==null))return _0x2c0bb9;const _0x82b432=_0x3450d6['get'](_0x2c0bb9);if(_0x82b432!==undefined)return{'$reference':_0x82b432};return _0x3450d6['set'](_0x2c0bb9,_0x4f42ef),Array['isArray'](_0x2c0bb9)?(_0x4239b=[],_0x2c0bb9['forEach'](function(_0x4b1cc9,_0x2abd2f){const _0x549465=[..._0x4f42ef,_0x2abd2f];_0x4239b[_0x2abd2f]=_0x117782(_0x4b1cc9,_0x549465);})):(_0x4239b={},Object['keys'](_0x2c0bb9)['forEach'](_0x52b780=>{const _0x8a54c2=[..._0x4f42ef,JSON['stringify'](_0x52b780)];_0x4239b[_0x52b780]=_0x117782(_0x2c0bb9[_0x52b780],_0x8a54c2);})),_0x4239b;}return _0x117782(_0x11dc48,[]);}function serializeBaseStructure(_0x183c86){return{'type':typeof _0x183c86,'value':_0x183c86['toString']()};}function serializeBigInt(_0x50c78d){return{'type':'bigint','value':_0x50c78d['toString']()};}function serializeUndefined(_0xa3e9aa){return{'type':'undefined','value':''};}function serializeObject(_0x2f3d29){if(_0x2f3d29===null)return{'type':'null','value':''};else{if(_0x2f3d29 instanceof Date)return{'type':'date','value':_0x2f3d29['toJSON']()};else{if(_0x2f3d29 instanceof Error)return{'type':'error','value':serializeObject({'name':_0x2f3d29['name'],'message':_0x2f3d29['message'],'cause':_0x2f3d29['cause']})};}}if(_0x2f3d29['$reference']!==undefined&&Object['keys'](_0x2f3d29)['length']===-0x1085+0x3*-0x3f+0x1143)return{'type':'reference','value':_0x2f3d29['$reference']};const _0x305989=Object['fromEntrie'+'s'](Object['entries'](_0x2f3d29)['map'](([_0x49315d,_0x4751fa])=>[_0x49315d,serialize(_0x4751fa)]));return{'type':_0x2f3d29 instanceof Array?'array':'object','value':_0x305989};}function serializeFunction(_0x141fc6){const _0x2f1181=nativeFunctions['forward']['get'](_0x141fc6);return _0x2f1181===undefined?{'type':'function','value':_0x141fc6['toString']()}:{'type':'native','value':_0x2f1181};}function serialize(_0x246c81){_0x246c81=decycleObject(_0x246c81);let _0x22c608;switch(typeof _0x246c81){case'object':_0x22c608=serializeObject(_0x246c81);break;case'function':_0x22c608=serializeFunction(_0x246c81);break;case'undefined':_0x22c608=serializeUndefined(_0x246c81);break;case'number':case'string':case'boolean':_0x22c608=serializeBaseStructure(_0x246c81);break;case'bigint':_0x22c608=serializeBigInt(_0x246c81);break;}return JSON['stringify'](_0x22c608);}function deserializeObject(_0x13720b,_0xe7277b){for(const [_0x29105e,_0x21a9c1]of Object['entries'](_0x13720b)){_0xe7277b[_0x29105e]=doSerialize(_0x21a9c1,_0xe7277b);}return _0xe7277b;}function deserializeArray(_0x2c1ece,_0x25b297){for(const [_0x58044e,_0x1750e7]of Object['entries'](_0x2c1ece)){_0x25b297[Number(_0x58044e)]=doSerialize(_0x1750e7,_0x25b297);}return _0x25b297;}function deserializeString(_0x185ae9){return _0x185ae9;}function deserializeNumber(_0x29cfe5){return Number(_0x29cfe5);}function deserializeFunction(_0x1496a7){return new Function('return\x20'+_0x1496a7)();}function deserializeError(_0x42d6b6){const _0x29588f=doSerialize(_0x42d6b6),_0x4b582b=new Error(_0x29588f['message'],_0x29588f['cause']);return _0x4b582b;}function deserializeReference(_0x2091f3,_0x219745){let _0x477c2e=_0x219745;for(const _0x2d5710 of _0x2091f3){_0x477c2e=_0x477c2e[JSON['parse'](_0x2d5710)];}return _0x477c2e;}function deserializeNative(_0x1b2e12){const _0x1b336b=nativeFunctions['reverse']['get'](_0x1b2e12);if(_0x1b336b===undefined)throw Error('Function\x20n'+'ot\x20found\x20i'+'n\x20native\x20f'+'unction\x20ma'+'p');return _0x1b336b;}function deserializeReferences(_0x4e4974,_0x39af26){if(typeof _0x4e4974!=='object'||_0x4e4974===null)return _0x4e4974;if(_0x4e4974['type']==='reference')return deserializeReference(_0x4e4974['value'],_0x39af26);if(Array['isArray'](_0x4e4974))for(let _0x57cdf9=-0x47f*0x1+0x1*0x12c1+-0xe42;_0x57cdf9<_0x4e4974['length'];_0x57cdf9++){_0x4e4974[_0x57cdf9]=deserializeReferences(_0x4e4974[_0x57cdf9],_0x39af26);}else for(const [_0x30bf49,_0x3677f1]of Object['entries'](_0x4e4974)){_0x4e4974[_0x30bf49]=deserializeReferences(_0x3677f1,_0x39af26);}return _0x4e4974;}function doSerialize(_0x5140c6,_0x493991=null){let _0x21a7cc;if(typeof _0x5140c6==='object')_0x21a7cc=_0x5140c6;else{if(typeof _0x5140c6==='string')_0x21a7cc=JSON['parse'](_0x5140c6);else throw new Error('Invalid\x20ar'+'gument\x20typ'+'e:\x20'+typeof _0x5140c6+'.');}_0x493991===null&&(_0x493991={});switch(_0x21a7cc['type']){case'object':return deserializeObject(_0x21a7cc['value'],{});case'array':return deserializeArray(_0x21a7cc['value'],[]);case'function':return deserializeFunction(_0x21a7cc['value']);case'native':return deserializeNative(_0x21a7cc['value']);case'reference':return _0x21a7cc;case'number':return deserializeNumber(_0x21a7cc['value']);case'string':return deserializeString(_0x21a7cc['value']);case'boolean':return _0x21a7cc['value']==='true';case'bigint':return BigInt(_0x21a7cc['value']);case'date':return new Date(_0x21a7cc['value']);case'error':return deserializeError(_0x21a7cc['value']);case'null':return null;case'undefined':return undefined;default:throw new Error('Invalid\x20se'+'rialized\x20o'+'bject\x20type');}}function deserialize(_0x1ea2cd){const _0x817c57=doSerialize(_0x1ea2cd);return deserializeReferences(_0x817c57,_0x817c57),_0x817c57;}module['exports']={'serialize':serialize,'deserialize':deserialize};
|
|
10
10
|
/* eslint-enable */
|