@brown-ds/distribution 0.2.31 → 0.2.32
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 +1 -1
- package/distribution/all/status.js +1 -1
- package/distribution/all/store.js +1 -1
- package/distribution/local/mem.js +1 -1
- package/distribution/local/store.js +1 -1
- package/distribution/util/serialization.js +1 -1
- package/distribution/util/wire.js +1 -1
- package/package.json +1 -1
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(_0x5d2c85,_0x40228b){if(_0x5d2c85===null)return{'key':null,'gid':_0x40228b};else return typeof _0x5d2c85==='string'?{'key':_0x5d2c85,'gid':_0x40228b}:_0x5d2c85;}function mem(_0x3de5ba){const _0x4b04c0={};_0x4b04c0['gid']=_0x3de5ba['gid']||'all',_0x4b04c0['hash']=_0x3de5ba['hash']||globalThis['distributi'+'on']['util']['id']['naiveHash'];function _0x75c519(_0x57d6b6,_0x2bc86b){log('[all.mem.g'+'et]\x20config'+'uration:\x20'+JSON['stringify'](_0x57d6b6)+'\x20context:\x20'+JSON['stringify'](_0x4b04c0)),_0x57d6b6=normalize(_0x57d6b6,_0x4b04c0['gid']),_0x57d6b6['gid']=_0x57d6b6['gid']||_0x4b04c0['gid'];const _0x5e3572={'service':'mem','method':'get'},_0x47c605=[_0x57d6b6];if(!_0x57d6b6['key']){globalThis['distributi'+'on'][_0x4b04c0['gid']]['comm']['send'](_0x47c605,_0x5e3572,(_0x33dc1f,_0x327e0b)=>{const _0xe493e5=Object['values'](_0x327e0b)['reduce']((_0x29968e,_0x506f51)=>_0x29968e['concat'](_0x506f51),[]);_0x2bc86b(_0x33dc1f,_0xe493e5);});return;}const _0x283630=_0x57d6b6['key'];if(_0x283630===null){_0x2bc86b(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x47c605,_0x5e3572,{'key':_0x283630},_0x4b04c0,_0x2bc86b);return;return _0x2bc86b(new Error('mem.get\x20no'+'t\x20implemen'+'ted'));}function _0x25340c(_0x327957,_0x5e1c5a,_0x47e5b1){log('[all.mem.p'+'ut]\x20state:'+'\x20'+JSON['stringify'](_0x327957)+('\x20configura'+'tion:\x20')+JSON['stringify'](_0x5e1c5a)),_0x5e1c5a=_0x5e1c5a||globalThis['distributi'+'on']['util']['id']['getID'](_0x327957),_0x5e1c5a=normalize(_0x5e1c5a,_0x4b04c0['gid']),_0x5e1c5a['gid']=_0x5e1c5a['gid']||_0x4b04c0['gid'];const _0x17bd85={'service':'mem','method':'put'},_0x4b54e2=[_0x327957,_0x5e1c5a],_0xa8e340=_0x5e1c5a['key'];if(_0xa8e340===null){_0x47e5b1(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x4b54e2,_0x17bd85,{'key':_0xa8e340},_0x4b04c0,_0x47e5b1);return;return _0x47e5b1(new Error('mem.put\x20no'+'t\x20implemen'+'ted'));}function _0x19f055(_0xc79fa7,_0x431eb8,_0x564a0c){log('[all.mem.a'+'ppend]\x20sta'+'te:\x20'+JSON['stringify'](_0xc79fa7)+('\x20configura'+'tion:\x20')+JSON['stringify'](_0x431eb8)),_0x431eb8=_0x431eb8||globalThis['distributi'+'on']['util']['id']['getID'](_0xc79fa7),_0x431eb8=normalize(_0x431eb8,_0x4b04c0['gid']),_0x431eb8['gid']=_0x431eb8['gid']||_0x4b04c0['gid'];const _0x1ebb93={'service':'mem','method':'append'},_0x43df89=[_0xc79fa7,_0x431eb8],_0x415ede=_0x431eb8['key'];if(_0x415ede===null){_0x564a0c(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x43df89,_0x1ebb93,{'key':_0x415ede},_0x4b04c0,_0x564a0c);return;return _0x564a0c(new Error('mem.append'+'\x20not\x20imple'+'mented'));}function _0x31695f(_0x2a746c,_0x5deb6b){log('[all.mem.d'+'el]\x20config'+'uration:\x20'+JSON['stringify'](_0x2a746c)),_0x2a746c=normalize(_0x2a746c,_0x4b04c0['gid']),_0x2a746c['gid']=_0x2a746c['gid']||_0x4b04c0['gid'];const _0x2e1c5c={'service':'mem','method':'del'},_0x5575cd=[_0x2a746c],_0x33e2ed=_0x2a746c['key'];if(_0x33e2ed===null){_0x5deb6b(new TypeError('Configurat'+'ion\x20is\x20nul'+'l'));return;}globalThis['distributi'+'on']['util']['wire']['dispatchMe'+'ssage'](_0x5575cd,_0x2e1c5c,{'key':_0x33e2ed},_0x4b04c0,_0x5deb6b);return;return _0x5deb6b(new Error('mem.del\x20no'+'t\x20implemen'+'ted'));}function _0x2c1fbe(_0x4e9e9b,_0x6297c8){log('[mem.recon'+'f]\x20configu'+'ration:\x20'+JSON['stringify'](_0x4e9e9b)+'\x20gid:\x20'+_0x4b04c0['gid']),globalThis['distributi'+'on']['local']['groups']['get'](_0x4b04c0['gid'],(_0x193dee,_0x867a12)=>{if(!_0x867a12){_0x6297c8(_0x193dee);return;}globalThis['distributi'+'on']['local']['groups']['put'](_0x4b04c0['gid'],_0x4e9e9b,(_0x41157d,_0x556015)=>{globalThis['distributi'+'on'][_0x4b04c0['gid']]['mem']['get'](null,(_0x2a2072,_0x32a9d0)=>{globalThis['distributi'+'on']['local']['groups']['put'](_0x4b04c0['gid'],_0x867a12,(_0x307681,_0x5c0002)=>{globalThis['distributi'+'on'][_0x4b04c0['gid']]['status']['get']('nid',(_0x41ffe3,_0x4fa0b7)=>{const _0x53283f=Object['values'](_0x4fa0b7),_0x40f04b=Object['values'](_0x4e9e9b)['map'](_0x583388=>globalThis['distributi'+'on']['util']['id']['getNID'](_0x583388));log('[mem.recon'+'f\x20received'+'\x20'+_0x32a9d0['length']+('\x20keys\x20from'+'\x20')+_0x4fa0b7['length']+'\x20nodes');let _0x46005e=0x1*0xef7+-0x88b+-0x66c;const _0x10a74d=()=>{if(_0x46005e===_0x32a9d0['length'])return _0x6297c8(null);};if(_0x32a9d0['length']===0x2090+-0x1*-0x21da+-0x2135*0x2)return _0x6297c8(null);for(const _0x58c5a5 of _0x32a9d0){const _0x58fa3d=globalThis['distributi'+'on']['util']['id']['getID'](_0x58c5a5),_0x51e8c5=_0x4b04c0['hash'](_0x58fa3d,_0x40f04b),_0x5a2a1e=_0x4b04c0['hash'](_0x58fa3d,_0x53283f);log('[mem.recon'+'f]\x20old\x20nid'+':\x20'+_0x51e8c5+'\x20new\x20nid:\x20'+_0x5a2a1e);if(_0x51e8c5===_0x5a2a1e){_0x46005e++,_0x10a74d();continue;}const _0x563b90=_0x4e9e9b[_0x51e8c5['substring'](-0x27*-0xbd+-0x219*-0x12+-0x162f*0x3,-0xc80+0x98f+0x1*0x2f6)],_0x5c1351=[{'key':_0x58c5a5,'gid':_0x4b04c0['gid']}],_0x39fa58={'service':'mem','method':'del','node':_0x563b90};log('[mem.recon'+'f]\x20deletin'+'g\x20key\x20'+_0x58c5a5+'\x20from\x20'+JSON['stringify'](_0x39fa58)),globalThis['distributi'+'on']['local']['comm']['send'](_0x5c1351,_0x39fa58,(_0x5e38c6,_0x207465)=>{globalThis['distributi'+'on'][_0x4b04c0['gid']]['mem']['put'](_0x207465,_0x58c5a5,(_0x49c4cb,_0xbde5be)=>{_0x46005e++,_0x10a74d();});});}});});});});});return;return _0x6297c8(new Error('mem.reconf'+'\x20not\x20imple'+'mented'));}return{'get':_0x75c519,'put':_0x25340c,'append':_0x19f055,'del':_0x31695f,'reconf':_0x2c1fbe};}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
|
-
function status(
|
|
9
|
+
function status(_0x2855a4){const _0x20233d={};_0x20233d['gid']=_0x2855a4['gid']||'all';function _0x150c30(_0x230055,_0x4862e3){const _0x1e63bc=[_0x230055],_0x3d8f9d={'service':'status','method':'get'};globalThis['distributi'+'on'][_0x20233d['gid']]['comm']['send'](_0x1e63bc,_0x3d8f9d,(_0x2b09ad,_0x3ed4ea)=>{switch(_0x230055){case'heapTotal':const _0x1d2b3e=Object['values'](_0x3ed4ea)['reduce']((_0x12dccb,_0x3a36d0)=>{return _0x12dccb+_0x3a36d0;},0x111b+-0x3*-0x917+0x163*-0x20);return _0x4862e3(_0x2b09ad,_0x1d2b3e);break;case'nid':const _0x15c7b0=Object['values'](_0x3ed4ea)['reduce']((_0x19ffd6,_0x42dcbb)=>{return _0x19ffd6['concat'](_0x42dcbb);},[]);return _0x4862e3(_0x2b09ad,_0x15c7b0);break;case'sid':const _0x5aa542=Object['values'](_0x3ed4ea)['reduce']((_0x4b0b86,_0x4fc5d9)=>{return _0x4b0b86['concat'](_0x4fc5d9);},[]);return _0x4862e3(_0x2b09ad,_0x5aa542);break;default:return _0x4862e3(_0x2b09ad,_0x3ed4ea);break;}});return;_0x4862e3(new Error('status.get'+'\x20not\x20imple'+'mented'));}function _0x553797(_0x316830,_0x5bcb66){globalThis['distributi'+'on']['local']['status']['spawn'](_0x316830,(_0x24f381,_0x234bb4)=>{globalThis['distributi'+'on'][_0x20233d['gid']]['comm']['send']([_0x20233d['gid'],_0x316830],{'service':'groups','method':'add'},()=>{});if(_0x24f381)return _0x5bcb66(_0x24f381);globalThis['distributi'+'on']['local']['groups']['add'](_0x20233d['gid'],_0x316830,()=>{return _0x5bcb66(null,_0x234bb4);});});return;_0x5bcb66(new Error('status.spa'+'wn\x20not\x20imp'+'lemented'));}function _0x369f82(_0x35e5dc){globalThis['distributi'+'on'][_0x20233d['gid']]['comm']['send']([],{'service':'status','method':'stop'},()=>{globalThis['distributi'+'on']['local']['status']['stop'](_0x35e5dc);});return;_0x35e5dc(new Error('status.sto'+'p\x20not\x20impl'+'emented'));}return{'get':_0x150c30,'stop':_0x369f82,'spawn':_0x553797};}module['exports']=status;
|
|
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(_0x30afc6,_0x2ee54a,_0x399c14){const _0x316956=_0x2ee54a&&typeof _0x2ee54a==='object'?_0x2ee54a['key']:_0x2ee54a;globalThis['distributi'+'on'][_0x30afc6['gid']]['status']['get']('nid',(_0x8dc737,_0x19d4b9)=>{const _0x2230fd=Object['values'](_0x19d4b9),_0x1120ea=globalThis['distributi'+'on']['util']['id']['getID'](_0x316956),_0x260065=_0x30afc6['hash'](_0x1120ea,_0x2230fd),_0x9f9d59=_0x260065['substring'](0x2438+0x7a8+-0x2be0,-0xd8f*-0x1+0x3*-0x77b+0x8e7);globalThis['distributi'+'on']['local']['groups']['get'](_0x30afc6['gid'],(_0x58187c,_0x22b59d)=>{if(!_0x22b59d)return _0x399c14(_0x58187c);else{const _0x484606=_0x22b59d[_0x9f9d59];return log('[store\x20(ge'+'tNode)]\x20co'+'nfiguratio'+'n:\x20'+JSON['stringify'](_0x2ee54a)+'group:\x20'+JSON['stringify'](_0x22b59d)+'\x20node:\x20'+JSON['stringify'](_0x484606)+'nid:\x20'+JSON['stringify'](_0x260065)+'\x20sid:\x20'+JSON['stringify'](_0x9f9d59)),_0x399c14(null,_0x484606);}});});}function normalize(_0x200d9f,_0x59db03){if(_0x200d9f===null)return{'key':null,'gid':_0x59db03};else return typeof _0x200d9f==='string'?{'key':_0x200d9f,'gid':_0x59db03}:_0x200d9f;}function store(_0x14783b){const _0x520cf5={'gid':_0x14783b['gid']||'all','hash':_0x14783b['hash']||globalThis['distributi'+'on']['util']['id']['naiveHash'],'subset':_0x14783b['subset']};function _0x19433f(_0x374446,_0x5aae10){if(!_0x374446){const _0x14f94c=[{'key':null,'gid':_0x520cf5['gid']}];globalThis['distributi'+'on'][_0x520cf5['gid']]['comm']['send'](_0x14f94c,{'service':'store','method':'get'},(_0x2c5df9,_0x4be9e2)=>{const _0x5ecb38=Object['values'](_0x4be9e2)['reduce']((_0x71704e,_0xca3c29)=>_0x71704e['concat'](_0xca3c29),[]);_0x5aae10(_0x2c5df9,_0x5ecb38);});return;}_0x374446=normalize(_0x374446,_0x520cf5['gid']),getNode(_0x520cf5,_0x374446,(_0x4bf699,_0x24874f)=>{if(!_0x24874f){_0x5aae10(_0x4bf699);return;}const _0x14a143=[_0x374446],_0x33bd29={'service':'store','method':'get','node':_0x24874f};log('[all.store'+'.get]confi'+'guration:\x20'+JSON['stringify'](_0x374446)+'node:\x20'+JSON['stringify'](globalThis['distributi'+'on']['node']['config'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x24874f)),globalThis['distributi'+'on']['local']['comm']['send'](_0x14a143,_0x33bd29,_0x5aae10);});return;return _0x5aae10(new Error('store.get\x20'+'not\x20implem'+'ented'));}function _0x12fcfe(_0x4ee34c,_0x142ed3,_0x560369){_0x142ed3=_0x142ed3||globalThis['distributi'+'on']['util']['id']['getID'](_0x4ee34c),_0x142ed3=normalize(_0x142ed3,_0x520cf5['gid']),getNode(_0x520cf5,_0x142ed3,(_0xfb2647,_0xc04ae9)=>{if(!_0xc04ae9){_0x560369(_0xfb2647);return;}const _0x200002=[_0x4ee34c,_0x142ed3],_0x25ef6e={'service':'store','method':'put','node':_0xc04ae9};log('[all.store'+'.put]\x20stat'+'e:\x20'+JSON['stringify'](_0x4ee34c)+('configurat'+'ion:\x20')+JSON['stringify'](_0x142ed3)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0xc04ae9)),globalThis['distributi'+'on']['local']['comm']['send'](_0x200002,_0x25ef6e,_0x560369);});return;return _0x560369(new Error('store.put\x20'+'not\x20implem'+'ented'));}function _0x8d1b82(_0x540d0c,_0x17c1af,_0x2f8189){_0x17c1af=_0x17c1af||globalThis['distributi'+'on']['util']['id']['getID'](_0x540d0c),_0x17c1af=normalize(_0x17c1af,_0x520cf5['gid']),getNode(_0x520cf5,_0x17c1af,(_0x245686,_0x10e912)=>{if(!_0x10e912){_0x2f8189(_0x245686);return;}const _0x29ff48=[_0x540d0c,_0x17c1af],_0x2ffc17={'service':'store','method':'append','node':_0x10e912};log('[all.store'+'.append]\x20s'+'tate:\x20'+JSON['stringify'](_0x540d0c)+('configurat'+'ion:\x20')+JSON['stringify'](_0x17c1af)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x10e912)),globalThis['distributi'+'on']['local']['comm']['send'](_0x29ff48,_0x2ffc17,_0x2f8189);});return;return _0x2f8189(new Error('store.appe'+'nd\x20not\x20imp'+'lemented'));}function _0x4ac88a(_0x2df2cc,_0x35a06b){getNode(_0x520cf5,_0x2df2cc,(_0x1ea970,_0x6dfbf)=>{if(!_0x6dfbf){_0x35a06b(_0x1ea970);return;}const _0x2f4fe9=[{'key':_0x2df2cc,'gid':_0x520cf5['gid']}],_0x42da02={'service':'store','method':'del','node':_0x6dfbf};globalThis['distributi'+'on']['local']['comm']['send'](_0x2f4fe9,_0x42da02,_0x35a06b);});return;return _0x35a06b(new Error('store.del\x20'+'not\x20implem'+'ented'));}function _0x4baae1(_0x313f8b,_0x293e14){log('[store.rec'+'onf]\x20confi'+'guration:\x20'+JSON['stringify'](_0x313f8b)+'\x20gid:\x20'+_0x520cf5['gid']),globalThis['distributi'+'on']['local']['groups']['get'](_0x520cf5['gid'],(_0x317afe,_0x2443f2)=>{if(!_0x2443f2){_0x293e14(_0x317afe);return;}globalThis['distributi'+'on']['local']['groups']['put'](_0x520cf5['gid'],_0x313f8b,(_0x5d4b3a,_0x3519f7)=>{globalThis['distributi'+'on'][_0x520cf5['gid']]['store']['get'](null,(_0x4c42d5,_0x37f598)=>{globalThis['distributi'+'on']['local']['groups']['put'](_0x520cf5['gid'],_0x2443f2,(_0x4655d8,_0x557cc3)=>{globalThis['distributi'+'on'][_0x520cf5['gid']]['status']['get']('nid',(_0x2d307b,_0x4f3d0b)=>{const _0x52cd6c=Object['values'](_0x4f3d0b),_0x2d1f93=Object['values'](_0x313f8b)['map'](_0x18416a=>globalThis['distributi'+'on']['util']['id']['getNID'](_0x18416a));log('[store.rec'+'onf\x20receiv'+'ed\x20'+_0x37f598['length']+('\x20keys\x20from'+'\x20')+_0x4f3d0b['length']+'\x20nodes');let _0x54f3a8=-0x94f*-0x2+0xf8c*-0x1+-0x312;const _0x465627=()=>{if(_0x54f3a8===_0x37f598['length'])return _0x293e14(null);};if(_0x37f598['length']===0x2*-0x395+-0x1c1b+-0x1*-0x2345)return _0x293e14(null);for(const _0x3b9f65 of _0x37f598){const _0x33ccb6=globalThis['distributi'+'on']['util']['id']['getID'](_0x3b9f65),_0x239e73=_0x520cf5['hash'](_0x33ccb6,_0x2d1f93),_0xcc48ae=_0x520cf5['hash'](_0x33ccb6,_0x52cd6c);log('[store.rec'+'onf]\x20old\x20n'+'id:\x20'+_0x239e73+'\x20new\x20nid:\x20'+_0xcc48ae);if(_0x239e73===_0xcc48ae){_0x54f3a8++,_0x465627();continue;}const _0x5de419=_0x313f8b[_0x239e73['substring'](0x5*0x44b+0x17d*0x5+-0x64*0x4a,-0x94c*0x1+-0x3*-0xc4f+0xba*-0x26)],_0x35d262=[{'key':_0x3b9f65,'gid':_0x520cf5['gid']}],_0x29e09b={'service':'store','method':'del','node':_0x5de419};log('[store.rec'+'onf]\x20delet'+'ing\x20key\x20'+_0x3b9f65+'\x20from\x20'+JSON['stringify'](_0x29e09b)),globalThis['distributi'+'on']['local']['comm']['send'](_0x35d262,_0x29e09b,(_0x35f52d,_0x4a0863)=>{globalThis['distributi'+'on'][_0x520cf5['gid']]['store']['put'](_0x4a0863,_0x3b9f65,(_0xdaa56,_0x58d6e7)=>{_0x54f3a8++,_0x465627();});});}});});});});});return;return _0x293e14(new Error('store.reco'+'nf\x20not\x20imp'+'lemented'));}return{'get':_0x19433f,'put':_0x12fcfe,'append':_0x8d1b82,'del':_0x4ac88a,'reconf':_0x4baae1};}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'(_0x490943){if(!this['store'][_0x490943['gid']])return undefined;return this['store'][_0x490943['gid']][_0x490943['key']];},'put'(_0x41f081,_0x7f1f9d){!this['store'][_0x41f081['gid']]&&(this['store'][_0x41f081['gid']]={}),this['store'][_0x41f081['gid']][_0x41f081['key']]=_0x7f1f9d;},'append'(_0x17f50c,_0x5098da){!this['get'](_0x17f50c)&&this['put'](_0x17f50c,[]),!Array['isArray'](this['get'](_0x17f50c))&&this['put'](_0x17f50c,[this['get'](_0x17f50c)]),Array['isArray'](_0x5098da)?this['put'](_0x17f50c,this['get'](_0x17f50c)['concat'](_0x5098da)):this['store'][_0x17f50c['gid']][_0x17f50c['key']]['push'](_0x5098da);},'del'(_0x1c3d27){if(!this['store'][_0x1c3d27['gid']])return undefined;const _0x344fbd=this['store'][_0x1c3d27['gid']][_0x1c3d27['key']];return delete this['store'][_0x1c3d27['gid']][_0x1c3d27['key']],_0x344fbd;},'toString'(){let _0xdbf02d='';for(const _0x46423a in this['store']){_0xdbf02d+=_0x46423a+':\x20'+JSON['stringify'](this['store'][_0x46423a]);}return _0xdbf02d;}};function normalize(_0x5c6e40){if(_0x5c6e40===null)return{'key':null,'gid':null};else return typeof _0x5c6e40==='string'?{'key':_0x5c6e40,'gid':null}:_0x5c6e40;};function put(_0x41cbc4,_0x5445d5,_0x3a5a8b){log('[mem.put]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x5445d5)+'\x20state:\x20'+JSON['stringify'](_0x41cbc4)+'\x20store:\x20'+kvStore['toString']());let {key:_0x474578,gid:_0x5187b2}=normalize(_0x5445d5);_0x474578=_0x474578||globalThis['distributi'+'on']['util']['id']['getID'](_0x41cbc4),_0x5187b2=_0x5187b2||'local',kvStore['put']({'key':_0x474578,'gid':_0x5187b2},_0x41cbc4),log('[mem.put]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']());if(_0x3a5a8b)return _0x3a5a8b(null,_0x41cbc4);return;return _0x3a5a8b(new Error('mem.put\x20no'+'t\x20implemen'+'ted'));};function append(_0x1e3d54,_0x16c42d,_0x10ee97){log('[mem.appen'+'d]\x20configu'+'ration:\x20'+JSON['stringify'](_0x16c42d)+'\x20state:\x20'+JSON['stringify'](_0x1e3d54)+'\x20store:\x20'+kvStore['toString']());let {key:_0x5ad385,gid:_0x1324dc}=normalize(_0x16c42d);_0x5ad385=_0x5ad385||globalThis['distributi'+'on']['util']['id']['getID'](_0x1e3d54),_0x1324dc=_0x1324dc||'local';if(!_0x5ad385)return _0x10ee97(new Error('Configurat'+'ion\x20key\x20is'+'\x20required\x20'+'for\x20append'));kvStore['append']({'key':_0x5ad385,'gid':_0x1324dc},_0x1e3d54),log('[mem.appen'+'d]\x20store\x20('+'after):\x20'+kvStore['toString']());const _0x6916b9=kvStore['get']({'key':_0x5ad385,'gid':_0x1324dc});if(_0x10ee97)return _0x10ee97(null,_0x6916b9);return;return _0x10ee97(new Error('mem.append'+'\x20not\x20imple'+'mented'));};function get(_0x281f15,_0x286642){log('[mem.get]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x281f15)+'\x20store:\x20'+kvStore['toString']());let {key:_0x3e5999,gid:_0x390e83}=normalize(_0x281f15);_0x390e83=_0x390e83||'local';if(_0x3e5999){const _0x3835b4=kvStore['get']({'key':_0x3e5999,'gid':_0x390e83});return _0x3835b4?_0x286642(null,_0x3835b4):_0x286642(new Error('Memory\x20key'+'\x20\x22'+_0x3e5999+('\x22\x20not\x20foun'+'d\x20for\x20')+_0x390e83+'\x27s\x20store'));}else{let _0x133ce4=kvStore['store'][_0x390e83]||{};return _0x133ce4=Object['keys'](_0x133ce4),_0x286642(null,_0x133ce4);}return;return _0x286642(new Error('mem.get\x20no'+'t\x20implemen'+'ted'));}function del(_0x531e2b,_0x373c66){log('[mem.del]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x531e2b)+'\x20store:\x20'+kvStore['toString']());let {key:_0x10424e,gid:_0x286333}=normalize(_0x531e2b);_0x286333=_0x286333||'local';const _0x14d102=kvStore['del']({'key':_0x10424e,'gid':_0x286333});log('[mem.del]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']());return _0x14d102?_0x373c66(null,_0x14d102):_0x373c66(new Error('Memory\x20key'+'\x20\x22'+_0x10424e+('\x22\x20not\x20foun'+'d\x20for\x20')+_0x286333+'\x27s\x20store'));return;return _0x373c66(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(_0x2badee){if(_0x2badee===null)return{'key':null,'gid':null};else return typeof _0x2badee==='string'?{'key':_0x2badee,'gid':null}:_0x2badee;}function put(_0x46339e,_0x26458e,_0x2e44ff){log('[store.put'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x26458e)+'\x20state:\x20'+JSON['stringify'](_0x46339e)),_0x26458e=normalize(_0x26458e),_0x26458e['key']=_0x26458e['key']||globalThis['distributi'+'on']['util']['id']['getID'](_0x46339e),_0x26458e['gid']=_0x26458e['gid']||'local';const _0xe27021=globalThis['distributi'+'on']['util']['serialize'](_0x46339e),_0x1ae4e7=Buffer['from'](_0x26458e['key'])['toString']('base64'),_0x3a6a1f=path['join'](nodeFolder,_0x26458e['gid']+'-'+_0x1ae4e7);fs['writeFile'](_0x3a6a1f,_0xe27021,_0x3e4123=>{return _0x3e4123?_0x2e44ff(_0x3e4123):_0x2e44ff(null,_0x46339e);});return;return _0x2e44ff(new Error('store.put\x20'+'not\x20implem'+'ented'));}function get(_0x3b5a37,_0x2061f6){log('[store.get'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x3b5a37)),_0x3b5a37=normalize(_0x3b5a37),_0x3b5a37['gid']=_0x3b5a37['gid']||'local';if(!_0x3b5a37['key']){fs['readdir'](nodeFolder,(_0x5669c0,_0x2f0902)=>{if(_0x5669c0)return _0x2061f6(_0x5669c0);const _0x579e45=[];for(let _0x35a615=0xebc+-0x23b*-0xb+-0x2745;_0x35a615<_0x2f0902['length'];_0x35a615++){const _0x28adac=_0x2f0902[_0x35a615]['split']('-'),_0x173ffa=_0x28adac[-0x859*0x1+0x485+0x3d4];if(_0x173ffa!==_0x3b5a37['gid'])continue;const _0x405289=_0x28adac[_0x28adac['length']-(-0xf50+0x1e92*-0x1+0x2de3)];_0x579e45['push'](Buffer['from'](_0x405289,'base64')['toString']());}return _0x2061f6(null,_0x579e45);});return;}const _0x3aade6=Buffer['from'](_0x3b5a37['key'])['toString']('base64'),_0x446187=path['join'](nodeFolder,_0x3b5a37['gid']+'-'+_0x3aade6);fs['readFile'](_0x446187,(_0x399841,_0x23e796)=>{return _0x399841?_0x399841['code']==='ENOENT'?_0x2061f6(new Error('File\x20'+_0x446187+('\x20(from\x20key'+'\x20\x27')+_0x3b5a37['key']+('\x27)\x20not\x20fou'+'nd\x20for\x20gro'+'up\x20')+_0x3b5a37['gid'])):_0x2061f6(_0x399841):_0x2061f6(null,globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x23e796['toString']()));});return;return _0x2061f6(new Error('store.get\x20'+'not\x20implem'+'ented'));}function del(_0x5eca7f,_0xebf973){log('[store.del'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x5eca7f)),_0x5eca7f=normalize(_0x5eca7f),_0x5eca7f['gid']=_0x5eca7f['gid']||'local';const _0x491781=Buffer['from'](_0x5eca7f['key'])['toString']('base64'),_0x29203c=path['join'](nodeFolder,_0x5eca7f['gid']+'-'+_0x491781);get(_0x5eca7f,(_0x5ebc3d,_0x112ef6)=>{if(_0x5ebc3d)return _0xebf973(_0x5ebc3d);fs['rm'](_0x29203c,_0x1c3629=>{return _0x1c3629?_0xebf973(_0x1c3629):_0xebf973(null,_0x112ef6);});});return;return _0xebf973(new Error('store.del\x20'+'not\x20implem'+'ented'));}function append(_0x98b0ed,_0x4dece0,_0x4434b1){log('[store.app'+'end]\x20confi'+'guration:\x20'+JSON['stringify'](_0x4dece0)+'\x20state:\x20'+JSON['stringify'](_0x98b0ed)),_0x4dece0=normalize(_0x4dece0),_0x4dece0['key']=_0x4dece0['key']||globalThis['distributi'+'on']['util']['id']['getID'](_0x98b0ed),_0x4dece0['gid']=_0x4dece0['gid']||'local';const _0x57c074=Buffer['from'](_0x4dece0['key'])['toString']('base64'),_0x248de5=path['join'](nodeFolder,_0x4dece0['gid']+'-'+_0x57c074),_0x24a0b6=_0x4c3552=>{const _0x477cff=globalThis['distributi'+'on']['util']['serialize'](_0x4c3552);fs['writeFile'](_0x248de5,_0x477cff,_0x316dec=>{if(_0x316dec)return _0x4434b1(_0x316dec);return _0x4434b1(null,_0x4c3552);});};fs['readFile'](_0x248de5,(_0xcbc1bf,_0x178c17)=>{if(_0xcbc1bf){if(_0xcbc1bf['code']==='ENOENT'){const _0x34ace0=Array['isArray'](_0x98b0ed)?_0x98b0ed:[_0x98b0ed];return _0x24a0b6(_0x34ace0);}return _0x4434b1(_0xcbc1bf);}let _0x1e51cd;try{_0x1e51cd=globalThis['distributi'+'on']['util']['deserializ'+'e'](_0x178c17['toString']());}catch(_0x441d7d){return _0x4434b1(_0x441d7d);}!Array['isArray'](_0x1e51cd)&&(_0x1e51cd=[_0x1e51cd]);const _0x24be88=Array['isArray'](_0x98b0ed)?_0x1e51cd['concat'](_0x98b0ed):_0x1e51cd['concat']([_0x98b0ed]);return _0x24a0b6(_0x24be88);});return;return _0x4434b1(new Error('store.appe'+'nd\x20not\x20imp'+'lemented'));}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 nativeFunctions={'forward':new Map(),'reverse':new Map()};function createNativeMap(){const
|
|
9
|
+
const nativeFunctions={'forward':new Map(),'reverse':new Map()};function createNativeMap(){const _0x164178=[];function _0x221c6b(_0x487b4f,_0x1db5ae){if(_0x1db5ae===null||_0x1db5ae===undefined)return;if(_0x164178['indexOf'](_0x1db5ae)!==-(-0x25e6+-0x155*0xf+0x39e2))return;_0x164178['push'](_0x1db5ae),Object['getOwnProp'+'ertyNames'](_0x1db5ae)['forEach'](_0x5af9ac=>{if(typeof _0x1db5ae[_0x5af9ac]==='function'){nativeFunctions['forward']['set'](_0x1db5ae[_0x5af9ac],_0x487b4f+'.'+_0x5af9ac),nativeFunctions['reverse']['set'](_0x487b4f+'.'+_0x5af9ac,_0x1db5ae[_0x5af9ac]);return;}typeof _0x1db5ae[_0x5af9ac]==='object'&&_0x164178['indexOf'](_0x1db5ae[_0x5af9ac])===-(-0x228e*0x1+-0x5d0+0x285f)&&_0x221c6b(_0x487b4f+'.'+_0x5af9ac,_0x1db5ae[_0x5af9ac]);});}for(const _0x2fd67d of require('repl')['_builtinLi'+'bs']){if(['wasi','sys','punycode','crypto']['includes'](_0x2fd67d))continue;const _0x1e7037=require(_0x2fd67d);_0x221c6b(_0x2fd67d,_0x1e7037);}}createNativeMap();function decycleObject(_0x21aecc){if(_0x21aecc===null||_0x21aecc===undefined)return _0x21aecc;const _0x32baf2=new WeakMap();function _0x7fe6c0(_0x20d751,_0x21c2c9){let _0x28e4d4;if(!(typeof _0x20d751==='object'&&!(_0x20d751 instanceof Error)&&!(_0x20d751 instanceof Date)&&!(_0x20d751 instanceof Boolean)&&_0x20d751!==null))return _0x20d751;const _0x52e6e6=_0x32baf2['get'](_0x20d751);if(_0x52e6e6!==undefined)return{'$reference':_0x52e6e6};return _0x32baf2['set'](_0x20d751,_0x21c2c9),Array['isArray'](_0x20d751)?(_0x28e4d4=[],_0x20d751['forEach'](function(_0x9b0f5d,_0x16535e){const _0x8bafd1=[..._0x21c2c9,_0x16535e];_0x28e4d4[_0x16535e]=_0x7fe6c0(_0x9b0f5d,_0x8bafd1);})):(_0x28e4d4={},Object['keys'](_0x20d751)['forEach'](_0x3ff09a=>{const _0x435cce=[..._0x21c2c9,JSON['stringify'](_0x3ff09a)];_0x28e4d4[_0x3ff09a]=_0x7fe6c0(_0x20d751[_0x3ff09a],_0x435cce);})),_0x28e4d4;}return _0x7fe6c0(_0x21aecc,[]);}function serializeBaseStructure(_0x37ef23){return{'type':typeof _0x37ef23,'value':_0x37ef23['toString']()};}function serializeBigInt(_0x2c05d5){return{'type':'bigint','value':_0x2c05d5['toString']()};}function serializeUndefined(_0x538837){return{'type':'undefined','value':''};}function serializeObject(_0x5d46ea){if(_0x5d46ea===null)return{'type':'null','value':''};else{if(_0x5d46ea instanceof Date)return{'type':'date','value':_0x5d46ea['toJSON']()};else{if(_0x5d46ea instanceof Error)return{'type':'error','value':serializeObject({'name':_0x5d46ea['name'],'message':_0x5d46ea['message'],'cause':_0x5d46ea['cause']})};}}if(_0x5d46ea['$reference']!==undefined&&Object['keys'](_0x5d46ea)['length']===0x132+-0x191a+0x17e9)return{'type':'reference','value':_0x5d46ea['$reference']};const _0x21595b=Object['fromEntrie'+'s'](Object['entries'](_0x5d46ea)['map'](([_0xb7b85e,_0x3573b9])=>{const _0xede808=serialize(_0x3573b9);return[_0xb7b85e,JSON['parse'](_0xede808)];}));return{'type':_0x5d46ea instanceof Array?'array':'object','value':_0x21595b};}function serializeFunction(_0x480fed){const _0x316507=nativeFunctions['forward']['get'](_0x480fed);return _0x316507===undefined?{'type':'function','value':_0x480fed['toString']()}:{'type':'native','value':_0x316507};}function serialize(_0x433a59){_0x433a59=decycleObject(_0x433a59);let _0x33ef51;switch(typeof _0x433a59){case'object':_0x33ef51=serializeObject(_0x433a59);break;case'function':_0x33ef51=serializeFunction(_0x433a59);break;case'undefined':_0x33ef51=serializeUndefined(_0x433a59);break;case'number':case'string':case'boolean':_0x33ef51=serializeBaseStructure(_0x433a59);break;case'bigint':_0x33ef51=serializeBigInt(_0x433a59);break;}return JSON['stringify'](_0x33ef51);}function deserializeObject(_0x527ff1,_0x42ee51){for(const [_0x1f2cf1,_0x2dfd16]of Object['entries'](_0x527ff1)){_0x42ee51[_0x1f2cf1]=doSerialize(_0x2dfd16,_0x42ee51);}return _0x42ee51;}function deserializeArray(_0x140ec7,_0x18a9d8){for(const [_0xdf5c8e,_0x572b3e]of Object['entries'](_0x140ec7)){_0x18a9d8[Number(_0xdf5c8e)]=doSerialize(_0x572b3e,_0x18a9d8);}return _0x18a9d8;}function deserializeString(_0x29ba21){return _0x29ba21;}function deserializeNumber(_0x243099){return Number(_0x243099);}function deserializeFunction(_0x860ff0){return new Function('return\x20'+_0x860ff0)();}function deserializeError(_0x490678){const _0x5bbd89=doSerialize(_0x490678),_0x17d34d=new Error(_0x5bbd89['message'],_0x5bbd89['cause']);return _0x17d34d;}function deserializeReference(_0x57dd50,_0x197ca1){let _0x324395=_0x197ca1;for(const _0x22cded of _0x57dd50){_0x324395=_0x324395[JSON['parse'](_0x22cded)];}return _0x324395;}function deserializeNative(_0x124c24){const _0x4f69ff=nativeFunctions['reverse']['get'](_0x124c24);if(_0x4f69ff===undefined)throw Error('Function\x20n'+'ot\x20found\x20i'+'n\x20native\x20f'+'unction\x20ma'+'p');return _0x4f69ff;}function deserializeReferences(_0x25efc1,_0x1a1857){if(typeof _0x25efc1!=='object'||_0x25efc1===null)return _0x25efc1;if(_0x25efc1['type']==='reference')return deserializeReference(_0x25efc1['value'],_0x1a1857);if(Array['isArray'](_0x25efc1))for(let _0x3d7be3=-0x243d+-0xcb3*0x1+0x74*0x6c;_0x3d7be3<_0x25efc1['length'];_0x3d7be3++){_0x25efc1[_0x3d7be3]=deserializeReferences(_0x25efc1[_0x3d7be3],_0x1a1857);}else for(const [_0xfee1ff,_0x3090c5]of Object['entries'](_0x25efc1)){_0x25efc1[_0xfee1ff]=deserializeReferences(_0x3090c5,_0x1a1857);}return _0x25efc1;}function doSerialize(_0x2acb65,_0x53cfb9=null){let _0x4bf04b;if(typeof _0x2acb65==='object')_0x4bf04b=_0x2acb65;else{if(typeof _0x2acb65==='string')_0x4bf04b=JSON['parse'](_0x2acb65);else throw new Error('Invalid\x20ar'+'gument\x20typ'+'e:\x20'+typeof _0x2acb65+'.');}_0x53cfb9===null&&(_0x53cfb9={});switch(_0x4bf04b['type']){case'object':return deserializeObject(_0x4bf04b['value'],{});case'array':return deserializeArray(_0x4bf04b['value'],[]);case'function':return deserializeFunction(_0x4bf04b['value']);case'native':return deserializeNative(_0x4bf04b['value']);case'reference':return _0x4bf04b;case'number':return deserializeNumber(_0x4bf04b['value']);case'string':return deserializeString(_0x4bf04b['value']);case'boolean':return _0x4bf04b['value']==='true';case'bigint':return BigInt(_0x4bf04b['value']);case'date':return new Date(_0x4bf04b['value']);case'error':return deserializeError(_0x4bf04b['value']);case'null':return null;case'undefined':return undefined;default:throw new Error('Invalid\x20se'+'rialized\x20o'+'bject\x20type');}}function deserialize(_0x13f335){if(typeof _0x13f335!=='string')throw new Error('Invalid\x20ar'+'gument\x20typ'+'e:\x20'+typeof _0x13f335+'.');const _0x3c86f0=doSerialize(_0x13f335);return deserializeReferences(_0x3c86f0,_0x3c86f0),_0x3c86f0;}module['exports']={'serialize':serialize,'deserialize':deserialize};
|
|
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');globalThis['toLocal']=new Map();function createRPC(
|
|
9
|
+
const log=require('../util/lo'+'g.js');globalThis['toLocal']=new Map();function createRPC(_0x4d2a9b){const _0x144604=globalThis['distributi'+'on']['util']['id']['getID'](globalThis['distributi'+'on']['util']['serialize'](_0x4d2a9b));globalThis['toLocal']['set'](_0x144604,_0x4d2a9b);let _0x73c7f4='\x0a\x20\x20\x20\x20const'+'\x20callback\x20'+'=\x20args.pop'+'();\x0a\x0a\x20\x20\x20\x20l'+'et\x20remote\x20'+'=\x20{node:\x20'+JSON['stringify'](globalThis['distributi'+'on']['node']['config'])+(',\x20service:'+'\x20\x27')+_0x144604+('\x27,\x20method:'+'\x20\x27call\x27};\x0a'+'\x20\x20\x20\x20let\x20me'+'ssage\x20=\x20ar'+'gs;\x0a\x0a\x20\x20\x20\x20d'+'istributio'+'n.local.co'+'mm.send(me'+'ssage,\x20rem'+'ote,\x20(erro'+'r,\x20respons'+'e)\x20=>\x20{\x0a\x20\x20'+'\x20\x20\x20\x20if\x20(er'+'ror)\x20{\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20callb'+'ack(error)'+';\x0a\x20\x20\x20\x20\x20\x20}\x20'+'else\x20{\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20callb'+'ack(null,\x20'+'response);'+'\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20'+'\x20\x20\x20});\x0a\x20\x20');return log('Created\x20RP'+'C\x20with\x20id:'+'\x20'+_0x144604),new Function('...args',_0x73c7f4);}function toAsync(_0x3e8a82){log('Converting'+'\x20function\x20'+'to\x20async:\x20'+_0x3e8a82['name']+':\x20'+_0x3e8a82['toString']()['replace'](/\n/g,'|'));const _0x215433=(..._0x4c5175)=>{const _0x3c60f6=_0x4c5175['pop']();try{const _0x1277ef=_0x3e8a82(..._0x4c5175);return _0x3c60f6(null,_0x1277ef);}catch(_0x5c8845){return _0x3c60f6(_0x5c8845);}};return _0x215433['toString']=()=>_0x3e8a82['toString'](),_0x215433;}function dispatchMessage(_0x18869b,_0x4845ac,{key:_0x37ac02},_0x32a048,_0x58581d){globalThis['distributi'+'on'][_0x32a048['gid']]['status']['get']('nid',(_0x30046d,_0x3aca81)=>{const _0x5ad82a=Object['values'](_0x3aca81),_0x1396e3=globalThis['distributi'+'on']['util']['id']['getID'](_0x37ac02),_0x115a9c=_0x32a048['hash'](_0x1396e3,_0x5ad82a),_0x327b03=_0x115a9c['substring'](0x4d*-0x1b+-0xd13*0x2+0x2245,-0x682+0x3f*0x49+0x30*-0x3d);globalThis['distributi'+'on']['local']['groups']['get'](_0x32a048['gid'],(_0x37f1ad,_0x55b29d)=>{if(_0x55b29d){const _0x4815ff=_0x55b29d[_0x327b03];globalThis['distributi'+'on']['local']['comm']['send'](_0x18869b,{..._0x4845ac,'node':_0x4815ff},_0x58581d);}else return _0x58581d(_0x37f1ad);});});}module['exports']={'createRPC':createRPC,'toAsync':toAsync,'dispatchMessage':dispatchMessage};
|
|
10
10
|
/* eslint-enable */
|