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

godoc: Minor API doc edits. Timestamps are Unix milliseconds. #1111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

evanj
Copy link
Contributor

@evanj evanj commented Dec 1, 2023

This is a collection of minor API documentation edits I noticed while using ListOffsets. Notably: I had to look around to figure out that timestamps are Unix milliseconds.

Detailed edits:

  • OffsetSpec: Reference defined constants and NewOffsetSpecForTimestamp. Attempt to clarify the constants using the wording from Java: https://kafka.apache.org/26/javadoc/org/apache/kafka/clients/admin/OffsetSpec.html
  • NewOffsetSpecForTimestamp: Rename parameter and clarify that timestamps are in Unix milliseconds.
  • ListOffsetsResultInfo: Timestamp is in Unix milliseconds.
  • ListOffsetsResult: Fix TopicPartiton typo. Clarify that this returns offsets for many TopicPartitions. Document how to create a valid OffsetSpec.
  • Consumer.OffsetsForTimes: Timestamps are Unix milliseconds.
  • Error: Document that Code() == ErrNoError is not an error.
  • Error.Error(): Separate two sentences so they are not incorrectly combined by godoc e.g. here: https://pkg.go.dev/github.com/confluentinc/confluent-kafka-go/v2@v2.3.0/kafka#Error.Error
  • ErrorCode: Document that ErrNoError is success.
  • offsets.go offsetsForTimes: Copy doc from Consumer.OffsetsForTimes.
  • Producer.OffsetsForTimes: Copy doc from Consumer.OffsetsForTimes.

This is a collection of minor API documentation edits I noticed while
using ListOffsets. Notably: I had to look around to figure out that
timestamps are Unix milliseconds.

Detailed edits:

* OffsetSpec: Reference defined constants and
  NewOffsetSpecForTimestamp. Attempt to clarify the constants using
  the wording from Java:
  https://kafka.apache.org/26/javadoc/org/apache/kafka/clients/admin/OffsetSpec.html
* NewOffsetSpecForTimestamp: Rename parameter and clarify that
  timestamps are in Unix milliseconds.
* ListOffsetsResultInfo: Timestamp is in Unix milliseconds.
* ListOffsetsResult: Fix TopicPartiton typo. Clarify that this
  returns offsets for many TopicPartitions. Document how to create a
  valid OffsetSpec.
* Consumer.OffsetsForTimes: Timestamps are Unix milliseconds.
* Error: Document that Code() == ErrNoError is not an error.
* Error.Error(): Separate two sentences so they are not incorrectly
  combined by godoc e.g. here:
  https://pkg.go.dev/github.com/confluentinc/confluent-kafka-go/v2@v2.3.0/kafka#Error.Error
* ErrorCode: Document that ErrNoError is success.
* offsets.go offsetsForTimes: Copy doc from Consumer.OffsetsForTimes.
* Producer.OffsetsForTimes: Copy doc from Consumer.OffsetsForTimes.
@evanj
Copy link
Contributor Author

evanj commented Dec 1, 2023

This conflicts with #1109 because it edits the documentation of some constants. I think that PR should be merged first, then I will rebase and/or fix the merge conflicts here (whatever you prefer).

@milindl milindl self-requested a review December 3, 2023 12:10
Copy link
Contributor

@milindl milindl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good to me.
If you want, I can merge in the changes from master (both merge and rebase are OK with me if you prefer doing it.)

Thanks for this change, it's helpful.

Comment on lines +1014 to +1015
func NewOffsetSpecForTimestamp(timestamp_ms int64) OffsetSpec {
return OffsetSpec(timestamp_ms)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func NewOffsetSpecForTimestamp(timestamp_ms int64) OffsetSpec {
return OffsetSpec(timestamp_ms)
func NewOffsetSpecForTimestamp(timestampMs int64) OffsetSpec {
return OffsetSpec(timestampMs)

(nit)

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

Successfully merging this pull request may close these issues.

None yet

2 participants