refactor: into crates
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
469f28f65d
commit
14ef235dd9
23
Cargo.lock
generated
23
Cargo.lock
generated
@ -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",
|
||||||
|
@ -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"] }
|
||||||
|
25
crates/hyperlog-core/Cargo.toml
Normal file
25
crates/hyperlog-core/Cargo.toml
Normal 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"
|
10
crates/hyperlog-core/src/lib.rs
Normal file
10
crates/hyperlog-core/src/lib.rs
Normal 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;
|
@ -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
|
||||||
|
@ -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 {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user