-
Notifications
You must be signed in to change notification settings - Fork 37
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
Write Durable Objects in Go #29
Comments
Hi, @eliezedeck ! Thank you for your feedback. In conclusion, I believe it is possible. However, the implementation will require one of the following two patterns.
In either case, due to the nature of Durable Objects, JavaScript code is required. Durable Objects must be declared and exported as a JavaScript class. The problem with this is that it relies on the ES module. In the case of Pattern 1, it is likely that the following short code would need to be added to the JavaScript: import { createDurableObjectClass } from "./utils.mjs";
export const Counter = createDurableObjectClass("Counter"); For pattern 2, I would provide the workers command as a CLI tool to automatically generate the current worker.mjs file. $ workers generate . Pattern 1 needs to be investigated to see if it can be implemented. Hopefully, this will be a relatively lightweight implementation since there is no need to provide a CLI tool. However, some additional work will be required to wrap the functionality provided by Durable Objects. Pattern 2 can certainly be implemented. However, the hurdle for implementing a "worker" may be somewhat higher because of the code generation required; wrapping the functionality provided by Durable Objects would require the same amount of extra work as Pattern 1. In any case, it seems difficult to achieve this immediately. I'll put it on the wish list! cc: @akarasz |
Thank you for the details explanation @syumai. I hope it'll be possible, hopefully one day. |
Hi,
First of all, I'd like to express my thanks and my encouragement for the folks behind this project. I think this deserve full support from Cloudflare.
Now, I seem to have noticed that the Durable Objects can only be written in JS. I'd like to know if there is a plan to support writing actual DurableObject classes using Go itself, and not just the ability to call the stub from Go.
Thank you.
The text was updated successfully, but these errors were encountered: