Sqlite
Quickstart
- to enable sqlite, see dendron.topic.workspace.sqlite (Private)
-
NOTE: this only works for enginev2 today and not enginev3
Architecture
Store initialization Diagram
NOTE: this is implemented for
enginev2
. it has not yet been implemented forenginev3
Code Flow
- How enginev2 initializes with SQLite: Init
Relevant Files
- ../packages/engine-server/src/drivers/SQLiteMetadataStore.ts (Private) - this provides metada via SQLite SQLiteMetadataStore:
- Prisma Schema: ../packages/engine-server/prisma/schema.prisma (Private) - what is currently indexed at startup
Dependencies
Details
Download Binaries
If prisma binaries aren't in place and sqlite
is enabled, Dendron will download them to ~/.dendron/
. Some implementation details to consider:
-
download happens in the constructore of the
SQLiteMetadataStore
(this is not ideal especially if it gets instaitated multiple times - we do this because theIDataStore
interface doesn't have aninit
method): https://github.com/dendronhq/dendron/blob/master/packages/engine-server/src/drivers/SQLiteMetadataStore.ts#L56:L56- in case there is a network issue with the download, we have a circuit breaker that will kill the download
- the actual binaries are uploaded to an S3 bucket that is fronted by cloudfront (s3 download speed too slow otherwise, 20MB = 10min)
-
NOTE: in order for this to work with webpack, we also implement various shims which are detailed in this
Cookbook
Check if SQLite is enabled
- you can verify that sqlite is enabled by checking for some of the following cues:
metadata.db
exists in your workspace root- checking for the following in
dendron.server.log
:checking if sql is initialized...
- this will only print if
sqlite
is enabled -
NOTE: this won't be available when developing because we don't output the
dendron.server.log
file in the dev environment
- this will only print if
Related
-
public docs: dendron.topic.workspace.sqlite (Private)
-
init logic:
- v3: V3
-
prisma logic: Prisma
-
data model: Dendron Data Model 2 0 (Private)
-
query: leaflet.journal.2022.10.12.engine-query-architecture (Private)
-
browser store: proj.2022.06-store-refactor.design.browser-node-env (Private)
-
engine v3 arch: user.jonathan.research.engine-v3-architecture (Private)
-
tasks
- initial sqlite implementation: task.2022.07.30.sqlite-backend (Private)