laserdisc-io / laserdisc Goto Github PK
View Code? Open in Web Editor NEWA Future-free Fs2 native pure FP Redis client
Home Page: http://laserdisc.io
License: MIT License
A Future-free Fs2 native pure FP Redis client
Home Page: http://laserdisc.io
License: MIT License
CLI.scala
should be moved out of laserdisc-fs2
and put into a new laserdisc-cli
module (dependent on laserdisc-fs2
)
Tests could be added too (needs refactoring)
sbt --supershell=false
or it will incur in sbt/sbt#5063 (thanks @barambani for finding this out)
However:
quit
does not terminate connection client-side (always been the case, not a new issue)
localhost:6379> quit
<<< OK - [5.06ms]
localhost:6379>
localhost:6379> ^C
[warn] Canceling execution...
[error] Total time: 124 s (02:04), completed 11-Nov-2019 08:45:47
sbt:laserdisc> [warn] Thread[ioapp-compute-2,5,run-main-group-0] loading cats.syntax.EitherIdOps$ after test or run has completed. This is a likely resource leak
2019-11-11 08:45:54,882 shutdown-hooks-run-all ERROR No Log4j 2 configuration file found.
Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging.
See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2
Read
has primitives that can qualify it to be at least FlatMap
and Functor
(Covariant, Contravariant and Invariant) and may be others. Also with the addition of a lawful pure
it could also be a Monad
.
It would be good to add checks to validate the laws for those type classes.
We should probably consider supporting Scala 3. For our reliance on shapeless we may be able to use https://github.com/typelevel/twiddles or get some ideas from it at least..
Most should be highlighted by FIXME
and/or TODO
in code
sbt-release-early keeps failing in closing the repository or releasing it (a sample error below). We could consider replacing it with sbt-release that's pretty reliable until something better is available.
[info] Nexus repository URL: https://oss.sonatype.org/service/local
[info] sonatypeProfileName = io.laserdisc
[info] Reading staging repository profiles...
[error] Multiple repositories are found:
[error] [iolaserdisc-1086] status:open, profile:io.laserdisc(4c27934a30ac28) description: Implicitly created (auto staging).
[error] [iolaserdisc-1087] status:open, profile:io.laserdisc(4c27934a30ac28) description: Implicitly created (auto staging).
[error] Specify one of the repository ids in the command line
[error] java.lang.IllegalStateException: Found multiple staging repositories
[error] at xerial.sbt.Sonatype$NexusRESTService.$anonfun$findTargetRepository$8(Sonatype.scala:479)
[error] at scala.Option.getOrElse(Option.scala:121)
[error] at xerial.sbt.Sonatype$NexusRESTService.findTargetRepository(Sonatype.scala:476)
[error] at xerial.sbt.Sonatype$SonatypeCommand$.$anonfun$sonatypeRelease$1(Sonatype.scala:202)
[error] at sbt.Command$.$anonfun$applyEffect$4(Command.scala:134)
[error] at sbt.Command$.$anonfun$applyEffect$2(Command.scala:130)
[error] at ch.epfl.scala.sbt.release.Helper.runCommand$1(ReleaseEarlyPlugin.scala:524)
[error] at ch.epfl.scala.sbt.release.Helper.$anonfun$runCommandAndRemaining$1(ReleaseEarlyPlugin.scala:533)
[error] at ch.epfl.scala.sbt.release.ReleaseEarly$Defaults$.$anonfun$sonatypeRelease$1(ReleaseEarlyPlugin.scala:267)
[error] at ch.epfl.scala.sbt.release.ReleaseEarly$Defaults$.$anonfun$sonatypeRelease$1$adapted(ReleaseEarlyPlugin.scala:259)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:263)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:272)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:263)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] java.lang.IllegalStateException: Found multiple staging repositories
[error] at xerial.sbt.Sonatype$NexusRESTService.$anonfun$findTargetRepository$8(Sonatype.scala:479)
[error] at scala.Option.getOrElse(Option.scala:121)
[error] at xerial.sbt.Sonatype$NexusRESTService.findTargetRepository(Sonatype.scala:476)
[error] at xerial.sbt.Sonatype$SonatypeCommand$.$anonfun$sonatypeRelease$1(Sonatype.scala:202)
[error] at sbt.Command$.$anonfun$applyEffect$4(Command.scala:134)
[error] at sbt.Command$.$anonfun$applyEffect$2(Command.scala:130)
[error] at ch.epfl.scala.sbt.release.Helper.runCommand$1(ReleaseEarlyPlugin.scala:524)
[error] at ch.epfl.scala.sbt.release.Helper.$anonfun$runCommandAndRemaining$1(ReleaseEarlyPlugin.scala:533)
[error] at ch.epfl.scala.sbt.release.ReleaseEarly$Defaults$.$anonfun$sonatypeRelease$1(ReleaseEarlyPlugin.scala:267)
[error] at ch.epfl.scala.sbt.release.ReleaseEarly$Defaults$.$anonfun$sonatypeRelease$1$adapted(ReleaseEarlyPlugin.scala:259)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:263)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:272)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:263)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] java.lang.IllegalStateException: Found multiple staging repositories
[error] at xerial.sbt.Sonatype$NexusRESTService.$anonfun$findTargetRepository$8(Sonatype.scala:479)
[error] at scala.Option.getOrElse(Option.scala:121)
[error] at xerial.sbt.Sonatype$NexusRESTService.findTargetRepository(Sonatype.scala:476)
[error] at xerial.sbt.Sonatype$SonatypeCommand$.$anonfun$sonatypeRelease$1(Sonatype.scala:202)
[error] at sbt.Command$.$anonfun$applyEffect$4(Command.scala:134)
[error] at sbt.Command$.$anonfun$applyEffect$2(Command.scala:130)
[error] at ch.epfl.scala.sbt.release.Helper.runCommand$1(ReleaseEarlyPlugin.scala:524)
[error] at ch.epfl.scala.sbt.release.Helper.$anonfun$runCommandAndRemaining$1(ReleaseEarlyPlugin.scala:533)
[error] at ch.epfl.scala.sbt.release.ReleaseEarly$Defaults$.$anonfun$sonatypeRelease$1(ReleaseEarlyPlugin.scala:267)
[error] at ch.epfl.scala.sbt.release.ReleaseEarly$Defaults$.$anonfun$sonatypeRelease$1$adapted(ReleaseEarlyPlugin.scala:259)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:263)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:272)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:263)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (core / releaseEarlyPublish) java.lang.IllegalStateException: Found multiple staging repositories
[error] (coreJS / releaseEarlyPublish) java.lang.IllegalStateException: Found multiple staging repositories
[error] (fs2 / releaseEarlyPublish) java.lang.IllegalStateException: Found multiple staging repositories
[error] Total time: 779 s, completed Jul 19, 2018 4:17:40 PM
Plan is:
fs2
based impl of subscriptionsFor example
We could have a module that adds the support for json values. This would use Circe Encoder
and Decoder
to serialise/deserialise types to Redis.
At a minimum tests for PublishP
, ServerP
, SetP
, SortedSetP
, StringP
and TransactionP
See
Similar in implementation to #20 - backed by fs2.Stream
Currently Travis doesn't provide openjdk 8 out of the box on bionic (see #170). It's probably time to consider Circle CI (or even Github Actions) for the builds and investigate if it can solve the problem.
Right now, if there's a deserialization issue doing a GET on the value, laserdisc suppresses the underlying error. E.g. if the value for 'someKey' cannot be deserialized:
redisClient.send1(strings.get[MyBean](someKey))..
The error message is of the form:
Error(RESP type(s) matched but failed to deserialize correctly: BulkString("{\"my\":\"bad\",\"json\":\"here\""))
It would be very helpful to propagate the deserialization error (or even indicate the target bean type).
Laserdisc is not listed here: https://redis.io/clients#
It would a great first step so that we are discoverable by our clients. This would also help to promote this library.
In many circumstances, as much as we'd like it to be, creating a safe protocol that is verifiable at compile time is just not possible.
One example would be when the Key
needed in a get
has to be constructed at runtime (say by appending together other string only available at runtime by consuming some external source).
In all these circumstances we may feel that the burden of having to prove the compiler we have valid Key
s is just too big and what we really wish for is a good ol' RuntimeException
, something that would just make us feel at peace with the universe...
I'm thinking something like:
trait UnsafeStringP { self: StringP =>
final def get[A](key: String)(
implicit ev: NonNullBulkString ==> A
): Protocol.Aux[Option[A]] = {
require(key.nonEmpty, "why are you doing this to me now")
self.get(Key.unsafeFrom(key))
}
}
I'd also love to see this properly packaged under some very comforting namespace like hell
or blinded
(which I personally like a lot 'cause it plays well with laserdisc
, i.e. import laserdisc.blinded._
)
the circe interop module is not included in the aggregate root project
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.