@brown-ds/distribution 0.2.23 → 0.2.24
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(_0x4a8d46,_0x69ce06,_0x429d12){const _0x2e769a=_0x69ce06&&typeof _0x69ce06==='object'?_0x69ce06['key']:_0x69ce06;globalThis['distributi'+'on'][_0x4a8d46['gid']]['status']['get']('nid',(_0x227145,_0x3868c7)=>{const _0x89a799=Object['values'](_0x3868c7),_0x451438=globalThis['distributi'+'on']['util']['id']['getID'](_0x2e769a),_0x50335a=_0x4a8d46['hash'](_0x451438,_0x89a799),_0x5a0ed3=_0x50335a['substring'](-0x1*-0x1877+0xca*-0x2e+0xbd5,-0x2*-0x761+0x2645+-0xa*0x54d);globalThis['distributi'+'on']['local']['groups']['get'](_0x4a8d46['gid'],(_0x44541b,_0x2883e1)=>{if(!_0x2883e1)return _0x429d12(_0x44541b);else{const _0x503ee8=_0x2883e1[_0x5a0ed3];return log('[store\x20(ge'+'tNode)]\x20co'+'nfiguratio'+'n:\x20'+JSON['stringify'](_0x69ce06)+'group:\x20'+JSON['stringify'](_0x2883e1)+'\x20node:\x20'+JSON['stringify'](_0x503ee8)+'nid:\x20'+JSON['stringify'](_0x50335a)+'\x20sid:\x20'+JSON['stringify'](_0x5a0ed3)),_0x429d12(null,_0x503ee8);}});});}function normalize(_0x4f03d4,_0x4a86b1){if(_0x4f03d4===null)return{'key':null,'gid':_0x4a86b1,'action':'put'};else return typeof _0x4f03d4==='string'?{'key':_0x4f03d4,'gid':_0x4a86b1,'action':'put'}:_0x4f03d4;}function store(_0x3c5d4c){const _0x32a4f3={'gid':_0x3c5d4c['gid']||'all','hash':_0x3c5d4c['hash']||globalThis['distributi'+'on']['util']['id']['naiveHash'],'subset':_0x3c5d4c['subset']};function _0x538f96(_0x45cd96,_0x4956dd){if(!_0x45cd96){const _0x38c459=[{'key':null,'gid':_0x32a4f3['gid']}];globalThis['distributi'+'on'][_0x32a4f3['gid']]['comm']['send'](_0x38c459,{'service':'store','method':'get'},(_0x5679d2,_0x140eb9)=>{const _0xb9d483=Object['values'](_0x140eb9)['reduce']((_0x43cfdd,_0x241f61)=>_0x43cfdd['concat'](_0x241f61),[]);_0x4956dd(_0x5679d2,_0xb9d483);});return;}_0x45cd96=normalize(_0x45cd96,_0x32a4f3['gid']),getNode(_0x32a4f3,_0x45cd96,(_0xbe761,_0x31a46c)=>{if(!_0x31a46c){_0x4956dd(_0xbe761);return;}const _0xf768bf=[_0x45cd96],_0x46a88a={'service':'store','method':'get','node':_0x31a46c};log('[all.store'+'.get]confi'+'guration:\x20'+JSON['stringify'](_0x45cd96)+'node:\x20'+JSON['stringify'](globalThis['distributi'+'on']['node']['config'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x31a46c)),globalThis['distributi'+'on']['local']['comm']['send'](_0xf768bf,_0x46a88a,_0x4956dd);});return;return _0x4956dd(new Error('store.get\x20'+'not\x20implem'+'ented'));}function _0x159653(_0x6e0b54,_0x42600f,_0xfabe01){_0x42600f=_0x42600f||globalThis['distributi'+'on']['util']['id']['getID'](_0x6e0b54),_0x42600f=normalize(_0x42600f,_0x32a4f3['gid']),getNode(_0x32a4f3,_0x42600f,(_0x3c46a7,_0x515ab7)=>{if(!_0x515ab7){_0xfabe01(_0x3c46a7);return;}const _0x49acb7=[_0x6e0b54,_0x42600f],_0x5bbffe={'service':'store','method':'put','node':_0x515ab7};log('[all.store'+'.put]\x20stat'+'e:\x20'+JSON['stringify'](_0x6e0b54)+('configurat'+'ion:\x20')+JSON['stringify'](_0x42600f)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x515ab7)),globalThis['distributi'+'on']['local']['comm']['send'](_0x49acb7,_0x5bbffe,_0xfabe01);});return;return _0xfabe01(new Error('store.put\x20'+'not\x20implem'+'ented'));}function _0xf7d730(_0x4d9055,_0x450d71){getNode(_0x32a4f3,_0x4d9055,(_0x3925de,_0x3fc873)=>{if(!_0x3fc873){_0x450d71(_0x3925de);return;}const _0x583da3=[{'key':_0x4d9055,'gid':_0x32a4f3['gid']}],_0x5e7a35={'service':'store','method':'del','node':_0x3fc873};globalThis['distributi'+'on']['local']['comm']['send'](_0x583da3,_0x5e7a35,_0x450d71);});return;return _0x450d71(new Error('store.del\x20'+'not\x20implem'+'ented'));}function _0x4b959b(_0x38686d,_0x121ecb){log('[store.rec'+'onf]\x20confi'+'guration:\x20'+JSON['stringify'](_0x38686d)+'\x20gid:\x20'+_0x32a4f3['gid']),globalThis['distributi'+'on']['local']['groups']['get'](_0x32a4f3['gid'],(_0x225c6f,_0x5de63b)=>{if(!_0x5de63b){_0x121ecb(_0x225c6f);return;}globalThis['distributi'+'on']['local']['groups']['put'](_0x32a4f3['gid'],_0x38686d,(_0x5df20d,_0x5a62ec)=>{globalThis['distributi'+'on'][_0x32a4f3['gid']]['store']['get'](null,(_0x1f31ca,_0x182920)=>{globalThis['distributi'+'on']['local']['groups']['put'](_0x32a4f3['gid'],_0x5de63b,(_0x20d543,_0x2e150d)=>{globalThis['distributi'+'on'][_0x32a4f3['gid']]['status']['get']('nid',(_0x1e7bbe,_0x1c803c)=>{const _0x5b39f7=Object['values'](_0x1c803c),_0x277cda=Object['values'](_0x38686d)['map'](_0x564e64=>globalThis['distributi'+'on']['util']['id']['getNID'](_0x564e64));log('[store.rec'+'onf\x20receiv'+'ed\x20'+_0x182920['length']+('\x20keys\x20from'+'\x20')+_0x1c803c['length']+'\x20nodes');let _0x2b30dd=0xd*0x137+-0x1716*-0x1+-0x26e1*0x1;const _0x2b7316=()=>{if(_0x2b30dd===_0x182920['length'])return _0x121ecb(null);};if(_0x182920['length']===0x1b8+-0x2633+0x247b)return _0x121ecb(null);for(const _0x563df6 of _0x182920){const _0x3b337f=globalThis['distributi'+'on']['util']['id']['getID'](_0x563df6),_0x934556=_0x32a4f3['hash'](_0x3b337f,_0x277cda),_0x2bbe23=_0x32a4f3['hash'](_0x3b337f,_0x5b39f7);log('[store.rec'+'onf]\x20old\x20n'+'id:\x20'+_0x934556+'\x20new\x20nid:\x20'+_0x2bbe23);if(_0x934556===_0x2bbe23){_0x2b30dd++,_0x2b7316();continue;}const _0x6e94e9=_0x38686d[_0x934556['substring'](0x477*-0x1+0x18cc+-0x1455,0x1d95*0x1+-0x22a*0x6+0x1*-0x1094)],_0x3eee67=[{'key':_0x563df6,'gid':_0x32a4f3['gid']}],_0x34de30={'service':'store','method':'del','node':_0x6e94e9};log('[store.rec'+'onf]\x20delet'+'ing\x20key\x20'+_0x563df6+'\x20from\x20'+JSON['stringify'](_0x34de30)),globalThis['distributi'+'on']['local']['comm']['send'](_0x3eee67,_0x34de30,(_0x4f5509,_0x57fd82)=>{globalThis['distributi'+'on'][_0x32a4f3['gid']]['store']['put'](_0x57fd82,_0x563df6,(_0x41d067,_0x4c93c7)=>{_0x2b30dd++,_0x2b7316();});});}});});});});});return;return _0x121ecb(new Error('store.reco'+'nf\x20not\x20imp'+'lemented'));}return{'get':_0x538f96,'put':_0x159653,'del':_0xf7d730,'reconf':_0x4b959b};}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(_0x31151d){let _0x2528e6=0x482+-0x1*0x1247+-0x4b*-0x2f;function _0x43f5fd(_0x5ea8df,_0x21d0d6){_0x2528e6+=-0x7ed+0x23*-0xc5+-0x19*-0x165;if(_0x2528e6>-0x78c+-0xf1b+0x16a8){log('Warning:\x20C'+'allback\x20fu'+'nction\x20cal'+'led\x20'+_0x2528e6+'\x20times');return;}if(_0x31151d!==undefined){_0x31151d(_0x5ea8df,_0x21d0d6);return;}}return _0x43f5fd;}function send(_0x355769,_0x31c12d,_0xe37bd2){_0xe37bd2=createGuardedCallback(_0xe37bd2);if(_0x31c12d===undefined){_0xe37bd2(new Error('Remote\x20is\x20'+'required'));return;}if(_0x31c12d?.['node']?.['ip']===undefined||_0x31c12d?.['node']?.['port']===undefined){_0xe37bd2(new Error('Remote\x20nod'+'e\x20IP\x20and\x20p'+'ort\x20requir'+'ed'));return;}if(_0x31c12d?.['service']===undefined){_0xe37bd2(new Error('Remote\x20ser'+'vice\x20is\x20re'+'quired'));return;}if(_0x31c12d?.['method']===undefined){_0xe37bd2(new Error('Remote\x20met'+'hod\x20is\x20req'+'uired'));return;}if(!(_0x355769 instanceof Array)){_0xe37bd2(new Error('Message\x20mu'+'st\x20be\x20an\x20a'+'rray\x20of\x20ar'+'guments'));return;}const _0x12bcfa=_0x31c12d['node'],_0x65790a=_0x31c12d['service'],_0x411682=_0x31c12d['method'],_0x1d8da9=_0x31c12d['gid']||'local';log('[comm.send'+']:\x20Sending'+'\x20'+JSON['stringify'](_0x355769)+'\x20to\x20'+_0x31c12d['service']+':'+_0x31c12d['method']+'\x20on\x20'+_0x31c12d['node']['ip']+':'+_0x31c12d['node']['port']);const _0x21d7e4=globalThis['distributi'+'on']['util']['serialize'](_0x355769),_0x3c7cbe={'hostname':_0x12bcfa['ip'],'port':_0x12bcfa['port'],'path':'/'+_0x1d8da9+'/'+_0x65790a+'/'+_0x411682,'method':'PUT','headers':{'Content-Type':'applicatio'+'n/json','Content-Length':Buffer['byteLength'](_0x21d7e4)}},_0x103377=http['request'](_0x3c7cbe,_0x2514a8=>{let _0x22b289='';_0x2514a8['on']('data',function(_0x5a4234){_0x22b289+=_0x5a4234;}),_0x2514a8['on']('end',function(){let _0x56eb4d=undefined,_0x2582c6=undefined;try{const _0xfecd76=globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x22b289);_0x56eb4d=_0xfecd76[-0x57f+-0x1*0x197b+0x1efa],_0x2582c6=_0xfecd76[-0x1*0x1f+0x35*-0xb5+0x2599];}catch(_0x32a01e){let _0x46bfcd=_0x22b289['slice'](0x1d3*0x1+-0x4f*-0x40+0x731*-0x3,0x1*0x5f6+-0x26*0x4a+-0x2fa*-0x3);_0x22b289['length']>0x24f4+0x8*0x10d+-0xe*0x2f6&&(_0x46bfcd+='...');_0xe37bd2(new Error('Failed\x20to\x20'+'deserializ'+'e\x20HTTP\x20res'+'ponse:\x20'+_0x46bfcd));return;}_0xe37bd2(_0x56eb4d,_0x2582c6);return;}),_0x2514a8['on']('error',_0xebed84=>{_0xe37bd2(new Error('HTTP\x20respo'+'nse\x20error:'+'\x20'+_0xebed84?.['message']));return;});});_0x103377['on']('error',_0x33c701=>{_0xe37bd2(new Error('HTTP\x20reque'+'st\x20error:\x20'+_0x33c701?.['message']));return;}),_0x103377['write'](_0x21d7e4),_0x103377['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 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(_0x558f44,_0x50d9e2){return _0x558f44 in groupsStore?_0x50d9e2(null,groupsStore[_0x558f44]):_0x50d9e2(new Error('Group\x20'+_0x558f44+'\x20not\x20found'),null);}function put(_0x37e256,_0x3c86c7,_0x4efe7d){log('groups.put'+':\x20config:\x20'+JSON['stringify'](_0x37e256)+'\x20group:\x20'+JSON['stringify'](_0x3c86c7)),_0x3c86c7=_0x3c86c7||{};typeof _0x37e256==='string'&&(_0x37e256={'gid':_0x37e256});if(!_0x37e256['gid'])return _0x4efe7d(Error('Config\x20gid'+'\x20was\x20null'),null);groupsStore[_0x37e256['gid']]=_0x3c86c7,Object['values'](_0x3c86c7)['forEach'](_0x48cd9d=>{groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](_0x48cd9d)]=_0x48cd9d;});const {setup:_0x1ea597}=require('../../dist'+'ribution/a'+'ll/all.js');return globalThis['distributi'+'on'][_0x37e256['gid']]=_0x1ea597(_0x37e256),_0x4efe7d(null,_0x3c86c7);}function del(_0x3b5d3c,_0x38bccf){if(_0x3b5d3c in groupsStore){const _0x3bffce=groupsStore[_0x3b5d3c];return delete groupsStore[_0x3b5d3c],globalThis['distributi'+'on'][_0x3b5d3c]&&delete globalThis['distributi'+'on'][_0x3b5d3c],_0x38bccf(null,_0x3bffce);}else return _0x38bccf(new Error('Group\x20'+_0x3b5d3c+'\x20not\x20found'));}function add(_0x56e327,_0x8aff2a,_0x433454){log('[all.group'+'s.add]\x20gro'+'up\x20name:\x20'+_0x56e327+'\x20node:\x20'+JSON['stringify'](_0x8aff2a));if(_0x56e327 in groupsStore){!groupsStore[_0x56e327]&&(groupsStore[_0x56e327]={});groupsStore[_0x56e327][globalThis['distributi'+'on']['util']['id']['getSID'](_0x8aff2a)]=_0x8aff2a,groupsStore['all'][globalThis['distributi'+'on']['util']['id']['getSID'](_0x8aff2a)]=_0x8aff2a;if(_0x433454)return _0x433454(null,groupsStore[_0x56e327]);}else{if(_0x433454)return _0x433454(new Error('Group\x20'+_0x56e327+'\x20not\x20found'));}};function rem(_0x51276c,_0x3e2dbc,_0x50bb5b){return log('[all.group'+'s.rem]\x20nam'+'e:\x20'+_0x51276c+'\x20node:\x20'+_0x3e2dbc),_0x51276c in groupsStore?(delete groupsStore[_0x51276c][_0x3e2dbc],delete groupsStore['all'][_0x3e2dbc],_0x50bb5b(null,groupsStore[_0x51276c])):_0x50bb5b(new Error('Group\x20'+_0x51276c+'\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 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(_0x5d20c0,_0x534a0a){log('[routes.ge'+'t]\x20Getting'+'\x20service:\x20'+JSON['stringify'](_0x5d20c0));if(!_0x5d20c0)return _0x534a0a(new Error('No\x20configu'+'ration\x20pro'+'vided!'));typeof _0x5d20c0==='string'&&(_0x5d20c0={'service':_0x5d20c0});const _0x105318=_0x5d20c0['service'],_0x372b05=_0x5d20c0['gid'];if(_0x372b05&&_0x372b05!=='local')return log('[routes.ge'+'t]\x20Found\x20d'+'istributed'+'\x20service:\x20'+_0x105318),_0x534a0a(null,globalThis['distributi'+'on'][_0x372b05][_0x105318]);else{const _0x3b2d89=routesStore['get'](_0x105318);if(_0x3b2d89)return log('[routes.ge'+'t]\x20Found\x20l'+'ocal\x20servi'+'ce:\x20'+_0x105318),_0x534a0a(null,_0x3b2d89);else{const _0x133ff0=globalThis['toLocal']['get'](_0x105318);return _0x133ff0?(log('[routes.ge'+'t]\x20Found\x20R'+'PC:\x20'+_0x105318),_0x534a0a(null,{'call':_0x133ff0})):_0x534a0a(new Error('Service\x20'+_0x105318+('\x20not\x20found'+'\x20in\x20routes')));}}}function put(_0x5d97d9,_0x52d181,_0x21481c){log('[routes.pu'+'t]\x20Putting'+'\x20service:\x20'+_0x52d181),routesStore['set'](_0x52d181,_0x5d97d9);if(_0x21481c)return _0x21481c(null,_0x52d181);}function rem(_0x8118fd,_0x3e6011){const _0x5bedf8=routesStore['get'](_0x8118fd);return routesStore['delete'](_0x8118fd),_0x3e6011(null,_0x5bedf8);}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=-0x4f+0xfe7+-0xf98;function get(_0x2c24ae,_0x5c033c){if(_0x2c24ae in globalThis['distributi'+'on']['node']['config']){_0x5c033c(null,globalThis['distributi'+'on']['node']['config'][_0x2c24ae]);return;}if(_0x2c24ae==='sid'){_0x5c033c(null,globalThis['distributi'+'on']['util']['id']['getSID'](globalThis['distributi'+'on']['node']['config']));return;}if(_0x2c24ae==='nid'){_0x5c033c(null,globalThis['distributi'+'on']['util']['id']['getNID'](globalThis['distributi'+'on']['node']['config']));return;}if(_0x2c24ae==='counts'){_0x5c033c(null,counts);return;}if(_0x2c24ae==='heapTotal'){_0x5c033c(null,process['memoryUsag'+'e']()['heapTotal']);return;}if(_0x2c24ae==='heapUsed'){_0x5c033c(null,process['memoryUsag'+'e']()['heapUsed']);return;}_0x5c033c(new Error('Status\x20key'+'\x20not\x20found'));};const fs=require('fs'),path=require('path'),proc=require('node:child'+'_process');function getDistribution(){let _0x3f0b9e='';try{const _0x1cbbec=proc['execSync']('git\x20rev-pa'+'rse\x20--show'+'-toplevel',{'encoding':'utf8'})['trim']();_0x3f0b9e=path['join'](_0x1cbbec,'distributi'+'on.js');if(fs['existsSync'](_0x3f0b9e))return _0x3f0b9e;}catch(_0xfed2a){log('[status]\x20C'+'ould\x20not\x20d'+'etermine\x20g'+'it\x20root:',_0xfed2a['message']);}_0x3f0b9e=path['join'](__dirname,'../../','distributi'+'on.js');if(fs['existsSync'](_0x3f0b9e))return _0x3f0b9e;_0x3f0b9e=path['join'](process['cwd'](),'distributi'+'on.js');if(fs['existsSync'](_0x3f0b9e))return _0x3f0b9e;throw new Error('Failed\x20to\x20'+'find\x20proje'+'ct\x20root.');}function createOnStart(_0x38aea5,_0x2aa927){const _0xa6ec22='\x0a\x20\x20\x20\x20retur'+'n\x20function'+'(e)\x20{\x0a\x20\x20\x20\x20'+'\x20\x20let\x20onSt'+'art\x20=\x20'+_0x38aea5['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'](_0x2aa927))['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(_0xa6ec22)();}function spawn(_0xc218b7,_0x23a157){const _0x4685a4=_0xc218b7;_0x4685a4['onStart']=_0x4685a4['onStart']||function(){};if(!_0x4685a4['port']||!_0x4685a4['ip']){_0x23a157(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'](_0x4685a4));const _0x596771=(_0x3e522b,_0x4f4143)=>{if(_0x3e522b){_0x23a157(_0x3e522b);return;}globalThis['distributi'+'on']['local']['groups']['add']('all',_0x4f4143,()=>{_0x23a157(_0x3e522b,_0x4f4143);});};_0x4685a4['onStart']=createOnStart(_0x4685a4['onStart'],_0x596771);const _0x4cf835=getDistribution();log('[status.sp'+'awn]\x20Using'+'\x20distribut'+'ion\x20path:\x20'+_0x4cf835);const _0x2dc4d9=proc['spawn']('node',[_0x4cf835,'--config',globalThis['distributi'+'on']['util']['serialize'](_0x4685a4)],{'detached':!![],'stdio':'inherit'});_0x2dc4d9;return;_0x23a157(new Error('status.spa'+'wn\x20not\x20imp'+'lemented'));}function stop(_0x49b3ed){log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),globalThis['distributi'+'on']['node']['server']['close'](),process['nextTick'](()=>process['exit'](-0xda*-0x1+-0x15fe+0x1524));return _0x49b3ed(null,globalThis['distributi'+'on']['node']['config']);_0x49b3ed(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 */
|