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
|
||||||
|
|
||||||
|
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
|
axum.workspace = true
|
||||||
|
|
||||||
serde = { version = "1.0.197", features = ["derive"] }
|
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"] }
|
uuid = { version = "1.7.0", features = ["v4"] }
|
||||||
tower-http = { version = "0.5.2", features = ["cors", "trace"] }
|
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 anyhow::Context;
|
||||||
use axum::extract::MatchedPath;
|
use axum::extract::MatchedPath;
|
||||||
use axum::http::Request;
|
use axum::http::Request;
|
||||||
use axum::Router;
|
|
||||||
use axum::routing::get;
|
use axum::routing::get;
|
||||||
|
use axum::Router;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
|
use mad::{Mad, MadError};
|
||||||
use sqlx::{Pool, Postgres};
|
use sqlx::{Pool, Postgres};
|
||||||
use tower_http::trace::TraceLayer;
|
use tower_http::trace::TraceLayer;
|
||||||
|
|
||||||
@ -36,13 +37,16 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
let state = SharedState(Arc::new(State::new().await?));
|
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()
|
let app = Router::new()
|
||||||
.route("/", get(root))
|
.route("/", get(root))
|
||||||
.with_state(state.clone())
|
.with_state(state.clone())
|
||||||
.layer(
|
.layer(TraceLayer::new_for_http().make_span_with(
|
||||||
TraceLayer::new_for_http().make_span_with(|request: &Request<_>| {
|
|request: &Request<_>| {
|
||||||
// Log the matched route's path (with placeholders not filled in).
|
|
||||||
// Use request.uri() or OriginalUri if you want the real path.
|
|
||||||
let matched_path = request
|
let matched_path = request
|
||||||
.extensions()
|
.extensions()
|
||||||
.get::<MatchedPath>()
|
.get::<MatchedPath>()
|
||||||
@ -54,14 +58,21 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
matched_path,
|
matched_path,
|
||||||
some_other_field = tracing::field::Empty,
|
some_other_field = tracing::field::Empty,
|
||||||
)
|
)
|
||||||
}), // ...
|
},
|
||||||
);
|
));
|
||||||
|
|
||||||
tracing::info!("listening on {}", host);
|
tracing::info!("listening on {}", host);
|
||||||
let listener = tokio::net::TcpListener::bind(host).await.unwrap();
|
let listener = tokio::net::TcpListener::bind(host).await.unwrap();
|
||||||
axum::serve(listener, app.into_make_service())
|
axum::serve(listener, app.into_make_service())
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.context("axum server stopped")
|
||||||
|
.map_err(MadError::Inner)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.run()
|
||||||
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -103,4 +114,3 @@ impl State {
|
|||||||
Ok(Self { db })
|
Ok(Self { db })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user