Separate SQLite code from Repo code
commit2313620c1661181d0e088ddac02277457cbfd405
authorJeff Hemphill <jhemphill@fb.com>
Wed, 3 Jul 2019 03:11:39 +0000 (2 20:11 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 3 Jul 2019 03:14:55 +0000 (2 20:14 -0700)
tree4023972d3ad83b3a25663c7affd298b83462dac7
parent1627d43e85d85b6c82b4cd37a1f5c018e48c4a96
Separate SQLite code from Repo code

Summary:
My native autoloader stores data in a SQLite database for fast cold starts and CLI standalone performance. HHVM already uses SQLite to cache bytecode. These SQLite DBs are the `.hhbc` and `.hhbbc` files managed by the `Repo` class. I originally tried storing my autoloader information in the `.hhbc` DB, but this led to terrible performance. SQLite only allows one thread or process to write to a DB at a given time, and the autoloader and unit emitter fought with each other for the ability to write to the DB.

The `Repo` class provides a fairly clean, opinionated, RAII-style wrapper around SQLite. I really liked that, so here I've abstracted the bits that aren't specific to `.hhbc` into a new `SQLite` class. In theory, we can make the `Repo` class depend on this `SQLite` class to reduce the duplication, but I'm more interested in just using this class to power the native autoloader for the time being.

Reviewed By: paulbiss

Differential Revision: D15562623

fbshipit-source-id: c53e9a1a186c354d0d24cec7f5fd5d3026e377ae
hphp/util/sqlite-wrapper-helpers.h [new file with mode: 0644]
hphp/util/sqlite-wrapper.cpp [new file with mode: 0644]
hphp/util/sqlite-wrapper.h [new file with mode: 0644]
hphp/util/test/sqlite-wrapper.cpp [new file with mode: 0644]