Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3394583
D6854.id23157.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
43 KB
Referenced Files
None
Subscribers
None
D6854.id23157.diff
View Options
diff --git a/services/backup/Cargo.lock b/services/backup/Cargo.lock
--- a/services/backup/Cargo.lock
+++ b/services/backup/Cargo.lock
@@ -407,7 +407,7 @@
"aws-types",
"chrono",
"clap",
- "derive_more",
+ "comm-services-lib",
"once_cell",
"prost",
"rand",
@@ -529,6 +529,17 @@
"unicode-width",
]
+[[package]]
+name = "comm-services-lib"
+version = "0.1.0"
+dependencies = [
+ "aws-config",
+ "aws-sdk-dynamodb",
+ "aws-types",
+ "chrono",
+ "derive_more",
+]
+
[[package]]
name = "convert_case"
version = "0.4.0"
diff --git a/services/backup/Cargo.toml b/services/backup/Cargo.toml
--- a/services/backup/Cargo.toml
+++ b/services/backup/Cargo.toml
@@ -14,7 +14,7 @@
aws-types = "0.51.0"
chrono = "0.4"
clap = { version = "4.0", features = ["derive", "env"] }
-derive_more = "0.99"
+comm-services-lib = { path = "../comm-services-lib" }
once_cell = "1.17"
prost = "0.11"
rand = "0.8.5"
diff --git a/services/backup/Dockerfile b/services/backup/Dockerfile
--- a/services/backup/Dockerfile
+++ b/services/backup/Dockerfile
@@ -16,6 +16,7 @@
# Cache build dependencies in a new layer
COPY services/backup/Cargo.toml services/backup/Cargo.lock ./
+COPY services/comm-services-lib ../comm-services-lib
RUN cargo build --release && rm src/*.rs
# Copy actual application sources
diff --git a/services/backup/src/database.rs b/services/backup/src/database.rs
--- a/services/backup/src/database.rs
+++ b/services/backup/src/database.rs
@@ -1,12 +1,7 @@
-use aws_sdk_dynamodb::{
- model::AttributeValue, output::GetItemOutput, Error as DynamoDBError,
-};
+use aws_sdk_dynamodb::{model::AttributeValue, output::GetItemOutput};
use chrono::{DateTime, Utc};
-use std::{
- collections::HashMap,
- fmt::{Display, Formatter},
- sync::Arc,
-};
+use comm_services_lib::database::{self, DBItemError, Error};
+use std::{collections::HashMap, sync::Arc};
use tracing::error;
use crate::constants::{
@@ -391,137 +386,30 @@
}
}
-#[derive(
- Debug, derive_more::Display, derive_more::From, derive_more::Error,
-)]
-pub enum Error {
- #[display(...)]
- AwsSdk(DynamoDBError),
- #[display(...)]
- Attribute(DBItemError),
-}
-
-#[derive(Debug, derive_more::Error, derive_more::Constructor)]
-pub struct DBItemError {
- attribute_name: &'static str,
- attribute_value: Option<AttributeValue>,
- attribute_error: DBItemAttributeError,
-}
-
-impl Display for DBItemError {
- fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
- match &self.attribute_error {
- DBItemAttributeError::Missing => {
- write!(f, "Attribute {} is missing", self.attribute_name)
- }
- DBItemAttributeError::IncorrectType => write!(
- f,
- "Value for attribute {} has incorrect type: {:?}",
- self.attribute_name, self.attribute_value
- ),
- error => write!(
- f,
- "Error regarding attribute {} with value {:?}: {}",
- self.attribute_name, self.attribute_value, error
- ),
- }
- }
-}
-
-#[derive(Debug, derive_more::Display, derive_more::Error)]
-pub enum DBItemAttributeError {
- #[display(...)]
- Missing,
- #[display(...)]
- IncorrectType,
- #[display(...)]
- InvalidTimestamp(chrono::ParseError),
-}
-
-fn parse_string_attribute(
- attribute_name: &'static str,
- attribute_value: Option<AttributeValue>,
-) -> Result<String, DBItemError> {
- match attribute_value {
- Some(AttributeValue::S(value)) => Ok(value),
- Some(_) => Err(DBItemError::new(
- attribute_name,
- attribute_value,
- DBItemAttributeError::IncorrectType,
- )),
- None => Err(DBItemError::new(
- attribute_name,
- attribute_value,
- DBItemAttributeError::Missing,
- )),
- }
-}
-
-fn parse_bool_attribute(
- attribute_name: &'static str,
- attribute_value: Option<AttributeValue>,
-) -> Result<bool, DBItemError> {
- match attribute_value {
- Some(AttributeValue::Bool(value)) => Ok(value),
- Some(_) => Err(DBItemError::new(
- attribute_name,
- attribute_value,
- DBItemAttributeError::IncorrectType,
- )),
- None => Err(DBItemError::new(
- attribute_name,
- attribute_value,
- DBItemAttributeError::Missing,
- )),
- }
-}
-
-fn parse_datetime_attribute(
- attribute_name: &'static str,
- attribute_value: Option<AttributeValue>,
-) -> Result<DateTime<Utc>, DBItemError> {
- if let Some(AttributeValue::S(datetime)) = &attribute_value {
- // parse() accepts a relaxed RFC3339 string
- datetime.parse().map_err(|e| {
- DBItemError::new(
- attribute_name,
- attribute_value,
- DBItemAttributeError::InvalidTimestamp(e),
- )
- })
- } else {
- Err(DBItemError::new(
- attribute_name,
- attribute_value,
- DBItemAttributeError::Missing,
- ))
- }
-}
-
fn parse_backup_item(
mut item: HashMap<String, AttributeValue>,
) -> Result<BackupItem, DBItemError> {
- let user_id = parse_string_attribute(
+ let user_id = database::parse_string_attribute(
BACKUP_TABLE_FIELD_USER_ID,
item.remove(BACKUP_TABLE_FIELD_USER_ID),
)?;
- let backup_id = parse_string_attribute(
+ let backup_id = database::parse_string_attribute(
BACKUP_TABLE_FIELD_BACKUP_ID,
item.remove(BACKUP_TABLE_FIELD_BACKUP_ID),
)?;
- let created = parse_datetime_attribute(
+ let created = database::parse_datetime_attribute(
BACKUP_TABLE_FIELD_CREATED,
item.remove(BACKUP_TABLE_FIELD_CREATED),
)?;
- let recovery_data = parse_string_attribute(
+ let recovery_data = database::parse_string_attribute(
BACKUP_TABLE_FIELD_RECOVERY_DATA,
item.remove(BACKUP_TABLE_FIELD_RECOVERY_DATA),
)?;
- let compaction_holder = parse_string_attribute(
+ let compaction_holder = database::parse_string_attribute(
BACKUP_TABLE_FIELD_COMPACTION_HOLDER,
item.remove(BACKUP_TABLE_FIELD_COMPACTION_HOLDER),
)?;
- let attachment_holders = parse_string_attribute(
+ let attachment_holders = database::parse_string_attribute(
BACKUP_TABLE_FIELD_ATTACHMENT_HOLDERS,
item.remove(BACKUP_TABLE_FIELD_ATTACHMENT_HOLDERS),
)?;
@@ -538,27 +426,27 @@
fn parse_log_item(
mut item: HashMap<String, AttributeValue>,
) -> Result<LogItem, DBItemError> {
- let backup_id = parse_string_attribute(
+ let backup_id = database::parse_string_attribute(
LOG_TABLE_FIELD_BACKUP_ID,
item.remove(LOG_TABLE_FIELD_BACKUP_ID),
)?;
- let log_id = parse_string_attribute(
+ let log_id = database::parse_string_attribute(
LOG_TABLE_FIELD_LOG_ID,
item.remove(LOG_TABLE_FIELD_LOG_ID),
)?;
- let persisted_in_blob = parse_bool_attribute(
+ let persisted_in_blob = database::parse_bool_attribute(
LOG_TABLE_FIELD_PERSISTED_IN_BLOB,
item.remove(LOG_TABLE_FIELD_PERSISTED_IN_BLOB),
)?;
- let value = parse_string_attribute(
+ let value = database::parse_string_attribute(
LOG_TABLE_FIELD_VALUE,
item.remove(LOG_TABLE_FIELD_VALUE),
)?;
- let data_hash = parse_string_attribute(
+ let data_hash = database::parse_string_attribute(
LOG_TABLE_FIELD_DATA_HASH,
item.remove(LOG_TABLE_FIELD_DATA_HASH),
)?;
- let attachment_holders = parse_string_attribute(
+ let attachment_holders = database::parse_string_attribute(
LOG_TABLE_FIELD_ATTACHMENT_HOLDERS,
item.remove(LOG_TABLE_FIELD_ATTACHMENT_HOLDERS),
)?;
diff --git a/services/backup/src/service/mod.rs b/services/backup/src/service/mod.rs
--- a/services/backup/src/service/mod.rs
+++ b/services/backup/src/service/mod.rs
@@ -1,4 +1,5 @@
use aws_sdk_dynamodb::Error as DynamoDBError;
+use comm_services_lib::database::Error as DBError;
use proto::backup_service_server::BackupService;
use std::pin::Pin;
use tokio::sync::mpsc;
@@ -8,9 +9,8 @@
use tracing_futures::Instrument;
use crate::{
- blob::BlobClient,
- constants::MPSC_CHANNEL_BUFFER_CAPACITY,
- database::{DatabaseClient, Error as DBError},
+ blob::BlobClient, constants::MPSC_CHANNEL_BUFFER_CAPACITY,
+ database::DatabaseClient,
};
mod proto {
diff --git a/services/blob/Cargo.lock b/services/blob/Cargo.lock
--- a/services/blob/Cargo.lock
+++ b/services/blob/Cargo.lock
@@ -482,6 +482,7 @@
"aws-types",
"chrono",
"clap",
+ "comm-services-lib",
"derive_more",
"once_cell",
"prost",
@@ -598,6 +599,17 @@
"unicode-width",
]
+[[package]]
+name = "comm-services-lib"
+version = "0.1.0"
+dependencies = [
+ "aws-config",
+ "aws-sdk-dynamodb",
+ "aws-types",
+ "chrono",
+ "derive_more",
+]
+
[[package]]
name = "convert_case"
version = "0.4.0"
diff --git a/services/blob/Cargo.toml b/services/blob/Cargo.toml
--- a/services/blob/Cargo.toml
+++ b/services/blob/Cargo.toml
@@ -14,6 +14,7 @@
aws-types = "0.51.0"
chrono = "0.4"
clap = { version = "4.0", features = ["derive", "env"] }
+comm-services-lib = { path = "../comm-services-lib" }
derive_more = "0.99"
once_cell = "1.17"
prost = "0.11"
diff --git a/services/blob/Dockerfile b/services/blob/Dockerfile
--- a/services/blob/Dockerfile
+++ b/services/blob/Dockerfile
@@ -16,6 +16,7 @@
# Cache build dependencies in a new layer
COPY services/blob/Cargo.toml services/blob/Cargo.lock ./
+COPY services/comm-services-lib ../comm-services-lib
RUN cargo build --release && rm src/*.rs
# Copy actual application sources
diff --git a/services/blob/src/database.rs b/services/blob/src/database.rs
--- a/services/blob/src/database.rs
+++ b/services/blob/src/database.rs
@@ -2,6 +2,7 @@
model::AttributeValue, output::GetItemOutput, Error as DynamoDBError,
};
use chrono::{DateTime, Utc};
+use comm_services_lib::database::{self, DBItemError};
use std::{
collections::HashMap,
fmt::{Display, Formatter},
@@ -101,15 +102,15 @@
item: Some(mut item),
..
} => {
- let blob_hash = parse_string_attribute(
+ let blob_hash = database::parse_string_attribute(
BLOB_TABLE_BLOB_HASH_FIELD,
item.remove(BLOB_TABLE_BLOB_HASH_FIELD),
)?;
- let s3_path = parse_string_attribute(
+ let s3_path = database::parse_string_attribute(
BLOB_TABLE_S3_PATH_FIELD,
item.remove(BLOB_TABLE_S3_PATH_FIELD),
)?;
- let created = parse_datetime_attribute(
+ let created = database::parse_datetime_attribute(
BLOB_TABLE_CREATED_FIELD,
item.remove(BLOB_TABLE_CREATED_FIELD),
)?;
@@ -206,11 +207,11 @@
item: Some(mut item),
..
} => {
- let holder = parse_string_attribute(
+ let holder = database::parse_string_attribute(
BLOB_REVERSE_INDEX_TABLE_HOLDER_FIELD,
item.remove(BLOB_REVERSE_INDEX_TABLE_HOLDER_FIELD),
)?;
- let blob_hash = parse_string_attribute(
+ let blob_hash = database::parse_string_attribute(
BLOB_REVERSE_INDEX_TABLE_BLOB_HASH_FIELD,
item.remove(BLOB_REVERSE_INDEX_TABLE_BLOB_HASH_FIELD),
)?;
@@ -253,11 +254,11 @@
let mut results: Vec<ReverseIndexItem> =
Vec::with_capacity(response.count() as usize);
for mut item in response.items.unwrap_or_default() {
- let holder = parse_string_attribute(
+ let holder = database::parse_string_attribute(
BLOB_REVERSE_INDEX_TABLE_HOLDER_FIELD,
item.remove(BLOB_REVERSE_INDEX_TABLE_HOLDER_FIELD),
)?;
- let blob_hash = parse_string_attribute(
+ let blob_hash = database::parse_string_attribute(
BLOB_REVERSE_INDEX_TABLE_BLOB_HASH_FIELD,
item.remove(BLOB_REVERSE_INDEX_TABLE_BLOB_HASH_FIELD),
)?;
@@ -321,81 +322,3 @@
}
impl std::error::Error for BlobDBError {}
-
-#[derive(Debug, derive_more::Error, derive_more::Constructor)]
-pub struct DBItemError {
- attribute_name: &'static str,
- attribute_value: Option<AttributeValue>,
- attribute_error: DBItemAttributeError,
-}
-
-impl Display for DBItemError {
- fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
- match &self.attribute_error {
- DBItemAttributeError::Missing => {
- write!(f, "Attribute {} is missing", self.attribute_name)
- }
- DBItemAttributeError::IncorrectType => write!(
- f,
- "Value for attribute {} has incorrect type: {:?}",
- self.attribute_name, self.attribute_value
- ),
- error => write!(
- f,
- "Error regarding attribute {} with value {:?}: {}",
- self.attribute_name, self.attribute_value, error
- ),
- }
- }
-}
-
-#[derive(Debug, derive_more::Display, derive_more::Error)]
-pub enum DBItemAttributeError {
- #[display(...)]
- Missing,
- #[display(...)]
- IncorrectType,
- #[display(...)]
- InvalidTimestamp(chrono::ParseError),
-}
-
-fn parse_string_attribute(
- attribute_name: &'static str,
- attribute_value: Option<AttributeValue>,
-) -> Result<String, DBItemError> {
- match attribute_value {
- Some(AttributeValue::S(value)) => Ok(value),
- Some(_) => Err(DBItemError::new(
- attribute_name,
- attribute_value,
- DBItemAttributeError::IncorrectType,
- )),
- None => Err(DBItemError::new(
- attribute_name,
- attribute_value,
- DBItemAttributeError::Missing,
- )),
- }
-}
-
-fn parse_datetime_attribute(
- attribute_name: &'static str,
- attribute_value: Option<AttributeValue>,
-) -> Result<DateTime<Utc>, DBItemError> {
- if let Some(AttributeValue::S(datetime)) = &attribute_value {
- // parse() accepts a relaxed RFC3339 string
- datetime.parse().map_err(|e| {
- DBItemError::new(
- attribute_name,
- attribute_value,
- DBItemAttributeError::InvalidTimestamp(e),
- )
- })
- } else {
- Err(DBItemError::new(
- attribute_name,
- attribute_value,
- DBItemAttributeError::Missing,
- ))
- }
-}
diff --git a/services/comm-services-lib/.gitignore b/services/comm-services-lib/.gitignore
new file mode 100644
--- /dev/null
+++ b/services/comm-services-lib/.gitignore
@@ -0,0 +1 @@
+target
diff --git a/services/feature-flags/Cargo.lock b/services/comm-services-lib/Cargo.lock
copy from services/feature-flags/Cargo.lock
copy to services/comm-services-lib/Cargo.lock
--- a/services/feature-flags/Cargo.lock
+++ b/services/comm-services-lib/Cargo.lock
@@ -12,10 +12,13 @@
]
[[package]]
-name = "anyhow"
-version = "1.0.69"
+name = "android_system_properties"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
+checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
+dependencies = [
+ "libc",
+]
[[package]]
name = "autocfg"
@@ -44,7 +47,7 @@
"http",
"hyper",
"ring",
- "time",
+ "time 0.3.20",
"tokio",
"tower",
"tracing",
@@ -177,7 +180,7 @@
"percent-encoding",
"regex",
"ring",
- "time",
+ "time 0.3.20",
"tracing",
]
@@ -281,7 +284,7 @@
"itoa",
"num-integer",
"ryu",
- "time",
+ "time 0.3.20",
]
[[package]]
@@ -356,42 +359,47 @@
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
-name = "clap"
-version = "4.1.4"
+name = "chrono"
+version = "0.4.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76"
+checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
dependencies = [
- "bitflags",
- "clap_derive",
- "clap_lex",
- "is-terminal",
- "once_cell",
- "strsim",
- "termcolor",
+ "iana-time-zone",
+ "js-sys",
+ "num-integer",
+ "num-traits",
+ "time 0.1.45",
+ "wasm-bindgen",
+ "winapi",
]
[[package]]
-name = "clap_derive"
-version = "4.1.0"
+name = "codespan-reporting"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"
+checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
dependencies = [
- "heck",
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn",
+ "termcolor",
+ "unicode-width",
]
[[package]]
-name = "clap_lex"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade"
+name = "comm-services-lib"
+version = "0.1.0"
dependencies = [
- "os_str_bytes",
+ "aws-config",
+ "aws-sdk-dynamodb",
+ "aws-types",
+ "chrono",
+ "derive_more",
]
+[[package]]
+name = "convert_case"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
+
[[package]]
name = "core-foundation"
version = "0.9.3"
@@ -409,55 +417,75 @@
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]]
-name = "either"
-version = "1.8.1"
+name = "cxx"
+version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
+checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62"
+dependencies = [
+ "cc",
+ "cxxbridge-flags",
+ "cxxbridge-macro",
+ "link-cplusplus",
+]
[[package]]
-name = "errno"
-version = "0.2.8"
+name = "cxx-build"
+version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
+checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690"
dependencies = [
- "errno-dragonfly",
- "libc",
- "winapi",
+ "cc",
+ "codespan-reporting",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "scratch",
+ "syn",
]
[[package]]
-name = "errno-dragonfly"
-version = "0.1.2"
+name = "cxxbridge-flags"
+version = "1.0.91"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf"
+
+[[package]]
+name = "cxxbridge-macro"
+version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
+checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892"
dependencies = [
- "cc",
- "libc",
+ "proc-macro2",
+ "quote",
+ "syn",
]
[[package]]
-name = "fastrand"
-version = "1.8.0"
+name = "derive_more"
+version = "0.99.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
+checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
dependencies = [
- "instant",
+ "convert_case",
+ "proc-macro2",
+ "quote",
+ "rustc_version",
+ "syn",
]
[[package]]
-name = "feature-flags"
-version = "0.1.0"
+name = "either"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
+
+[[package]]
+name = "fastrand"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
dependencies = [
- "anyhow",
- "aws-config",
- "aws-sdk-dynamodb",
- "aws-types",
- "clap",
- "http",
- "once_cell",
- "tokio",
- "tracing",
- "tracing-subscriber",
+ "instant",
]
[[package]]
@@ -552,27 +580,6 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
-[[package]]
-name = "heck"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
-
-[[package]]
-name = "hermit-abi"
-version = "0.2.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "hermit-abi"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "856b5cb0902c2b6d65d5fd97dfa30f9b70c7538e770b98eab5ed52d8db923e01"
-
[[package]]
name = "hex"
version = "0.4.3"
@@ -581,9 +588,9 @@
[[package]]
name = "http"
-version = "0.2.8"
+version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
+checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
dependencies = [
"bytes",
"fnv",
@@ -653,44 +660,46 @@
]
[[package]]
-name = "indexmap"
-version = "1.9.2"
+name = "iana-time-zone"
+version = "0.1.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
+checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765"
dependencies = [
- "autocfg",
- "hashbrown",
+ "android_system_properties",
+ "core-foundation-sys",
+ "iana-time-zone-haiku",
+ "js-sys",
+ "wasm-bindgen",
+ "winapi",
]
[[package]]
-name = "instant"
-version = "0.1.12"
+name = "iana-time-zone-haiku"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
+checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
dependencies = [
- "cfg-if",
+ "cxx",
+ "cxx-build",
]
[[package]]
-name = "io-lifetimes"
-version = "1.0.5"
+name = "indexmap"
+version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
+checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
dependencies = [
- "libc",
- "windows-sys 0.45.0",
+ "autocfg",
+ "hashbrown",
]
[[package]]
-name = "is-terminal"
-version = "0.4.3"
+name = "instant"
+version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef"
+checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
- "hermit-abi 0.3.0",
- "io-lifetimes",
- "rustix",
- "windows-sys 0.45.0",
+ "cfg-if",
]
[[package]]
@@ -721,10 +730,13 @@
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
-name = "linux-raw-sys"
-version = "0.1.4"
+name = "link-cplusplus"
+version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
+checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5"
+dependencies = [
+ "cc",
+]
[[package]]
name = "log"
@@ -735,15 +747,6 @@
"cfg-if",
]
-[[package]]
-name = "matchers"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
-dependencies = [
- "regex-automata",
-]
-
[[package]]
name = "memchr"
version = "2.5.0"
@@ -752,24 +755,14 @@
[[package]]
name = "mio"
-version = "0.8.5"
+version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"
+checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
dependencies = [
"libc",
"log",
- "wasi",
- "windows-sys 0.42.0",
-]
-
-[[package]]
-name = "nu-ansi-term"
-version = "0.46.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
-dependencies = [
- "overload",
- "winapi",
+ "wasi 0.11.0+wasi-snapshot-preview1",
+ "windows-sys 0.45.0",
]
[[package]]
@@ -791,21 +784,11 @@
"autocfg",
]
-[[package]]
-name = "num_cpus"
-version = "1.15.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
-dependencies = [
- "hermit-abi 0.2.6",
- "libc",
-]
-
[[package]]
name = "once_cell"
-version = "1.17.0"
+version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
+checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]]
name = "openssl-probe"
@@ -813,18 +796,6 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
-[[package]]
-name = "os_str_bytes"
-version = "6.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
-
-[[package]]
-name = "overload"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
-
[[package]]
name = "percent-encoding"
version = "2.2.0"
@@ -863,30 +834,6 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
-[[package]]
-name = "proc-macro-error"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
-dependencies = [
- "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "syn",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro-error-attr"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
-dependencies = [
- "proc-macro2",
- "quote",
- "version_check",
-]
-
[[package]]
name = "proc-macro2"
version = "1.0.51"
@@ -916,15 +863,6 @@
"regex-syntax",
]
-[[package]]
-name = "regex-automata"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
-dependencies = [
- "regex-syntax",
-]
-
[[package]]
name = "regex-syntax"
version = "0.6.28"
@@ -955,20 +893,6 @@
"semver",
]
-[[package]]
-name = "rustix"
-version = "0.36.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
-dependencies = [
- "bitflags",
- "errno",
- "io-lifetimes",
- "libc",
- "linux-raw-sys",
- "windows-sys 0.45.0",
-]
-
[[package]]
name = "rustls"
version = "0.20.8"
@@ -1017,6 +941,12 @@
"windows-sys 0.42.0",
]
+[[package]]
+name = "scratch"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2"
+
[[package]]
name = "sct"
version = "0.7.0"
@@ -1062,30 +992,15 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
-[[package]]
-name = "sharded-slab"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
-dependencies = [
- "lazy_static",
-]
-
[[package]]
name = "slab"
-version = "0.4.7"
+version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
+checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d"
dependencies = [
"autocfg",
]
-[[package]]
-name = "smallvec"
-version = "1.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
-
[[package]]
name = "socket2"
version = "0.4.7"
@@ -1102,17 +1017,11 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
-[[package]]
-name = "strsim"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
-
[[package]]
name = "syn"
-version = "1.0.107"
+version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
@@ -1129,19 +1038,21 @@
]
[[package]]
-name = "thread_local"
-version = "1.1.4"
+name = "time"
+version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
+checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [
- "once_cell",
+ "libc",
+ "wasi 0.10.0+wasi-snapshot-preview1",
+ "winapi",
]
[[package]]
name = "time"
-version = "0.3.17"
+version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376"
+checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890"
dependencies = [
"serde",
"time-core",
@@ -1156,9 +1067,9 @@
[[package]]
name = "time-macros"
-version = "0.2.6"
+version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2"
+checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36"
dependencies = [
"time-core",
]
@@ -1174,24 +1085,11 @@
"libc",
"memchr",
"mio",
- "num_cpus",
"pin-project-lite",
"socket2",
- "tokio-macros",
"windows-sys 0.42.0",
]
-[[package]]
-name = "tokio-macros"
-version = "1.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
[[package]]
name = "tokio-rustls"
version = "0.23.4"
@@ -1205,9 +1103,9 @@
[[package]]
name = "tokio-stream"
-version = "0.1.11"
+version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce"
+checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313"
dependencies = [
"futures-core",
"pin-project-lite",
@@ -1216,9 +1114,9 @@
[[package]]
name = "tokio-util"
-version = "0.7.4"
+version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740"
+checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2"
dependencies = [
"bytes",
"futures-core",
@@ -1287,36 +1185,6 @@
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
dependencies = [
"once_cell",
- "valuable",
-]
-
-[[package]]
-name = "tracing-log"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
-dependencies = [
- "lazy_static",
- "log",
- "tracing-core",
-]
-
-[[package]]
-name = "tracing-subscriber"
-version = "0.3.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70"
-dependencies = [
- "matchers",
- "nu-ansi-term",
- "once_cell",
- "regex",
- "sharded-slab",
- "smallvec",
- "thread_local",
- "tracing",
- "tracing-core",
- "tracing-log",
]
[[package]]
@@ -1331,6 +1199,12 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
+[[package]]
+name = "unicode-width"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
+
[[package]]
name = "untrusted"
version = "0.7.1"
@@ -1343,18 +1217,6 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9"
-[[package]]
-name = "valuable"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
-
-[[package]]
-name = "version_check"
-version = "0.9.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
-
[[package]]
name = "want"
version = "0.3.0"
@@ -1365,6 +1227,12 @@
"try-lock",
]
+[[package]]
+name = "wasi"
+version = "0.10.0+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
+
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
diff --git a/services/comm-services-lib/Cargo.toml b/services/comm-services-lib/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/services/comm-services-lib/Cargo.toml
@@ -0,0 +1,14 @@
+[package]
+name = "comm-services-lib"
+version = "0.1.0"
+edition = "2021"
+license = "BSD-3-Clause"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+aws-config = "0.51.0"
+aws-types = "0.51.0"
+aws-sdk-dynamodb = "0.21.0"
+chrono = "0.4"
+derive_more = "0.99"
diff --git a/services/comm-services-lib/src/database.rs b/services/comm-services-lib/src/database.rs
new file mode 100644
--- /dev/null
+++ b/services/comm-services-lib/src/database.rs
@@ -0,0 +1,110 @@
+use aws_sdk_dynamodb::{model::AttributeValue, Error as DynamoDBError};
+use chrono::{DateTime, Utc};
+use std::fmt::{Display, Formatter};
+
+#[derive(
+ Debug, derive_more::Display, derive_more::From, derive_more::Error,
+)]
+pub enum Error {
+ #[display(...)]
+ AwsSdk(DynamoDBError),
+ #[display(...)]
+ Attribute(DBItemError),
+}
+
+#[derive(Debug, derive_more::Error, derive_more::Constructor)]
+pub struct DBItemError {
+ attribute_name: &'static str,
+ attribute_value: Option<AttributeValue>,
+ attribute_error: DBItemAttributeError,
+}
+
+impl Display for DBItemError {
+ fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
+ match &self.attribute_error {
+ DBItemAttributeError::Missing => {
+ write!(f, "Attribute {} is missing", self.attribute_name)
+ }
+ DBItemAttributeError::IncorrectType => write!(
+ f,
+ "Value for attribute {} has incorrect type: {:?}",
+ self.attribute_name, self.attribute_value
+ ),
+ error => write!(
+ f,
+ "Error regarding attribute {} with value {:?}: {}",
+ self.attribute_name, self.attribute_value, error
+ ),
+ }
+ }
+}
+
+#[derive(Debug, derive_more::Display, derive_more::Error)]
+pub enum DBItemAttributeError {
+ #[display(...)]
+ Missing,
+ #[display(...)]
+ IncorrectType,
+ #[display(...)]
+ InvalidTimestamp(chrono::ParseError),
+}
+
+pub fn parse_string_attribute(
+ attribute_name: &'static str,
+ attribute_value: Option<AttributeValue>,
+) -> Result<String, DBItemError> {
+ match attribute_value {
+ Some(AttributeValue::S(value)) => Ok(value),
+ Some(_) => Err(DBItemError::new(
+ attribute_name,
+ attribute_value,
+ DBItemAttributeError::IncorrectType,
+ )),
+ None => Err(DBItemError::new(
+ attribute_name,
+ attribute_value,
+ DBItemAttributeError::Missing,
+ )),
+ }
+}
+
+pub fn parse_bool_attribute(
+ attribute_name: &'static str,
+ attribute_value: Option<AttributeValue>,
+) -> Result<bool, DBItemError> {
+ match attribute_value {
+ Some(AttributeValue::Bool(value)) => Ok(value),
+ Some(_) => Err(DBItemError::new(
+ attribute_name,
+ attribute_value,
+ DBItemAttributeError::IncorrectType,
+ )),
+ None => Err(DBItemError::new(
+ attribute_name,
+ attribute_value,
+ DBItemAttributeError::Missing,
+ )),
+ }
+}
+
+pub fn parse_datetime_attribute(
+ attribute_name: &'static str,
+ attribute_value: Option<AttributeValue>,
+) -> Result<DateTime<Utc>, DBItemError> {
+ if let Some(AttributeValue::S(datetime)) = &attribute_value {
+ // parse() accepts a relaxed RFC3339 string
+ datetime.parse().map_err(|e| {
+ DBItemError::new(
+ attribute_name,
+ attribute_value,
+ DBItemAttributeError::InvalidTimestamp(e),
+ )
+ })
+ } else {
+ Err(DBItemError::new(
+ attribute_name,
+ attribute_value,
+ DBItemAttributeError::Missing,
+ ))
+ }
+}
diff --git a/services/comm-services-lib/src/lib.rs b/services/comm-services-lib/src/lib.rs
new file mode 100644
--- /dev/null
+++ b/services/comm-services-lib/src/lib.rs
@@ -0,0 +1 @@
+pub mod database;
diff --git a/services/feature-flags/Cargo.lock b/services/feature-flags/Cargo.lock
--- a/services/feature-flags/Cargo.lock
+++ b/services/feature-flags/Cargo.lock
@@ -11,6 +11,15 @@
"memchr",
]
+[[package]]
+name = "android_system_properties"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "anyhow"
version = "1.0.69"
@@ -44,7 +53,7 @@
"http",
"hyper",
"ring",
- "time",
+ "time 0.3.17",
"tokio",
"tower",
"tracing",
@@ -177,7 +186,7 @@
"percent-encoding",
"regex",
"ring",
- "time",
+ "time 0.3.17",
"tracing",
]
@@ -281,7 +290,7 @@
"itoa",
"num-integer",
"ryu",
- "time",
+ "time 0.3.17",
]
[[package]]
@@ -355,6 +364,21 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+[[package]]
+name = "chrono"
+version = "0.4.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
+dependencies = [
+ "iana-time-zone",
+ "js-sys",
+ "num-integer",
+ "num-traits",
+ "time 0.1.45",
+ "wasm-bindgen",
+ "winapi",
+]
+
[[package]]
name = "clap"
version = "4.1.4"
@@ -392,6 +416,22 @@
"os_str_bytes",
]
+[[package]]
+name = "codespan-reporting"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
+dependencies = [
+ "termcolor",
+ "unicode-width",
+]
+
+[[package]]
+name = "convert_case"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
+
[[package]]
name = "core-foundation"
version = "0.9.3"
@@ -408,6 +448,63 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
+[[package]]
+name = "cxx"
+version = "1.0.91"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62"
+dependencies = [
+ "cc",
+ "cxxbridge-flags",
+ "cxxbridge-macro",
+ "link-cplusplus",
+]
+
+[[package]]
+name = "cxx-build"
+version = "1.0.91"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690"
+dependencies = [
+ "cc",
+ "codespan-reporting",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "scratch",
+ "syn",
+]
+
+[[package]]
+name = "cxxbridge-flags"
+version = "1.0.91"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf"
+
+[[package]]
+name = "cxxbridge-macro"
+version = "1.0.91"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "derive_more"
+version = "0.99.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
+dependencies = [
+ "convert_case",
+ "proc-macro2",
+ "quote",
+ "rustc_version",
+ "syn",
+]
+
[[package]]
name = "either"
version = "1.8.1"
@@ -455,6 +552,7 @@
"clap",
"http",
"once_cell",
+ "rust-lib",
"tokio",
"tracing",
"tracing-subscriber",
@@ -652,6 +750,30 @@
"tokio-rustls",
]
+[[package]]
+name = "iana-time-zone"
+version = "0.1.53"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765"
+dependencies = [
+ "android_system_properties",
+ "core-foundation-sys",
+ "iana-time-zone-haiku",
+ "js-sys",
+ "wasm-bindgen",
+ "winapi",
+]
+
+[[package]]
+name = "iana-time-zone-haiku"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
+dependencies = [
+ "cxx",
+ "cxx-build",
+]
+
[[package]]
name = "indexmap"
version = "1.9.2"
@@ -720,6 +842,15 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
+[[package]]
+name = "link-cplusplus"
+version = "1.0.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5"
+dependencies = [
+ "cc",
+]
+
[[package]]
name = "linux-raw-sys"
version = "0.1.4"
@@ -758,7 +889,7 @@
dependencies = [
"libc",
"log",
- "wasi",
+ "wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys 0.42.0",
]
@@ -946,6 +1077,17 @@
"winapi",
]
+[[package]]
+name = "rust-lib"
+version = "0.1.0"
+dependencies = [
+ "aws-config",
+ "aws-sdk-dynamodb",
+ "aws-types",
+ "chrono",
+ "derive_more",
+]
+
[[package]]
name = "rustc_version"
version = "0.4.0"
@@ -1017,6 +1159,12 @@
"windows-sys 0.42.0",
]
+[[package]]
+name = "scratch"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2"
+
[[package]]
name = "sct"
version = "0.7.0"
@@ -1137,6 +1285,17 @@
"once_cell",
]
+[[package]]
+name = "time"
+version = "0.1.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
+dependencies = [
+ "libc",
+ "wasi 0.10.0+wasi-snapshot-preview1",
+ "winapi",
+]
+
[[package]]
name = "time"
version = "0.3.17"
@@ -1331,6 +1490,12 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
+[[package]]
+name = "unicode-width"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
+
[[package]]
name = "untrusted"
version = "0.7.1"
@@ -1365,6 +1530,12 @@
"try-lock",
]
+[[package]]
+name = "wasi"
+version = "0.10.0+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
+
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
diff --git a/services/feature-flags/Cargo.toml b/services/feature-flags/Cargo.toml
--- a/services/feature-flags/Cargo.toml
+++ b/services/feature-flags/Cargo.toml
@@ -14,6 +14,7 @@
clap = { version = "4.0", features = ["derive", "env"] }
http = "0.2"
once_cell = "1.17"
+rust-lib = { path = "../comm-services-lib" }
tokio = { version = "1.24", features = ["rt-multi-thread", "macros"]}
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"]}
diff --git a/services/scripts/list_services.sh b/services/scripts/list_services.sh
--- a/services/scripts/list_services.sh
+++ b/services/scripts/list_services.sh
@@ -12,6 +12,7 @@
! -name "commtest" \
! -name "lib" \
! -name "terraform" \
+ ! -name "comm-services-lib" \
! -name ".*" \
-print0 | xargs -0 -n1 basename
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 8:39 PM (20 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2606046
Default Alt Text
D6854.id23157.diff (43 KB)
Attached To
Mode
D6854: [services] Extract common database code to a separate lib
Attached
Detach File
Event Timeline
Log In to Comment