Skip to content

Commit 49a494b

Browse files
committed
Reformat with scalafmt 3.0.0
1 parent 4f6365d commit 49a494b

File tree

18 files changed

+480
-419
lines changed

18 files changed

+480
-419
lines changed

cassandra-datastax-driver/src/main/scala/com/avast/sst/datastax/config/advanced.scala

+345-289
Large diffs are not rendered by default.

cassandra-datastax-driver/src/main/scala/com/avast/sst/datastax/config/basic.scala

+82-88
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,43 @@ import scala.concurrent.duration._
44

55
/** Basic datastax driver configuration.
66
*
7-
* @param contactPoints The contact points to use for the initial connection to the cluster.
8-
* These are addresses of Cassandra nodes that the driver uses to discover the cluster topology.
9-
*
10-
* Only one contact point is required (the driver will retrieve the address of the other nodes
11-
* automatically), but it is usually a good idea to provide more than one contact point, because if
12-
* that single contact point is unavailable, the driver cannot initialize itself correctly.
13-
* This must be a list of strings with each contact point specified as "host:port". If the host is
14-
* a DNS name that resolves to multiple A-records, all the corresponding addresses will be used. Do
15-
* not use "localhost" as the host name (since it resolves to both IPv4 and IPv6 addresses on some
16-
* platforms).
17-
*
18-
* Note that Cassandra 3 and below requires all nodes in a cluster to share the same port (see
19-
* CASSANDRA-7544).
20-
* @param sessionName A name that uniquely identifies the driver instance created from this configuration. This is
21-
* used as a prefix for log messages and metrics.
22-
*
23-
* If this option is absent, the driver will generate an identifier composed of the letter 's'
24-
* followed by an incrementing counter. If you provide a different value, try to keep it short to
25-
* keep the logs readable. Also, make sure it is unique: reusing the same value will not break the
26-
* driver, but it will mix up the logs and metrics.
27-
* @param sessionKeyspace The name of the keyspace that the session should initially be connected to.
28-
*
29-
* This expects the same format as in a CQL query: case-sensitive names must be quoted.
30-
*
31-
* If this option is absent, the session won't be connected to any keyspace, and you'll have to
32-
* either qualify table names in your queries, or use the per-query keyspace feature available in
33-
* Cassandra 4 and above (see `com.datastax.oss.driver.api.core.session.Request.getKeyspace()`).
34-
* @param request This configures basic request properties such as timeout, page size etc.
35-
* @param loadBalancingPolicy The policy that decides the "query plan" for each query; that is, which nodes to try as
36-
* coordinators, and in which order.
37-
*
38-
* Overridable in a profile. Note that the driver creates as few instances as possible: if a
39-
* named profile inherits from the default profile, or if two sibling profiles have the exact
40-
* same configuration, they will share a single policy instance at runtime.
41-
* If there are multiple load balancing policies in a single driver instance, they work together
42-
* in the following way:
43-
* - each request gets a query plan from its profile's policy (or the default policy if the
44-
* request has no profile, or the profile does not override the policy).
45-
* - when the policies assign distances to nodes, the driver uses the closest assigned distance
46-
* for any given node.
7+
* @param contactPoints
8+
* The contact points to use for the initial connection to the cluster. These are addresses of Cassandra nodes that the driver uses to
9+
* discover the cluster topology.
10+
*
11+
* Only one contact point is required (the driver will retrieve the address of the other nodes automatically), but it is usually a good
12+
* idea to provide more than one contact point, because if that single contact point is unavailable, the driver cannot initialize itself
13+
* correctly. This must be a list of strings with each contact point specified as "host:port". If the host is a DNS name that resolves to
14+
* multiple A-records, all the corresponding addresses will be used. Do not use "localhost" as the host name (since it resolves to both
15+
* IPv4 and IPv6 addresses on some platforms).
16+
*
17+
* Note that Cassandra 3 and below requires all nodes in a cluster to share the same port (see CASSANDRA-7544).
18+
* @param sessionName
19+
* A name that uniquely identifies the driver instance created from this configuration. This is used as a prefix for log messages and
20+
* metrics.
21+
*
22+
* If this option is absent, the driver will generate an identifier composed of the letter 's' followed by an incrementing counter. If you
23+
* provide a different value, try to keep it short to keep the logs readable. Also, make sure it is unique: reusing the same value will not
24+
* break the driver, but it will mix up the logs and metrics.
25+
* @param sessionKeyspace
26+
* The name of the keyspace that the session should initially be connected to.
27+
*
28+
* This expects the same format as in a CQL query: case-sensitive names must be quoted.
29+
*
30+
* If this option is absent, the session won't be connected to any keyspace, and you'll have to either qualify table names in your queries,
31+
* or use the per-query keyspace feature available in Cassandra 4 and above (see
32+
* `com.datastax.oss.driver.api.core.session.Request.getKeyspace()`).
33+
* @param request
34+
* This configures basic request properties such as timeout, page size etc.
35+
* @param loadBalancingPolicy
36+
* The policy that decides the "query plan" for each query; that is, which nodes to try as coordinators, and in which order.
37+
*
38+
* Overridable in a profile. Note that the driver creates as few instances as possible: if a named profile inherits from the default
39+
* profile, or if two sibling profiles have the exact same configuration, they will share a single policy instance at runtime. If there are
40+
* multiple load balancing policies in a single driver instance, they work together in the following way:
41+
* - each request gets a query plan from its profile's policy (or the default policy if the request has no profile, or the profile does
42+
* not override the policy).
43+
* - when the policies assign distances to nodes, the driver uses the closest assigned distance for any given node.
4744
*/
4845
final case class BasicConfig(
4946
contactPoints: List[String] = BasicConfig.Default.contactPoints,
@@ -60,38 +57,34 @@ object BasicConfig {
6057

6158
/** Request configuration.
6259
*
63-
* @param timeout How long the driver waits for a request to complete. This is a global limit on the duration of
64-
* a `session.execute()` call, including any internal retries the driver might do.
65-
*
66-
* By default, this value is set pretty high to ensure that DDL queries don't time out, in order
67-
* to provide the best experience for new users trying the driver with the out-of-the-box
68-
* configuration.
69-
* For any serious deployment, we recommend that you use separate configuration profiles for DDL
70-
* and DML; you can then set the DML timeout much lower (down to a few milliseconds if needed).
71-
*
72-
* Note that, because timeouts are scheduled on the driver's timer thread, the duration specified
73-
* here must be greater than the timer tick duration defined by the
74-
* advanced.netty.timer.tick-duration setting (see below). If that is not the case, timeouts will
75-
* not be triggered as timely as desired.
76-
*
77-
* Overridable in a profile.
78-
* @param consistency The consistency level.
79-
* Overridable in a profile.
80-
* @param pageSize The page size. This controls how many rows will be retrieved simultaneously in a single
81-
* network roundtrip (the goal being to avoid loading too many results in memory at the same
82-
* time). If there are more results, additional requests will be used to retrieve them (either
83-
* automatically if you iterate with the sync API, or explicitly with the async API's
84-
* fetchNextPage method).
85-
*
86-
* If the value is 0 or negative, it will be ignored and the request will not be paged.
87-
*
88-
* Overridable in a profile.
89-
* @param serialConsistency The serial consistency level.
90-
* The allowed values are SERIAL and LOCAL_SERIAL.
91-
* Overridable in a profile.
92-
* @param defaultIdempotence The default idempotence of a request, that will be used for all `Request` instances where
93-
* `isIdempotent()` returns null.
94-
* Overridable in a profile.
60+
* @param timeout
61+
* How long the driver waits for a request to complete. This is a global limit on the duration of a `session.execute()` call, including
62+
* any internal retries the driver might do.
63+
*
64+
* By default, this value is set pretty high to ensure that DDL queries don't time out, in order to provide the best experience for new
65+
* users trying the driver with the out-of-the-box configuration. For any serious deployment, we recommend that you use separate
66+
* configuration profiles for DDL and DML; you can then set the DML timeout much lower (down to a few milliseconds if needed).
67+
*
68+
* Note that, because timeouts are scheduled on the driver's timer thread, the duration specified here must be greater than the timer tick
69+
* duration defined by the advanced.netty.timer.tick-duration setting (see below). If that is not the case, timeouts will not be triggered
70+
* as timely as desired.
71+
*
72+
* Overridable in a profile.
73+
* @param consistency
74+
* The consistency level. Overridable in a profile.
75+
* @param pageSize
76+
* The page size. This controls how many rows will be retrieved simultaneously in a single network roundtrip (the goal being to avoid
77+
* loading too many results in memory at the same time). If there are more results, additional requests will be used to retrieve them
78+
* (either automatically if you iterate with the sync API, or explicitly with the async API's fetchNextPage method).
79+
*
80+
* If the value is 0 or negative, it will be ignored and the request will not be paged.
81+
*
82+
* Overridable in a profile.
83+
* @param serialConsistency
84+
* The serial consistency level. The allowed values are SERIAL and LOCAL_SERIAL. Overridable in a profile.
85+
* @param defaultIdempotence
86+
* The default idempotence of a request, that will be used for all `Request` instances where `isIdempotent()` returns null. Overridable
87+
* in a profile.
9588
*/
9689
final case class BasicRequestConfig(
9790
timeout: Duration = BasicRequestConfig.Default.timeout,
@@ -108,20 +101,21 @@ object BasicRequestConfig {
108101

109102
/** The policy that decides the "query plan" for each query; that is, which nodes to try as coordinators, and in which order.
110103
*
111-
* @param `class` The class of the policy. If it is not qualified, the driver assumes that it resides in the
112-
* package `com.datastax.oss.driver.internal.core.loadbalancing`.
113-
* @param localDatacenter The datacenter that is considered "local": the default policy will only include nodes from
114-
* this datacenter in its query plans.
104+
* @param `class`
105+
* The class of the policy. If it is not qualified, the driver assumes that it resides in the package
106+
* `com.datastax.oss.driver.internal.core.loadbalancing`.
107+
* @param localDatacenter
108+
* The datacenter that is considered "local": the default policy will only include nodes from this datacenter in its query plans.
115109
*
116-
* This option can only be absent if you specified no contact points: in that case, the driver
117-
* defaults to 127.0.0.1:9042, and that node's datacenter is used as the local datacenter.
110+
* This option can only be absent if you specified no contact points: in that case, the driver defaults to 127.0.0.1:9042, and that node's
111+
* datacenter is used as the local datacenter.
118112
*
119-
* As soon as you provide contact points (either through the configuration or through the cluster
120-
* builder), you must define the local datacenter explicitly, and initialization will fail if
121-
* this property is absent. In addition, all contact points should be from this datacenter;
122-
* warnings will be logged for nodes that are from a different one.
113+
* As soon as you provide contact points (either through the configuration or through the cluster builder), you must define the local
114+
* datacenter explicitly, and initialization will fail if this property is absent. In addition, all contact points should be from this
115+
* datacenter; warnings will be logged for nodes that are from a different one.
123116
*
124-
* @param filter A custom filter to include/exclude nodes.
117+
* @param filter
118+
* A custom filter to include/exclude nodes.
125119
*/
126120
final case class LoadBalancingPolicyConfig(
127121
`class`: String = LoadBalancingPolicyConfig.Default.`class`,
@@ -135,12 +129,12 @@ object LoadBalancingPolicyConfig {
135129

136130
/** A custom filter to include/exclude nodes.
137131
*
138-
* The predicate's `test(Node)` method will be invoked each time the policy processes a
139-
* topology or state change: if it returns false, the node will be set at distance IGNORED
140-
* (meaning the driver won't ever connect to it), and never included in any query plan.
132+
* The predicate's `test(Node)` method will be invoked each time the policy processes a topology or state change: if it returns false, the
133+
* node will be set at distance IGNORED (meaning the driver won't ever connect to it), and never included in any query plan.
141134
*
142-
* @param `class` it must be the fully-qualified name of a class that implements `java.util.function.Predicate<Node>`,
143-
* and has a public constructor taking a single `DriverContext` argument.
135+
* @param `class`
136+
* it must be the fully-qualified name of a class that implements `java.util.function.Predicate<Node>`, and has a public constructor
137+
* taking a single `DriverContext` argument.
144138
*/
145139
final case class FilterConfig(`class`: String)
146140

cats-effect/src/main/scala/com/avast/sst/catseffect/TimeUtils.scala

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ object TimeUtils {
2222
} yield result
2323
}
2424

25-
/** Measures the time it takes the effect to finish and records it using the provided function. It distinguishes between successful
26-
* and failure state.
27-
* Please note, that in case of the effect cancellation the `record` is not invoked at all.
25+
/** Measures the time it takes the effect to finish and records it using the provided function. It distinguishes between successful and
26+
* failure state. Please note, that in case of the effect cancellation the `record` is not invoked at all.
2827
*/
2928
def timeCase[F[_], A](f: F[A])(record: Either[Duration, Duration] => F[Unit])(implicit F: Bracket[F, Throwable], C: Clock[F]): F[A] = {
3029
def calculateAndRecordAs(start: Long)(wrap: Duration => Either[Duration, Duration]): F[Unit] = {

cats-effect/src/main/scala/com/avast/sst/catseffect/syntax/TimeSyntax.scala

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ object TimeSyntax {
2020
/** Measures the time it takes the effect to finish and records it using the provided function. */
2121
def time(record: Duration => F[Unit])(implicit F: Bracket[F, Throwable], C: Clock[F]): F[A] = TimeUtils.time(f)(record)
2222

23-
/** Measures the time it takes the effect to finish and records it using the provided function. It distinguishes between successful
24-
* and failure state.
25-
* Please note, that in case of the effect cancellation the `record` is not invoked at all.
23+
/** Measures the time it takes the effect to finish and records it using the provided function. It distinguishes between successful and
24+
* failure state. Please note, that in case of the effect cancellation the `record` is not invoked at all.
2625
*/
2726
def timeCase(record: Either[Duration, Duration] => F[Unit])(implicit F: Bracket[F, Throwable], C: Clock[F]): F[A] = {
2827
TimeUtils.timeCase(f)(record)

doobie-hikari/src/main/scala/com/avast/sst/doobie/DoobieHikariModule.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ object DoobieHikariModule {
1616

1717
/** Makes [[doobie.hikari.HikariTransactor]] initialized with the given config.
1818
*
19-
* @param boundedConnectExecutionContext [[scala.concurrent.ExecutionContext]] used for creating connections (should be bounded!)
19+
* @param boundedConnectExecutionContext
20+
* [[scala.concurrent.ExecutionContext]] used for creating connections (should be bounded!)
2021
*/
2122
def make[F[_]: Async](
2223
config: DoobieHikariConfig,

grpc-server/src/main/scala/com/avast/sst/grpc/server/GrpcServerModule.scala

+6-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ object GrpcServerModule {
1111

1212
/** Makes [[io.grpc.Server]] (Netty) initialized with the given config, services and interceptors.
1313
*
14-
* @param services service implementations to be added to the handler registry
15-
* @param executionContext executor to be used for the server
16-
* @param interceptors that are run for all the services
14+
* @param services
15+
* service implementations to be added to the handler registry
16+
* @param executionContext
17+
* executor to be used for the server
18+
* @param interceptors
19+
* that are run for all the services
1720
*/
1821
def make[F[_]: Sync](
1922
config: GrpcServerConfig,

http4s-client-blaze/src/main/scala/com/avast/sst/http4s/client/Http4sBlazeClientModule.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ object Http4sBlazeClientModule {
1010

1111
/** Makes [[org.http4s.client.Client]] (Blaze) initialized with the given config.
1212
*
13-
* @param executionContext callback handling [[scala.concurrent.ExecutionContext]]
13+
* @param executionContext
14+
* callback handling [[scala.concurrent.ExecutionContext]]
1415
*/
1516
def make[F[_]: ConcurrentEffect](
1617
config: Http4sBlazeClientConfig,

http4s-client-monix-catnap/src/main/scala/com/avast/sst/http4s/client/monix/catnap/Http4sClientCircuitBreakerModule.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ object Http4sClientCircuitBreakerModule {
1111

1212
/** Wraps [[org.http4s.client.Client]] with the given [[monix.catnap.CircuitBreaker]].
1313
*
14-
* The circuit breaker is special in that it also catches any HTTP responses considered as server failures
15-
* according to the [[com.avast.sst.http4s.client.monix.catnap.HttpStatusClassifier]].
14+
* The circuit breaker is special in that it also catches any HTTP responses considered as server failures according to the
15+
* [[com.avast.sst.http4s.client.monix.catnap.HttpStatusClassifier]].
1616
*/
1717
def make[F[_]: Sync](
1818
client: Client[F],
@@ -26,7 +26,7 @@ object Http4sClientCircuitBreakerModule {
2626
Client[F] { request =>
2727
val raisedInternal = client.run(request).allocated.flatMap {
2828
case tuple @ (response, _) if !httpStatusClassifier.isServerFailure(response.status) => F.pure(tuple)
29-
case (response, close) => F.raiseError[(Response[F], F[Unit])](new ServerFailure(response, close))
29+
case (response, close) => F.raiseError[(Response[F], F[Unit])](new ServerFailure(response, close))
3030
}
3131
val lifted = circuitBreaker.protect(raisedInternal).recover { case serverFailure: ServerFailure =>
3232
(serverFailure.response, serverFailure.close)

http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerModule.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ object Http4sBlazeServerModule {
1313

1414
/** Makes [[org.http4s.server.Server]] (Blaze) initialized with the given config and [[org.http4s.HttpApp]].
1515
*
16-
* @param executionContext callback handling [[scala.concurrent.ExecutionContext]]
16+
* @param executionContext
17+
* callback handling [[scala.concurrent.ExecutionContext]]
1718
*/
1819
def make[F[_]: ConcurrentEffect: Timer](
1920
config: Http4sBlazeServerConfig,

0 commit comments

Comments
 (0)