3 Network Nodes Running in Debug Mode
This commit is contained in:
1 parent
e98b1fbd6c
commit
48c35d8148
12 files changed
+129
-14
No files matched your search
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "C:\\Superalgos"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"search.maintainFileSearchCache": true
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "C:\\Superalgos"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"search.maintainFileSearchCache": true
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "C:\\Superalgos"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"search.maintainFileSearchCache": true
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ exports.newDesktopApp = function newDesktopApp() {
|
||||
|
||||
let thisObject = {
|
||||
socialGraph: undefined,
|
||||
p2pMetwork: undefined,
|
||||
p2pNetwork: undefined,
|
||||
webSocketsClient: undefined,
|
||||
webSocketsInterface: undefined,
|
||||
run: run
|
||||
@@ -21,12 +21,12 @@ exports.newDesktopApp = function newDesktopApp() {
|
||||
/*
|
||||
We can join now the P2P Network as a client app.
|
||||
*/
|
||||
thisObject.p2pMetwork = SA.projects.network.modules.p2pNetwork.newNetworkModulesP2PNetwork()
|
||||
await thisObject.p2pMetwork.initialize('Network Client')
|
||||
thisObject.p2pNetwork = SA.projects.network.modules.p2pNetwork.newNetworkModulesP2PNetwork()
|
||||
await thisObject.p2pNetwork.initialize('Network Client')
|
||||
/*
|
||||
Here we will pick a Network Node from all users profiles available that do have a Network Node running.
|
||||
*/
|
||||
let selectedNetworkNode = thisObject.p2pMetwork.p2pNodesToConnect[0]
|
||||
let selectedNetworkNode = thisObject.p2pNetwork.p2pNodesToConnect[0]
|
||||
/*
|
||||
This is the Web Sockets client that interacts with the Superalgos Network.
|
||||
*/
|
||||
|
||||
+10
-8
@@ -4,7 +4,7 @@ exports.newNetworkNode = function newNetworkNode() {
|
||||
webSocketsInterface: undefined,
|
||||
socialGraphService: undefined,
|
||||
storage: undefined,
|
||||
p2pMetwork: undefined,
|
||||
p2pNetwork: undefined,
|
||||
run: run
|
||||
}
|
||||
|
||||
@@ -13,11 +13,6 @@ exports.newNetworkNode = function newNetworkNode() {
|
||||
return thisObject
|
||||
|
||||
async function run() {
|
||||
/*
|
||||
Other Network Nodes and Client Apps will communicate with this Network Node via it's Websocket Interface.
|
||||
*/
|
||||
thisObject.webSocketsInterface = NT.projects.network.modules.webSocketsInterface.newNetworkModulesWebSocketsInterface()
|
||||
thisObject.webSocketsInterface.initialize()
|
||||
/*
|
||||
The Social Graph Service is the first and for now, the only service this Network Node provides.
|
||||
*/
|
||||
@@ -31,7 +26,14 @@ exports.newNetworkNode = function newNetworkNode() {
|
||||
/*
|
||||
We can join now the P2P Network as a new peer there.
|
||||
*/
|
||||
thisObject.p2pMetwork = SA.projects.network.modules.p2pNetwork.newNetworkModulesP2PNetwork()
|
||||
await thisObject.p2pMetwork.initialize('Network Peer')
|
||||
thisObject.p2pNetwork = SA.projects.network.modules.p2pNetwork.newNetworkModulesP2PNetwork()
|
||||
await thisObject.p2pNetwork.initialize('Network Peer')
|
||||
/*
|
||||
Other Network Nodes and Client Apps will communicate with this Network Node via it's Websocket Interface.
|
||||
*/
|
||||
thisObject.webSocketsInterface = NT.projects.network.modules.webSocketsInterface.newNetworkModulesWebSocketsInterface()
|
||||
thisObject.webSocketsInterface.initialize()
|
||||
console.log('Network Node Web Sockets Interface ....................................... Listening at port ' + JSON.parse(NT.networkNode.p2pNetwork.thisNetworkNode.node.config).webSocketsPort)
|
||||
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -10,7 +10,7 @@ exports.newNetworkRoot = function newNetworkRoot() {
|
||||
|
||||
return thisObject
|
||||
|
||||
async function run() {
|
||||
async function run(debugSettings) {
|
||||
/*
|
||||
The NT object is accessible everywhere at the Superalgos Network.
|
||||
It provides access to all modules built for this Network.
|
||||
@@ -25,6 +25,10 @@ exports.newNetworkRoot = function newNetworkRoot() {
|
||||
let ENVIRONMENT = require('./Environment.js');
|
||||
let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment()
|
||||
global.env = ENVIRONMENT_MODULE
|
||||
|
||||
if (debugSettings !== undefined && debugSettings.P2P_NETWORK_NODE_SIGNING_ACCOUNT !== undefined) {
|
||||
global.env.P2P_NETWORK_NODE_SIGNING_ACCOUNT = debugSettings.P2P_NETWORK_NODE_SIGNING_ACCOUNT
|
||||
}
|
||||
/*
|
||||
First thing is to load the project schema file.
|
||||
*/
|
||||
|
||||
@@ -40,7 +40,9 @@ exports.newNetworkModulesWebSocketsInterface = function newNetworkModulesWebSock
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
socketServer = new SA.nodeModules.ws.Server({ port: global.env.NETWORK_WEB_SOCKETS_INTERFACE_PORT })
|
||||
let port = JSON.parse(NT.networkNode.p2pNetwork.thisNetworkNode.node.config).webSocketsPort
|
||||
|
||||
socketServer = new SA.nodeModules.ws.Server({ port: port })
|
||||
clientInterface = NT.projects.socialTrading.modules.clientInterface.newSocialTradingModulesClientInterface()
|
||||
peerInterface = NT.projects.socialTrading.modules.peerInterface.newSocialTradingModulesPeerInterface()
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ exports.newNetworkModulesP2PNetwork = function newNetworkModulesP2PNetwork() {
|
||||
let thisObject = {
|
||||
joinTheNetworkAsNetworkPeer: joinTheNetworkAsNetworkPeer,
|
||||
p2pNodesToConnect: undefined,
|
||||
thisNetworkNode: undefined,
|
||||
/* Framework Functions */
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
@@ -37,6 +38,8 @@ exports.newNetworkModulesP2PNetwork = function newNetworkModulesP2PNetwork() {
|
||||
let p2pNetworkNode = SA.projects.network.globals.memory.arrays.P2P_NETWORK_NODES[i]
|
||||
if (thisP2PNodeId !== p2pNetworkNode.node.id) {
|
||||
thisObject.p2pNodesToConnect.push(p2pNetworkNode)
|
||||
} else {
|
||||
thisObject.thisNetworkNode = p2pNetworkNode
|
||||
}
|
||||
}
|
||||
break
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
exports.newNetworkModulesP2PNetworkPeers = function newNetworkModulesP2PNetworkPeers() {
|
||||
/*
|
||||
This module represents the P2P Nodes we are connected to.
|
||||
*/
|
||||
let thisObject = {
|
||||
|
||||
/* Framework Functions */
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize() {
|
||||
|
||||
}
|
||||
|
||||
async function initialize() {
|
||||
/*
|
||||
On a first iteration, we will try to connect to 2 Network Peers, one upstream and one downstream,
|
||||
meaning one with higher ranking that us, and the other with lower ranking than us.
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
The Superalgos Network offers 3 types of services:
|
||||
|
||||
* Social Graph Service
|
||||
* Search Index Service
|
||||
* Private Message Service
|
||||
|
||||
Users can decide which services to run at their node.(TODO)
|
||||
|
||||
This module represents the Nodejs command that users have to start the Network Node..
|
||||
|
||||
*/
|
||||
|
||||
let APP_ROOT = require('./NetworkRoot.js')
|
||||
let APP_ROOT_MODULE = APP_ROOT.newNetworkRoot()
|
||||
APP_ROOT_MODULE.run({P2P_NETWORK_NODE_SIGNING_ACCOUNT: 'P2P-Network-Node-1'})
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
The Superalgos Network offers 3 types of services:
|
||||
|
||||
* Social Graph Service
|
||||
* Search Index Service
|
||||
* Private Message Service
|
||||
|
||||
Users can decide which services to run at their node.(TODO)
|
||||
|
||||
This module represents the Nodejs command that users have to start the Network Node..
|
||||
|
||||
*/
|
||||
|
||||
let APP_ROOT = require('./NetworkRoot.js')
|
||||
let APP_ROOT_MODULE = APP_ROOT.newNetworkRoot()
|
||||
APP_ROOT_MODULE.run({P2P_NETWORK_NODE_SIGNING_ACCOUNT: 'P2P-Network-Node-2'})
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
The Superalgos Network offers 3 types of services:
|
||||
|
||||
* Social Graph Service
|
||||
* Search Index Service
|
||||
* Private Message Service
|
||||
|
||||
Users can decide which services to run at their node.(TODO)
|
||||
|
||||
This module represents the Nodejs command that users have to start the Network Node..
|
||||
|
||||
*/
|
||||
|
||||
let APP_ROOT = require('./NetworkRoot.js')
|
||||
let APP_ROOT_MODULE = APP_ROOT.newNetworkRoot()
|
||||
APP_ROOT_MODULE.run({P2P_NETWORK_NODE_SIGNING_ACCOUNT: 'P2P-Network-Node-3'})
|
||||
Reference in new issue
Block a user