diff --git a/.github/workflows/scylla-ci.yml b/.github/workflows/scylla-ci.yml
index 98842bf1..39b373c4 100644
--- a/.github/workflows/scylla-ci.yml
+++ b/.github/workflows/scylla-ci.yml
@@ -23,12 +23,27 @@ jobs:
steps:
- name: Setup Rust
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
submodules: recursive
- - name: Generate prisma
- run: cargo prisma generate
+ - name: Clippy
+ run: cargo clippy --all-targets
+ - name: Fmt
+ run: cargo fmt --check
+ - name: Start DB
+ working-directory: compose
+ run: docker compose up -d odyssey-timescale
- name: Build
run: cargo build --verbose
- - name: Clippy
- run: cargo clippy --verbose -- -D warnings
+ - name: Run # so we can migrate the database, run for a little than bail
+ env:
+ DATABASE_URL: postgresql://postgres:password@127.0.0.1:5432/postgres
+ run: |
+ cargo run & ID=$!; sleep 10s; kill $ID
+ - name: Test
+ env:
+ DATABASE_URL: postgresql://postgres:password@127.0.0.1:5432/postgres
+ run: cargo test -- --test-threads=1
+ - name: Cleanup
+ working-directory: compose
+ run: docker compose down
diff --git a/.github/workflows/scylla-tests.yml b/.github/workflows/scylla-tests.yml
deleted file mode 100644
index f559faf7..00000000
--- a/.github/workflows/scylla-tests.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-name: Scylla Rust Tests
-
-on:
- push:
- branches:
- - main
- - develop
- pull_request:
- branches:
- - main
- - develop
- - 'feature/**'
-
-env:
- SOURCE_DATABASE_URL: postgresql://postgres:password@127.0.0.1:5432/timescaledb cargo run
-
-jobs:
- run-tests:
- runs-on: ubuntu-latest
- timeout-minutes: 15
- steps:
- - name: Checkout repository
- uses: actions/checkout@v3
- with:
- submodules: true
- - name: Run db
- working-directory: compose
- run: docker compose run -P -d odyssey-timescale
- - name: Generate prisma
- run: cargo prisma generate
- working-directory: scylla-server
- - name: Deploy prisma
- run: cargo prisma migrate deploy
- working-directory: scylla-server
- - name: Run tests
- working-directory: scylla-server
- run: cargo test -- --test-threads=1
diff --git a/angular-client/src/components/carousel/carousel.component.html b/angular-client/src/components/carousel/carousel.component.html
index 6a6be750..919b15b5 100644
--- a/angular-client/src/components/carousel/carousel.component.html
+++ b/angular-client/src/components/carousel/carousel.component.html
@@ -11,24 +11,39 @@
-
+
-
+
-
-
-
-
+
-
+
diff --git a/angular-client/src/pages/graph-page/graph-caption/graph-caption.component.html b/angular-client/src/pages/graph-page/graph-caption/graph-caption.component.html
index 222ec5fe..ed18238d 100644
--- a/angular-client/src/pages/graph-page/graph-caption/graph-caption.component.html
+++ b/angular-client/src/pages/graph-page/graph-caption/graph-caption.component.html
@@ -4,7 +4,11 @@
@if (dataTypeName) {
diff --git a/angular-client/src/utils/types.utils.ts b/angular-client/src/utils/types.utils.ts
index 2ee190ec..a8f54665 100644
--- a/angular-client/src/utils/types.utils.ts
+++ b/angular-client/src/utils/types.utils.ts
@@ -15,7 +15,8 @@ export interface NodeWithVisibilityToggle extends Node {
dataTypesAreVisible: boolean;
}
-export interface NodeWithVisibilityToggleObservable extends NodeWithVisibilityToggle {
+export interface NodeWithVisibilityToggleObservable
+ extends NodeWithVisibilityToggle {
dataTypesObservable: Observable;
}
@@ -34,7 +35,6 @@ export type Run = {
id: number;
locationName: string;
driverName: string;
- systemName: string;
time: Date;
};
diff --git a/compose/compose.client-dev.yml b/compose/compose.client-dev.yml
index 1c550727..9b4c46c0 100644
--- a/compose/compose.client-dev.yml
+++ b/compose/compose.client-dev.yml
@@ -2,7 +2,6 @@ services:
scylla-server:
environment:
- SCYLLA_SIREN_HOST_URL=siren:1883
- - SCYLLA_PROD=true
siren:
extends:
diff --git a/compose/compose.yml b/compose/compose.yml
index 39178cdb..2f0cab62 100644
--- a/compose/compose.yml
+++ b/compose/compose.yml
@@ -26,17 +26,15 @@ services:
depends_on:
- odyssey-timescale
environment:
- - SOURCE_DATABASE_URL=postgresql://postgres:password@odyssey-timescale:5432/postgres
- # - PROD_SIREN_HOST_URL=siren:1883
- - SCYLLA_PROD=true
- #- SCYLLA_SATURATE_BATCH=false
- #-SCYLLA_DATA_UPLOAD_DISABLE=false
- #-SCYLLA_SIREN_HOST_URL=localhost:1883
- #-SCYLLA_BATCH_UPSERT_TIME=10
- - SCYLLA_RATE_LIMIT_MODE=static
- - SCYLLA_STATIC_RATE_LIMIT_VALUE=50
- #-SCYLLA_SOCKET_DISCARD_PERCENT=0
- - RUST_LOG=warn,scylla_server=debug
+ - DATABASE_URL=postgresql://postgres:password@odyssey-timescale:5432/postgres
+ # - PROD_SIREN_HOST_URL=siren:1883
+ #-SCYLLA_DATA_UPLOAD_DISABLE=false
+ #-SCYLLA_SIREN_HOST_URL=localhost:1883
+ #-SCYLLA_BATCH_UPSERT_TIME=10
+ - SCYLLA_RATE_LIMIT_MODE=static
+ - SCYLLA_STATIC_RATE_LIMIT_VALUE=50
+ #-SCYLLA_SOCKET_DISCARD_PERCENT=0
+ - RUST_LOG=warn,scylla_server=debug
cpu_shares: 1024
stop_grace_period: 2m
stop_signal: SIGINT
diff --git a/scylla-server/.cargo/config.toml b/scylla-server/.cargo/config.toml
deleted file mode 100644
index 09ffa116..00000000
--- a/scylla-server/.cargo/config.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-[alias]
-prisma = "run --release --package prisma-cli --"
-prisma-seed = "run --release --bin seed"
\ No newline at end of file
diff --git a/scylla-server/Cargo.lock b/scylla-server/Cargo.lock
index 62c335f8..874a978e 100755
--- a/scylla-server/Cargo.lock
+++ b/scylla-server/Cargo.lock
@@ -17,17 +17,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
-[[package]]
-name = "ahash"
-version = "0.7.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
-dependencies = [
- "getrandom 0.2.15",
- "once_cell",
- "version_check",
-]
-
[[package]]
name = "ahash"
version = "0.8.11"
@@ -40,15 +29,6 @@ dependencies = [
"zerocopy",
]
-[[package]]
-name = "aho-corasick"
-version = "0.7.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
-dependencies = [
- "memchr",
-]
-
[[package]]
name = "aho-corasick"
version = "1.1.3"
@@ -134,12 +114,6 @@ version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
-[[package]]
-name = "ascii"
-version = "0.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e"
-
[[package]]
name = "async-stream"
version = "0.3.5"
@@ -173,15 +147,6 @@ dependencies = [
"syn 2.0.67",
]
-[[package]]
-name = "atomic-shim"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67cd4b51d303cf3501c301e8125df442128d3c6d7c69f71b27833d253de47e77"
-dependencies = [
- "crossbeam-utils",
-]
-
[[package]]
name = "autocfg"
version = "1.3.0"
@@ -326,34 +291,6 @@ dependencies = [
"rustc-demangle",
]
-[[package]]
-name = "base-x"
-version = "0.2.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270"
-
-[[package]]
-name = "base36"
-version = "0.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9c26bddc1271f7112e5ec797e8eeba6de2de211c1488e506b9500196dbf77c5"
-dependencies = [
- "base-x",
- "failure",
-]
-
-[[package]]
-name = "base64"
-version = "0.12.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
-
-[[package]]
-name = "base64"
-version = "0.13.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
-
[[package]]
name = "base64"
version = "0.21.7"
@@ -366,24 +303,6 @@ version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
-[[package]]
-name = "bigdecimal"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa"
-dependencies = [
- "num-bigint",
- "num-integer",
- "num-traits",
- "serde",
-]
-
-[[package]]
-name = "bit-vec"
-version = "0.6.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
-
[[package]]
name = "bitflags"
version = "1.3.2"
@@ -396,15 +315,6 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
-[[package]]
-name = "block-buffer"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
-dependencies = [
- "generic-array",
-]
-
[[package]]
name = "block-buffer"
version = "0.10.4"
@@ -414,21 +324,6 @@ dependencies = [
"generic-array",
]
-[[package]]
-name = "builtin-psl-connectors"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "connection-string",
- "either",
- "enumflags2",
- "indoc",
- "lsp-types",
- "once_cell",
- "psl-core",
- "regex",
-]
-
[[package]]
name = "bumpalo"
version = "3.16.0"
@@ -505,7 +400,7 @@ version = "4.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e"
dependencies = [
- "heck 0.5.0",
+ "heck",
"proc-macro2",
"quote",
"syn 2.0.67",
@@ -523,39 +418,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
-[[package]]
-name = "colored"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8"
-dependencies = [
- "lazy_static",
- "windows-sys 0.48.0",
-]
-
-[[package]]
-name = "combine"
-version = "3.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680"
-dependencies = [
- "ascii",
- "byteorder",
- "either",
- "memchr",
- "unreachable",
-]
-
-[[package]]
-name = "connection-string"
-version = "0.1.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c4ecb0dc8c35d2c626e45ae70bbfcb1050b302f42bcdf025d913cc0c5a0b443"
-dependencies = [
- "js-sys",
- "wasm-bindgen",
-]
-
[[package]]
name = "console-api"
version = "0.7.0"
@@ -594,21 +456,6 @@ dependencies = [
"tracing-subscriber",
]
-[[package]]
-name = "convert_case"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8"
-
-[[package]]
-name = "convert_case"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
-dependencies = [
- "unicode-segmentation",
-]
-
[[package]]
name = "core-foundation"
version = "0.9.4"
@@ -652,24 +499,6 @@ dependencies = [
"crossbeam-utils",
]
-[[package]]
-name = "crossbeam-epoch"
-version = "0.9.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
-dependencies = [
- "crossbeam-utils",
-]
-
-[[package]]
-name = "crossbeam-queue"
-version = "0.3.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35"
-dependencies = [
- "crossbeam-utils",
-]
-
[[package]]
name = "crossbeam-utils"
version = "0.8.20"
@@ -687,36 +516,38 @@ dependencies = [
]
[[package]]
-name = "cuid"
-version = "1.3.2"
+name = "darling"
+version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51294db11d38eb763c92936c5c88425d0090e27dce21dd15748134af9e53e739"
+checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
dependencies = [
- "base36",
- "cuid-util",
- "cuid2",
- "hostname",
- "num",
- "once_cell",
- "rand 0.8.5",
+ "darling_core",
+ "darling_macro",
]
[[package]]
-name = "cuid-util"
-version = "0.1.0"
+name = "darling_core"
+version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ea2bfe0336ff1b7ca74819b2df8dfae9afea358aff6b1688baa5c181d8c3713"
+checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
+dependencies = [
+ "fnv",
+ "ident_case",
+ "proc-macro2",
+ "quote",
+ "strsim",
+ "syn 2.0.67",
+]
[[package]]
-name = "cuid2"
-version = "0.1.2"
+name = "darling_macro"
+version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "47d99cacd52fd67db7490ad051c8c1973fb75520174d69aabbae08c534c9d0e8"
+checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
dependencies = [
- "cuid-util",
- "num",
- "rand 0.8.5",
- "sha3",
+ "darling_core",
+ "quote",
+ "syn 2.0.67",
]
[[package]]
@@ -726,126 +557,89 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2"
[[package]]
-name = "datamodel-renderer"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
+name = "diesel"
+version = "2.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "158fe8e2e68695bd615d7e4f3227c0727b151330d3e253b525086c348d055d5e"
dependencies = [
- "base64 0.13.1",
- "once_cell",
- "psl",
- "regex",
+ "bitflags 2.5.0",
+ "byteorder",
+ "chrono",
+ "diesel_derives",
+ "itoa",
+ "pq-sys",
+ "r2d2",
]
[[package]]
-name = "diagnostics"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
+name = "diesel_derives"
+version = "2.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7f2c3de51e2ba6bf2a648285696137aaf0f5f487bcbea93972fe8a364e131a4"
dependencies = [
- "colored",
- "indoc",
- "pest",
+ "diesel_table_macro_syntax",
+ "dsl_auto_type",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.67",
]
[[package]]
-name = "digest"
-version = "0.9.0"
+name = "diesel_migrations"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
+checksum = "8a73ce704bad4231f001bff3314d91dce4aba0770cee8b233991859abc15c1f6"
dependencies = [
- "generic-array",
+ "diesel",
+ "migrations_internals",
+ "migrations_macros",
]
[[package]]
-name = "digest"
-version = "0.10.7"
+name = "diesel_table_macro_syntax"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
+checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25"
dependencies = [
- "block-buffer 0.10.4",
- "crypto-common",
- "subtle",
+ "syn 2.0.67",
]
[[package]]
-name = "directories"
-version = "4.0.1"
+name = "digest"
+version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
- "dirs-sys",
+ "block-buffer",
+ "crypto-common",
]
[[package]]
-name = "dirs-sys"
-version = "0.3.7"
+name = "dotenvy"
+version = "0.15.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
-dependencies = [
- "libc",
- "redox_users",
- "winapi",
-]
+checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
[[package]]
-name = "dml"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
+name = "dsl_auto_type"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c5d9abe6314103864cc2d8901b7ae224e0ab1a103a0a416661b4097b0779b607"
dependencies = [
- "chrono",
- "cuid",
+ "darling",
"either",
- "enumflags2",
- "indoc",
- "prisma-value",
- "psl-core",
- "schema-ast",
- "serde",
- "serde_json",
- "uuid",
-]
-
-[[package]]
-name = "dmmf"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "bigdecimal",
- "indexmap 1.9.3",
- "prisma-models",
- "psl",
- "schema",
- "schema-builder",
- "serde",
- "serde_json",
+ "heck",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.67",
]
-[[package]]
-name = "dotenv"
-version = "0.15.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
-
[[package]]
name = "either"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b"
-[[package]]
-name = "encoding_rs"
-version = "0.8.34"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "endian-type"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"
-
[[package]]
name = "engineioxide"
version = "0.14.0"
@@ -862,7 +656,7 @@ dependencies = [
"hyper 1.4.0",
"hyper-util",
"pin-project-lite",
- "rand 0.8.5",
+ "rand",
"serde",
"serde_json",
"smallvec",
@@ -873,26 +667,6 @@ dependencies = [
"tracing",
]
-[[package]]
-name = "enumflags2"
-version = "0.7.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d232db7f5956f3f14313dc2f87985c58bd2c695ce124c8cdd984e08e15ac133d"
-dependencies = [
- "enumflags2_derive",
-]
-
-[[package]]
-name = "enumflags2_derive"
-version = "0.7.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.67",
-]
-
[[package]]
name = "equivalent"
version = "1.0.1"
@@ -909,46 +683,12 @@ dependencies = [
"windows-sys 0.52.0",
]
-[[package]]
-name = "failure"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
-dependencies = [
- "backtrace",
- "failure_derive",
-]
-
-[[package]]
-name = "failure_derive"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
- "synstructure",
-]
-
-[[package]]
-name = "fallible-iterator"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
-
[[package]]
name = "fastrand"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
-[[package]]
-name = "fixedbitset"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
-
[[package]]
name = "fixedbitset"
version = "0.5.7"
@@ -982,21 +722,6 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
-[[package]]
-name = "foreign-types"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
-dependencies = [
- "foreign-types-shared",
-]
-
-[[package]]
-name = "foreign-types-shared"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
-
[[package]]
name = "form_urlencoded"
version = "1.2.1"
@@ -1006,27 +731,6 @@ dependencies = [
"percent-encoding",
]
-[[package]]
-name = "fuchsia-cprng"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
-
-[[package]]
-name = "futures"
-version = "0.3.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0"
-dependencies = [
- "futures-channel",
- "futures-core",
- "futures-executor",
- "futures-io",
- "futures-sink",
- "futures-task",
- "futures-util",
-]
-
[[package]]
name = "futures-channel"
version = "0.3.30"
@@ -1034,7 +738,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
dependencies = [
"futures-core",
- "futures-sink",
]
[[package]]
@@ -1044,18 +747,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
[[package]]
-name = "futures-executor"
-version = "0.3.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d"
-dependencies = [
- "futures-core",
- "futures-task",
- "futures-util",
-]
-
-[[package]]
-name = "futures-io"
+name = "futures-io"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
@@ -1083,25 +775,16 @@ version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
-[[package]]
-name = "futures-timer"
-version = "3.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24"
-
[[package]]
name = "futures-util"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
dependencies = [
- "futures-channel",
"futures-core",
- "futures-io",
"futures-macro",
"futures-sink",
"futures-task",
- "memchr",
"pin-project-lite",
"pin-utils",
"slab",
@@ -1117,17 +800,6 @@ dependencies = [
"version_check",
]
-[[package]]
-name = "getrandom"
-version = "0.1.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
-dependencies = [
- "cfg-if",
- "libc",
- "wasi 0.9.0+wasi-snapshot-preview1",
-]
-
[[package]]
name = "getrandom"
version = "0.2.15"
@@ -1136,7 +808,7 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
"cfg-if",
"libc",
- "wasi 0.11.0+wasi-snapshot-preview1",
+ "wasi",
]
[[package]]
@@ -1145,16 +817,6 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
-[[package]]
-name = "graphql-parser"
-version = "0.3.0"
-source = "git+https://github.com/prisma/graphql-parser#6a3f58bd879065588e710cb02b5bd30c1ce182c3"
-dependencies = [
- "combine",
- "indexmap 1.9.3",
- "thiserror",
-]
-
[[package]]
name = "h2"
version = "0.3.26"
@@ -1174,23 +836,11 @@ dependencies = [
"tracing",
]
-[[package]]
-name = "hashbrown"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
-dependencies = [
- "ahash 0.7.8",
-]
-
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
-dependencies = [
- "ahash 0.7.8",
-]
[[package]]
name = "hashbrown"
@@ -1198,7 +848,7 @@ version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [
- "ahash 0.8.11",
+ "ahash",
"allocator-api2",
]
@@ -1215,15 +865,6 @@ dependencies = [
"num-traits",
]
-[[package]]
-name = "heck"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
-dependencies = [
- "unicode-segmentation",
-]
-
[[package]]
name = "heck"
version = "0.5.0"
@@ -1236,21 +877,6 @@ version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
-[[package]]
-name = "hex"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
-
-[[package]]
-name = "hmac"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
-dependencies = [
- "digest 0.10.7",
-]
-
[[package]]
name = "home"
version = "0.5.9"
@@ -1260,17 +886,6 @@ dependencies = [
"windows-sys 0.52.0",
]
-[[package]]
-name = "hostname"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867"
-dependencies = [
- "libc",
- "match_cfg",
- "winapi",
-]
-
[[package]]
name = "http"
version = "0.2.12"
@@ -1362,7 +977,7 @@ dependencies = [
"httpdate",
"itoa",
"pin-project-lite",
- "socket2 0.5.7",
+ "socket2",
"tokio",
"tower-service",
"tracing",
@@ -1400,19 +1015,6 @@ dependencies = [
"tokio-io-timeout",
]
-[[package]]
-name = "hyper-tls"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
-dependencies = [
- "bytes",
- "hyper 0.14.29",
- "native-tls",
- "tokio",
- "tokio-native-tls 0.3.1",
-]
-
[[package]]
name = "hyper-util"
version = "0.1.6"
@@ -1452,33 +1054,10 @@ dependencies = [
]
[[package]]
-name = "idna"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
-dependencies = [
- "unicode-bidi",
- "unicode-normalization",
-]
-
-[[package]]
-name = "include_dir"
-version = "0.7.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd"
-dependencies = [
- "include_dir_macros",
-]
-
-[[package]]
-name = "include_dir_macros"
-version = "0.7.4"
+name = "ident_case"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75"
-dependencies = [
- "proc-macro2",
- "quote",
-]
+checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "indexmap"
@@ -1488,7 +1067,6 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
"hashbrown 0.12.3",
- "serde",
]
[[package]]
@@ -1501,42 +1079,6 @@ dependencies = [
"hashbrown 0.14.5",
]
-[[package]]
-name = "indoc"
-version = "1.0.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306"
-
-[[package]]
-name = "instant"
-version = "0.1.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "introspection-connector"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "anyhow",
- "async-trait",
- "enumflags2",
- "psl",
- "serde",
- "serde_json",
- "thiserror",
- "user-facing-errors",
-]
-
-[[package]]
-name = "ipnet"
-version = "2.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
-
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
@@ -1567,41 +1109,6 @@ dependencies = [
"wasm-bindgen",
]
-[[package]]
-name = "json-rpc-api-build"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "backtrace",
- "heck 0.3.3",
- "serde",
- "toml",
-]
-
-[[package]]
-name = "jsonrpc-core"
-version = "17.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4467ab6dfa369b69e52bd0692e480c4d117410538526a57a304a0f2250fd95e"
-dependencies = [
- "futures",
- "futures-executor",
- "futures-util",
- "log",
- "serde",
- "serde_derive",
- "serde_json",
-]
-
-[[package]]
-name = "keccak"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654"
-dependencies = [
- "cpufeatures",
-]
-
[[package]]
name = "lazy_static"
version = "1.5.0"
@@ -1614,22 +1121,6 @@ version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
-[[package]]
-name = "libredox"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
-dependencies = [
- "bitflags 2.5.0",
- "libc",
-]
-
-[[package]]
-name = "linked-hash-map"
-version = "0.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
-
[[package]]
name = "linux-raw-sys"
version = "0.4.14"
@@ -1652,52 +1143,6 @@ version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
-[[package]]
-name = "lru"
-version = "0.7.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a"
-dependencies = [
- "hashbrown 0.12.3",
-]
-
-[[package]]
-name = "lru-cache"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c"
-dependencies = [
- "linked-hash-map",
-]
-
-[[package]]
-name = "lsp-types"
-version = "0.91.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2368312c59425dd133cb9a327afee65be0a633a8ce471d248e2202a48f8f68ae"
-dependencies = [
- "bitflags 1.3.2",
- "serde",
- "serde_json",
- "serde_repr",
- "url",
-]
-
-[[package]]
-name = "mach"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "match_cfg"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4"
-
[[package]]
name = "matchers"
version = "0.1.0"
@@ -1719,16 +1164,6 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d3c2fcf089c060eb333302d80c5f3ffa8297abecf220f788e4a09ef85f59420"
-[[package]]
-name = "md-5"
-version = "0.10.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"
-dependencies = [
- "cfg-if",
- "digest 0.10.7",
-]
-
[[package]]
name = "memchr"
version = "2.7.4"
@@ -1736,128 +1171,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
-name = "metrics"
-version = "0.18.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e52eb6380b6d2a10eb3434aec0885374490f5b82c8aaf5cd487a183c98be834"
-dependencies = [
- "ahash 0.7.8",
- "metrics-macros",
-]
-
-[[package]]
-name = "metrics"
-version = "0.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "142c53885123b68d94108295a09d4afe1a1388ed95b54d5dacd9a454753030f2"
-dependencies = [
- "ahash 0.7.8",
- "metrics-macros",
-]
-
-[[package]]
-name = "metrics-exporter-prometheus"
-version = "0.10.0"
+name = "migrations_internals"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "953cbbb6f9ba4b9304f4df79b98cdc9d14071ed93065a9fca11c00c5d9181b66"
+checksum = "fd01039851e82f8799046eabbb354056283fb265c8ec0996af940f4e85a380ff"
dependencies = [
- "hyper 0.14.29",
- "indexmap 1.9.3",
- "ipnet",
- "metrics 0.19.0",
- "metrics-util 0.13.0",
- "parking_lot 0.11.2",
- "quanta",
- "thiserror",
- "tokio",
- "tracing",
+ "serde",
+ "toml",
]
[[package]]
-name = "metrics-macros"
-version = "0.5.1"
+name = "migrations_macros"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49e30813093f757be5cf21e50389a24dc7dbb22c49f23b7e8f51d69b508a5ffa"
+checksum = "ffb161cc72176cb37aa47f1fc520d3ef02263d67d661f44f05d05a079e1237fd"
dependencies = [
+ "migrations_internals",
"proc-macro2",
"quote",
- "syn 1.0.109",
-]
-
-[[package]]
-name = "metrics-util"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "65a9e83b833e1d2e07010a386b197c13aa199bbd0fca5cf69bfa147972db890a"
-dependencies = [
- "aho-corasick 0.7.20",
- "atomic-shim",
- "crossbeam-epoch",
- "crossbeam-utils",
- "hashbrown 0.11.2",
- "indexmap 1.9.3",
- "metrics 0.18.1",
- "num_cpus",
- "ordered-float",
- "parking_lot 0.11.2",
- "quanta",
- "radix_trie",
- "sketches-ddsketch",
-]
-
-[[package]]
-name = "metrics-util"
-version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd1f4b69bef1e2b392b2d4a12902f2af90bb438ba4a66aa222d1023fa6561b50"
-dependencies = [
- "atomic-shim",
- "crossbeam-epoch",
- "crossbeam-utils",
- "hashbrown 0.11.2",
- "metrics 0.19.0",
- "num_cpus",
- "parking_lot 0.11.2",
- "quanta",
- "sketches-ddsketch",
-]
-
-[[package]]
-name = "migration-connector"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "chrono",
- "enumflags2",
- "introspection-connector",
- "psl",
- "sha2 0.9.9",
- "tracing",
- "tracing-error",
- "user-facing-errors",
-]
-
-[[package]]
-name = "migration-core"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "async-trait",
- "chrono",
- "enumflags2",
- "json-rpc-api-build",
- "jsonrpc-core",
- "migration-connector",
- "psl",
- "serde",
- "serde_json",
- "sql-migration-connector",
- "tokio",
- "tracing",
- "tracing-futures",
- "tracing-subscriber",
- "url",
- "user-facing-errors",
]
[[package]]
@@ -1888,138 +1219,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
dependencies = [
"libc",
- "wasi 0.11.0+wasi-snapshot-preview1",
+ "wasi",
"windows-sys 0.48.0",
]
[[package]]
-name = "mobc"
-version = "0.7.3"
-source = "git+https://github.com/prisma/mobc?tag=1.0.6#80462c4870a2bf6aab49da15c88c021bae531da8"
+name = "nom"
+version = "7.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
- "async-trait",
- "futures-channel",
- "futures-core",
- "futures-timer",
- "futures-util",
- "log",
- "metrics 0.18.1",
- "thiserror",
- "tokio",
- "tracing",
- "tracing-subscriber",
+ "memchr",
+ "minimal-lexical",
]
[[package]]
-name = "native-tls"
-version = "0.2.12"
+name = "nu-ansi-term"
+version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466"
-dependencies = [
- "libc",
- "log",
- "openssl",
- "openssl-probe",
- "openssl-sys",
- "schannel",
- "security-framework",
- "security-framework-sys",
- "tempfile",
-]
-
-[[package]]
-name = "nibble_vec"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43"
-dependencies = [
- "smallvec",
-]
-
-[[package]]
-name = "nom"
-version = "7.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
-dependencies = [
- "memchr",
- "minimal-lexical",
-]
-
-[[package]]
-name = "nu-ansi-term"
-version = "0.46.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
+checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
dependencies = [
"overload",
"winapi",
]
-[[package]]
-name = "num"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23"
-dependencies = [
- "num-bigint",
- "num-complex",
- "num-integer",
- "num-iter",
- "num-rational",
- "num-traits",
-]
-
-[[package]]
-name = "num-bigint"
-version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7"
-dependencies = [
- "num-integer",
- "num-traits",
-]
-
-[[package]]
-name = "num-complex"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
-dependencies = [
- "num-traits",
-]
-
-[[package]]
-name = "num-integer"
-version = "0.1.46"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
-dependencies = [
- "num-traits",
-]
-
-[[package]]
-name = "num-iter"
-version = "0.1.45"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
-dependencies = [
- "autocfg",
- "num-integer",
- "num-traits",
-]
-
-[[package]]
-name = "num-rational"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
-dependencies = [
- "num-bigint",
- "num-integer",
- "num-traits",
-]
-
[[package]]
name = "num-traits"
version = "0.2.19"
@@ -2054,38 +1277,6 @@ version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
-[[package]]
-name = "opaque-debug"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
-
-[[package]]
-name = "openssl"
-version = "0.10.64"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f"
-dependencies = [
- "bitflags 2.5.0",
- "cfg-if",
- "foreign-types",
- "libc",
- "once_cell",
- "openssl-macros",
- "openssl-sys",
-]
-
-[[package]]
-name = "openssl-macros"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.67",
-]
-
[[package]]
name = "openssl-probe"
version = "0.1.5"
@@ -2094,9 +1285,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
-version = "0.9.102"
+version = "0.9.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2"
+checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741"
dependencies = [
"cc",
"libc",
@@ -2104,58 +1295,12 @@ dependencies = [
"vcpkg",
]
-[[package]]
-name = "opentelemetry"
-version = "0.17.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8"
-dependencies = [
- "async-trait",
- "crossbeam-channel",
- "futures-channel",
- "futures-executor",
- "futures-util",
- "js-sys",
- "lazy_static",
- "percent-encoding",
- "pin-project",
- "rand 0.8.5",
- "thiserror",
- "tokio",
-]
-
-[[package]]
-name = "ordered-float"
-version = "2.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c"
-dependencies = [
- "num-traits",
-]
-
-[[package]]
-name = "ordermap"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"
-
[[package]]
name = "overload"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
-[[package]]
-name = "parking_lot"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
-dependencies = [
- "instant",
- "lock_api",
- "parking_lot_core 0.8.6",
-]
-
[[package]]
name = "parking_lot"
version = "0.12.3"
@@ -2163,21 +1308,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [
"lock_api",
- "parking_lot_core 0.9.10",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.8.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
-dependencies = [
- "cfg-if",
- "instant",
- "libc",
- "redox_syscall 0.2.16",
- "smallvec",
- "winapi",
+ "parking_lot_core",
]
[[package]]
@@ -2188,108 +1319,17 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [
"cfg-if",
"libc",
- "redox_syscall 0.5.2",
+ "redox_syscall",
"smallvec",
"windows-targets 0.52.5",
]
-[[package]]
-name = "parser-database"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "diagnostics",
- "either",
- "enumflags2",
- "indexmap 1.9.3",
- "schema-ast",
-]
-
-[[package]]
-name = "paste"
-version = "1.0.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
-
[[package]]
name = "percent-encoding"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
-[[package]]
-name = "pest"
-version = "2.7.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8"
-dependencies = [
- "memchr",
- "thiserror",
- "ucd-trie",
-]
-
-[[package]]
-name = "pest_derive"
-version = "2.7.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459"
-dependencies = [
- "pest",
- "pest_generator",
-]
-
-[[package]]
-name = "pest_generator"
-version = "2.7.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687"
-dependencies = [
- "pest",
- "pest_meta",
- "proc-macro2",
- "quote",
- "syn 2.0.67",
-]
-
-[[package]]
-name = "pest_meta"
-version = "2.7.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd"
-dependencies = [
- "once_cell",
- "pest",
- "sha2 0.10.8",
-]
-
-[[package]]
-name = "petgraph"
-version = "0.4.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f"
-dependencies = [
- "fixedbitset 0.1.9",
- "ordermap",
-]
-
-[[package]]
-name = "phf"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
-dependencies = [
- "phf_shared",
-]
-
-[[package]]
-name = "phf_shared"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
-dependencies = [
- "siphasher",
-]
-
[[package]]
name = "pin-project"
version = "1.1.5"
@@ -2324,52 +1364,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
-version = "0.3.30"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
-
-[[package]]
-name = "postgres-native-tls"
-version = "0.5.0"
-source = "git+https://github.com/pimeys/rust-postgres?rev=064a6a50427542e2c166e870027735aab3b52e77#064a6a50427542e2c166e870027735aab3b52e77"
-dependencies = [
- "native-tls",
- "tokio",
- "tokio-native-tls 0.3.0",
- "tokio-postgres",
-]
-
-[[package]]
-name = "postgres-protocol"
-version = "0.6.4"
-source = "git+https://github.com/pimeys/rust-postgres?rev=064a6a50427542e2c166e870027735aab3b52e77#064a6a50427542e2c166e870027735aab3b52e77"
-dependencies = [
- "base64 0.13.1",
- "byteorder",
- "bytes",
- "fallible-iterator",
- "hmac",
- "md-5",
- "memchr",
- "rand 0.8.5",
- "sha2 0.10.8",
- "stringprep",
-]
-
-[[package]]
-name = "postgres-types"
-version = "0.2.4"
-source = "git+https://github.com/pimeys/rust-postgres?rev=064a6a50427542e2c166e870027735aab3b52e77#064a6a50427542e2c166e870027735aab3b52e77"
-dependencies = [
- "bit-vec",
- "bytes",
- "chrono",
- "fallible-iterator",
- "postgres-protocol",
- "serde",
- "serde_json",
- "uuid",
-]
+checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
[[package]]
name = "ppv-lite86"
@@ -2378,127 +1375,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
-name = "prisma-cli"
-version = "0.1.0"
-dependencies = [
- "prisma-client-rust-cli",
-]
-
-[[package]]
-name = "prisma-client-rust"
-version = "0.6.11"
-source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.6.11#3ac68d0052533d3ae0332d93a56a8ad169c2ee18"
-dependencies = [
- "base64 0.13.1",
- "bigdecimal",
- "chrono",
- "diagnostics",
- "dml",
- "dmmf",
- "dotenv",
- "futures",
- "include_dir",
- "indexmap 1.9.3",
- "migration-core",
- "paste",
- "prisma-client-rust-macros",
- "prisma-models",
- "psl",
- "query-connector",
- "query-core",
- "schema",
- "serde",
- "serde-value",
- "serde_json",
- "tempdir",
- "thiserror",
- "tokio",
- "tracing",
- "user-facing-errors",
- "uuid",
-]
-
-[[package]]
-name = "prisma-client-rust-cli"
-version = "0.6.11"
-source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.6.11#3ac68d0052533d3ae0332d93a56a8ad169c2ee18"
-dependencies = [
- "directories",
- "flate2",
- "http 0.2.12",
- "prisma-client-rust-sdk",
- "proc-macro2",
- "quote",
- "regex",
- "reqwest",
- "serde",
- "serde_json",
- "serde_path_to_error",
- "syn 1.0.109",
- "thiserror",
-]
-
-[[package]]
-name = "prisma-client-rust-macros"
-version = "0.6.11"
-source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.6.11#3ac68d0052533d3ae0332d93a56a8ad169c2ee18"
-dependencies = [
- "convert_case 0.6.0",
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
-[[package]]
-name = "prisma-client-rust-sdk"
-version = "0.6.11"
-source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.6.11#3ac68d0052533d3ae0332d93a56a8ad169c2ee18"
-dependencies = [
- "convert_case 0.5.0",
- "dml",
- "dmmf",
- "prisma-models",
- "proc-macro2",
- "psl",
- "query-core",
- "quote",
- "request-handlers",
- "serde",
- "serde_json",
- "serde_path_to_error",
- "syn 1.0.109",
- "thiserror",
-]
-
-[[package]]
-name = "prisma-models"
-version = "0.0.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
+name = "pq-src"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28fbf44fbf1d3e50d0ca0c6e6253f65d1bf01bb004a6ea553efb32e7081948c7"
dependencies = [
- "bigdecimal",
- "chrono",
- "itertools",
- "once_cell",
- "prisma-value",
- "psl",
- "serde",
- "serde_json",
- "thiserror",
+ "cc",
+ "openssl-sys",
]
[[package]]
-name = "prisma-value"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
+name = "pq-sys"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6cc05d7ea95200187117196eee9edd0644424911821aeb28a18ce60ea0b8793"
dependencies = [
- "base64 0.12.3",
- "bigdecimal",
- "chrono",
- "once_cell",
- "regex",
- "serde",
- "serde_json",
- "uuid",
+ "pq-src",
+ "vcpkg",
]
[[package]]
@@ -2565,340 +1458,82 @@ dependencies = [
"protobuf-parse",
"regex",
"tempfile",
- "thiserror",
-]
-
-[[package]]
-name = "protobuf-parse"
-version = "3.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b0e9b447d099ae2c4993c0cbb03c7a9d6c937b17f2d56cfc0b1550e6fcfdb76"
-dependencies = [
- "anyhow",
- "indexmap 2.2.6",
- "log",
- "protobuf",
- "protobuf-support",
- "tempfile",
- "thiserror",
- "which",
-]
-
-[[package]]
-name = "protobuf-support"
-version = "3.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0766e3675a627c327e4b3964582594b0e8741305d628a98a5de75a1d15f99b9"
-dependencies = [
- "thiserror",
-]
-
-[[package]]
-name = "psl"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "builtin-psl-connectors",
- "dml",
- "psl-core",
-]
-
-[[package]]
-name = "psl-core"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "bigdecimal",
- "chrono",
- "diagnostics",
- "enumflags2",
- "indoc",
- "itertools",
- "lsp-types",
- "once_cell",
- "parser-database",
- "prisma-value",
- "regex",
- "schema-ast",
- "serde",
- "serde_json",
- "url",
-]
-
-[[package]]
-name = "quaint"
-version = "0.2.0-alpha.13"
-source = "git+https://github.com/Brendonovich/quaint?tag=0.6.5#c502995f5e9dd4a86d80fa27f63e641bd6bbc6f2"
-dependencies = [
- "async-trait",
- "base64 0.12.3",
- "bigdecimal",
- "bit-vec",
- "byteorder",
- "bytes",
- "chrono",
- "connection-string",
- "futures",
- "hex",
- "lru-cache",
- "metrics 0.18.1",
- "mobc",
- "native-tls",
- "num_cpus",
- "percent-encoding",
- "postgres-native-tls",
- "postgres-types",
- "serde_json",
- "sqlformat",
- "thiserror",
- "tokio",
- "tokio-postgres",
- "tracing",
- "tracing-core",
- "url",
- "uuid",
-]
-
-[[package]]
-name = "quanta"
-version = "0.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "20afe714292d5e879d8b12740aa223c6a88f118af41870e8b6196e39a02238a8"
-dependencies = [
- "crossbeam-utils",
- "libc",
- "mach",
- "once_cell",
- "raw-cpuid",
- "wasi 0.10.2+wasi-snapshot-preview1",
- "web-sys",
- "winapi",
-]
-
-[[package]]
-name = "query-connector"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "anyhow",
- "async-trait",
- "chrono",
- "futures",
- "indexmap 1.9.3",
- "itertools",
- "prisma-models",
- "prisma-value",
- "serde",
- "serde_json",
- "thiserror",
- "user-facing-errors",
- "uuid",
-]
-
-[[package]]
-name = "query-core"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "async-trait",
- "base64 0.12.3",
- "bigdecimal",
- "chrono",
- "connection-string",
- "crossbeam-queue",
- "cuid",
- "enumflags2",
- "futures",
- "indexmap 1.9.3",
- "itertools",
- "lazy_static",
- "lru",
- "once_cell",
- "opentelemetry",
- "parking_lot 0.12.3",
- "petgraph",
- "pin-utils",
- "prisma-models",
- "prisma-value",
- "psl",
- "query-connector",
- "query-engine-metrics",
- "schema",
- "schema-builder",
- "serde",
- "serde_json",
- "sql-query-connector",
- "thiserror",
- "tokio",
- "tracing",
- "tracing-futures",
- "tracing-opentelemetry",
- "tracing-subscriber",
- "url",
- "user-facing-errors",
- "uuid",
-]
-
-[[package]]
-name = "query-engine-metrics"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "metrics 0.18.1",
- "metrics-exporter-prometheus",
- "metrics-util 0.12.1",
- "once_cell",
- "parking_lot 0.12.3",
- "serde",
- "serde_json",
- "tracing",
- "tracing-futures",
- "tracing-subscriber",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.36"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "radix_trie"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd"
-dependencies = [
- "endian-type",
- "nibble_vec",
-]
-
-[[package]]
-name = "rand"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
-dependencies = [
- "fuchsia-cprng",
- "libc",
- "rand_core 0.3.1",
- "rdrand",
- "winapi",
-]
-
-[[package]]
-name = "rand"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
-dependencies = [
- "getrandom 0.1.16",
- "libc",
- "rand_chacha 0.2.2",
- "rand_core 0.5.1",
- "rand_hc",
-]
-
-[[package]]
-name = "rand"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
-dependencies = [
- "libc",
- "rand_chacha 0.3.1",
- "rand_core 0.6.4",
-]
-
-[[package]]
-name = "rand_chacha"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
-dependencies = [
- "ppv-lite86",
- "rand_core 0.5.1",
-]
-
-[[package]]
-name = "rand_chacha"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
-dependencies = [
- "ppv-lite86",
- "rand_core 0.6.4",
-]
-
-[[package]]
-name = "rand_core"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
-dependencies = [
- "rand_core 0.4.2",
+ "thiserror",
]
[[package]]
-name = "rand_core"
-version = "0.4.2"
+name = "protobuf-parse"
+version = "3.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
+checksum = "1b0e9b447d099ae2c4993c0cbb03c7a9d6c937b17f2d56cfc0b1550e6fcfdb76"
+dependencies = [
+ "anyhow",
+ "indexmap 2.2.6",
+ "log",
+ "protobuf",
+ "protobuf-support",
+ "tempfile",
+ "thiserror",
+ "which",
+]
[[package]]
-name = "rand_core"
-version = "0.5.1"
+name = "protobuf-support"
+version = "3.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
+checksum = "f0766e3675a627c327e4b3964582594b0e8741305d628a98a5de75a1d15f99b9"
dependencies = [
- "getrandom 0.1.16",
+ "thiserror",
]
[[package]]
-name = "rand_core"
-version = "0.6.4"
+name = "quote"
+version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [
- "getrandom 0.2.15",
+ "proc-macro2",
]
[[package]]
-name = "rand_hc"
-version = "0.2.0"
+name = "r2d2"
+version = "0.8.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
+checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93"
dependencies = [
- "rand_core 0.5.1",
+ "log",
+ "parking_lot",
+ "scheduled-thread-pool",
]
[[package]]
-name = "raw-cpuid"
-version = "10.7.0"
+name = "rand"
+version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332"
+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
- "bitflags 1.3.2",
+ "libc",
+ "rand_chacha",
+ "rand_core",
]
[[package]]
-name = "rdrand"
-version = "0.4.0"
+name = "rand_chacha"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
- "rand_core 0.3.1",
+ "ppv-lite86",
+ "rand_core",
]
[[package]]
-name = "redox_syscall"
-version = "0.2.16"
+name = "rand_core"
+version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
- "bitflags 1.3.2",
+ "getrandom",
]
[[package]]
@@ -2910,24 +1545,13 @@ dependencies = [
"bitflags 2.5.0",
]
-[[package]]
-name = "redox_users"
-version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891"
-dependencies = [
- "getrandom 0.2.15",
- "libredox",
- "thiserror",
-]
-
[[package]]
name = "regex"
version = "1.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
dependencies = [
- "aho-corasick 1.1.3",
+ "aho-corasick",
"memchr",
"regex-automata 0.4.7",
"regex-syntax 0.8.4",
@@ -2948,7 +1572,7 @@ version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
dependencies = [
- "aho-corasick 1.1.3",
+ "aho-corasick",
"memchr",
"regex-syntax 0.8.4",
]
@@ -2965,77 +1589,6 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
-[[package]]
-name = "remove_dir_all"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
-dependencies = [
- "winapi",
-]
-
-[[package]]
-name = "request-handlers"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "bigdecimal",
- "connection-string",
- "dmmf",
- "futures",
- "graphql-parser",
- "indexmap 1.9.3",
- "itertools",
- "psl",
- "query-core",
- "serde",
- "serde_json",
- "thiserror",
- "tracing",
- "url",
- "user-facing-errors",
-]
-
-[[package]]
-name = "reqwest"
-version = "0.11.27"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62"
-dependencies = [
- "base64 0.21.7",
- "bytes",
- "encoding_rs",
- "futures-core",
- "futures-util",
- "h2",
- "http 0.2.12",
- "http-body 0.4.6",
- "hyper 0.14.29",
- "hyper-tls",
- "ipnet",
- "js-sys",
- "log",
- "mime",
- "native-tls",
- "once_cell",
- "percent-encoding",
- "pin-project-lite",
- "rustls-pemfile 1.0.4",
- "serde",
- "serde_json",
- "serde_urlencoded",
- "sync_wrapper 0.1.2",
- "system-configuration",
- "tokio",
- "tokio-native-tls 0.3.1",
- "tower-service",
- "url",
- "wasm-bindgen",
- "wasm-bindgen-futures",
- "web-sys",
- "winreg",
-]
-
[[package]]
name = "ring"
version = "0.17.8"
@@ -3044,7 +1597,7 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
dependencies = [
"cc",
"cfg-if",
- "getrandom 0.2.15",
+ "getrandom",
"libc",
"spin",
"untrusted",
@@ -3063,12 +1616,12 @@ version = "0.24.0"
source = "git+https://github.com/bytebeamio/rumqtt?branch=main#db1f261dd5cd6c69bbfd1058ba69ea8ef5f4fc38"
dependencies = [
"bytes",
- "fixedbitset 0.5.7",
+ "fixedbitset",
"flume",
"futures-util",
"log",
"rustls-native-certs",
- "rustls-pemfile 2.1.2",
+ "rustls-pemfile",
"rustls-webpki",
"thiserror",
"tokio",
@@ -3117,21 +1670,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a88d6d420651b496bdd98684116959239430022a115c1240e6c3993be0b15fba"
dependencies = [
"openssl-probe",
- "rustls-pemfile 2.1.2",
+ "rustls-pemfile",
"rustls-pki-types",
"schannel",
"security-framework",
]
-[[package]]
-name = "rustls-pemfile"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
-dependencies = [
- "base64 0.21.7",
-]
-
[[package]]
name = "rustls-pemfile"
version = "2.1.2"
@@ -3181,36 +1725,12 @@ dependencies = [
]
[[package]]
-name = "schema"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "once_cell",
- "prisma-models",
- "psl",
-]
-
-[[package]]
-name = "schema-ast"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "diagnostics",
- "pest",
- "pest_derive",
-]
-
-[[package]]
-name = "schema-builder"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
+name = "scheduled-thread-pool"
+version = "0.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19"
dependencies = [
- "itertools",
- "lazy_static",
- "once_cell",
- "prisma-models",
- "psl",
- "schema",
+ "parking_lot",
]
[[package]]
@@ -3228,10 +1748,13 @@ dependencies = [
"chrono",
"clap",
"console-subscriber",
- "prisma-client-rust",
+ "diesel",
+ "diesel_migrations",
+ "dotenvy",
+ "pq-sys",
"protobuf",
"protobuf-codegen",
- "rand 0.8.5",
+ "rand",
"ringbuffer",
"rumqttc",
"serde",
@@ -3277,16 +1800,6 @@ dependencies = [
"serde_derive",
]
-[[package]]
-name = "serde-value"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c"
-dependencies = [
- "ordered-float",
- "serde",
-]
-
[[package]]
name = "serde_derive"
version = "1.0.203"
@@ -3317,7 +1830,6 @@ version = "1.0.128"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
dependencies = [
- "indexmap 2.2.6",
"itoa",
"memchr",
"ryu",
@@ -3335,14 +1847,12 @@ dependencies = [
]
[[package]]
-name = "serde_repr"
-version = "0.1.19"
+name = "serde_spanned"
+version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
+checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.67",
+ "serde",
]
[[package]]
@@ -3365,41 +1875,7 @@ checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
dependencies = [
"cfg-if",
"cpufeatures",
- "digest 0.10.7",
-]
-
-[[package]]
-name = "sha2"
-version = "0.9.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
-dependencies = [
- "block-buffer 0.9.0",
- "cfg-if",
- "cpufeatures",
- "digest 0.9.0",
- "opaque-debug",
-]
-
-[[package]]
-name = "sha2"
-version = "0.10.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
-dependencies = [
- "cfg-if",
- "cpufeatures",
- "digest 0.10.7",
-]
-
-[[package]]
-name = "sha3"
-version = "0.10.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60"
-dependencies = [
- "digest 0.10.7",
- "keccak",
+ "digest",
]
[[package]]
@@ -3420,213 +1896,62 @@ dependencies = [
"libc",
]
-[[package]]
-name = "siphasher"
-version = "0.3.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
-
-[[package]]
-name = "sketches-ddsketch"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04d2ecae5fcf33b122e2e6bd520a57ccf152d2dde3b38c71039df1a6867264ee"
-
[[package]]
name = "slab"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
-dependencies = [
- "autocfg",
-]
-
-[[package]]
-name = "smallvec"
-version = "1.13.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
-
-[[package]]
-name = "socket2"
-version = "0.4.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
-dependencies = [
- "libc",
- "winapi",
-]
-
-[[package]]
-name = "socket2"
-version = "0.5.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
-dependencies = [
- "libc",
- "windows-sys 0.52.0",
-]
-
-[[package]]
-name = "socketioxide"
-version = "0.14.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23f50a295325631d230022f1562fde3d1351edf4d8eac73265f657cc762f655c"
-dependencies = [
- "bytes",
- "engineioxide",
- "futures-core",
- "futures-util",
- "http 1.1.0",
- "http-body 1.0.0",
- "hyper 1.4.0",
- "itoa",
- "matchit 0.8.3",
- "pin-project-lite",
- "serde",
- "serde_json",
- "thiserror",
- "tokio",
- "tower",
- "tracing",
-]
-
-[[package]]
-name = "spin"
-version = "0.9.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
-dependencies = [
- "lock_api",
-]
-
-[[package]]
-name = "sql-ddl"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-
-[[package]]
-name = "sql-introspection-connector"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "anyhow",
- "async-trait",
- "bigdecimal",
- "datamodel-renderer",
- "enumflags2",
- "introspection-connector",
- "once_cell",
- "psl",
- "quaint",
- "regex",
- "serde",
- "serde_json",
- "sql-schema-describer",
- "thiserror",
- "tracing",
- "tracing-futures",
- "user-facing-errors",
-]
-
-[[package]]
-name = "sql-migration-connector"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "chrono",
- "connection-string",
- "either",
- "enumflags2",
- "indoc",
- "migration-connector",
- "once_cell",
- "psl",
- "quaint",
- "regex",
- "serde_json",
- "sql-ddl",
- "sql-introspection-connector",
- "sql-schema-describer",
- "tokio",
- "tracing",
- "tracing-futures",
- "url",
- "user-facing-errors",
- "uuid",
-]
-
-[[package]]
-name = "sql-query-connector"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "anyhow",
- "async-trait",
- "bigdecimal",
- "chrono",
- "cuid",
- "futures",
- "itertools",
- "once_cell",
- "opentelemetry",
- "prisma-models",
- "prisma-value",
- "psl",
- "quaint",
- "query-connector",
- "rand 0.7.3",
- "serde",
- "serde_json",
- "socket2 0.4.10",
- "thiserror",
- "tokio",
- "tracing",
- "tracing-futures",
- "tracing-opentelemetry",
- "user-facing-errors",
- "uuid",
+checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
+dependencies = [
+ "autocfg",
]
[[package]]
-name = "sql-schema-describer"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
+name = "smallvec"
+version = "1.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
+
+[[package]]
+name = "socket2"
+version = "0.5.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
dependencies = [
- "async-trait",
- "bigdecimal",
- "enumflags2",
- "indexmap 1.9.3",
- "indoc",
- "once_cell",
- "psl",
- "quaint",
- "regex",
- "serde",
- "tracing",
- "tracing-error",
- "tracing-futures",
+ "libc",
+ "windows-sys 0.52.0",
]
[[package]]
-name = "sqlformat"
-version = "0.2.4"
+name = "socketioxide"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f895e3734318cc55f1fe66258926c9b910c124d47520339efecbb6c59cec7c1f"
+checksum = "23f50a295325631d230022f1562fde3d1351edf4d8eac73265f657cc762f655c"
dependencies = [
- "nom",
- "unicode_categories",
+ "bytes",
+ "engineioxide",
+ "futures-core",
+ "futures-util",
+ "http 1.1.0",
+ "http-body 1.0.0",
+ "hyper 1.4.0",
+ "itoa",
+ "matchit 0.8.3",
+ "pin-project-lite",
+ "serde",
+ "serde_json",
+ "thiserror",
+ "tokio",
+ "tower",
+ "tracing",
]
[[package]]
-name = "stringprep"
-version = "0.1.5"
+name = "spin"
+version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1"
+checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
dependencies = [
- "unicode-bidi",
- "unicode-normalization",
- "unicode-properties",
+ "lock_api",
]
[[package]]
@@ -3675,49 +2000,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
-[[package]]
-name = "synstructure"
-version = "0.12.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
- "unicode-xid",
-]
-
-[[package]]
-name = "system-configuration"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
-dependencies = [
- "bitflags 1.3.2",
- "core-foundation",
- "system-configuration-sys",
-]
-
-[[package]]
-name = "system-configuration-sys"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
-name = "tempdir"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
-dependencies = [
- "rand 0.4.6",
- "remove_dir_all",
-]
-
[[package]]
name = "tempfile"
version = "3.10.1"
@@ -3760,21 +2042,6 @@ dependencies = [
"once_cell",
]
-[[package]]
-name = "tinyvec"
-version = "1.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
-dependencies = [
- "tinyvec_macros",
-]
-
-[[package]]
-name = "tinyvec_macros"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
-
[[package]]
name = "tokio"
version = "1.38.0"
@@ -3786,10 +2053,10 @@ dependencies = [
"libc",
"mio",
"num_cpus",
- "parking_lot 0.12.3",
+ "parking_lot",
"pin-project-lite",
"signal-hook-registry",
- "socket2 0.5.7",
+ "socket2",
"tokio-macros",
"tracing",
"windows-sys 0.48.0",
@@ -3816,48 +2083,6 @@ dependencies = [
"syn 2.0.67",
]
-[[package]]
-name = "tokio-native-tls"
-version = "0.3.0"
-source = "git+https://github.com/pimeys/tls?branch=vendored-openssl#6d0e6fc7a4bf6f290b1033764b47cb3f26d7fceb"
-dependencies = [
- "native-tls",
- "tokio",
-]
-
-[[package]]
-name = "tokio-native-tls"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
-dependencies = [
- "native-tls",
- "tokio",
-]
-
-[[package]]
-name = "tokio-postgres"
-version = "0.7.7"
-source = "git+https://github.com/pimeys/rust-postgres?rev=064a6a50427542e2c166e870027735aab3b52e77#064a6a50427542e2c166e870027735aab3b52e77"
-dependencies = [
- "async-trait",
- "byteorder",
- "bytes",
- "fallible-iterator",
- "futures-channel",
- "futures-util",
- "log",
- "parking_lot 0.12.3",
- "percent-encoding",
- "phf",
- "pin-project-lite",
- "postgres-protocol",
- "postgres-types",
- "socket2 0.4.10",
- "tokio",
- "tokio-util",
-]
-
[[package]]
name = "tokio-rustls"
version = "0.25.0"
@@ -3911,11 +2136,36 @@ dependencies = [
[[package]]
name = "toml"
-version = "0.5.11"
+version = "0.8.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
+dependencies = [
+ "serde",
+ "serde_spanned",
+ "toml_datetime",
+ "toml_edit",
+]
+
+[[package]]
+name = "toml_datetime"
+version = "0.6.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.22.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
+checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d"
dependencies = [
+ "indexmap 2.2.6",
"serde",
+ "serde_spanned",
+ "toml_datetime",
+ "winnow",
]
[[package]]
@@ -3956,7 +2206,7 @@ dependencies = [
"indexmap 1.9.3",
"pin-project",
"pin-project-lite",
- "rand 0.8.5",
+ "rand",
"slab",
"tokio",
"tokio-util",
@@ -4027,37 +2277,6 @@ dependencies = [
"valuable",
]
-[[package]]
-name = "tracing-error"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e"
-dependencies = [
- "tracing",
- "tracing-subscriber",
-]
-
-[[package]]
-name = "tracing-futures"
-version = "0.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
-dependencies = [
- "pin-project",
- "tracing",
-]
-
-[[package]]
-name = "tracing-log"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2"
-dependencies = [
- "log",
- "once_cell",
- "tracing-core",
-]
-
[[package]]
name = "tracing-log"
version = "0.2.0"
@@ -4069,20 +2288,6 @@ dependencies = [
"tracing-core",
]
-[[package]]
-name = "tracing-opentelemetry"
-version = "0.17.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f"
-dependencies = [
- "once_cell",
- "opentelemetry",
- "tracing",
- "tracing-core",
- "tracing-log 0.1.4",
- "tracing-subscriber",
-]
-
[[package]]
name = "tracing-subscriber"
version = "0.3.18"
@@ -4098,7 +2303,7 @@ dependencies = [
"thread_local",
"tracing",
"tracing-core",
- "tracing-log 0.2.0",
+ "tracing-log",
]
[[package]]
@@ -4119,7 +2324,7 @@ dependencies = [
"http 1.1.0",
"httparse",
"log",
- "rand 0.8.5",
+ "rand",
"sha1",
"thiserror",
"utf-8",
@@ -4131,108 +2336,18 @@ version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
-[[package]]
-name = "ucd-trie"
-version = "0.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
-
-[[package]]
-name = "unicode-bidi"
-version = "0.3.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
-
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
-[[package]]
-name = "unicode-normalization"
-version = "0.1.23"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5"
-dependencies = [
- "tinyvec",
-]
-
-[[package]]
-name = "unicode-properties"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291"
-
-[[package]]
-name = "unicode-segmentation"
-version = "1.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
-
-[[package]]
-name = "unicode-xid"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
-
-[[package]]
-name = "unicode_categories"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
-
-[[package]]
-name = "unreachable"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
-dependencies = [
- "void",
-]
-
[[package]]
name = "untrusted"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
-[[package]]
-name = "url"
-version = "2.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
-dependencies = [
- "form_urlencoded",
- "idna",
- "percent-encoding",
- "serde",
-]
-
-[[package]]
-name = "user-facing-error-macros"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
-[[package]]
-name = "user-facing-errors"
-version = "0.1.0"
-source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53"
-dependencies = [
- "backtrace",
- "indoc",
- "quaint",
- "serde",
- "serde_json",
- "tracing",
- "user-facing-error-macros",
-]
-
[[package]]
name = "utf-8"
version = "0.7.6"
@@ -4245,16 +2360,6 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
-[[package]]
-name = "uuid"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
-dependencies = [
- "getrandom 0.2.15",
- "serde",
-]
-
[[package]]
name = "valuable"
version = "0.1.0"
@@ -4273,12 +2378,6 @@ version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
-[[package]]
-name = "void"
-version = "1.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
-
[[package]]
name = "want"
version = "0.3.1"
@@ -4288,18 +2387,6 @@ dependencies = [
"try-lock",
]
-[[package]]
-name = "wasi"
-version = "0.9.0+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
-
-[[package]]
-name = "wasi"
-version = "0.10.2+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
-
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@@ -4331,18 +2418,6 @@ dependencies = [
"wasm-bindgen-shared",
]
-[[package]]
-name = "wasm-bindgen-futures"
-version = "0.4.29"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395"
-dependencies = [
- "cfg-if",
- "js-sys",
- "wasm-bindgen",
- "web-sys",
-]
-
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.79"
@@ -4372,16 +2447,6 @@ version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2"
-[[package]]
-name = "web-sys"
-version = "0.3.56"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb"
-dependencies = [
- "js-sys",
- "wasm-bindgen",
-]
-
[[package]]
name = "which"
version = "4.4.2"
@@ -4565,13 +2630,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
[[package]]
-name = "winreg"
-version = "0.50.0"
+name = "winnow"
+version = "0.6.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
+checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
dependencies = [
- "cfg-if",
- "windows-sys 0.48.0",
+ "memchr",
]
[[package]]
diff --git a/scylla-server/Cargo.toml b/scylla-server/Cargo.toml
index 7539bd4c..47229e1a 100644
--- a/scylla-server/Cargo.toml
+++ b/scylla-server/Cargo.toml
@@ -5,7 +5,9 @@ edition = "2021"
default-run = "scylla-server"
[dependencies]
-prisma-client-rust = {git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.11", default-features = false,features = ["postgresql", "migrations"] }
+diesel = { version = "2.2.4", features = ["postgres", "r2d2", "chrono"] }
+pq-sys = { version = "0.6", features = ["bundled"] }
+dotenvy = "0.15"
serde = "1.0.203"
protobuf-codegen = "3.5.1"
protobuf = "3.5.1"
@@ -25,13 +27,11 @@ clap = { version = "4.5.11", features = ["derive", "env"] }
axum-extra = { version = "0.9.3", features = ["query"] }
chrono = { version = "0.4.38", features = ["serde"] }
serde_json = "1.0.128"
+diesel_migrations = { version = "2.2.0", features = ["postgres"] }
[features]
top = ["dep:console-subscriber"]
-[workspace]
-members = ["prisma-cli"]
-
[build-dependencies]
protobuf-codegen = "3.5.1"
@@ -44,7 +44,3 @@ strip = true # Automatically strip symbols from the binary.
[[bin]]
name = "scylla-server"
path = "src/main.rs"
-
-[[bin]]
-name = "seed"
-path = "prisma/seed.rs"
diff --git a/scylla-server/Dockerfile b/scylla-server/Dockerfile
index 19c57654..eb975893 100755
--- a/scylla-server/Dockerfile
+++ b/scylla-server/Dockerfile
@@ -1,8 +1,12 @@
-FROM rust:latest
+FROM rust:latest AS builder
WORKDIR /usr/src/myapp
COPY . .
-RUN cargo prisma generate
-RUN cargo build --release --locked
-ENTRYPOINT ["./docker_run.sh"]
+RUN cargo install --path . --locked --profile release
+
+FROM debian:stable-slim
+COPY --from=builder /usr/local/cargo/bin/scylla-server /usr/local/bin/scylla-server
+RUN apt-get update && apt install -y openssl && apt clean && rm -rf /var/lib/apt/lists/*
+
+ENTRYPOINT ["/usr/local/bin/scylla-server"]
diff --git a/scylla-server/README.md b/scylla-server/README.md
index 53ba47af..c7a85c05 100644
--- a/scylla-server/README.md
+++ b/scylla-server/README.md
@@ -4,37 +4,6 @@ The backend written in Rust for Argos.
## Local Development
-Before doing any of the following make sure you've installed Rust: https://www.rust-lang.org/learn/get-started
-
-We specifically need cargo (Rust's build tool and package manager), so run 'cargo --version' to make sure you've correctly installed Rust.
-
-### Setup the Database
-
-In the root project directory run the following to create the timescaledb instance in docker:
-
-```
-docker compose up -d odyssey-timescale
-```
-
-To setup environment variables, cd into the scylla-server directory and create a file named `.env` containing the following contents:
-
-```
-SOURCE_DATABASE_URL=postgresql://postgres:password@127.0.0.1:5432/postgres
-```
-
-To setup Prisma, in the scylla-server directory run:
-
-```
-cargo prisma generate
-```
-
-To setup the database and seed some data run:
-
-```
-cargo prisma migrate deploy
-cargo prisma-seed
-```
-
### Run the app
In scylla-server run:
@@ -47,20 +16,17 @@ And you're done!
## Test this app
-#### Seed some data
+#### Get started with DB
-Run `cargo prisma-seed`
+Download the diesel CLI from [here](https://diesel.rs/guides/getting-started).
-#### Integration tests
+With this you can run manual migrations and change the schema.
-Since this app uses the database for testing, you must follow these steps, or run `./integration_test.sh`:
+#### Integration tests
-```
-docker volume rm argos_db-data
-docker compose up -d odyssey-timescale
-cargo prisma migrate deploy
-cargo test -- --test-threads=1
-```
+Since this app uses the database for testing, you must:
+1. Install the diesel CLI.
+2. run `./integration_test.sh`:
#### Test it yourself!
diff --git a/scylla-server/diesel.toml b/scylla-server/diesel.toml
new file mode 100644
index 00000000..83d15a98
--- /dev/null
+++ b/scylla-server/diesel.toml
@@ -0,0 +1,9 @@
+# For documentation on how to configure this file,
+# see https://diesel.rs/guides/configuring-diesel-cli
+
+[print_schema]
+file = "src/schema.rs"
+custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
+
+[migrations_directory]
+dir = "./migrations"
diff --git a/scylla-server/docker_run.sh b/scylla-server/docker_run.sh
deleted file mode 100755
index b6804b5e..00000000
--- a/scylla-server/docker_run.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-cargo prisma migrate deploy && exec /usr/src/myapp/target/release/scylla-server
\ No newline at end of file
diff --git a/scylla-server/integration_test.sh b/scylla-server/integration_test.sh
index 829d7c7b..c270980c 100755
--- a/scylla-server/integration_test.sh
+++ b/scylla-server/integration_test.sh
@@ -1,15 +1,15 @@
#!/bin/sh
-
echo "Starting db"
-cd ..
+cd ../compose
docker compose up -d odyssey-timescale
-echo "Deploying prisma"
-cd ./scylla-server
-cargo prisma migrate deploy
+cd ../scylla-server
+echo "Migrating DB"
+diesel migration run
echo "Running tests"
-SOURCE_DATABASE_URL=postgresql://postgres:password@127.0.0.1:5432/postgres cargo test -- --test-threads=1
+DATABASE_URL=postgresql://postgres:password@127.0.0.1:5432/postgres cargo test -- --test-threads=1
-cd ..
+echo "Exiting"
+cd ../compose
docker compose down
\ No newline at end of file
diff --git a/scylla-server/migrations/.keep b/scylla-server/migrations/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/scylla-server/migrations/00000000000000_diesel_initial_setup/down.sql b/scylla-server/migrations/00000000000000_diesel_initial_setup/down.sql
new file mode 100644
index 00000000..a9f52609
--- /dev/null
+++ b/scylla-server/migrations/00000000000000_diesel_initial_setup/down.sql
@@ -0,0 +1,6 @@
+-- This file was automatically created by Diesel to setup helper functions
+-- and other internal bookkeeping. This file is safe to edit, any future
+-- changes will be added to existing projects as new migrations.
+
+DROP FUNCTION IF EXISTS diesel_manage_updated_at(_tbl regclass);
+DROP FUNCTION IF EXISTS diesel_set_updated_at();
diff --git a/scylla-server/migrations/00000000000000_diesel_initial_setup/up.sql b/scylla-server/migrations/00000000000000_diesel_initial_setup/up.sql
new file mode 100644
index 00000000..d68895b1
--- /dev/null
+++ b/scylla-server/migrations/00000000000000_diesel_initial_setup/up.sql
@@ -0,0 +1,36 @@
+-- This file was automatically created by Diesel to setup helper functions
+-- and other internal bookkeeping. This file is safe to edit, any future
+-- changes will be added to existing projects as new migrations.
+
+
+
+
+-- Sets up a trigger for the given table to automatically set a column called
+-- `updated_at` whenever the row is modified (unless `updated_at` was included
+-- in the modified columns)
+--
+-- # Example
+--
+-- ```sql
+-- CREATE TABLE users (id SERIAL PRIMARY KEY, updated_at TIMESTAMP NOT NULL DEFAULT NOW());
+--
+-- SELECT diesel_manage_updated_at('users');
+-- ```
+CREATE OR REPLACE FUNCTION diesel_manage_updated_at(_tbl regclass) RETURNS VOID AS $$
+BEGIN
+ EXECUTE format('CREATE TRIGGER set_updated_at BEFORE UPDATE ON %s
+ FOR EACH ROW EXECUTE PROCEDURE diesel_set_updated_at()', _tbl);
+END;
+$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION diesel_set_updated_at() RETURNS trigger AS $$
+BEGIN
+ IF (
+ NEW IS DISTINCT FROM OLD AND
+ NEW.updated_at IS NOT DISTINCT FROM OLD.updated_at
+ ) THEN
+ NEW.updated_at := current_timestamp;
+ END IF;
+ RETURN NEW;
+END;
+$$ LANGUAGE plpgsql;
diff --git a/scylla-server/migrations/2024-11-10-031516_create_all/down.sql b/scylla-server/migrations/2024-11-10-031516_create_all/down.sql
new file mode 100644
index 00000000..92b734d9
--- /dev/null
+++ b/scylla-server/migrations/2024-11-10-031516_create_all/down.sql
@@ -0,0 +1,4 @@
+-- This file should undo anything in `up.sql`
+DROP TABLE "run";
+DROP TABLE "data";
+DROP TABLE "dataType";
\ No newline at end of file
diff --git a/scylla-server/migrations/2024-11-10-031516_create_all/up.sql b/scylla-server/migrations/2024-11-10-031516_create_all/up.sql
new file mode 100644
index 00000000..9ad478bf
--- /dev/null
+++ b/scylla-server/migrations/2024-11-10-031516_create_all/up.sql
@@ -0,0 +1,47 @@
+-- CreateTable
+CREATE TABLE "run" (
+ "id" SERIAL NOT NULL,
+ "locationName" TEXT,
+ "latitude" DOUBLE PRECISION,
+ "longitude" DOUBLE PRECISION,
+ "driverName" TEXT,
+ "notes" TEXT NOT NULL,
+ "time" TIMESTAMPTZ NOT NULL,
+
+ CONSTRAINT "run_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "data" (
+ "id" SERIAL NOT NULL,
+ "values" DOUBLE PRECISION[],
+ "dataTypeName" TEXT NOT NULL,
+ "time" TIMESTAMPTZ NOT NULL,
+ "runId" INTEGER NOT NULL,
+
+ CONSTRAINT "data_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "dataType" (
+ "name" TEXT NOT NULL,
+ "unit" TEXT NOT NULL,
+ "nodeName" TEXT NOT NULL,
+
+ CONSTRAINT "dataType_pkey" PRIMARY KEY ("name")
+);
+
+-- CreateIndex
+CREATE UNIQUE INDEX "run_id_key" ON "run"("id");
+
+-- CreateIndex
+CREATE UNIQUE INDEX "data_id_time_key" ON "data"("id", "time");
+
+-- CreateIndex
+CREATE UNIQUE INDEX "dataType_name_key" ON "dataType"("name");
+
+-- AddForeignKey
+ALTER TABLE "data" ADD CONSTRAINT "data_dataTypeName_fkey" FOREIGN KEY ("dataTypeName") REFERENCES "dataType"("name") ON DELETE RESTRICT ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "data" ADD CONSTRAINT "data_runId_fkey" FOREIGN KEY ("runId") REFERENCES "run"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
\ No newline at end of file
diff --git a/scylla-server/prisma-cli/Cargo.toml b/scylla-server/prisma-cli/Cargo.toml
deleted file mode 100755
index 31208305..00000000
--- a/scylla-server/prisma-cli/Cargo.toml
+++ /dev/null
@@ -1,9 +0,0 @@
-[package]
-name = "prisma-cli"
-version = "0.1.0"
-edition = "2021"
-
-[dependencies]
-prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.11", features = [
- "postgresql", "migrations"
-], default-features = false }
\ No newline at end of file
diff --git a/scylla-server/prisma-cli/src/main.rs b/scylla-server/prisma-cli/src/main.rs
deleted file mode 100755
index f7580155..00000000
--- a/scylla-server/prisma-cli/src/main.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-fn main() {
- prisma_client_rust_cli::run();
-}
diff --git a/scylla-server/prisma/migrations/20240212220042_init/migration.sql b/scylla-server/prisma/migrations/20240212220042_init/migration.sql
deleted file mode 100644
index a351b84f..00000000
--- a/scylla-server/prisma/migrations/20240212220042_init/migration.sql
+++ /dev/null
@@ -1,109 +0,0 @@
--- CreateTable
-CREATE TABLE "run" (
- "id" SERIAL NOT NULL,
- "locationName" TEXT,
- "driverName" TEXT,
- "systemName" TEXT,
- "time" TIMESTAMPTZ NOT NULL,
-
- CONSTRAINT "run_pkey" PRIMARY KEY ("id")
-);
-
--- CreateTable
-CREATE TABLE "location" (
- "name" TEXT NOT NULL,
- "latitude" DOUBLE PRECISION NOT NULL,
- "longitude" DOUBLE PRECISION NOT NULL,
- "radius" DOUBLE PRECISION NOT NULL,
-
- CONSTRAINT "location_pkey" PRIMARY KEY ("name")
-);
-
--- CreateTable
-CREATE TABLE "driver" (
- "username" TEXT NOT NULL,
-
- CONSTRAINT "driver_pkey" PRIMARY KEY ("username")
-);
-
--- CreateTable
-CREATE TABLE "system" (
- "name" TEXT NOT NULL,
-
- CONSTRAINT "system_pkey" PRIMARY KEY ("name")
-);
-
--- CreateTable
-CREATE TABLE "data" (
- "id" TEXT NOT NULL,
- "values" DOUBLE PRECISION[],
- "dataTypeName" TEXT NOT NULL,
- "time" TIMESTAMPTZ NOT NULL,
- "runId" INTEGER NOT NULL
-);
-
--- CreateTable
-CREATE TABLE "dataType" (
- "name" TEXT NOT NULL,
- "unit" TEXT NOT NULL,
- "nodeName" TEXT NOT NULL,
-
- CONSTRAINT "dataType_pkey" PRIMARY KEY ("name")
-);
-
--- CreateTable
-CREATE TABLE "node" (
- "name" TEXT NOT NULL,
-
- CONSTRAINT "node_pkey" PRIMARY KEY ("name")
-);
-
--- CreateIndex
-CREATE UNIQUE INDEX "run_id_key" ON "run"("id");
-
--- CreateIndex
-CREATE UNIQUE INDEX "location_name_key" ON "location"("name");
-
--- CreateIndex
-CREATE UNIQUE INDEX "driver_username_key" ON "driver"("username");
-
--- CreateIndex
-CREATE UNIQUE INDEX "system_name_key" ON "system"("name");
-
--- CreateIndex
-CREATE UNIQUE INDEX "data_id_time_key" ON "data"("id", "time");
-
-SELECT * FROM create_hypertable('data', by_range('time'));
-SELECT * FROM add_dimension('data', by_hash('id', 4));
-
--- CreateIndex
-CREATE UNIQUE INDEX "dataType_name_key" ON "dataType"("name");
-
--- CreateIndex
-CREATE UNIQUE INDEX "node_name_key" ON "node"("name");
-
--- AddForeignKey
-ALTER TABLE "run" ADD CONSTRAINT "run_locationName_fkey" FOREIGN KEY ("locationName") REFERENCES "location"("name") ON DELETE SET NULL ON UPDATE CASCADE;
-
--- AddForeignKey
-ALTER TABLE "run" ADD CONSTRAINT "run_driverName_fkey" FOREIGN KEY ("driverName") REFERENCES "driver"("username") ON DELETE SET NULL ON UPDATE CASCADE;
-
--- AddForeignKey
-ALTER TABLE "run" ADD CONSTRAINT "run_systemName_fkey" FOREIGN KEY ("systemName") REFERENCES "system"("name") ON DELETE SET NULL ON UPDATE CASCADE;
-
--- AddForeignKey
-ALTER TABLE "data" ADD CONSTRAINT "data_dataTypeName_fkey" FOREIGN KEY ("dataTypeName") REFERENCES "dataType"("name") ON DELETE RESTRICT ON UPDATE CASCADE;
-
--- AddForeignKey
-ALTER TABLE "data" ADD CONSTRAINT "data_runId_fkey" FOREIGN KEY ("runId") REFERENCES "run"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-
--- AddForeignKey
-ALTER TABLE "dataType" ADD CONSTRAINT "dataType_nodeName_fkey" FOREIGN KEY ("nodeName") REFERENCES "node"("name") ON DELETE RESTRICT ON UPDATE CASCADE;
-
-ALTER TABLE "data" SET (timescaledb.compress,
- timescaledb.compress_orderby = 'time DESC',
- timescaledb.compress_segmentby = '"runId", "dataTypeName"',
- timescaledb.compress_chunk_time_interval='24 hours'
-);
-
-SELECT add_compression_policy('data', compress_after => INTERVAL '1d');
\ No newline at end of file
diff --git a/scylla-server/prisma/migrations/20240212220355_init/migration.sql b/scylla-server/prisma/migrations/20240212220355_init/migration.sql
deleted file mode 100644
index 404aedb6..00000000
--- a/scylla-server/prisma/migrations/20240212220355_init/migration.sql
+++ /dev/null
@@ -1,2 +0,0 @@
--- DropIndex
-DROP INDEX "data_time_idx";
diff --git a/scylla-server/prisma/migrations/migration_lock.toml b/scylla-server/prisma/migrations/migration_lock.toml
deleted file mode 100644
index fbffa92c..00000000
--- a/scylla-server/prisma/migrations/migration_lock.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-# Please do not edit this file manually
-# It should be added in your version-control system (i.e. Git)
-provider = "postgresql"
\ No newline at end of file
diff --git a/scylla-server/prisma/schema.prisma b/scylla-server/prisma/schema.prisma
deleted file mode 100755
index 29a4aaa5..00000000
--- a/scylla-server/prisma/schema.prisma
+++ /dev/null
@@ -1,64 +0,0 @@
-generator client {
- provider = "cargo prisma"
-
-}
-
-datasource db {
- provider = "postgresql"
- url = env("SOURCE_DATABASE_URL")
-}
-
-model run {
- id Int @id @unique @default(autoincrement())
- locationName String?
- location location? @relation(fields: [locationName], references: [name])
- driverName String?
- driver driver? @relation(fields: [driverName], references: [username])
- systemName String?
- system system? @relation(fields: [systemName], references: [name])
- data data[]
- time DateTime @db.Timestamptz()
-}
-
-model location {
- name String @id @unique
- latitude Float
- longitude Float
- radius Float
- runs run[]
-}
-
-model driver {
- username String @id @unique
- runs run[]
-}
-
-model system {
- name String @id @unique
- runs run[]
-}
-
-model data {
- id String @default(uuid())
- values Float[]
- dataTypeName String
- dataType dataType @relation(fields: [dataTypeName], references: [name])
- time DateTime @db.Timestamptz()
- runId Int
- run run @relation(fields: [runId], references: [id])
-
- @@unique([id, time])
-}
-
-model dataType {
- name String @id @unique
- unit String
- data data[]
- node node @relation(fields: [nodeName], references: [name])
- nodeName String
-}
-
-model node {
- name String @id @unique
- dataTypes dataType[]
-}
\ No newline at end of file
diff --git a/scylla-server/prisma/seed.rs b/scylla-server/prisma/seed.rs
deleted file mode 100644
index 3129c951..00000000
--- a/scylla-server/prisma/seed.rs
+++ /dev/null
@@ -1,228 +0,0 @@
-use std::{sync::Arc, time::Duration};
-
-use prisma_client_rust::QueryError;
-use scylla_server::{
- prisma::PrismaClient,
- processors::ClientData,
- services::{
- data_service, data_type_service, driver_service, location_service, node_service,
- run_service, system_service,
- },
- Database,
-};
-
-#[tokio::main]
-async fn main() -> Result<(), QueryError> {
- println!("Connecting and seeding!");
- let client: Database = Arc::new(
- PrismaClient::_builder()
- .build()
- .await
- .expect("Could not build prisma DB"),
- );
-
- client.data().delete_many(vec![]).exec().await?;
-
- client.data_type().delete_many(vec![]).exec().await?;
-
- client.driver().delete_many(vec![]).exec().await?;
-
- client.location().delete_many(vec![]).exec().await?;
-
- client.node().delete_many(vec![]).exec().await?;
-
- client.run().delete_many(vec![]).exec().await?;
-
- client.system().delete_many(vec![]).exec().await?;
-
- let created_run = run_service::create_run(&client, chrono::offset::Utc::now()).await?;
-
- system_service::upsert_system(&client, "Data And Controls".to_string(), created_run.id).await?;
- driver_service::upsert_driver(&client, "Fergus".to_string(), created_run.id).await?;
- location_service::upsert_location(
- &client,
- "Gainsborough".to_string(),
- 1.0,
- 1.0,
- 1.0,
- created_run.id,
- )
- .await?;
-
- node_service::upsert_node(&client, "BMS".to_string()).await?;
- node_service::upsert_node(&client, "MPU".to_string()).await?;
-
- data_type_service::upsert_data_type(
- &client,
- "Pack-Temp".to_string(),
- "C".to_string(),
- "BMS".to_string(),
- )
- .await?;
- data_service::add_many(
- &client,
- vec![
- ClientData {
- run_id: created_run.id,
- name: "Pack-Temp".to_string(),
- unit: "C".to_string(),
- values: vec![20f32],
- timestamp: chrono::offset::Utc::now(),
- node: "BMS".to_string(),
- },
- ClientData {
- run_id: created_run.id,
- name: "Pack-Temp".to_string(),
- unit: "C".to_string(),
- values: vec![21f32],
- timestamp: chrono::offset::Utc::now() + Duration::from_millis(1000),
- node: "BMS".to_string(),
- },
- ClientData {
- run_id: created_run.id,
- name: "Pack-Temp".to_string(),
- unit: "C".to_string(),
- values: vec![22f32],
- timestamp: chrono::offset::Utc::now() + Duration::from_millis(2000),
- node: "BMS".to_string(),
- },
- ClientData {
- run_id: created_run.id,
- name: "Pack-Temp".to_string(),
- unit: "C".to_string(),
- values: vec![17f32],
- timestamp: chrono::offset::Utc::now() + Duration::from_millis(3000),
- node: "BMS".to_string(),
- },
- ClientData {
- run_id: created_run.id,
- name: "Pack-Temp".to_string(),
- unit: "C".to_string(),
- values: vec![17f32],
- timestamp: chrono::offset::Utc::now() + Duration::from_millis(4000),
- node: "BMS".to_string(),
- },
- ClientData {
- run_id: created_run.id,
- name: "Pack-Temp".to_string(),
- unit: "C".to_string(),
- values: vec![17f32],
- timestamp: chrono::offset::Utc::now() + Duration::from_millis(5000),
- node: "BMS".to_string(),
- },
- ClientData {
- run_id: created_run.id,
- name: "Pack-Temp".to_string(),
- unit: "C".to_string(),
- values: vec![17f32],
- timestamp: chrono::offset::Utc::now() + Duration::from_millis(6000),
- node: "BMS".to_string(),
- },
- ClientData {
- run_id: created_run.id,
- name: "Pack-Temp".to_string(),
- unit: "C".to_string(),
- values: vec![17f32],
- timestamp: chrono::offset::Utc::now() + Duration::from_millis(7000),
- node: "BMS".to_string(),
- },
- ClientData {
- run_id: created_run.id,
- name: "Pack-Temp".to_string(),
- unit: "C".to_string(),
- values: vec![17f32],
- timestamp: chrono::offset::Utc::now() + Duration::from_millis(8000),
- node: "BMS".to_string(),
- },
- ],
- )
- .await?;
-
- data_type_service::upsert_data_type(
- &client,
- "Pack-Voltage".to_string(),
- "V".to_string(),
- "BMS".to_string(),
- )
- .await?;
- data_type_service::upsert_data_type(
- &client,
- "Pack-SOC".to_string(),
- "%".to_string(),
- "BMS".to_string(),
- )
- .await?;
- data_type_service::upsert_data_type(
- &client,
- "Pack-Current".to_string(),
- "A".to_string(),
- "BMS".to_string(),
- )
- .await?;
- data_type_service::upsert_data_type(
- &client,
- "Sense-Accel".to_string(),
- "G".to_string(),
- "MPU".to_string(),
- )
- .await?;
- data_type_service::upsert_data_type(
- &client,
- "Sense-Temperature".to_string(),
- "C".to_string(),
- "MPU".to_string(),
- )
- .await?;
- data_type_service::upsert_data_type(
- &client,
- "State-Speed".to_string(),
- "mph".to_string(),
- "MPU".to_string(),
- )
- .await?;
-
- node_service::upsert_node(&client, "TPU".to_string()).await?;
- data_type_service::upsert_data_type(
- &client,
- "Points".to_string(),
- "coords".to_string(),
- "TPU".to_string(),
- )
- .await?;
-
- simulate_route(client, created_run.id).await?;
-
- Ok(())
-}
-
-// lat,long
-const NYC_COORDS: (f64, f64) = (40.7128, -74.006);
-const LA_COORDS: (f64, f64) = (34.0522, -118.2437);
-const STEP_NUM: u8 = 10;
-async fn simulate_route(db: Database, curr_run: i32) -> Result<(), QueryError> {
- let step_lat = (LA_COORDS.0 - NYC_COORDS.0) / STEP_NUM as f64;
- let step_long = (LA_COORDS.1 - NYC_COORDS.1) / STEP_NUM as f64;
-
- for i in 0..STEP_NUM {
- // clamp to [-90,90]
- let inter_lat = (NYC_COORDS.0 + step_lat * i as f64).clamp(-90.0, 90.0);
- let inter_long = NYC_COORDS.1 + step_long * i as f64;
-
- data_service::add_data(
- &db,
- ClientData {
- run_id: curr_run,
- name: "Points".to_string(),
- unit: "Coord".to_string(),
- values: vec![inter_lat as f32, inter_long as f32],
- timestamp: chrono::offset::Utc::now(),
- node: "TPU".to_string(),
- },
- )
- .await?;
-
- tokio::time::sleep(Duration::from_secs(1)).await;
- }
-
- Ok(())
-}
diff --git a/scylla-server/src/controllers/data_controller.rs b/scylla-server/src/controllers/data_controller.rs
index 4e74d9d9..a0330112 100644
--- a/scylla-server/src/controllers/data_controller.rs
+++ b/scylla-server/src/controllers/data_controller.rs
@@ -5,18 +5,19 @@ use axum::{
use crate::{
error::ScyllaError, services::data_service, transformers::data_transformer::PublicData,
- Database,
+ PoolHandle,
};
/// Get all of the data points of a certain data type name and run ID
pub async fn get_data(
- State(db): State,
+ State(pool): State,
Path((data_type_name, run_id)): Path<(String, i32)>,
) -> Result>, ScyllaError> {
- let data = data_service::get_data(&db, data_type_name, run_id).await?;
+ let mut db = pool.get()?;
+ let data = data_service::get_data(&mut db, data_type_name, run_id).await?;
// map data to frontend data types according to the From func of the client struct
- let mut transformed_data: Vec = data.iter().map(PublicData::from).collect();
+ let mut transformed_data: Vec = data.into_iter().map(PublicData::from).collect();
transformed_data.sort();
Ok(Json::from(transformed_data))
diff --git a/scylla-server/src/controllers/data_type_controller.rs b/scylla-server/src/controllers/data_type_controller.rs
index 1277492d..b2821796 100644
--- a/scylla-server/src/controllers/data_type_controller.rs
+++ b/scylla-server/src/controllers/data_type_controller.rs
@@ -2,17 +2,18 @@ use axum::{extract::State, Json};
use crate::{
error::ScyllaError, services::data_type_service,
- transformers::data_type_transformer::PublicDataType, Database,
+ transformers::data_type_transformer::PublicDataType, PoolHandle,
};
/// Get a list of data types
pub async fn get_all_data_types(
- State(db): State,
+ State(pool): State,
) -> Result>, ScyllaError> {
- let data_types = data_type_service::get_all_data_types(&db).await?;
+ let mut db = pool.get()?;
+ let data_types = data_type_service::get_all_data_types(&mut db).await?;
let transformed_data_types: Vec =
- data_types.iter().map(PublicDataType::from).collect();
+ data_types.into_iter().map(PublicDataType::from).collect();
Ok(Json::from(transformed_data_types))
}
diff --git a/scylla-server/src/controllers/driver_controller.rs b/scylla-server/src/controllers/driver_controller.rs
deleted file mode 100644
index 50de4bb8..00000000
--- a/scylla-server/src/controllers/driver_controller.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-use axum::{extract::State, Json};
-
-use crate::{
- error::ScyllaError, services::driver_service, transformers::driver_transformer::PublicDriver,
- Database,
-};
-
-/// Get a list of drivers
-pub async fn get_all_drivers(
- State(db): State,
-) -> Result>, ScyllaError> {
- let driver_data = driver_service::get_all_drivers(&db).await?;
-
- let transformed_driver_data: Vec =
- driver_data.iter().map(PublicDriver::from).collect();
-
- Ok(Json::from(transformed_driver_data))
-}
diff --git a/scylla-server/src/controllers/location_controller.rs b/scylla-server/src/controllers/location_controller.rs
deleted file mode 100644
index 679756b8..00000000
--- a/scylla-server/src/controllers/location_controller.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-use axum::{extract::State, Json};
-
-use crate::{
- error::ScyllaError, services::location_service,
- transformers::location_transformer::PublicLocation, Database,
-};
-
-/// get a list of locations
-pub async fn get_all_locations(
- State(db): State,
-) -> Result>, ScyllaError> {
- let loc_data = location_service::get_all_locations(&db).await?;
-
- let transformed_loc_data: Vec =
- loc_data.iter().map(PublicLocation::from).collect();
-
- Ok(Json::from(transformed_loc_data))
-}
diff --git a/scylla-server/src/controllers/mod.rs b/scylla-server/src/controllers/mod.rs
index cf82adb2..acc5fb63 100644
--- a/scylla-server/src/controllers/mod.rs
+++ b/scylla-server/src/controllers/mod.rs
@@ -1,8 +1,5 @@
pub mod car_command_controller;
+
pub mod data_controller;
pub mod data_type_controller;
-pub mod driver_controller;
-pub mod location_controller;
-pub mod node_controller;
pub mod run_controller;
-pub mod system_controller;
diff --git a/scylla-server/src/controllers/node_controller.rs b/scylla-server/src/controllers/node_controller.rs
deleted file mode 100644
index 4460caaf..00000000
--- a/scylla-server/src/controllers/node_controller.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-use axum::{extract::State, Json};
-
-use crate::{
- error::ScyllaError, services::node_service, transformers::node_transformer::PublicNode,
- Database,
-};
-
-/// get a list of nodes
-pub async fn get_all_nodes(
- State(db): State,
-) -> Result>, ScyllaError> {
- let node_data = node_service::get_all_nodes(&db).await?;
-
- let transformed_node_data: Vec = node_data.iter().map(PublicNode::from).collect();
-
- Ok(Json::from(transformed_node_data))
-}
diff --git a/scylla-server/src/controllers/run_controller.rs b/scylla-server/src/controllers/run_controller.rs
index ce6d11dd..8922dabe 100644
--- a/scylla-server/src/controllers/run_controller.rs
+++ b/scylla-server/src/controllers/run_controller.rs
@@ -6,24 +6,28 @@ use axum::{
};
use crate::{
- error::ScyllaError, services::run_service, transformers::run_transformer::PublicRun, Database,
+ error::ScyllaError, services::run_service, transformers::run_transformer::PublicRun, PoolHandle,
};
/// get a list of runs
-pub async fn get_all_runs(State(db): State) -> Result>, ScyllaError> {
- let run_data = run_service::get_all_runs(&db).await?;
+pub async fn get_all_runs(
+ State(pool): State,
+) -> Result>, ScyllaError> {
+ let mut db = pool.get()?;
+ let run_data = run_service::get_all_runs(&mut db).await?;
- let transformed_run_data: Vec = run_data.iter().map(PublicRun::from).collect();
+ let transformed_run_data: Vec = run_data.into_iter().map(PublicRun::from).collect();
Ok(Json::from(transformed_run_data))
}
/// get a run given its ID
pub async fn get_run_by_id(
- State(db): State,
+ State(pool): State,
Path(run_id): Path,
) -> Result, ScyllaError> {
- let run_data = run_service::get_run_by_id(&db, run_id).await?;
+ let mut db = pool.get()?;
+ let run_data = run_service::get_run_by_id(&mut db, run_id).await?;
if run_data.is_none() {
return Err(ScyllaError::EmptyResult);
@@ -31,15 +35,16 @@ pub async fn get_run_by_id(
let run_data_safe = run_data.unwrap();
- let transformed_run_data = PublicRun::from(&run_data_safe);
+ let transformed_run_data = PublicRun::from(run_data_safe);
Ok(Json::from(transformed_run_data))
}
/// create a new run with an auto-incremented ID
/// note the new run must be updated so the channel passed in notifies the data processor to use the new run
-pub async fn new_run(State(db): State) -> Result, ScyllaError> {
- let run_data = run_service::create_run(&db, chrono::offset::Utc::now()).await?;
+pub async fn new_run(State(pool): State) -> Result, ScyllaError> {
+ let mut db = pool.get()?;
+ let run_data = run_service::create_run(&mut db, chrono::offset::Utc::now()).await?;
crate::RUN_ID.store(run_data.id, Ordering::Relaxed);
tracing::info!(
@@ -47,5 +52,5 @@ pub async fn new_run(State(db): State) -> Result, Scyl
crate::RUN_ID.load(Ordering::Relaxed)
);
- Ok(Json::from(PublicRun::from(&run_data)))
+ Ok(Json::from(PublicRun::from(run_data)))
}
diff --git a/scylla-server/src/controllers/system_controller.rs b/scylla-server/src/controllers/system_controller.rs
deleted file mode 100644
index 5922efa9..00000000
--- a/scylla-server/src/controllers/system_controller.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-use axum::{extract::State, Json};
-
-use crate::{
- error::ScyllaError, services::system_service, transformers::system_transformer::PublicSystem,
- Database,
-};
-
-/// get a list of systems
-pub async fn get_all_systems(
- State(db): State,
-) -> Result>, ScyllaError> {
- let run_data = system_service::get_all_systems(&db).await?;
-
- let transformed_run_data: Vec = run_data.iter().map(PublicSystem::from).collect();
-
- Ok(Json::from(transformed_run_data))
-}
diff --git a/scylla-server/src/db_handler.rs b/scylla-server/src/db_handler.rs
new file mode 100644
index 00000000..35cba368
--- /dev/null
+++ b/scylla-server/src/db_handler.rs
@@ -0,0 +1,216 @@
+use tokio::sync::mpsc::Receiver;
+
+use tokio::{sync::mpsc::Sender, time::Duration};
+
+use tokio_util::sync::CancellationToken;
+use tracing::{debug, info, instrument, trace, warn, Level};
+
+use crate::services::{data_service, data_type_service, run_service};
+use crate::{ClientData, PoolHandle, RUN_ID};
+
+/// A few threads to manage the processing and inserting of special types,
+/// upserting of metadata for data, and batch uploading the database
+pub struct DbHandler {
+ /// The list of data types seen by this instance, used for when to upsert
+ datatype_list: Vec,
+ /// The broadcast channel which provides serial datapoints for processing
+ receiver: Receiver,
+ /// The database pool handle
+ pool: PoolHandle,
+ /// the queue of data
+ data_queue: Vec,
+ /// the time since last batch
+ last_time: tokio::time::Instant,
+ /// upload interval
+ upload_interval: u64,
+}
+
+impl DbHandler {
+ /// Make a new db handler
+ /// * `recv` - the broadcast reciver of which clientdata will be sent
+ pub fn new(
+ receiver: Receiver,
+ pool: PoolHandle,
+ upload_interval: u64,
+ ) -> DbHandler {
+ DbHandler {
+ datatype_list: vec![],
+ receiver,
+ pool,
+ data_queue: vec![],
+ last_time: tokio::time::Instant::now(),
+ upload_interval,
+ }
+ }
+
+ /// This loop handles batch uploading, and has no internal state or requirements
+ /// It uses the queue from data queue to insert to the database specified
+ /// On cancellation, will await one final queue message to cleanup anything remaining in the channel
+ pub async fn batching_loop(
+ mut batch_queue: Receiver>,
+ pool: PoolHandle,
+ cancel_token: CancellationToken,
+ ) {
+ loop {
+ tokio::select! {
+ _ = cancel_token.cancelled() => {
+ let Ok(mut database) = pool.get() else {
+ warn!("Could not get connection for cleanup");
+ break;
+ };
+ // cleanup all remaining messages if batches start backing up
+ while let Some(final_msgs) = batch_queue.recv().await {
+ info!("{} batches remaining!", batch_queue.len()+1);
+ // do not spawn new tasks in this mode, see below comment for chunk_size math
+ let chunk_size = final_msgs.len() / ((final_msgs.len() / 16380) + 1);
+ for chunk in final_msgs.chunks(chunk_size).collect::>() {
+ info!(
+ "A cleanup batch uploaded: {:?}",
+ data_service::add_many(&mut database, chunk.to_vec()).await
+ );
+ }
+ }
+ info!("No more messages to cleanup.");
+ break;
+ },
+ Some(msgs) = batch_queue.recv() => {
+ // libpq has max 65535 params, therefore batch
+ // max for batch is 65535/4 params per message, hence the below, rounded down with a margin for safety
+ // TODO avoid this code batch uploading the remainder messages as a new batch, combine it with another safely
+ let chunk_size = msgs.len() / ((msgs.len() / 16380) + 1);
+ debug!("Batch uploading {} chunks in parrallel", msgs.len() / chunk_size);
+ for chunk in msgs.chunks(chunk_size).collect::>() {
+ tokio::spawn(DbHandler::batch_upload(chunk.to_vec(), pool.clone()));
+ }
+ debug!(
+ "DB send: {} of {}",
+ batch_queue.len(),
+ batch_queue.max_capacity()
+ );
+ }
+ }
+ }
+ }
+
+ /// A batching loop that consumes messages but does not upload anything
+ pub async fn fake_batching_loop(
+ mut batch_queue: Receiver>,
+ cancel_token: CancellationToken,
+ ) {
+ loop {
+ tokio::select! {
+ _ = cancel_token.cancelled() => {
+ warn!("Cancelling fake upload with {} batches left in queue!", batch_queue.len());
+ break;
+ },
+ Some(msgs) = batch_queue.recv() => {
+ warn!("NOT UPLOADING {} MESSAGES", msgs.len());
+ },
+ }
+ }
+ }
+
+ #[instrument(level = Level::DEBUG, skip(msg, pool))]
+ async fn batch_upload(msg: Vec, pool: PoolHandle) {
+ let Ok(mut database) = pool.get() else {
+ warn!("Could not get connection for batch upload!");
+ return;
+ };
+ match data_service::add_many(&mut database, msg).await {
+ Ok(count) => info!("Batch uploaded: {:?}", count),
+ Err(err) => warn!("Error in batch upload: {:?}", err),
+ }
+ }
+
+ /// A loop which uses self and a sender channel to process data
+ /// If the data is special, i.e. coordinates, driver, etc. it will store it in its special location of the db immediately
+ /// For all data points it will add the to the data_channel for batch uploading logic when a certain time has elapsed
+ /// Before this time the data is stored in an internal queue.
+ /// On cancellation, the messages currently in the queue will be sent as a final flush of any remaining messages received before cancellation
+ pub async fn handling_loop(
+ mut self,
+ data_channel: Sender>,
+ cancel_token: CancellationToken,
+ ) {
+ loop {
+ tokio::select! {
+ _ = cancel_token.cancelled() => {
+ debug!("Pushing final messages to queue");
+ data_channel.send(self.data_queue.clone()).await.expect("Could not comm data to db thread, shutdown");
+ self.data_queue.clear();
+ break;
+ },
+ Some(msg) = self.receiver.recv() => {
+ self.handle_msg(msg, &data_channel).await;
+ }
+ }
+ }
+ }
+
+ #[instrument(skip(self), level = Level::TRACE)]
+ async fn handle_msg(&mut self, msg: ClientData, data_channel: &Sender>) {
+ trace!(
+ "Mqtt dispatcher: {} of {}",
+ self.receiver.len(),
+ self.receiver.max_capacity()
+ );
+
+ // If the time is greater than upload interval, push to batch upload thread and clear queue
+ if tokio::time::Instant::now().duration_since(self.last_time)
+ > Duration::from_millis(self.upload_interval)
+ && !self.data_queue.is_empty()
+ {
+ data_channel
+ .send(self.data_queue.clone())
+ .await
+ .expect("Could not comm data to db thread");
+ self.data_queue.clear();
+ self.last_time = tokio::time::Instant::now();
+ }
+
+ if !self.datatype_list.contains(&msg.name) {
+ let Ok(mut database) = self.pool.get() else {
+ warn!("Could not get connection for dataType upsert");
+ return;
+ };
+ info!("Upserting data type: {}", msg.name);
+ if let Err(msg) = data_type_service::upsert_data_type(
+ &mut database,
+ msg.name.clone(),
+ msg.unit.clone(),
+ msg.node.clone(),
+ )
+ .await
+ {
+ warn!("DB error datatype upsert: {:?}", msg);
+ }
+ self.datatype_list.push(msg.name.clone());
+ }
+
+ // Check for GPS points, insert them into current run if available
+ if msg.name == "TPU/GPS/Location" {
+ debug!("Upserting run with location points!");
+ let Ok(mut database) = self.pool.get() else {
+ warn!("Could not get connection for db points update");
+ return;
+ };
+ // ensure lat AND long present in message, just a sanity check
+ if msg.values.len() < 2 {
+ warn!("GPS message found without both lat and long!");
+ } else if let Err(err) = run_service::update_run_with_coords(
+ &mut database,
+ RUN_ID.load(std::sync::atomic::Ordering::Relaxed),
+ msg.values[0].into(),
+ msg.values[1].into(),
+ )
+ .await
+ {
+ warn!("DB error run gps points upsert: {:?}", err);
+ }
+ }
+
+ // no matter what, batch upload the message
+ trace!("Pushing msg to queue: {:?}", msg);
+ self.data_queue.push(msg);
+ }
+}
diff --git a/scylla-server/src/error.rs b/scylla-server/src/error.rs
index 8b7563ad..b228d1ed 100644
--- a/scylla-server/src/error.rs
+++ b/scylla-server/src/error.rs
@@ -2,15 +2,13 @@ use axum::{
http::StatusCode,
response::{IntoResponse, Response},
};
-use prisma_client_rust::{
- prisma_errors::query_engine::{RecordNotFound, UniqueKeyViolation},
- QueryError,
-};
use tracing::warn;
pub enum ScyllaError {
- /// Any prisma query which errors out
- PrismaError(QueryError),
+ /// Deseil error
+ DbError(diesel::result::Error),
+ /// Diesel db connection error,
+ ConnError(diesel::r2d2::PoolError),
/// An instruction was not encodable
InvalidEncoding(String),
/// Could not communicate to car
@@ -19,9 +17,15 @@ pub enum ScyllaError {
EmptyResult,
}
-impl From for ScyllaError {
- fn from(error: QueryError) -> Self {
- ScyllaError::PrismaError(error)
+impl From for ScyllaError {
+ fn from(error: diesel::result::Error) -> Self {
+ ScyllaError::DbError(error)
+ }
+}
+
+impl From for ScyllaError {
+ fn from(error: diesel::r2d2::PoolError) -> Self {
+ ScyllaError::ConnError(error)
}
}
@@ -29,15 +33,11 @@ impl From for ScyllaError {
impl IntoResponse for ScyllaError {
fn into_response(self) -> Response {
let (status, reason) = match self {
- ScyllaError::PrismaError(error) if error.is_prisma_error::() => (
- StatusCode::CONFLICT,
- format!("Unique Key Violation: {}", error),
- ),
- ScyllaError::PrismaError(error) if error.is_prisma_error::() => (
- StatusCode::NOT_FOUND,
- format!("Record Not Found: {}", error),
+ ScyllaError::ConnError(error) => (
+ StatusCode::INTERNAL_SERVER_ERROR,
+ format!("Could not connect to db: {}", error),
),
- ScyllaError::PrismaError(error) => (
+ ScyllaError::DbError(error) => (
StatusCode::BAD_REQUEST,
format!("Misc query error: {}", error),
),
diff --git a/scylla-server/src/lib.rs b/scylla-server/src/lib.rs
index 70794d70..5ea5f7db 100644
--- a/scylla-server/src/lib.rs
+++ b/scylla-server/src/lib.rs
@@ -1,20 +1,26 @@
-use std::sync::atomic::AtomicI32;
+use chrono::serde::ts_milliseconds;
pub mod controllers;
pub mod error;
-pub mod processors;
pub mod services;
-pub mod transformers;
-#[allow(clippy::all)]
-#[allow(warnings)]
-pub mod prisma;
+pub mod db_handler;
+pub mod mqtt_processor;
+
+#[allow(non_snake_case)]
+pub mod models;
+#[allow(non_snake_case)]
+pub mod schema;
pub mod command_data;
pub mod serverdata;
+pub mod transformers;
+
/// The type descriptor of the database passed to the middlelayer through axum state
-pub type Database = std::sync::Arc;
+pub type Database = diesel::PgConnection;
+
+pub type PoolHandle = diesel::r2d2::Pool>;
#[derive(clap::ValueEnum, Debug, PartialEq, Copy, Clone, Default)]
#[clap(rename_all = "kebab_case")]
@@ -27,4 +33,25 @@ pub enum RateLimitMode {
}
// Atomic to keep track the current run id across EVERYTHING (very scary)
-pub static RUN_ID: AtomicI32 = AtomicI32::new(-1);
+pub static RUN_ID: std::sync::atomic::AtomicI32 = std::sync::atomic::AtomicI32::new(-1);
+
+/// Represents the client data
+/// This has the dual purposes of
+/// * - representing the packet sent over the socket for live data
+/// * - representing the struct for the service layer to unpack for insertion
+/// Note: node name is only considered for database storage and convenience, it is not serialized in a socket packet
+#[derive(serde::Serialize, Clone, Debug)]
+pub struct ClientData {
+ #[serde(rename = "runId")]
+ pub run_id: i32,
+ pub name: String,
+ pub unit: String,
+ pub values: Vec,
+ /// Client expects time in milliseconds, so serialize as such
+ #[serde(with = "ts_milliseconds")]
+ pub timestamp: chrono::DateTime,
+
+ /// client doesnt parse node
+ #[serde(skip_serializing)]
+ pub node: String,
+}
diff --git a/scylla-server/src/main.rs b/scylla-server/src/main.rs
index 002841b6..7241b6b9 100755
--- a/scylla-server/src/main.rs
+++ b/scylla-server/src/main.rs
@@ -9,24 +9,26 @@ use axum::{
Extension, Router,
};
use clap::Parser;
+use diesel::{
+ r2d2::{ConnectionManager, Pool},
+ PgConnection,
+};
+use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
+use dotenvy::dotenv;
use rumqttc::v5::AsyncClient;
-use scylla_server::RUN_ID;
use scylla_server::{
controllers::{
self,
car_command_controller::{self},
- data_type_controller, driver_controller, location_controller, node_controller,
- run_controller, system_controller,
- },
- prisma::PrismaClient,
- processors::{
- db_handler,
- mock_processor::MockProcessor,
- mqtt_processor::{MqttProcessor, MqttProcessorOptions},
- ClientData,
+ data_type_controller, run_controller,
},
services::run_service::{self},
- Database, RateLimitMode,
+ PoolHandle, RateLimitMode,
+};
+use scylla_server::{
+ db_handler,
+ mqtt_processor::{MqttProcessor, MqttProcessorOptions},
+ ClientData, RUN_ID,
};
use socketioxide::{extract::SocketRef, SocketIo};
use tokio::{signal, sync::mpsc};
@@ -43,14 +45,6 @@ use tracing_subscriber::{fmt::format::FmtSpan, EnvFilter};
#[derive(Parser, Debug)]
#[command(version)]
struct ScyllaArgs {
- /// Whether to enable the Scylla production mode
- #[arg(short = 'p', long, env = "SCYLLA_PROD")]
- prod: bool,
-
- /// Whether to enable batch saturation (parallel batching)
- #[arg(short = 's', long, env = "SCYLLA_SATURATE_BATCH")]
- saturate_batch: bool,
-
/// Whether to disable batch data uploading (will not disable upsertion of special types)
#[arg(long, env = "SCYLLA_DATA_UPLOAD_DISABLE")]
disable_data_upload: bool,
@@ -105,6 +99,8 @@ struct ScyllaArgs {
socketio_discard_percent: u8,
}
+const MIGRATIONS: EmbeddedMigrations = embed_migrations!();
+
#[tokio::main]
async fn main() {
let cli = ScyllaArgs::parse();
@@ -138,12 +134,20 @@ async fn main() {
}
// create the database stuff
- let db: Database = Arc::new(
- PrismaClient::_builder()
- .build()
- .await
- .expect("Could not build prisma DB"),
- );
+ info!("Initializing database connections...");
+ dotenv().ok();
+ let manager = ConnectionManager::::new(std::env::var("DATABASE_URL").unwrap());
+ // Refer to the `r2d2` documentation for more methods to use
+ // when building a connection pool
+ let db: PoolHandle = Pool::builder()
+ .test_on_check_out(true)
+ .build(manager)
+ .expect("Could not build connection pool");
+
+ let mut conn = db.get().unwrap();
+ conn.run_pending_migrations(MIGRATIONS)
+ .expect("Could not run migrations!");
+ info!("Successfully migrated DB!");
// create the socket stuff
let (socket_layer, io) = SocketIo::builder()
@@ -170,15 +174,14 @@ async fn main() {
let token = CancellationToken::new();
// spawn the database handler
task_tracker.spawn(
- db_handler::DbHandler::new(mqtt_receive, Arc::clone(&db), cli.batch_upsert_time * 1000)
+ db_handler::DbHandler::new(mqtt_receive, db.clone(), cli.batch_upsert_time * 1000)
.handling_loop(db_send, token.clone()),
);
// spawn the database inserter, if we have it enabled
if !cli.disable_data_upload {
task_tracker.spawn(db_handler::DbHandler::batching_loop(
db_receive,
- Arc::clone(&db),
- cli.saturate_batch,
+ db.clone(),
token.clone(),
));
} else {
@@ -188,40 +191,31 @@ async fn main() {
));
}
- // if PROD_SCYLLA=false, also procur a client for use in the config state
- let client: Option> = if !cli.prod {
- info!("Running processor in mock mode, no data will be stored");
- let recv = MockProcessor::new(io);
- tokio::spawn(recv.generate_mock());
- None
- } else {
- // creates the initial run
- let curr_run = run_service::create_run(&db, chrono::offset::Utc::now())
- .await
- .expect("Could not create initial run!");
- debug!("Configuring current run: {:?}", curr_run);
+ // creates the initial run
+ let curr_run = run_service::create_run(&mut db.get().unwrap(), chrono::offset::Utc::now())
+ .await
+ .expect("Could not create initial run!");
+ debug!("Configuring current run: {:?}", curr_run);
- RUN_ID.store(curr_run.id, Ordering::Relaxed);
- // run prod if this isnt present
- // create and spawn the mqtt processor
- info!("Running processor in MQTT (production) mode");
- let (recv, opts) = MqttProcessor::new(
- mqtt_send,
- io,
- token.clone(),
- MqttProcessorOptions {
- mqtt_path: cli.siren_host_url,
- initial_run: curr_run.id,
- static_rate_limit_time: cli.static_rate_limit_value,
- rate_limit_mode: cli.rate_limit_mode,
- upload_ratio: cli.socketio_discard_percent,
- },
- );
- let (client, eventloop) = AsyncClient::new(opts, 600);
- let client_sharable: Arc = Arc::new(client);
- task_tracker.spawn(recv.process_mqtt(client_sharable.clone(), eventloop));
- Some(client_sharable)
- };
+ RUN_ID.store(curr_run.id, Ordering::Relaxed);
+ // run prod if this isnt present
+ // create and spawn the mqtt processor
+ info!("Running processor in MQTT (production) mode");
+ let (recv, opts) = MqttProcessor::new(
+ mqtt_send,
+ io,
+ token.clone(),
+ MqttProcessorOptions {
+ mqtt_path: cli.siren_host_url,
+ initial_run: curr_run.id,
+ static_rate_limit_time: cli.static_rate_limit_value,
+ rate_limit_mode: cli.rate_limit_mode,
+ upload_ratio: cli.socketio_discard_percent,
+ },
+ );
+ let (client, eventloop) = AsyncClient::new(opts, 600);
+ let client_sharable: Arc = Arc::new(client);
+ task_tracker.spawn(recv.process_mqtt(client_sharable.clone(), eventloop));
let app = Router::new()
// DATA
@@ -231,22 +225,13 @@ async fn main() {
)
// DATA TYPE
.route("/datatypes", get(data_type_controller::get_all_data_types))
- // DRIVERS
- .route("/drivers", get(driver_controller::get_all_drivers))
- // LOCATIONS
- .route("/locations", get(location_controller::get_all_locations))
- // NODES
- .route("/nodes", get(node_controller::get_all_nodes))
- // RUNS
.route("/runs", get(run_controller::get_all_runs))
.route("/runs/:id", get(run_controller::get_run_by_id))
.route("/runs/new", post(run_controller::new_run))
- // SYSTEMS
- .route("/systems", get(system_controller::get_all_systems))
// CONFIG
.route(
"/config/set/:configKey",
- post(car_command_controller::send_config_command).layer(Extension(client)),
+ post(car_command_controller::send_config_command).layer(Extension(client_sharable)),
)
// for CORS handling
.layer(
diff --git a/scylla-server/src/models.rs b/scylla-server/src/models.rs
new file mode 100644
index 00000000..03990555
--- /dev/null
+++ b/scylla-server/src/models.rs
@@ -0,0 +1,38 @@
+use chrono::{DateTime, Utc};
+use diesel::prelude::*;
+use serde::Serialize;
+
+#[derive(Queryable, Debug, Identifiable, Insertable, Selectable, Serialize, AsChangeset)]
+#[diesel(table_name = crate::schema::data)]
+#[diesel(belongs_to(DataType, foreign_key = dataTypeName))]
+#[diesel(check_for_backend(diesel::pg::Pg))]
+pub struct Data {
+ pub id: i32,
+ pub values: Option>>,
+ pub dataTypeName: String,
+ pub time: DateTime,
+ pub runId: i32,
+}
+
+#[derive(Queryable, Debug, Identifiable, Insertable, Selectable, Serialize, AsChangeset)]
+#[diesel(table_name = crate::schema::dataType)]
+#[diesel(primary_key(name))]
+#[diesel(check_for_backend(diesel::pg::Pg))]
+pub struct DataType {
+ pub name: String,
+ pub unit: String,
+ pub nodeName: String,
+}
+
+#[derive(Queryable, Debug, Identifiable, Insertable, Selectable, Serialize, AsChangeset)]
+#[diesel(table_name = crate::schema::run)]
+#[diesel(check_for_backend(diesel::pg::Pg))]
+pub struct Run {
+ pub id: i32,
+ pub locationName: Option,
+ pub latitude: Option,
+ pub longitude: Option,
+ pub driverName: Option,
+ pub notes: String,
+ pub time: DateTime,
+}
diff --git a/scylla-server/src/processors/mqtt_processor.rs b/scylla-server/src/mqtt_processor.rs
similarity index 97%
rename from scylla-server/src/processors/mqtt_processor.rs
rename to scylla-server/src/mqtt_processor.rs
index 604e876f..2255b6a5 100644
--- a/scylla-server/src/processors/mqtt_processor.rs
+++ b/scylla-server/src/mqtt_processor.rs
@@ -5,7 +5,6 @@ use std::{
};
use chrono::TimeDelta;
-use prisma_client_rust::bigdecimal::ToPrimitive;
use protobuf::Message;
use ringbuffer::RingBuffer;
use rumqttc::v5::{
@@ -153,26 +152,27 @@ impl MqttProcessor {
},
_ = view_interval.tick() => {
trace!("Updating viewership data!");
- if let Ok(sockets) = self.io.sockets() {
+ let sockets = self.io.sockets();
+ let sockets_cnt = match sockets {
+ Ok(s) => s.len() as f32,
+ Err(_) => -1f32,
+ };
let client_data = ClientData {
name: "Viewers".to_string(),
node: "Internal".to_string(),
unit: "".to_string(),
run_id: crate::RUN_ID.load(Ordering::Relaxed),
timestamp: chrono::offset::Utc::now(),
- values: vec![sockets.len() as f32]
+ values: vec![sockets_cnt]
};
self.send_socket_msg(client_data, &mut upload_counter);
- } else {
- warn!("Could not fetch socket count");
- }
}
_ = latency_interval.tick() => {
// set latency to 0 if no messages are in buffer
let avg_latency = if latency_ringbuffer.is_empty() {
0
} else {
- latency_ringbuffer.iter().sum::().num_milliseconds() / latency_ringbuffer.len().to_i64().unwrap_or_default()
+ latency_ringbuffer.iter().sum::().num_milliseconds() / latency_ringbuffer.len() as i64
};
let client_data = ClientData {
@@ -238,7 +238,7 @@ impl MqttProcessor {
// get the node and datatype from the topic extracted at the beginning
let node = split.0;
- let data_type = split.1.replace('/', "-");
+ let data_type = String::from(topic);
// extract the unix time
// levels of time priority
diff --git a/scylla-server/src/processors/db_handler.rs b/scylla-server/src/processors/db_handler.rs
deleted file mode 100644
index 5a927672..00000000
--- a/scylla-server/src/processors/db_handler.rs
+++ /dev/null
@@ -1,324 +0,0 @@
-use tokio::sync::mpsc::Receiver;
-
-use tokio::{sync::mpsc::Sender, time::Duration};
-
-use tokio_util::sync::CancellationToken;
-use tracing::{debug, info, instrument, trace, warn, Level};
-
-use crate::{
- services::{
- data_service, data_type_service, driver_service, location_service, node_service,
- system_service,
- },
- Database,
-};
-
-use super::{ClientData, LocationData};
-
-/// A struct defining an in progress location packet
-struct LocLock {
- location_name: Option,
- points: Option<(f32, f32)>,
- radius: Option,
-}
-
-impl LocLock {
- pub fn new() -> LocLock {
- LocLock {
- location_name: None,
- points: None,
- radius: None,
- }
- }
-
- /// Add the location name to the packet
- pub fn add_loc_name(&mut self, loc_name: String) {
- self.location_name = Some(loc_name);
- }
-
- /// Add points to the packet
- pub fn add_points(&mut self, lat: f32, long: f32) {
- self.points = Some((lat, long));
- }
-
- /// Add a radius to the packet
- pub fn add_radius(&mut self, radius: f32) {
- self.radius = Some(radius);
- }
-
- /// Attempt to finalize the packet, returning a location data and clearing this object or None if still in progress
- pub fn finalize(&mut self) -> Option {
- if self.location_name.is_some() && self.points.is_some() && self.radius.is_some() {
- self.clear();
- return Some(LocationData {
- location_name: self.location_name.clone().unwrap(),
- lat: self.points.unwrap().0,
- long: self.points.unwrap().1,
- radius: self.radius.unwrap(),
- });
- }
- None
- }
-
- /// Clear the internal state
- fn clear(&mut self) {
- self.location_name = None;
- self.points = None;
- self.radius = None;
- }
-}
-
-/// A few threads to manage the processing and inserting of special types,
-/// upserting of metadata for data, and batch uploading the database
-pub struct DbHandler {
- /// The list of nodes seen by this instance, used for when to upsert
- node_list: Vec,
- /// The list of data types seen by this instance, used for when to upsert
- datatype_list: Vec,
- /// The broadcast channel which provides serial datapoints for processing
- receiver: Receiver,
- /// The database
- db: Database,
- /// An internal state of an in progress location packet
- location_lock: LocLock,
- /// Whether the location has been modified this loop
- is_location: bool,
- /// the queue of data
- data_queue: Vec,
- /// the time since last batch
- last_time: tokio::time::Instant,
- /// upload interval
- upload_interval: u64,
-}
-
-impl DbHandler {
- /// Make a new db handler
- /// * `recv` - the broadcast reciver of which clientdata will be sent
- pub fn new(receiver: Receiver, db: Database, upload_interval: u64) -> DbHandler {
- DbHandler {
- node_list: vec![],
- datatype_list: vec![],
- receiver,
- db,
- location_lock: LocLock::new(),
- is_location: false,
- data_queue: vec![],
- last_time: tokio::time::Instant::now(),
- upload_interval,
- }
- }
-
- /// This loop handles batch uploading, and has no internal state or requirements
- /// It uses the queue from data queue to insert to the database specified
- /// On cancellation, will await one final queue message to cleanup anything remaining in the channel
- pub async fn batching_loop(
- mut batch_queue: Receiver>,
- database: Database,
- saturate_batches: bool,
- cancel_token: CancellationToken,
- ) {
- loop {
- tokio::select! {
- _ = cancel_token.cancelled() => {
- // cleanup all remaining messages if batches start backing up
- while let Some(final_msgs) = batch_queue.recv().await {
- info!("{} batches remaining!", batch_queue.len()+1);
- info!(
- "A cleanup batch uploaded: {:?}",
- data_service::add_many(&database, final_msgs).await
- );
- }
- info!("No more messages to cleanup.");
- break;
- },
- Some(msgs) = batch_queue.recv() => {
- if saturate_batches {
- let shared_db = database.clone();
- tokio::spawn(async move {
- Self::batch_upload(msgs, &shared_db).await;
- });
- } else {
- Self::batch_upload(msgs, &database).await;
- }
- debug!(
- "DB send: {} of {}",
- batch_queue.len(),
- batch_queue.max_capacity()
- );
- }
- }
- }
- }
-
- /// A batching loop that consumes messages but does not upload anything
- pub async fn fake_batching_loop(
- mut batch_queue: Receiver>,
- cancel_token: CancellationToken,
- ) {
- loop {
- tokio::select! {
- _ = cancel_token.cancelled() => {
- warn!("Cancelling fake upload with {} batches left in queue!", batch_queue.len());
- break;
- },
- Some(msgs) = batch_queue.recv() => {
- warn!("NOT UPLOADING {} MESSAGES", msgs.len());
- },
- }
- }
- }
-
- #[instrument(level = Level::DEBUG, skip(msg))]
- async fn batch_upload(msg: Vec, db: &Database) {
- match data_service::add_many(db, msg).await {
- Ok(count) => info!("Batch uploaded: {:?}", count),
- Err(err) => warn!("Error in batch upload: {:?}", err),
- }
- }
-
- /// A loop which uses self and a sender channel to process data
- /// If the data is special, i.e. coordinates, driver, etc. it will store it in its special location of the db immediately
- /// For all data points it will add the to the data_channel for batch uploading logic when a certain time has elapsed
- /// Before this time the data is stored in an internal queue.
- /// On cancellation, the messages currently in the queue will be sent as a final flush of any remaining messages received before cancellation
- pub async fn handling_loop(
- mut self,
- data_channel: Sender>,
- cancel_token: CancellationToken,
- ) {
- loop {
- tokio::select! {
- _ = cancel_token.cancelled() => {
- debug!("Pushing final messages to queue");
- data_channel.send(self.data_queue.clone()).await.expect("Could not comm data to db thread, shutdown");
- self.data_queue.clear();
- break;
- },
- Some(msg) = self.receiver.recv() => {
- self.handle_msg(msg, &data_channel).await;
- }
- }
- }
- }
-
- #[instrument(skip(self), level = Level::TRACE)]
- async fn handle_msg(&mut self, msg: ClientData, data_channel: &Sender>) {
- trace!(
- "Mqtt dispatcher: {} of {}",
- self.receiver.len(),
- self.receiver.max_capacity()
- );
-
- // If the time is greater than upload interval, push to batch upload thread and clear queue
- if tokio::time::Instant::now().duration_since(self.last_time)
- > Duration::from_millis(self.upload_interval)
- && !self.data_queue.is_empty()
- {
- data_channel
- .send(self.data_queue.clone())
- .await
- .expect("Could not comm data to db thread");
- self.data_queue.clear();
- self.last_time = tokio::time::Instant::now();
- }
-
- // upsert if not present, a sort of cache of upserted types really
- if !self.node_list.contains(&msg.node) {
- info!("Upserting node: {}", msg.node);
- if let Err(msg) = node_service::upsert_node(&self.db, msg.node.clone()).await {
- warn!("DB error node upsert: {:?}", msg);
- }
- self.node_list.push(msg.node.clone());
- }
- if !self.datatype_list.contains(&msg.name) {
- info!("Upserting data type: {}", msg.name);
- if let Err(msg) = data_type_service::upsert_data_type(
- &self.db,
- msg.name.clone(),
- msg.unit.clone(),
- msg.node.clone(),
- )
- .await
- {
- warn!("DB error datatype upsert: {:?}", msg);
- }
- self.datatype_list.push(msg.name.clone());
- }
-
- // if data has some special meanings, push them to the database immediately, notably no matter what also enter batching logic
- match msg.name.as_str() {
- // TODO remove driver from here, as driver is not car sourced
- "Driver" => {
- debug!("Upserting driver: {:?}", msg.values);
- if let Err(err) = driver_service::upsert_driver(
- &self.db,
- (*msg.values.first().unwrap_or(&0.0f32)).to_string(),
- msg.run_id,
- )
- .await
- {
- warn!("Driver upsert error: {:?}", err);
- }
- }
- // TODO see above
- "location" => {
- debug!("Upserting location name: {:?}", msg.values);
- self.location_lock
- .add_loc_name((*msg.values.first().unwrap_or(&0.0f32)).to_string());
- self.is_location = true;
- }
- // TODO see above
- "system" => {
- debug!("Upserting system: {:?}", msg.values);
- if let Err(err) = system_service::upsert_system(
- &self.db,
- (*msg.values.first().unwrap_or(&0.0f32)).to_string(),
- msg.run_id,
- )
- .await
- {
- warn!("System upsert error: {:?}", err);
- }
- }
- "GPS-Location" => {
- debug!("Upserting location points: {:?}", msg.values);
- self.location_lock.add_points(
- *msg.values.first().unwrap_or(&0.0f32),
- *msg.values.get(1).unwrap_or(&0.0f32),
- );
- self.is_location = true;
- }
- "Radius" => {
- debug!("Upserting location radius: {:?}", msg.values);
- self.location_lock
- .add_radius(*msg.values.first().unwrap_or(&0.0f32));
- self.is_location = true;
- }
- _ => {}
- }
- // if location has been modified, push a new location of the loc lock object returns Some
- if self.is_location {
- trace!("Checking location status...");
- if let Some(loc) = self.location_lock.finalize() {
- debug!("Upserting location: {:?}", loc);
- if let Err(err) = location_service::upsert_location(
- &self.db,
- loc.location_name,
- loc.lat as f64,
- loc.long as f64,
- loc.radius as f64,
- msg.run_id,
- )
- .await
- {
- warn!("Location upsert error: {:?}", err);
- }
- }
- self.is_location = false;
- }
-
- // no matter what, batch upload the message
- trace!("Pushing msg to queue: {:?}", msg);
- self.data_queue.push(msg);
- }
-}
diff --git a/scylla-server/src/processors/mock_data.rs b/scylla-server/src/processors/mock_data.rs
deleted file mode 100644
index e557f3bd..00000000
--- a/scylla-server/src/processors/mock_data.rs
+++ /dev/null
@@ -1,123 +0,0 @@
-use super::mock_processor::MockData;
-
-pub const BASE_MOCK_DATA: [MockData; 17] = [
- MockData {
- name: "Status-Temp_Average",
- unit: "C",
- num_of_vals: 1,
- min: -20.0,
- max: 54.0,
- },
- MockData {
- name: "Temps-Motor_Temperature",
- unit: "C",
- num_of_vals: 1,
- min: -20.0,
- max: 54.0,
- },
- MockData {
- name: "Pack-SOC",
- unit: "%",
- num_of_vals: 1,
- min: 0.0,
- max: 100.0,
- },
- MockData {
- name: "Sense-Accel",
- unit: "G",
- num_of_vals: 3,
- min: -6.0,
- max: 6.0,
- },
- MockData {
- name: "GPS-Location",
- unit: "coordinates",
- num_of_vals: 2,
- min: -90.0,
- max: 90.0,
- },
- MockData {
- name: "Sense-SteeringAngle",
- unit: "degrees",
- num_of_vals: 1,
- min: 0.0,
- max: 360.0,
- },
- MockData {
- name: "Pack-Voltage",
- unit: "V",
- num_of_vals: 1,
- min: 0.0,
- max: 5.0,
- },
- MockData {
- name: "OnBoard-CpuUsage",
- unit: "%",
- num_of_vals: 1,
- min: 0.0,
- max: 100.0,
- },
- MockData {
- name: "OnBoard-CpuTemp",
- unit: "C",
- num_of_vals: 1,
- min: 0.0,
- max: 100.0,
- },
- MockData {
- name: "OnBoard-MemAvailable",
- unit: "mb",
- num_of_vals: 1,
- min: 0.0,
- max: 8000.0,
- },
- MockData {
- name: "HaLow-RSSI",
- unit: "dbm",
- num_of_vals: 1,
- min: -150.0,
- max: 80.0,
- },
- MockData {
- name: "HaLow-StaMCS",
- unit: "",
- num_of_vals: 1,
- min: 0.0,
- max: 10.0,
- },
- MockData {
- name: "Status/MPH",
- unit: "mph",
- num_of_vals: 1,
- min: 0.0,
- max: 88.0,
- },
- MockData {
- name: "Pack-CCL",
- unit: "A",
- num_of_vals: 1,
- min: -35.0,
- max: 0.0,
- },
- MockData {
- name: "Pack-DCL",
- unit: "A",
- num_of_vals: 1,
- min: 0.0,
- max: 550.0,
- },
- MockData {
- name: "Pedals-Brake1",
- unit: "",
- num_of_vals: 1,
- min: 0.0,
- max: 3000.0,
- },
- MockData {
- name: "Power-AC_Current",
- unit: "A",
- num_of_vals: 1,
- min: 0.0,
- max: 600.0,
- },
-];
diff --git a/scylla-server/src/processors/mock_processor.rs b/scylla-server/src/processors/mock_processor.rs
deleted file mode 100644
index 4757ba4f..00000000
--- a/scylla-server/src/processors/mock_processor.rs
+++ /dev/null
@@ -1,66 +0,0 @@
-use std::time::Duration;
-
-use rand::Rng;
-use socketioxide::SocketIo;
-use tracing::warn;
-
-use super::{mock_data::BASE_MOCK_DATA, ClientData};
-
-#[derive(Clone, Copy)]
-pub struct MockData {
- pub name: &'static str,
- pub unit: &'static str,
- pub num_of_vals: u8,
- pub min: f32,
- pub max: f32,
-}
-
-impl MockData {
- fn get_values(&self) -> Vec {
- let mut val_vec: Vec = vec![];
- // for each point, get a random number in the range
- for _ in 0..self.num_of_vals {
- val_vec.push(rand::thread_rng().gen_range((self.min)..(self.max)));
- }
-
- val_vec
- }
-}
-
-pub struct MockProcessor {
- curr_run: i32,
- io: SocketIo,
-}
-
-impl MockProcessor {
- pub fn new(io: SocketIo) -> Self {
- MockProcessor { curr_run: 1, io }
- }
-
- pub async fn generate_mock(self) {
- loop {
- // get a random mock datapoint the first 0 to len of number mock data
- let index = rand::thread_rng().gen_range(0..(BASE_MOCK_DATA.len()));
-
- let dat = BASE_MOCK_DATA[index];
-
- let client_data: ClientData = ClientData {
- run_id: self.curr_run,
- name: dat.name.to_string(),
- unit: dat.unit.to_string(),
- values: dat.get_values(),
- timestamp: chrono::offset::Utc::now(),
- node: "".to_string(), // uneeded for socket use only
- };
-
- match self.io.emit(
- "message",
- serde_json::to_string(&client_data).expect("Could not serialize ClientData"),
- ) {
- Ok(_) => (),
- Err(err) => warn!("Socket: Broadcast error: {}", err),
- }
- tokio::time::sleep(Duration::from_millis(50)).await;
- }
- }
-}
diff --git a/scylla-server/src/processors/mod.rs b/scylla-server/src/processors/mod.rs
deleted file mode 100644
index 5c0736e3..00000000
--- a/scylla-server/src/processors/mod.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-use chrono::serde::ts_milliseconds;
-use chrono::{DateTime, Utc};
-
-pub mod db_handler;
-mod mock_data;
-pub mod mock_processor;
-pub mod mqtt_processor;
-
-/// Represents the client data
-/// This has the dual purposes of
-/// * - representing the packet sent over the socket for live data
-/// * - representing the struct for the service layer to unpack for insertion
-/// Note: node name is only considered for database storage and convenience, it is not serialized in a socket packet
-#[derive(serde::Serialize, Clone, Debug)]
-pub struct ClientData {
- #[serde(rename = "runId")]
- pub run_id: i32,
- pub name: String,
- pub unit: String,
- pub values: Vec,
- /// Client expects time in milliseconds, so serialize as such
- #[serde(with = "ts_milliseconds")]
- pub timestamp: DateTime,
-
- /// client doesnt parse node
- #[serde(skip_serializing)]
- pub node: String,
-}
-
-/// A final location packet
-/// This has the purpose of representing the struct for the service layer to unpack for insertion, and therefore is not serialized
-#[derive(Debug)]
-struct LocationData {
- location_name: String,
- lat: f32,
- long: f32,
- radius: f32,
-}
diff --git a/scylla-server/src/schema.rs b/scylla-server/src/schema.rs
new file mode 100644
index 00000000..52414e46
--- /dev/null
+++ b/scylla-server/src/schema.rs
@@ -0,0 +1,36 @@
+// @generated automatically by Diesel CLI.
+
+diesel::table! {
+ data (id) {
+ id -> Int4,
+ values -> Nullable>>,
+ dataTypeName -> Text,
+ time -> Timestamptz,
+ runId -> Int4,
+ }
+}
+
+diesel::table! {
+ dataType (name) {
+ name -> Text,
+ unit -> Text,
+ nodeName -> Text,
+ }
+}
+
+diesel::table! {
+ run (id) {
+ id -> Int4,
+ locationName -> Nullable,
+ latitude -> Nullable,
+ longitude -> Nullable,
+ driverName -> Nullable,
+ notes -> Text,
+ time -> Timestamptz,
+ }
+}
+
+diesel::joinable!(data -> dataType (dataTypeName));
+diesel::joinable!(data -> run (runId));
+
+diesel::allow_tables_to_appear_in_same_query!(data, dataType, run,);
diff --git a/scylla-server/src/services/data_service.rs b/scylla-server/src/services/data_service.rs
index 1cfb5387..3f15725e 100644
--- a/scylla-server/src/services/data_service.rs
+++ b/scylla-server/src/services/data_service.rs
@@ -1,80 +1,70 @@
-use prisma_client_rust::QueryError;
-
-use crate::{prisma, processors::ClientData, Database};
-
-prisma::data::select! {public_data {
- time
- values
-}}
+use crate::{models::Data, schema::data::dsl::*, ClientData, Database};
+use diesel::prelude::*;
/// Get datapoints that mach criteria
-/// * `db` - The prisma client to make the call to
+/// * `db` - The database connection to use
/// * `data_type_name` - The data type name to filter the data by
/// * `run_id` - The run id to filter the data
-/// * `fetch_run` whether to fetch the run assocaited with this data
-/// * `fetch_data_type` whether to fetch the data type associated with this data
-/// returns: A result containing the data or the QueryError propogated by the db
+/// returns: A result containing the data or the error propogated by the db
pub async fn get_data(
- db: &Database,
+ db: &mut Database,
data_type_name: String,
run_id: i32,
-) -> Result, QueryError> {
- db.data()
- .find_many(vec![
- prisma::data::data_type_name::equals(data_type_name),
- prisma::data::run_id::equals(run_id),
- ])
- .select(public_data::select())
- .exec()
- .await
+) -> Result, diesel::result::Error> {
+ data.filter(runId.eq(run_id).and(dataTypeName.eq(data_type_name)))
+ .load(db)
}
/// Adds a datapoint
-/// * `db` - The prisma client to make the call to
+/// * `db` - The database connection to use
/// * `serverdata` - The protobuf message to parse, note the unit is ignored!
/// * `unix_time` - The time im miliseconds since unix epoch of the message
/// * `data_type_name` - The name of the data type, note this data type must already exist!
/// * `rin_id` - The run id to assign the data point to, note this run must already exist!
/// returns: A result containing the data or the QueryError propogated by the db
pub async fn add_data(
- db: &Database,
+ db: &mut Database,
client_data: ClientData,
-) -> Result {
- db.data()
- .create(
- prisma::data_type::name::equals(client_data.name),
- client_data.timestamp.fixed_offset(),
- prisma::run::id::equals(client_data.run_id),
- vec![prisma::data::values::set(
- client_data.values.iter().map(|f| *f as f64).collect(),
- )],
- )
- .select(public_data::select())
- .exec()
- .await
+) -> Result {
+ diesel::insert_into(data)
+ .values((
+ dataTypeName.eq(client_data.name),
+ time.eq(client_data.timestamp),
+ runId.eq(client_data.run_id),
+ values.eq(client_data
+ .values
+ .iter()
+ .map(|v| Some(*v as f64))
+ .collect::>()),
+ ))
+ .get_result(db)
}
/// Adds many datapoints via a batch insert
-/// * `db` - The prisma client to make the call to
+/// * `db` - The database connection to use
/// * `client_data` - A list of data to batch insert
/// returns: A result containing the number of rows inserted or the QueryError propogated by the db
-pub async fn add_many(db: &Database, client_data: Vec) -> Result {
- db.data()
- .create_many(
+pub async fn add_many(
+ db: &mut Database,
+ client_data: Vec,
+) -> Result {
+ diesel::insert_into(data)
+ .values(
client_data
.iter()
- .map(|f| {
- prisma::data::create_unchecked(
- f.name.to_string(),
- f.timestamp.fixed_offset(),
- f.run_id,
- vec![prisma::data::values::set(
- f.values.iter().map(|f| *f as f64).collect(),
- )],
+ .map(|single_client_data| {
+ (
+ dataTypeName.eq(single_client_data.name.clone()),
+ time.eq(single_client_data.timestamp),
+ runId.eq(single_client_data.run_id),
+ values.eq(single_client_data
+ .values
+ .iter()
+ .map(|v| Some(*v as f64))
+ .collect::>()),
)
})
- .collect(),
+ .collect::>(),
)
- .exec()
- .await
+ .execute(db)
}
diff --git a/scylla-server/src/services/data_type_service.rs b/scylla-server/src/services/data_type_service.rs
index 2cf87278..757e5543 100644
--- a/scylla-server/src/services/data_type_service.rs
+++ b/scylla-server/src/services/data_type_service.rs
@@ -1,51 +1,35 @@
-use prisma_client_rust::QueryError;
-
-use crate::{prisma, Database};
-
-prisma::data_type::select! {public_datatype {
- name
- unit
-}}
+use crate::{models::DataType, schema::dataType::dsl::*, Database};
+use diesel::prelude::*;
/// Gets all datatypes
-/// * `db` - The prisma client to make the call to
+/// * `d ` - The connection to the database
/// returns: A result containing the data or the QueryError propogated by the db
-pub async fn get_all_data_types(db: &Database) -> Result, QueryError> {
- db.data_type()
- .find_many(vec![])
- .select(public_datatype::select())
- .exec()
- .await
+pub async fn get_all_data_types(db: &mut Database) -> Result, diesel::result::Error> {
+ dataType.load(db)
}
/// Upserts a datatype, either creating or updating one depending on its existence
-/// * `db` - The prisma client to make the call to
+/// * `db` - The database connection to use
/// * `data_type_name` - The data type name to upsert
/// * `unit` - The unit of the data
/// * `node_name` - The name of the node linked to the data type, must already exist!
/// returns: A result containing the data or the QueryError propogated by the db
pub async fn upsert_data_type(
- db: &Database,
+ db: &mut Database,
data_type_name: String,
- unit: String,
+ new_unit: String,
node_name: String,
-) -> Result {
- db.data_type()
- .upsert(
- prisma::data_type::name::equals(data_type_name.clone()),
- prisma::data_type::create(
- data_type_name.clone(),
- unit.clone(),
- prisma::node::name::equals(node_name.clone()),
- vec![],
- ),
- vec![
- prisma::data_type::unit::set(unit),
- prisma::data_type::name::set(data_type_name.clone()),
- prisma::data_type::node::connect(prisma::node::name::equals(node_name.clone())),
- ],
- )
- .select(public_datatype::select())
- .exec()
- .await
+) -> Result {
+ let val = DataType {
+ name: data_type_name,
+ unit: new_unit,
+ nodeName: node_name,
+ };
+ diesel::insert_into(dataType)
+ .values(&val)
+ .on_conflict(name)
+ .do_update() // actually allows for the upsert ability
+ .set(&val)
+ .returning(DataType::as_returning())
+ .get_result(db)
}
diff --git a/scylla-server/src/services/driver_service.rs b/scylla-server/src/services/driver_service.rs
deleted file mode 100644
index fd7f26cf..00000000
--- a/scylla-server/src/services/driver_service.rs
+++ /dev/null
@@ -1,62 +0,0 @@
-use prisma_client_rust::QueryError;
-
-use crate::{
- prisma::{self},
- Database,
-};
-
-prisma::driver::select! { public_driver{
- username
- runs: select {
- id
- location_name
- driver_name
- system_name
- time
- }
-}}
-
-/// Gets all drivers
-/// * `db` - The prisma client to make the call to
-/// returns: A result containing the data or the QueryError propogated by the db
-pub async fn get_all_drivers(db: &Database) -> Result, QueryError> {
- db.driver()
- .find_many(vec![])
- .select(public_driver::select())
- .exec()
- .await
-}
-
-/// Upserts a driver, either creating or updating one depending on its existence
-/// * `db` - The prisma client to make the call to
-/// * `driver_name` - The name of the driver to upsert
-/// * `run_id` - The id of the run to link to the driver, must already exist!
-/// returns: A result containing the data or the QueryError propogated by the db
-pub async fn upsert_driver(
- db: &Database,
- driver_name: String,
- run_id: i32,
-) -> Result {
- let drive = db
- .driver()
- .upsert(
- prisma::driver::username::equals(driver_name.clone()),
- prisma::driver::create(driver_name.clone(), vec![]),
- vec![],
- )
- .select(public_driver::select())
- .exec()
- .await?;
-
- db.run()
- .update(
- prisma::run::id::equals(run_id),
- vec![prisma::run::driver::connect(
- prisma::driver::username::equals(driver_name),
- )],
- )
- .exec()
- .await?;
-
- Ok(drive)
-}
diff --git a/scylla-server/src/services/location_service.rs b/scylla-server/src/services/location_service.rs
deleted file mode 100644
index 717045ba..00000000
--- a/scylla-server/src/services/location_service.rs
+++ /dev/null
@@ -1,75 +0,0 @@
-use prisma_client_rust::QueryError;
-
-use crate::{
- prisma::{self},
- Database,
-};
-
-prisma::location::select! {public_location{
- name
- latitude
- longitude
- radius
- runs: select {
- id
- location_name
- driver_name
- system_name
- time
- }
-}}
-
-/// Gets all locations
-/// * `db` - The prisma client to make the call to
-/// returns: A result containing the data or the QueryError propogated by the db
-pub async fn get_all_locations(db: &Database) -> Result, QueryError> {
- db.location()
- .find_many(vec![])
- .select(public_location::select())
- .exec()
- .await
-}
-
-/// Upserts a location, either creating or updating one depending on its existence
-/// * `db` - The prisma client to make the call to
-/// * `name` - The name of the location to upsert
-/// * `latitude` - The latitude of the location
-/// * `longitude` - The longitude of the location
-/// * `radius` - The radius of the locations bounds
-/// * `run_id` - The run at the location, must already exist!
-/// returns: A result containing the data or the QueryError propogated by the db
-pub async fn upsert_location(
- db: &Database,
- name: String,
- latitude: f64,
- longitude: f64,
- radius: f64,
- run_id: i32,
-) -> Result {
- let loc = db
- .location()
- .upsert(
- prisma::location::name::equals(name.clone()),
- prisma::location::create(name.clone(), latitude, longitude, radius, vec![]),
- vec![
- prisma::location::latitude::set(latitude),
- prisma::location::longitude::set(longitude),
- prisma::location::radius::set(radius),
- ],
- )
- .select(public_location::select())
- .exec()
- .await?;
-
- db.run()
- .update(
- prisma::run::id::equals(run_id),
- vec![prisma::run::location::connect(
- prisma::location::name::equals(name),
- )],
- )
- .exec()
- .await?;
-
- Ok(loc)
-}
diff --git a/scylla-server/src/services/mod.rs b/scylla-server/src/services/mod.rs
index abaaef06..2de58ca6 100644
--- a/scylla-server/src/services/mod.rs
+++ b/scylla-server/src/services/mod.rs
@@ -1,7 +1,3 @@
pub mod data_service;
pub mod data_type_service;
-pub mod driver_service;
-pub mod location_service;
-pub mod node_service;
pub mod run_service;
-pub mod system_service;
diff --git a/scylla-server/src/services/node_service.rs b/scylla-server/src/services/node_service.rs
deleted file mode 100644
index 3946d836..00000000
--- a/scylla-server/src/services/node_service.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-use prisma_client_rust::QueryError;
-
-use crate::{prisma, Database};
-
-prisma::node::include! {public_node{
- data_types: select {
- name
- unit
- }
-}}
-
-/// Gets all nodes
-/// * `db` - The prisma client to make the call to
-/// returns: A result containing the data or the QueryError propogated by the db
-pub async fn get_all_nodes(db: &Database) -> Result, QueryError> {
- db.node()
- .find_many(vec![])
- .with(prisma::node::data_types::fetch(vec![]))
- .include(public_node::include())
- .exec()
- .await
-}
-
-/// Upserts a node, either creating or updating one depending on its existence
-/// * `db` - The prisma client to make the call to
-/// * `node_name` - The name of the node linked to the data type
-/// returns: A result containing the data or the QueryError propogated by the db
-pub async fn upsert_node(
- db: &Database,
- node_name: String,
-) -> Result {
- db.node()
- .upsert(
- prisma::node::name::equals(node_name.clone()),
- prisma::node::create(node_name, vec![]),
- vec![],
- )
- .include(public_node::include())
- .exec()
- .await
-}
diff --git a/scylla-server/src/services/run_service.rs b/scylla-server/src/services/run_service.rs
index b775e36b..1c2e0d11 100644
--- a/scylla-server/src/services/run_service.rs
+++ b/scylla-server/src/services/run_service.rs
@@ -1,30 +1,12 @@
-use std::vec;
-
+use crate::{models::Run, schema::run::dsl::*, Database};
use chrono::{DateTime, Utc};
-use prisma_client_rust::QueryError;
-
-use crate::{
- prisma::{self},
- Database,
-};
-
-prisma::run::select! {public_run{
- id
- location_name
- driver_name
- system_name
- time
-}}
+use diesel::prelude::*;
/// Gets all runs
/// * `db` - The prisma client to make the call to
/// returns: A result containing the data or the QueryError propogated by the db
-pub async fn get_all_runs(db: &Database) -> Result, QueryError> {
- db.run()
- .find_many(vec![])
- .select(public_run::select())
- .exec()
- .await
+pub async fn get_all_runs(db: &mut Database) -> Result, diesel::result::Error> {
+ run.load(db)
}
/// Gets a single run by its id
@@ -32,14 +14,10 @@ pub async fn get_all_runs(db: &Database) -> Result, QueryE
/// * `run_id` - The id of the run to search for
/// returns: A result containing the data (or None if the `run_id` was not a valid run) or the QueryError propogated by the db
pub async fn get_run_by_id(
- db: &Database,
+ db: &mut Database,
run_id: i32,
-) -> Result