@brown-ds/distribution 0.0.34 → 0.0.36
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/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
|
|
9
|
+
const distribution=global['distributi'+'on'],util=distribution['util'],log=require('../util/lo'+'g');function getNode(_0x589765,_0x19e411,_0xc1f933){typeof _0x19e411==='object'&&(_0x19e411=_0x19e411['key']),distribution[_0x589765['gid']]['status']['get']('nid',(_0x56a4dc,_0x327511)=>{let _0x1ec6eb=Object['values'](_0x327511),_0x2a079a=util['id']['getID'](_0x19e411),_0x2b837c=_0x589765['hash'](_0x2a079a,_0x1ec6eb),_0x3f4b86=_0x2b837c['substring'](0xfac+0x12f2+-0x229e,0x1676+-0x17c*0x1a+-0x33b*-0x5);distribution['local']['groups']['get'](_0x589765['gid'],(_0x36b12d,_0x3152f9)=>{let _0xe9ec=_0x3152f9[_0x3f4b86];log('[mem\x20(getN'+'ode)]\x20conf'+'iguration:'+'\x20'+JSON['stringify'](_0x19e411)+'group:\x20'+JSON['stringify'](_0x3152f9)+'\x20node:\x20'+JSON['stringify'](_0xe9ec)+'nid:\x20'+JSON['stringify'](_0x2b837c)+'\x20sid:\x20'+JSON['stringify'](_0x3f4b86)),_0xc1f933(_0xe9ec);});});}function normalize(_0xe68513,_0x44d826){let _0x23951e={};_0xe68513===null&&(_0xe68513={});if(typeof _0xe68513==='string')_0x23951e['key']=_0xe68513,_0x23951e['gid']=_0x44d826,_0x23951e['action']='put';else typeof _0xe68513==='object'&&(_0x23951e['key']=_0xe68513['key'],_0x23951e['gid']=_0xe68513['gid']||_0x44d826,_0x23951e['action']=_0xe68513['action']||'put');return _0x23951e;};const mem=function(_0x3a1d0e){let _0x2283ec={};return _0x2283ec['gid']=_0x3a1d0e['gid']||'all',_0x2283ec['hash']=_0x3a1d0e['hash']||util['id']['naiveHash'],{'get':(_0xaccb4e,_0x5dad77)=>{if(!_0xaccb4e){let _0x886e1d=[{'key':null,'gid':_0x2283ec['gid']}];distribution[_0x2283ec['gid']]['comm']['send'](_0x886e1d,{'service':'mem','method':'get'},(_0x71d717,_0xf9e85d)=>{let _0x50cc5a=Object['values'](_0xf9e85d)['reduce']((_0x614ca4,_0x13fda0)=>_0x614ca4['concat'](_0x13fda0),[]);_0x5dad77(_0x71d717,_0x50cc5a);});return;}_0xaccb4e=normalize(_0xaccb4e,_0x2283ec['gid']),getNode(_0x2283ec,_0xaccb4e,_0x4083f4=>{let _0x1c45e4=[_0xaccb4e],_0xc7d1fc={'service':'mem','method':'get','node':_0x4083f4};log('[all.mem.g'+'et]\x20config'+'uration:\x20'+JSON['stringify'](_0xaccb4e)+'\x20node:\x20'+JSON['stringify'](global['nodeConfig'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x4083f4)),distribution['local']['comm']['send'](_0x1c45e4,_0xc7d1fc,_0x5dad77);});},'put':(_0x2ac3e5,_0x2d7ec8,_0x4fecc2)=>{_0x2d7ec8=_0x2d7ec8||util['id']['getID'](_0x2ac3e5),_0x2d7ec8=normalize(_0x2d7ec8,_0x2283ec['gid']),getNode(_0x2283ec,_0x2d7ec8,_0x286b9e=>{let _0x49f76f=[_0x2ac3e5,_0x2d7ec8],_0x21c899={'service':'mem','method':'put','node':_0x286b9e};log('[all.mem.p'+'ut]\x20state:'+'\x20'+JSON['stringify'](_0x2ac3e5)+('configurat'+'ion:\x20')+JSON['stringify'](_0x2d7ec8)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x286b9e)),distribution['local']['comm']['send'](_0x49f76f,_0x21c899,_0x4fecc2);});},'del':(_0x16b8b2,_0x5ede00)=>{getNode(_0x2283ec,_0x16b8b2,_0x35d4fc=>{let _0x44075a=[{'key':_0x16b8b2,'gid':_0x2283ec['gid']}],_0x48105a={'service':'mem','method':'del','node':_0x35d4fc};distribution['local']['comm']['send'](_0x44075a,_0x48105a,_0x5ede00);});},'reconf':(_0x2ae122,_0x2ec210)=>{distribution[_0x2283ec['gid']]['mem']['get'](null,(_0x4e758b,_0x4f2a58)=>{distribution[_0x2283ec['gid']]['status']['get']('nid',(_0x3c9859,_0x464236)=>{let _0xfbb01a=Object['values'](_0x464236),_0x2f589b=Object['values'](_0x2ae122)['map'](_0x260bab=>util['id']['getNID'](_0x260bab)),_0x2cdc74=0xeb7*0x1+0x1*0x18ac+-0x2763*0x1;const _0x5113ba=()=>{_0x2cdc74===_0x4f2a58['length']&&_0x2ec210();};if(_0x4f2a58['length']===0x1f5f+-0x1*-0x49f+-0x23fe){_0x2ec210();return;}for(let _0x1e74de of _0x4f2a58){let _0x3a2d06=util['id']['getID'](_0x1e74de),_0x55df9c=_0x2283ec['hash'](_0x3a2d06,_0x2f589b),_0x545ae9=_0x2283ec['hash'](_0x3a2d06,_0xfbb01a);if(_0x55df9c===_0x545ae9){_0x2cdc74++,_0x5113ba();continue;}let _0x4853c1=_0x2ae122[_0x55df9c['substring'](-0xb5c*0x1+-0x691+0x11ed,-0x2037+-0x1fcc+0x4008)],_0x1ffaf1=[{'key':_0x1e74de,'gid':_0x2283ec['gid']}],_0x1b81a2={'service':'mem','method':'del','node':_0x4853c1};distribution['local']['comm']['send'](_0x1ffaf1,_0x1b81a2,(_0x4e42af,_0x394b89)=>{distribution[_0x2283ec['gid']]['mem']['put'](_0x394b89,_0x1e74de,(_0xe183fd,_0x27f8da)=>{_0x2cdc74++,_0x5113ba();});});}});});}};};module['exports']=mem;
|
|
10
10
|
/* eslint-enable */
|
|
@@ -6,5 +6,5 @@ Do NOT edit this file directly. Use it as a black box.
|
|
|
6
6
|
|
|
7
7
|
If you notice any issues with using this file, please contact the TAs.
|
|
8
8
|
*/
|
|
9
|
-
const distribution=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(_0xa0467f,_0x510f83,_0x2e2cbb){distribution[_0xa0467f['gid']]['status']['get']('nid',(_0x551d07,_0xb8508b)=>{let _0x576d79=Object['values'](_0xb8508b),_0x45deb4=util['id']['getID'](_0x510f83),_0x2bf5e4=_0xa0467f['hash'](_0x45deb4,_0x576d79),_0x1e0eb2=_0x2bf5e4['substring'](-0x3d*0x43+0x26b1+0x16ba*-0x1,-0x143*-0x1b+-0x2fd*0x2+-0x1c12);distribution['local']['groups']['get'](_0xa0467f['gid'],(_0x41d762,_0x5d0f54)=>{let _0x1ca477=_0x5d0f54[_0x1e0eb2];_0x2e2cbb(_0x1ca477);});});}const store=function(_0xee17b3){let _0x292db5={};return _0x292db5['gid']=_0xee17b3['gid']||'all',_0x292db5['hash']=_0xee17b3['hash']||util['id']['naiveHash'],{'get':(_0x3d7c00,_0x491ab9)=>{if(!_0x3d7c00){let _0x32bfe7=[{'key':null,'gid':_0x292db5['gid']}];distribution[_0x292db5['gid']]['comm']['send'](_0x32bfe7,{'service':'store','method':'get'},(_0x318e62,_0x192e66)=>{log('[all.store'+'.get\x20null\x20'+'given\x20as\x20k'+'ey.\x20keys:\x20'+JSON['stringify'](_0x192e66)+'\x20errors:\x20'+JSON['stringify'](_0x318e62));let _0x5e896b=Object['values'](_0x192e66)['reduce']((_0x4a725c,_0x1a85e2)=>_0x4a725c['concat'](_0x1a85e2),[]);_0x491ab9(_0x318e62,_0x5e896b);});return;}getNode(_0x292db5,_0x3d7c00,_0x72f87a=>{let _0x5e4b16=[{'key':_0x3d7c00,'gid':_0x292db5['gid']}],_0x539a83={'service':'store','method':'get','node':_0x72f87a};distribution['local']['comm']['send'](_0x5e4b16,_0x539a83,_0x491ab9);});},'put':(_0x3e40a2,_0x19844d,_0x3424ac)=>{_0x19844d=_0x19844d||util['id']['getID'](_0x3e40a2),getNode(_0x292db5,_0x19844d,_0x57bfb3=>{let _0x418353=[_0x3e40a2,{'key':_0x19844d,'gid':_0x292db5['gid']}],_0xbb8976={'service':'store','method':'put','node':_0x57bfb3};log('[all.store'+'.put]:\x20(gi'+'d:\x20'+_0x292db5['gid']+')\x20'+JSON['stringify'](_0x3e40a2)+'\x20'+JSON['stringify'](_0x19844d)+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x57bfb3)),distribution['local']['comm']['send'](_0x418353,_0xbb8976,_0x3424ac);});},'del':(_0x111e0b,_0x54f463)=>{getNode(_0x292db5,_0x111e0b,_0x5f298d=>{let _0x341abd=[{'key':_0x111e0b,'gid':_0x292db5['gid']}],_0x4ce73e={'service':'store','method':'del','node':_0x5f298d};distribution['local']['comm']['send'](_0x341abd,_0x4ce73e,_0x54f463);});},'reconf':(_0x386745,_0x23e325)=>{distribution[_0x292db5['gid']]['store']['get'](null,(_0x27f3c1,_0x32c3f0)=>{distribution[_0x292db5['gid']]['status']['get']('nid',(_0x18f2d9,_0x3f1917)=>{let _0x5c076b=Object['values'](_0x3f1917),_0xb6f65b=Object['values'](_0x386745)['map'](_0x2cd4db=>util['id']['getNID'](_0x2cd4db));log('[store.rec'+'onf\x20receiv'+'ed\x20'+_0x32c3f0['length']+('\x20keys\x20from'+'\x20')+_0x3f1917['length']+'\x20nodes');let _0x2b4776=-0x1*-0x15fd+-0x91f+0xb7*-0x12;const _0x3e2050=()=>{_0x2b4776===_0x32c3f0['length']&&_0x23e325();};if(_0x32c3f0['length']===0xd9*-0x2d+0x1aff*-0x1+-0x16*-0x2f6){_0x23e325();return;}for(let _0x8a4c69 of _0x32c3f0){let _0x1dfe7e=util['id']['getID'](_0x8a4c69),_0x290ab5=_0x292db5['hash'](_0x1dfe7e,_0xb6f65b),_0x5b0c41=_0x292db5['hash'](_0x1dfe7e,_0x5c076b);log('[store.rec'+'onf\x20old\x20ni'+'d:\x20'+_0x290ab5+'\x20new\x20nid:\x20'+_0x5b0c41);if(_0x290ab5===_0x5b0c41){_0x2b4776++,_0x3e2050();continue;}let _0x3e1594=_0x386745[_0x290ab5['substring'](-0x12ce+0x14b*0x1d+0x57*-0x37,-0x119*0x9+0x25e2+0x954*-0x3)],_0x2f153d=[{'key':_0x8a4c69,'gid':_0x292db5['gid']}],_0x2a4c14={'service':'store','method':'del','node':_0x3e1594};log('[store.rec'+'onf]\x20delet'+'ing\x20key\x20'+_0x8a4c69+'\x20from\x20'+JSON['stringify'](_0x2a4c14)),distribution['local']['comm']['send'](_0x2f153d,_0x2a4c14,(_0x25f526,_0x197d13)=>{distribution[_0x292db5['gid']]['store']['put'](_0x197d13,_0x8a4c69,(_0x21ecb9,_0x228777)=>{_0x2b4776++,_0x3e2050();});});}});});}};};module['exports']=store;
|
|
10
10
|
/* eslint-enable */
|