STATUS:	Pre-Alpha

WHAT IS uKRNL.JS?

JS Microkernel emulates the synaptic transmission process between instances (servers)
where the modules are exited with requests, so they encapsulate, process and make
responses. It is free software (free as in freedom) under the terms of GPL v3.

WHAT LANGUAGE IS uKRNL.JS WRITTEN IN?

It is written in NodeJS and C.

DEPENDS ON

MongoDB:
	Right now it depends on MongoDB for its basic meta data, this is just to
	provide an operational application meanwhile it is in development. In
	the future it will have a little hash data container with json support
	to manage its meta data.

liburegex:
	The unique regular expressions library is free software library licensed
	under GPL v3 to handle strings like its name says, ukrnl will always
	depend on it.

KEYWORDS

Instance:
	Means one virtual or physical server.

Schema:	Means different user context in the same instance sharing resources like
	memory, ports, descriptors but if you want it keeps different NodeJS
	version so it can handle independent modules.

Module:	It can be user controller or system controller.

Controller:
	It is an standard JS class with private methods, prototype, constructor
	and public methods, it support all class standards like aggregation,
	inheritance, overload and so on.

CONCEPT

The old concept about Database and Program will change, all data will be distributed
and dispersed for all instances so the writing and acquisition process flies over the
servers.

The controllers will work like programs sometimes like intermediate software and
sometimes like data container, they can be distributed in lots of servers and their
responses will match in at least many times as custom level to be valid.

Finally programs and databases will not exist, just the controller module accept
requests and a valid response has to match in at least many times as custom level.

FACTS

- Each system instance can handle one kernel so we have lots of kernels as instances
  we have but at least we must have one kernel in whole system.
- Up to 4000 system modules per instance.
- Up to 10000 user modules per instance.

LIMITS

Reserved modules / controllers per instance is not define yet because Pre-Alpha state.

CONVETION USED

All messages between servers, modules, controllers, etc. are json so I call this as
Friday 13th convention ;-)

SYNAPTIC JS MICROKERNEL TECHNICAL DESIGN

Nodejs non-native prereqs:	mongodb

Nodejs native prereqs:		fs
		http
		url
		Math

Nodejs native calls:		http.request

Postdata:	{
    controller: 'Name',
    method: 'module',
    params: {
        key1: "val1",
        key2: obj2,
        ...
    }
}

Headers:	{
    Content-Type: 'application/json',
    Content-Length: Postdata.length
}

Options:	{
    host: 'IpHost',
    port: PortNumber,
    path: '/lib/ControllerName',
    method: 'POST',
    headers: Headers
}

Returns:	HTTP/1.1 200 OK,
{
    Content-Type: 'application/json'
},
{ return: <value>, data: { object: Object, message:  <desc>  } }

NODEJS CLASS CONVENTION FOR CONTROLLERS

module.exports = <ControllerName>;

function <ControllerName>() {};

<ControllerName>.prototype = {
    constructor: <ControllerName>,
    <method0>: function ( objData, oCallBack ) {
        oCallBack( { object: { object: .. }} );
    },
    ..,
    <methodN>: function ( objData, oCallBack ) {
    }
};

SYSTEM AND USER SPACE MODULES

SYSDB: ukrnl
STATUS: Pre-Alpha
COLLECTION: controller
module		host		id	version			status	path
					major	minor	patch
Processes	localhost	36000	0	0	0	A	/slib/
Init		localhost	36001	0	0	0	A	/slib/
Monitor		localhost	40000	0	0	0	A	/lib/

uKRNL MODULES / CONTROLLERS JSON DEFS

db.controller.update (
  { module: "Processes" },
  {
    module: "Processes",
    host: "localhost",
    id: "36000",
    version: {
      major: "0",
      minor: "0",
      patch: "0"
    },
    status: "A",
    path: "/slib/"
  },
  { upsert: true }
)

db.controller.update (
  { module: "Init" },
  {
    module: "Init",
    host: "localhost",
    id: "36001",
    version: {
      major: "0",
      minor: "0",
      patch: "0"
    },
    status: "A",
    path: "/slib/"
  },
  { upsert: true }
)

db.controller.update (
  { module: "Monitor" },
  {
    module: "Monitor",
    host: "localhost",
    id: "40000",
    version: {
      major: "0",
      minor: "0",
      patch: "0"
    },
    status: "A",
    path: "/lib/"
  },
  { upsert: true }
)

uKRNL.JSON

{
    "license": " ********************************************************************=
**********\n * Synapses Null Kernel                                                  =
     *\n * Copyright (C) 2014  Victor C. Salas P. (aka nmag) <nmagko@gmail.com>      =
 *\n *                                                                            *\n=
 *  This program is free software: you can redistribute it and/or modify      *\n *  =
it under the terms of the GNU General Public License as published by      *\n *  the =
Free Software Foundation, either version 3 of the License, or         *\n *  (at your=
 option) any later version.                                       *\n *              =
                                                              *\n *  This program is =
distributed in the hope that it will be useful,           *\n *  but WITHOUT ANY WARR=
ANTY; without even the implied warranty of            *\n *  MERCHANTABILITY or FITNE=
SS FOR A PARTICULAR PURPOSE.  See the             *\n *  GNU General Public License f=
or more details.                              *\n *                                  =
                                          *\n *  You should have received a copy of t=
he GNU General Public License         *\n *  along with this program.  If not, see <h=
ttp://www.gnu.org/licenses/>.     *\n ***********************************************=
*******************************\n",
    "version": {
        "major": 0,
        "minor": 0,
        "patch": 0
    },
    "debug": 1,
    "default_binding_port": 4000,
    "database": {
        "host": "127.0.0.1",
        "port": 27017,
        "name": "ukrnl"
    },
    "collection": [
        "multiplexer",
        "controller"
    ]
}

FREE DOCUMENTATION LICENSE

Copyright (C)  2015,2016  Victor Clodoaldo Salas Pumacayo.

  Permission is granted to copy, distribute and/or modify this document
  under the terms of the GNU Free Documentation License, Version 1.3
  or any later version published by the Free Software Foundation;
  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
  A copy of the license is included in the section entitled "GNU
  Free Documentation License".
