Rename the db crate to database
This commit is contained in:
@@ -8,5 +8,5 @@ rust-version.workspace = true
|
||||
admin_backend = { path = "../admin_backend" }
|
||||
axum.workspace = true
|
||||
clusters.workspace = true
|
||||
db.workspace = true
|
||||
database.workspace = true
|
||||
tokio = { workspace = true, features = ["net", "signal", "sync", "time"] }
|
||||
|
||||
@@ -2,14 +2,14 @@ use std::{sync::Arc, time::Duration};
|
||||
|
||||
use axum::{Router, extract::State, http::StatusCode, routing::get};
|
||||
|
||||
pub fn router(db: db::Connection) -> Router {
|
||||
pub fn router(db: database::Connection) -> Router {
|
||||
Router::new()
|
||||
.route("/healthz", get(|| async { StatusCode::NO_CONTENT }))
|
||||
.route("/readyz", get(readiness))
|
||||
.with_state(Arc::new(db))
|
||||
}
|
||||
|
||||
async fn readiness(State(db): State<Arc<db::Connection>>) -> StatusCode {
|
||||
async fn readiness(State(db): State<Arc<database::Connection>>) -> StatusCode {
|
||||
match tokio::time::timeout(Duration::from_secs(2), db.revision()).await {
|
||||
Ok(Ok(_)) => StatusCode::NO_CONTENT,
|
||||
_ => StatusCode::SERVICE_UNAVAILABLE,
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::{env, error::Error, io, net::SocketAddr, sync::Arc};
|
||||
|
||||
use axum::Router;
|
||||
use clusters::{DOCUMENTS, DeploymentConfig, ResolvedDeployment};
|
||||
use db::{ConnectError, connect_resolved, connect_sql};
|
||||
use database::{ConnectError, connect_resolved, connect_sql};
|
||||
use tokio::{net::TcpListener, sync::watch};
|
||||
|
||||
#[tokio::main]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "db"
|
||||
name = "database"
|
||||
version = "0.1.0"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::{collections::BTreeMap, env, time::Duration};
|
||||
|
||||
use db::{
|
||||
use database::{
|
||||
Connection, DeploymentConfig, Driver, Mutation, ReadPreference, Resource, SqlCluster,
|
||||
StorageError, Tls, connect,
|
||||
};
|
||||
+3
-1
@@ -1,6 +1,8 @@
|
||||
use std::{collections::BTreeMap, path::Path};
|
||||
|
||||
use db::{DeploymentConfig, Driver, Mutation, Resource, SqlCluster, StorageError, Tls, connect};
|
||||
use database::{
|
||||
DeploymentConfig, Driver, Mutation, Resource, SqlCluster, StorageError, Tls, connect,
|
||||
};
|
||||
use documents::{
|
||||
Contextualize, Document, DocumentContent, DocumentId, DocumentKey, DocumentTree, WorkspaceId,
|
||||
};
|
||||
Reference in New Issue
Block a user