zstd: add ResetWithOptions #1110
Replies: 2 comments 2 replies
-
|
Quite reasonable suggestion. One question I don't have an immediate answer to is whether options are applied to default settings or to the existing ones. Since you say "changing options", I assume your thoughts are towards to the latter. Current internal Reset functionality relies on options not changing, so doing options "from scratch" would probably be quite involved. If we apply options to current settings it would also allow us to selectively support options... For example... func WithLowerEncoderMem(b bool) EOption {
return func(o *encoderOptions) error {
// When changing an option on a reset o.resetOpt will be true.
if o.resetOpt && b != o.lowMem {
return fmt.Errorf("cannot change lower encoder memory setting on Reset")
}
o.lowMem = b
return nil
}
}From an API perspective, I would slightly prefer that reset options would make you end up with a Writer that would be similar to one created with those options. I am thinking if there is a way to make it clearer from the method name... |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Thank you for the module.
Right now, there is the following methods:
which are useful for reusing an existing coder.
I have a particular application, where I need to change the RawDict based on context. At present, you need to construct an entirely new coder using
NewReaderorNewWriter.Could we provide a
Resetthat allows changing options?Beta Was this translation helpful? Give feedback.
All reactions