refactor: into crates

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-04-30 20:27:55 +02:00
parent 469f28f65d
commit 14ef235dd9
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
14 changed files with 62 additions and 14 deletions

23
Cargo.lock generated
View File

@ -796,6 +796,29 @@ dependencies = [
[[package]] [[package]]
name = "hyperlog" name = "hyperlog"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"axum", "axum",

View File

@ -3,6 +3,7 @@ members = ["crates/*"]
resolver = "2" resolver = "2"
[workspace.dependencies] [workspace.dependencies]
hyperlog-core = {path = "crates/hyperlog-core"}
anyhow = { version = "1" } anyhow = { version = "1" }
tokio = { version = "1", features = ["full"] } tokio = { version = "1", features = ["full"] }

View File

@ -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"

View File

@ -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;

View File

@ -4,6 +4,8 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
hyperlog-core.workspace = true
anyhow.workspace = true anyhow.workspace = true
tokio.workspace = true tokio.workspace = true
tracing.workspace = true tracing.workspace = true

View File

@ -1,4 +1,3 @@
#![feature(map_try_insert)]
use std::{net::SocketAddr, ops::Deref, sync::Arc}; use std::{net::SocketAddr, ops::Deref, sync::Arc};
use anyhow::Context; use anyhow::Context;
@ -7,19 +6,10 @@ use axum::http::Request;
use axum::routing::get; use axum::routing::get;
use axum::Router; use axum::Router;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use hyperlog_core::{commander, state};
use sqlx::{Pool, Postgres}; use sqlx::{Pool, Postgres};
use tower_http::trace::TraceLayer; 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)] #[derive(Parser)]
#[command(author, version, about, long_about = None, subcommand_required = true)] #[command(author, version, about, long_about = None, subcommand_required = true)]
struct Command { struct Command {
@ -33,17 +23,14 @@ enum Commands {
#[arg(env = "SERVICE_HOST", long, default_value = "127.0.0.1:3000")] #[arg(env = "SERVICE_HOST", long, default_value = "127.0.0.1:3000")]
host: SocketAddr, host: SocketAddr,
}, },
Exec { Exec {
#[command(subcommand)] #[command(subcommand)]
commands: ExecCommands, commands: ExecCommands,
}, },
Query { Query {
#[command(subcommand)] #[command(subcommand)]
commands: QueryCommands, commands: QueryCommands,
}, },
Info {}, Info {},
} }