#[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
Sourcepub fn set_shard_by<T: Into<ShardBy>>(self, v: T) -> Self
pub fn set_shard_by<T: Into<ShardBy>>(self, v: T) -> Self
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.
§Example
let x = TrafficSplit::new().set_allocations([
("key0", 123.5),
("key1", 456.5),
]);Trait Implementations§
Source§impl Clone for TrafficSplit
impl Clone for TrafficSplit
Source§fn clone(&self) -> TrafficSplit
fn clone(&self) -> TrafficSplit
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TrafficSplit
impl Debug for TrafficSplit
Source§impl Default for TrafficSplit
impl Default for TrafficSplit
Source§fn default() -> TrafficSplit
fn default() -> TrafficSplit
Source§impl Message for TrafficSplit
impl Message for TrafficSplit
Source§impl PartialEq for TrafficSplit
impl PartialEq for TrafficSplit
Source§fn eq(&self, other: &TrafficSplit) -> bool
fn eq(&self, other: &TrafficSplit) -> bool
self and other values to be equal, and is used by ==.