diff --git a/Cargo.lock b/Cargo.lock index e37c3ae..6e0fe54 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -796,6 +796,29 @@ dependencies = [ [[package]] name = "hyperlog" version = "0.1.0" +dependencies = [ + "anyhow", + "axum", + "bus", + "clap", + "dirs", + "dotenv", + "hyperlog-core", + "serde", + "serde_json", + "similar-asserts", + "sqlx", + "tempfile", + "tokio", + "tower-http", + "tracing", + "tracing-subscriber", + "uuid", +] + +[[package]] +name = "hyperlog-core" +version = "0.1.0" dependencies = [ "anyhow", "axum", diff --git a/Cargo.toml b/Cargo.toml index 1519161..a108e2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ members = ["crates/*"] resolver = "2" [workspace.dependencies] +hyperlog-core = {path = "crates/hyperlog-core"} anyhow = { version = "1" } tokio = { version = "1", features = ["full"] } diff --git a/crates/hyperlog-core/Cargo.toml b/crates/hyperlog-core/Cargo.toml new file mode 100644 index 0000000..089786c --- /dev/null +++ b/crates/hyperlog-core/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "hyperlog-core" +version = "0.1.0" +edition = "2021" + +[dependencies] +anyhow.workspace = true +tokio.workspace = true +tracing.workspace = true +tracing-subscriber.workspace = true +clap.workspace = true +dotenv.workspace = true +axum.workspace = true + +serde = { version = "1.0.197", features = ["derive"] } +sqlx = { version = "0.7.3", features = ["runtime-tokio", "tls-rustls", "postgres", "uuid", "time"] } +uuid = { version = "1.7.0", features = ["v4"] } +tower-http = { version = "0.5.2", features = ["cors", "trace"] } +serde_json = "1.0.116" +bus = "2.4.1" +dirs = "5.0.1" + +[dev-dependencies] +similar-asserts = "1.5.0" +tempfile = "3.10.1" diff --git a/crates/hyperlog/src/commander.rs b/crates/hyperlog-core/src/commander.rs similarity index 100% rename from crates/hyperlog/src/commander.rs rename to crates/hyperlog-core/src/commander.rs diff --git a/crates/hyperlog/src/engine.rs b/crates/hyperlog-core/src/engine.rs similarity index 100% rename from crates/hyperlog/src/engine.rs rename to crates/hyperlog-core/src/engine.rs diff --git a/crates/hyperlog/src/events.rs b/crates/hyperlog-core/src/events.rs similarity index 100% rename from crates/hyperlog/src/events.rs rename to crates/hyperlog-core/src/events.rs diff --git a/crates/hyperlog-core/src/lib.rs b/crates/hyperlog-core/src/lib.rs new file mode 100644 index 0000000..8326d8f --- /dev/null +++ b/crates/hyperlog-core/src/lib.rs @@ -0,0 +1,10 @@ +#![feature(map_try_insert)] +pub mod commander; +pub mod querier; + +pub mod engine; +pub mod events; +pub mod log; +pub mod shared_engine; +pub mod state; +pub mod storage; diff --git a/crates/hyperlog/src/log.rs b/crates/hyperlog-core/src/log.rs similarity index 100% rename from crates/hyperlog/src/log.rs rename to crates/hyperlog-core/src/log.rs diff --git a/crates/hyperlog/src/querier.rs b/crates/hyperlog-core/src/querier.rs similarity index 100% rename from crates/hyperlog/src/querier.rs rename to crates/hyperlog-core/src/querier.rs diff --git a/crates/hyperlog/src/shared_engine.rs b/crates/hyperlog-core/src/shared_engine.rs similarity index 100% rename from crates/hyperlog/src/shared_engine.rs rename to crates/hyperlog-core/src/shared_engine.rs diff --git a/crates/hyperlog/src/state.rs b/crates/hyperlog-core/src/state.rs similarity index 100% rename from crates/hyperlog/src/state.rs rename to crates/hyperlog-core/src/state.rs diff --git a/crates/hyperlog/src/storage.rs b/crates/hyperlog-core/src/storage.rs similarity index 100% rename from crates/hyperlog/src/storage.rs rename to crates/hyperlog-core/src/storage.rs diff --git a/crates/hyperlog/Cargo.toml b/crates/hyperlog/Cargo.toml index 5a84bc1..194b01b 100644 --- a/crates/hyperlog/Cargo.toml +++ b/crates/hyperlog/Cargo.toml @@ -4,6 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] +hyperlog-core.workspace = true + anyhow.workspace = true tokio.workspace = true tracing.workspace = true diff --git a/crates/hyperlog/src/main.rs b/crates/hyperlog/src/main.rs index 222d19b..1b0c206 100644 --- a/crates/hyperlog/src/main.rs +++ b/crates/hyperlog/src/main.rs @@ -1,4 +1,3 @@ -#![feature(map_try_insert)] use std::{net::SocketAddr, ops::Deref, sync::Arc}; use anyhow::Context; @@ -7,19 +6,10 @@ use axum::http::Request; use axum::routing::get; use axum::Router; use clap::{Parser, Subcommand}; +use hyperlog_core::{commander, state}; use sqlx::{Pool, Postgres}; use tower_http::trace::TraceLayer; -pub mod commander; -pub mod querier; - -pub mod engine; -pub mod events; -pub mod log; -pub mod shared_engine; -pub mod state; -pub mod storage; - #[derive(Parser)] #[command(author, version, about, long_about = None, subcommand_required = true)] struct Command { @@ -33,17 +23,14 @@ enum Commands { #[arg(env = "SERVICE_HOST", long, default_value = "127.0.0.1:3000")] host: SocketAddr, }, - Exec { #[command(subcommand)] commands: ExecCommands, }, - Query { #[command(subcommand)] commands: QueryCommands, }, - Info {}, }