restatedev / restate

Restate is the platform for building resilient applications that tolerate all infrastructure faults w/o the need for a PhD.
https://docs.restate.dev
Other
1.48k stars 34 forks source link

sdk-dotnet #1677

Open Ibrahimogod opened 3 months ago

Ibrahimogod commented 3 months ago

Are you planning to support .NET with some sdks

tillrohrmann commented 3 months ago

Hi @Ibrahimogod, at the moment Restate supports TS, Java and Kotlin. We are planning to expand the set of supported languages very soon. Your interest in the .Net SDK is noted and will be factored into the planning. Once work on the .Net SDK starts and I can share a reliable timeline with you, I'll let you know.

Ibrahimogod commented 3 months ago

Hi @Ibrahimogod, at the moment Restate supports TS, Java and Kotlin. We are planning to expand the set of supported languages very soon. Your interest in the .Net SDK is noted and will be factored into the planning. Once work on the .Net SDK starts and I can share a reliable timeline with you, I'll let you know.

I would like to contribute, I have some good .net background, but I don't really know where to begin, if you have any references I would appreciate it if you share with me

tillrohrmann commented 3 months ago

Help with implementing new SDKs is always great to have :-)

We have a semi-formal specification of the service protocol which you can find here. One part that is still missing is the discovery part.

Apart from the formal specification, the best source for information is the TS SDK implementation or the Java SDK if you like this language more. I can also give you more concrete pointers into one of these SDKs, if you let me know which one you prefer.

Ibrahimogod commented 3 months ago

Help with implementing new SDKs is always great to have :-)

We have a semi-formal specification of the service protocol which you can find here. One part that is still missing is the discovery part.

Apart from the formal specification, the best source for information is the TS SDK implementation or the Java SDK if you like this language more. I can also give you more concrete pointers into one of these SDKs, if you let me know which one you prefer.

I think I'll understand typescript more than java

tillrohrmann commented 3 months ago

The main part of the business logic of a SDK lives in the internal state machine. The state machine is called from the node enpoint via the GenericHandler.

The invocation is started by StateMachine::invoke. Through a couple of wrappers (ServiceComponents), the actual service code is called with a Context argument which gives access to Restate API calls. These API calls translate to calls on the StateMachine which persist information through the Restate server and continue once the Restate server has responded.

I hope this helps navigating the code base a bit. If you have further questions, then let me know @Ibrahimogod.

jeremylcarter commented 1 month ago

I am keen to help out with a .NET SDK

slinkydeveloper commented 1 month ago

@jeremylcarter @Ibrahimogod

For who's keen to give a try to build a .NET SDK, we built for Python and Rust SDKs a common core module, available here https://github.com/restatedev/sdk-shared-core. This module handles most of the complexity of the protocol between SDKs and Restate runtime. It is built in Rust but in principle you can generate a binding for any you would like to use. This is an example of how we use PyO3 to generate a Rust -> Python binding: https://github.com/restatedev/sdk-python/blob/main/src/lib.rs This core module handles the state machine business logic, but not the network layer (which at the end of the day, it's a simple HTTP/2 server), and not the APIs on top, which ofc needs to be built on a language basis. Perhaps you can start by simply trying to generate the Rust -> C# bindings using something like https://github.com/Cysharp/csbindgen and then build the http server on top of it to connect to Restate.

If you look in this particular file https://github.com/restatedev/sdk-python/blob/main/python/restate/server_context.py you can see how the Python SDK integrates its "context" API with the Rust core. You can check the similar counterpart in Rust: https://github.com/restatedev/sdk-rust/blob/main/src/endpoint/context.rs

If you wanna know more, feel free to reach me out on Discord too (I'm @slinkydeveloper there too), I'll be happy to provide support to get started with a .NET SDK

jeremylcarter commented 1 month ago

So the typescript and java SDKs don't use this sdk-shared-core? Are you transitioning to try to use the shared core for all SDKs?

slinkydeveloper commented 1 month ago

So the typescript and java SDKs don't use this sdk-shared-core? Are you transitioning to try to use the shared core for all SDKs?

This is the idea, but we have no concrete plan/timelines for that atm given what we have works and it's tested. But going forward, this is definitely something we're considering for ease of maintenance.

joebowbeer commented 2 weeks ago

@tillrohrmann wrote:

at the moment Restate supports TS, Java and Kotlin

I also see this statement at the top of your README, and I'm thankful that TS is among your bellwethers

Then at the bottom of the README there is a longer list of SDKs. Is this the expanded list of supported languages you mentioned?

slinkydeveloper commented 2 weeks ago

@joebowbeer Yep between june and now we added Rust, Python and Golang :smile: look on the side bar here https://docs.restate.dev/

jeremylcarter commented 5 days ago

I'm starting work on this in my spare time. If I make any progress, ill update this ticket.