This Month in Reactive Graph! August 2024

Hello and welcome to another issue of This Month in Reactive Graph! Reactive Graph is a runtime empowering everyone to build reliable and efficient software. This is a monthly summary of its progress and community. Want something mentioned? Send us a pull request. Want to get involved? We love contributions.

This Month in Reactive Graph is openly developed on GitHub and archives can be viewed at this-month-in.reactive-graph.io. If you find any errors in this month's issue, please submit a PR.


Table of Contents


Extended the Rust GraphQL Client

The Rust GraphQL Client is important to make Reactive Graph more useful and accessible. It allows to access the Reactive Graph programmatically by simply using the crate reactive-graph-client. The client crate is the foundation for the command line interface and for rust applications.

The Rust GraphQL Client is now capable to manage the type system. This means you can query or alter components, entity types and relation types. Furthermore, we started with the implementation of managing the instance system. This means you can query and alter entity instances and relation instances. Last but not least, we decided to defer work on the flow types and flow instances till instance system has been fully implemented.

The following diagram shows the importance of the Rust GraphQL Client:

flowchart TD

    subgraph Runtime
        G[GraphQL API]
        A[Reactive Graph]

        G --> A
    end

    subgraph Client
        CLI[Command Line Interface]
        RC1[Rust Client]

        CLI --> RC1
        RC1 --> G
    end

    subgraph Rust Application
        RA[Rust Application]
        RC2[Rust Client]

        RA --> RC2
        RC2 --> G
    end

Extended the Command Line Interface

The command line interface made big progress.

Manage Type System via CLI

➜ reactive-graph client entity-types get string title_case                                                        
Command Output
╔════════════════════════╦════════════════════════╦══════════════════════════════════╦══════════════════════════════════════╦══════════════════════════════════════════════════════════════════════════════╦════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║ namespace              ║ name                   ║ description                      ║ components                           ║ properties                                                                   ║ extensions                                                                                                         ║
╠════════════════════════╬════════════════════════╬══════════════════════════════════╬══════════════════════════════════════╬══════════════════════════════════════════════════════════════════════════════╬════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ string                 ║ title_case             ║ Converts the input to title case ║  namespace       │ name              ║  name                                │ data_type │ socket_type │ mutability  ║  namespace              │ name                   │ description │ extension                                         ║
║                        ║                        ║                                  ║ ─────────────────┼────────────────── ║ ─────────────────────────────────────┼───────────┼─────────────┼──────────── ║ ────────────────────────┼────────────────────────┼─────────────┼────────────────────────────────────────────────── ║
║                        ║                        ║                                  ║  string          │ string_operation  ║  result                              │ String    │ Output      │ Immutable   ║  core                   │ divergent              │             │ []                                                ║
║                        ║                        ║                                  ║                                      ║ ─────────────────────────────────────┼───────────┼─────────────┼──────────── ║ ────────────────────────┼────────────────────────┼─────────────┼────────────────────────────────────────────────── ║
║                        ║                        ║                                  ║                                      ║  lhs                                 │ String    │ Input       │ Mutable     ║  metadata               │ dublin-core            │             │ {                                                 ║
║                        ║                        ║                                  ║                                      ║                                                                              ║                         │                        │             │   "creator": "Hanack",                            ║
║                        ║                        ║                                  ║                                      ║                                                                              ║                         │                        │             │   "subject": "Converts the input to title case",  ║
║                        ║                        ║                                  ║                                      ║                                                                              ║                         │                        │             │   "title": "Title Case"                           ║
║                        ║                        ║                                  ║                                      ║                                                                              ║                         │                        │             │ }                                                 ║
╚════════════════════════╩════════════════════════╩══════════════════════════════════╩══════════════════════════════════════╩══════════════════════════════════════════════════════════════════════════════╩════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝

Output Format Table

With the new parameter --output-format it is possible to output the data in table format (default), or as JSON or as TOML.

You can explicitly define the output format is table:

➜ reactive-graph client entity-instances list-properties 6ba7b810-9e15-11d1-50b4-00c04fd530c7 --output-format=table

Or you can just omit the option, because table is the default output format:

➜ reactive-graph client entity-instances list-properties 6ba7b810-9e15-11d1-50b4-00c04fd530c7
Command Output
╔════════════╦═════════════════════════════════════════════════════════════════════════════════════════════════════╗
║ name       ║ value                                                                                               ║
╠════════════╬═════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ args       ║ [{"help":"Delay shutdown by N seconds","long":"delay","name":"delay","required":false,"short":"d"}] ║
╠════════════╬═════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ cmd_result ║ 0                                                                                                   ║
╠════════════╬═════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ prop_name  ║ "New Value"                                                                                         ║
╠════════════╬═════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ label      ║ "/org/inexor/commands/core/shutdown"                                                                ║
╠════════════╬═════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ delay      ║ 0                                                                                                   ║
╠════════════╬═════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ command    ║ "shutdown"                                                                                          ║
╠════════════╬═════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ trigger    ║ false                                                                                               ║
╠════════════╬═════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ namespace  ║ "core"                                                                                              ║
╠════════════╬═════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ help       ║ "Shutdown the application"                                                                          ║
╚════════════╩═════════════════════════════════════════════════════════════════════════════════════════════════════╝

Output Format JSON

Additionally to the output format table, two new output formats have been implemented json and toml. This allows to use the Reactive Graph CLI as tool for exporting types and instances.

➜ reactive-graph client entity-instances list-properties 6ba7b810-9e15-11d1-50b4-00c04fd530c7 --output-format=json
Command Output
[
  {
    "name": "help",
    "value": "Shutdown the application"
  },
  {
    "name": "label",
    "value": "/org/inexor/commands/core/shutdown"
  },
  {
    "name": "trigger",
    "value": false
  },
  {
    "name": "cmd_result",
    "value": 0
  },
  {
    "name": "prop_name",
    "value": "New Value"
  },
  {
    "name": "args",
    "value": [
      {
        "help": "Delay shutdown by N seconds",
        "long": "delay",
        "name": "delay",
        "required": false,
        "short": "d"
      }
    ]
  },
  {
    "name": "delay",
    "value": 0
  },
  {
    "name": "namespace",
    "value": "core"
  },
  {
    "name": "command",
    "value": "shutdown"
  }
]

Also, it allows to use the CLI as stdin for other CLI programs by using shell pipes. For example:

reactive-graph client entity-type get namespace type_name --output-format=JSON | less

Replacing OpenSSL with rustls

  • Started work on replacing OpenSSL with rustls
  • Actix Web now supports rustls
  • Patched the gql-client crate for rustls support
  • Waiting for a PR in aws-lc-rs to be merged (https://github.com/aws/aws-lc-rs/pull/491) since aws-lc-rs requires NASM on windows and this breaks the CI

Continuous Modernization

  • Fixed a bunch of clippy lints
  • Upgraded builds to use the latest nightly rust compiler
  • Replaced old GitHub Actions (actions-rs) with modern GitHub Actions
  • We are not quite happy that windows builds needs more than an hour and mac builds more than three hours, so we added another layer of cache to speed up the CI
  • Pinned the nightly version in order to make caching in the CI more effective

Java GraphQL Client

  • The goal was to show that it's possible to manage the Reactive Graph from a programming language other than Rust
  • A gradle plugin generates POJOs and interfaces from the GraphQL schema (schema first approach). It's even possible to implement Spring Data alike repositories
  • The status of the Java GraphQL Client is only a proof of concept. In the future, the Java GraphQL Client shall be on feature parity with the Rust GraphQL Client

The following diagram shows how the GraphQL Client APIs are used by applications:

flowchart TD

    subgraph Runtime
        G[GraphQL API]
        A[Reactive Graph]

        G --> A
    end

    subgraph Client
        CLI[Command Line Interface]
        RC1[Rust Client]

        CLI --> RC1
        RC1 --> G
    end

    subgraph Rust Application
        RA[Rust Application]
        RC2[Rust Client]

        RA --> RC2
        RC2 --> G
    end

    subgraph Java Application
        JA[Java Application]
        JC[Java Client]

        JA --> JC
        JC --> G
    end

As you can see, thanks to the GraphQL API it is possible to build applications in different programming languages.


POC WASM / WASI

We implemented a POC to check the current status of WASM. WASM will be an important part of the Reactive Graph. One use case is that the Reactive Graph could use WASM to load plugins written in "any" language that compiles to WASM. Another use case is that the Reactive Graph could use WASM to load behaviours for reactive entities or reactive relations. The POC showed that it now possible to interop with more complex data than primitive data types like integers.


Identity and Permission System

Currently, Reactive Graph lacks an Identity and Permission System. One of the next steps will be to implement it. We decided to not use an existing framework. The type system has to be threatened a bit different from the instance system. Also, the permission system is more complex for the instance system. In a first step we specified the requirements and the data model of the upcoming identity management and the permission system (https://github.com/reactive-graph/reactive-graph/issues/26).


Goals for September 2024

(highest priority on top)

  1. Finish work on the rust GraphQL client and the Command Line Interface
  2. Finish replacing OpenSSL with rustls
  3. Start work on the Identity and Permission System
  4. Specify the Type System Persistence (Graph Relational Mapper)