dependencies update

main
Ziyang Hu 10 months ago
parent 439c8d7496
commit 890d2c016e

1689
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -56,12 +56,12 @@ rustyline = "12.0.0"
minreq = { version = "2.6.0", features = ["https-rustls"] }
miette = { version = "5.5.0", features = ["fancy"] }
ctrlc = "3.2.4"
axum = "0.6.2"
axum-macros = "0.3.1"
itertools = "0.11.0"
axum = "0.7.1"
axum-macros = "0.4.0"
itertools = "0.12.0"
tokio = { version = "1.24.1", features = ["full"] }
async-stream = "0.3.3"
futures = "0.3.25"
crossbeam = "0.8.2"
eventsource-client = "0.11.0"
tower-http = { version = "0.4.0", features = ["full"] }
eventsource-client = "0.12.0"
tower-http = { version = "0.5.0", features = ["full"] }

@ -16,7 +16,7 @@ use std::sync::atomic::{AtomicU32, Ordering};
use std::thread;
// use std::thread;
use axum::body::{boxed, Body, BoxBody};
use axum::body::Body;
use axum::extract::{DefaultBodyLimit, Path, Query, State};
use axum::http::{header, HeaderName, Method, Request, Response, StatusCode};
use axum::response::sse::{Event, KeepAlive};
@ -32,6 +32,7 @@ use miette::miette;
// use miette::miette;
use rand::Rng;
use serde_json::json;
use tokio::net::TcpListener;
use tokio::task::spawn_blocking;
use tower_http::auth::{AsyncAuthorizeRequest, AsyncRequireAuthorizationLayer};
use tower_http::compression::CompressionLayer;
@ -86,15 +87,13 @@ struct MyAuth {
token_table: Option<Arc<(String, DbInstance)>>,
}
impl<B> AsyncAuthorizeRequest<B> for MyAuth
where
B: Send + Sync + 'static,
impl AsyncAuthorizeRequest<Body> for MyAuth
{
type RequestBody = B;
type ResponseBody = BoxBody;
type Future = BoxFuture<'static, Result<Request<B>, Response<Self::ResponseBody>>>;
type RequestBody = Body;
type ResponseBody = Body;
type Future = BoxFuture<'static, Result<Request<Body>, Response<Self::ResponseBody>>>;
fn authorize(&mut self, mut request: Request<B>) -> Self::Future {
fn authorize(&mut self, mut request: Request<Body>) -> Self::Future {
let skip_auth = self.skip_auth;
let auth_guard = self.auth_guard.clone();
let token_table = self.token_table.clone();
@ -180,7 +179,7 @@ impl<B> AsyncAuthorizeRequest<B> for MyAuth
} else {
let unauthorized_response = Response::builder()
.status(StatusCode::UNAUTHORIZED)
.body(boxed(Body::empty()))
.body(Body::empty())
.unwrap();
Err(unauthorized_response)
@ -282,10 +281,8 @@ pub(crate) async fn server_main(args: ServerArgs) {
args.engine, addr
);
axum::Server::bind(&addr)
.serve(app.into_make_service())
.await
.unwrap();
let listener = TcpListener::bind("127.0.0.1:3000").await.unwrap();
axum::serve(listener, app.into_make_service()).await.unwrap();
}
#[derive(serde_derive::Deserialize)]

@ -102,10 +102,10 @@ base64 = "0.21.0"
chrono = "0.4.19"
chrono-tz = "0.8.0"
priority-queue = "1.2.3"
ordered-float = "3.0.0"
ordered-float = "4.1.1"
byteorder = "1.4.3"
num-traits = "0.2.15"
itertools = "0.11.0"
itertools = "0.12.0"
regex = "1.6.0"
pest = "2.2.1"
pest_derive = "2.2.1"
@ -120,9 +120,9 @@ minreq = { version = "2.6.0", features = ["https-rustls"], optional = true }
tikv-jemallocator-global = { version = "0.5.0", optional = true }
cozorocks = { path = "../cozorocks", version = "0.1.7", optional = true }
sled = { version = "0.34.7", optional = true }
tikv-client = { version = "0.1.0", optional = true }
tikv-client = { version = "0.3.0", optional = true }
tokio = { version = "1.21.2", optional = true }
sqlite = { version = "0.31.0", optional = true }
sqlite = { version = "0.32.0", optional = true }
sqlite3-src = { version = "0.5.1", optional = true, features = ["bundled"] }
js-sys = { version = "0.3.60", optional = true }
graph = { version = "0.3.0", optional = true }

@ -13,7 +13,7 @@ use ::sqlite::Connection;
use crossbeam::sync::{ShardedLock, ShardedLockReadGuard, ShardedLockWriteGuard};
use either::{Either, Left, Right};
use miette::{bail, miette, IntoDiagnostic, Result};
use sqlite::{ConnectionWithFullMutex, State, Statement};
use sqlite::{ConnectionThreadSafe, State, Statement};
use crate::data::tuple::{check_key_for_validity, Tuple};
use crate::data::value::ValidityTs;
@ -26,7 +26,7 @@ use crate::utils::swap_option_result;
pub struct SqliteStorage {
lock: Arc<ShardedLock<()>>,
name: PathBuf,
pool: Arc<Mutex<Vec<ConnectionWithFullMutex>>>,
pool: Arc<Mutex<Vec<ConnectionThreadSafe>>>,
}
/// Create a sqlite backed database.
@ -38,7 +38,7 @@ pub fn new_cozo_sqlite(path: impl AsRef<Path>) -> Result<crate::Db<SqliteStorage
if path.as_ref().to_str() == Some("") {
bail!("empty path for sqlite storage")
}
let conn = Connection::open_with_full_mutex(&path).into_diagnostic()?;
let conn = Connection::open_thread_safe(&path).into_diagnostic()?;
let query = r#"
create table if not exists cozo
(
@ -65,7 +65,7 @@ impl<'s> Storage<'s> for SqliteStorage {
fn transact(&'s self, write: bool) -> Result<Self::Tx> {
let conn = {
match self.pool.lock().unwrap().pop() {
None => Connection::open_with_full_mutex(&self.name).into_diagnostic()?,
None => Connection::open_thread_safe(&self.name).into_diagnostic()?,
Some(conn) => conn,
}
};
@ -119,7 +119,7 @@ impl<'s> Storage<'s> for SqliteStorage {
pub struct SqliteTx<'a> {
lock: Either<ShardedLockReadGuard<'a, ()>, ShardedLockWriteGuard<'a, ()>>,
storage: &'a SqliteStorage,
conn: Option<ConnectionWithFullMutex>,
conn: Option<ConnectionThreadSafe>,
stmts: [Mutex<Option<Statement<'a>>>; N_CACHED_QUERIES],
committed: bool,
}

@ -42,4 +42,4 @@ cozo = { version = "0.7.5", path = "../cozo-core", default_features = false }
lazy_static = "1.4.0"
[build-dependencies]
cbindgen = "0.24.3"
cbindgen = "0.26.0"

@ -12,10 +12,9 @@ use std::env;
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let config = Config {
cpp_compat: true,
..Config::default()
};
let mut config = Config::default();
config.cpp_compat = true;
cbindgen::Builder::new()
.with_config(config)
.with_crate(crate_dir)

@ -42,6 +42,6 @@ io-uring = ["cozo/io-uring"]
[dependencies]
cozo = { version = "0.7.5", path = "../cozo-core", default-features = false }
pyo3 = { version = "0.19.0", features = ["extension-module", "abi3", "abi3-py37"] }
pyo3 = { version = "0.20.0", features = ["extension-module", "abi3", "abi3-py37"] }
miette = "5.5.0"
serde_json = "1.0.96"

@ -33,11 +33,11 @@ fn report2py(r: Report) -> PyErr {
fn py_to_named_rows(ob: &PyAny) -> PyResult<NamedRows> {
let d = ob.downcast::<PyDict>()?;
let rows = d
.get_item("rows")
.get_item("rows")?
.ok_or_else(|| PyException::new_err("named rows must contain 'rows'"))?;
let rows = py_to_rows(rows)?;
let headers = d
.get_item("headers")
.get_item("headers")?
.ok_or_else(|| PyException::new_err("named rows must contain 'headers'"))?;
let headers = headers.extract::<Vec<String>>()?;
Ok(NamedRows::new(headers, rows))

Loading…
Cancel
Save