From: Patrick Steinhardt Date: Wed, 22 Apr 2026 11:15:57 GMT Subject: Re: [PATCH 6/8] refs: move object parsing to the generic layer Message-ID: In-Reply-To: <20260420-refs-move-to-generic-layer-v1-6-513e354f376b@gmail.com> On Mon, Apr 20, 2026 at 12:12:04PM +0200, Karthik Nayak wrote: > Regular reference updates made via reference transactions validate that > the provided object ID exists in the object database, this is done by s/this/which/ > calling 'parse_object()'. This check is done independently by the > backends. ..., which leads to duplicated logic. > Let's move this to the generic layer, ensuring the backends only have to > care about reference storage and not about validation of the object IDs. > With this also remove the 'REF_TRANSACTION_ERROR_INVALID_NEW_VALUE' > error type as its no longer used. > > Since we don't iterate over individual references in > `ref_transaction_prepare()`, we add this check to > `ref_transaction_update()`. This means that the validation is done as > soon as an update is queued, without needing to prepare the > transaction. It can be argued that this is more ideal, since this > validation has no dependency on the reference transaction being > prepared. > > It must be noted that the change in behavior means that this error > cannot be ignored even with usage of batched updates, since this happens > when the update is being added to the transaction. But since the caller > gets specific error codes, they can either abort the transaction or > continue adding other updates to the transaction. Right, this is what the preceding commits have allowed us to do. I think this is a good step. Being less entangled with the object database in the ref backends is a good thing. Patrick