Skip to content

Commit

Permalink
Merge pull request #62 from armanbilge/topic/relax-constraints
Browse files Browse the repository at this point in the history
Relax constraints, expose `Network`
  • Loading branch information
ChristopherDavenport authored Mar 6, 2023
2 parents 6f5aacf + be60db6 commit c5b2ce9
Showing 1 changed file with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ object RedisConnection{
val clusterCacheTopologySeconds: FiniteDuration = 1.second // How long topology will not be rechecked for after a succesful refresh
}

def direct[F[_]: Async]: DirectConnectionBuilder[F] =
def direct[F[_]: Concurrent: Network]: DirectConnectionBuilder[F] =
new DirectConnectionBuilder(
Network[F],
Defaults.host,
Expand All @@ -138,6 +138,10 @@ object RedisConnection{
TLSParameters.Default
)

@deprecated("Use overload that takes a Network", "0.4.1")
def direct[F[_]](F: Async[F]): DirectConnectionBuilder[F] =
direct(F, Network.forAsync(F))

class DirectConnectionBuilder[F[_]: Concurrent] private[RedisConnection](
private val sg: SocketGroup[F],
val host: Host,
Expand Down Expand Up @@ -174,7 +178,7 @@ object RedisConnection{
} yield RedisConnection.DirectConnection(out)
}

def pool[F[_]: Async]: PooledConnectionBuilder[F] =
def pool[F[_]: Temporal: Network]: PooledConnectionBuilder[F] =
new PooledConnectionBuilder(
Network[F],
Defaults.host,
Expand All @@ -183,7 +187,11 @@ object RedisConnection{
TLSParameters.Default
)

class PooledConnectionBuilder[F[_]: Async] private[RedisConnection] (
@deprecated("Use overload that takes a Network", "0.4.1")
def pool[F[_]](F: Async[F]): PooledConnectionBuilder[F] =
pool(F, Network.forAsync(F))

class PooledConnectionBuilder[F[_]: Temporal] private[RedisConnection] (
private val sg: SocketGroup[F],
val host: Host,
val port: Port,
Expand Down Expand Up @@ -222,7 +230,7 @@ object RedisConnection{
).build.map(PooledConnection[F](_))
}

def queued[F[_]: Async]: QueuedConnectionBuilder[F] =
def queued[F[_]: Temporal: Network]: QueuedConnectionBuilder[F] =
new QueuedConnectionBuilder(
Network[F],
Defaults.host,
Expand All @@ -234,7 +242,11 @@ object RedisConnection{
Defaults.chunkSizeLimit
)

class QueuedConnectionBuilder[F[_]: Async] private[RedisConnection](
@deprecated("Use overload that takes a Network", "0.4.1")
def queued[F[_]](F: Async[F]): QueuedConnectionBuilder[F] =
queued(F, Network.forAsync(F))

class QueuedConnectionBuilder[F[_]: Temporal] private[RedisConnection](
private val sg: SocketGroup[F],
val host: Host,
val port: Port,
Expand Down Expand Up @@ -320,7 +332,7 @@ object RedisConnection{
}
}

def cluster[F[_]: Async]: ClusterConnectionBuilder[F] =
def cluster[F[_]: Async: Network]: ClusterConnectionBuilder[F] =
new ClusterConnectionBuilder(
Network[F],
Defaults.host,
Expand All @@ -335,6 +347,10 @@ object RedisConnection{
Defaults.clusterCacheTopologySeconds
)

@deprecated("Use overload that takes a Network", "0.4.1")
def cluster[F[_]](F: Async[F]): ClusterConnectionBuilder[F] =
cluster(F, Network.forAsync(F))

class ClusterConnectionBuilder[F[_]: Async] private[RedisConnection] (
private val sg: SocketGroup[F],
val host: Host,
Expand Down

0 comments on commit c5b2ce9

Please sign in to comment.