feat: add docs
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
a5196b005e
commit
cf321d110e
965
Cargo.lock
generated
965
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
23
README.md
23
README.md
@ -1 +1,24 @@
|
||||
# nodata
|
||||
|
||||
Nodata is a simple binary that consists of two parts:
|
||||
|
||||
1. Data ingest
|
||||
2. Data storage
|
||||
3. Data aggregation
|
||||
4. Data API / egress
|
||||
|
||||
## Data ingest
|
||||
|
||||
Nodata presents a simple protobuf grpc api for ingesting either single events or batch
|
||||
|
||||
## Data storage
|
||||
|
||||
Nodata stores data locally in a parquet partitioned scheme
|
||||
|
||||
## Data aggregation
|
||||
|
||||
Nodata accepts wasm routines for running aggregations over data to be processed
|
||||
|
||||
## Data Egress
|
||||
|
||||
Nodata exposes aggregations as apis, or events to be sent as grpc streamed apis to a service.
|
||||
|
@ -13,6 +13,13 @@ 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"] }
|
||||
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"] }
|
||||
mad = { git = "https://github.com/kjuulh/mad", branch = "main" }
|
||||
|
@ -3,9 +3,10 @@ use std::{net::SocketAddr, ops::Deref, sync::Arc};
|
||||
use anyhow::Context;
|
||||
use axum::extract::MatchedPath;
|
||||
use axum::http::Request;
|
||||
use axum::Router;
|
||||
use axum::routing::get;
|
||||
use axum::Router;
|
||||
use clap::{Parser, Subcommand};
|
||||
use mad::{Mad, MadError};
|
||||
use sqlx::{Pool, Postgres};
|
||||
use tower_http::trace::TraceLayer;
|
||||
|
||||
@ -36,13 +37,16 @@ async fn main() -> anyhow::Result<()> {
|
||||
|
||||
let state = SharedState(Arc::new(State::new().await?));
|
||||
|
||||
let state = state.clone();
|
||||
Mad::builder()
|
||||
.add_fn(move |_cancel| {
|
||||
let state = state.clone();
|
||||
async move {
|
||||
let app = Router::new()
|
||||
.route("/", get(root))
|
||||
.with_state(state.clone())
|
||||
.layer(
|
||||
TraceLayer::new_for_http().make_span_with(|request: &Request<_>| {
|
||||
// Log the matched route's path (with placeholders not filled in).
|
||||
// Use request.uri() or OriginalUri if you want the real path.
|
||||
.layer(TraceLayer::new_for_http().make_span_with(
|
||||
|request: &Request<_>| {
|
||||
let matched_path = request
|
||||
.extensions()
|
||||
.get::<MatchedPath>()
|
||||
@ -54,14 +58,21 @@ async fn main() -> anyhow::Result<()> {
|
||||
matched_path,
|
||||
some_other_field = tracing::field::Empty,
|
||||
)
|
||||
}), // ...
|
||||
);
|
||||
},
|
||||
));
|
||||
|
||||
tracing::info!("listening on {}", host);
|
||||
let listener = tokio::net::TcpListener::bind(host).await.unwrap();
|
||||
axum::serve(listener, app.into_make_service())
|
||||
.await
|
||||
.unwrap();
|
||||
.context("axum server stopped")
|
||||
.map_err(MadError::Inner)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
})
|
||||
.run()
|
||||
.await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@ -103,4 +114,3 @@ impl State {
|
||||
Ok(Self { db })
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user