-
Notifications
You must be signed in to change notification settings - Fork 89
Closed
Description
I am working now on implementing otel4s integration for redis4cats and it seems impossible to do for streaming, because otel4s needs to have F[_]: MonadCancelThrow, but it does not exist for fs2.Stream and according to Fabio (SystemFw), he "strongly doubts it" that it's possible to add.
I suggest changing the APIs to this:
/**
* @tparam F the IO type
* @tparam S the stream type, like `fs2.Stream[IO, *]`
*/
trait PublishCommands[F[_], S[_[_], _], K, V] extends PubSubStats[F, K] {
def publish(channel: RedisChannel[K], value: V): F[Unit]
def publish(channel: RedisChannel[K]): S[F, V] => S[F, Unit]
}
/**
* @tparam F the IO type
* @tparam S the stream type, like `fs2.Stream[IO, *]`
*/
trait SubscribeCommands[F[_], S[_[_], _], K, V] {
def subscribe(channel: RedisChannel[K]): S[F, V]
def unsubscribe(channel: RedisChannel[K]): F[Unit]
def psubscribe(channel: RedisPattern[K]): S[F, RedisPatternEvent[K, V]]
def punsubscribe(channel: RedisPattern[K]): F[Unit]
}
trait PubSubCommands[F[_], S[_[_], _], K, V] extends PublishCommands[F, S, K, V] with SubscribeCommands[F, S, K, V]This clearly shows which operations are one-shot, and which ones are streaming, instead of, for example, unsubscribe returning a stream with one element.
Metadata
Metadata
Assignees
Labels
No labels