refdb - abstract reference reading/writing (not for merge)

not for merge, probably.