influxdata / line-protocol

MIT License
38 stars 10 forks source link

lineprotocol: remove NewDecoderAtSection #44

Closed rogpeppe closed 3 years ago

rogpeppe commented 3 years ago

This is a backwardly incompatible change, but I'm hoping that the release is new enough and this feature obscure enough to avoid problems.

NewDecoderAtSection has often been problematic when trying to get tests to pass. There are some awkward special cases in the code to deal with it, and a fix for issue #43 was going to require more special cases.

The functionality NewDecoderAtSection provides is really overly general for what's needed - I don't know of any concrete use case that requires decoding just the fields of a line-protocol line, for example. In some places, we might need to parse just the tags, but that can be implemented by a much more specific entry point that won't interact oddly with the rest of the decoding functionality.

So let's remove it, at least for now, which also allows us to remove the Section type itself from public view, simplifying the API further.

rogpeppe commented 3 years ago

However, do we know if this is being used anywhere?

I don't think it's possible to tell in general. I think we should land it and if anyone squawks, we can potentially reconsider.