Network modules with added comments.
This commit is contained in:
1 parent
ce33c03bf8
commit
a7a338bf26
7 files changed
+49
-8
No files matched your search
@@ -10,14 +10,18 @@ exports.newNetworkNode = function newNetworkNode() {
|
||||
|
||||
async function run() {
|
||||
/*
|
||||
Let's start the Network Interfaces
|
||||
Other Network Nodes and Client Apps will communicate with this Network Node via it's Websocket Interface.
|
||||
*/
|
||||
NT.webSocketsInterface = NT.projects.network.modules.webSocketsInterface.newNetworkModulesWebSocketsInterface()
|
||||
NT.webSocketsInterface.initialize()
|
||||
|
||||
/*
|
||||
The Social Graph Service is the first and for now, the only service this Network Node provides.
|
||||
*/
|
||||
thisObject.socialGraphService = NT.projects.socialTrading.modules.socialGraph.newNetworkModulesSocialGraph()
|
||||
await thisObject.socialGraphService.initialize()
|
||||
|
||||
/*
|
||||
The Sotrage deals with persisting the Social Graph.
|
||||
*/
|
||||
thisObject.storage = NT.projects.socialTrading.modules.storage.newSocialTradingModulesStorage()
|
||||
thisObject.storage.initialize()
|
||||
}
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
exports.newNetworkModulesWebSocketsInterface = function newNetworkModulesWebSocketsInterface() {
|
||||
/*
|
||||
This module represents the websockets interface of the Network Node.
|
||||
|
||||
A Network Nodes is epected to receive conections request from 2 different types
|
||||
of entities:
|
||||
|
||||
1. Other Network Nodes.
|
||||
2. Clients / Apps.
|
||||
|
||||
This module deals with those 2 connection types and is the one receiving from
|
||||
and sending messages to those entities.
|
||||
*/
|
||||
let thisObject = {
|
||||
networkClients: undefined,
|
||||
networkPeers: undefined,
|
||||
@@ -45,7 +56,6 @@ exports.newNetworkModulesWebSocketsInterface = function newNetworkModulesWebSock
|
||||
socketServer.on('connection', onConnectionOpened)
|
||||
|
||||
function onConnectionOpened(socket)
|
||||
|
||||
/*
|
||||
This function is executed every time a new Websockets connection
|
||||
is stablished.
|
||||
|
||||
@@ -3,6 +3,13 @@ exports.newBootstrap = function newBootstrap() {
|
||||
This module helps the Network Node to bootstrap, by
|
||||
loading all the services and data that needs to start
|
||||
operating.
|
||||
|
||||
In particular, a network node operates with all User Profiles loaded in
|
||||
memory maps. These profiles become part of the system in the form of User Profiles
|
||||
Plugins at the Governance System, when user submit them. This means
|
||||
that all these profiles are already at the local disk of the Network Node.
|
||||
|
||||
From there they will be loaded into memory as part of this bootstrapping process.
|
||||
*/
|
||||
let thisObject = {
|
||||
/* Framework Functions */
|
||||
|
||||
@@ -6,6 +6,10 @@ exports.newSocialTradingModulesClientInterface = function newSocialTradingModule
|
||||
|
||||
* Send an Event that happened at the Network Client to the Network.
|
||||
* Make a Query to the Network Node for info needed at the Network Client.
|
||||
|
||||
This interface is one layer above the communication protocol interface
|
||||
where actual messages are received through, like for instance the
|
||||
websockets interface.
|
||||
*/
|
||||
let thisObject = {
|
||||
messageReceived: messageReceived,
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
exports.newSocialTradingModulesPeerInterface = function newSocialTradingModulesPeerInterface() {
|
||||
|
||||
/*
|
||||
This module represents the Interface the Network Node have
|
||||
with other Network Nodes connected to it.
|
||||
|
||||
This interface is one layer above the communication protocol interface
|
||||
where actual messages are received through, like for instance the
|
||||
websockets interface.
|
||||
*/
|
||||
let thisObject = {
|
||||
initialize: initialize,
|
||||
finalize: finalize,
|
||||
@@ -17,6 +24,6 @@ exports.newSocialTradingModulesPeerInterface = function newSocialTradingModulesP
|
||||
}
|
||||
|
||||
function run() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
exports.newNetworkModulesSocialGraph = function newNetworkModulesSocialGraph() {
|
||||
/*
|
||||
This module represents the Social Graph Service that
|
||||
this deals with the Social Graph this node mantains.
|
||||
deals with the Social Graph this node mantains.
|
||||
The Social Graph is one of the services the Network Node provides.
|
||||
|
||||
This service is responsible for mantaining the whole Social Graph
|
||||
|
||||
@@ -3,6 +3,15 @@ exports.newSocialTradingModulesStorage = function newSocialTradingModulesStorage
|
||||
This module represents the Network Node Physical Storage.
|
||||
It is used to save the in-memory events and also to load
|
||||
them when the node is starting.
|
||||
|
||||
Each node has a github repository to store its social graph.
|
||||
That Github repository can be used by any other node to get the history of
|
||||
events that can build the social graph.
|
||||
|
||||
Each Network Node saves locally all unsaved events, every one minute,
|
||||
and after saving, pushes the changes to it's Github repo, which
|
||||
acts as a backup of itself, and also for other new nodes to bootstrap
|
||||
their own copy of the social graph.
|
||||
*/
|
||||
let thisObject = {
|
||||
initialize: initialize,
|
||||
|
||||
Reference in new issue
Block a user