mirror of
https://github.com/tursodatabase/libsql.git
synced 2025-07-14 11:25:17 +00:00
add libsql-hrana crate (#1260)
This commit is contained in:
17
Cargo.lock
generated
17
Cargo.lock
generated
@ -2705,6 +2705,7 @@ dependencies = [
|
||||
"http",
|
||||
"hyper",
|
||||
"hyper-rustls 0.25.0",
|
||||
"libsql-hrana",
|
||||
"libsql-sqlite3-parser",
|
||||
"libsql-sys",
|
||||
"libsql_replication",
|
||||
@ -2753,6 +2754,17 @@ dependencies = [
|
||||
"libsql-wasmtime-bindings",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsql-hrana"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
"prost",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsql-rusqlite"
|
||||
version = "0.30.0"
|
||||
@ -2821,6 +2833,7 @@ dependencies = [
|
||||
"jsonwebtoken",
|
||||
"libsql",
|
||||
"libsql-client",
|
||||
"libsql-hrana",
|
||||
"libsql-rusqlite",
|
||||
"libsql-sqlite3-parser",
|
||||
"libsql-sys",
|
||||
@ -2891,14 +2904,10 @@ dependencies = [
|
||||
name = "libsql-sys"
|
||||
version = "0.4.0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
"libsql-ffi",
|
||||
"libsql-rusqlite",
|
||||
"once_cell",
|
||||
"prost",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tracing",
|
||||
"zerocopy",
|
||||
]
|
||||
|
@ -10,11 +10,12 @@ members = [
|
||||
"bottomless-cli",
|
||||
"libsql-replication",
|
||||
"libsql-ffi",
|
||||
"libsql-hrana",
|
||||
|
||||
"vendored/rusqlite",
|
||||
"vendored/sqlite3-parser",
|
||||
|
||||
"xtask",
|
||||
"xtask", "libsql-hrana",
|
||||
]
|
||||
|
||||
exclude = [
|
||||
|
15
libsql-hrana/Cargo.toml
Normal file
15
libsql-hrana/Cargo.toml
Normal file
@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "libsql-hrana"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||
prost = { version = "0.12" }
|
||||
base64 = { version = "0.21" }
|
||||
bytes = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1.0"
|
||||
|
@ -60,7 +60,8 @@ serde_json = { version = "1.0.91", features = ["preserve_order"] }
|
||||
md-5 = "0.10"
|
||||
sha2 = "0.10"
|
||||
sha256 = "1.1.3"
|
||||
libsql-sys = { path = "../libsql-sys", features = ["wal", "hrana"], default-features = false }
|
||||
libsql-sys = { path = "../libsql-sys", features = ["wal"], default-features = false }
|
||||
libsql-hrana = { path = "../libsql-hrana" }
|
||||
sqlite3-parser = { package = "libsql-sqlite3-parser", path = "../vendored/sqlite3-parser", version = "0.11.0", default-features = false, features = [ "YYNOERRORRECOVERY" ] }
|
||||
tempfile = "3.7.0"
|
||||
thiserror = "1.0.38"
|
||||
|
@ -1,7 +1,7 @@
|
||||
use anyhow::{Context, Result};
|
||||
use bytes::Bytes;
|
||||
use futures::stream::Stream;
|
||||
use libsql_sys::hrana::proto;
|
||||
use libsql_hrana::proto;
|
||||
use parking_lot::Mutex;
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use std::pin::Pin;
|
||||
|
@ -4,7 +4,7 @@ use bytesize::ByteSize;
|
||||
use super::super::{batch, stmt, ProtocolError, Version};
|
||||
use super::stream;
|
||||
use crate::connection::{Connection, RequestContext};
|
||||
use libsql_sys::hrana::proto;
|
||||
use libsql_hrana::proto;
|
||||
|
||||
const MAX_SQL_COUNT: usize = 50;
|
||||
const MAX_STORED_SQL_SIZE: ByteSize = ByteSize::kb(5);
|
||||
|
@ -6,7 +6,7 @@ pub mod http;
|
||||
mod result_builder;
|
||||
pub mod stmt;
|
||||
pub mod ws;
|
||||
pub use libsql_sys::hrana::proto;
|
||||
pub use libsql_hrana::proto;
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialOrd, Ord, PartialEq, Eq)]
|
||||
pub enum Version {
|
||||
|
@ -17,12 +17,6 @@ once_cell = "1.18.0"
|
||||
rusqlite = { workspace = true, features = ["trace"], optional = true }
|
||||
tracing = "0.1.37"
|
||||
zerocopy = { version = "0.7.28", features = ["derive"] }
|
||||
serde = { version = "1.0", features = ["derive", "rc"], optional = true }
|
||||
prost = { version = "0.12", optional = true }
|
||||
base64 = { version = "0.21", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1.0"
|
||||
|
||||
[features]
|
||||
default = ["api"]
|
||||
@ -32,9 +26,4 @@ rusqlite = ["dep:rusqlite"]
|
||||
wasmtime-bindings = ["libsql-ffi/wasmtime-bindings"]
|
||||
unix-excl-vfs = []
|
||||
encryption = ["libsql-ffi/multiple-ciphers"]
|
||||
serde = ["dep:serde"]
|
||||
hrana = [
|
||||
"serde",
|
||||
"dep:prost",
|
||||
"dep:base64"
|
||||
]
|
||||
|
||||
|
@ -63,8 +63,6 @@ pub mod ffi {
|
||||
#[cfg(feature = "api")]
|
||||
pub mod connection;
|
||||
pub mod error;
|
||||
#[cfg(feature = "hrana")]
|
||||
pub mod hrana;
|
||||
#[cfg(feature = "api")]
|
||||
pub mod statement;
|
||||
#[cfg(feature = "api")]
|
||||
|
@ -11,7 +11,8 @@ tracing = { version = "0.1.37", default-features = false }
|
||||
thiserror = "1.0.40"
|
||||
|
||||
futures = { version = "0.3.28", optional = true }
|
||||
libsql-sys = { version = "0.4", path = "../libsql-sys", features = ["hrana"], optional = true }
|
||||
libsql-sys = { version = "0.4", path = "../libsql-sys", optional = true }
|
||||
libsql-hrana = { version = "0.1", path = "../libsql-hrana", optional = true }
|
||||
tokio = { version = "1.29.1", features = ["sync"], optional = true }
|
||||
tokio-util = { version = "0.7", features = ["io-util", "codec"], optional = true }
|
||||
parking_lot = { version = "0.12.1", optional = true }
|
||||
@ -101,7 +102,7 @@ hrana = [
|
||||
"dep:tokio",
|
||||
"dep:tokio-util",
|
||||
"dep:bytes",
|
||||
"libsql-sys",
|
||||
"dep:libsql-hrana",
|
||||
]
|
||||
serde = ["dep:serde"]
|
||||
remote = [
|
||||
|
@ -16,8 +16,8 @@ use crate::parser::StmtKind;
|
||||
use crate::{params::Params, ValueType};
|
||||
use bytes::Bytes;
|
||||
use futures::{Stream, StreamExt};
|
||||
pub use libsql_sys::hrana::proto;
|
||||
use libsql_sys::hrana::proto::{Batch, BatchResult, Col, Stmt};
|
||||
pub use libsql_hrana::proto;
|
||||
use libsql_hrana::proto::{Batch, BatchResult, Col, Stmt};
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
|
@ -3,7 +3,7 @@ use crate::hrana::proto::{Batch, BatchResult, DescribeResult, Stmt, StmtResult};
|
||||
use crate::hrana::{CursorResponseError, HranaError, HttpSend, Result};
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use futures::Stream;
|
||||
use libsql_sys::hrana::proto::{
|
||||
use libsql_hrana::proto::{
|
||||
BatchStreamReq, CloseSqlStreamReq, CloseStreamReq, CloseStreamResp, DescribeStreamReq,
|
||||
GetAutocommitStreamReq, PipelineReqBody, PipelineRespBody, SequenceStreamReq,
|
||||
StoreSqlStreamReq, StreamRequest, StreamResponse, StreamResult,
|
||||
|
@ -3,7 +3,7 @@ use crate::hrana::stream::HranaStream;
|
||||
use crate::hrana::{HttpSend, Result};
|
||||
use crate::parser::StmtKind;
|
||||
use crate::TransactionBehavior;
|
||||
use libsql_sys::hrana::proto::{ExecuteStreamReq, StreamRequest};
|
||||
use libsql_hrana::proto::{ExecuteStreamReq, StreamRequest};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct HttpTransaction<T>
|
||||
|
@ -36,7 +36,7 @@ use crate::{
|
||||
params::IntoParams,
|
||||
TransactionBehavior,
|
||||
};
|
||||
use libsql_sys::hrana::proto::{Batch, Stmt};
|
||||
use libsql_hrana::proto::{Batch, Stmt};
|
||||
|
||||
pub use crate::wasm::rows::Rows;
|
||||
|
||||
|
Reference in New Issue
Block a user