workerutil: Make generic store
Created by: efritz
When implementing the VM-based code intel indexer (progress in https://github.com/sourcegraph/sourcegraph/pull/12723), I realized that I needed to copy all of the functionality of the workerutil Worker but targeting a different non-database persistence layer (it polls an API rather than Postgres).
This PR moves some code around to make it possible to supply small "shims" around persistence layers for use by the worker.
Summary of changes:
- Create a more generic "Handler" and "Store" interface in the workerutil package. The handler changes only in the type of the (transactional) store argument it accepts, and the store is a subset of the database store that's used by the worker.
- Move the store and database-specific handlers into a dbworker package.
- Create a "refined" handler and store for the database layer.
- Add small shims to translate db handler into a generic handler, and a generic store into a db store.
- Update uses (code intel worker and indexer; campaigns reconciler)