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: Implement HTTP-over-AMQP #304

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
**/target
**/Cargo.lock
.idea/
.vscode/
.DS_Store

Expand Down
43 changes: 42 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
"fe2o3-amqp-ws",
"fe2o3-amqp-management",
"fe2o3-amqp-cbs",
"fe2o3-amqp-http",
]

exclude = [
Expand Down Expand Up @@ -67,9 +68,49 @@ log = "0.4"
tracing = "0.1"
tokio = { version = "1", default-features = false }
tokio-util = "0.7"
tokio-test = "0.4"
futures-util = "0.3"
uuid = "1"
ordered-float = "4"
pin-project-lite = "0.2"
rand = "0.8"
getrandom = { version = "0.2", features = ["js"] }
getrandom = { version = "0.2", features = ["js"] }
convert_case = "0.6.0"
darling = "0.20"
proc-macro2 = "1"
quote = "1"
syn = "2"
url = "2"
slab = "0.4"
parking_lot = { version = "0.12", features = ["send_guard"] }
sha-1 = "0.10"
sha2 = "0.10"
base64 = "0.22"
stringprep = "0.1"
hmac = "0.12"
pbkdf2 = "0.12"
webpki-roots = "0.26"
tokio-rustls = "0.26"
librustls = { package = "rustls", version = "0.23" }
libnative-tls = { package = "native-tls", version = "0.2" }
tokio-native-tls = "0.3"
ring = "0.17"
tokio-stream = "0.1"
fluvio-wasm-timer = "0.2"
testcontainers = "0.15.0"
indexmap = "2"
serde_json = "1"
chrono = "0.4"
time = "0.3"
criterion = "0.5"
http = "1"
httpdate = "1"
http-body = "1"
http-body-util = "0.1"
tungstenite = "0.24"
tokio-tungstenite = "0.24"
js-sys = "0.3"
wasm-bindgen = "0.2"
web-sys = "0.3"
serde_repr = "0.1"
trait-variant = "0.1.1"
6 changes: 3 additions & 3 deletions fe2o3-amqp-cbs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ readme = "Readme.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
fe2o3-amqp = { workspace = true }
fe2o3-amqp-management = { workspace = true }
trait-variant = "0.1.1"
fe2o3-amqp.workspace = true
fe2o3-amqp-management.workspace = true
trait-variant.workspace = true
2 changes: 1 addition & 1 deletion fe2o3-amqp-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ readme = "Readme.md"

[dependencies]
serde_amqp = { workspace = true, features = ["derive"] }
fe2o3-amqp-types = { workspace = true }
fe2o3-amqp-types.workspace = true
19 changes: 19 additions & 0 deletions fe2o3-amqp-http/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "fe2o3-amqp-http"
version = "0.1.0"
edition = "2021"

[dependencies]
fe2o3-amqp.workspace = true
fe2o3-amqp-types.workspace = true
serde.workspace = true
thiserror.workspace = true

http.workspace = true
httpdate.workspace = true
http-body.workspace = true
http-body-util.workspace = true

# Optional dependencies
log = { workspace = true, optional = true }
tracing = { workspace = true, optional = true }
9 changes: 9 additions & 0 deletions fe2o3-amqp-http/src/client.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use fe2o3_amqp::{Receiver, Sender};

use crate::projected::TryIntoProjected;

#[derive(Debug)]
pub struct Client {
sender: Sender,
receiver: Receiver,
}
58 changes: 58 additions & 0 deletions fe2o3-amqp-http/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
use http::{header::{InvalidHeaderValue, ToStrError}, method::InvalidMethod, status::InvalidStatusCode};
use thiserror::Error;

#[derive(Debug, Error)]
pub enum TryIntoProjectedError<BE> {
#[error(transparent)]
ToStrError(#[from] ToStrError),

#[error(transparent)]
Date(#[from] httpdate::Error),

#[error(transparent)]
SystemTime(#[from] std::time::SystemTimeError),

#[error(transparent)]
Body(BE),
}

#[derive(Debug, Error)]
pub enum TryFromProjectedError<BE> {
#[error("HTTP method not present")]
MethodNotPresent,

#[error(transparent)]
InvalidMethod(#[from] InvalidMethod),

#[error("HTTP status not present")]
StatusNotPresent,

#[error(transparent)]
InvalidStatusCode(#[from] InvalidStatusCode),

#[error("HTTP request target not present")]
RequestTargetNotPresent,

#[error("HTTP version not encoded as a string")]
VersionNotString,

#[error("HTTP version not valid")]
InvalidVersion,

#[error(transparent)]
HeaderValue(#[from] InvalidHeaderValue),

#[error(transparent)]
Body(BE),

#[error(transparent)]
Http(#[from] http::Error),
}

pub(crate) struct InvalidVersion;

impl<T> From<InvalidVersion> for TryFromProjectedError<T> {
fn from(_: InvalidVersion) -> Self {
TryFromProjectedError::InvalidVersion
}
}
7 changes: 7 additions & 0 deletions fe2o3-amqp-http/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pub mod client;
pub mod projected;
pub mod tunneled;
pub mod uri;
pub mod error;

mod util;
Loading
Loading