refdb - abstract reference reading/writing

An abstraction on ref storage allows for pluggable ref backends and includes a standard filesystem based ref storage mechanism that allows for loose and packed refs.

- [x] unit tests
- [x] docs in the `.h`

cc @jwiegley