Skip to content

Commit

Permalink
Changes II
Browse files Browse the repository at this point in the history
  • Loading branch information
aartigao committed Oct 28, 2023
1 parent 3b0134d commit 5569d79
Show file tree
Hide file tree
Showing 61 changed files with 98 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ rewrite.redundantBraces.maxLines = 1
rewrite.redundantBraces.stringInterpolation = true

# Ensure consistent ordering for imports
rewrite.imports.sort = ascii
rewrite.imports.sort = original
rewrite.imports.groups = [
["java\\..*"],
["scala\\..*"],
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/fs2/kafka/CommitRecovery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ package fs2.kafka

import scala.concurrent.duration.*

import cats.Functor
import cats.effect.Temporal
import cats.syntax.applicativeError.*
import cats.syntax.flatMap.*
import cats.syntax.functor.*
import cats.Functor

import org.apache.kafka.clients.consumer.{OffsetAndMetadata, RetriableCommitFailedException}
import org.apache.kafka.common.TopicPartition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

package fs2.kafka

import cats.{Applicative, Bitraverse, Eq, Eval, Show, Traverse}
import cats.syntax.bifoldable.*
import cats.syntax.bitraverse.*
import cats.syntax.eq.*
import cats.syntax.foldable.*
import cats.syntax.functor.*
import cats.syntax.show.*
import cats.syntax.traverse.*
import cats.{Applicative, Bitraverse, Eq, Eval, Show, Traverse}

/**
* [[CommittableConsumerRecord]] is a Kafka record along with an instance of [[CommittableOffset]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

package fs2.kafka

import cats.{ApplicativeError, Eq, Show}
import cats.instances.string.*
import cats.syntax.show.*
import cats.{ApplicativeError, Eq, Show}
import fs2.kafka.instances.*

import org.apache.kafka.clients.consumer.OffsetAndMetadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

package fs2.kafka

import cats.ApplicativeError
import cats.{Applicative, Foldable, Show}
import cats.instances.list.*
import cats.syntax.foldable.*
import cats.syntax.show.*
import cats.{Applicative, Foldable, Show}
import cats.ApplicativeError
import fs2.kafka.instances.*
import fs2.kafka.internal.syntax.*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

package fs2.kafka

import cats.{Applicative, Bitraverse, Eq, Eval, Foldable, Show, Traverse}
import cats.syntax.bifoldable.*
import cats.syntax.bitraverse.*
import cats.syntax.eq.*
import cats.syntax.foldable.*
import cats.syntax.functor.*
import cats.syntax.show.*
import cats.syntax.traverse.*
import cats.{Applicative, Bitraverse, Eq, Eval, Foldable, Show, Traverse}
import fs2.Chunk
import fs2.kafka.internal.syntax.*
import fs2.Chunk

/**
* [[CommittableProducerRecords]] represents zero or more [[ProducerRecord]]s and a
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/fs2/kafka/ConsumerRecord.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

package fs2.kafka

import cats.syntax.all.*
import cats.{Applicative, Apply, Bitraverse, Eq, Eval, Show, Traverse}
import cats.syntax.all.*
import fs2.kafka.internal.syntax.*

import org.apache.kafka.clients.consumer.ConsumerRecord.{NO_TIMESTAMP, NULL_SIZE}
Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/main/scala/fs2/kafka/ConsumerSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

package fs2.kafka

import scala.concurrent.ExecutionContext
import scala.concurrent.duration.*
import scala.concurrent.ExecutionContext

import cats.Show
import cats.effect.Resource
import cats.Show
import fs2.kafka.security.KafkaCredentialStore

import org.apache.kafka.clients.consumer.ConsumerConfig
Expand Down
6 changes: 2 additions & 4 deletions modules/core/src/main/scala/fs2/kafka/Deserializer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ package fs2.kafka
import java.nio.charset.{Charset, StandardCharsets}
import java.util.UUID

import cats.MonadError
import cats.effect.{Resource, Sync}
import cats.syntax.all.*
import cats.MonadError

/**
* Functional composable Kafka key- and record deserializer with support for effect types.
Expand Down Expand Up @@ -96,9 +96,7 @@ object GenericDeserializer {
* Creates a new [[Deserializer]] which always fails deserialization with the specified exception
* `e`.
*/
def fail[F[_], A](e: Throwable)(implicit
F: Sync[F]
): Deserializer[F, A] =
def fail[F[_], A](e: Throwable)(implicit F: Sync[F]): Deserializer[F, A] =
Deserializer.lift(_ => F.raiseError(e))

/**
Expand Down
6 changes: 2 additions & 4 deletions modules/core/src/main/scala/fs2/kafka/Header.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

package fs2.kafka

import cats.{Eq, Show}
import cats.instances.string.*
import cats.syntax.eq.*
import cats.{Eq, Show}

/**
* [[Header]] represents a `String` key and `Array[Byte]` value which can be included as part of
Expand Down Expand Up @@ -61,9 +61,7 @@ object Header {
* Creates a new [[Header]] instance using the specified `String` key and value of type `V`,
* which is going to be serialized with the implicit `HeaderSerializer`.
*/
def apply[V](key: String, value: V)(implicit
serializer: HeaderSerializer[V]
): Header =
def apply[V](key: String, value: V)(implicit serializer: HeaderSerializer[V]): Header =
new HeaderImpl(
key = key,
value = serializer.serialize(value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import java.util.UUID

import scala.annotation.tailrec

import cats.syntax.either.*
import cats.{Eval, Monad}
import cats.syntax.either.*

/**
* [[HeaderDeserializer]] is a functional deserializer for Kafka record header values. It's similar
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/fs2/kafka/Headers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

package fs2.kafka

import cats.data.{Chain, NonEmptyChain}
import cats.{Eq, Show}
import cats.data.{Chain, NonEmptyChain}
import fs2.kafka.internal.converters.collection.*
import fs2.kafka.internal.syntax.*

Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/fs2/kafka/Jitter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

package fs2.kafka

import cats.Applicative
import cats.effect.Sync
import cats.syntax.functor.*
import cats.Applicative

/**
* [[Jitter]] represents the ability to apply jitter to an existing value `n`, effectively
Expand Down
10 changes: 5 additions & 5 deletions modules/core/src/main/scala/fs2/kafka/KafkaAdminClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ package fs2.kafka

import scala.annotation.nowarn

import cats.{Foldable, Functor}
import cats.effect.*
import cats.syntax.all.*
import cats.{Foldable, Functor}
import fs2.Stream
import fs2.kafka.KafkaAdminClient.*
import fs2.kafka.admin.MkAdminClient
import fs2.kafka.internal.WithAdminClient
import fs2.kafka.internal.converters.collection.*
import fs2.kafka.internal.syntax.*
import fs2.kafka.internal.WithAdminClient
import fs2.kafka.KafkaAdminClient.*
import fs2.Stream

import org.apache.kafka.clients.admin.*
import org.apache.kafka.clients.consumer.OffsetAndMetadata
import org.apache.kafka.common.{Node, TopicPartition}
import org.apache.kafka.common.acl.{AclBinding, AclBindingFilter}
import org.apache.kafka.common.config.ConfigResource
import org.apache.kafka.common.{Node, TopicPartition}

/**
* [[KafkaAdminClient]] represents an admin client for Kafka, which is able to describe queries
Expand Down
8 changes: 4 additions & 4 deletions modules/core/src/main/scala/fs2/kafka/KafkaConsumer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ import scala.collection.immutable.SortedSet
import scala.concurrent.duration.FiniteDuration
import scala.util.matching.Regex

import cats.{Foldable, Functor, Reducible}
import cats.data.{NonEmptySet, OptionT}
import cats.effect.*
import cats.effect.implicits.*
import cats.effect.std.*
import cats.syntax.all.*
import cats.{Foldable, Functor, Reducible}
import fs2.{Chunk, Stream}
import fs2.kafka.consumer.*
import fs2.kafka.instances.*
import fs2.kafka.internal.*
import fs2.kafka.internal.KafkaConsumerActor.*
import fs2.kafka.internal.LogEntry.{RevokedPreviousFetch, StoredFetch}
import fs2.kafka.internal.converters.collection.*
import fs2.kafka.internal.syntax.*
import fs2.{Chunk, Stream}
import fs2.kafka.internal.KafkaConsumerActor.*
import fs2.kafka.internal.LogEntry.{RevokedPreviousFetch, StoredFetch}

import org.apache.kafka.clients.consumer.OffsetAndMetadata
import org.apache.kafka.common.{Metric, MetricName, PartitionInfo, TopicPartition}
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/fs2/kafka/KafkaProducer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ package fs2.kafka
import scala.annotation.nowarn
import scala.concurrent.Promise

import cats.{Apply, Functor}
import cats.effect.*
import cats.syntax.all.*
import cats.{Apply, Functor}
import fs2.*
import fs2.kafka.internal.*
import fs2.kafka.producer.MkProducer
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/fs2/kafka/ProducerRecord.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

package fs2.kafka

import cats.{Applicative, Bitraverse, Eq, Eval, Show, Traverse}
import cats.instances.int.*
import cats.instances.long.*
import cats.instances.option.*
import cats.instances.string.*
import cats.syntax.eq.*
import cats.syntax.functor.*
import cats.syntax.show.*
import cats.{Applicative, Bitraverse, Eq, Eval, Show, Traverse}

/**
* [[ProducerRecord]] represents a record which can be produced to Kafka. At the very least, this
Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/main/scala/fs2/kafka/ProducerSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

package fs2.kafka

import scala.concurrent.ExecutionContext
import scala.concurrent.duration.*
import scala.concurrent.ExecutionContext

import cats.Show
import cats.effect.Resource
import cats.Show
import fs2.kafka.security.KafkaCredentialStore

import org.apache.kafka.clients.producer.ProducerConfig
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/fs2/kafka/Serializer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ package fs2.kafka
import java.nio.charset.{Charset, StandardCharsets}
import java.util.UUID

import cats.Contravariant
import cats.effect.{Resource, Sync}
import cats.syntax.all.*
import cats.Contravariant

sealed abstract class GenericSerializer[-T <: KeyOrValue, F[_], A] {

Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/fs2/kafka/Timestamp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

package fs2.kafka

import cats.{Eq, Show}
import cats.instances.boolean.*
import cats.instances.long.*
import cats.instances.option.*
import cats.syntax.eq.*
import cats.{Eq, Show}

/**
* [[Timestamp]] is an optional timestamp value representing a [[createTime]], [[logAppendTime]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ package fs2.kafka

import scala.annotation.nowarn

import cats.effect.syntax.all.*
import cats.effect.{Async, Outcome, Resource}
import cats.effect.syntax.all.*
import cats.syntax.all.*
import fs2.{Chunk, Stream}
import fs2.kafka.internal.*
import fs2.kafka.internal.converters.collection.*
import fs2.kafka.producer.MkProducer
import fs2.{Chunk, Stream}

import org.apache.kafka.clients.consumer.ConsumerGroupMetadata
import org.apache.kafka.clients.producer.RecordMetadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
package fs2.kafka.admin

import cats.effect.Sync
import fs2.kafka.AdminClientSettings
import fs2.kafka.internal.converters.collection.*
import fs2.kafka.AdminClientSettings

import org.apache.kafka.clients.admin.AdminClient

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ package fs2.kafka.consumer

import scala.util.matching.Regex

import cats.Reducible
import cats.data.NonEmptyList
import cats.Reducible

trait KafkaSubscription[F[_]] {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
package fs2.kafka.consumer

import cats.effect.Sync
import fs2.kafka.internal.converters.collection.*
import fs2.kafka.{ConsumerSettings, KafkaByteConsumer}
import fs2.kafka.internal.converters.collection.*

import org.apache.kafka.common.serialization.ByteArrayDeserializer

Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/fs2/kafka/instances.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

package fs2.kafka

import cats.{Order, Show}
import cats.instances.int.*
import cats.instances.long.*
import cats.instances.string.*
import cats.instances.tuple.*
import cats.syntax.show.*
import cats.{Order, Show}

import org.apache.kafka.clients.consumer.OffsetAndMetadata
import org.apache.kafka.clients.producer.RecordMetadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import java.util.concurrent.Executors

import scala.concurrent.ExecutionContext

import cats.effect.syntax.async.*
import cats.effect.{Async, Resource, Sync}
import cats.effect.syntax.async.*

private[kafka] trait Blocking[F[_]] {
def apply[A](a: => A): F[A]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import cats.effect.*
import cats.effect.std.*
import cats.effect.syntax.all.*
import cats.syntax.all.*
import fs2.Chunk
import fs2.kafka.*
import fs2.kafka.instances.*
import fs2.kafka.internal.KafkaConsumerActor.*
import fs2.kafka.internal.LogEntry.*
import fs2.kafka.internal.converters.collection.*
import fs2.kafka.internal.syntax.*
import fs2.kafka.internal.KafkaConsumerActor.*
import fs2.kafka.internal.LogEntry.*
import fs2.Chunk

import org.apache.kafka.clients.consumer.{
ConsumerConfig,
Expand Down
Loading

0 comments on commit 5569d79

Please sign in to comment.