-
Notifications
You must be signed in to change notification settings - Fork 6
How to create a new JDBC back end
John Sullivan edited this page Feb 7, 2017
·
4 revisions
- First, try the SQLite back end. You can set
longevity.jdbc.driverClass
to be whatever you want. - Wait for something to go wrong. (If you are going to be using optimistic locking, something silly is going to go wrong pretty early on. Other than this, I can't think of anything that will go wrong, but something probably will.)
- Talk to us about it on the message board or on Gitter.
- Add your back end into the build
- Add your driver as a
ModuleId
intoproject/Dependencies.scala
- Add your driver as both an optional and test dependency in the
longevity
project inbuild.sbt
- Create an SBT sub-project
longevityYourBackEndDeps
that mirrorslongevitySqliteDeps
- Add your SBT sub-project to the
aggregate
clause for theroot
project
- Add your driver as a
- Add a new
longevity.config.BackEnd
for your JDBC driver. - Copy the entire package
longevity.persistence.sqlite
intolongevity.persistence.yourBackEnd
. rename everything fromSQLite
toYourBackEnd
accordingly. (Including in the scaladoc.) - Copy/paste SQLite code in
longevity.persistence.RepoPoolBuilder
to your back end.- There is a lot of duplication in this source file! If you could help us clean this up we would greatly appreciate it!
- Now, figure out which parts of
longevity.persistence.jdbc
need to be changed to fix your problem. Your fixes are most likely going to diverge from what is needed by SQLite. So push down the code in question intoSQLiteRepo
andYourBackEndRepo
, leaving behind something abstract inJdbcRepo
. - Run the tests. You will need to have MongoDB and Cassandra installed for them to run. See the Developer Setup page for details.
- By virtue of adding your own
BackEnd
, a lot of the tests will pick up your back end automatically. If you get a lot of errors and want to narrow things down a bit to clear problems, I typically start withtest-only longevity.integration.domain.basics.*
. - There are some tests that you will have to add - see specifically:
longevity.integration.duplicateKeyVal
longevity.integration.poly
longevity.integration.queries
longevity.integration.unstablePartitionKey
longevity.integration.writeConflict
- It would really be nice if more of these tests would just automatically adapt to a new back end. If you could add that in for us, we would be eternally grateful!