Skip to main content

shep_core/protocol/request/
selector_spec.rs

1//! [`SelectorSpec`], the wire form of a verb's sheep selector.
2
3use serde::{Deserialize, Serialize};
4
5/// Serializable selector (mirror of [`crate::selector::ProcessSelector`];
6/// regex travels as its source string)
7// wire format: changing this is a breaking change
8#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
9#[serde(tag = "kind", content = "value", rename_all = "snake_case")]
10pub enum SelectorSpec {
11    /// Every sheep
12    All,
13    /// By id
14    Id(u32),
15    /// By exact name
16    Name(String),
17    /// By regex source
18    Regex(String),
19    /// By fold name
20    Fold(String),
21    // Both field names are wire contract, pinned by `request_wire_v11`.
22    /// By app name and instance slot
23    ///
24    /// On the wire: `{"kind":"instance","value":{"name":"web","slot":2}}`.
25    Instance {
26        /// The app name
27        name: String,
28        /// The instance slot, counting from 0
29        slot: u32,
30    },
31}