[pbs-devel] [RFC v2 pxar 09/36] encoder: add payload advance capability

Christian Ebner c.ebner at proxmox.com
Mon Mar 11 16:41:48 CET 2024


> On 11.03.2024 16:27 CET Fabian Grünbichler <f.gruenbichler at proxmox.com> wrote:
> 
> 
> what I mean is - when you read this you encode it as PayloadOffset. when
> you advance it to skip (ahead) to a certain offset, it's now a regular
> u64.
> 
> I know the (only) input here (at the moment!) is chunk size(s), but what
> effectively happens is you tell the encoder "advance by offset X", so we
> might as well mark it as such in the interface, and force callers to
> think "hey, does it make sense to cast/wrap the u64 I have here as an
> offset in payload context?" (which it does when we want to let the
> encoder skip ahead by X chunks)
> 

Okay, yes I see your point.

> > I was thinking of adding the chunks themself as parameters, this would however
> > require to expose that type to the pxar crate, so I opted for keeping this as
> > unsigned integer. Maybe I should construct a dedicated type just for this?
> 
> I think it's fine to just pass the value by which we want to advance, I
> just wonder whether it doesn't make sense to refer to it as
> PayloadOffset across the board and internally, to make it clear at the
> pxar <-> rest interface what meaning this u64 has, to avoid confusing it
> with the other (wrapped or unwrapped) u64 values we have all around.

Okay, I will wrap this as well then




More information about the pbs-devel mailing list