-
Notifications
You must be signed in to change notification settings - Fork 97
Comments
Is there any work already done or stated to support Go? I think I can't spot any, even on other branches. |
Yes, a client API along the lines of the client APIs in JavaScript and Java (which is essentially a glorified gRPC client). Sorry for the really poor description on this issue. |
Cool—having support for Go would be awesome!
Go Support means being able to implement CloudState entities in Go, in the
same fashion as the JS support and Java support.
You can wire the TCK to test against the reference implementation of the
proxy. See the application.conf in the TCK for inspiration.
We can help guiding you on how to hook things up. The best start is to look
at either the JS and/or Java support.
…--
Cheers,
√
|
Thanks for the pointer and offer to help. I like the motivation for the project and would love to see a Go Client – API for it. Let me get a grasp on it by reading the README and existing client API... if I can be helpful I'd be happy to do so. |
Sounds great. Thank you. |
So after reading the README, some parts a few times, as well as code, I come back to your offer to guidance. I bluntly and with my own words re-phrase what I have the impression of the implementation. Coming from JAVA/JVM/Go space mainly I confess not to understand too much about Scala code. So bear with me if I ask too stupid questions or assumptions of mine; I'm sure some are: The IR (CIR) sems to be paramount to understand expected semantics of a "client". Cloudstate Procotol gRPC definitions together with IR semantics are the solely interface a foreign client API. A client API implementation is like an SPI implementing gRPC services (technically). So here the API implementation enables entities to get called and treated by the IR semantics of being CRDTs, EventSourced or a Function(?). The Sidecar (in the reference implementation Akka based) beside the CloudState protocol does not know much about a client, gets opaque gRPC domain definitions through discovery and calls the clients "code". Entity IDs, beside that the entity behaves according to the protocol, are the most concrete property the Akka Sidecar knows about them through its type. Persistence is done by the Akka Sidecar and transparent for the client. At most the client has a small context it holds and persists domain objects, like to implement snapshots. What happens on a "Client API" is completely separated from the Akka Sidecar, so if I see "akka imports" in CloudStateRunner.scala there are no shortcuts to any Akka "stuff" and it might be used for convenience (Having the JS API surely prooves that I think). Am I off the rails or is that kind of accurate (I'm sure I miss a lot oft stuff) what the "API Client" can be characterised of or what it sees from its perspective? |
@marcellanz In broad strokes—yes. The user's code interfaces with the proxy via the CloudState gRPC protocol, so for every language "implementation" a gRPC server will be running in that process, the proxy will connect to it via the CloudState protocol, and the only interactions via the proxy and the user code's process will be over gRPC. This means that any programming language which can have a gRPC server is a possible candidate to use CloudState. There are so many benefits to this approach—since the proxy does all the data access, we can keep track of DB-metrics completely isolated from user code metrics (think latencies and such). |
Thank you. |
Today I made some progress with a go-support API client with which I'm quite happy for a first stint and a few hours. Having one of the TCK tests green and the EntityDiscoveryManager happy with the EntitySpec it gets back from the go client with the shopping-chart example, including dependency protos. Its raw and needs lot more work, but I closed some circles and I got into all things I did not knew before. Going forward, I think I'll make all the TCK tests happy and then refactor it into an idiomatic go library. But for now, its good how it is and I like how things came together. (CloudStateProxy is satisfied first time with what he gets from Discovery from the "other side") |
That's great news. Thanks for the update. |
That’s very cool news, Marcel!
Let us know how it goes, and if you need any input from us. 😊
--
Cheers,
√
|
I have the second bullet green on the TCK but I'm pretty sure that the TCK is too kind with the current implementation as it is not complete for sure. I'm currently going down to implement the EventSourced service. The points where I could get some help are regarding how to build the project (properly). I honestly don't know how to build the project properly I think from a "sbt" point of view.
I think I understand dependencies in general but with sbt I'm a bit lost :-D I imported the project in IntelliJ like in the screenshot shown below. I build with IntelliJ and also tried on the CLI or with "sbt shell" by:
|
Hi Marcel,
you manually add an Akka + Go configuration here:
https://github.com/cloudstateio/cloudstate/blob/master/tck/src/it/resources/application.conf
And then you run from the command line, in the cloudstate project root
directory:
sbt it:test
(stands for integration test)
|
@viktorklang, that worked, thanks. |
@marcellanz You're most welcome! I'll make sure that the documentation gets improved in that regard. |
This is going to be so 🆒 |
@akramtexas I can only agree! ^^ |
Great to hear that you're making progress. The failed assertion is making
sure that it gets the correct number of expected events back.
Let me see how I can improve the TCK output to better guide the implementor
in the right direction. :)
|
Go has an opinionated behaviour when it comes to maps iteration order. Since Go 1.0, iterating maps has an unpredictable and random order when it comes to iterating maps and, depending on the implementation of stuff, the following can happen The TCK here expects the order of a shopping carts Go being opinionated in this brought some eyebrows up sometimes, even if defined in the Spec: But I find it refreshing that it forces now the question if the TCK should respect that from an implementation @viktorklang |
@marcellanz That's a great question! In this case, isn't it the iteration order of a sequence though? |
Good morning Marcel I was planning to start from scratch with this task a week ago, but I've seen that you've been advancing a lot of work. If you're happy with sharing with me your code I can have a look at it and start contributing there. Regarding to your last input, I think it might be helpful to solve this problem if you used channels (https://tour.golang.org/concurrency/2) to guarantee the messaging order? Kind Regards Arturo |
Good morning gentlemen 🌞: @marcellanz, @viktorklang, @ArturoTarinVillaescusa @marcellanz - I like a lot two of your observations in particular, both spot on 🎯
|
Also please check out: go-maps-in-action 🗺 |
Hi @ArturoTarinVillaescusa. Sure, I'll be happy to share. I currently work to get the current TCK 100% passed and having a proposal for the client API. I'm not comfortable to share the state of code I have at the moment, but with the progress I made the last few days I'm pretty sure I can propose a first version of the go api client with which we can move on sometimes this week or the end of it. There is plenty of stuff to do and I'm sure and looking forward to any contributions to it :-) Next steps will be CRDTs and the function protocol I think or anything the community is thinking of.
The order of the shopping cart items that get back by issuing the I'm not quite sure if I understand how channels would assure the order of the lines items added to the cart but I'm happy to discuss and hear what your idea was to do that. |
Good evening @akramtexas. Thanks for the pointers about maps in Go. I was fast implementing the cart using a Regarding your proposed code, which I captured into a Go Playground snipped: |
This travis build https://travis-ci.com/marcellanz/cloudstate/jobs/232175160 My goal for the next week is now to have a proposal for the Go Client API by somewhere the end of the week based on this implementation. I also plan to write some documentation similar to existing or planned API documentation of the other language implementations. I'm looking forward to discussions and future work to get a full implementation of the Go Client API. (first CloudState TCK 100% pass on travis-ci.org) |
@marcellanz Wow! Congratulations—the feeling when the TCK passes is a great one, for sure! ^^ |
@viktorklang thanks, it felt great :-) |
Let me know when you want/need to create a PR! 😊
--
Cheers,
√
|
@viktorklang I will. Give me a bit more time to make it "right"… |
@marcellanz Absolutely! :) |
@viktorklang I think I will PR this today. I have some tasks left but documented them. |
Very cool @marcellanz! Please add //TODO //FIXME on everything which you know that might represent edge-cases or otherwise, this makes it easier for others to spot things which may not be optimal yet. Also, if you have time, it's really great to have a bit of rationale w.r.t. the end-user API, if there are any opportunities for improvements or otherwise. :) Thanks for spending your time and efforts on this important feature! |
I will do and already had on a number of places. I'll go through it again and mark where appropriate.
I started the usual documents under cloudstate/docs/.../user/lang/go. I'll finish it and update the PR with an explaining gettingstarted.md and similar eventsourced.md as the Java one. |
Perfect, thank you!
Nice! |
@viktorklang The PR branch has now documentation for go support. |
Check here for future/current progress of Go Support in CloudState: https://github.com/cloudstateio/go-support |
This is convenient especially when debugging connectivity/firewall issues, like when running the proxy locally in docker on Linux.
No description provided.
The text was updated successfully, but these errors were encountered: