Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Update document #148

Merged
merged 4 commits into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion specs/CardanoShellSpec.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Currently, the \textit{Daedalus} and the \textit{Node} (this is what I'm calling
\textbf{IPC} (Inter Process Communication) is a set of methods which processes can use to communicate - \url{https://en.wikipedia.org/wiki/Inter-process_communication}.\\

The actual communication right now is being done by the \textit{spawn} function, pieces of which can be found \href{https://github.com/nodejs/node/blob/62942e9ad7a59b76e9255ea2560bad2245709efc/lib/internal/child_process.js#L306}{here}.
The part of the code which adds the handle id which they will use to communicate via environment variable "NODE\_CHANNEL\_FD" \href{https://github.com/nodejs/node/blob/master/lib/internal/child_process.js#L324-L335}{here}.\\
The part of the code which adds the handle id which they will use to communicate via environment variable \textit{NODE\_CHANNEL\_FD} \href{https://github.com/nodejs/node/blob/master/lib/internal/child_process.js#L324-L335}{here}.\\

Currently, the \textit{Deadalus} starts the \textit{Node} (we will ignore the \textit{Launcher} for now, since it complicates the story a bit).\\

Expand All @@ -220,6 +220,9 @@ When the \textit{Daedalus} calls and starts the \textit{Node}, it also opens up
First, the \textit{Node} sends the message \textbf{Started} back to the \textit{Daedalus} to inform him that the communication can begin.
After that, \textit{Daedalus} sends the message \textbf{QueryPort} to the \textit{Node}, and the \textit{Node} responds with the free port it found using \textbf{ReplyPort PORTNUM} that is going to be used for starting the HTTP "server" serving the \textit{JSON API} which they can then use to communicate further.\\

Not only does the \textit{Node} responds to the message, but it can also perform some IO actions depending on the message sent from the client.
For instance, you can have the client fetch the system information and return it to the server, or have it so that node will kill its thread/process when it responds with \textbf{ReplyPort PORTNUM}.\\

The communication is bi-directional, on Windows it is using \textbf{named pipes}.\\

We can easily generalize this concept. We can say that \textit{Daedalus} is the \textit{Server}, and that the \textit{Node} is the \textit{Client}. Since the communication is bi-directional, we can say that either way, but we can presume that the \textit{Server} is the process which is started first.
Expand Down
Binary file modified specs/CardanoShellSpec.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion specs/shell.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let
# adding the haskell environment for running lhs2tex
pkgs = import (import ./../nixpkgs.nix) { config = import ./../config.nix; };
pkgs = import (import ./../nixpkgs.nix) { config = import ./../default.nix; };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we even need nixpkgs.nix but this is not required to be the bleeding edge anyway, so it's good.

in
pkgs.stdenv.mkDerivation {
name = "docsEnv";
Expand Down