RFC: Removal of the ShardScheme::Auto variant
#1604
vilgotf
started this conversation in
Development & RFCs
Replies: 1 comment
-
|
Using an |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently
ShardScheme(twilight_gateway::cluster::scheme::ShardScheme) has three variants:ShardSchemecan be set inClusterBuilderand is then used to construct the shards. So far so good.ShardSchemeis, however, also publicly accessible through the cluster'sConfig(cluster.config().shard_scheme()), but accessing its information (iter(),from(),total()&to()) requires handlingOptions when it's theAutovariant. TheAutovariant is actually internally translated into theRangevariant from Discord's auto-sharding, but this information is then dropped. ExposingRange, instead ofAutoon auto-sharding, tells the user what Discord suggested.Removing the
Autovariant is done by storing anOption<ShardScheme>in theClusterBuilder, and treatingNoneas auto-sharding.An alternative is to add a
auto-sharding: boolfield (with an accompanyingfn is_auto_sharding(&self) -> bool;method) toShardScheme::Rangeto highlight whenRangewas user specified vs generated by Discord's auto-sharding.Implementation pr: #1600
Beta Was this translation helpful? Give feedback.
All reactions