Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
Electron, Databases,
and RxDB
An overview of Electron data storage options,
and a new observable object store.
@bengotow
I want to build Evernote with Electron.

How should I store user’s data?
“Notes”
Recent Notes
Full-text Search Edit Note
• One user, their persistent filesystem
• For small datasets (<1,000 items), loading /
saving JSON and filtering it in memor...
• Chrome has great key-value storage options,
and we can manually maintain indexes.
Do I need a relational
database?
KEY V...
LocalStorage
• Synchronous
• Strings only
• Retrieve keys
• <10MB (#8337)
Key Value Storage
IndexedDB
• Sync or async
• St...
• But… I need full-text search
• But… I want to query and sort by arbitrary fields
• But… I want to support millions of not...
• De-facto standard for relational storage in client-
side applications (macOS, iOS, Android, etc.)
• Builds everywhere, n...
SQLite + ORM
SQLite + ORM
But… for Electron?
• Most JavaScript database wrappers were built
for server-side NodeJS.
• Heavy focus on querying, conne...
• CoreData (iOS): NSFetchedResultsController
• YapDatabase (iOS): YapDatabaseView
• AndroidSQLite (Android): View “Cursors...
Electron-RxDB
• Observable object store built on SQLite:
CoreData for Electron
• Built to power the Nylas N1 mail client,
...
Define a Note
Save a Note
Query for Notes
Create a Notes view
Create a Notes view
• Database is an EventEmitter, broadcasts events
when transactions are committed.
• Queries return RxJS Observables that e...
Nylas N1
• RxDB provides live “slices” of 1GB+ of mail data
• Views bind to Flux / Redux stores for application
state, RxD...
Built for Electron
• Multi-window support
• Always builds SQLite for Electron
• Example Electron app: “Notes”
Thanks!
bengotow/electron-RxDB
@bengotow
Nächste SlideShare
Wird geladen in …5
×

von

Electron, databases, and RxDB Slide 1 Electron, databases, and RxDB Slide 2 Electron, databases, and RxDB Slide 3 Electron, databases, and RxDB Slide 4 Electron, databases, and RxDB Slide 5 Electron, databases, and RxDB Slide 6 Electron, databases, and RxDB Slide 7 Electron, databases, and RxDB Slide 8 Electron, databases, and RxDB Slide 9 Electron, databases, and RxDB Slide 10 Electron, databases, and RxDB Slide 11 Electron, databases, and RxDB Slide 12 Electron, databases, and RxDB Slide 13 Electron, databases, and RxDB Slide 14 Electron, databases, and RxDB Slide 15 Electron, databases, and RxDB Slide 16 Electron, databases, and RxDB Slide 17 Electron, databases, and RxDB Slide 18 Electron, databases, and RxDB Slide 19 Electron, databases, and RxDB Slide 20 Electron, databases, and RxDB Slide 21
Nächste SlideShare
Manual de practicas de soldadura
Weiter
Herunterladen, um offline zu lesen und im Vollbildmodus anzuzeigen.

4 Gefällt mir

Teilen

Herunterladen, um offline zu lesen

Electron, databases, and RxDB

Herunterladen, um offline zu lesen

An overview of Electron data storage options (IndexedDB, LocalStorage, SQLite), and a new observable object store.

Ähnliche Bücher

Kostenlos mit einer 30-tägigen Testversion von Scribd

Alle anzeigen

Ähnliche Hörbücher

Kostenlos mit einer 30-tägigen Testversion von Scribd

Alle anzeigen

Electron, databases, and RxDB

  1. 1. Electron, Databases, and RxDB An overview of Electron data storage options, and a new observable object store. @bengotow
  2. 2. I want to build Evernote with Electron.
 How should I store user’s data?
  3. 3. “Notes” Recent Notes Full-text Search Edit Note
  4. 4. • One user, their persistent filesystem • For small datasets (<1,000 items), loading / saving JSON and filtering it in memory is fine. Do I need a database?
  5. 5. • Chrome has great key-value storage options, and we can manually maintain indexes. Do I need a relational database? KEY VALUE A {“name”:”My first document.. B {“name”:”Another note… C {“name”: “Favorite note… RECENT_IDS [“B”, “C”]
  6. 6. LocalStorage • Synchronous • Strings only • Retrieve keys • <10MB (#8337) Key Value Storage IndexedDB • Sync or async • Strings, JSON • Retrieve keys, ranges • Indexed scan for key • < 1/3 free disk space Or use the Filesystem!
  7. 7. • But… I need full-text search • But… I want to query and sort by arbitrary fields • But… I want to support millions of notes • But… I may need more than 1/3 of the available disk space. (IndexedDB limit) 🤔
  8. 8. • De-facto standard for relational storage in client- side applications (macOS, iOS, Android, etc.) • Builds everywhere, no dependencies • Simple, fast, reliable • Open source, great documentation
  9. 9. SQLite + ORM
  10. 10. SQLite + ORM
  11. 11. But… for Electron? • Most JavaScript database wrappers were built for server-side NodeJS. • Heavy focus on querying, connection pools, etc., limited APIs for connecting models to views.
  12. 12. • CoreData (iOS): NSFetchedResultsController • YapDatabase (iOS): YapDatabaseView • AndroidSQLite (Android): View “Cursors” “Give me the notes matching this query, and let me know if the results change.”
  13. 13. Electron-RxDB • Observable object store built on SQLite: CoreData for Electron • Built to power the Nylas N1 mail client, tuned for performance
  14. 14. Define a Note
  15. 15. Save a Note Query for Notes
  16. 16. Create a Notes view
  17. 17. Create a Notes view
  18. 18. • Database is an EventEmitter, broadcasts events when transactions are committed. • Queries return RxJS Observables that emit new result sets as transactions are committed.
 
 • Optimizations prevent RxDB from re-running SQL queries in common cases SQLite 💖 RxJS
  19. 19. Nylas N1 • RxDB provides live “slices” of 1GB+ of mail data • Views bind to Flux / Redux stores for application state, RxDB queries for data. • Many features (mail rules, notifications, etc.) implemented with database listeners.
  20. 20. Built for Electron • Multi-window support • Always builds SQLite for Electron • Example Electron app: “Notes”
  21. 21. Thanks! bengotow/electron-RxDB @bengotow
  • JakobSchindegger

    Feb. 10, 2018
  • rafalszulczewski

    Mar. 8, 2017
  • fajaryan

    Jan. 22, 2017
  • hoghweed

    Jan. 21, 2017

An overview of Electron data storage options (IndexedDB, LocalStorage, SQLite), and a new observable object store.

Aufrufe

Aufrufe insgesamt

4.675

Auf Slideshare

0

Aus Einbettungen

0

Anzahl der Einbettungen

5

Befehle

Downloads

14

Geteilt

0

Kommentare

0

Likes

4

×