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
-
Currently
ShardScheme
(twilight_gateway::cluster::scheme::ShardScheme) has three variants:ShardScheme
can be set inClusterBuilder
and is then used to construct the shards. So far so good.ShardScheme
is, however, also publicly accessible through the cluster'sConfig
(cluster.config().shard_scheme()
), but accessing its information (iter()
,from()
,total()
&to()
) requires handlingOption
s when it's theAuto
variant. TheAuto
variant is actually internally translated into theRange
variant from Discord's auto-sharding, but this information is then dropped. ExposingRange
, instead ofAuto
on auto-sharding, tells the user what Discord suggested.Removing the
Auto
variant is done by storing anOption<ShardScheme>
in theClusterBuilder
, and treatingNone
as auto-sharding.An alternative is to add a
auto-sharding: bool
field (with an accompanyingfn is_auto_sharding(&self) -> bool;
method) toShardScheme::Range
to highlight whenRange
was user specified vs generated by Discord's auto-sharding.Implementation pr: #1600
Beta Was this translation helpful? Give feedback.
All reactions