@brown-ds/distribution 0.0.39 → 0.0.41
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.
|
@@ -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 groups=function(
|
|
9
|
+
const groups=function(_0x3d6e23){let _0x539a05={};return _0x539a05['gid']=_0x3d6e23['gid']||'global',{'put':(_0x3bd42f,_0x142d63,_0x2c6680)=>{global['distributi'+'on'][_0x539a05['gid']]['comm']['send']([_0x3bd42f,_0x142d63],{'service':'groups','method':'put'},_0x2c6680);},'del':(_0x3e1894,_0x10dbe6)=>{global['distributi'+'on'][_0x539a05['gid']]['comm']['send']([_0x3e1894],{'service':'groups','method':'del'},_0x10dbe6);},'get':(_0x51b365,_0x2f5287)=>{global['distributi'+'on'][_0x539a05['gid']]['comm']['send']([_0x51b365],{'service':'groups','method':'get'},_0x2f5287);},'add':(_0x1c572c,_0x3f97c9,_0x52f43a)=>{global['distributi'+'on'][_0x539a05['gid']]['comm']['send']([_0x1c572c,_0x3f97c9],{'service':'groups','method':'add'},_0x52f43a);},'rem':(_0x5ca29b,_0x315e62,_0x5eb9a2)=>{global['distributi'+'on'][_0x539a05['gid']]['comm']['send']([_0x5ca29b,_0x315e62],{'service':'groups','method':'rem'},_0x5eb9a2);}};};module['exports']=groups;
|
|
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(),routes={};routes['get']=function(
|
|
9
|
+
const log=require('../util/lo'+'g'),routesStore=new Map(),routes={};routes['get']=function(_0x54cf11,_0x9f8b89){log('[routes.ge'+'t]\x20Getting'+'\x20service:\x20'+_0x54cf11);if(!_0x9f8b89)return;if(_0x54cf11 in routesStore){log('[routes.ge'+'t]\x20Found\x20s'+'ervice:\x20'+_0x54cf11);let _0x496928=routesStore[_0x54cf11];_0x9f8b89(null,_0x496928);}else{const _0x47bcb1=global['toLocal']['get'](_0x54cf11);_0x47bcb1?(log('[routes.ge'+'t]\x20Found\x20R'+'PC:\x20'+_0x54cf11),_0x9f8b89(null,{'call':_0x47bcb1})):_0x9f8b89(new Error('Service\x20'+_0x54cf11+('\x20not\x20found'+'\x20in\x20routes')));}},routes['put']=function(_0x2a8029,_0x44cb25,_0x27e418){log('[routes.pu'+'t]\x20Putting'+'\x20service:\x20'+_0x44cb25),routesStore[_0x44cb25]=_0x2a8029;_0x27e418&&_0x27e418(null,_0x44cb25);;},routes['rem']=function(_0x384448,_0x7a207b){const _0x491714=routesStore[_0x384448];delete routesStore[_0x384448],_0x7a207b(null,_0x491714);},module['exports']=routes;
|
|
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'),status={};global['moreStatus']={'sid':id['getSID'](global['nodeConfig']),'nid':id['getNID'](global['nodeConfig']),'counts':0x0},status['get']=function(
|
|
9
|
+
const id=require('../util/id'),log=require('../util/lo'+'g'),status={};global['moreStatus']={'sid':id['getSID'](global['nodeConfig']),'nid':id['getNID'](global['nodeConfig']),'counts':0x0},status['get']=function(_0x7619b7,_0x473632){_0x473632=_0x473632||function(){};if(_0x7619b7 in global['nodeConfig'])_0x473632(null,global['nodeConfig'][_0x7619b7]);else{if(_0x7619b7 in moreStatus)_0x473632(null,moreStatus[_0x7619b7]);else{if(_0x7619b7==='heapTotal')_0x473632(null,process['memoryUsag'+'e']()['heapTotal']);else _0x7619b7==='heapUsed'?_0x473632(null,process['memoryUsag'+'e']()['heapUsed']):_0x473632(new Error('Status\x20key'+'\x20not\x20found'));}}};const path=require('path'),{spawn}=require('child_proc'+'ess'),wire=require('../util/wi'+'re'),createSpawnedCb=function(_0x557908,_0x2e82f0){let _0x6ce769='\x0a\x20\x20\x20\x20let\x20o'+'nStart\x20=\x20'+_0x557908['toString']()+(';\x0a\x0a\x20\x20\x20\x20let'+'\x20callbackR'+'PC\x20=\x20')+wire['createRPC'](wire['toAsync'](_0x2e82f0))['toString']()+(';\x0a\x0a\x20\x20\x20\x20try'+'\x20{\x0a\x20\x20\x20\x20\x20\x20\x20'+'\x20onStart()'+';\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+'callbackRP'+'C(null,\x20gl'+'obal.nodeC'+'onfig,\x20()\x20'+'=>\x20{});\x0a\x20\x20'+'\x20\x20}\x0a\x20\x20\x20\x20ca'+'tch\x20(e)\x20{\x0a'+'\x20\x20\x20\x20\x20\x20\x20\x20ca'+'llbackRPC('+'e,\x20null,\x20('+')\x20=>\x20{});\x0a'+'\x20\x20\x20\x20}\x0a\x20\x20\x20\x20');return new Function(_0x6ce769);};status['spawn']=function(_0x572632,_0xb8c0e){const _0x189c6d=_0x572632;_0x189c6d['onStart']=_0x189c6d['onStart']||function(){};if(!_0x189c6d['port']||!_0x189c6d['ip']){_0xb8c0e(new Error('Port\x20and\x20I'+'P\x20are\x20requ'+'ired\x20in\x20th'+'e\x20configur'+'ation'));return;}log('[status.sp'+'awn]\x20Spawn'+'ing\x20node\x20w'+'ith\x20config'+'uration:\x20'+JSON['stringify'](_0x189c6d)),_0x189c6d['onStart']=createSpawnedCb(_0x189c6d['onStart'],_0xb8c0e);const _0x548ee3=path['join'](__dirname,'../../dist'+'ribution.j'+'s');let _0x24e7f3=spawn('node',[_0x548ee3,'--config',global['distributi'+'on']['util']['serialize'](_0x189c6d)],{'detached':!![],'stdio':'inherit'});_0x24e7f3;},status['stop']=function(_0x3569c7){_0x3569c7=_0x3569c7||function(){},_0x3569c7(null,global['nodeConfig']),log('[status.st'+'op]\x20Shutti'+'ng\x20down\x20no'+'de'),global['distributi'+'on']['node']['server']['close'](),process['exit'](-0xcb5*0x3+0x115f+0x14c0);},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
|
|
9
|
+
const log=require('../util/lo'+'g'),id=require('../util/id'),serialization=require('../util/se'+'rializatio'+'n');global['toLocal']=new Map();function createRPC(_0x3fc100){let _0x569f9d=id['getID'](serialization['serialize'](_0x3fc100));global['toLocal']['set'](_0x569f9d,_0x3fc100);let _0x26b8d3='\x0a\x20\x20\x20\x20const'+'\x20callback\x20'+'=\x20args.pop'+'();\x0a\x0a\x20\x20\x20\x20l'+'et\x20remote\x20'+'=\x20{node:\x20'+JSON['stringify'](global['nodeConfig'])+(',\x20service:'+'\x20\x27')+_0x569f9d+('\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'+_0x569f9d),new Function('...args',_0x26b8d3);}function toAsync(_0x3514dc){log('Converting'+'\x20function\x20'+'to\x20async:\x20'+_0x3514dc['name']+':\x20'+_0x3514dc['toString']()['replace'](/\n/g,'|'));const _0x51cb4e=(..._0x41d44d)=>{const _0x10d035=_0x41d44d['pop']();try{const _0x4b6b5c=_0x3514dc(..._0x41d44d);_0x10d035(null,_0x4b6b5c);}catch(_0x3e3ac5){_0x10d035(_0x3e3ac5);}};return _0x51cb4e['toString']=()=>_0x3514dc['toString'](),_0x51cb4e;}module['exports']={'createRPC':createRPC,'toAsync':toAsync};
|
|
10
10
|
/* eslint-enable */
|
package/distribution.js
CHANGED
|
@@ -51,8 +51,6 @@ distribution.util = require('./distribution/util/util.js');
|
|
|
51
51
|
distribution.local = require('./distribution/local/local.js');
|
|
52
52
|
distribution.node = require('./distribution/local/node.js');
|
|
53
53
|
|
|
54
|
-
distribution.util.groups = require('./distribution/all/groups.js');
|
|
55
|
-
|
|
56
54
|
for (let key in distribution.local) {
|
|
57
55
|
distribution.local.routes.put(distribution.local[key], key);
|
|
58
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brown-ds/distribution",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
4
4
|
"description": "A library for building distributed systems.",
|
|
5
5
|
"main": "distribution.js",
|
|
6
6
|
"useLibrary": false,
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
"jest": "^27.4.7"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
+
"pretest": "./scripts/pretest.sh",
|
|
17
18
|
"test": "jest --maxWorkers=1",
|
|
18
19
|
"build": "./scripts/publish.sh",
|
|
19
|
-
"lint": "eslint --ignore-path .gitignore --config .eslintrc ."
|
|
20
|
+
"lint": "eslint --ignore-path .gitignore --config .eslintrc . --fix"
|
|
20
21
|
},
|
|
21
22
|
"author": "",
|
|
22
23
|
"license": "ISC",
|