@brown-ds/distribution 0.0.46 → 0.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/distribution/all/comm.js +1 -1
- package/distribution/all/mem.js +1 -1
- package/distribution/all/mr.js +1 -1
- package/distribution/local/comm.js +1 -1
- package/distribution/local/mem.js +1 -1
- package/distribution/local/node.js +1 -1
- package/distribution/local/routes.js +1 -1
- package/distribution/local/store.js +1 -1
- package/package.json +2 -2
package/distribution/all/comm.js
CHANGED
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
function comm(
|
|
9
|
+
function comm(_0x3ff307){const _0x27d376={};_0x27d376['gid']=_0x3ff307['gid']||'global';function _0x3a6af3(_0x2830e3,_0x55cfbd,_0xeaadfb){global['distributi'+'on']['local']['groups']['get'](_0x27d376['gid'],(_0x1ac991,_0x38d838)=>{const _0x372909=Object['keys'](_0x38d838)['length'];if(_0x372909===0x8f5*-0x2+0x1d5f+-0xb75){_0xeaadfb(new Error('No\x20nodes\x20f'+'ound'));return;}let _0xdc7351=0x29c*-0x7+-0x1082+0x22c6;const _0x1b694e={},_0x57635d={};for(const _0x395b8c of Object['keys'](_0x38d838)){const _0x931efa=_0x38d838[_0x395b8c],_0x1502ce={'node':{'ip':_0x931efa['ip'],'port':_0x931efa['port']},'service':_0x55cfbd['service'],'method':_0x55cfbd['method'],'gid':_0x55cfbd['gid']||'local'};global['distributi'+'on']['local']['comm']['send'](_0x2830e3,_0x1502ce,(_0x5e82ce,_0x24e7c4)=>{_0x5e82ce?_0x57635d[_0x395b8c]=_0x5e82ce:_0x1b694e[_0x395b8c]=_0x24e7c4,_0xdc7351+=0x1*-0xf63+0x61*-0x19+-0x43*-0x5f,_0xdc7351===_0x372909&&_0xeaadfb(_0x57635d,_0x1b694e);});}});}return{'send':_0x3a6af3};};module['exports']=comm;
|
|
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 distribution=global['distributi'+'on'],util=distribution['util'],log=require('../util/lo'+'g');function getNode(
|
|
9
|
+
const distribution=global['distributi'+'on'],util=distribution['util'],log=require('../util/lo'+'g');function getNode(_0x3ba64f,_0x2c9ee5,_0x30b3a1){typeof _0x2c9ee5==='object'&&(_0x2c9ee5=_0x2c9ee5['key']),distribution[_0x3ba64f['gid']]['status']['get']('nid',(_0x1e2529,_0x33b0f8)=>{const _0x4cf427=Object['values'](_0x33b0f8),_0x10c42a=util['id']['getID'](_0x2c9ee5),_0x2075a7=_0x3ba64f['hash'](_0x10c42a,_0x4cf427),_0x224ecf=_0x2075a7['substring'](-0x2b*-0xe6+-0x2f*0xbb+-0x44d,0x26b5+-0x1*-0xf1+-0x27a1);distribution['local']['groups']['get'](_0x3ba64f['gid'],(_0x4313d3,_0x361168)=>{const _0x4de3ae=_0x361168[_0x224ecf];log('[mem\x20(getN'+'ode)]\x20conf'+'iguration:'+'\x20'+JSON['stringify'](_0x2c9ee5)+'group:\x20'+JSON['stringify'](_0x361168)+'\x20node:\x20'+JSON['stringify'](_0x4de3ae)+'nid:\x20'+JSON['stringify'](_0x2075a7)+'\x20sid:\x20'+JSON['stringify'](_0x224ecf)),_0x30b3a1(_0x4de3ae);});});}function normalize(_0x204615,_0x39f633){const _0x3580d0={};_0x204615===null&&(_0x204615={});if(typeof _0x204615==='string')_0x3580d0['key']=_0x204615,_0x3580d0['gid']=_0x39f633,_0x3580d0['action']='put';else typeof _0x204615==='object'&&(_0x3580d0['key']=_0x204615['key'],_0x3580d0['gid']=_0x204615['gid']||_0x39f633,_0x3580d0['action']=_0x204615['action']||'put');return _0x3580d0;};function mem(_0x4da3ff){const _0x42ed82={};return _0x42ed82['gid']=_0x4da3ff['gid']||'all',_0x42ed82['hash']=_0x4da3ff['hash']||util['id']['naiveHash'],{'get':(_0x256b00,_0x32d4f9)=>{if(!_0x256b00){const _0x1f6564=[{'key':null,'gid':_0x42ed82['gid']}];distribution[_0x42ed82['gid']]['comm']['send'](_0x1f6564,{'service':'mem','method':'get'},(_0x3e5078,_0x1eb776)=>{const _0x159334=Object['values'](_0x1eb776)['reduce']((_0x33062f,_0x2b3920)=>_0x33062f['concat'](_0x2b3920),[]);_0x32d4f9(_0x3e5078,_0x159334);});return;}_0x256b00=normalize(_0x256b00,_0x42ed82['gid']),getNode(_0x42ed82,_0x256b00,_0x237fa2=>{const _0x57f5f7=[_0x256b00],_0x1c44f6={'service':'mem','method':'get','node':_0x237fa2};log('[all.mem.g'+'et]\x20config'+'uration:\x20'+JSON['stringify'](_0x256b00)+'\x20node:\x20'+JSON['stringify'](global['nodeConfig'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x237fa2)),distribution['local']['comm']['send'](_0x57f5f7,_0x1c44f6,_0x32d4f9);});},'put':(_0x113743,_0x328c86,_0x4b7004)=>{_0x328c86=_0x328c86||util['id']['getID'](_0x113743),_0x328c86=normalize(_0x328c86,_0x42ed82['gid']),getNode(_0x42ed82,_0x328c86,_0x4d9acd=>{const _0x18817a=[_0x113743,_0x328c86],_0x57ae35={'service':'mem','method':'put','node':_0x4d9acd};log('[all.mem.p'+'ut]\x20state:'+'\x20'+JSON['stringify'](_0x113743)+('configurat'+'ion:\x20')+JSON['stringify'](_0x328c86)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x4d9acd)),distribution['local']['comm']['send'](_0x18817a,_0x57ae35,_0x4b7004);});},'del':(_0xa12052,_0x2a7439)=>{getNode(_0x42ed82,_0xa12052,_0x22b652=>{const _0x327271=[{'key':_0xa12052,'gid':_0x42ed82['gid']}],_0x4838d8={'service':'mem','method':'del','node':_0x22b652};distribution['local']['comm']['send'](_0x327271,_0x4838d8,_0x2a7439);});},'reconf':(_0x25fd4d,_0x12bb17)=>{distribution[_0x42ed82['gid']]['mem']['get'](null,(_0xa873d3,_0x651583)=>{distribution[_0x42ed82['gid']]['status']['get']('nid',(_0x48643a,_0x8bd506)=>{const _0x3dc7fe=Object['values'](_0x8bd506),_0x163a21=Object['values'](_0x25fd4d)['map'](_0x5ea3e6=>util['id']['getNID'](_0x5ea3e6));log('[mem.recon'+'f\x20received'+'\x20'+_0x651583['length']+('\x20keys\x20from'+'\x20')+_0x8bd506['length']+'\x20nodes');let _0x4456b6=0x18d+-0x504+0x377;const _0x8db5eb=()=>{_0x4456b6===_0x651583['length']&&_0x12bb17();};if(_0x651583['length']===-0x2040+0x8b2+0x178e){_0x12bb17();return;}for(const _0x47fffc of _0x651583){const _0x17bfa9=util['id']['getID'](_0x47fffc),_0x101786=_0x42ed82['hash'](_0x17bfa9,_0x163a21),_0x3bc0bf=_0x42ed82['hash'](_0x17bfa9,_0x3dc7fe);log('[mem.recon'+'f]\x20old\x20nid'+':\x20'+_0x101786+'\x20new\x20nid:\x20'+_0x3bc0bf);if(_0x101786===_0x3bc0bf){_0x4456b6++,_0x8db5eb();continue;}const _0x44c3f4=_0x25fd4d[_0x101786['substring'](-0xac1+-0x7e9+0x12aa,0xee8*-0x1+0x14ee+-0x601)],_0x1b69f5=[{'key':_0x47fffc,'gid':_0x42ed82['gid']}],_0xc01f25={'service':'mem','method':'del','node':_0x44c3f4};log('[mem.recon'+'f]\x20deletin'+'g\x20key\x20'+_0x47fffc+'\x20from\x20'+JSON['stringify'](_0xc01f25)),distribution['local']['comm']['send'](_0x1b69f5,_0xc01f25,(_0x2d47fd,_0x5af87d)=>{distribution[_0x42ed82['gid']]['mem']['put'](_0x5af87d,_0x47fffc,(_0x1e9731,_0xba6e06)=>{_0x4456b6++,_0x8db5eb();});});}});});}};};module['exports']=mem;
|
|
10
10
|
/* eslint-enable */
|
package/distribution/all/mr.js
CHANGED
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
const distribution=require('../../dist'+'ribution'),id=distribution['util']['id'];function mr(
|
|
9
|
+
const distribution=require('../../dist'+'ribution'),id=distribution['util']['id'];function mr(_0x245017){const _0x4221e2={'gid':_0x245017['gid']||'global'};function _0x3b541e(_0x278b20,_0x16df72){const _0x5aece6=id['getSID'](_0x278b20),_0xca6e4f={'mapper':_0x278b20['map'],'reducer':_0x278b20['reduce'],'map':function(_0x4d9914,_0x157672,_0x2a0cf2,_0x42c0f2){if(_0x4d9914['length']==-0x9*0x20d+0x1be5+-0x970*0x1)_0x42c0f2(null,{});else{const _0x5f084c=[];let _0x373feb=-0x1cb5+0x51c*0x2+0x1*0x127d;_0x4d9914['forEach'](_0x2d0951=>{distribution[_0x157672]['store']['get'](_0x2d0951,(_0x4a1db7,_0x4efd72)=>{_0x373feb++;const _0x37c698=this['mapper'](_0x2d0951,_0x4efd72);Array['isArray'](_0x37c698)?_0x5f084c['push'](..._0x37c698):_0x5f084c['push'](_0x37c698),_0x373feb==_0x4d9914['length']&&distribution['local']['store']['put'](_0x5f084c,_0x2a0cf2+'_map',(_0x2aff0e,_0x618408)=>{_0x42c0f2(_0x2aff0e,_0x5f084c);});});});}},'shuffle':function(_0x5cf805,_0x23c4b8,_0x356977){distribution['local']['store']['get'](_0x23c4b8+'_map',(_0x12610b,_0x1cd31f)=>{if(!_0x12610b){let _0x5dbb74=-0x78a+0x13da+-0xc50;_0x1cd31f['forEach'](_0x4339de=>{const [_0x276299]=Object['keys'](_0x4339de);distribution[_0x5cf805]['mem']['put'](_0x4339de[_0x276299],{'key':_0x276299,'action':'append'},(_0x4b06b9,_0x502649)=>{_0x5dbb74++,_0x5dbb74==_0x1cd31f['length']&&_0x356977(null,_0x1cd31f);});});}else _0x356977(_0x12610b,{});});},'reduce':function(_0x4389bd,_0x3a0726,_0x105978){distribution['local']['mem']['get']({'key':null,'gid':_0x4389bd},(_0x18a902,_0x2721c8)=>{let _0x266ba4=[],_0xefbd34=0xd3d*0x1+-0x14d+-0xbf0;_0x2721c8['length']==-0xcde+0x182d*0x1+-0xb4f&&_0x105978(null,null),_0x2721c8['forEach'](_0x582bcd=>distribution['local']['mem']['get']({'key':_0x582bcd,'gid':_0x4389bd},(_0x1c1dc3,_0x53c232)=>{const _0x3956b4=this['reducer'](_0x582bcd,_0x53c232);_0x266ba4=_0x266ba4['concat'](_0x3956b4),_0xefbd34++,_0xefbd34==_0x2721c8['length']&&_0x105978(null,_0x266ba4);}));});}},_0x20af29=function(_0x5636e8,_0x44af7c){const _0x2b624a={};return Object['keys'](_0x44af7c)['forEach'](_0x4aba1d=>{_0x2b624a[_0x4aba1d]=[];}),_0x5636e8['forEach'](_0x331451=>{const _0x48021b=id['getID'](_0x331451),_0x28c562=id['naiveHash'](_0x48021b,Object['keys'](_0x44af7c));_0x2b624a[_0x28c562]['push'](_0x331451);}),_0x2b624a;};distribution[_0x4221e2['gid']]['routes']['put'](_0xca6e4f,'mr-'+_0x5aece6,(_0x2556fa,_0x21e5fb)=>{distribution['local']['groups']['get'](_0x4221e2['gid'],(_0x46da67,_0x1c3649)=>{const _0x2160d4=_0x20af29(_0x278b20['keys'],_0x1c3649);let _0x59ad89=0x1*-0x4a7+-0x2130+0xc9d*0x3;const _0x4c34f3=Object['keys'](_0x1c3649)['length'],_0x1f72c4={'service':'mr-'+_0x5aece6,'method':'map'};for(const _0x54d376 in _0x1c3649){_0x1f72c4['node']=_0x1c3649[_0x54d376];const _0x465ec9=[_0x2160d4[_0x54d376],_0x4221e2['gid'],_0x5aece6];distribution['local']['comm']['send'](_0x465ec9,_0x1f72c4,(_0x27f5f2,_0x427568)=>{++_0x59ad89;if(_0x59ad89==_0x4c34f3){const _0x58cdd5={'service':'mr-'+_0x5aece6,'method':'shuffle'};distribution[_0x4221e2['gid']]['comm']['send']([_0x4221e2['gid'],_0x5aece6],_0x58cdd5,(_0x797bb2,_0x28587c)=>{const _0x304270={'service':'mr-'+_0x5aece6,'method':'reduce'};distribution[_0x4221e2['gid']]['comm']['send']([_0x4221e2['gid'],_0x5aece6],_0x304270,(_0x5a9688,_0x12861c)=>{let _0x4420a0=[];for(const _0x390fe8 of Object['values'](_0x12861c)){_0x390fe8!==null&&(_0x4420a0=_0x4420a0['concat'](_0x390fe8));}_0x16df72(null,_0x4420a0);return;distribution[_0x4221e2['gid']]['routes']['rem']('mr-'+_0x5aece6,(_0x14297a,_0xc71d57)=>{});});});}});}});});}return{'exec':_0x3b541e};};module['exports']=mr;
|
|
10
10
|
/* eslint-enable */
|
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
const http=require('http'),serialization=require('../util/se'+'rializatio'+'n'),log=require('../util/lo'+'g');function send(
|
|
9
|
+
const http=require('http'),serialization=require('../util/se'+'rializatio'+'n'),log=require('../util/lo'+'g');function send(_0x300bcb,_0x3023ca,_0x34e3b3){log('[comm.send'+']:\x20Sending'+'\x20'+JSON['stringify'](_0x300bcb)+'to\x20'+_0x3023ca['service']+':'+_0x3023ca['method']+'\x20on\x20'+_0x3023ca['node']['ip']+':'+_0x3023ca['node']['port']);if(!_0x300bcb instanceof Array)throw new Error('Message\x20mu'+'st\x20be\x20an\x20a'+'rray');const _0x35595c=_0x3023ca['node'],_0x184741=_0x3023ca['service'],_0x4a4e97=_0x3023ca['method'],_0x4e0578=_0x3023ca['gid']||'local',_0x5cfefb=serialization['serialize'](_0x300bcb),_0x20ba86={'hostname':_0x35595c['ip'],'port':_0x35595c['port'],'path':'/'+_0x4e0578+'/'+_0x184741+'/'+_0x4a4e97,'method':'PUT','headers':{'Content-Type':'applicatio'+'n/json','Content-Length':Buffer['byteLength'](_0x5cfefb)}},_0x4aedd9=http['request'](_0x20ba86,_0x42eaf5=>{let _0x367027='';_0x42eaf5['on']('data',function(_0x5ca18f){_0x367027+=_0x5ca18f;}),_0x42eaf5['on']('end',function(){_0x34e3b3&&_0x34e3b3(...serialization['deserializ'+'e'](_0x367027));}),_0x42eaf5['on']('error',function(_0x190227){_0x34e3b3&&_0x34e3b3(new Error('Error\x20on\x20r'+'esponse'));});});_0x4aedd9['on']('error',function(_0x33f3a1){_0x34e3b3&&_0x34e3b3(new Error(_0x33f3a1));}),_0x4aedd9['write'](_0x5cfefb),_0x4aedd9['end']();}module['exports']={'send':send};
|
|
10
10
|
/* eslint-enable */
|
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
const id=require('../util/id'),log=require('../util/lo'+'g'),kvStore={'store':new Map(),'get'(
|
|
9
|
+
const id=require('../util/id'),log=require('../util/lo'+'g'),kvStore={'store':new Map(),'get'(_0x26585a){if(!this['store'][_0x26585a['gid']])return undefined;return this['store'][_0x26585a['gid']][_0x26585a['key']];},'put'(_0xe29537,_0x43c1f7){!this['store'][_0xe29537['gid']]&&(this['store'][_0xe29537['gid']]=new Map()),this['store'][_0xe29537['gid']][_0xe29537['key']]=_0x43c1f7;},'append'(_0x16d74a,_0x18f333){!this['get'](_0x16d74a)&&this['put'](_0x16d74a,[]),!Array['isArray'](this['get'](_0x16d74a))&&this['put'](_0x16d74a,[this['get'](_0x16d74a)]),Array['isArray'](_0x18f333)?this['put'](_0x16d74a,this['get'](_0x16d74a)['concat'](_0x18f333)):this['store'][_0x16d74a['gid']][_0x16d74a['key']]['push'](_0x18f333);},'del'(_0x588206){if(!this['store'][_0x588206['gid']])return undefined;const _0x1c68b0=this['store'][_0x588206['gid']][_0x588206['key']];return delete this['store'][_0x588206['gid']][_0x588206['key']],_0x1c68b0;},'toString'(){let _0x5b2567='';for(const _0x2347a3 in this['store']){_0x5b2567+=_0x2347a3+':\x20'+JSON['stringify'](this['store'][_0x2347a3]);}return _0x5b2567;}};function normalize(_0x60e5f6){const _0x1ac61a={};_0x60e5f6===null&&(_0x60e5f6={});if(typeof _0x60e5f6==='string')_0x1ac61a['key']=_0x60e5f6,_0x1ac61a['gid']='local',_0x1ac61a['action']='put';else typeof _0x60e5f6==='object'&&(_0x1ac61a['key']=_0x60e5f6['key'],_0x1ac61a['gid']=_0x60e5f6['gid'],_0x1ac61a['action']=_0x60e5f6['action']);return _0x1ac61a;};function put(_0x40b1c3,_0x400283,_0x3d8828){log('[mem.put]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x400283)+'state:\x20'+JSON['stringify'](_0x40b1c3)+'\x20store:\x20'+kvStore['toString']()),_0x3d8828=_0x3d8828||function(){},_0x400283=normalize(_0x400283),_0x400283['key']=_0x400283['key']||id['getID'](_0x40b1c3),_0x400283['gid']=_0x400283['gid']||'local',_0x400283['action']=_0x400283['action']||'put',kvStore[_0x400283['action']](_0x400283,_0x40b1c3),log('[mem.put]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']()),_0x3d8828&&_0x3d8828(null,_0x40b1c3);};function get(_0x10d1ff,_0x201974){log('[mem.get]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x10d1ff)+'\x20store:\x20'+kvStore['toString']()),_0x201974=_0x201974||function(){},_0x10d1ff=normalize(_0x10d1ff),_0x10d1ff['gid']=_0x10d1ff['gid']||'local';if(!_0x10d1ff['key']){let _0x4e192e=kvStore['store'][_0x10d1ff['gid']]||{};_0x4e192e=Object['keys'](_0x4e192e),_0x201974(null,_0x4e192e);return;}const _0x360c2e=kvStore['get'](_0x10d1ff);_0x360c2e?_0x201974(null,_0x360c2e):_0x201974(new Error('Memory\x20key'+'\x20\x22'+_0x10d1ff['key']+('\x22\x20\x0a\x20\x20\x20\x20\x20\x20\x20'+'\x20not\x20found'+'\x20for\x20')+_0x10d1ff['gid']+'\x27s\x20store'));}function del(_0x53b5c6,_0x214f32){log('[mem.del]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x53b5c6)+'\x20store:\x20'+kvStore['toString']()),_0x214f32=_0x214f32||function(){},_0x53b5c6=normalize(_0x53b5c6);const _0x27a824=kvStore['del'](_0x53b5c6);log('[mem.del]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']()),_0x27a824?_0x214f32(null,_0x27a824):_0x214f32(new Error('Memory\x20key'+'\x20\x22'+_0x53b5c6['key']+('\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+'not\x20found\x20'+'for\x20')+_0x53b5c6['gid']+'\x27s\x20store'));};module['exports']={'put':put,'get':get,'del':del};
|
|
10
10
|
/* eslint-enable */
|
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
const http=require('http'),url=require('url'),log=require('../util/lo'+'g'),serialization=require('../util/se'+'rializatio'+'n');function isValidBody(
|
|
9
|
+
const http=require('http'),url=require('url'),log=require('../util/lo'+'g'),serialization=require('../util/se'+'rializatio'+'n');function isValidBody(_0x377981){if(_0x377981['length']===-0x1814+-0x1cf9*0x1+0x350d)return new Error('No\x20body');try{_0x377981=JSON['parse'](_0x377981);}catch(_0x185f27){return _0x185f27;}return undefined;}function endRequest(_0x540e16,_0x3d1ccb){_0x540e16['end'](serialization['serialize']([_0x3d1ccb]));}const start=function(_0x966886){const _0x3a6518=http['createServ'+'er']((_0x81d7f9,_0x24b09d)=>{if(_0x81d7f9['method']!=='PUT'){_0x24b09d['end'](serialization['serialize'](new Error('Method\x20not'+'\x20allowed!')));return;}const _0x25b575=url['parse'](_0x81d7f9['url'])['pathname'],[,_0x10d46f,_0x549703,_0x7b93c4]=_0x25b575['split']('/');log('[server]\x20g'+'ot\x20request'+'\x20'+_0x10d46f+'\x20'+_0x549703+':'+_0x7b93c4+'\x20from\x20'+_0x81d7f9['connection']['remoteAddr'+'ess']);let _0x5b05d9=[];_0x81d7f9['on']('data',_0x259bfc=>{_0x5b05d9['push'](_0x259bfc);}),_0x81d7f9['on']('end',()=>{_0x5b05d9=Buffer['concat'](_0x5b05d9)['toString']();let _0x3c4071;if(_0x3c4071=isValidBody(_0x5b05d9)){endRequest(_0x24b09d,_0x3c4071);return;}_0x5b05d9=JSON['parse'](_0x5b05d9),_0x5b05d9=serialization['deserializ'+'e'](_0x5b05d9);const _0xeab15c=_0x5b05d9;!Array['isArray'](_0xeab15c)&&endRequest(_0x24b09d,new Error('Invalid\x20ar'+'gument\x20typ'+'e,\x20expecte'+'d\x20array,\x20g'+'ot\x20'+typeof _0xeab15c));const _0x336473=_0x549703;global['distributi'+'on']['local']['routes']['get']({'service':_0x549703,'gid':_0x10d46f},(_0x53dc03,_0x1c3871)=>{const _0x9e7383=(_0x365a8e,_0x1d3e09)=>{_0x24b09d['end'](serialization['serialize']([_0x365a8e,_0x1d3e09]));};if(_0x53dc03){_0x9e7383(_0x53dc03);return;}if(!_0x1c3871[_0x7b93c4]){_0x9e7383(new Error('Method\x20'+_0x7b93c4+('\x20not\x20found'+'\x20in\x20servic'+'e\x20')+_0x336473));return;}log('[server]\x20\x20'+'Calling\x20se'+'rvice:\x20'+_0x336473+':'+_0x7b93c4+('\x20with\x20args'+':\x20')+JSON['stringify'](_0xeab15c));_0xeab15c['length']===-0x1ecd+-0x33*0x95+0x3c7d&&_0x1c3871[_0x7b93c4]['length']===0x43f*0x1+-0x9*0x24+-0x28*0x13&&_0xeab15c['push'](undefined);try{_0x1c3871[_0x7b93c4](..._0xeab15c,_0x9e7383);}catch(_0xebf001){_0x9e7383(_0xebf001);}});});});_0x3a6518['listen'](global['nodeConfig']['port'],global['nodeConfig']['ip'],()=>{log('Server\x20run'+'ning\x20at\x20ht'+'tp://'+global['nodeConfig']['ip']+':'+global['nodeConfig']['port']+'/'),global['distributi'+'on']['node']['server']=_0x3a6518,_0x966886(_0x3a6518);}),_0x3a6518['on']('error',_0x51f1ef=>{log('Server\x20err'+'or:\x20'+_0x51f1ef);throw _0x51f1ef;});};module['exports']={'start':start};
|
|
10
10
|
/* eslint-enable */
|
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
const log=require('../util/lo'+'g'),routesStore=new Map();function get(
|
|
9
|
+
const log=require('../util/lo'+'g'),routesStore=new Map();function get(_0xd7907f,_0xed0098){log('[routes.ge'+'t]\x20Getting'+'\x20service:\x20'+JSON['stringify'](_0xd7907f));if(!_0xed0098)return;typeof _0xd7907f==='string'&&(_0xd7907f={'service':_0xd7907f});const _0x3ba868=_0xd7907f['service'],_0x5195df=_0xd7907f['gid'];if(_0x5195df&&_0x5195df!=='local')log('[routes.ge'+'t]\x20Found\x20d'+'istributed'+'\x20service:\x20'+_0x3ba868),_0xed0098(null,global['distributi'+'on'][_0x5195df][_0x3ba868]);else{if(_0x3ba868 in routesStore)log('[routes.ge'+'t]\x20Found\x20l'+'ocal\x20servi'+'ce:\x20'+_0x3ba868),_0xed0098(null,routesStore[_0x3ba868]);else{const _0x32adc9=global['toLocal']['get'](_0x3ba868);_0x32adc9?(log('[routes.ge'+'t]\x20Found\x20R'+'PC:\x20'+_0x3ba868),_0xed0098(null,{'call':_0x32adc9})):_0xed0098(new Error('Service\x20'+_0x3ba868+('\x20not\x20found'+'\x20in\x20routes')));}}}function put(_0x1f51cd,_0x4a907d,_0x41a465){log('[routes.pu'+'t]\x20Putting'+'\x20service:\x20'+_0x4a907d+'\x20'+JSON['stringify'](_0x1f51cd)),routesStore[_0x4a907d]=_0x1f51cd;_0x41a465&&_0x41a465(null,_0x4a907d);;}function rem(_0x451b3f,_0x3f58ab){const _0x5b8abb=routesStore[_0x451b3f];delete routesStore[_0x451b3f],_0x3f58ab(null,_0x5b8abb);};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 fs=require('fs'),path=require('path'),id=require('../util/id'),serialization=require('../util/se'+'rializatio'+'n'),log=require('../util/lo'+'g'),baseFolder=path['join'](__dirname,'../../stor'+'e');!fs['existsSync'](baseFolder)&&fs['mkdirSync'](baseFolder);!fs['existsSync'](baseFolder+'/s-'+global['moreStatus']['sid'])&&fs['mkdirSync'](baseFolder+'/s-'+global['moreStatus']['sid']);function normalize(
|
|
9
|
+
const fs=require('fs'),path=require('path'),id=require('../util/id'),serialization=require('../util/se'+'rializatio'+'n'),log=require('../util/lo'+'g'),baseFolder=path['join'](__dirname,'../../stor'+'e');!fs['existsSync'](baseFolder)&&fs['mkdirSync'](baseFolder);!fs['existsSync'](baseFolder+'/s-'+global['moreStatus']['sid'])&&fs['mkdirSync'](baseFolder+'/s-'+global['moreStatus']['sid']);function normalize(_0x118f7e){const _0x3fd6db={};_0x118f7e===null&&(_0x118f7e={});if(typeof _0x118f7e==='string')_0x3fd6db['key']=_0x118f7e,_0x3fd6db['gid']='local';else typeof _0x118f7e==='object'&&(_0x3fd6db['key']=_0x118f7e['key'],_0x3fd6db['gid']=_0x118f7e['gid']);return _0x3fd6db;};function put(_0x36bd7c,_0x219bb1,_0x4cfea1){_0x4cfea1=_0x4cfea1||function(){},_0x219bb1=normalize(_0x219bb1),_0x219bb1['key']=_0x219bb1['key']||id['getID'](_0x36bd7c),_0x219bb1['gid']=_0x219bb1['gid']||'local';const _0x40a15f=serialization['serialize'](_0x36bd7c);let _0xb22032=Buffer['from'](_0x219bb1['key'])['toString']('base64');_0xb22032=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x219bb1['gid']+'-'+_0xb22032,log('[store.put'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x219bb1)+'\x20state:\x20'+JSON['stringify'](_0x36bd7c)+('\x20filename:'+'\x20')+_0xb22032),fs['writeFile'](_0xb22032,_0x40a15f,_0x3bcd97=>{_0x3bcd97?_0x4cfea1(_0x3bcd97):_0x4cfea1(null,_0x36bd7c);});}function get(_0x13325a,_0x1dabf5){_0x1dabf5=_0x1dabf5||function(){},_0x13325a=normalize(_0x13325a),_0x13325a['gid']=_0x13325a['gid']||'local';if(!_0x13325a['key']){fs['readdir'](baseFolder+'/s-'+global['moreStatus']['sid'],(_0x25bc24,_0x146254)=>{if(_0x25bc24)_0x1dabf5(_0x25bc24);else{const _0x5bb71e=[];for(let _0x2a63fe=0x351+0x112c+-0x147d;_0x2a63fe<_0x146254['length'];_0x2a63fe++){let _0x4dfc03=_0x146254[_0x2a63fe]['split']('-');const _0x286ecc=_0x4dfc03[0x1*-0x18f4+-0xf55+0x2849];if(_0x286ecc!==_0x13325a['gid'])continue;_0x4dfc03=_0x4dfc03[_0x4dfc03['length']-(0x76b*0x3+-0x8*-0x371+-0x31c8)],_0x5bb71e['push'](Buffer['from'](_0x4dfc03,'base64')['toString']());}_0x1dabf5(null,_0x5bb71e);}});return;}let _0x3fc3f0=Buffer['from'](_0x13325a['key'])['toString']('base64');_0x3fc3f0=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x13325a['gid']+'-'+_0x3fc3f0,log('[store.get'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x13325a)+('\x20filename:'+'\x20')+_0x3fc3f0),fs['readFile'](_0x3fc3f0,(_0xf9236e,_0x53a4f4)=>{_0xf9236e?_0xf9236e['code']==='ENOENT'?_0x1dabf5(new Error('File\x20'+_0x3fc3f0+('\x20(from\x20key'+'\x20\x27')+_0x13325a['key']+('\x27)\x20not\x20fou'+'nd\x20for\x20gro'+'up\x20')+_0x13325a['gid'])):_0x1dabf5(_0xf9236e):_0x1dabf5(null,serialization['deserializ'+'e'](_0x53a4f4['toString']()));});}function del(_0x337936,_0x19b174){_0x19b174=_0x19b174||function(){},_0x337936=normalize(_0x337936);let _0x8e6929=Buffer['from'](_0x337936['key'])['toString']('base64');_0x8e6929=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x337936['gid']+'-'+_0x8e6929,get(_0x337936,(_0x5986f4,_0x4aa473)=>{if(_0x5986f4){_0x19b174(_0x5986f4);return;}fs['rm'](_0x8e6929,_0x543c5a=>{_0x543c5a?_0x19b174(_0x543c5a):_0x19b174(null,_0x4aa473);});});}module['exports']={'put':put,'get':get,'del':del};
|
|
10
10
|
/* eslint-enable */
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brown-ds/distribution",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.48",
|
|
4
4
|
"description": "A library for building distributed systems.",
|
|
5
5
|
"main": "distribution.js",
|
|
6
|
-
"useLibrary":
|
|
6
|
+
"useLibrary": true,
|
|
7
7
|
"directories": {
|
|
8
8
|
"test": "test"
|
|
9
9
|
},
|