-
Notifications
You must be signed in to change notification settings - Fork 346
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
quill cassandra for lagom #1299
Conversation
@WayneWang12 thank you for the contribution! What's different about lagom? Is it only the driver interface? are the queries different? We should reuse code. |
6815a86
to
e5e55bd
Compare
@fwbrasil Yes you are right. So I've updated my branch. Can you help to review it again? I've extract ed The only difference is that Lagom has its own Actually I should create a project for |
I'll add unit-test later this day or tommorrow. |
I find it possible to share No need to create different context here. |
It seems I just need Whether LagomContext is in quill or not is irrelevent. @fwbrasil If But please extract |
1e7ca30
to
ee3ba0f
Compare
quill-cassandra-lagom/src/main/scala/io/getquill/CassandraLagomAsyncContext.scala
Show resolved
Hide resolved
Thanks for your reply. I'm on a business trip last few days in Beijing and back to Shanghai this morning. I'll look into this PR soon after my work. Sorry for late response. |
6493f89
to
a49bfe9
Compare
@fwbrasil Seems that I've completed this PR. Can you review it again? Sorry for the delay. Company work is busy in China before Spring Festival. |
5daaee2
to
edf1ac0
Compare
db382b7
to
514ff17
Compare
6cb77ac
to
b51dbc0
Compare
Finally, all checks have passed 😂 . It's not easy. |
Here are some of my general thoughts:
I know this would require very big changes and I am prepared to undertake the It is well know with corporate codebases, whenever modules become copy-pasted out of pressing urgency, they tend to drift apart very quickly, often to the point of requiring a gargantuan effort to reconcile or requiring a complete redesign. I think it should be of utmost important to not commit this terrible mistake with the Quill codebase. Sorry if I sound harsh. |
... so. We need a
|
Here is a sketch what needs to get done in order to have modularity (and DRY!) in the Cassandra module: : #1322 Note how |
@deusaquilus I've read your code. It seems that you want to refactor it to make every effect derived from cluster and session. But Lagom's I read Lagom's code carefully this time. They don't expose Actually every module depends on datasax driver, including What I have done is to make different wrappers able to reuse the existed code without exposing multiple contexts to users. But the direct dependency of |
@WayneWang12 I see what you're saying. I think maybe you should rename @fwbrasil Perhaps trying to do a refactor this big is a bit too ambitious for a feature-PR. Do you agree with my general approach of |
@deusaquilus At the begining I added a new module named But I still think my initial |
b51dbc0
to
77edf0d
Compare
@deusaquilus I've updated this PR. And an extra modification is that in implicit class ListenableFutureConverter[A](val lf: ListenableFuture[A]) extends AnyVal {
def asScala(implicit ec: ExecutionContext): Future[A] = {
val promise = Promise[A]
lf.addListener(new Runnable {
def run(): Unit = {
promise.complete(Try(lf.get()))
()
}
}, ec.asInstanceOf[Executor])
promise.future
}
} Previous version will introduce guava's |
1. quill-cassandra, basic cassandra driver. 2. quill-cassandra-datastax that depends on quill-cassandra and uses the datastax driver
77edf0d
to
4e3135f
Compare
@WayneWang12 Looks good! I'll go over it again tomorrow. |
Okay, looks good to me. |
@fwbrasil What do you think? Are you good with this? |
Thanks for your review @deusaquilus ~ Now quill is my first choice for database accessing. Great library you have contributed to the world! |
Thanks @fwbrasil for accepting my pull request 😄 |
Problem
I'm using Lagom to build my application. And I find that if quill can support lagom then it maybe perfect. So I find a way to add quill support for lagom.
Solution
Just a little code copy from quill-cassandra and change
Cluster
to lagom'sCassandraSession
.@jilen Please review it. Thank you~