Support storing key-value data in partitions
Gitaly gains a key-value store as part of transactions. Transaction's themselves use the key-value store already for few things:
- Storing the applied LSN of a partition
- Storing the partition assignment table mapping repositories to the partition's they belong
While we are already storing the partition assignment table in the database, the writes into it don't go through the usual write-ahead logging all other writes do. This is an issue as the writes that don't go through the partition's write-ahead log are wouldn't be backed up as part of it, and they are not atomic with the other writes performed in the partition.
We'll also soon need to store other generic key-value data in the partitions that is not owned by the transaction logic. First user of such data will be Implement basic support for repository migrations (#5758). There we will store information on which migrations have been applied to which repositories in a given partition, and use this state to determine which migrations need to be applied before the client's are allowed to operate on the repositories.
Let's implement support for writing generic key-value data into the partition as part of a transaction. We'll support setting and deleting keys along with conflict checking the writes.