Update dependencies.

This commit is contained in:
Orne Brocaar 2023-02-06 12:23:44 +00:00
parent 38e79563ca
commit 5953542a72
22 changed files with 926 additions and 786 deletions

1028
Cargo.lock generated

File diff suppressed because it is too large Load Diff

46
api/js/README.md vendored
View File

@ -18,48 +18,6 @@ yarn add @chirpstack/chirpstack-api
## Usage
All messages, services, constants, etc. are auto-generated from the ChirpStack protobuf definitions. The result is that
this package structure matches that of the protobuf definitions. There is no ES6 index gathering all of the exports, so
full import/require paths should be used. The generated code is all callback based, but can be promisified.
The protobuf definitions can be found here: https://github.com/brocaar/chirpstack-api/tree/master/protobuf
The generated code all depends on the `grpc` package, and for most use cases you will probably need to make use of the
`grpc` package directly as well. This is seen in the example below.
### Example
This example shows how to log in to ChirpStack via the gRPC API and then create a gRPC metadata object containing the
JWT. This metadata could then be passed to any future requests that require authorization.
```javascript
import * as grpc from '@grpc/grpc-js';
import * as internalService from '@chirpstack/chirpstack-api/as/external/api/internal_grpc_pb';
import * as internalMessages from '@chirpstack/chirpstack-api/as/external/api/internal_pb';
// Create the client for the 'internal' service
const internalServiceClient = new internalService.InternalServiceClient(
'localhost:8080',
grpc.credentials.createInsecure()
);
// Create and build the login request message
const loginRequest = new internalMessages.LoginRequest();
loginRequest.setEmail('email');
loginRequest.setPassword('password');
// Send the login request
internalServiceClient.login(loginRequest, (error, response) => {
// Build a gRPC metadata object, setting the authorization key to the JWT we
// got back from logging in.
const metadata = new grpc.Metadata();
metadata.set('authorization', response.getJwt());
// This metadata can now be passed for requests to APIs that require authorization
// e.g.
// deviceServiceClient.create(createDeviceRequest, metadata, callback);
});
```
Please refer to [https://www.chirpstack.io/chirpstack/api/js-examples.html](https://www.chirpstack.io/chirpstack/api/js-examples.html)
for code examples.

302
api/rust/Cargo.lock generated vendored
View File

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "anyhow"
version = "1.0.65"
version = "1.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602"
checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
[[package]]
name = "async-stream"
@ -31,9 +31,9 @@ dependencies = [
[[package]]
name = "async-trait"
version = "0.1.57"
version = "0.1.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f"
checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2"
dependencies = [
"proc-macro2",
"quote",
@ -48,9 +48,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "axum"
version = "0.5.16"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9e3356844c4d6a6d6467b8da2cffb4a2820be256f50a3a386c9d152bab31043"
checksum = "e5694b64066a2459918d8074c2ce0d5a88f409431994c2356617c8ae0c4721fc"
dependencies = [
"async-trait",
"axum-core",
@ -66,9 +66,9 @@ dependencies = [
"mime",
"percent-encoding",
"pin-project-lite",
"rustversion",
"serde",
"sync_wrapper",
"tokio",
"tower",
"tower-http",
"tower-layer",
@ -77,9 +77,9 @@ dependencies = [
[[package]]
name = "axum-core"
version = "0.2.8"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9f0c0a60006f2a293d82d571f635042a72edf927539b7685bd62d361963839b"
checksum = "1cae3e661676ffbacb30f1a824089a8c9150e71017f7e1e38f2aa32009188d34"
dependencies = [
"async-trait",
"bytes",
@ -87,15 +87,16 @@ dependencies = [
"http",
"http-body",
"mime",
"rustversion",
"tower-layer",
"tower-service",
]
[[package]]
name = "base64"
version = "0.13.0"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "bitflags"
@ -105,9 +106,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bytes"
version = "1.2.1"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
[[package]]
name = "cfg-if"
@ -134,9 +135,9 @@ dependencies = [
[[package]]
name = "chrono"
version = "0.4.22"
version = "0.4.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
dependencies = [
"num-integer",
"num-traits",
@ -144,9 +145,9 @@ dependencies = [
[[package]]
name = "either"
version = "1.8.0"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
[[package]]
name = "fastrand"
@ -171,36 +172,36 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "futures-channel"
version = "0.3.24"
version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050"
checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5"
dependencies = [
"futures-core",
]
[[package]]
name = "futures-core"
version = "0.3.24"
version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf"
checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608"
[[package]]
name = "futures-sink"
version = "0.3.24"
version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56"
checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364"
[[package]]
name = "futures-task"
version = "0.3.24"
version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1"
checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366"
[[package]]
name = "futures-util"
version = "0.3.24"
version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90"
checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1"
dependencies = [
"futures-core",
"futures-task",
@ -210,9 +211,9 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.2.7"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
dependencies = [
"cfg-if",
"libc",
@ -221,9 +222,9 @@ dependencies = [
[[package]]
name = "h2"
version = "0.3.14"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be"
checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4"
dependencies = [
"bytes",
"fnv",
@ -298,9 +299,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]]
name = "hyper"
version = "0.14.20"
version = "0.14.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac"
checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c"
dependencies = [
"bytes",
"futures-channel",
@ -334,9 +335,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "1.9.1"
version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
dependencies = [
"autocfg",
"hashbrown",
@ -362,9 +363,9 @@ dependencies = [
[[package]]
name = "itoa"
version = "1.0.3"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
[[package]]
name = "lazy_static"
@ -374,9 +375,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.133"
version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "log"
@ -389,9 +390,9 @@ dependencies = [
[[package]]
name = "matchit"
version = "0.5.0"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb"
checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40"
[[package]]
name = "memchr"
@ -407,14 +408,14 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
[[package]]
name = "mio"
version = "0.8.4"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"
dependencies = [
"libc",
"log",
"wasi",
"windows-sys 0.36.1",
"windows-sys",
]
[[package]]
@ -444,15 +445,15 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.15.0"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
[[package]]
name = "pbjson"
version = "0.5.0"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f06d6c64fa91b40a9321e174ad4e9702038c90210f87b295b4f723c7ad2155a"
checksum = "048f9ac93c1eab514f9470c4bc8d97ca2a0a236b84f45cc19d69a59fc11467f6"
dependencies = [
"base64",
"serde",
@ -460,9 +461,9 @@ dependencies = [
[[package]]
name = "pbjson-build"
version = "0.5.0"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "780b05debc7ed9a64c4ba63309c39a329368aa54a6894686c3a91608a18f9bb2"
checksum = "bdbb7b706f2afc610f3853550cdbbf6372fd324824a087806bd4480ea4996e24"
dependencies = [
"heck",
"itertools",
@ -472,9 +473,9 @@ dependencies = [
[[package]]
name = "pbjson-types"
version = "0.5.0"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aa68b479d28fc76e96b1973cb307c177607bbd975e7cd9101605d56cf09f22d"
checksum = "4a88c8d87f99a4ac14325e7a4c24af190fca261956e3b82dd7ed67e77e6c7043"
dependencies = [
"bytes",
"chrono",
@ -535,15 +536,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "ppv-lite86"
version = "0.2.16"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "prettyplease"
version = "0.1.19"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a49e86d2c26a24059894a3afa13fd17d063419b05dfb83f06d9c3566060c3f5a"
checksum = "e97e3215779627f01ee256d2fad52f3d95e8e1c11e9fc6fd08f7cd455d5d5c78"
dependencies = [
"proc-macro2",
"syn",
@ -551,18 +552,18 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.44"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bd7356a8122b6c4a24a82b278680c73357984ca2fc79a0f9fa6dea7dced7c58"
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
dependencies = [
"unicode-ident",
]
[[package]]
name = "prost"
version = "0.11.0"
version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "399c3c31cdec40583bb68f0b18403400d01ec4289c383aa047560439952c4dd7"
checksum = "21dc42e00223fc37204bd4aa177e69420c604ca4a183209a8f9de30c6d934698"
dependencies = [
"bytes",
"prost-derive",
@ -570,9 +571,9 @@ dependencies = [
[[package]]
name = "prost-build"
version = "0.11.1"
version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f835c582e6bd972ba8347313300219fed5bfa52caf175298d860b61ff6069bb"
checksum = "a3f8ad728fb08fe212df3c05169e940fbb6d9d16a877ddde14644a983ba2012e"
dependencies = [
"bytes",
"heck",
@ -581,18 +582,20 @@ dependencies = [
"log",
"multimap",
"petgraph",
"prettyplease",
"prost",
"prost-types",
"regex",
"syn",
"tempfile",
"which",
]
[[package]]
name = "prost-derive"
version = "0.11.0"
version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7345d5f0e08c0536d7ac7229952590239e77abf0a0100a1b1d890add6ea96364"
checksum = "8bda8c0881ea9f722eb9629376db3d0b903b462477c1aafcb0566610ac28ac5d"
dependencies = [
"anyhow",
"itertools",
@ -603,9 +606,9 @@ dependencies = [
[[package]]
name = "prost-types"
version = "0.11.1"
version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dfaa718ad76a44b3415e6c4d53b17c8f99160dcb3a99b10470fce8ad43f6e3e"
checksum = "a5e0526209433e96d83d750dd81a99118edbc55739e7e61a46764fd2ad537788"
dependencies = [
"bytes",
"prost",
@ -613,9 +616,9 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.21"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
dependencies = [
"proc-macro2",
]
@ -661,18 +664,18 @@ dependencies = [
[[package]]
name = "regex"
version = "1.6.0"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.27"
version = "0.6.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
[[package]]
name = "remove_dir_all"
@ -684,19 +687,25 @@ dependencies = [
]
[[package]]
name = "serde"
version = "1.0.145"
name = "rustversion"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b"
checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70"
[[package]]
name = "serde"
version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.145"
version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c"
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
dependencies = [
"proc-macro2",
"quote",
@ -724,9 +733,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.100"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52205623b1b0f064a4e71182c3b18ae902267282930c6d5462c91b859668426e"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
dependencies = [
"proc-macro2",
"quote",
@ -755,9 +764,9 @@ dependencies = [
[[package]]
name = "tokio"
version = "1.24.2"
version = "1.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb"
checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"
dependencies = [
"autocfg",
"bytes",
@ -767,7 +776,7 @@ dependencies = [
"pin-project-lite",
"socket2",
"tokio-macros",
"windows-sys 0.42.0",
"windows-sys",
]
[[package]]
@ -782,9 +791,9 @@ dependencies = [
[[package]]
name = "tokio-macros"
version = "1.8.0"
version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484"
checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
dependencies = [
"proc-macro2",
"quote",
@ -793,9 +802,9 @@ dependencies = [
[[package]]
name = "tokio-stream"
version = "0.1.10"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6edf2d6bc038a43d31353570e27270603f4648d18f5ed10c0e179abe43255af"
checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce"
dependencies = [
"futures-core",
"pin-project-lite",
@ -818,9 +827,9 @@ dependencies = [
[[package]]
name = "tonic"
version = "0.8.1"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11cd56bdb54ef93935a6a79dbd1d91f1ebd4c64150fd61654031fd6b8b775c91"
checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb"
dependencies = [
"async-stream",
"async-trait",
@ -850,9 +859,9 @@ dependencies = [
[[package]]
name = "tonic-build"
version = "0.8.0"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fbcd2800e34e743b9ae795867d5f77b535d3a3be69fd731e39145719752df8c"
checksum = "5bf5e9b9c0f7e0a7c027dcfaba7b2c60816c7049171f679d99ee2ff65d0de8c4"
dependencies = [
"prettyplease",
"proc-macro2",
@ -883,9 +892,9 @@ dependencies = [
[[package]]
name = "tower-http"
version = "0.3.4"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c530c8675c1dbf98facee631536fa116b5fb6382d7dd6dc1b118d970eafe3ba"
checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858"
dependencies = [
"bitflags",
"bytes",
@ -902,9 +911,9 @@ dependencies = [
[[package]]
name = "tower-layer"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62"
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
[[package]]
name = "tower-service"
@ -914,9 +923,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
[[package]]
name = "tracing"
version = "0.1.36"
version = "0.1.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
dependencies = [
"cfg-if",
"log",
@ -927,9 +936,9 @@ dependencies = [
[[package]]
name = "tracing-attributes"
version = "0.1.22"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2"
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
dependencies = [
"proc-macro2",
"quote",
@ -938,9 +947,9 @@ dependencies = [
[[package]]
name = "tracing-core"
version = "0.1.29"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7"
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
dependencies = [
"once_cell",
]
@ -957,15 +966,15 @@ dependencies = [
[[package]]
name = "try-lock"
version = "0.2.3"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
[[package]]
name = "unicode-ident"
version = "1.0.4"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]]
name = "want"
@ -985,9 +994,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "which"
version = "4.3.0"
version = "4.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b"
checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269"
dependencies = [
"either",
"libc",
@ -1016,19 +1025,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
dependencies = [
"windows_aarch64_msvc 0.36.1",
"windows_i686_gnu 0.36.1",
"windows_i686_msvc 0.36.1",
"windows_x86_64_gnu 0.36.1",
"windows_x86_64_msvc 0.36.1",
]
[[package]]
name = "windows-sys"
version = "0.42.0"
@ -1036,82 +1032,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.42.0",
"windows_i686_gnu 0.42.0",
"windows_i686_msvc 0.42.0",
"windows_x86_64_gnu 0.42.0",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.42.0",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.0"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
[[package]]
name = "windows_aarch64_msvc"
version = "0.36.1"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
[[package]]
name = "windows_i686_gnu"
version = "0.36.1"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
[[package]]
name = "windows_i686_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
[[package]]
name = "windows_i686_msvc"
version = "0.36.1"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
[[package]]
name = "windows_i686_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
[[package]]
name = "windows_x86_64_gnu"
version = "0.36.1"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.0"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
[[package]]
name = "windows_x86_64_msvc"
version = "0.36.1"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"

2
api/rust/Cargo.toml vendored
View File

@ -22,7 +22,7 @@ hex = "0.4"
rand = "0.8"
tonic = { version = "0.8", features = ["codegen", "prost"], default-features = false }
tokio = { version = "1.24", features = ["macros"], optional = true }
tokio = { version = "1.25", features = ["macros"], optional = true }
serde = { version = "1.0" }
[build-dependencies]

View File

@ -16,7 +16,7 @@ rand = "0.8"
aes-kw = "0.2"
reqwest = { version = "0.11", features = ["json", "rustls-tls"], default-features = false }
chrono = { version = "0.4", features = ["serde"] }
tokio = { version = "1.24", features = ["macros" ] }
tokio = { version = "1.25", features = ["macros" ] }
# Development and testing
[dev-dependencies]

View File

@ -11,20 +11,20 @@ license = "MIT"
[dependencies]
# CLI interface
clap = { version = "4.0", features = ["derive"] }
clap = { version = "4.1", features = ["derive"] }
# Configuration
serde = { version = "1.0", features = ["derive", "rc"] }
serde_yaml = "0.9"
serde_json = "1.0"
humantime-serde = "1.1"
toml = "0.5"
toml = "0.7"
handlebars = "4.3"
# Database
validator = "0.16"
diesel = { version = "2.0.2", features = [ "chrono", "postgres", "r2d2", "uuid", "serde_json", "numeric" ] }
diesel_migrations = { version = "2.0.0" }
diesel = { version = "2.0", features = [ "chrono", "postgres", "r2d2", "uuid", "serde_json", "numeric" ] }
diesel_migrations = { version = "2.0" }
r2d2 = "0.8"
bigdecimal = "0.3"
redis = { version = "0.22", features = ["r2d2", "cluster"] }
@ -49,18 +49,18 @@ aws-sdk-sns = "0.19"
hmac = "0.12"
sha2 = "0.10"
urlencoding = "2.1"
geohash = "0.12"
geohash = "0.13"
gcp_auth = "0.7"
lapin = "2.1"
tokio-executor-trait = "2.1"
tokio-reactor-trait = "1.1"
rdkafka = { version = "0.28", features = ["cmake-build"]}
rdkafka = { version = "0.29", features = ["cmake-build"]}
# gRPC and Protobuf
tonic = "0.8"
tonic-web = "0.5"
tonic-reflection = "0.5"
tokio = { version = "1.24", features = ["macros", "rt-multi-thread"] }
tonic-reflection = "0.6"
tokio = { version = "1.25", features = ["macros", "rt-multi-thread"] }
tokio-stream = "0.1"
prost-types = "0.11"
prost = "0.11"
@ -84,7 +84,7 @@ anyhow = "1.0"
# Authentication
pbkdf2 = "0.11"
rand_core = { version = "0.6", features = ["std"] }
jsonwebtoken = "8.1"
jsonwebtoken = "8.2"
openssl = { version = "0.10", features = ["vendored"] }
openidconnect = { version = "2.5", features = ["accept-rfc3339-timestamps"] }
@ -97,22 +97,22 @@ rquickjs = { version = "0.1", features = ["bindgen", "loader", "array-buffer", "
# Misc
lazy_static = "1.4"
uuid = { version = "1.1", features = [ "v4", "serde" ] }
uuid = { version = "1.3", features = [ "v4", "serde" ] }
chrono = "0.4"
async-trait = "0.1"
aes = "0.8"
rand = "0.8"
base64 = "0.13"
base64 = "0.21"
async-recursion = "1.0"
regex = "1.6"
regex = "1.7"
petgraph = "0.6"
prometheus-client = "0.18"
prometheus-client = "0.19"
pin-project = "1.0"
# Development and testing
[dev-dependencies]
httpmock = "0.6"
bytes = "1.2"
bytes = "1.4"
# Debian packaging.
[package.metadata.deb]

View File

@ -824,8 +824,8 @@ pub mod test {
name: "Received".to_string(),
timestamps: vec![{
let ts = Local
.ymd(now.year(), now.month(), now.day())
.and_hms(0, 0, 0);
.with_ymd_and_hms(now.year(), now.month(), now.day(), 0, 0, 0)
.unwrap();
//let ts: SystemTime = ts.into();
let ts: DateTime<Utc> = ts.into();
ts.into()

View File

@ -10,7 +10,7 @@ use anyhow::Result;
use futures::future::{self, Either, TryFutureExt};
use hyper::{service::make_service_fn, Server};
use pin_project::pin_project;
use prometheus_client::encoding::text::Encode;
use prometheus_client::encoding::EncodeLabelSet;
use prometheus_client::metrics::counter::Counter;
use prometheus_client::metrics::family::Family;
use prometheus_client::metrics::histogram::Histogram;
@ -63,7 +63,7 @@ lazy_static! {
prometheus::register(
"api_requests_handled",
"Number of API requests handled by service, method and status code",
Box::new(counter.clone()),
counter.clone(),
);
counter
};
@ -79,7 +79,7 @@ lazy_static! {
prometheus::register(
"api_requests_handled_seconds",
"Duration of API requests handled by service, method and status code",
Box::new(histogram.clone()),
histogram.clone(),
);
histogram
};
@ -301,7 +301,7 @@ impl<B> tower_http::trace::OnResponse<B> for OnResponse {
}
}
#[derive(Clone, Hash, PartialEq, Eq, Encode)]
#[derive(Clone, Hash, PartialEq, Eq, EncodeLabelSet, Debug)]
struct GrpcLabels {
service: String,
method: String,

View File

@ -202,7 +202,7 @@ pub mod test {
#[tokio::test]
pub async fn test_decode() {
let recv_time = Utc.ymd(2014, 7, 8).and_hms(9, 10, 11);
let recv_time = Utc.with_ymd_and_hms(2014, 7, 8, 9, 10, 11).unwrap();
let decoder = r#"
function decodeUplink(input) {

View File

@ -94,7 +94,7 @@ pub mod test {
#[test]
fn test_get_beacon_start_for_time() {
let gps_epoch_time: DateTime<Utc> = Utc.ymd(1980, 1, 6).and_hms(0, 0, 0);
let gps_epoch_time: DateTime<Utc> = Utc.with_ymd_and_hms(1980, 1, 6, 0, 0, 0).unwrap();
// For GPS epoch time
let start_ts = get_beacon_start_for_time(gps_epoch_time);

View File

@ -11,7 +11,7 @@ use async_trait::async_trait;
use futures::stream::StreamExt;
use handlebars::Handlebars;
use paho_mqtt as mqtt;
use prometheus_client::encoding::text::Encode;
use prometheus_client::encoding::EncodeLabelSet;
use prometheus_client::metrics::counter::Counter;
use prometheus_client::metrics::family::Family;
use prost::Message;
@ -28,12 +28,12 @@ use crate::storage::{get_redis_conn, redis_key};
use crate::{downlink, uplink};
use lrwn::region::CommonName;
#[derive(Clone, Hash, PartialEq, Eq, Encode)]
#[derive(Clone, Hash, PartialEq, Eq, EncodeLabelSet, Debug)]
struct EventLabels {
event: String,
}
#[derive(Clone, Hash, PartialEq, Eq, Encode)]
#[derive(Clone, Hash, PartialEq, Eq, EncodeLabelSet, Debug)]
struct CommandLabels {
command: String,
}
@ -44,7 +44,7 @@ lazy_static! {
prometheus::register(
"gateway_backend_mqtt_events",
"Number of events received",
Box::new(counter.clone()),
counter.clone(),
);
counter
};
@ -53,7 +53,7 @@ lazy_static! {
prometheus::register(
"gateway_backend_mqtt_commands",
"Number of commands sent",
Box::new(counter.clone()),
counter.clone(),
);
counter
};

View File

@ -1,78 +1,78 @@
use chrono::{DateTime, Duration, TimeZone, Utc};
lazy_static! {
static ref GPS_EPOCH_TIME: DateTime<Utc> = Utc.ymd(1980, 1, 6).and_hms(0, 0, 0);
static ref GPS_EPOCH_TIME: DateTime<Utc> = Utc.with_ymd_and_hms(1980, 1, 6, 0, 0, 0).unwrap();
static ref LEAP_SECONDS_TABLE: Vec<(DateTime<Utc>, Duration)> = vec![
(
Utc.ymd(1981, 6, 30).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1981, 6, 30, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(1982, 6, 30).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1982, 6, 30, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(1983, 6, 30).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1983, 6, 30, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(1985, 6, 30).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1985, 6, 30, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(1987, 12, 31).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1987, 12, 31, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(1989, 12, 31).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1989, 12, 31, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(1990, 12, 31).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1990, 12, 31, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(1992, 6, 30).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1992, 6, 30, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(1993, 6, 30).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1993, 6, 30, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(1994, 6, 30).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1994, 6, 30, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(1995, 12, 31).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1995, 12, 31, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(1997, 6, 30).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1997, 6, 30, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(1998, 12, 31).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(1998, 12, 31, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(2005, 12, 31).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(2005, 12, 31, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(2008, 12, 31).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(2008, 12, 31, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(2012, 6, 30).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(2012, 6, 30, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(2015, 6, 30).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(2015, 6, 30, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
(
Utc.ymd(2016, 12, 31).and_hms(23, 59, 59),
Utc.with_ymd_and_hms(2016, 12, 31, 23, 59, 59).unwrap(),
Duration::seconds(1)
),
];
@ -128,19 +128,19 @@ pub mod test {
time_since_gps_epoch: Duration::zero(),
},
Test {
time: Utc.ymd(2010, 1, 28).and_hms(16, 36, 24),
time: Utc.with_ymd_and_hms(2010, 1, 28, 16, 36, 24).unwrap(),
time_since_gps_epoch: Duration::seconds(948731799),
},
Test {
time: Utc.ymd(2025, 7, 14).and_hms(0, 0, 0),
time: Utc.with_ymd_and_hms(2025, 7, 14, 0, 0, 0).unwrap(),
time_since_gps_epoch: Duration::seconds(1436486418),
},
Test {
time: Utc.ymd(2012, 6, 30).and_hms(23, 59, 59),
time: Utc.with_ymd_and_hms(2012, 6, 30, 23, 59, 59).unwrap(),
time_since_gps_epoch: Duration::seconds(1025136014),
},
Test {
time: Utc.ymd(2012, 7, 1).and_hms(0, 0, 0),
time: Utc.with_ymd_and_hms(2012, 7, 1, 0, 0, 0).unwrap(),
time_since_gps_epoch: Duration::seconds(1025136016),
},
];

View File

@ -7,6 +7,7 @@ use aws_types::credentials::future;
use aws_types::credentials::ProvideCredentials;
use aws_types::region::Region;
use aws_types::{credentials, Credentials};
use base64::{engine::general_purpose, Engine as _};
use prost::Message;
use tracing::{info, trace};
@ -129,7 +130,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("up", &di.application_id, &di.dev_eui, &pl)
@ -144,7 +145,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("join", &di.application_id, &di.dev_eui, &pl)
@ -159,7 +160,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("ack", &di.application_id, &di.dev_eui, &pl)
@ -174,7 +175,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("txack", &di.application_id, &di.dev_eui, &pl)
@ -189,7 +190,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("log", &di.application_id, &di.dev_eui, &pl)
@ -204,7 +205,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("status", &di.application_id, &di.dev_eui, &pl)
@ -219,7 +220,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("location", &di.application_id, &di.dev_eui, &pl)
@ -234,7 +235,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("integration", &di.application_id, &di.dev_eui, &pl)

View File

@ -3,6 +3,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH};
use anyhow::Result;
use async_trait::async_trait;
use base64::{engine::general_purpose, Engine as _};
use hmac::{Hmac, Mac};
use prost::Message;
use reqwest::header::{HeaderMap, HeaderName, AUTHORIZATION, CONTENT_TYPE};
@ -112,7 +113,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("up", &di.application_id, &di.dev_eui, &pl)
@ -127,7 +128,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("join", &di.application_id, &di.dev_eui, &pl)
@ -142,7 +143,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("ack", &di.application_id, &di.dev_eui, &pl)
@ -157,7 +158,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("txack", &di.application_id, &di.dev_eui, &pl)
@ -172,7 +173,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("log", &di.application_id, &di.dev_eui, &pl)
@ -187,7 +188,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("status", &di.application_id, &di.dev_eui, &pl)
@ -202,7 +203,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("location", &di.application_id, &di.dev_eui, &pl)
@ -217,7 +218,7 @@ impl IntegrationTrait for Integration {
let di = pl.device_info.as_ref().unwrap();
let pl = match self.json {
true => serde_json::to_string(&pl)?,
false => base64::encode(pl.encode_to_vec()),
false => general_purpose::STANDARD.encode(pl.encode_to_vec()),
};
self.publish("integration", &di.application_id, &di.dev_eui, &pl)
@ -239,7 +240,7 @@ fn create_sas_token(
let sig = format!("{}\n{}", encoded_url, exp);
let mut m = HmacSha256::new_from_slice(key.as_bytes())?;
m.update(sig.as_bytes());
let result = base64::encode(m.finalize().into_bytes());
let result = general_purpose::STANDARD.encode(m.finalize().into_bytes());
let hash = urlencoding::encode(&result);

View File

@ -3,6 +3,7 @@ use std::time::Duration;
use anyhow::{Context, Result};
use async_trait::async_trait;
use base64::{engine::general_purpose, Engine as _};
use gcp_auth::{AuthenticationManager, CustomServiceAccount};
use prost::Message;
use reqwest::header::{HeaderMap, AUTHORIZATION, CONTENT_TYPE};
@ -77,7 +78,7 @@ impl Integration {
let pl = PublishRequest {
messages: vec![PubSubMessage {
data: base64::encode(pl),
data: general_purpose::STANDARD.encode(pl),
attributes: PubSubMessageAttributes {
event: event.to_string(),
dev_eui: dev_eui.to_string(),

View File

@ -389,8 +389,7 @@ fn struct_values_to_location(
(
"geohash".to_string(),
Value::String(
geohash::encode(geohash::Coordinate { x: lon, y: lat }, 12)
.unwrap_or_default(),
geohash::encode(geohash::Coord { x: lon, y: lat }, 12).unwrap_or_default(),
),
),
]

View File

@ -6,7 +6,7 @@ use async_trait::async_trait;
use handlebars::Handlebars;
use prost::Message;
use rdkafka::config::ClientConfig;
use rdkafka::message::OwnedHeaders;
use rdkafka::message::{Header, OwnedHeaders};
use rdkafka::producer::{FutureProducer, FutureRecord};
use serde::Serialize;
use tracing::{error, info};
@ -77,7 +77,10 @@ impl<'a> Integration<'a> {
.send(
FutureRecord::to(&self.topic)
.key(&event_key)
.headers(OwnedHeaders::new().add("event", event))
.headers(OwnedHeaders::new().insert(Header {
key: "event",
value: Some(event),
}))
.payload(b),
Duration::from_secs(0),
)
@ -289,8 +292,11 @@ pub mod test {
);
assert_eq!(serde_json::to_vec(&pl).unwrap(), msg.payload().unwrap());
assert_eq!(
("event", "up".as_bytes()),
msg.headers().unwrap().get(0).unwrap()
Header {
key: "event",
value: Some("up".as_bytes()),
},
msg.headers().unwrap().get(0)
);
}
}

View File

@ -3,6 +3,7 @@ use std::time::Duration;
use anyhow::Result;
use async_trait::async_trait;
use base64::{engine::general_purpose, Engine as _};
use reqwest::header::{HeaderMap, CONTENT_TYPE};
use reqwest::Client;
use serde::Serialize;
@ -36,7 +37,7 @@ impl UplinkPayload {
UplinkPayload {
correlation_id: pl.deduplication_id.clone(),
dev_eui: di.dev_eui.clone(),
data: base64::encode(&pl.data),
data: general_purpose::STANDARD.encode(&pl.data),
f_cnt: pl.f_cnt,
f_port: pl.f_port,
rx_info: pl

View File

@ -2,7 +2,7 @@ use std::sync::RwLock;
use anyhow::Result;
use prometheus_client::encoding::text::encode;
use prometheus_client::registry::Registry;
use prometheus_client::registry::{Metric, Registry};
lazy_static! {
static ref REGISTRY: RwLock<Registry> = RwLock::new(<Registry>::default());
@ -10,17 +10,13 @@ lazy_static! {
pub fn encode_to_string() -> Result<String> {
let registry_r = REGISTRY.read().unwrap();
let mut buffer = vec![];
let mut buffer = String::new();
encode(&mut buffer, &registry_r)?;
Ok(String::from_utf8(buffer)?)
Ok(buffer)
}
pub fn register(
name: &str,
help: &str,
metric: Box<dyn prometheus_client::encoding::text::SendSyncEncodeMetric>,
) {
pub fn register(name: &str, help: &str, metric: impl Metric) {
let mut registry_w = REGISTRY.write().unwrap();
registry_w.register(name, help, metric)
}

View File

@ -111,14 +111,28 @@ async fn save_for_interval(a: Aggregation, name: &str, record: &Record) -> Resul
let ts: DateTime<Local> = match a {
Aggregation::HOUR => Local
.ymd(record.time.year(), record.time.month(), record.time.day())
.and_hms(record.time.hour(), 0, 0),
.with_ymd_and_hms(
record.time.year(),
record.time.month(),
record.time.day(),
record.time.hour(),
0,
0,
)
.unwrap(),
Aggregation::DAY => Local
.ymd(record.time.year(), record.time.month(), record.time.day())
.and_hms(0, 0, 0),
.with_ymd_and_hms(
record.time.year(),
record.time.month(),
record.time.day(),
0,
0,
0,
)
.unwrap(),
Aggregation::MONTH => Local
.ymd(record.time.year(), record.time.month(), 1)
.and_hms(0, 0, 0),
.with_ymd_and_hms(record.time.year(), record.time.month(), 1, 0, 0, 0)
.unwrap(),
};
move || -> Result<()> {
@ -188,13 +202,12 @@ pub async fn get(
match a {
Aggregation::HOUR => {
let mut ts =
Local
.ymd(start.year(), start.month(), start.day())
.and_hms(start.hour(), 0, 0);
let mut ts = Local
.with_ymd_and_hms(start.year(), start.month(), start.day(), start.hour(), 0, 0)
.unwrap();
let end = Local
.ymd(end.year(), end.month(), end.day())
.and_hms(end.hour(), 0, 0);
.with_ymd_and_hms(end.year(), end.month(), end.day(), end.hour(), 0, 0)
.unwrap();
while ts.le(&end) {
timestamps.push(ts);
@ -204,11 +217,11 @@ pub async fn get(
}
Aggregation::DAY => {
let mut ts = Local
.ymd(start.year(), start.month(), start.day())
.and_hms(0, 0, 0);
.with_ymd_and_hms(start.year(), start.month(), start.day(), 0, 0, 0)
.unwrap();
let end = Local
.ymd(end.year(), end.month(), end.day())
.and_hms(0, 0, 0);
.with_ymd_and_hms(end.year(), end.month(), end.day(), 0, 0, 0)
.unwrap();
while ts.le(&end) {
timestamps.push(ts);
@ -218,26 +231,40 @@ pub async fn get(
// In case of DST to non-DST transition, the ts is incremented with less
// than 24h and we end up with the same day. Therefore we increment by two
// days.
(ts + ChronoDuration::days(2)).date().and_hms(0, 0, 0)
(ts + ChronoDuration::days(2))
.date()
.and_hms_opt(0, 0, 0)
.unwrap()
} else {
// Make sure that the timestamp stays at midnight in case of non-DST to DST
// change.
(ts + ChronoDuration::days(1)).date().and_hms(0, 0, 0)
(ts + ChronoDuration::days(1))
.date()
.and_hms_opt(0, 0, 0)
.unwrap()
}
};
}
}
Aggregation::MONTH => {
let mut ts = Local.ymd(start.year(), start.month(), 1).and_hms(0, 0, 0);
let end = Local.ymd(end.year(), end.month(), 1).and_hms(0, 0, 0);
let mut ts = Local
.with_ymd_and_hms(start.year(), start.month(), 1, 0, 0, 0)
.unwrap();
let end = Local
.with_ymd_and_hms(end.year(), end.month(), 1, 0, 0, 0)
.unwrap();
while ts.le(&end) {
timestamps.push(ts);
keys.push(get_key(name, a, ts));
ts = if ts.month() == 12 {
Local.ymd(ts.year() + 1, 1, 1).and_hms(0, 0, 0)
Local
.with_ymd_and_hms(ts.year() + 1, 1, 1, 0, 0, 0)
.unwrap()
} else {
Local.ymd(ts.year(), ts.month() + 1, 1).and_hms(0, 0, 0)
Local
.with_ymd_and_hms(ts.year(), ts.month() + 1, 1, 0, 0, 0)
.unwrap()
};
}
}
@ -308,7 +335,7 @@ pub mod test {
let records = vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 1, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 1, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 1f64), ("bar".into(), 2f64)]
.iter()
@ -316,7 +343,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 2, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 2, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 3f64), ("bar".into(), 4f64)]
.iter()
@ -324,7 +351,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(2, 1, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 2, 1, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
@ -342,8 +369,8 @@ pub mod test {
"test",
Kind::ABSOLUTE,
Aggregation::HOUR,
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.ymd(2018, 1, 1).and_hms(2, 0, 0),
Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
Local.with_ymd_and_hms(2018, 1, 1, 2, 0, 0).unwrap(),
)
.await
.unwrap();
@ -351,7 +378,7 @@ pub mod test {
assert_eq!(
vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 4f64), ("bar".into(), 6f64)]
.iter()
@ -359,7 +386,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(2, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 2, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
@ -377,7 +404,7 @@ pub mod test {
let records = vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 1f64), ("bar".into(), 2f64)]
.iter()
@ -385,7 +412,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(2, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 2, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 3f64), ("bar".into(), 4f64)]
.iter()
@ -393,7 +420,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2018, 1, 2).and_hms(1, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 2, 1, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
@ -411,8 +438,8 @@ pub mod test {
"test",
Kind::ABSOLUTE,
Aggregation::DAY,
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.ymd(2018, 1, 2).and_hms(1, 0, 0),
Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
Local.with_ymd_and_hms(2018, 1, 2, 1, 0, 0).unwrap(),
)
.await
.unwrap();
@ -420,7 +447,7 @@ pub mod test {
assert_eq!(
vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(0, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 0, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 4f64), ("bar".into(), 6f64)]
.iter()
@ -428,7 +455,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2018, 1, 2).and_hms(0, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 2, 0, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
@ -446,7 +473,7 @@ pub mod test {
let records = vec![
Record {
time: Local.ymd(2022, 10, 30).and_hms(1, 0, 0),
time: Local.with_ymd_and_hms(2022, 10, 30, 1, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 1f64), ("bar".into(), 2f64)]
.iter()
@ -454,7 +481,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2022, 10, 30).and_hms(5, 0, 0),
time: Local.with_ymd_and_hms(2022, 10, 30, 5, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 3f64), ("bar".into(), 4f64)]
.iter()
@ -462,7 +489,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2022, 10, 31).and_hms(1, 0, 0),
time: Local.with_ymd_and_hms(2022, 10, 31, 1, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
@ -480,8 +507,8 @@ pub mod test {
"test",
Kind::ABSOLUTE,
Aggregation::DAY,
Local.ymd(2022, 10, 30).and_hms(1, 0, 0),
Local.ymd(2022, 10, 31).and_hms(1, 0, 0),
Local.with_ymd_and_hms(2022, 10, 30, 1, 0, 0).unwrap(),
Local.with_ymd_and_hms(2022, 10, 31, 1, 0, 0).unwrap(),
)
.await
.unwrap();
@ -489,7 +516,7 @@ pub mod test {
assert_eq!(
vec![
Record {
time: Local.ymd(2022, 10, 30).and_hms(0, 0, 0),
time: Local.with_ymd_and_hms(2022, 10, 30, 0, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 4f64), ("bar".into(), 6f64)]
.iter()
@ -497,7 +524,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2022, 10, 31).and_hms(0, 0, 0),
time: Local.with_ymd_and_hms(2022, 10, 31, 0, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
@ -515,7 +542,7 @@ pub mod test {
let records = vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(0, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 0, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 1f64), ("bar".into(), 2f64)]
.iter()
@ -523,7 +550,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2018, 1, 2).and_hms(0, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 2, 0, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 3f64), ("bar".into(), 4f64)]
.iter()
@ -531,7 +558,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2018, 2, 1).and_hms(0, 0, 0),
time: Local.with_ymd_and_hms(2018, 2, 1, 0, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
@ -549,8 +576,8 @@ pub mod test {
"test",
Kind::ABSOLUTE,
Aggregation::MONTH,
Local.ymd(2018, 1, 1).and_hms(0, 0, 0),
Local.ymd(2018, 2, 1).and_hms(0, 0, 0),
Local.with_ymd_and_hms(2018, 1, 1, 0, 0, 0).unwrap(),
Local.with_ymd_and_hms(2018, 2, 1, 0, 0, 0).unwrap(),
)
.await
.unwrap();
@ -558,7 +585,7 @@ pub mod test {
assert_eq!(
vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(0, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 0, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 4f64), ("bar".into(), 6f64)]
.iter()
@ -566,7 +593,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2018, 2, 1).and_hms(0, 0, 0),
time: Local.with_ymd_and_hms(2018, 2, 1, 0, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
@ -584,7 +611,7 @@ pub mod test {
let records = vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 1, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 1, 0).unwrap(),
kind: Kind::COUNTER,
metrics: [("foo".into(), 1.0), ("bar".into(), 2.0)]
.iter()
@ -592,7 +619,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 2, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 2, 0).unwrap(),
kind: Kind::COUNTER,
metrics: [("foo".into(), 2.0), ("bar".into(), 4.0)]
.iter()
@ -610,15 +637,15 @@ pub mod test {
"test",
Kind::COUNTER,
Aggregation::HOUR,
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
)
.await
.unwrap();
assert_eq!(
vec![Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
kind: Kind::COUNTER,
metrics: [("foo".into(), 2.0), ("bar".into(), 4.0)]
.iter()
@ -635,7 +662,7 @@ pub mod test {
let records = vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 1, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 1, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 1.0), ("bar".into(), 2.0)]
.iter()
@ -643,7 +670,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 2, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 2, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 2.0), ("bar".into(), 4.0)]
.iter()
@ -661,15 +688,15 @@ pub mod test {
"test",
Kind::ABSOLUTE,
Aggregation::HOUR,
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
)
.await
.unwrap();
assert_eq!(
vec![Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 3.0), ("bar".into(), 6.0)]
.iter()
@ -686,7 +713,7 @@ pub mod test {
let records = vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 1, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 1, 0).unwrap(),
kind: Kind::GAUGE,
metrics: [("foo".into(), 1.0), ("bar".into(), 2.0)]
.iter()
@ -694,7 +721,7 @@ pub mod test {
.collect(),
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 2, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 2, 0).unwrap(),
kind: Kind::GAUGE,
metrics: [("foo".into(), 2.0), ("bar".into(), 4.0)]
.iter()
@ -712,15 +739,15 @@ pub mod test {
"test",
Kind::GAUGE,
Aggregation::HOUR,
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
)
.await
.unwrap();
assert_eq!(
vec![Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
time: Local.with_ymd_and_hms(2018, 1, 1, 1, 0, 0).unwrap(),
kind: Kind::GAUGE,
metrics: [("foo".into(), 1.5), ("bar".into(), 3.0)]
.iter()

View File

@ -187,7 +187,7 @@ pub async fn setup() -> Result<()> {
info!("Setting up Redis client");
if conf.redis.cluster {
let client = redis::cluster::ClusterClientBuilder::new(conf.redis.servers.clone())
.open()
.build()
.context("ClusterClient open")?;
let pool: r2d2::Pool<redis::cluster::ClusterClient> = r2d2::Pool::builder()
.max_size(conf.redis.max_open_connections)

View File

@ -13,7 +13,7 @@ hex = "0.4"
cmac = "0.7"
aes = "0.8"
serde = { version = "1.0", features = ["derive"] }
diesel = { version = "2.0.2", features = [ "postgres" ] }
diesel = { version = "2.0", features = [ "postgres" ] }
# Error handling
thiserror = "1.0"