@brown-ds/distribution 0.2.27 → 0.2.28
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/all.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 comm=require('./comm.js'),groups=require('./groups.j'+'s'),routes=require('./routes.j'+'s'),status=require('./status.j'+'s'),gossip=require('./gossip.j'+'s'),mem=require('./mem.js'),store=require('./store.js'),mr=require('./mr.js');function setup(
|
|
9
|
+
const comm=require('./comm.js'),groups=require('./groups.j'+'s'),routes=require('./routes.j'+'s'),status=require('./status.j'+'s'),gossip=require('./gossip.j'+'s'),mem=require('./mem.js'),store=require('./store.js'),mr=require('./mr.js');function setup(_0x1bc56e){return{'comm':comm(_0x1bc56e),'groups':groups(_0x1bc56e),'status':status(_0x1bc56e),'routes':routes(_0x1bc56e),'gossip':gossip(_0x1bc56e),'mem':mem(_0x1bc56e),'store':store(_0x1bc56e),'mr':mr(_0x1bc56e)};}module['exports']={'comm':comm,'groups':groups,'status':status,'routes':routes,'gossip':gossip,'mem':mem,'store':store,'mr':mr,'setup':setup};
|
|
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(_0x4437e9,_0xbe3374){if(_0x4437e9===null)return{'key':null,'gid':_0xbe3374};else return typeof _0x4437e9==='string'?{'key':_0x4437e9,'gid':_0xbe3374}:_0x4437e9;}function mem(_0x52687e){const _0x451d69={};_0x451d69['gid']=_0x52687e['gid']||'all',_0x451d69['hash']=_0x52687e['hash']||globalThis['distributi'+'on']['util']['id']['naiveHash'];function _0x5b5454(_0xb99429,_0x18cb45){log('[all.mem.g'+'et]\x20config'+'uration:\x20'+JSON['stringify'](_0xb99429)+'\x20context:\x20'+JSON['stringify'](_0x451d69)),_0xb99429=normalize(_0xb99429,_0x451d69['gid']),_0xb99429['gid']=_0xb99429['gid']||_0x451d69['gid'];const _0x7fc148={'service':'mem','method':'get'},_0x10e64b=[_0xb99429];if(!_0xb99429['key']){globalThis['distributi'+'on'][_0x451d69['gid']]['comm']['send'](_0x10e64b,_0x7fc148,(_0x43c4af,_0xbed7d5)=>{const _0x20fbad=Object['values'](_0xbed7d5)['reduce']((_0x83f404,_0x2120d3)=>_0x83f404['concat'](_0x2120d3),[]);_0x18cb45(_0x43c4af,_0x20fbad);});return;}const _0x5e1aa3=_0xb99429['key'];if(_0x5e1aa3===null){_0x18cb45(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x10e64b,_0x7fc148,{'key':_0x5e1aa3},_0x451d69,_0x18cb45);return;return _0x18cb45(new Error('mem.get\x20no'+'t\x20implemen'+'ted'));}function _0x14080e(_0x3382b3,_0x937af6,_0x178af1){log('[all.mem.p'+'ut]\x20state:'+'\x20'+JSON['stringify'](_0x3382b3)+('\x20configura'+'tion:\x20')+JSON['stringify'](_0x937af6)),_0x937af6=_0x937af6||globalThis['distributi'+'on']['util']['id']['getID'](_0x3382b3),_0x937af6=normalize(_0x937af6,_0x451d69['gid']),_0x937af6['gid']=_0x937af6['gid']||_0x451d69['gid'];const _0x5ae404={'service':'mem','method':'put'},_0x3f59e9=[_0x3382b3,_0x937af6],_0x4be0df=_0x937af6['key'];if(_0x4be0df===null){_0x178af1(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x3f59e9,_0x5ae404,{'key':_0x4be0df},_0x451d69,_0x178af1);return;return _0x178af1(new Error('mem.put\x20no'+'t\x20implemen'+'ted'));}function _0x2dfccf(_0x5b6216,_0x398340,_0x1092a7){log('[all.mem.a'+'ppend]\x20sta'+'te:\x20'+JSON['stringify'](_0x5b6216)+('\x20configura'+'tion:\x20')+JSON['stringify'](_0x398340)),_0x398340=_0x398340||globalThis['distributi'+'on']['util']['id']['getID'](_0x5b6216),_0x398340=normalize(_0x398340,_0x451d69['gid']),_0x398340['gid']=_0x398340['gid']||_0x451d69['gid'];const _0x528fd8={'service':'mem','method':'append'},_0x1eb260=[_0x5b6216,_0x398340],_0x26a85c=_0x398340['key'];if(_0x26a85c===null){_0x1092a7(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x1eb260,_0x528fd8,{'key':_0x26a85c},_0x451d69,_0x1092a7);return;return _0x1092a7(new Error('mem.append'+'\x20not\x20imple'+'mented'));}function _0x4cb9a3(_0x2b6242,_0x107b2e){log('[all.mem.d'+'el]\x20config'+'uration:\x20'+JSON['stringify'](_0x2b6242)),_0x2b6242=normalize(_0x2b6242,_0x451d69['gid']),_0x2b6242['gid']=_0x2b6242['gid']||_0x451d69['gid'];const _0x227384={'service':'mem','method':'del'},_0x230988=[_0x2b6242],_0x24b2b4=_0x2b6242['key'];if(_0x24b2b4===null){_0x107b2e(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x230988,_0x227384,{'key':_0x24b2b4},_0x451d69,_0x107b2e);return;return _0x107b2e(new Error('mem.del\x20no'+'t\x20implemen'+'ted'));}function _0x34bd46(_0x291023,_0x495c7b){log('[mem.recon'+'f]\x20configu'+'ration:\x20'+JSON['stringify'](_0x291023)+'\x20gid:\x20'+_0x451d69['gid']),globalThis['distributi'+'on']['local']['groups']['get'](_0x451d69['gid'],(_0x5bc13b,_0x3b1ade)=>{if(!_0x3b1ade){_0x495c7b(_0x5bc13b);return;}globalThis['distributi'+'on']['local']['groups']['put'](_0x451d69['gid'],_0x291023,(_0x1ccccf,_0x1bf0de)=>{globalThis['distributi'+'on'][_0x451d69['gid']]['mem']['get'](null,(_0x3b289c,_0x577a6b)=>{globalThis['distributi'+'on']['local']['groups']['put'](_0x451d69['gid'],_0x3b1ade,(_0x55c74f,_0x288c6e)=>{globalThis['distributi'+'on'][_0x451d69['gid']]['status']['get']('nid',(_0xdebfc,_0x327a63)=>{const _0xaa8d4a=Object['values'](_0x327a63),_0x21d5a4=Object['values'](_0x291023)['map'](_0xc7ae0e=>globalThis['distributi'+'on']['util']['id']['getNID'](_0xc7ae0e));log('[mem.recon'+'f\x20received'+'\x20'+_0x577a6b['length']+('\x20keys\x20from'+'\x20')+_0x327a63['length']+'\x20nodes');let _0x2e3f74=0x937+0x1f43+0x3ae*-0xb;const _0x32c236=()=>{if(_0x2e3f74===_0x577a6b['length'])return _0x495c7b(null);};if(_0x577a6b['length']===-0x2*0x521+-0x1*-0x1053+-0x611*0x1)return _0x495c7b(null);for(const _0xe0a89e of _0x577a6b){const _0x1c9b60=globalThis['distributi'+'on']['util']['id']['getID'](_0xe0a89e),_0x3f565a=_0x451d69['hash'](_0x1c9b60,_0x21d5a4),_0x499c3d=_0x451d69['hash'](_0x1c9b60,_0xaa8d4a);log('[mem.recon'+'f]\x20old\x20nid'+':\x20'+_0x3f565a+'\x20new\x20nid:\x20'+_0x499c3d);if(_0x3f565a===_0x499c3d){_0x2e3f74++,_0x32c236();continue;}const _0x3c052e=_0x291023[_0x3f565a['substring'](-0x7d1+0x1a56+0x1af*-0xb,-0x16cd+0xdf*0x11+-0x1*-0x803)],_0x37fe40=[{'key':_0xe0a89e,'gid':_0x451d69['gid']}],_0xa73bb4={'service':'mem','method':'del','node':_0x3c052e};log('[mem.recon'+'f]\x20deletin'+'g\x20key\x20'+_0xe0a89e+'\x20from\x20'+JSON['stringify'](_0xa73bb4)),globalThis['distributi'+'on']['local']['comm']['send'](_0x37fe40,_0xa73bb4,(_0x35e9a5,_0x7d0985)=>{globalThis['distributi'+'on'][_0x451d69['gid']]['mem']['put'](_0x7d0985,_0xe0a89e,(_0x218854,_0x2cf82d)=>{_0x2e3f74++,_0x32c236();});});}});});});});});return;return _0x495c7b(new Error('mem.reconf'+'\x20not\x20imple'+'mented'));}return{'get':_0x5b5454,'put':_0x14080e,'append':_0x2dfccf,'del':_0x4cb9a3,'reconf':_0x34bd46};}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(_0x25f9a5){const _0x16c53a={'gid':_0x25f9a5['gid']||'all'};function _0x160adf(_0x406070,_0x56170f){const _0x41d2b4=id['getID'](_0x406070),_0x29e82b={'mapper':_0x406070['map'],'reducer':_0x406070['reduce'],'map':function(_0xa5e15,_0x55a414,_0x5e9259,_0x192a26){if(_0xa5e15['length']==0x1ad3+-0x7be*0x5+0x1*0xbe3){_0x192a26(null,[]);return;}else{const _0x1abc44=[];let _0x1f1cc2=-0x5f1*-0x2+-0x1ad1+-0x1*-0xeef;_0xa5e15['forEach'](_0x5d84dc=>{globalThis['distributi'+'on'][_0x55a414]['store']['get'](_0x5d84dc,(_0x28e361,_0x543a91)=>{_0x1f1cc2++;const _0x55496c=this['mapper'](_0x5d84dc,_0x543a91);Array['isArray'](_0x55496c)?_0x1abc44['push'](..._0x55496c):_0x1abc44['push'](_0x55496c),_0x1f1cc2==_0xa5e15['length']&&distribution['local']['store']['put'](_0x1abc44,_0x5e9259+'_map',(_0x2e88ed,_0x8e9330)=>{_0x192a26(_0x2e88ed,_0x1abc44);});});});}},'shuffle':function(_0x1de969,_0x349f69,_0x461db2){distribution['local']['store']['get'](_0x349f69+'_map',(_0x4ec934,_0x2cf67a)=>{if(!_0x4ec934){let _0x3aa135=-0x2f3+0x2*0xb7b+0x2f*-0x6d;_0x2cf67a['forEach'](_0x17eb95=>{const [_0x2fbf2d]=Object['keys'](_0x17eb95);distribution[_0x1de969]['mem']['append'](_0x17eb95[_0x2fbf2d],{'key':_0x2fbf2d,'gid':_0x1de969},(_0x35805e,_0x1f9694)=>{_0x3aa135++;if(_0x3aa135==_0x2cf67a['length'])return _0x461db2(null,_0x2cf67a);});});}else return _0x461db2(_0x4ec934,{});});},'reduce':function(_0x59eda8,_0x554392,_0x3f0bb0){distribution['local']['mem']['get']({'key':null,'gid':_0x59eda8},(_0x19667b,_0x352208)=>{let _0x6b156=[],_0x2d10ff=0xc23+-0x1d9f*-0x1+0x29c2*-0x1;if(_0x352208['length']==0x1e5c+0x9*0x3fd+-0x1*0x4241)return _0x3f0bb0(null,null);_0x352208['forEach'](_0x7e2960=>distribution['local']['mem']['get']({'key':_0x7e2960,'gid':_0x59eda8},(_0x2eb699,_0x377d78)=>{const _0x558c4e=this['reducer'](_0x7e2960,_0x377d78);_0x6b156=_0x6b156['concat'](_0x558c4e),_0x2d10ff++;if(_0x2d10ff==_0x352208['length'])return _0x3f0bb0(null,_0x6b156);}));});}},_0x15b668=function(_0x5ece1b,_0x215632){const _0x189e93={};return Object['keys'](_0x215632)['forEach'](_0x483faf=>{_0x189e93[_0x483faf]=[];}),_0x5ece1b['forEach'](_0x562a17=>{const _0xe0f709=id['getID'](_0x562a17),_0x3530a4=id['naiveHash'](_0xe0f709,Object['keys'](_0x215632));_0x189e93[_0x3530a4]['push'](_0x562a17);}),_0x189e93;};distribution[_0x16c53a['gid']]['routes']['put'](_0x29e82b,'mr-'+_0x41d2b4,(_0x36c17a,_0x4f3a40)=>{distribution['local']['groups']['get'](_0x16c53a['gid'],(_0x36e667,_0x2bfc9d)=>{if(!_0x2bfc9d){_0x56170f(_0x36e667);return;}const _0x34d3af=_0x15b668(_0x406070['keys'],_0x2bfc9d);let _0x2878b9=0xdc2+-0x2d9+0xae9*-0x1;const _0x26c7e0=Object['keys'](_0x2bfc9d)['length'],_0x4c77b8={'service':'mr-'+_0x41d2b4,'method':'map'};for(const _0x3b82fb in _0x2bfc9d){const _0x13d664=[_0x34d3af[_0x3b82fb],_0x16c53a['gid'],_0x41d2b4];distribution['local']['comm']['send'](_0x13d664,{'node':_0x2bfc9d[_0x3b82fb],..._0x4c77b8},(_0x43bdb0,_0x277934)=>{++_0x2878b9;if(_0x2878b9==_0x26c7e0){const _0x290af0={'service':'mr-'+_0x41d2b4,'method':'shuffle'};distribution[_0x16c53a['gid']]['comm']['send']([_0x16c53a['gid'],_0x41d2b4],_0x290af0,(_0x2624f3,_0x3c7ed1)=>{const _0x51f770={'service':'mr-'+_0x41d2b4,'method':'reduce'};distribution[_0x16c53a['gid']]['comm']['send']([_0x16c53a['gid'],_0x41d2b4],_0x51f770,(_0x5404f6,_0x51c8fe)=>{let _0x5eacea=[];for(const _0x12fca4 of Object['values'](_0x51c8fe)){_0x12fca4!==null&&(_0x5eacea=_0x5eacea['concat'](_0x12fca4));}_0x56170f(null,_0x5eacea);return;});});}});}});});return;return _0x56170f(new Error('mr.exec\x20no'+'t\x20implemen'+'ted'));}return{'exec':_0x160adf};}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 log=require('../util/lo'+'g.js');function getNode(
|
|
9
|
+
const log=require('../util/lo'+'g.js');function getNode(_0x4e8249,_0x45a5d3,_0x412239){const _0x58b897=_0x45a5d3&&typeof _0x45a5d3==='object'?_0x45a5d3['key']:_0x45a5d3;globalThis['distributi'+'on'][_0x4e8249['gid']]['status']['get']('nid',(_0x4699fc,_0x8c6c0e)=>{const _0x39f54a=Object['values'](_0x8c6c0e),_0x55cee8=globalThis['distributi'+'on']['util']['id']['getID'](_0x58b897),_0x3497f6=_0x4e8249['hash'](_0x55cee8,_0x39f54a),_0x15216c=_0x3497f6['substring'](-0x2e*0xe+0x24b+0x39*0x1,-0x2092+0x1a65+0x632);globalThis['distributi'+'on']['local']['groups']['get'](_0x4e8249['gid'],(_0x2b8d28,_0x109948)=>{if(!_0x109948)return _0x412239(_0x2b8d28);else{const _0x24c8a5=_0x109948[_0x15216c];return log('[store\x20(ge'+'tNode)]\x20co'+'nfiguratio'+'n:\x20'+JSON['stringify'](_0x45a5d3)+'group:\x20'+JSON['stringify'](_0x109948)+'\x20node:\x20'+JSON['stringify'](_0x24c8a5)+'nid:\x20'+JSON['stringify'](_0x3497f6)+'\x20sid:\x20'+JSON['stringify'](_0x15216c)),_0x412239(null,_0x24c8a5);}});});}function normalize(_0x14506a,_0xc99f63){if(_0x14506a===null)return{'key':null,'gid':_0xc99f63};else return typeof _0x14506a==='string'?{'key':_0x14506a,'gid':_0xc99f63}:_0x14506a;}function store(_0x587398){const _0x262c29={'gid':_0x587398['gid']||'all','hash':_0x587398['hash']||globalThis['distributi'+'on']['util']['id']['naiveHash'],'subset':_0x587398['subset']};function _0xd35ee(_0x296d2c,_0x583295){if(!_0x296d2c){const _0x43a8d2=[{'key':null,'gid':_0x262c29['gid']}];globalThis['distributi'+'on'][_0x262c29['gid']]['comm']['send'](_0x43a8d2,{'service':'store','method':'get'},(_0x209fbf,_0x59f126)=>{const _0x499f50=Object['values'](_0x59f126)['reduce']((_0x20c333,_0x328dd6)=>_0x20c333['concat'](_0x328dd6),[]);_0x583295(_0x209fbf,_0x499f50);});return;}_0x296d2c=normalize(_0x296d2c,_0x262c29['gid']),getNode(_0x262c29,_0x296d2c,(_0x55e145,_0x16ee7b)=>{if(!_0x16ee7b){_0x583295(_0x55e145);return;}const _0x4d87cf=[_0x296d2c],_0xb01a54={'service':'store','method':'get','node':_0x16ee7b};log('[all.store'+'.get]confi'+'guration:\x20'+JSON['stringify'](_0x296d2c)+'node:\x20'+JSON['stringify'](globalThis['distributi'+'on']['node']['config'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x16ee7b)),globalThis['distributi'+'on']['local']['comm']['send'](_0x4d87cf,_0xb01a54,_0x583295);});return;return _0x583295(new Error('store.get\x20'+'not\x20implem'+'ented'));}function _0x2f0e55(_0x519d27,_0x57e991,_0x2df51b){_0x57e991=_0x57e991||globalThis['distributi'+'on']['util']['id']['getID'](_0x519d27),_0x57e991=normalize(_0x57e991,_0x262c29['gid']),getNode(_0x262c29,_0x57e991,(_0x28b335,_0x4f35ba)=>{if(!_0x4f35ba){_0x2df51b(_0x28b335);return;}const _0x2edddd=[_0x519d27,_0x57e991],_0x526514={'service':'store','method':'put','node':_0x4f35ba};log('[all.store'+'.put]\x20stat'+'e:\x20'+JSON['stringify'](_0x519d27)+('configurat'+'ion:\x20')+JSON['stringify'](_0x57e991)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x4f35ba)),globalThis['distributi'+'on']['local']['comm']['send'](_0x2edddd,_0x526514,_0x2df51b);});return;return _0x2df51b(new Error('store.put\x20'+'not\x20implem'+'ented'));}function _0x5cdd05(_0x2f118d,_0x1c3ac3,_0x3ad44b){_0x1c3ac3=_0x1c3ac3||globalThis['distributi'+'on']['util']['id']['getID'](_0x2f118d),_0x1c3ac3=normalize(_0x1c3ac3,_0x262c29['gid']),getNode(_0x262c29,_0x1c3ac3,(_0x2a3a99,_0xe2de4a)=>{if(!_0xe2de4a){_0x3ad44b(_0x2a3a99);return;}const _0x510cc9=[_0x2f118d,_0x1c3ac3],_0x18badd={'service':'store','method':'append','node':_0xe2de4a};log('[all.store'+'.append]\x20s'+'tate:\x20'+JSON['stringify'](_0x2f118d)+('configurat'+'ion:\x20')+JSON['stringify'](_0x1c3ac3)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0xe2de4a)),globalThis['distributi'+'on']['local']['comm']['send'](_0x510cc9,_0x18badd,_0x3ad44b);});return;return _0x3ad44b(new Error('store.appe'+'nd\x20not\x20imp'+'lemented'));}function _0x14ce0c(_0x201c6f,_0x4228c9){getNode(_0x262c29,_0x201c6f,(_0x3a68ef,_0x3f45e2)=>{if(!_0x3f45e2){_0x4228c9(_0x3a68ef);return;}const _0x273cc1=[{'key':_0x201c6f,'gid':_0x262c29['gid']}],_0x18e4a7={'service':'store','method':'del','node':_0x3f45e2};globalThis['distributi'+'on']['local']['comm']['send'](_0x273cc1,_0x18e4a7,_0x4228c9);});return;return _0x4228c9(new Error('store.del\x20'+'not\x20implem'+'ented'));}function _0x522293(_0x259174,_0xb02e11){log('[store.rec'+'onf]\x20confi'+'guration:\x20'+JSON['stringify'](_0x259174)+'\x20gid:\x20'+_0x262c29['gid']),globalThis['distributi'+'on']['local']['groups']['get'](_0x262c29['gid'],(_0x356dfc,_0x478c78)=>{if(!_0x478c78){_0xb02e11(_0x356dfc);return;}globalThis['distributi'+'on']['local']['groups']['put'](_0x262c29['gid'],_0x259174,(_0x35ff4f,_0x2117ff)=>{globalThis['distributi'+'on'][_0x262c29['gid']]['store']['get'](null,(_0x1d69aa,_0x3ed3ac)=>{globalThis['distributi'+'on']['local']['groups']['put'](_0x262c29['gid'],_0x478c78,(_0x42e07d,_0x2fde84)=>{globalThis['distributi'+'on'][_0x262c29['gid']]['status']['get']('nid',(_0x3c01e1,_0x5b2e1d)=>{const _0x3aed75=Object['values'](_0x5b2e1d),_0x4b2e88=Object['values'](_0x259174)['map'](_0x4ca6bc=>globalThis['distributi'+'on']['util']['id']['getNID'](_0x4ca6bc));log('[store.rec'+'onf\x20receiv'+'ed\x20'+_0x3ed3ac['length']+('\x20keys\x20from'+'\x20')+_0x5b2e1d['length']+'\x20nodes');let _0x3047e1=0xd*-0xa3+-0x42c+0xc73;const _0x30884a=()=>{if(_0x3047e1===_0x3ed3ac['length'])return _0xb02e11(null);};if(_0x3ed3ac['length']===-0x1e8+-0x9fd*-0x2+-0x1212)return _0xb02e11(null);for(const _0x359399 of _0x3ed3ac){const _0x542df0=globalThis['distributi'+'on']['util']['id']['getID'](_0x359399),_0x4eb824=_0x262c29['hash'](_0x542df0,_0x4b2e88),_0x470615=_0x262c29['hash'](_0x542df0,_0x3aed75);log('[store.rec'+'onf]\x20old\x20n'+'id:\x20'+_0x4eb824+'\x20new\x20nid:\x20'+_0x470615);if(_0x4eb824===_0x470615){_0x3047e1++,_0x30884a();continue;}const _0x14eec5=_0x259174[_0x4eb824['substring'](-0x266e*0x1+0x1*-0xdc9+0x1*0x3437,0x16a*0xb+0xe*0xa5+-0x188f)],_0x1449e9=[{'key':_0x359399,'gid':_0x262c29['gid']}],_0x1ce999={'service':'store','method':'del','node':_0x14eec5};log('[store.rec'+'onf]\x20delet'+'ing\x20key\x20'+_0x359399+'\x20from\x20'+JSON['stringify'](_0x1ce999)),globalThis['distributi'+'on']['local']['comm']['send'](_0x1449e9,_0x1ce999,(_0x175068,_0x26d649)=>{globalThis['distributi'+'on'][_0x262c29['gid']]['store']['put'](_0x26d649,_0x359399,(_0x4c0f9c,_0x404df2)=>{_0x3047e1++,_0x30884a();});});}});});});});});return;return _0xb02e11(new Error('store.reco'+'nf\x20not\x20imp'+'lemented'));}return{'get':_0xd35ee,'put':_0x2f0e55,'append':_0x5cdd05,'del':_0x14ce0c,'reconf':_0x522293};}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 log=require('../util/lo'+'g'),kvStore={'store':{},'get'(
|
|
9
|
+
const log=require('../util/lo'+'g'),kvStore={'store':{},'get'(_0xbf1509){if(!this['store'][_0xbf1509['gid']])return undefined;return this['store'][_0xbf1509['gid']][_0xbf1509['key']];},'put'(_0xab28a4,_0x3aba34){!this['store'][_0xab28a4['gid']]&&(this['store'][_0xab28a4['gid']]={}),this['store'][_0xab28a4['gid']][_0xab28a4['key']]=_0x3aba34;},'append'(_0x4362f4,_0x1cb69c){!this['get'](_0x4362f4)&&this['put'](_0x4362f4,[]),!Array['isArray'](this['get'](_0x4362f4))&&this['put'](_0x4362f4,[this['get'](_0x4362f4)]),Array['isArray'](_0x1cb69c)?this['put'](_0x4362f4,this['get'](_0x4362f4)['concat'](_0x1cb69c)):this['store'][_0x4362f4['gid']][_0x4362f4['key']]['push'](_0x1cb69c);},'del'(_0x53be48){if(!this['store'][_0x53be48['gid']])return undefined;const _0x2acd24=this['store'][_0x53be48['gid']][_0x53be48['key']];return delete this['store'][_0x53be48['gid']][_0x53be48['key']],_0x2acd24;},'toString'(){let _0x1a7bdb='';for(const _0x20b178 in this['store']){_0x1a7bdb+=_0x20b178+':\x20'+JSON['stringify'](this['store'][_0x20b178]);}return _0x1a7bdb;}};function normalize(_0x1b1bf1){if(_0x1b1bf1===null)return{'key':null,'gid':null};else return typeof _0x1b1bf1==='string'?{'key':_0x1b1bf1,'gid':null}:_0x1b1bf1;};function put(_0xc76ba7,_0x815c36,_0xd42bbf){log('[mem.put]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x815c36)+'\x20state:\x20'+JSON['stringify'](_0xc76ba7)+'\x20store:\x20'+kvStore['toString']());let {key:_0x46fc05,gid:_0x58a0a7}=normalize(_0x815c36);_0x46fc05=_0x46fc05||globalThis['distributi'+'on']['util']['id']['getID'](_0xc76ba7),_0x58a0a7=_0x58a0a7||'local',kvStore['put']({'key':_0x46fc05,'gid':_0x58a0a7},_0xc76ba7),log('[mem.put]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']());if(_0xd42bbf)return _0xd42bbf(null,_0xc76ba7);return;return _0xd42bbf(new Error('mem.put\x20no'+'t\x20implemen'+'ted'));};function append(_0x473c00,_0x589a9b,_0x106c41){log('[mem.appen'+'d]\x20configu'+'ration:\x20'+JSON['stringify'](_0x589a9b)+'\x20state:\x20'+JSON['stringify'](_0x473c00)+'\x20store:\x20'+kvStore['toString']());let {key:_0x270d21,gid:_0x518f40}=normalize(_0x589a9b);_0x270d21=_0x270d21||globalThis['distributi'+'on']['util']['id']['getID'](_0x473c00),_0x518f40=_0x518f40||'local';if(!_0x270d21)return _0x106c41(new Error('Configurat'+'ion\x20key\x20is'+'\x20required\x20'+'for\x20append'));kvStore['append']({'key':_0x270d21,'gid':_0x518f40},_0x473c00),log('[mem.appen'+'d]\x20store\x20('+'after):\x20'+kvStore['toString']());const _0x3dded9=kvStore['get']({'key':_0x270d21,'gid':_0x518f40});if(_0x106c41)return _0x106c41(null,_0x3dded9);return;return _0x106c41(new Error('mem.append'+'\x20not\x20imple'+'mented'));};function get(_0x1976f9,_0x544523){log('[mem.get]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x1976f9)+'\x20store:\x20'+kvStore['toString']());let {key:_0x451d65,gid:_0x42140e}=normalize(_0x1976f9);_0x42140e=_0x42140e||'local';if(_0x451d65){const _0x5d64f0=kvStore['get']({'key':_0x451d65,'gid':_0x42140e});return _0x5d64f0?_0x544523(null,_0x5d64f0):_0x544523(new Error('Memory\x20key'+'\x20\x22'+_0x451d65+('\x22\x20not\x20foun'+'d\x20for\x20')+_0x42140e+'\x27s\x20store'));}else{let _0x453235=kvStore['store'][_0x42140e]||{};return _0x453235=Object['keys'](_0x453235),_0x544523(null,_0x453235);}return;return _0x544523(new Error('mem.get\x20no'+'t\x20implemen'+'ted'));}function del(_0x562e2f,_0x43a87d){log('[mem.del]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x562e2f)+'\x20store:\x20'+kvStore['toString']());let {key:_0x5c1c6a,gid:_0x57bb89}=normalize(_0x562e2f);_0x57bb89=_0x57bb89||'local';const _0x4ccb01=kvStore['del']({'key':_0x5c1c6a,'gid':_0x57bb89});log('[mem.del]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']());return _0x4ccb01?_0x43a87d(null,_0x4ccb01):_0x43a87d(new Error('Memory\x20key'+'\x20\x22'+_0x5c1c6a+('\x22\x20not\x20foun'+'d\x20for\x20')+_0x57bb89+'\x27s\x20store'));return;return _0x43a87d(new Error('mem.del\x20no'+'t\x20implemen'+'ted'));};module['exports']={'put':put,'get':get,'del':del,'append':append};
|
|
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(_0x173895){if(_0x173895===null)return{'key':null,'gid':null};else return typeof _0x173895==='string'?{'key':_0x173895,'gid':null}:_0x173895;}function put(_0x5d8678,_0x3f2b2a,_0x4c7881){log('[store.put'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x3f2b2a)+'\x20state:\x20'+JSON['stringify'](_0x5d8678)),_0x3f2b2a=normalize(_0x3f2b2a),_0x3f2b2a['key']=_0x3f2b2a['key']||globalThis['distributi'+'on']['util']['id']['getID'](_0x5d8678),_0x3f2b2a['gid']=_0x3f2b2a['gid']||'local';const _0x55d57f=globalThis['distributi'+'on']['util']['serialize'](_0x5d8678),_0x413a5c=Buffer['from'](_0x3f2b2a['key'])['toString']('base64'),_0x43d508=path['join'](nodeFolder,_0x3f2b2a['gid']+'-'+_0x413a5c);fs['writeFile'](_0x43d508,_0x55d57f,_0x3d5e4d=>{return _0x3d5e4d?_0x4c7881(_0x3d5e4d):_0x4c7881(null,_0x5d8678);});return;return _0x4c7881(new Error('store.put\x20'+'not\x20implem'+'ented'));}function get(_0x2968d0,_0x5ce40d){log('[store.get'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x2968d0)),_0x2968d0=normalize(_0x2968d0),_0x2968d0['gid']=_0x2968d0['gid']||'local';if(!_0x2968d0['key']){fs['readdir'](nodeFolder,(_0x5e2fe5,_0x47cd19)=>{if(_0x5e2fe5)return _0x5ce40d(_0x5e2fe5);const _0x112293=[];for(let _0x281063=-0x5ad*-0x1+-0x1153+-0x2a*-0x47;_0x281063<_0x47cd19['length'];_0x281063++){const _0x4a391f=_0x47cd19[_0x281063]['split']('-'),_0x540ef8=_0x4a391f[-0xb1b*0x3+-0x474+0x25c5];if(_0x540ef8!==_0x2968d0['gid'])continue;const _0x51f1df=_0x4a391f[_0x4a391f['length']-(-0x1*0x4f9+-0x236f+0x2869)];_0x112293['push'](Buffer['from'](_0x51f1df,'base64')['toString']());}return _0x5ce40d(null,_0x112293);});return;}const _0x26045e=Buffer['from'](_0x2968d0['key'])['toString']('base64'),_0x279361=path['join'](nodeFolder,_0x2968d0['gid']+'-'+_0x26045e);fs['readFile'](_0x279361,(_0x435cba,_0x3f816d)=>{return _0x435cba?_0x435cba['code']==='ENOENT'?_0x5ce40d(new Error('File\x20'+_0x279361+('\x20(from\x20key'+'\x20\x27')+_0x2968d0['key']+('\x27)\x20not\x20fou'+'nd\x20for\x20gro'+'up\x20')+_0x2968d0['gid'])):_0x5ce40d(_0x435cba):_0x5ce40d(null,globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x3f816d['toString']()));});return;return _0x5ce40d(new Error('store.get\x20'+'not\x20implem'+'ented'));}function del(_0x384bab,_0x1dd0cd){log('[store.del'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x384bab)),_0x384bab=normalize(_0x384bab),_0x384bab['gid']=_0x384bab['gid']||'local';const _0x1e7596=Buffer['from'](_0x384bab['key'])['toString']('base64'),_0x23451e=path['join'](nodeFolder,_0x384bab['gid']+'-'+_0x1e7596);get(_0x384bab,(_0x19fd95,_0x4541dd)=>{if(_0x19fd95)return _0x1dd0cd(_0x19fd95);fs['rm'](_0x23451e,_0x57d804=>{return _0x57d804?_0x1dd0cd(_0x57d804):_0x1dd0cd(null,_0x4541dd);});});return;return _0x1dd0cd(new Error('store.del\x20'+'not\x20implem'+'ented'));}function append(_0x3200de,_0x428db0,_0xc98a04){log('[store.app'+'end]\x20confi'+'guration:\x20'+JSON['stringify'](_0x428db0)+'\x20state:\x20'+JSON['stringify'](_0x3200de)),_0x428db0=normalize(_0x428db0),_0x428db0['key']=_0x428db0['key']||globalThis['distributi'+'on']['util']['id']['getID'](_0x3200de),_0x428db0['gid']=_0x428db0['gid']||'local';const _0x26cb35=Buffer['from'](_0x428db0['key'])['toString']('base64'),_0x324711=path['join'](nodeFolder,_0x428db0['gid']+'-'+_0x26cb35),_0x2608b4=_0xc16035=>{const _0x352de5=globalThis['distributi'+'on']['util']['serialize'](_0xc16035);fs['writeFile'](_0x324711,_0x352de5,_0x5474f2=>{if(_0x5474f2)return _0xc98a04(_0x5474f2);return _0xc98a04(null,_0xc16035);});};return fs['readFile'](_0x324711,(_0x1031a6,_0x2a8851)=>{if(_0x1031a6){if(_0x1031a6['code']==='ENOENT'){const _0x4adc0e=Array['isArray'](_0x3200de)?_0x3200de:[_0x3200de];return _0x2608b4(_0x4adc0e);}return _0xc98a04(_0x1031a6);}let _0x46b091;try{_0x46b091=globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x2a8851['toString']());}catch(_0x122b8d){return _0xc98a04(_0x122b8d);}!Array['isArray'](_0x46b091)&&(_0x46b091=[_0x46b091]);const _0x5ee081=Array['isArray'](_0x3200de)?_0x46b091['concat'](_0x3200de):_0x46b091['concat']([_0x3200de]);return _0x2608b4(_0x5ee081);}),_0xc98a04(new Error('store.appe'+'nd\x20not\x20imp'+'lemented'));}module['exports']={'put':put,'get':get,'del':del,'append':append};
|
|
10
10
|
/* eslint-enable */
|