Introduce reference transactions

A transaction allows you to lock multiple references and set up changes
for them before applying the changes all at once (or as close as the
backend supports).

This can be used for replication purposes, or for making sure some
operations run when the reference is locked and thus cannot be changed.
reflog: constify byindex
signature: add a dup function which takes a pool

This will be used by the transaction code.
wip reflog
transaction: use the signature's pool dup function

This allows us to remove the freeing loop and instead simply free the
pool.
now with reflogs