{"id":25407809,"url":"https://github.com/coriolinus/libsql-spike","last_synced_at":"2025-04-13T11:55:44.907Z","repository":{"id":277334295,"uuid":"930446820","full_name":"coriolinus/libsql-spike","owner":"coriolinus","description":"Figure out if `libsql` has what it takes for our requirements","archived":true,"fork":false,"pushed_at":"2025-02-19T13:15:54.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T11:55:41.152Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coriolinus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-10T16:42:51.000Z","updated_at":"2025-02-19T13:24:25.000Z","dependencies_parsed_at":"2025-02-19T05:15:12.305Z","dependency_job_id":null,"html_url":"https://github.com/coriolinus/libsql-spike","commit_stats":null,"previous_names":["coriolinus/libsql-spike"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coriolinus%2Flibsql-spike","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coriolinus%2Flibsql-spike/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coriolinus%2Flibsql-spike/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coriolinus%2Flibsql-spike/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coriolinus","download_url":"https://codeload.github.com/coriolinus/libsql-spike/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248710446,"owners_count":21149188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-16T07:18:30.587Z","updated_at":"2025-04-13T11:55:44.891Z","avatar_url":"https://github.com/coriolinus.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `libsql` Spike\n\nWe are looking for a unified database solution which\n\n- is async\n- builds to wasm\n- works via uniffi\n\n[`libsql`] looks like it may meet our criteria, so let's prove that concept one way or the other.\n\n[`libsql`]: https://turso.tech/libsql\n\n## Strategy\n\n1. Build a simple pure-rust library using this DB\n2. Build a simple CLI so we can prove it works locally\n3. Build a -ffi adaptor crate\n4. Add `uniffi` bindings to the ffi adaptor crate.\n5. Verify that some other language i.e. python can access the things uniffi exports\n6. Add `wasm` bindings to the ffi adaptor crate.\n7. Verify that TS in bun can access the things wasm exports.\n\nThe FFI stuff is complicated, but we can streamline things by essentially copying config from core-crypto.\nThe point of all this is to demonstrate the capability on a project with a (much!) smaller surface area\nthan core-crypto itself.\n\n## Outcome\n\nSteps 1-6 work properly. Additionally, we managed to demonstrate a technique for unifying implementations between wasm and uniffi.\n\nUnfortunately, step 7 is impossible without adjusting `libsql`:\n\n```sh\n$ cargo build -p ffi --features wasm --target wasm32-unknown-unknown\n   Compiling libsql-ffi v0.5.0\n   Compiling libsql-sys v0.8.0\nerror[E0433]: failed to resolve: could not find `unix` in `os`\n   --\u003e ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libsql-sys-0.8.0/src/connection.rs:276:26\n    |\n276 |             use std::os::unix::ffi::OsStrExt;\n    |                          ^^^^ could not find `unix` in `os`\n    |\nnote: found an item that was configured out\n   --\u003e ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/os/mod.rs:36:9\n    |\n36  | pub mod unix {}\n    |         ^^^^\nnote: the item is gated here\n   --\u003e ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/os/mod.rs:28:1\n    |\n28  | / #[cfg(all(\n29  | |     doc,\n30  | |     any(\n31  | |         all(target_arch = \"wasm32\", not(target_os = \"wasi\")),\n32  | |         all(target_vendor = \"fortanix\", target_env = \"sgx\")\n33  | |     )\n34  | | ))]\n    | |___^\nnote: found an item that was configured out\n   --\u003e ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/os/mod.rs:85:9\n    |\n85  | pub mod unix;\n    |         ^^^^\nnote: the item is gated here\n   --\u003e ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/os/mod.rs:84:1\n    |\n84  | #[cfg(all(not(target_os = \"hermit\"), any(unix, doc)))]\n    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nerror[E0599]: no method named `as_bytes` found for reference `\u0026OsStr` in the current scope\n   --\u003e ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libsql-sys-0.8.0/src/connection.rs:277:73\n    |\n277 |             let path = std::ffi::CString::new(path.as_ref().as_os_str().as_bytes())\n    |                                                                         ^^^^^^^^\n    |\nhelp: there is a method `as_encoded_bytes` with a similar name\n    |\n277 |             let path = std::ffi::CString::new(path.as_ref().as_os_str().as_encoded_bytes())\n    |                                                                         ~~~~~~~~~~~~~~~~\n\nSome errors have detailed explanations: E0433, E0599.\nFor more information about an error, try `rustc --explain E0433`.\nerror: could not compile `libsql-sys` (lib) due to 2 previous errors\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoriolinus%2Flibsql-spike","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoriolinus%2Flibsql-spike","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoriolinus%2Flibsql-spike/lists"}