pub struct ExplodeSpec {
pub field: String,
pub table: String,
pub primary_key: Vec<String>,
pub columns: Vec<ExplodeColumn>,
pub track_history: bool,
}Expand description
v0.31 / #40: declarative “flatten this JSON array into a real
SQLite table” spec on an inventory manifest. The projector
creates the table on first registration (CREATE TABLE IF NOT
EXISTS + indexes) and writes a row per element of
payload[field] on every result, scoped by (pc_id, job_id) so
each PC’s rows replace cleanly without a per-PC schema.
Fields§
§field: StringJSON array key under the payload to explode. E.g. "apps"
for payload: { apps: [{...}, {...}] }.
table: StringDerived SQLite table name. Operators choose this — pick
something namespaced + stable (inventory_sw_apps, not
apps) so multiple inventory manifests don’t collide on a
generic name.
primary_key: Vec<String>Element-level fields that uniquely identify a row inside one
PC’s payload. The full PK is (pc_id, job_id) + these columns. Required — operators must think about uniqueness
(e.g. ["name", "source"] for installed apps because the
same name appears in multiple uninstall hives).
v0.31 / #41: same tuple drives history identity. When
track_history is on, the projector serialises these
fields’ values into inventory_history.identity_json for
every change event, so queries like “every PC that ever
installed Chrome (any source)” filter on identity_json
content without a per-manifest schema.
columns: Vec<ExplodeColumn>Per-element fields that become columns in the derived table.
track_history: boolv0.31 / #41: when true (default false), the projector
diffs each PC’s incoming payload against the prior rows
for the same (pc_id, job_id) BEFORE the DELETE-then-INSERT
replace, and writes added / removed / changed events into
inventory_history. Lets operators answer time-dimension
questions (“when did Chrome 120 first appear on PC X?”,
“what’s the Win 11 23H2 rollout curve”) without storing
per-scan snapshots. Off by default so operators opt in
per-spec — history has a real storage cost on long-lived
deployments (mitigated by the 90-day default retention
sweeper, see cleanup module).
Trait Implementations§
Source§impl Clone for ExplodeSpec
impl Clone for ExplodeSpec
Source§fn clone(&self) -> ExplodeSpec
fn clone(&self) -> ExplodeSpec
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 ExplodeSpec
impl Debug for ExplodeSpec
Source§impl<'de> Deserialize<'de> for ExplodeSpec
impl<'de> Deserialize<'de> for ExplodeSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ExplodeSpec
impl JsonSchema for ExplodeSpec
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more