"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: gotd: initial implementation of the delete-refs capability
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Fri, 27 Jan 2023 18:09:50 +0100

Download raw body.

Thread
On Fri, Jan 27, 2023 at 05:37:26PM +0100, Omar Polo wrote:
> This makes "got send -d" works against gotd.
> 
> The idea is that, if a server supports this capability, clients can
> delete references by sending a zero-id value as the target value of
> the update.

The client actually sends an old-id and a new zero-id.
 
> I'm not 100% sure the locking is right, but it resambles the update
> case so maybe it is.

After locking, gotd should resolve the ref to obtain its current ID,
and not delete if current ID != old ID sent by the client.
Otherwise, during a race, one client would silently win over another.
 
> There are some improvements that we can do on top of this:
> 
>  - the ref_is_new and delete_ref fields of the struct
>    gotd{,_imsg}_ref_update could be merged in a single field using an
>    enum, and

Not worth it, I would say. Just keep two flags.
 
>  - as a special case (but it's actually the more common one I guess),
>    the session process could avoid sending the fds for the pack idx
>    and data when a client is only deleting references.

Not sure. Just keep sending them for now, so we have less special cases.