Skip to content
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

v4: Redesign shard.Manager #342

Open
diamondburned opened this issue Sep 9, 2022 · 6 comments
Open

v4: Redesign shard.Manager #342

diamondburned opened this issue Sep 9, 2022 · 6 comments
Milestone

Comments

@diamondburned
Copy link
Owner

diamondburned commented Sep 9, 2022

In v4, at the very least, shard.Manager should now be generic.

Since we already have an interface for it, we can do this:

type Manager[S Shard] struct{}

func NewManager[S](idData gateway.IdentifyCommand, fn NewShardFunc[S]) (*Manager[S], error)

It might also be worth to consider redesigning Manager to a single instance that exposes an event channel, then wrap it inside another instance that dispatches those events to each shard instance.

We can then have state wrap the shard manager and provide its own states internally. This will avoid interfaces entirely.

@diamondburned diamondburned added this to the v4 milestone Oct 13, 2022
@switchupcb
Copy link

Would you be interested in implementing a Shard Manager for Disgo?

@diamondburned
Copy link
Owner Author

I don't use Disgo.

@diamondburned
Copy link
Owner Author

@switchupcb This is irrelevant to the issue so I'll try to keep it short, but do you have an intermediate format (like jsonschema) for your dasgo?

I'm been interested in generating the bulk of Arikawa's API structures, but a lot of it cannot be autogenerated using regular codegens, so I've been looking to write a custom solution that can generate code from some schema.

@switchupcb
Copy link

I am unfamiliar with jsonschema, but it provides metadata about the JSON object type. As a result, you are requesting a code generator that parses every dasgo object and allows you to generate code based on the structs. copygen is a type-based code generator that allows you to specify types to parse, then create code generators for them accordingly.

If you need any more help, feel free to let me know.

@diamondburned
Copy link
Owner Author

As a result, you are requesting a code generator that parses every dasgo object and allows you to generate code based on the structs.

Ah well. I guess I have to parse the Go code, then. That's a bummer for me.

@switchupcb
Copy link

switchupcb commented Nov 29, 2022

If you plan to use Dasgo let me know or add me on Discord. I will add your arikawa maintainers to the maintainer list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants