Refactor/patch db (#2415)

* the only way to begin is by beginning

* chore: Convert over 3444 migration

* fix imports

* wip

* feat: convert volume

* convert: system.rs

* wip(convert): Setup

* wip properties

* wip notifications

* wip

* wip migration

* wip init

* wip auth/control

* wip action

* wip control

* wiip 034

* wip 344

* wip some more versions converted

* feat: Reserialize the version of the db

* wip rest of the versions

* wip s9pk/manifest

* wip wifi

* chore: net/keys

* chore: net/dns

* wip net/dhcp

* wip manager manager-map

* gut dependency errors

* wip update/mod

* detect breakages locally for updates

* wip: manager/mod

* wip: manager/health

* wip: backup/target/mod

* fix: Typo addresses

* clean control.rs

* fix system package id

* switch to btreemap for now

* config wip

* wip manager/mod

* install wip

Co-authored-by: J H <Blu-J@users.noreply.github.com>

* chore: Update the last of the errors

* feat: Change the prelude de to borrow

* feat: Adding in some more things

* chore: add to the prelude

* chore: Small fixes

* chore: Fixing the small errors

* wip: Cleaning up check errors

* wip: Fix some of the issues

* chore: Fix setup

* chore:fix version

* chore: prelude, mod, http_reader

* wip backup_bulk

* chore: Last of the errors

* upadte package.json

* chore: changes needed for a build

* chore: Removing some of the linting errors in the manager

* chore: Some linting 101

* fix: Wrong order of who owns what

* chore: Remove the unstable

* chore: Remove the test in the todo

* @dr-bonez did a refactoring on the backup

* chore: Make sure that there can only be one override guard at a time

* resolve most todos

* wip: Add some more tracing to debug an error

* wip: Use a mv instead of rename

* wip: Revert some of the missing code segments found earlier

* chore: Make the build

* chore: Something about the lib looks like it iis broken

* wip: More instrument and dev working

* kill netdummy before creating it

* better db analysis tools

* fixes from testing

* fix: Make add start the service

* fix status after install

* make wormhole

* fix missing icon file

* fix data url for icons

* fix: Bad deser

* bugfixes

* fix: Backup

* fix: Some of the restor

* fix: Restoring works

* update frontend patch-db types

* hack it in (#2424)

* hack it in

* optimize

* slightly cleaner

* handle config pointers

* dependency config errs

* fix compat

* cache docker

* fix dependency expectation

* fix dependency auto-config

---------

Co-authored-by: Aiden McClelland <me@drbonez.dev>
Co-authored-by: Matt Hill <mattnine@protonmail.com>
Co-authored-by: J H <Blu-J@users.noreply.github.com>
Co-authored-by: Matt Hill <MattDHill@users.noreply.github.com>
This commit is contained in:
J H
2023-09-27 15:46:48 -06:00
committed by GitHub
parent c305deab52
commit 9a202cc124
132 changed files with 7641 additions and 20541 deletions

View File

@@ -41,6 +41,18 @@ dependencies = [
"version_check",
]
[[package]]
name = "ahash"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
dependencies = [
"cfg-if",
"getrandom 0.2.8",
"once_cell",
"version_check",
]
[[package]]
name = "aho-corasick"
version = "0.7.20"
@@ -292,15 +304,6 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitmaps"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2"
dependencies = [
"typenum",
]
[[package]]
name = "bitmaps"
version = "3.2.0"
@@ -355,44 +358,6 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
[[package]]
name = "bollard"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d82e7850583ead5f8bbef247e2a3c37a19bd576e8420cd262a6711921827e1e5"
dependencies = [
"base64 0.13.1",
"bollard-stubs",
"bytes",
"futures-core",
"futures-util",
"hex",
"http",
"hyper",
"hyperlocal",
"log",
"pin-project-lite",
"serde",
"serde_derive",
"serde_json",
"serde_urlencoded",
"thiserror",
"tokio",
"tokio-util",
"url",
"winapi",
]
[[package]]
name = "bollard-stubs"
version = "1.42.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed59b5c00048f48d7af971b71f800fdf23e858844a6f9e4d32ca72e9399e7864"
dependencies = [
"serde",
"serde_with 1.14.0",
]
[[package]]
name = "brotli"
version = "3.3.4"
@@ -484,7 +449,7 @@ version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23170228b96236b5a7299057ac284a321457700bc8c41a4476052f0f4ba5349d"
dependencies = [
"hashbrown",
"hashbrown 0.12.3",
]
[[package]]
@@ -584,7 +549,7 @@ dependencies = [
"indenter",
"once_cell",
"owo-colors",
"tracing-error 0.2.0",
"tracing-error",
]
[[package]]
@@ -596,7 +561,7 @@ dependencies = [
"once_cell",
"owo-colors",
"tracing-core",
"tracing-error 0.2.0",
"tracing-error",
]
[[package]]
@@ -609,6 +574,7 @@ dependencies = [
"dashmap",
"emver",
"failure",
"imbl-value",
"indexmap",
"itertools 0.10.5",
"lazy_static",
@@ -905,38 +871,14 @@ dependencies = [
"syn 1.0.107",
]
[[package]]
name = "darling"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c"
dependencies = [
"darling_core 0.13.4",
"darling_macro 0.13.4",
]
[[package]]
name = "darling"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa"
dependencies = [
"darling_core 0.14.2",
"darling_macro 0.14.2",
]
[[package]]
name = "darling_core"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610"
dependencies = [
"fnv",
"ident_case",
"proc-macro2 1.0.50",
"quote 1.0.23",
"strsim 0.10.0",
"syn 1.0.107",
"darling_core",
"darling_macro",
]
[[package]]
@@ -953,24 +895,13 @@ dependencies = [
"syn 1.0.107",
]
[[package]]
name = "darling_macro"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835"
dependencies = [
"darling_core 0.13.4",
"quote 1.0.23",
"syn 1.0.107",
]
[[package]]
name = "darling_macro"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e"
dependencies = [
"darling_core 0.14.2",
"darling_core",
"quote 1.0.23",
"syn 1.0.107",
]
@@ -982,7 +913,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
dependencies = [
"cfg-if",
"hashbrown",
"hashbrown 0.12.3",
"lock_api",
"once_cell",
"parking_lot_core 0.9.6",
@@ -1192,7 +1123,7 @@ dependencies = [
"color-eyre",
"futures",
"helpers",
"imbl 2.0.0",
"imbl",
"nix 0.25.1",
"procfs",
"serde",
@@ -1200,9 +1131,9 @@ dependencies = [
"tokio",
"tokio-stream",
"tracing",
"tracing-error 0.2.0",
"tracing-error",
"tracing-futures",
"tracing-subscriber 0.3.16",
"tracing-subscriber",
"yajrc 0.1.0 (git+https://github.com/dr-bonez/yajrc.git?branch=develop)",
]
@@ -1253,7 +1184,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116"
dependencies = [
"heck 0.4.0",
"heck",
"proc-macro2 1.0.50",
"quote 1.0.23",
"syn 1.0.107",
@@ -1646,7 +1577,16 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash",
"ahash 0.7.6",
]
[[package]]
name = "hashbrown"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
"ahash 0.8.3",
]
[[package]]
@@ -1655,23 +1595,14 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa"
dependencies = [
"hashbrown",
"hashbrown 0.12.3",
]
[[package]]
name = "heck"
version = "0.3.3"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "heck"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
dependencies = [
"unicode-segmentation",
]
@@ -1851,19 +1782,6 @@ dependencies = [
"tokio-tungstenite",
]
[[package]]
name = "hyperlocal"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fafdf7b2b2de7c9784f76e02c0935e65a8117ec3b768644379983ab333ac98c"
dependencies = [
"futures-util",
"hex",
"hyper",
"pin-project",
"tokio",
]
[[package]]
name = "iana-time-zone"
version = "0.1.53"
@@ -1915,30 +1833,17 @@ dependencies = [
"unicode-normalization",
]
[[package]]
name = "imbl"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "543682c9082b25e63d03b5acbd65ad111fd49dd93e70843e5175db4ff81d606b"
dependencies = [
"bitmaps 2.1.0",
"rand_core 0.6.4",
"rand_xoshiro",
"sized-chunks",
"typenum",
"version_check",
]
[[package]]
name = "imbl"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2806b69cd9f4664844027b64465eacb444c67c1db9c778e341adff0c25cdb0d"
dependencies = [
"bitmaps 3.2.0",
"bitmaps",
"imbl-sized-chunks",
"rand_core 0.6.4",
"rand_xoshiro",
"serde",
"version_check",
]
@@ -1948,7 +1853,19 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6957ea0b2541c5ca561d3ef4538044af79f8a05a1eb3a3b148936aaceaa1076"
dependencies = [
"bitmaps 3.2.0",
"bitmaps",
]
[[package]]
name = "imbl-value"
version = "0.1.0"
source = "git+https://github.com/Start9Labs/imbl-value.git#929395141c3a882ac366c12ac9402d0ebaa2201b"
dependencies = [
"imbl",
"serde",
"serde_json",
"treediff",
"yasi",
]
[[package]]
@@ -1983,7 +1900,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
dependencies = [
"autocfg",
"hashbrown",
"hashbrown 0.12.3",
"serde",
]
@@ -1996,20 +1913,6 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "internment"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a798d7677f07d6f1e77be484ea8626ddb1566194de399f1206306820c406371"
dependencies = [
"ahash",
"dashmap",
"hashbrown",
"once_cell",
"parking_lot 0.12.1",
"serde",
]
[[package]]
name = "io-lifetimes"
version = "1.0.4"
@@ -2106,7 +2009,7 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb52eeac20f256459e909bd4a03bb8c4fab6a1fdbb8ed52d00f644152df48ece"
dependencies = [
"ahash",
"ahash 0.7.6",
"dyn-clone",
"hifijson",
"indexmap",
@@ -2169,9 +2072,9 @@ dependencies = [
name = "json-patch"
version = "0.2.7-alpha.0"
dependencies = [
"imbl-value",
"json-ptr",
"serde",
"serde_json",
"treediff",
]
@@ -2179,17 +2082,18 @@ dependencies = [
name = "json-ptr"
version = "0.1.0"
dependencies = [
"imbl",
"imbl-value",
"serde",
"serde_json",
"thiserror",
]
[[package]]
name = "jsonpath_lib"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eaa63191d68230cccb81c5aa23abd53ed64d83337cacbb25a7b8c7979523774f"
source = "git+https://github.com/Start9Labs/jsonpath.git#1cacbd64afa2e1941a21fef06bad14317ba92f30"
dependencies = [
"imbl-value",
"log",
"serde",
"serde_json",
@@ -2380,6 +2284,15 @@ dependencies = [
"autocfg",
]
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]]
name = "mime"
version = "0.3.16"
@@ -2417,11 +2330,10 @@ dependencies = [
name = "models"
version = "0.1.0"
dependencies = [
"bollard",
"base64 0.21.0",
"color-eyre",
"ed25519-dalek",
"emver",
"internment",
"ipnet",
"lazy_static",
"mbrman",
@@ -2429,6 +2341,7 @@ dependencies = [
"patch-db",
"rand 0.8.5",
"regex",
"reqwest",
"rpc-toolkit",
"serde",
"serde_json",
@@ -2438,6 +2351,7 @@ dependencies = [
"tokio",
"torut",
"tracing",
"yasi",
]
[[package]]
@@ -2483,19 +2397,6 @@ dependencies = [
"smallvec",
]
[[package]]
name = "nix"
version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c"
dependencies = [
"bitflags",
"cc",
"cfg-if",
"libc",
"memoffset",
]
[[package]]
name = "nix"
version = "0.24.3"
@@ -2505,7 +2406,7 @@ dependencies = [
"bitflags",
"cfg-if",
"libc",
"memoffset",
"memoffset 0.6.5",
]
[[package]]
@@ -2518,7 +2419,20 @@ dependencies = [
"bitflags",
"cfg-if",
"libc",
"memoffset",
"memoffset 0.6.5",
"pin-utils",
]
[[package]]
name = "nix"
version = "0.26.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b"
dependencies = [
"bitflags",
"cfg-if",
"libc",
"memoffset 0.7.1",
"pin-utils",
]
@@ -2880,19 +2794,19 @@ dependencies = [
"async-trait",
"fd-lock-rs",
"futures",
"imbl 1.0.1",
"imbl",
"imbl-value",
"json-patch",
"json-ptr",
"lazy_static",
"nix 0.23.2",
"nix 0.26.4",
"patch-db-macro",
"serde",
"serde_cbor 0.11.1",
"serde_json",
"thiserror",
"tokio",
"tracing",
"tracing-error 0.1.2",
"tracing-error",
]
[[package]]
@@ -2908,7 +2822,7 @@ dependencies = [
name = "patch-db-macro-internals"
version = "0.1.0"
dependencies = [
"heck 0.3.3",
"heck",
"proc-macro2 1.0.50",
"quote 1.0.23",
"syn 1.0.107",
@@ -3400,11 +3314,11 @@ dependencies = [
[[package]]
name = "reqwest"
version = "0.11.13"
version = "0.11.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c"
checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1"
dependencies = [
"base64 0.13.1",
"base64 0.21.0",
"bytes",
"cookie",
"cookie_store 0.16.1",
@@ -3424,7 +3338,6 @@ dependencies = [
"once_cell",
"percent-encoding",
"pin-project-lite",
"proc-macro-hack",
"serde",
"serde_json",
"serde_urlencoded",
@@ -3436,6 +3349,7 @@ dependencies = [
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-streams",
"web-sys",
"winreg",
]
@@ -3814,16 +3728,6 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_with"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff"
dependencies = [
"serde",
"serde_with_macros 1.5.2",
]
[[package]]
name = "serde_with"
version = "2.2.0"
@@ -3836,29 +3740,17 @@ dependencies = [
"indexmap",
"serde",
"serde_json",
"serde_with_macros 2.2.0",
"serde_with_macros",
"time 0.3.17",
]
[[package]]
name = "serde_with_macros"
version = "1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082"
dependencies = [
"darling 0.13.4",
"proc-macro2 1.0.50",
"quote 1.0.23",
"syn 1.0.107",
]
[[package]]
name = "serde_with_macros"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1966009f3c05f095697c537312f5415d1e3ed31ce0a56942bac4c771c5c335e"
dependencies = [
"darling 0.14.2",
"darling",
"proc-macro2 1.0.50",
"quote 1.0.23",
"syn 1.0.107",
@@ -4002,16 +3894,6 @@ version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
[[package]]
name = "sized-chunks"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e"
dependencies = [
"bitmaps 2.1.0",
"typenum",
]
[[package]]
name = "slab"
version = "0.4.7"
@@ -4080,7 +3962,7 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcbc16ddba161afc99e14d1713a453747a2b07fc097d2009f4c300ec99286105"
dependencies = [
"ahash",
"ahash 0.7.6",
"atoi",
"base64 0.13.1",
"bitflags",
@@ -4136,7 +4018,7 @@ checksum = "b850fa514dc11f2ee85be9d055c512aa866746adfacd1cb42d867d68e6a5b0d9"
dependencies = [
"dotenvy",
"either",
"heck 0.4.0",
"heck",
"hex",
"once_cell",
"proc-macro2 1.0.50",
@@ -4227,7 +4109,8 @@ dependencies = [
"http",
"hyper",
"hyper-ws-listener",
"imbl 2.0.0",
"imbl",
"imbl-value",
"include_dir",
"indexmap",
"ipnet",
@@ -4269,7 +4152,7 @@ dependencies = [
"scopeguard",
"serde",
"serde_json",
"serde_with 2.2.0",
"serde_with",
"serde_yaml 0.9.16",
"sha2 0.10.6",
"sha2 0.9.9",
@@ -4289,9 +4172,9 @@ dependencies = [
"toml",
"torut",
"tracing",
"tracing-error 0.2.0",
"tracing-error",
"tracing-futures",
"tracing-subscriber 0.3.16",
"tracing-subscriber",
"trust-dns-server",
"typed-builder",
"url",
@@ -4742,16 +4625,6 @@ dependencies = [
"valuable",
]
[[package]]
name = "tracing-error"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4d7c0b83d4a500748fa5879461652b361edf5c9d51ede2a2ac03875ca185e24"
dependencies = [
"tracing",
"tracing-subscriber 0.2.25",
]
[[package]]
name = "tracing-error"
version = "0.2.0"
@@ -4759,7 +4632,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e"
dependencies = [
"tracing",
"tracing-subscriber 0.3.16",
"tracing-subscriber",
]
[[package]]
@@ -4783,17 +4656,6 @@ dependencies = [
"tracing-core",
]
[[package]]
name = "tracing-subscriber"
version = "0.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71"
dependencies = [
"sharded-slab",
"thread_local",
"tracing-core",
]
[[package]]
name = "tracing-subscriber"
version = "0.3.16"
@@ -5178,6 +5040,19 @@ version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
[[package]]
name = "wasm-streams"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4609d447824375f43e1ffbc051b50ad8f4b3ae8219680c94452ea05eb240ac7"
dependencies = [
"futures-util",
"js-sys",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]]
name = "web-sys"
version = "0.3.60"
@@ -5254,13 +5129,13 @@ version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
"windows_aarch64_gnullvm 0.42.1",
"windows_aarch64_msvc 0.42.1",
"windows_i686_gnu 0.42.1",
"windows_i686_msvc 0.42.1",
"windows_x86_64_gnu 0.42.1",
"windows_x86_64_gnullvm 0.42.1",
"windows_x86_64_msvc 0.42.1",
]
[[package]]
@@ -5269,7 +5144,16 @@ version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets",
"windows-targets 0.42.1",
]
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.5",
]
[[package]]
@@ -5278,13 +5162,28 @@ version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
"windows_aarch64_gnullvm 0.42.1",
"windows_aarch64_msvc 0.42.1",
"windows_i686_gnu 0.42.1",
"windows_i686_msvc 0.42.1",
"windows_x86_64_gnu 0.42.1",
"windows_x86_64_gnullvm 0.42.1",
"windows_x86_64_msvc 0.42.1",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
]
[[package]]
@@ -5293,36 +5192,72 @@ version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_i686_gnu"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.1"
@@ -5330,12 +5265,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "winreg"
version = "0.10.1"
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "winreg"
version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [
"winapi",
"cfg-if",
"windows-sys 0.48.0",
]
[[package]]
@@ -5388,6 +5330,18 @@ dependencies = [
"linked-hash-map",
]
[[package]]
name = "yasi"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f355ab62ebe30b758c1f4ab096a306722c4b7dbfb9d8c07d18c70d71a945588"
dependencies = [
"ahash 0.8.3",
"hashbrown 0.13.2",
"lazy_static",
"serde",
]
[[package]]
name = "zeroize"
version = "1.5.7"

View File

@@ -17,6 +17,7 @@ emver = { version = "0.1.7", git = "https://github.com/Start9Labs/emver-rs.git",
] }
failure = "0.1.8"
indexmap = { version = "1.6.2", features = ["serde"] }
imbl-value = { git = "https://github.com/Start9Labs/imbl-value.git" }
itertools = "0.10.0"
lazy_static = "1.4"
linear-map = { version = "1.2", features = ["serde_impl"] }

View File

@@ -79,7 +79,7 @@ pub fn validate_dependency_configuration(
if let Some(config) = config {
cfgs.insert(name, Cow::Borrowed(&config))
} else {
cfgs.insert(name, Cow::Owned(serde_json::Map::new()))
cfgs.insert(name, Cow::Owned(imbl_value::InOMap::new()))
};
let rule_check = rules
.into_iter()
@@ -104,7 +104,7 @@ pub fn apply_dependency_configuration(
cfgs.insert(dependency_id, Cow::Owned(dep_config.clone()));
match config {
Some(config) => cfgs.insert(package_id, Cow::Owned(config.clone())),
None => cfgs.insert(package_id, Cow::Owned(serde_json::Map::new())),
None => cfgs.insert(package_id, Cow::Owned(imbl_value::InOMap::new())),
};
let rule_check = rules
.into_iter()

View File

@@ -1,11 +1,11 @@
use std::borrow::Cow;
use std::sync::Arc;
use imbl_value::{InternedString, Value};
use linear_map::LinearMap;
use pest::iterators::Pairs;
use pest::Parser;
use rand::SeedableRng;
use serde_json::Value;
use startos::config::util::STATIC_NULL;
use startos::config::Config;
@@ -382,7 +382,7 @@ fn compile_var_rec(mut ident: Pairs<Rule>) -> Option<Accessor> {
match idx.as_rule() {
Rule::list_access_function_first => {
let mut pred_iter = idx.into_inner();
let item_var = pred_iter.next().unwrap().as_str().to_owned();
let item_var: InternedString = pred_iter.next().unwrap().as_str().into();
let predicate = compile_bool_expr(pred_iter.next().unwrap().into_inner());
Box::new(move |v, cfgs| match v {
Value::Array(l) => VarRes::Exactly(
@@ -411,7 +411,7 @@ fn compile_var_rec(mut ident: Pairs<Rule>) -> Option<Accessor> {
}
Rule::list_access_function_last => {
let mut pred_iter = idx.into_inner();
let item_var = pred_iter.next().unwrap().as_str().to_owned();
let item_var: InternedString = pred_iter.next().unwrap().as_str().into();
let predicate = compile_bool_expr(pred_iter.next().unwrap().into_inner());
Box::new(move |v, cfgs| match v {
Value::Array(l) => VarRes::Exactly(
@@ -440,7 +440,7 @@ fn compile_var_rec(mut ident: Pairs<Rule>) -> Option<Accessor> {
}
Rule::list_access_function_any => {
let mut pred_iter = idx.into_inner();
let item_var = pred_iter.next().unwrap().as_str().to_owned();
let item_var: InternedString = pred_iter.next().unwrap().as_str().into();
let predicate = compile_bool_expr(pred_iter.next().unwrap().into_inner());
Box::new(move |v, cfgs| match v {
Value::Array(l) => VarRes::Any(
@@ -469,7 +469,7 @@ fn compile_var_rec(mut ident: Pairs<Rule>) -> Option<Accessor> {
}
Rule::list_access_function_all => {
let mut pred_iter = idx.into_inner();
let item_var = pred_iter.next().unwrap().as_str().to_owned();
let item_var: InternedString = pred_iter.next().unwrap().as_str().into();
let predicate = compile_bool_expr(pred_iter.next().unwrap().into_inner());
Box::new(move |v, cfgs| match v {
Value::Array(l) => VarRes::All(
@@ -506,7 +506,7 @@ fn compile_var_rec(mut ident: Pairs<Rule>) -> Option<Accessor> {
let idx = idx.as_str().to_owned();
Box::new(move |v, _| match v {
Value::Object(o) => {
VarRes::Exactly(o.get(&idx).unwrap_or(&STATIC_NULL))
VarRes::Exactly(o.get(&*idx).unwrap_or(&STATIC_NULL))
}
_ => VarRes::Exactly(&STATIC_NULL),
})
@@ -514,8 +514,9 @@ fn compile_var_rec(mut ident: Pairs<Rule>) -> Option<Accessor> {
Rule::sub_ident_regular_expr => {
let idx = compile_str_expr(idx.into_inner().next().unwrap().into_inner());
Box::new(move |v, dep_cfg| match v {
Value::Object(o) => idx(&Config::default(), dep_cfg)
.map(|idx| idx.and_then(|idx| o.get(&idx)).unwrap_or(&STATIC_NULL)),
Value::Object(o) => idx(&Config::default(), dep_cfg).map(|idx| {
idx.and_then(|idx| o.get(&*idx)).unwrap_or(&STATIC_NULL)
}),
_ => VarRes::Exactly(&STATIC_NULL),
})
}
@@ -575,7 +576,7 @@ fn compile_var(mut var: Pairs<Rule>) -> CompiledExpr<VarRes<Value>> {
return VarRes::Exactly(Value::Null);
};
}
let val = cfg.get(&first_seg_string).unwrap_or(&STATIC_NULL);
let val = cfg.get(&*first_seg_string).unwrap_or(&STATIC_NULL);
if let Some(accessor) = &accessor {
accessor(val, cfgs).map(|v| v.clone())
} else {
@@ -593,7 +594,7 @@ fn compile_var_mut_rec(mut ident: Pairs<Rule>) -> Result<Option<AccessorMut>, fa
match idx.as_rule() {
Rule::list_access_function_first => {
let mut pred_iter = idx.into_inner();
let item_var = pred_iter.next().unwrap().as_str().to_owned();
let item_var: InternedString = pred_iter.next().unwrap().as_str().into();
let predicate = compile_bool_expr(pred_iter.next().unwrap().into_inner());
Box::new(move |v, cfgs| match v {
Value::Array(l) => l
@@ -618,7 +619,7 @@ fn compile_var_mut_rec(mut ident: Pairs<Rule>) -> Result<Option<AccessorMut>, fa
}
Rule::list_access_function_last => {
let mut pred_iter = idx.into_inner();
let item_var = pred_iter.next().unwrap().as_str().to_owned();
let item_var: InternedString = pred_iter.next().unwrap().as_str().into();
let predicate = compile_bool_expr(pred_iter.next().unwrap().into_inner());
Box::new(move |v, cfgs| match v {
Value::Array(l) => l
@@ -651,14 +652,14 @@ fn compile_var_mut_rec(mut ident: Pairs<Rule>) -> Result<Option<AccessorMut>, fa
let idx = idx.into_inner().next().unwrap();
match idx.as_rule() {
Rule::sub_ident_regular_base => {
let idx = idx.as_str().to_owned();
let idx: InternedString = idx.as_str().into();
Box::new(move |v, _| match v {
Value::Object(ref mut o) => {
if o.contains_key(&idx) {
o.get_mut(&idx)
if o.contains_key(&*idx) {
o.get_mut(&*idx)
} else {
o.insert(idx.clone(), Value::Null);
o.get_mut(&idx)
o.get_mut(&*idx)
}
}
_ => None,
@@ -669,11 +670,11 @@ fn compile_var_mut_rec(mut ident: Pairs<Rule>) -> Result<Option<AccessorMut>, fa
Box::new(
move |v, dep_cfg| match (v, idx(&Config::default(), dep_cfg)) {
(Value::Object(ref mut o), VarRes::Exactly(Some(ref idx))) => {
if o.contains_key(idx) {
o.get_mut(idx)
if o.contains_key(&**idx) {
o.get_mut(&**idx)
} else {
o.insert(idx.clone(), Value::Null);
o.get_mut(idx)
o.get_mut(&**idx)
}
}
_ => None,
@@ -693,7 +694,7 @@ fn compile_var_mut_rec(mut ident: Pairs<Rule>) -> Result<Option<AccessorMut>, fa
if l.len() > idx {
l.get_mut(idx)
} else if idx == l.len() {
l.push(Value::Null);
l.push_back(Value::Null);
l.get_mut(idx)
} else {
None
@@ -711,7 +712,7 @@ fn compile_var_mut_rec(mut ident: Pairs<Rule>) -> Result<Option<AccessorMut>, fa
if l.len() > idx {
l.get_mut(idx)
} else if idx == l.len() {
l.push(Value::Null);
l.push_back(Value::Null);
l.get_mut(idx)
} else {
None
@@ -741,11 +742,11 @@ fn compile_var_mut(mut var: Pairs<Rule>) -> Result<CompiledReference, failure::E
if first_seg.as_rule() == Rule::app_id {
failure::bail!("Can only assign to relative path");
}
let first_seg_string = first_seg.as_str().to_owned();
let first_seg_string: InternedString = first_seg.as_str().into();
let accessor_mut = compile_var_mut_rec(var)?;
Ok(Box::new(move |cfg, cfgs| {
let var = if cfg.contains_key(&first_seg_string) {
cfg.get_mut(&first_seg_string).unwrap()
let var = if cfg.contains_key(&*first_seg_string) {
cfg.get_mut(&*first_seg_string).unwrap()
} else {
cfg.insert(first_seg_string.clone(), Value::Null);
cfg.get_mut(&first_seg_string).unwrap()
@@ -865,19 +866,19 @@ fn compile_num_cmp_expr(mut pairs: Pairs<Rule>) -> CompiledRule {
}
}
fn compile_str_var(var: Pairs<Rule>) -> CompiledExpr<VarRes<Option<String>>> {
fn compile_str_var(var: Pairs<Rule>) -> CompiledExpr<VarRes<Option<InternedString>>> {
let var = compile_var(var);
Box::new(move |cfg, cfgs| {
var(cfg, cfgs).map(|a| match a {
Value::String(s) => Some(s),
Value::Number(n) => Some(format!("{}", n)),
Value::Bool(b) => Some(format!("{}", b)),
Value::String(s) => Some(InternedString::from(&*s)),
Value::Number(n) => Some(InternedString::from_display(&n)),
Value::Bool(b) => Some(InternedString::from_display(&b)),
_ => None,
})
})
}
fn compile_str(str_str: &str) -> CompiledExpr<VarRes<Option<String>>> {
fn compile_str(str_str: &str) -> CompiledExpr<VarRes<Option<InternedString>>> {
let str_str = &str_str[1..str_str.len() - 1];
let mut out = String::with_capacity(str_str.len());
let mut escape = false;
@@ -904,11 +905,11 @@ fn compile_str(str_str: &str) -> CompiledExpr<VarRes<Option<String>>> {
}
}
}
let res = VarRes::Exactly(Some(out));
let res = VarRes::Exactly(Some(out.into()));
Box::new(move |_, _| res.clone())
}
fn compile_str_expr(pairs: Pairs<Rule>) -> CompiledExpr<VarRes<Option<String>>> {
fn compile_str_expr(pairs: Pairs<Rule>) -> CompiledExpr<VarRes<Option<InternedString>>> {
STR_PREC_CLIMBER.climb(
pairs,
|pair| match pair.as_rule() {
@@ -921,9 +922,9 @@ fn compile_str_expr(pairs: Pairs<Rule>) -> CompiledExpr<VarRes<Option<String>>>
Rule::add => Box::new(move |cfg, cfgs| {
lhs(cfg, cfgs).and_then(|lhs| {
rhs(cfg, cfgs).map(|rhs| {
let lhs = lhs.clone()?;
let lhs = lhs.as_ref()?.to_string();
let rhs = rhs?;
Some(lhs + &rhs)
Some(InternedString::from(lhs + &*rhs))
})
})
}),
@@ -941,7 +942,7 @@ fn compile_str_cmp_expr(mut pairs: Pairs<Rule>) -> CompiledRule {
lhs(cfg, cfgs)
.and_then(|lhs| {
rhs(cfg, cfgs).map(|rhs| match (&lhs, &rhs) {
(Some(lhs), Some(rhs)) => rhs.contains(lhs) && lhs.len() < rhs.len(),
(Some(lhs), Some(rhs)) => rhs.contains(&**lhs) && lhs.len() < rhs.len(),
_ => false,
})
})
@@ -951,7 +952,7 @@ fn compile_str_cmp_expr(mut pairs: Pairs<Rule>) -> CompiledRule {
lhs(cfg, cfgs)
.and_then(|lhs| {
rhs(cfg, cfgs).map(|rhs| match (&lhs, &rhs) {
(Some(lhs), Some(rhs)) => rhs.contains(lhs),
(Some(lhs), Some(rhs)) => rhs.contains(&**lhs),
_ => false,
})
})
@@ -983,7 +984,7 @@ fn compile_str_cmp_expr(mut pairs: Pairs<Rule>) -> CompiledRule {
lhs(cfg, cfgs)
.and_then(|lhs| {
rhs(cfg, cfgs).map(|rhs| match (&lhs, &rhs) {
(Some(lhs), Some(rhs)) => lhs.contains(rhs) && lhs.len() > rhs.len(),
(Some(lhs), Some(rhs)) => lhs.contains(&**rhs) && lhs.len() > rhs.len(),
_ => true,
})
})
@@ -993,7 +994,7 @@ fn compile_str_cmp_expr(mut pairs: Pairs<Rule>) -> CompiledRule {
lhs(cfg, cfgs)
.and_then(|lhs| {
rhs(cfg, cfgs).map(|rhs| match (&lhs, &rhs) {
(Some(lhs), Some(rhs)) => lhs.contains(rhs),
(Some(lhs), Some(rhs)) => lhs.contains(&**rhs),
_ => true,
})
})
@@ -1037,7 +1038,10 @@ fn compile_value_expr(mut pairs: Pairs<Rule>) -> CompiledExpr<VarRes<Value>> {
Rule::str_expr => {
let expr = compile_str_expr(expr.into_inner());
Box::new(move |cfg, cfgs| {
expr(cfg, cfgs).map(|s| s.map(Value::String).unwrap_or(Value::Null))
expr(cfg, cfgs).map(|s| {
s.map(|s| Value::String(Arc::new(s.to_string())))
.unwrap_or(Value::Null)
})
})
}
Rule::num_expr => {
@@ -1059,7 +1063,7 @@ fn compile_value_expr(mut pairs: Pairs<Rule>) -> CompiledExpr<VarRes<Value>> {
fn compile_del_action(mut pairs: Pairs<Rule>) -> Result<Mutator, failure::Error> {
let list_mut = compile_var_mut(pairs.next().unwrap().into_inner())?;
let var = pairs.next().unwrap().as_str().to_owned();
let var: InternedString = pairs.next().unwrap().as_str().into();
let predicate = compile_bool_expr(pairs.next().unwrap().into_inner());
Ok(Box::new(move |cfg, cfgs| match (&list_mut)(cfg, cfgs) {
Some(Value::Array(ref mut l)) => {
@@ -1093,7 +1097,7 @@ fn compile_push_action(mut pairs: Pairs<Rule>, value: Value) -> Result<Mutator,
Some(Value::Array(ref mut a)) => a,
_ => return,
};
vec.push(value.clone())
vec.push_back(value.clone())
}))
}
@@ -1122,7 +1126,9 @@ fn compile_set_action(var: &str, to: &SetVariant) -> Result<Mutator, failure::Er
let entropy = entropy.clone();
Box::new(move |cfg, cfgs| {
if let Some(var) = get_mut(cfg, cfgs) {
*var = Value::String(entropy.gen(&mut rand::rngs::StdRng::from_entropy()));
*var = Value::String(Arc::new(
entropy.gen(&mut rand::rngs::StdRng::from_entropy()),
));
}
})
}