Giter VIP home page Giter VIP logo

c9-fbp's Introduction

C9-FBP

This is a runtime for the FBP Protocol on the Deno JavaScript runtime.

Eventually, it will become JS runtime independent so you could run it on Deno, NodeJS, Bun or even WebAssembly.

Installation

git clone [email protected]:Industrial/c9-fbp.git
cd c9-fbp
deno task test

NixOS

For NixOS, deno can be installed on a project basis by using the .envrc and flake.nix file. Run this command to automatically use the Nix Flake when entering the directory.

Usage

Lint

deno task lint
deno task lint:watch

Test

deno task test
deno task test:watch
deno task test:coverage

Start

deno task start

Develop

deno task dev

Documentation

Message Streaming Model

Graph

A Graph is a Box (visually) that receives Message's. The Graph contains Node's.

Message

A Message is a JSON object.

Node

A Node is a Box that has a list of Inport's and a list of Outport's. An Inport is a TransformStream that data is written to from outside of the Node and read from inside the Node. An Outport is a TransformStream that data is written to from inside the Node and read from outside the Node. This is a pull-based system. That means that the logic of the Node runs when one of the Outport's asks for a Message. For every Message asked for, the logic of the Node may pull one or multiple Message's from one to many input ports. To prevent the case where a message is asked from one Outport but the Node decides that a Message should instead go to another Outport, the Node will logic will only run when all Outport's are ready to receive a message.

GraphNode

A GraphNode is a Node that contains it's own Graph. For a Graph to be usable in a GraphNode, it needs to contain an Input Node and an Output Node, which wire in the GraphNode's Inport to the Input Node and the Output Node to the GraphNode's Outport.

Functional Model of Streams

Create a function called waitForAllOutportsReady => Task<void>. It completes (asynchronously) when all outport ports are ready to write to.

Create a function called waitForNextInportMessage => Task<{ portId: string, data: unknown }>. It completes when the next message arrives on any inport.

Create a send function that takes a pordId and data argument. It send the data to the port.

Create a function called run that takes a logic function. The logic function is the implementation of the component that the nodes is configured to run. It first calls waitForAllOutportsReady. Then, it calls waitForNextInportMessage. Then, it passes the next InportMessage to the logic function along with the send function. The send function is composed with the run function so that the process is started again when the message is sent. It might be more efficient to run the run function (as a side effect) before the send happens so it's listening before the send triggers the ready.

c9-fbp's People

Contributors

industrial avatar

Watchers

 avatar  avatar

c9-fbp's Issues

Commit succeeds when error occurs

Task commit:lint-staged deno run -A npm:lint-staged
✔ Preparing lint-staged...
⚠ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *.{js,jsx,ts,tsx} — 1 file
      ✔ deno fmt
      ✖ deno lint [FAILED]
↓ Skipped because of errors from tasks.
✔ Reverting to original state because of errors...
✔ Cleaning up temporary files...

✖ deno lint:
(no-unused-vars) `StartedNetworkOutputMessage` is never used
  StartedNetworkOutputMessage,
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    at /home/tom/Code/code9/deno/c9-fbp/src/test/protocol/network.test.ts:8:3

    hint: If this is intentional, alias it with an underscore like `StartedNetworkOutputMessage as _StartedNetworkOutputMessage`
    help: for further information visit https://lint.deno.land/#no-unused-vars

Found 1 problem
Checked 1 file
Task commit:commitlint deno run -A npm:commitlint --edit ""
[features/network-protocol 304219e] fix(tests): network tests assertion
 1 file changed, 1 insertion(+), 12 deletions(-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.