Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address inconsistency wrt return type of latest_offset/3 and expected type of :offset options. #184

Open
dantswain opened this issue Jan 20, 2017 · 0 comments

Comments

@dantswain
Copy link
Collaborator

This is a follow-up to #183. KafkaEx.latest_offset/3 and KafkaEx.earliest_offset/3 both return type [OffsetResponse.t] | :topic_not_found. On the other hand, functions like KafkaEx.fetch/3 and KafkaEx.stream/3 take an offset option that expects an integer offset.

Some options:

  1. No change
  2. Modify functions that accept an offset parameter to accept [OffsetResponse.t] OR an integer.
  3. Introduce new functions that accept the array-of-struct argument
  4. Introduce a new parameter name for the array-of-struct argument
  5. Change the latest_offset/3 and earliest_offset/3 functions to return integers.
  6. Introduce a helper function to turn [OffsetResponse.t] into a single integer, update the docs to make this usage more clear.

I think option 6 may be the best, followed by 2. 5 breaks the API and is probably not a good idea even though the current API is fairly unintuitive :/ 3 and 4 add complexity to existing functions without really clarifying things much. 2 introduces some incoherence, though it may be the most intuitive option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant