-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Delta Lake docs (#313) * Create delta.mdx * Update delta.mdx * Update index.mdx * Update delta.mdx * Update delta.mdx * Fixes --------- Co-authored-by: Prashanth Rao <[email protected]> Co-authored-by: prrao87 <[email protected]> * Add Iceberg Extension Documentation (#314) * add ice_berg docu * Update src/content/docs/extensions/iceberg.mdx Co-authored-by: Guodong Jin <[email protected]> * Update src/content/docs/extensions/iceberg.mdx Co-authored-by: Guodong Jin <[email protected]> * restructure * restructure * restructure * update table * update table * Apply suggestions from code review * update table * Fixes --------- Co-authored-by: Guodong Jin <[email protected]> Co-authored-by: Prashanth Rao <[email protected]> Co-authored-by: prrao87 <[email protected]> * Fix file extension * Minor fixes * Create wasm.mdx Update wasm.mdx Update docs (#331) Fix demo script Starting merge for 0.8.0 * remove progress_bar_time from docs (#337) * Fix ignore errors in DataFrame section (#338) * Add doc for `show_indexes`, `show_official_extensions` (#339) * Add doc for `show_indexes`, `show_official_extensions` and `show_loaded_extensions` * Apply suggestions from code review * Update src/content/docs/cypher/query-clauses/call.md --------- Co-authored-by: Prashanth Rao <[email protected]> * FTS index (#332) * Create full-text-search.md * Update full-text-search.md * Update FTS docs --------- Co-authored-by: prrao87 <[email protected]> * Document the behaviour of import/export database with indexes (#340) * Add doc for file-format option (#342) (#343) * Add doc for file-format * Update index.mdx * Apply suggestions from code review --------- Co-authored-by: ziyi chen <[email protected]> * Fix typos and improve formatting * Add doc for yield clause (#347) * Add doc for yield clause * Apply suggestions from code review --------- Co-authored-by: Prashanth Rao <[email protected]> * skip/limit doc (#341) * skip/limit doc * Update limit.md * Update limit.md * Update skip.md * Add documentation on special behaviour for query result getNext() (#351) * Add docs on query result getNext() behaviour * Add manual frees in C API example * Apply suggestions from code review --------- Co-authored-by: Prashanth Rao <[email protected]> * Update rdbms.mdx (#352) * Add doc for duckdb/sqlite/postgres's type conversion (#348) * Add doc for duckdb's type conversion * Update rdbms.mdx * Update rdbms.mdx * Update rdbms.mdx * Update rdbms.mdx * Update src/content/docs/extensions/attach/rdbms.mdx Co-authored-by: Guodong Jin <[email protected]> * Update src/content/docs/extensions/attach/rdbms.mdx Co-authored-by: Guodong Jin <[email protected]> * Update src/content/docs/extensions/attach/rdbms.mdx Co-authored-by: Guodong Jin <[email protected]> * Update src/content/docs/extensions/attach/rdbms.mdx Co-authored-by: Guodong Jin <[email protected]> * Update rdbms.mdx --------- Co-authored-by: Guodong Jin <[email protected]> * Rename output of fts (#354) * Add doc for rel_table_group (#349) * rel-table-group * Polish rel group * Update src/content/docs/cypher/data-definition/create-table.md Co-authored-by: Guodong Jin <[email protected]> * Update src/content/docs/cypher/data-definition/create-table.md Co-authored-by: Guodong Jin <[email protected]> * Update src/content/docs/cypher/data-definition/create-table.md --------- Co-authored-by: xiyang <[email protected]> Co-authored-by: Prashanth Rao <[email protected]> Co-authored-by: Guodong Jin <[email protected]> * Fix formatting * Update src/content/docs/migrate/index.md Co-authored-by: Guodong Jin <[email protected]> * Fix export-db with index doc * Add reference to the bm25 match algo (#357) * edits * Update wasm.mdx * Update wasm.mdx * Update full-text-search.md (#358) Co-authored-by: Prashanth Rao <[email protected]> * Fts minor fix (#362) * fts minor fix * Update full-text-search.md * Update index.mdx * Update installation.mdx * Update installation.mdx * Update installation.mdx * Improve load/scan docs * Update config --------- Co-authored-by: ziyi chen <[email protected]> Co-authored-by: Sterling Shi <[email protected]> Co-authored-by: Guodong Jin <[email protected]> Co-authored-by: 囧囧 <[email protected]> Co-authored-by: Howe Wang <[email protected]> Co-authored-by: Royi Luo <[email protected]> Co-authored-by: xiyang <[email protected]> Co-authored-by: semihsalihoglu-uw <[email protected]>
- Loading branch information
1 parent
830169d
commit bc5e5c0
Showing
20 changed files
with
1,190 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
title: WebAssembly (Wasm) | ||
--- | ||
|
||
[WebAssembly](https://webassembly.org/), a.k.a. _Wasm_, is a standard defining any suitable low-level | ||
programming language as compilation target, enabling deployment of software within web browsers on a variety | ||
of devices. This page describes Kùzu's Wasm API, enabling Kùzu databases to run inside Wasm-capable | ||
browsers. | ||
|
||
## Benefits of WASM | ||
|
||
Several benefits of Kùzu-Wasm are the following: | ||
|
||
- Fast, in-browser graph analysis without ever sending data to a server. | ||
- Strong data privacy guarantees, as the data never leaves the browser. | ||
- Real-time interactive in-browser graph analytics and visualization. | ||
|
||
## Installation | ||
|
||
```bash | ||
npm i kuzu-wasm | ||
``` | ||
|
||
## Example usage | ||
|
||
We provide a simple example to demonstrate how to use Kùzu-Wasm. In this example, we will create a simple graph and run a few simple queries. | ||
|
||
We provide three versions of this example: | ||
- `browser_in_memory`: This example demonstrates how to use Kùzu-Wasm in a web browser with an in-memory filesystem. | ||
- `browser_persistent`: This example demonstrates how to use Kùzu-Wasm in a web browser with a persistent IDBFS filesystem. | ||
- `nodejs`: This example demonstrates how to use Kùzu-Wasm in Node.js. | ||
|
||
The example can be found in [the examples directory](https://github.com/kuzudb/kuzu/tree/master/tools/wasm/examples). | ||
|
||
## Understanding the package | ||
|
||
In this package, three different variants of WebAssembly modules are provided: | ||
- **Default**: This is the default build of the WebAssembly module. It does not support multi-threading and uses Emscripten's default filesystem. This build has the smallest size and works in both Node.js and browser environments. It has the best compatibility and does not require cross-origin isolation. However, the performance may be limited due to the lack of multithreading support. This build is located at the root level of the package. | ||
- **Multi-threaded**: This build supports multi-threading and uses Emscripten's default filesystem. This build has a larger size compared to the default build and only requires [cross-origin isolation](https://web.dev/articles/cross-origin-isolation-guide) in the browser environment. This build is located in the `multithreaded` directory. | ||
- **Node.js**: This build is optimized for Node.js and uses Node.js's filesystem instead of Emscripten's default filesystem (`NODEFS` flag is enabled). This build also supports multi-threading. It is distributed as a CommonJS module rather than an ES module to maximize compatibility. This build is located in the `nodejs` directory. Note that this build only works in Node.js and does not work in the browser environment. | ||
|
||
In each variant, there are two different versions of the WebAssembly module: | ||
- **Async**: This version of the module is the default version and each function call returns a Promise. This version dispatches all the function calls to the WebAssembly module to a Web Worker or Node.js worker thread to prevent blocking the main thread. However, this version may have a slight overhead due to the serialization and deserialization of the data required by the worker threads. This version is located at the root level of each variant (e.g., `kuzu-wasm`, `kuzu-wasm/multithreaded`, `kuzu-wasm/nodejs`). | ||
- **Sync**: This version of the module is synchronous and does not require any callbacks (other than the module initialization). This version is good for scripting / CLI / prototyping purposes but is not recommended to be used in GUI applications or web servers because it may block the main thread and cause unexpected freezes. This alternative version is located in the `sync` directory of each variant (e.g., `kuzu-wasm/sync`, `kuzu-wasm/multithreaded/sync`, `kuzu-wasm/nodejs/sync`). | ||
|
||
Note that you cannot mix and match the variants and versions. For example, a `Database` object created with the default variant cannot be passed to a function in the multithreaded variant. Similarly, a `Database` object created with the async version cannot be passed to a function in the sync version. | ||
|
||
### Loading the Worker script (for async versions) | ||
In each variant, the main module is bundled as one script file. However, the worker script is located in a separate file. The worker script is required to run the WebAssembly module in a Web Worker or Node.js worker thread. If you are using a build tool like Webpack, the worker script needs to be copied to the output directory. For example, in Webpack, you can use the `copy-webpack-plugin` to copy the worker script to the output directory. | ||
|
||
By default, the worker script is resolved under the same directory / URL prefix as the main module. If you want to change the location of the worker script, you can use pass the optional worker path parameter to the `setWorkerPath` function. For example: | ||
```javascript | ||
import kuzu from "kuzu-wasm"; | ||
kuzu.setWorkerPath('path/to/worker.js'); | ||
``` | ||
|
||
Note that this function must be called before any other function calls to the WebAssembly module. After the initialization is started, the worker script path cannot be changed and not finding the worker script will cause an error. | ||
|
||
For the Node.js variant, the worker script can be resolved automatically and you do not need to set the worker path. | ||
|
||
## API documentation | ||
The API documentation can be found here: | ||
|
||
**Synchronous** version: [API documentation](https://kuzudb.com/api-docs/wasm/sync/) | ||
|
||
**Asynchronous** version: [API documentation](https://kuzudb.com/api-docs/wasm/async/) | ||
|
||
## Local development | ||
|
||
This section is relevant if you are interested in contributing to Kùzu's Wasm API. | ||
|
||
First, build the WebAssembly module: | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
This will build the WebAssembly module in the `release` directory and create a tarball ready for publishing under the current directory. | ||
|
||
You can run the tests as follows: | ||
|
||
```bash | ||
npm test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.