mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 04:25:31 +08:00
8d21d89f0a
Summary: Previously we stored message bodies uncompressed inside two different databases. This was bad for a few reasons: * Duplicate data in multiple places is an obvious waste of disk space * Uncompressed data also made the disk footprint bigger than it might otherwise be * Storing these large message bodies in the database made the db file larger than it otherwise could have been, increasing the size of tables and slowing down queries. This diff adds support for storing message bodies outside of the database in compressed flat files. It changes the use of the body column in the K2 database and the MessageBody table in the edgehill database to contain a blob of JSON that contains a path to the file on disk. We use the new format in an incremental fashion without having to perform an actual database migration by first checking if the body matches our expected JSON format and treating it appropriately if it doesn't. Both databases refer to the same file on disk, thus deduplicating the messages bodies. We also transparently support gzipping the message bodies stored on disk when we read from/write to the files. The real world space savings depends on the compressibility of the messages, but we've seen up to ~60% improvement in disk space usage for certain inboxes. Typical savings are closer to 20%. Also, by storing messages as separate files on disk we can potentially integrate with Spotlight search at some point in the future. Test Plan: Run locally, make sure that upgrade to this doesn't hose things, look at size of DB, read emails Reviewers: evan, spang, halla, juan Reviewed By: halla, juan Differential Revision: https://phab.nylas.com/D4422 |
||
---|---|---|
.. | ||
spec | ||
src | ||
index.js | ||
package.json | ||
README.md |
Isomorphic Core
Isomorphic refers to javascript that can be run on both the client and the server.
This is shared code for mail and utilities that is designed to run both on deployed cloud servers and from within the Nylas Mail client.
Use through a regular import: import iso-core from 'isomorphic-core'
It is required as a dependency in the package.json of other modules.
This library isn't on the npm registry, but works as a dependency thanks to
lerna bootstrap
See index.js for what gets explicitly exported by this library.
Important Usage Notes:
Since this code runs in both the client and the server, you must be careful with what libraries you use. Some common gotchas:
- You can't use
NylasEnv
orNylasExports
. These are injected only in the client. - If you require a 3rd party library, it must be added to the "dependencies" of
isomorphic-core's
package.json
- You may use modern javascript syntax. Both the client and server get compiled with the same .babelrc setting