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

Make instances public, add fs2Kafka prefix to their names #473

Merged
merged 3 commits into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package fs2.kafka

import cats.instances.list._
import cats.syntax.show._
import fs2.kafka.internal.instances._
import fs2.kafka.instances._
import fs2.kafka.internal.syntax._
import org.apache.kafka.clients.consumer.OffsetAndMetadata
import org.apache.kafka.common.{KafkaException, TopicPartition}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package fs2.kafka
import cats.instances.list._
import cats.instances.string._
import cats.syntax.show._
import fs2.kafka.internal.instances._
import fs2.kafka.instances._
import fs2.kafka.internal.syntax._
import org.apache.kafka.clients.consumer.OffsetAndMetadata
import org.apache.kafka.common.{KafkaException, TopicPartition}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import cats.ApplicativeError
import cats.instances.string._
import cats.Show
import cats.syntax.show._
import fs2.kafka.internal.instances._
import fs2.kafka.instances._
import org.apache.kafka.clients.consumer.OffsetAndMetadata
import org.apache.kafka.common.TopicPartition

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import cats.instances.list._
import cats.syntax.foldable._
import cats.syntax.show._
import cats.{Applicative, Foldable, Show}
import fs2.kafka.internal.instances._
import fs2.kafka.instances._
import fs2.kafka.internal.syntax._
import org.apache.kafka.clients.consumer.OffsetAndMetadata
import org.apache.kafka.common.TopicPartition
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/fs2/kafka/KafkaConsumer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import fs2.{Chunk, Stream}
import fs2.concurrent.{NoneTerminatedQueue, Queue}
import fs2.kafka.internal._
import fs2.kafka.internal.converters.collection._
import fs2.kafka.internal.instances._
import fs2.kafka.instances._
import fs2.kafka.internal.KafkaConsumerActor._
import fs2.kafka.internal.syntax._
import fs2.kafka.consumer._
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/fs2/kafka/ProducerResult.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package fs2.kafka
import cats.syntax.show._
import cats.Show
import fs2.Chunk
import fs2.kafka.internal.instances._
import fs2.kafka.instances._
import fs2.kafka.internal.syntax._
import org.apache.kafka.clients.producer.RecordMetadata

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package fs2.kafka.internal
package fs2.kafka

import cats.instances.int._
import cats.instances.long._
Expand All @@ -16,29 +16,29 @@ import org.apache.kafka.clients.consumer.OffsetAndMetadata
import org.apache.kafka.clients.producer.RecordMetadata
import org.apache.kafka.common.TopicPartition

private[kafka] object instances {
implicit val offsetAndMetadataOrder: Order[OffsetAndMetadata] =
object instances {
implicit val fs2KafkaOffsetAndMetadataOrder: Order[OffsetAndMetadata] =
Order.by(oam => (oam.offset, oam.metadata))

implicit val offsetAndMetadataOrdering: Ordering[OffsetAndMetadata] =
implicit val fs2KafkaOffsetAndMetadataOrdering: Ordering[OffsetAndMetadata] =
Order[OffsetAndMetadata].toOrdering

implicit val offsetAndMetadataShow: Show[OffsetAndMetadata] =
implicit val fs2KafkaOffsetAndMetadataShow: Show[OffsetAndMetadata] =
Show.show { oam =>
if (oam.metadata.nonEmpty)
show"(${oam.offset}, ${oam.metadata})"
else oam.offset.show
}

implicit val recordMetadataShow: Show[RecordMetadata] =
implicit val fs2KafkaRecordMetadataShow: Show[RecordMetadata] =
Show.show(rm => show"${rm.topic}-${rm.partition}@${rm.offset}")

implicit val topicPartitionOrder: Order[TopicPartition] =
implicit val fs2KafkaTopicPartitionOrder: Order[TopicPartition] =
Order.by(tp => (tp.topic, tp.partition))

implicit val topicPartitionOrdering: Ordering[TopicPartition] =
implicit val fs2KafkaTopicPartitionOrdering: Ordering[TopicPartition] =
Order[TopicPartition].toOrdering

implicit val topicPartitionShow: Show[TopicPartition] =
implicit val fs2KafkaTopicPartitionShow: Show[TopicPartition] =
Show.show(tp => show"${tp.topic}-${tp.partition}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import fs2.Chunk
import fs2.concurrent.Queue
import fs2.kafka._
import fs2.kafka.internal.converters.collection._
import fs2.kafka.internal.instances._
import fs2.kafka.instances._
import fs2.kafka.internal.KafkaConsumerActor._
import fs2.kafka.internal.LogEntry._
import fs2.kafka.internal.syntax._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import cats.data.{Chain, NonEmptyList, NonEmptySet, NonEmptyVector}
import cats.implicits._
import fs2.Chunk
import fs2.kafka.CommittableConsumerRecord
import fs2.kafka.internal.instances._
import fs2.kafka.instances._
import fs2.kafka.internal.KafkaConsumerActor._
import fs2.kafka.internal.LogLevel._
import fs2.kafka.internal.syntax._
Expand Down