Network Workspace
This commit is contained in:
1 parent
85cc9c2c3d
commit
ecd0dcc761
12 files changed
+72
-29
No files matched your search
@@ -63,6 +63,21 @@ exports.newMultiProject = function () {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
From here we will require and get the modules, but without instantiation thisObject.
|
||||
*/
|
||||
|
||||
/* Set up Modules for this Project */
|
||||
if (projectDefinition[rootObjectName].modules !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].modules.length; j++) {
|
||||
let taskModuleDefinition = projectDefinition[rootObjectName].modules[j]
|
||||
let path = global.env.PATH_TO_PROJECTS_REQUIRED + '/' + projectDefinition.name + '/' + rootObjectName + '/' + 'Modules' + '/' + taskModuleDefinition.fileName
|
||||
|
||||
let requiredObject = require(path)
|
||||
projectInstance.modules[taskModuleDefinition.propertyName] = requiredObject
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up Task Modules for this Project */
|
||||
if (projectDefinition[rootObjectName].taskModules !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].taskModules.length; j++) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "C:\\Superalgos\\Network"
|
||||
},
|
||||
{
|
||||
"path": "C:\\Superalgos\\Projects\\Network"
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
@@ -19,9 +19,9 @@ exports.newBotProfileStats = function newBotProfileStats() {
|
||||
*/
|
||||
let userProfile
|
||||
if (queryReceived.targetUserProfileId !== undefined) {
|
||||
userProfile = NT.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
userProfile = NT.globals.memory.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
} else {
|
||||
userProfile = NT.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle)
|
||||
userProfile = NT.globals.memory.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle)
|
||||
}
|
||||
|
||||
if (userProfile === undefined) {
|
||||
|
||||
@@ -59,8 +59,8 @@ exports.newEvents = function newEvents() {
|
||||
|
||||
Any of the above happening, means that indeed it is related.
|
||||
*/
|
||||
let emitterUserProfile = NT.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.emitterUserProfileId)
|
||||
let targetUserProfile = NT.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.targetUserProfileId)
|
||||
let emitterUserProfile = NT.globals.memory.USER_PROFILES_BY_ID.get(eventReceived.emitterUserProfileId)
|
||||
let targetUserProfile = NT.globals.memory.USER_PROFILES_BY_ID.get(eventReceived.targetUserProfileId)
|
||||
let emitterBotProfile = emitterUserProfile.bots.get(eventReceived.emitterBotProfileId)
|
||||
let targetBotProfile = targetUserProfile.bots.get(eventReceived.targetBotProfileId)
|
||||
let emitterPost = emitterUserProfile.posts.get(eventReceived.emitterPostHash)
|
||||
|
||||
@@ -18,9 +18,9 @@ exports.newUserProfileStats = function newUserProfileStats() {
|
||||
Validate User Profile
|
||||
*/
|
||||
if (queryReceived.targetUserProfileId !== undefined) {
|
||||
thisObject.profile = NT.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
thisObject.profile = NT.globals.memory.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
} else {
|
||||
thisObject.profile = NT.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle)
|
||||
thisObject.profile = NT.globals.memory.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle)
|
||||
}
|
||||
|
||||
if (thisObject.profile === undefined) {
|
||||
|
||||
@@ -13,7 +13,6 @@ or relationships between User and Bot profiles and also between their posts.
|
||||
global.NT = {
|
||||
modules: {
|
||||
BOOTSTRAP: require('./Bootstrap.js'),
|
||||
EVENT: require('./Event.js'),
|
||||
USER_PROFILE: require('./UserProfile.js'),
|
||||
BOT_PROFILE: require('./BotProfile.js'),
|
||||
POST: require('./Post.js'),
|
||||
@@ -51,20 +50,6 @@ let MULTI_PROJECT = require('../MultiProject.js');
|
||||
let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject()
|
||||
MULTI_PROJECT_MODULE.initialize(CL, 'CL')
|
||||
MULTI_PROJECT_MODULE.initialize(SA, 'SA')
|
||||
/*
|
||||
Here is the Data we are going to keep in memory.
|
||||
*/
|
||||
NT.memory = {
|
||||
maps: {
|
||||
USER_PROFILES_BY_ID: new Map(), // Here we will store the user profiles by User Profile Id.
|
||||
USER_PROFILES_BY_HANDLE: new Map(), // Here we will store the user profiles by User Profile Handle.
|
||||
EVENTS: new Map(), // This is the registry of all events received that prevents processing them more than once.
|
||||
},
|
||||
arrays: {
|
||||
NETWORK_CLIENTS: [], // These are the Network Clients connected to this Network Node ordered by Ranking.
|
||||
NETWORK_PEERS: [], // These are the Network Peers connected to this Network Node ordered by Ranking.
|
||||
}
|
||||
}
|
||||
|
||||
let bootstrapProcess = NT.modules.BOOTSTRAP.newBootstrap()
|
||||
bootstrapProcess.initialize()
|
||||
@@ -15,7 +15,7 @@ exports.newQueriesValidations = function newQueriesValidations() {
|
||||
Validate User Profile
|
||||
*/
|
||||
if (queryReceived.targetUserProfileId !== undefined) {
|
||||
thisObject.profile = NT.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
thisObject.profile = NT.globals.memory.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
}
|
||||
|
||||
if (thisObject.profile === undefined) {
|
||||
|
||||
@@ -45,13 +45,13 @@ exports.newClientInterface = function newClientInterface() {
|
||||
*/
|
||||
|
||||
let eventReceived = JSON.parse(eventMessage)
|
||||
if (NT.memory.maps.EVENTS.get(eventReceived.eventId) !== undefined) {
|
||||
if (NT.globals.memory.EVENTS.get(eventReceived.eventId) !== undefined) {
|
||||
throw ('Event Already Exists.')
|
||||
}
|
||||
|
||||
let event = NT.modules.EVENT.newEvent()
|
||||
let event = NT.modules.event.newNetworkModulesEvent()
|
||||
event.initialize(eventReceived)
|
||||
NT.memory.maps.EVENTS.set(eventReceived.eventId, event)
|
||||
NT.globals.memory.EVENTS.set(eventReceived.eventId, event)
|
||||
}
|
||||
|
||||
function queryReceived(queryMessage) {
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ exports.newPost = function newPost() {
|
||||
/*
|
||||
Validate Target User Profile.
|
||||
*/
|
||||
let targetUserProfile = NT.memory.maps.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId)
|
||||
let targetUserProfile = NT.globals.memory.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId)
|
||||
if (targetUserProfile === undefined) {
|
||||
throw ('Target User Profile Not Found.')
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
exports.newNetworkGlobalsMemory = function () {
|
||||
/*
|
||||
Here is the Data we are going to keep in memory.
|
||||
*/
|
||||
let thisObject = {
|
||||
maps: {
|
||||
USER_PROFILES_BY_ID: new Map(), // Here we will store the user profiles by User Profile Id.
|
||||
USER_PROFILES_BY_HANDLE: new Map(), // Here we will store the user profiles by User Profile Handle.
|
||||
EVENTS: new Map(), // This is the registry of all events received that prevents processing them more than once.
|
||||
},
|
||||
arrays: {
|
||||
NETWORK_CLIENTS: [], // These are the Network Clients connected to this Network Node ordered by Ranking.
|
||||
NETWORK_PEERS: [], // These are the Network Peers connected to this Network Node ordered by Ranking.
|
||||
}
|
||||
}
|
||||
|
||||
return thisObject
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newEvent = function newEvent() {
|
||||
exports.newNetworkModulesEvent = function newNetworkModulesEvent() {
|
||||
/*
|
||||
An Event is anything that happens system wide that
|
||||
needs to be delivered to relevant entities via
|
||||
@@ -104,7 +104,7 @@ exports.newEvent = function newEvent() {
|
||||
if (emitterUserProfileId === undefined) {
|
||||
throw ('Emitter User Profile Id Not Provided.')
|
||||
}
|
||||
emitterUserProfile = NT.memory.maps.USER_PROFILES_BY_ID.get(thisObject.emitterUserProfileId)
|
||||
emitterUserProfile = NT.globals.memory.USER_PROFILES_BY_ID.get(thisObject.emitterUserProfileId)
|
||||
if (emitterUserProfile === undefined) {
|
||||
throw ('Emitter User Profile Not Found.')
|
||||
}
|
||||
@@ -112,7 +112,7 @@ exports.newEvent = function newEvent() {
|
||||
Validate Target User Profile.
|
||||
*/
|
||||
if (thisObject.targetUserProfileId !== undefined) {
|
||||
targetUserProfile = NT.memory.maps.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId)
|
||||
targetUserProfile = NT.globals.memory.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId)
|
||||
if (targetUserProfile === undefined) {
|
||||
throw ('Target User Profile Not Found.')
|
||||
}
|
||||
@@ -1278,6 +1278,20 @@
|
||||
"propertyName": "queryConstants",
|
||||
"functionName": "newNetworkGlobalsQueryConstants",
|
||||
"fileName": "QueryConstants.js"
|
||||
},
|
||||
{
|
||||
"name": "Memory",
|
||||
"propertyName": "memory",
|
||||
"functionName": "newNetworkGlobalsMemory",
|
||||
"fileName": "Memory.js"
|
||||
}
|
||||
],
|
||||
"modules": [
|
||||
{
|
||||
"name": "Event",
|
||||
"propertyName": "event",
|
||||
"functionName": "newNetworkModulesEvent",
|
||||
"fileName": "Event.js"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user