Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support dual mode data storage #369

Merged
merged 31 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c00cb44
feat: support dual mode data storage
jrconlin Aug 3, 2023
4ed4fbd
f pick up spare
jrconlin Aug 3, 2023
f0d27f9
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Aug 15, 2023
3efba03
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Aug 17, 2023
64b199e
f add flag to write to secondary (default true)
jrconlin Aug 28, 2023
73323aa
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Aug 28, 2023
8284da6
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Aug 28, 2023
f8335de
Merge branch 'master' into feat/3452-dual_data
jrconlin Aug 31, 2023
06f26cc
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Oct 6, 2023
3e0934c
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Oct 6, 2023
6fdb28a
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Oct 30, 2023
2acb6ef
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Nov 3, 2023
8f1858d
Merge branch 'feat/3452-dual_data' of github.com:mozilla-services/aut…
jrconlin Nov 3, 2023
bf78aea
f fix merge
jrconlin Nov 3, 2023
9384a28
Merge branch 'master' into feat/3452-dual_data
jrconlin Nov 13, 2023
101cfaa
f bump gcr-raw to 0.16
jrconlin Nov 13, 2023
d2b4bb6
f reduce the circleci jobs to fit memory
jrconlin Nov 14, 2023
eaeed21
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Nov 15, 2023
568c33d
Merge branch 'master' into feat/3452-dual_data
jrconlin Nov 15, 2023
3c5e773
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Nov 15, 2023
204a9d2
f fix remove_node_id()
jrconlin Nov 15, 2023
0ef905c
Merge branch 'feat/3452-dual_data' of github.com:mozilla-services/aut…
jrconlin Nov 15, 2023
46109ed
Merge branch 'master' into feat/3452-dual_data
jrconlin Nov 17, 2023
ff6ecbe
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Nov 17, 2023
a21acc7
f post merge fixups
jrconlin Nov 17, 2023
2727003
Merge branch 'feat/3452-dual_data' of github.com:mozilla-services/aut…
jrconlin Nov 17, 2023
577ca3f
f post merge dependency fixes
jrconlin Nov 17, 2023
7f4e43f
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Nov 21, 2023
f2753f7
f r's
jrconlin Nov 22, 2023
92a73e6
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin Nov 29, 2023
a4829cf
f cleanup (why didn't clippy catch that?)
jrconlin Nov 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
audit:
docker:
# NOTE: update version for all # RUST_VER
- image: rust:1.72
- image: rust:1.73
auth:
username: $DOCKER_USER
password: $DOCKER_PASS
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
apt install build-essential curl libstdc++6 libstdc++-10-dev libssl-dev pkg-config -y
apt install cmake -y
# RUST_VER
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.72 -y
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.73 -y
export PATH=$PATH:$HOME/.cargo/bin
echo 'export PATH=$PATH:$HOME/.cargo/bin' >> $BASH_ENV
rustc --version
Expand Down
62 changes: 31 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ edition = "2021"
# ideally, this would contain any crates that are shared between crates.
# there are some lingering code interdependencies that prevent that, but it should
# remain a goal for the overall refactor.

actix = "0.13"
actix-cors = "0.6"
actix-http = "3.2"
Expand Down Expand Up @@ -112,7 +113,10 @@ autoconnect_settings = { path = "./autoconnect/autoconnect-settings" }
autoconnect_web = { path = "./autoconnect/autoconnect-web" }
autoconnect_ws = { path = "./autoconnect/autoconnect-ws" }
autoconnect_ws_clientsm = { path = "./autoconnect/autoconnect-ws/autoconnect-ws-clientsm" }
autopush_common = { path = "./autopush-common", features = ["bigtable"] }
autopush_common = { path = "./autopush-common", features = [
"dynamodb",
"bigtable",
] }

[profile.release]
debug = 1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# NOTE: Ensure builder's Rust version matches CI's in .circleci/config.yml
FROM rust:1.72-buster as builder
FROM rust:1.73-buster as builder
ARG CRATE

ADD . /app
Expand Down
10 changes: 8 additions & 2 deletions autoendpoint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ tokio.workspace = true
url.workspace = true
uuid.workspace = true

a2 = {version = "0.8", git = "https://github.com/mozilla-services/a2", branch="master"}
a2 = { version = "0.8", git = "https://github.com/mozilla-services/a2", branch = "master" }
bytebuffer = "2.1"
again = { version = "0.1.2", default-features = false, features = ["log", "rand"] }
again = { version = "0.1.2", default-features = false, features = [
"log",
"rand",
] }
async-trait = "0.1"
autopush_common = { path = "../autopush-common" }
jsonwebtoken = "8.0"
Expand All @@ -64,5 +67,8 @@ tempfile = "3.2.0"
tokio = { workspace = true, features = ["fs", "macros"] }

[features]
default = ["dynamodb"]
dynamodb = ["autopush_common/dynamodb"]
emulator = ["bigtable"]
dual = ["bigtable", "dynamodb"]
bigtable = ["autopush_common/bigtable"]
10 changes: 9 additions & 1 deletion autoendpoint/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ use actix_web::{
};
#[cfg(feature = "bigtable")]
use autopush_common::db::bigtable::BigTableClientImpl;
#[cfg(feature = "dual")]
use autopush_common::db::dual::DualClientImpl;
use cadence::StatsdClient;
use fernet::MultiFernet;
use serde_json::json;

#[cfg(feature = "dynamodb")]
use autopush_common::db::dynamodb::DdbClientImpl;

use autopush_common::{
db::{client::DbClient, dynamodb::DdbClientImpl, DbSettings, StorageType},
db::{client::DbClient, DbSettings, StorageType},
middleware::sentry::SentryWrapper,
};

Expand Down Expand Up @@ -63,6 +68,7 @@ impl Server {
},
};
let db: Box<dyn DbClient> = match StorageType::from_dsn(&db_settings.dsn) {
#[cfg(feature = "dynamodb")]
StorageType::DynamoDb => {
debug!("Using Dynamodb");
Box::new(DdbClientImpl::new(metrics.clone(), &db_settings)?)
Expand All @@ -72,6 +78,8 @@ impl Server {
debug!("Using BigTable");
Box::new(BigTableClientImpl::new(metrics.clone(), &db_settings)?)
}
#[cfg(all(feature = "bigtable", feature = "dual"))]
StorageType::Dual => Box::new(DualClientImpl::new(metrics.clone(), &db_settings)?),
_ => {
debug!("No idea what {:?} is", &db_settings.dsn);
return Err(ApiErrorKind::General(
Expand Down
Loading