@brown-ds/distribution 0.0.44 → 0.0.45
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/README.md
CHANGED
|
@@ -21,11 +21,11 @@ By default, tests excluding those with non-distribution in their names are run.
|
|
|
21
21
|
|
|
22
22
|
### Running Tests
|
|
23
23
|
|
|
24
|
-
1.
|
|
24
|
+
1. Run all regular tests (default):
|
|
25
25
|
```sh
|
|
26
26
|
$ npm test
|
|
27
27
|
```
|
|
28
|
-
2.
|
|
28
|
+
2. Run scenario tests:
|
|
29
29
|
```sh
|
|
30
30
|
$ npm test -- -c
|
|
31
31
|
```
|
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(_0x4ad3a9,_0xf7c916,_0x5d2cfc){typeof _0xf7c916==='object'&&(_0xf7c916=_0xf7c916['key']),distribution[_0x4ad3a9['gid']]['status']['get']('nid',(_0x23760d,_0x3b44e9)=>{const _0x1c5729=Object['values'](_0x3b44e9),_0x5befe3=util['id']['getID'](_0xf7c916),_0x2896e6=_0x4ad3a9['hash'](_0x5befe3,_0x1c5729),_0x2bf7a2=_0x2896e6['substring'](0xa07+-0x322*-0x8+-0x2317*0x1,0x50b*0x2+0x2485+-0x174b*0x2);distribution['local']['groups']['get'](_0x4ad3a9['gid'],(_0x273e38,_0x107c25)=>{const _0x52d151=_0x107c25[_0x2bf7a2];log('[mem\x20(getN'+'ode)]\x20conf'+'iguration:'+'\x20'+JSON['stringify'](_0xf7c916)+'group:\x20'+JSON['stringify'](_0x107c25)+'\x20node:\x20'+JSON['stringify'](_0x52d151)+'nid:\x20'+JSON['stringify'](_0x2896e6)+'\x20sid:\x20'+JSON['stringify'](_0x2bf7a2)),_0x5d2cfc(_0x52d151);});});}function normalize(_0x2d17db,_0x5379c4){const _0x1dcae2={};_0x2d17db===null&&(_0x2d17db={});if(typeof _0x2d17db==='string')_0x1dcae2['key']=_0x2d17db,_0x1dcae2['gid']=_0x5379c4,_0x1dcae2['action']='put';else typeof _0x2d17db==='object'&&(_0x1dcae2['key']=_0x2d17db['key'],_0x1dcae2['gid']=_0x2d17db['gid']||_0x5379c4,_0x1dcae2['action']=_0x2d17db['action']||'put');return _0x1dcae2;};function mem(_0x5e75cd){const _0x4d8e3b={};return _0x4d8e3b['gid']=_0x5e75cd['gid']||'all',_0x4d8e3b['hash']=_0x5e75cd['hash']||util['id']['naiveHash'],{'get':(_0xa07fc5,_0x37158d)=>{if(!_0xa07fc5){const _0x2d53f2=[{'key':null,'gid':_0x4d8e3b['gid']}];distribution[_0x4d8e3b['gid']]['comm']['send'](_0x2d53f2,{'service':'mem','method':'get'},(_0x204022,_0x567384)=>{const _0x1c4fe4=Object['values'](_0x567384)['reduce']((_0x5288fa,_0x2d7964)=>_0x5288fa['concat'](_0x2d7964),[]);_0x37158d(_0x204022,_0x1c4fe4);});return;}_0xa07fc5=normalize(_0xa07fc5,_0x4d8e3b['gid']),getNode(_0x4d8e3b,_0xa07fc5,_0x5d4966=>{const _0x2aa6f8=[_0xa07fc5],_0xfb8bbd={'service':'mem','method':'get','node':_0x5d4966};log('[all.mem.g'+'et]\x20config'+'uration:\x20'+JSON['stringify'](_0xa07fc5)+'\x20node:\x20'+JSON['stringify'](global['nodeConfig'])+('\x20target\x20no'+'de:\x20')+JSON['stringify'](_0x5d4966)),distribution['local']['comm']['send'](_0x2aa6f8,_0xfb8bbd,_0x37158d);});},'put':(_0x501416,_0x8d8325,_0x33543b)=>{_0x8d8325=_0x8d8325||util['id']['getID'](_0x501416),_0x8d8325=normalize(_0x8d8325,_0x4d8e3b['gid']),getNode(_0x4d8e3b,_0x8d8325,_0x310d10=>{const _0xeb3185=[_0x501416,_0x8d8325],_0x4afffb={'service':'mem','method':'put','node':_0x310d10};log('[all.mem.p'+'ut]\x20state:'+'\x20'+JSON['stringify'](_0x501416)+('configurat'+'ion:\x20')+JSON['stringify'](_0x8d8325)+('target\x20nod'+'e:\x20')+JSON['stringify'](_0x310d10)),distribution['local']['comm']['send'](_0xeb3185,_0x4afffb,_0x33543b);});},'del':(_0x3d2ae9,_0xeed2eb)=>{getNode(_0x4d8e3b,_0x3d2ae9,_0xbcc298=>{const _0x3955f1=[{'key':_0x3d2ae9,'gid':_0x4d8e3b['gid']}],_0x39d846={'service':'mem','method':'del','node':_0xbcc298};distribution['local']['comm']['send'](_0x3955f1,_0x39d846,_0xeed2eb);});},'reconf':(_0x2e09eb,_0x58e9f5)=>{distribution[_0x4d8e3b['gid']]['mem']['get'](null,(_0x19f449,_0x26105a)=>{distribution[_0x4d8e3b['gid']]['status']['get']('nid',(_0x19cea5,_0x58e0c2)=>{const _0x4b8977=Object['values'](_0x58e0c2),_0x57e25a=Object['values'](_0x2e09eb)['map'](_0xc5d20e=>util['id']['getNID'](_0xc5d20e));log('[mem.recon'+'f\x20received'+'\x20'+_0x26105a['length']+('\x20keys\x20from'+'\x20')+_0x58e0c2['length']+'\x20nodes');let _0xa11d7a=0x14a9+0x929*-0x3+0x6d2;const _0x4f2592=()=>{_0xa11d7a===_0x26105a['length']&&_0x58e9f5();};if(_0x26105a['length']===0x26c0+-0x19*-0xca+0x1d3d*-0x2){_0x58e9f5();return;}for(const _0x3f5f53 of _0x26105a){const _0x11ce1f=util['id']['getID'](_0x3f5f53),_0x45440f=_0x4d8e3b['hash'](_0x11ce1f,_0x57e25a),_0x734746=_0x4d8e3b['hash'](_0x11ce1f,_0x4b8977);log('[mem.recon'+'f]\x20old\x20nid'+':\x20'+_0x45440f+'\x20new\x20nid:\x20'+_0x734746);if(_0x45440f===_0x734746){_0xa11d7a++,_0x4f2592();continue;}const _0x1f2b12=_0x2e09eb[_0x45440f['substring'](-0x1*0x4a3+0x13c0*0x1+-0xf1d,0x234a+-0xfb6*-0x1+-0x32fb)],_0x56fd90=[{'key':_0x3f5f53,'gid':_0x4d8e3b['gid']}],_0x49c988={'service':'mem','method':'del','node':_0x1f2b12};log('[mem.recon'+'f]\x20deletin'+'g\x20key\x20'+_0x3f5f53+'\x20from\x20'+JSON['stringify'](_0x49c988)),distribution['local']['comm']['send'](_0x56fd90,_0x49c988,(_0x35d942,_0x1d57f4)=>{distribution[_0x4d8e3b['gid']]['mem']['put'](_0x1d57f4,_0x3f5f53,(_0x280206,_0x5801af)=>{_0xa11d7a++,_0x4f2592();});});}});});}};};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(_0x462fee){const _0x50884d={'gid':_0x462fee['gid']||'global'};function _0x149476(_0x14d54c,_0xb7dd0f){const _0x2388d2=id['getSID'](_0x14d54c),_0x4b7098={'mapper':_0x14d54c['map'],'reducer':_0x14d54c['reduce'],'map':function(_0x977dec,_0x51296c,_0x4d6109,_0x18075a){if(_0x977dec['length']==0x1a8b+-0x2680+0xbf5)_0x18075a(null,{});else{const _0x26f165=[];let _0x3b008b=-0x70e+-0x43*-0x2+0x4c*0x16;_0x977dec['forEach'](_0x2664a8=>{distribution[_0x51296c]['store']['get'](_0x2664a8,(_0x1f70bd,_0x38e222)=>{_0x3b008b++;const _0x2ca044=this['mapper'](_0x2664a8,_0x38e222);Array['isArray'](_0x2ca044)?_0x26f165['push'](..._0x2ca044):_0x26f165['push'](_0x2ca044),_0x3b008b==_0x977dec['length']&&distribution['local']['store']['put'](_0x26f165,_0x4d6109+'_map',(_0x2216d8,_0x596883)=>{_0x18075a(_0x2216d8,_0x26f165);});});});}},'shuffle':function(_0x19e3af,_0x267741,_0x24b4b4){distribution['local']['store']['get'](_0x267741+'_map',(_0x1e4656,_0x532ce9)=>{if(!_0x1e4656){let _0x255c91=-0x4*0x7e9+0x1eb5+0xef;_0x532ce9['forEach'](_0x3827bd=>{const [_0x155b71]=Object['keys'](_0x3827bd);distribution[_0x19e3af]['mem']['put'](_0x3827bd[_0x155b71],{'key':_0x155b71,'action':'append'},(_0x1df586,_0x41c9a8)=>{_0x255c91++,_0x255c91==_0x532ce9['length']&&_0x24b4b4(null,_0x532ce9);});});}else _0x24b4b4(_0x1e4656,{});});},'reduce':function(_0x96312,_0x28135c,_0x430a4c){distribution['local']['mem']['get']({'key':null,'gid':_0x96312},(_0xecbade,_0xfb2a8c)=>{let _0x5030ed=[],_0x1603e0=-0x966*0x3+-0x3b*0x64+-0x1*-0x333e;_0xfb2a8c['length']==-0x3b7+-0x819*-0x2+-0xc7b&&_0x430a4c(null,null),_0xfb2a8c['forEach'](_0x55ad4a=>distribution['local']['mem']['get']({'key':_0x55ad4a,'gid':_0x96312},(_0x5f3ff8,_0x2ab892)=>{const _0x2ca846=this['reducer'](_0x55ad4a,_0x2ab892);_0x5030ed=_0x5030ed['concat'](_0x2ca846),_0x1603e0++,_0x1603e0==_0xfb2a8c['length']&&_0x430a4c(null,_0x5030ed);}));});}},_0x358e36=function(_0x3c9ead,_0x3f26ed){const _0x7a0bf1={};return Object['keys'](_0x3f26ed)['forEach'](_0x48d179=>{_0x7a0bf1[_0x48d179]=[];}),_0x3c9ead['forEach'](_0x86ab5d=>{const _0x458b3c=id['getID'](_0x86ab5d),_0x47e494=id['naiveHash'](_0x458b3c,Object['keys'](_0x3f26ed));_0x7a0bf1[_0x47e494]['push'](_0x86ab5d);}),_0x7a0bf1;};distribution[_0x50884d['gid']]['routes']['put'](_0x4b7098,'mr-'+_0x2388d2,(_0x45f336,_0x25b51b)=>{distribution['local']['groups']['get'](_0x50884d['gid'],(_0x5e071e,_0x55a50f)=>{const _0x313f9c=_0x358e36(_0x14d54c['keys'],_0x55a50f);let _0x2a1d4d=-0x1a7e*-0x1+0x267a+-0x40f8;const _0x5b62bc=Object['keys'](_0x55a50f)['length'],_0x3751c0={'service':'mr-'+_0x2388d2,'method':'map'};for(const _0x46a531 in _0x55a50f){_0x3751c0['node']=_0x55a50f[_0x46a531];const _0x4078fd=[_0x313f9c[_0x46a531],_0x50884d['gid'],_0x2388d2];distribution['local']['comm']['send'](_0x4078fd,_0x3751c0,(_0x5c3dce,_0x458883)=>{++_0x2a1d4d;if(_0x2a1d4d==_0x5b62bc){const _0x30af82={'service':'mr-'+_0x2388d2,'method':'shuffle'};distribution[_0x50884d['gid']]['comm']['send']([_0x50884d['gid'],_0x2388d2],_0x30af82,(_0x1fb6fe,_0x43b114)=>{const _0x201459={'service':'mr-'+_0x2388d2,'method':'reduce'};distribution[_0x50884d['gid']]['comm']['send']([_0x50884d['gid'],_0x2388d2],_0x201459,(_0x394764,_0x5388e0)=>{let _0xd16900=[];for(const _0x518317 of Object['values'](_0x5388e0)){_0x518317!==null&&(_0xd16900=_0xd16900['concat'](_0x518317));}_0xb7dd0f(null,_0xd16900);return;distribution[_0x50884d['gid']]['routes']['rem']('mr-'+_0x2388d2,(_0x423ffa,_0x30da0f)=>{});});});}});}});});}return{'exec':_0x149476};};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(_0x19ab05,_0x47382d,_0x34e933){log('[comm.send'+']:\x20Sending'+'\x20'+JSON['stringify'](_0x19ab05)+'to\x20'+_0x47382d['service']+':'+_0x47382d['method']+'\x20on\x20'+_0x47382d['node']['ip']+':'+_0x47382d['node']['port']);if(!_0x19ab05 instanceof Array)throw new Error('Message\x20mu'+'st\x20be\x20an\x20a'+'rray');const _0x4f2af8=_0x47382d['node'],_0x136253=_0x47382d['service'],_0x189283=_0x47382d['method'],_0x4e16b7=serialization['serialize'](_0x19ab05),_0x28a281={'hostname':_0x4f2af8['ip'],'port':_0x4f2af8['port'],'path':'/'+_0x136253+'/'+_0x189283,'method':'PUT','headers':{'Content-Type':'applicatio'+'n/json','Content-Length':Buffer['byteLength'](_0x4e16b7)}},_0x3c44a9=http['request'](_0x28a281,_0x2f5d1f=>{let _0xdda473='';_0x2f5d1f['on']('data',function(_0x169cce){_0xdda473+=_0x169cce;}),_0x2f5d1f['on']('end',function(){_0x34e933&&_0x34e933(...serialization['deserializ'+'e'](_0xdda473));}),_0x2f5d1f['on']('error',function(_0x40a4c2){_0x34e933&&_0x34e933(new Error('Error\x20on\x20r'+'esponse'));});});_0x3c44a9['on']('error',function(_0x41a17d){_0x34e933&&_0x34e933(new Error(_0x41a17d));}),_0x3c44a9['write'](_0x4e16b7),_0x3c44a9['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'(_0x2e2196){if(!this['store'][_0x2e2196['gid']])return undefined;return this['store'][_0x2e2196['gid']][_0x2e2196['key']];},'put'(_0x59ae73,_0x5d9a55){!this['store'][_0x59ae73['gid']]&&(this['store'][_0x59ae73['gid']]=new Map()),this['store'][_0x59ae73['gid']][_0x59ae73['key']]=_0x5d9a55;},'append'(_0x5dc886,_0x4422a1){!this['get'](_0x5dc886)&&this['put'](_0x5dc886,[]),!Array['isArray'](this['get'](_0x5dc886))&&this['put'](_0x5dc886,[this['get'](_0x5dc886)]),Array['isArray'](_0x4422a1)?this['put'](_0x5dc886,this['get'](_0x5dc886)['concat'](_0x4422a1)):this['store'][_0x5dc886['gid']][_0x5dc886['key']]['push'](_0x4422a1);},'del'(_0x13da85){if(!this['store'][_0x13da85['gid']])return undefined;const _0x51f639=this['store'][_0x13da85['gid']][_0x13da85['key']];return delete this['store'][_0x13da85['gid']][_0x13da85['key']],_0x51f639;},'toString'(){let _0x1f8be8='';for(const _0x2534c2 in this['store']){_0x1f8be8+=_0x2534c2+':\x20'+JSON['stringify'](this['store'][_0x2534c2]);}return _0x1f8be8;}};function normalize(_0x2222f1){const _0x2a5b0f={};_0x2222f1===null&&(_0x2222f1={});if(typeof _0x2222f1==='string')_0x2a5b0f['key']=_0x2222f1,_0x2a5b0f['gid']='local',_0x2a5b0f['action']='put';else typeof _0x2222f1==='object'&&(_0x2a5b0f['key']=_0x2222f1['key'],_0x2a5b0f['gid']=_0x2222f1['gid'],_0x2a5b0f['action']=_0x2222f1['action']);return _0x2a5b0f;};function put(_0x4e0269,_0x3a80ee,_0x56fee1){log('[mem.put]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x3a80ee)+'state:\x20'+JSON['stringify'](_0x4e0269)+'\x20store:\x20'+kvStore['toString']()),_0x56fee1=_0x56fee1||function(){},_0x3a80ee=normalize(_0x3a80ee),_0x3a80ee['key']=_0x3a80ee['key']||id['getID'](_0x4e0269),_0x3a80ee['gid']=_0x3a80ee['gid']||'local',_0x3a80ee['action']=_0x3a80ee['action']||'put',kvStore[_0x3a80ee['action']](_0x3a80ee,_0x4e0269),log('[mem.put]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']()),_0x56fee1&&_0x56fee1(null,_0x4e0269);};function get(_0x2361d3,_0x384536){log('[mem.get]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x2361d3)+'\x20store:\x20'+kvStore['toString']()),_0x384536=_0x384536||function(){},_0x2361d3=normalize(_0x2361d3),_0x2361d3['gid']=_0x2361d3['gid']||'local';if(!_0x2361d3['key']){let _0x504bbb=kvStore['store'][_0x2361d3['gid']]||{};_0x504bbb=Object['keys'](_0x504bbb),_0x384536(null,_0x504bbb);return;}const _0x563be5=kvStore['get'](_0x2361d3);_0x563be5?_0x384536(null,_0x563be5):_0x384536(new Error('Memory\x20key'+'\x20\x22'+_0x2361d3['key']+('\x22\x20\x0a\x20\x20\x20\x20\x20\x20\x20'+'\x20not\x20found'+'\x20for\x20')+_0x2361d3['gid']+'\x27s\x20store'));}function del(_0x5afc0d,_0x187da8){log('[mem.del]\x20'+'configurat'+'ion:\x20'+JSON['stringify'](_0x5afc0d)+'\x20store:\x20'+kvStore['toString']()),_0x187da8=_0x187da8||function(){},_0x5afc0d=normalize(_0x5afc0d);const _0x5cb5b9=kvStore['del'](_0x5afc0d);log('[mem.del]\x20'+'store\x20(aft'+'er):\x20'+kvStore['toString']()),_0x5cb5b9?_0x187da8(null,_0x5cb5b9):_0x187da8(new Error('Memory\x20key'+'\x20\x22'+_0x5afc0d['key']+('\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+'not\x20found\x20'+'for\x20')+_0x5afc0d['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 log=require('../util/lo'+'g'),routesStore=new Map();function get(
|
|
9
|
+
const log=require('../util/lo'+'g'),routesStore=new Map();function get(_0x3d8a2d,_0x4a4280){log('[routes.ge'+'t]\x20Getting'+'\x20service:\x20'+_0x3d8a2d);if(!_0x4a4280)return;if(_0x3d8a2d in routesStore){log('[routes.ge'+'t]\x20Found\x20s'+'ervice:\x20'+_0x3d8a2d);const _0x3fa0a2=routesStore[_0x3d8a2d];_0x4a4280(null,_0x3fa0a2);}else{const _0x342a96=global['toLocal']['get'](_0x3d8a2d);_0x342a96?(log('[routes.ge'+'t]\x20Found\x20R'+'PC:\x20'+_0x3d8a2d),_0x4a4280(null,{'call':_0x342a96})):_0x4a4280(new Error('Service\x20'+_0x3d8a2d+('\x20not\x20found'+'\x20in\x20routes')));}}function put(_0x1bb5be,_0x1c620e,_0x1d5665){log('[routes.pu'+'t]\x20Putting'+'\x20service:\x20'+_0x1c620e),routesStore[_0x1c620e]=_0x1bb5be;_0x1d5665&&_0x1d5665(null,_0x1c620e);;}function rem(_0x566886,_0x4e261a){const _0x1495ec=routesStore[_0x566886];delete routesStore[_0x566886],_0x4e261a(null,_0x1495ec);};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(_0x173044){const _0x15fbb0={};_0x173044===null&&(_0x173044={});if(typeof _0x173044==='string')_0x15fbb0['key']=_0x173044,_0x15fbb0['gid']='local';else typeof _0x173044==='object'&&(_0x15fbb0['key']=_0x173044['key'],_0x15fbb0['gid']=_0x173044['gid']);return _0x15fbb0;};function put(_0x274319,_0x2c12e7,_0x5a4856){_0x5a4856=_0x5a4856||function(){},_0x2c12e7=normalize(_0x2c12e7),_0x2c12e7['key']=_0x2c12e7['key']||id['getID'](_0x274319),_0x2c12e7['gid']=_0x2c12e7['gid']||'local';const _0x4641e9=serialization['serialize'](_0x274319);let _0x1c0053=Buffer['from'](_0x2c12e7['key'])['toString']('base64');_0x1c0053=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x2c12e7['gid']+'-'+_0x1c0053,log('[store.put'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x2c12e7)+'\x20state:\x20'+JSON['stringify'](_0x274319)+('\x20filename:'+'\x20')+_0x1c0053),fs['writeFile'](_0x1c0053,_0x4641e9,_0x337244=>{_0x337244?_0x5a4856(_0x337244):_0x5a4856(null,_0x274319);});}function get(_0x284c92,_0x44f6ed){_0x44f6ed=_0x44f6ed||function(){},_0x284c92=normalize(_0x284c92),_0x284c92['gid']=_0x284c92['gid']||'local';if(!_0x284c92['key']){fs['readdir'](baseFolder+'/s-'+global['moreStatus']['sid'],(_0xeaf544,_0x334b07)=>{if(_0xeaf544)_0x44f6ed(_0xeaf544);else{const _0x35ae85=[];for(let _0x185297=0x4f6*0x1+-0x10c3+0xbcd;_0x185297<_0x334b07['length'];_0x185297++){let _0x3258b6=_0x334b07[_0x185297]['split']('-');const _0x9b8808=_0x3258b6[-0xa5e+-0xda3*-0x1+0x3*-0x117];if(_0x9b8808!==_0x284c92['gid'])continue;_0x3258b6=_0x3258b6[_0x3258b6['length']-(0x1b1a+-0x317*0xb+-0x31*-0x24)],_0x35ae85['push'](Buffer['from'](_0x3258b6,'base64')['toString']());}_0x44f6ed(null,_0x35ae85);}});return;}let _0x3bb2cc=Buffer['from'](_0x284c92['key'])['toString']('base64');_0x3bb2cc=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x284c92['gid']+'-'+_0x3bb2cc,log('[store.get'+']\x20configur'+'ation:\x20'+JSON['stringify'](_0x284c92)+('\x20filename:'+'\x20')+_0x3bb2cc),fs['readFile'](_0x3bb2cc,(_0xe074bf,_0x5c350e)=>{_0xe074bf?_0xe074bf['code']==='ENOENT'?_0x44f6ed(new Error('File\x20'+_0x3bb2cc+('\x20(from\x20key'+'\x20\x27')+_0x284c92['key']+('\x27)\x20not\x20fou'+'nd\x20for\x20gro'+'up\x20')+_0x284c92['gid'])):_0x44f6ed(_0xe074bf):_0x44f6ed(null,serialization['deserializ'+'e'](_0x5c350e['toString']()));});}function del(_0x2379d0,_0x32aaef){_0x32aaef=_0x32aaef||function(){},_0x2379d0=normalize(_0x2379d0);let _0x494c23=Buffer['from'](_0x2379d0['key'])['toString']('base64');_0x494c23=baseFolder+'/s-'+global['moreStatus']['sid']+'/'+_0x2379d0['gid']+'-'+_0x494c23,get(_0x2379d0,(_0x43cbcc,_0x5920ba)=>{if(_0x43cbcc){_0x32aaef(_0x43cbcc);return;}fs['rm'](_0x494c23,_0xdc2e=>{_0xdc2e?_0x32aaef(_0xdc2e):_0x32aaef(null,_0x5920ba);});});}module['exports']={'put':put,'get':get,'del':del};
|
|
10
10
|
/* eslint-enable */
|