This is useful because the upcoming configuration database also needs a lockfile implementation. Also adds tests.