[pbs-devel] [RFC v2 pxar 02/36] encoder: add optional output writer for file payloads
Fabian Grünbichler
f.gruenbichler at proxmox.com
Mon Mar 11 16:41:17 CET 2024
On March 11, 2024 2:50 pm, Christian Ebner wrote:
> On 3/11/24 14:21, Fabian Grünbichler wrote:
>> On March 5, 2024 10:26 am, Christian Ebner wrote:
>>
>> should we prevent/catch this being called multiple times?
>
> The attaching of the optional payload output being possible
> at any time and even multiple times is something Dietmar noticed as
> well.
>
> I will follow his suggestion here and add this as an optional parameter
> to the encoders `new` method, which will handle this better at the cost
> of breaking the API. Are there objections to that?
IMHO breaking the API here is fine, this whole series is not fully
compatible anyway already.. and setting it once at construction time and
not having a setter later on seems sensible for this, yes.
>> this part here and the read counter-part in the next commit basically
>> hard-code the format of this entry type, maybe that could be handled
>> nicer? e.g., construct a PayloadRef here, and let that implement the
>> conversion to/from data?
>>
>> it is a pre-existing pattern here though ;)
>>
>
> Okay, will have a look on how to handle the serialization in a more
> generic way, especially since the `PayloadRef` struct will be used
> later in the decoder anyway (therefore already have that), so it might
> make sense to e.g. have a trait for all pxar entry types to that
> guarantees the serialization methods.
>
> Is that what you had in mind here?
something like that (I mean, even a simple `fn data(&self)` would be
enough possibly?)
More information about the pbs-devel
mailing list