-
Notifications
You must be signed in to change notification settings - Fork 19
Work in Progress: Version 2 #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #50 +/- ##
=========================================
Coverage ? 34.69%
=========================================
Files ? 8
Lines ? 392
Branches ? 48
=========================================
Hits ? 136
Misses ? 256
Partials ? 0
Continue to review full report at Codecov.
|
|
Just skimmed over and it looks promising 👍 I'll have a look over the weekend. Any idea what kind of performance impact this has? |
lloydmeta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, looks pretty good. I really like the improvements to CI and the build.
As I mentioned before, I'm a bit concerned about not knowing the performance impact of this upgrade, since a Memcached client should be extremely performant (in #33 you mentioned performance should be a goal) of this project.
Just left a few comments/questions.
| </developer> | ||
| </developers> | ||
| lazy val scalaJSSettings = Seq( | ||
| coverageExcludedFiles := ".*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason for this? Minitest works cross-platform right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't about Minitest. I've made shade-local to cross-compile to Scala.js, since there's nothing JVM specific in it and who knows, might be useful to somebody in the browser :-)
The problem is that sbt-scoverage doesn't work with Scala.js. So we have to exclude all Scala.js files from coverage reports.
| import scala.collection.immutable.SortedMap | ||
| import scala.concurrent.duration._ | ||
|
|
||
| /** Describes an immutable cache data-structure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a use case for this cache outside of say, testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The immutable cache thing would be useful in combination with streaming:
observable.scan((cache, elem) => cache.set(elem.key, elem.value))People working with Observable have done this many times, aggregating data in simple Map references. Adding expiry logic for those values can also be very useful.
| * https://github.com/monix/shade/blob/master/LICENSE.txt | ||
| */ | ||
|
|
||
| package shade.memcached |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose going forward Codecs will be strictly tied to being used with Memcached?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to handle it otherwise. Because we are now using the high-level API, we need to work with Transcoder, which isn't a bad thing because we can now also work with flags.
Bringing in SpyMemcached's Transcoder implementations has these benefits:
- data persisted by Shade can be read by SpyMemcached - the problem is SpyMemcached
Transcoderimplementations reject values if they aren't stored with properflags- so with the current version you'd have to implement your ownTranscoderthat just deals withArray[Byte]like the currentCodecdoes - the
SerializingTranscoderin SpyMemcached begins compressing data in case it goes over a certain size, which is cool
I'm not sure if making Codec specific to SpyMemcached is bad, because by introducing usage of those flags, that's an implementation detail that doesn't seem reusable.
| client.add(withPrefix(key), expSecs, value, codec) | ||
| }, | ||
| (async, callback) => { | ||
| async.addListener(new OperationCompletionListener { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| } | ||
| } | ||
| } | ||
| // |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a bunch of commented-out tests here. TODOs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes 😄 Tests need to be fixed.
| SerializingCodecAnyRef.asInstanceOf[Codec[A]] | ||
|
|
||
| /** Reusable reference for [[serializingCodec]]. */ | ||
| private object SerializingCodecAnyRef extends Codec[Any] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it might be worthwhile to add in Shapeless to build an auto generic codec that can be tried before we fall back to something that relies on Java serialisation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, never did that, can you share a sample? Wouldn't that also involve macros?
d97b560 to
18da705
Compare
Changes in version 2:
addListener, so we no longer have to use its dirty internals for exposing futures and tasksTask, in addition to the methods exposingCancelableFutureshade-localandshade-memcached, the idea being that Shade should be a project for "caching" and it should maybe provide other integrations meant for caching stuff (e.g. Redis?)For review, it might be easier to just review the files in the version2 branch.