SpringQL: Open-source stream processor for IoT devices and in-vehicle computers

Overview

What is SpringQL?

SpringQL is an open-source stream processor specialized in memory efficiency. It is supposed to run on embedded systems like IoT devices and in-vehicle computers.

  • SQL support

    Like other stream processors, infinite number of rows flow through SpringQL system. You can register SQL-like (continuous) queries to filter, transform, and analyze rows. The query language is named SpringQL as well as the whole system itself. SpringQL has the ability to make windows from stream of rows so that you can perform GROUP BY, JOIN, and even more operations targeting on finite number of rows.

  • Memory efficient

    Unlike other stream processors, the goal of SpringQL is saving working memory during stream processing. Of course the end-to-end latency and throughput are also important but they aren't the main targets.

  • Minimum dependencies

    Embedded systems may have small storage size and only have quite fundamental libraries (libc, for example). SpringQL depends only on... TBD

Why SpringQL?

Complex stream analysis (heavy machine learning, visualization, and so on) would be done in server-side. SpringQL is useful to reduce upload data size from embedded devices to servers.

You can sample, filter (WHERE), aggregate (GROUP BY), shrink (SELECT necessary_column, ...) stream rows to reduce data size inside embedded devices.

Getting started

You can use SpringQL in 3 ways:

  1. Embedded mode: Link libspringql from your apprecation binary and call API functions using a client library for each programming language.
  2. IPC mode: IPC (Iterprocess Communication) with springqld from your applications. Multiple applications can share stream in this mode.
  3. Command line mode: Run springql from shell and write SpringQL. This mode is mostly for demonstration.

Here introduces "Command line mode" first to quickly grasp SpringQL usage.

Command line mode demo

springql command is available from springql-cmd crate.

Requirements

Installation

$ cargo install springql-cmd

Running demo

In this demo, you will make a pipeline to process stock trade data.

A pipeline represents rules to process stream data and it consists of the following stuffs.

TODO Diagram

  • Source: Streaming data source outside of SpringQL.
  • Sink: ...
  • Stream: Relational schema like tables in RDBMS. While tables in RDBMS hold rows inside, rows flow streams.
    • Native stream: ...
    • Foreign stream: ...
  • Pump: ...
  • Server: ...

You firstly need streaming data source to organize pipeline. springql-cmd crate provides springql-trade-source command and it provides trade logs in JSON format.

$ springql-trade-source --port 17890

Waiting for connection from input server...
Sample row: {"timestamp": "2021-10-28 13:20:51.310480519", "ticker": "GOOGL", "amount": 100}

Now you can start your pipeline and input from springql-trade-source to a foreign stream.

"timestamp" TIMESTAMP NOT NULL ROWTIME, -> "ticker" TEXT NOT NULL, -> "amount" INTEGER NOT NULL -> ) SERVER NET_SERVER OPTIONS ( -> remote_port 17890 -> ); ">
$ springql --output fst_trade_oracle.log> CREATE FOREIGN STREAM "fst_trade" (
 ->   "timestamp" TIMESTAMP NOT NULL ROWTIME,
 ->   "ticker" TEXT NOT NULL,
 ->   "amount" INTEGER NOT NULL
 -> ) SERVER NET_SERVER OPTIONS (
 ->   remote_port 17890  
 -> );

ROWTIME keyword means "timestamp" field is used as timestamp of each row.

Data do not start to flow until you create a pump which input rows from "trade" stream. A pump needs output stream so here creates "trade_oracle" stream too.

"timestamp" TIMESTAMP NOT NULL ROWTIME, -> "ticker" TEXT NOT NULL, -> "amount" INTEGER NOT NULL -> ); ⛲> CREATE PUMP "pu_filter_oracle" AS -> INSERT INTO "st_trade_oracle" ("timestamp", "ticker", "amount") -> SELECT STREAM "timestamp", "ticker", "amount" FROM "fst_trade" WHERE "ticker" = "ORCL"; ">
> CREATE STREAM "st_trade_oracle" (
 ->   "timestamp" TIMESTAMP NOT NULL ROWTIME,
 ->   "ticker" TEXT NOT NULL,
 ->   "amount" INTEGER NOT NULL
 -> );

⛲> CREATE PUMP "pu_filter_oracle" AS
 ->   INSERT INTO "st_trade_oracle" ("timestamp", "ticker", "amount")
 ->   SELECT STREAM "timestamp", "ticker", "amount" FROM "fst_trade" WHERE "ticker" = "ORCL";

Unfortunately, you cannot see records from "st_trade_oracle" directly because you can only observe output data from sink. Let's create in-memory queue sink and pump to it here.

"ts" TIMESTAMP NOT NULL, -> "ticker" TEXT NOT NULL, -> "amount" INTEGER NOT NULL -> ) SERVER IN_MEMORY_QUEUE; ⛲> CREATE PUMP "pu_oracle_to_sink" AS -> INSERT INTO "fst_trade_oracle" ("ts", "ticker", "amount") -> SELECT STREAM "timestamp", "ticker", "amount" FROM "st_trade_oracle"; ">
> CREATE FOREIGN STREAM "fst_trade_oracle" (
 ->   "ts" TIMESTAMP NOT NULL,
 ->   "ticker" TEXT NOT NULL,
 ->   "amount" INTEGER NOT NULL
 -> ) SERVER IN_MEMORY_QUEUE;

⛲> CREATE PUMP "pu_oracle_to_sink" AS
 ->   INSERT INTO "fst_trade_oracle" ("ts", "ticker", "amount")
 ->   SELECT STREAM "timestamp", "ticker", "amount" FROM "st_trade_oracle";

You might realize that "timestamp" column has changed into "ts" and ROWTIME keyword disappears. A sink does not have a concept of ROWTIME so it is meaningless to specify ROWTIME keyword to output foreign stream.

After activating 2 pumps, you can finally get output stream.

SELECT "ts", "ticker", "amount" FROM "fst_trade_oracle"; Output are written to: `fst_trade_oracle.log` ... ">
> ALTER PUMP "pu_filter_oracle", "pu_oracle_to_sink" START;

⛲> SELECT "ts", "ticker", "amount" FROM "fst_trade_oracle";
Output are written to: `fst_trade_oracle.log` ...
$ tail -f fst_trade_oracle.log
{"ts":"2021-10-28 13:23:34.826434031","ticker":"ORCL","amount":100}
{"ts":"2021-10-28 13:23:36.382103952","ticker":"ORCL","amount":200}
...

Embedded mode

Client libraries for the following languages are currently available:

C client, for example, is composed of a header file and a dynamic library. See C client repository for more details on how to use SpringQL in embedded mode.

IPC mode

Installation

$ cargo install springql-daemon

TBD launch sqringqld via systemctl?

Launch daemon with a pipeline commonly used by applications

TODO config file?

share the same interm streams and sinks (not in memory but like redis)

Writing and building sample application

TODO read from redis sink

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in SpringQL by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Copyright (c) 2021 TOYOTA MOTOR CORPORATION.

Comments
  • Coverage with grcov

    Coverage with grcov

    Close #69

    add coverage_grcov.makefile.toml. make lcov task to alias coverage_grcov.

    change upload codecov coverage data from ./lcov.info to ./target/lcov.info


    @laysakura added: also fixes: #89

    opened by kazuk 6
  • add `cargo publish --dry-run` retry loop for waiting cargo repo update

    add `cargo publish --dry-run` retry loop for waiting cargo repo update

    Issue number and link

    Fixes: this run failed

    https://github.com/SpringQL/SpringQL/actions/runs/3097372810/jobs/5013974715

    Describe your changes

    Checklist before requesting a review

    • [ ] I follow the Semantic Pull Requests rules (bugfix/feature)
    • [ ] I specified links to related issues (must: bugfix, want: feature)
    • [ ] I have performed a self-review of my code (bugfix/feature)
    • [ ] I have added thorough tests (bugfix/feature)
    • [ ] I have edited ## [Unreleased] section in CHANGELOG.md following keep a changelog syntax (bugfix/feature)
    • [ ] I {made/will make} a related pull request for documentation repo (feature)
    opened by kazuk 4
  • feat: Add wrapping `springql` crate

    feat: Add wrapping `springql` crate

    Issue number and link

    Fixes: #192

    Describe your changes

    • add wrapping crate springql
    • re-export springql-core API's from springql

    Checklist before requesting a review

    • [x] I follow the Semantic Pull Requests rules (bugfix/feature)
    • [x] I specified links to related issues (must: bugfix, want: feature)
    • [x] I have performed a self-review of my code (bugfix/feature)
    • [ ] I have added thorough tests (bugfix/feature)
    • [x] I have edited ## [Unreleased] section in CHANGELOG.md following keep a changelog syntax (bugfix/feature)
    • [x] I {made/will make} a related pull request for documentation repo (feature)
    opened by kazuk 4
  • remove parking_lot from dependency

    remove parking_lot from dependency

    Issue number and link

    Fixes: #222

    Describe your changes

    • remove parking_lot and fix compilation errors

    Checklist before requesting a review

    • [ ] I follow the Semantic Pull Requests rules (bugfix/feature)
    • [ ] I specified links to related issues (must: bugfix, want: feature)
    • [ ] I have performed a self-review of my code (bugfix/feature)
    • [ ] I have added thorough tests (bugfix/feature)
    • [ ] I have edited ## [Unreleased] section in CHANGELOG.md following keep a changelog syntax (bugfix/feature)
    • [ ] I {made/will make} a related pull request for documentation repo (feature)
    opened by kazuk 3
  • remove config deserialize from core

    remove config deserialize from core

    Issue number and link

    Fixes: #220

    Describe your changes

    • remove config crate dependency from springql-core
    • add config crate to springql
    • move config deserialize function from core, to springql
    • add public surface api config_from_toml

    Checklist before requesting a review

    • [x] I follow the Semantic Pull Requests rules (bugfix/feature)
    • [x] I specified links to related issues (must: bugfix, want: feature)
    • [x] I have performed a self-review of my code (bugfix/feature)
    • [ ] I have added thorough tests (bugfix/feature)
    • [x] I have edited ## [Unreleased] section in CHANGELOG.md following keep a changelog syntax (bugfix/feature)
    • [ ] I {made/will make} a related pull request for documentation repo (feature)
    opened by kazuk 3
  • fix: migration dependency : chrono -> time-rs

    fix: migration dependency : chrono -> time-rs

    Issue number and link

    Fixes: #191

    Describe your changes

    • remove dependency to chrono
    • add dependency time

    Checklist before requesting a review

    • [x] I follow the Semantic Pull Requests rules (bugfix/feature)
    • [x] I specified links to related issues (must: bugfix, want: feature)
    • [x] I have performed a self-review of my code (bugfix/feature)
    • [ ] I have added thorough tests (bugfix/feature)
    • [x] I have edited ## [Unreleased] section in CHANGELOG.md following keep a changelog syntax (bugfix/feature)
    • [ ] I {made/will make} a related pull request for documentation repo (feature)
    opened by kazuk 3
  • Refactor Hide detail module structure

    Refactor Hide detail module structure

    Issue number and link

    Fixes: #177

    Describe your changes

    make private mod bellow

    • pipeline::field::field_name
    • pipeline::pump_model::window_operation_parameter::aggregate
    • pipeline::pump_model::window_operation_parameter::join_parameter

    Checklist before requesting a review

    • [x] I follow the Semantic Pull Requests rules (bugfix/feature)
    • [x] I specified links to related issues (must: bugfix, want: feature)
    • [x] I have performed a self-review of my code (bugfix/feature)
    • [ ] I have added thorough tests (bugfix/feature)
    • [x] I have edited ## [Unreleased] section in CHANGELOG.md following keep a changelog syntax (bugfix/feature)
    • [ ] I {made/will make} a related pull request for documentation repo (feature)
    opened by kazuk 3
  • Run cargo-deny at build (experimental/proposal)

    Run cargo-deny at build (experimental/proposal)

    Issue number and link

    Fixes: #147

    Describe your changes

    add "springql-build" for build script crate. this runs "cargo deny check" for workspace.

    add springql-build to springql-core's [build-dependencies]

    Checklist before requesting a review

    • [x] I follow the Semantic Pull Requests rules (bugfix/feature)
    • [x] I specified links to related issues (must: bugfix, want: feature)
    • [x] I have performed a self-review of my code (bugfix/feature)
    • [x] I have added thorough tests (bugfix/feature)
    • [ ] I have edited ## [Unreleased] section in CHANGELOG.md following keep a changelog syntax (bugfix/feature)
    • [ ] I {made/will make} a related pull request for documentation repo (feature)
    experimental 
    opened by kazuk 3
  • ci: Prevent dependencies issue

    ci: Prevent dependencies issue

    Issue number and link

    Fixes: #138

    Describe your changes

    add deny.toml for cargo-deny add cargo-deny install for Github Actions add check-dependencies task for makefile add CI job for runs it.

    Checklist before requesting a review

    • [x] I follow the Semantic Pull Requests rules (bugfix/feature)
    • [x] I specified links to related issues (must: bugfix, want: feature)
    • [x] I have performed a self-review of my code (bugfix/feature)
    • [ ] I have added thorough tests (bugfix/feature)
    • [x] I have edited ## [Unreleased] section in CHANGELOG.md following keep a changelog syntax (bugfix/feature)
    • [x] I {made/will make} a related pull request for documentation repo (feature)
    opened by kazuk 3
  • feat: add doc alias for project configuration

    feat: add doc alias for project configuration

    Issue number and link

    Fixes: #137

    Describe your changes

    Checklist before requesting a review

    • [x] I follow the Semantic Pull Requests rules (bugfix/feature)
    • [x] I specified links to related issues (must: bugfix, want: feature)
    • [x] I have performed a self-review of my code (bugfix/feature)
    opened by kazuk 3
  • ci: Prevent dependencies issue

    ci: Prevent dependencies issue

    Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

    checking license compatibility, security advisories, etc

    https://crates.io/crates/cargo-audit https://crates.io/crates/cargo-deny

    Describe the solution you'd like A clear and concise description of what you want to happen.

    add cargo-deny, cargo-audit to CI task

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    use dependabot for security vulnerabilities.

    Additional context Add any other context or screenshots about the feature request here.

    ci 
    opened by kazuk 3
  • ci : Fix broken links errors

    ci : Fix broken links errors

    Issue number and link

    Fixes deadlinks errors

    Describe your changes

    Bump up pest and remove log files for deadlinks. This is because pest caused deadlinks errors.

    Checklist before requesting a review

    • [x] I follow the Semantic Pull Requests rules (bugfix/feature)
    • [ ] I specified links to related issues (must: bugfix, want: feature)
    • [ ] I have performed a self-review of my code (bugfix/feature)
    • [ ] I have added thorough tests (bugfix/feature)
    • [ ] I have edited ## [Unreleased] section in CHANGELOG.md following keep a changelog syntax (bugfix/feature)
    • [ ] I {made/will make} a related pull request for documentation repo (feature)
    opened by TaKO8Ki 1
  • `Use workflow from` is ignored in release workflow

    `Use workflow from` is ignored in release workflow

    What's ignored

    image

    Where's problem

    https://github.com/SpringQL/SpringQL/blob/3a462a5d04b85d7571cd0359e70c2341d9bbde10/.github/workflows/release.yml#L27-L28

    ci 
    opened by laysakura 1
  • Remove netcat dependency from example

    Remove netcat dependency from example

    Motivation

    We want to dockernize

    https://github.com/SpringQL/SpringQL/issues/221

    I try to build docker build and run.

    $ docker run b230c49234ba
    waiting JSON records in tcp/54300 port...
    [2022-07-09T22:39:44Z ERROR panic] thread 'main' panicked at 'send failed: Os { code: 2, kind: NotFound, message: "No such file or directory" }': springql/examples/doc_app1.rs:23
    

    crashed at this function.

    fn send_data_to_pipeline() {
        Command::new("bash")
            .arg("-c")
            .arg(r#"echo '{"ts": "2022-01-01 13:00:00.000000000", "temperature": 5.3}' |nc localhost 54300"#)
            .spawn()
            .expect("send failed");
    }
    

    Refactoring target

    Do not use to netcat.

    refactor 
    opened by kazuk 1
  • Running on distroless image

    Running on distroless image

    Is your feature request related to a problem? Please describe.

    Describe the solution you'd like

    SpringQL is aiming to be as lightweight as possible. It assumes to run on POSIX compatible OS with some standard C library.

    In order to realize the policy, it's great if we assure SpringQL's tests & apps run on distroless image.

    This feature may clearly show the SpringQL's position compared to server-side rich stream processors like Flink, Beam, Spark Streaming, etc.

    Describe alternatives you've considered

    apko image? I'm not sure enough.

    Additional context

    Use springql/example/ for testing.

    feat 
    opened by laysakura 0
Owner
SpringQL
SpringQL: An open-source stream processor for IoT devices and in-vehicle computers.
SpringQL
Small example using Slint on the MXCHIP IoT DevKit (AZ3166)

Small example using Slint on the MXCHIP IoT DevKit (AZ3166) To Build and run: You need: The hardware: an MXCHIP IoT DevKit https://en.mxchip.com/az316

Olivier Goffart 4 Dec 24, 2022
A simple web server(and library) to display server stats over HTTP and Websockets/SSE or stream it to other systems.

x-server-stats A simple web server(and library) to display server stats over HTTP and Websockets/SSE or stream it to other systems. x-server(in x-serv

Pratyaksh 11 Oct 17, 2022
The best open source remote desktop software

The best open-source remote desktop software, written in Rust. Works out of the box, no configuration required. Great alternative to TeamViewer and AnyDesk! You have full control of your data, with no concerns about security. You can use our rendezvous/relay server, set up your own, or write your own rendezvous/relay server.

RustDesk 35.4k Jan 4, 2023
Filen.io is a cloud storage provider with an open-source desktop client.

Library to call Filen.io API from Rust Filen.io is a cloud storage provider with an open-source desktop client. My goal is to write a library which ca

Konstantin Zakharov 5 Nov 15, 2022
The open source distributed web search engine that searches by meaning.

DawnSearch DawnSearch is an open source distributed web search engine that searches by meaning. It uses semantic search (searching on meaning), using

DawnSearch 4 Aug 8, 2023
MuonFP is an enterprise ready, TCP passive fingerprinter written in Rust that has no external dependencies such as WireShark or other open source software.

MuonFP is a TCP passive fingerprinter written in Rust that has no external dependencies such as WireShark or other open source software. The program w

Sundruid 8 Sep 22, 2024
Transforms UDP stream into (fake) TCP streams that can go through Layer 3 & Layer 4 (NAPT) firewalls/NATs.

Phantun A lightweight and fast UDP to TCP obfuscator. Table of Contents Phantun Latest release Overview Usage 1. Enable Kernel IP forwarding 2. Add re

Datong Sun 782 Dec 30, 2022
General-purpose asynchronous socket stream.

async-socket This crate implements a general-purpose asynchronous socket. The Socket implements AsyncRead, AsyncWrite, Stream and Clone traits and thu

Kristijan Sedlak 3 Oct 20, 2021
Stream API for tokio-udp.

UDPflow Stream API for tokio-udp. TCP-like UDP stream use tokio::net::UdpSocket; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use udpflow::{UdpListen

zephyr 5 Dec 2, 2022
Crate extending futures stream combinators, that is adding precise rate limiter

stream-rate-limiter Stream combinator .rate_limiter(opt: RateLimitOptions) Provides way to limit stream element rate with constant intervals. It adds

null 3 Jul 23, 2023
Stream & Download Cartoons & Animes

eren Stream & Download Cartoons & Animes Install Linux/Mac First of all install rust then git clone 'https://github.com/Based-Programmer/eren' && \ cd

BASED 3 Jul 8, 2023
Many modbus devices support only one or very few clients

Modbus TCP proxy Many modbus devices support only one or very few clients. This proxy acts as a bridge between the client and the modbus device. It ca

Tiago Coutinho 6 Aug 10, 2022
Tiny CLI application in rust to scan ports from a given IP and find how many are open. You can also pass the amount of threads for that scan

Port Scanner A simple multi-threaded port scanner written in Rust. Usage Run the port scanner by providing the target IP address and optional flags. $

nicolas lopes 4 Aug 29, 2023
Open Internet Service to store transaction history for NFTs/Tokens on the Internet Computer

CAP - Certified Asset Provenance Transaction history & asset provenance for NFT’s & Tokens on the Internet Computer CAP is an open internet service pr

Psychedelic 42 Nov 10, 2022
Cover is an open internet service for canister code verification on the Internet Computer

Cover Cover (short for Code Verification) is an open internet service that helps verify the code of canisters on the Internet Computer. Visit our webs

Psychedelic 14 Oct 31, 2022
A open port scanner.

opscan A open port scanner. Install With cargo cargo install --force opscan With docker docker run --rm -it sigoden/opscan opscan.nmap.org Binaries

null 17 Feb 19, 2023
MASQ Network 121 Dec 20, 2022
An end-to-end encrypted, anonymous IP-hiding, decentralized, audio/video/file sharing/offline messaging multi-device platform built for both communications and application security and performance.

An end-to-end encrypted, anonymous IP-hiding, decentralized, audio/video/file sharing/offline messaging multi-device platform built for both communications and application security and performance.

null 2 Apr 27, 2022
A fast, stable, efficient, and lightweight intranet penetration, port forwarding tool supports multiple connections, cascading proxy, and transmission encryption

A fast, stable, efficient, and lightweight intranet penetration, port forwarding tool supports multiple connections, cascading proxy, and transmission encryption

editso 1.3k Dec 30, 2022