#[non_exhaustive]pub struct TrafficSplit {
pub shard_by: ShardBy,
pub allocations: HashMap<String, f64>,
/* private fields */
}Expand description
Traffic routing configuration for versions within a single service. Traffic splits define how traffic directed to the service is assigned to versions.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.shard_by: ShardByMechanism used to determine which version a request is sent to. The traffic selection algorithm will be stable for either type until allocations are changed.
allocations: HashMap<String, f64>Mapping from version IDs within the service to fractional (0.000, 1] allocations of traffic for that version. Each version can be specified only once, but some versions in the service may not have any traffic allocation. Services that have traffic allocated cannot be deleted until either the service is deleted or their traffic allocation is removed. Allocations must sum to 1. Up to two decimal place precision is supported for IP-based splits and up to three decimal places is supported for cookie-based splits.
Implementations§
Source§impl TrafficSplit
impl TrafficSplit
pub fn new() -> Self
Sourcepub fn set_shard_by<T: Into<ShardBy>>(self, v: T) -> Self
pub fn set_shard_by<T: Into<ShardBy>>(self, v: T) -> Self
Sets the value of shard_by.
Sourcepub fn set_allocations<T, K, V>(self, v: T) -> Self
pub fn set_allocations<T, K, V>(self, v: T) -> Self
Sets the value of allocations.
Trait Implementations§
Source§impl Clone for TrafficSplit
impl Clone for TrafficSplit
Source§fn clone(&self) -> TrafficSplit
fn clone(&self) -> TrafficSplit
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more