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
- SQLiteMetadataStore: ../packages/engine-server/src/drivers/SQLiteMetadataStore.ts (Private) - this provides metada via SQLite
- 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 theIDataStoreinterface doesn't have aninitmethod): 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 pull request
Cookbook
Check if SQLite is enabled
- you can verify that sqlite is enabled by checking for some of the following cues:
metadata.dbexists in your workspace root- checking for the following in
dendron.server.log:checking if sql is initialized...- this will only print if
sqliteis enabled -
NOTE: this won't be available when developing because we don't output the
dendron.server.logfile 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)