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

refactor: move broadcast/protocol/registry into a common crate #357

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions Cargo.lock

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

15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"autopush",
"autoendpoint",
"autoconnect",
"autoconnect/autoconnect-common",
"autoconnect/autoconnect-settings",
"autoconnect/autoconnect-web",
"autoconnect/autoconnect-ws",
Expand Down Expand Up @@ -87,13 +88,13 @@ tungstenite = { version = "0.9.2", default-features = false } # 0.10+ requires
uuid = { version = "1.1", features = ["serde", "v4"] }
url = "2.2"

autoconnect = {path = "./autoconnect"}
autopush_common = {path = "./autopush-common"}
autoconnect_registry = {path = "./autoconnect/autoconnect-registry"}
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"}
autoconnect = { path = "./autoconnect" }
autoconnect_common = { path = "./autoconnect/autoconnect-common" }
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" }

[profile.release]
debug = 1
1 change: 0 additions & 1 deletion autoconnect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ slog-stdlog.workspace = true
slog-term.workspace = true
uuid.workspace = true

autoconnect_registry.workspace = true
autoconnect_settings.workspace = true
autoconnect_web.workspace = true
autoconnect_ws.workspace = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
[package]
name = "autoconnect_registry"
version.workspace = true
name = "autoconnect_common"
authors.workspace = true
edition.workspace = true
version.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
futures.workspace = true
futures-locks.workspace = true
reqwest.workspace = true
serde.workspace = true
serde_derive.workspace = true
serde_json.workspace = true
slog.workspace = true
slog-scope.workspace = true
uuid.workspace = true

autoconnect_ws.workspace = true

autopush_common.workspace = true
6 changes: 6 additions & 0 deletions autoconnect/autoconnect-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#[macro_use]
extern crate slog_scope;

pub mod broadcast;
pub mod protocol;
pub mod registry;
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// move to own crate to avoid cyclic crate errors.
#[macro_use]
extern crate slog_scope;

use std::collections::HashMap;

use futures_locks::RwLock;
Expand Down
2 changes: 1 addition & 1 deletion autoconnect/autoconnect-settings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ serde_derive.workspace = true
slog.workspace = true
slog-scope.workspace = true

autoconnect_common.workspace = true
autopush_common.workspace = true
autoconnect_registry.workspace = true
2 changes: 1 addition & 1 deletion autoconnect/autoconnect-settings/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use cadence::StatsdClient;
use fernet::{Fernet, MultiFernet};

use crate::{Settings, ENV_PREFIX};
use autoconnect_registry::ClientRegistry;
use autoconnect_common::registry::ClientRegistry;
use autopush_common::db::{client::DbClient, dynamodb::DdbClientImpl, DbSettings, StorageType};
use autopush_common::{
errors::{ApcErrorKind, Result},
Expand Down
2 changes: 1 addition & 1 deletion autoconnect/autoconnect-web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ slog-scope.workspace = true
uuid.workspace = true


autoconnect_registry.workspace = true
autoconnect_common.workspace = true
autoconnect_settings.workspace = true
autoconnect_ws.workspace = true
autopush_common.workspace = true
9 changes: 5 additions & 4 deletions autoconnect/autoconnect-web/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ use futures_util::StreamExt;
use serde_json::json;
use uuid::Uuid;

use autoconnect_registry::RegisteredClient;
use autoconnect_common::{
broadcast::Broadcast,
protocol::{ClientAck, ClientMessage, ServerMessage},
registry::RegisteredClient,
};
use autoconnect_settings::options::AppState;
use autopush_common::db::{self, User};
use autopush_common::errors::{ApcError, ApcErrorKind, Result};
use autopush_common::notification::Notification;
use autopush_common::util::ms_since_epoch;

use crate::broadcast::Broadcast;
use crate::protocol::{ClientAck, ClientMessage, ServerMessage};

/// Client & Registry functions.
/// These are common functions run by connected WebSocket clients.
/// These are called from the Autoconnect server.
Expand Down
2 changes: 0 additions & 2 deletions autoconnect/autoconnect-web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ extern crate slog;
#[macro_use]
extern crate slog_scope;

pub mod broadcast;
pub mod client;
pub mod dockerflow;
pub mod metrics;
pub mod protocol;
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ actix-web.workspace = true
uuid.workspace = true

autopush_common.workspace = true
autoconnect_registry.workspace = true
autoconnect_settings.workspace = true
autoconnect_web.workspace = true
autoconnect_ws.workspace = true