Skip to content

Commit

Permalink
fix: add meta to support new format (#622)
Browse files Browse the repository at this point in the history
* fix: add meta to support new format

* Update

* Update

* Update
  • Loading branch information
sjaanus authored Jan 8, 2025
1 parent 9de3014 commit 4b80ea9
Show file tree
Hide file tree
Showing 17 changed files with 122 additions and 77 deletions.
167 changes: 92 additions & 75 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions examples/hostedexample.json
Original file line number Diff line number Diff line change
Expand Up @@ -657,5 +657,10 @@
],
"environment": "production",
"inlineSegmentConstraints": true
},
"meta": {
"revisionId": 21,
"etag": "\"76d8bb0e:21\"",
"queryHash": "76d8bb0e"
}
}
4 changes: 2 additions & 2 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ tokio-stream = { version = "0.1.17" }
tracing = { version = "0.1.40", features = ["log"] }
tracing-subscriber = { version = "0.3.18", features = ["json", "env-filter"] }
ulid = "1.1.2"
unleash-types = { version = "0.14", features = ["openapi", "hashes"] }
unleash-yggdrasil = { version = "0.14.1" }
unleash-types = { version = "0.15.3", features = ["openapi", "hashes"] }
unleash-yggdrasil = { version = "0.14.3" }
utoipa = { version = "5", features = ["actix_extras", "chrono"] }
utoipa-swagger-ui = { version = "8", features = ["actix-web"] }
[dev-dependencies]
Expand Down
2 changes: 2 additions & 0 deletions server/src/client_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ mod tests {
],
segments: None,
query: None,
meta: None,
}
}

Expand Down Expand Up @@ -1301,6 +1302,7 @@ mod tests {
},
],
segments: None,
meta: None,
};
let mut dx_token = EdgeToken::from_str("dx:development.secret123").unwrap();
dx_token.status = TokenValidationStatus::Validated;
Expand Down
1 change: 1 addition & 0 deletions server/src/feature_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ fn update_client_features(
s
}),
query: old.query.clone().or(update.query.clone()),
meta: old.meta.clone().or(update.meta.clone()),
}
}

Expand Down
5 changes: 5 additions & 0 deletions server/src/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub(crate) fn filter_client_features(
segments: feature_cache.segments.clone(),
query: feature_cache.query.clone(),
version: feature_cache.version,
meta: feature_cache.meta.clone(),
}
}

Expand Down Expand Up @@ -90,6 +91,7 @@ mod tests {
}],
query: None,
segments: None,
meta: None,
};

let map: DashMap<String, ClientFeatures> = DashMap::default();
Expand Down Expand Up @@ -134,6 +136,7 @@ mod tests {
],
query: None,
segments: None,
meta: None,
};

let map: DashMap<String, ClientFeatures> = DashMap::default();
Expand Down Expand Up @@ -169,6 +172,7 @@ mod tests {
],
query: None,
segments: None,
meta: None,
};

let map: DashMap<String, ClientFeatures> = DashMap::default();
Expand Down Expand Up @@ -221,6 +225,7 @@ mod tests {
],
query: None,
segments: None,
meta: None,
};

let map: DashMap<String, ClientFeatures> = DashMap::default();
Expand Down
3 changes: 3 additions & 0 deletions server/src/frontend_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ mod tests {
}],
segments: None,
query: None,
meta: None,
}
}

Expand Down Expand Up @@ -885,6 +886,7 @@ mod tests {
}],
segments: None,
query: None,
meta: None,
}
}

Expand All @@ -908,6 +910,7 @@ mod tests {
],
segments: None,
query: None,
meta: None,
}
}

Expand Down
3 changes: 3 additions & 0 deletions server/src/http/broadcaster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ mod test {
features: vec![],
query: None,
segments: None,
meta: None,
},
);
}
Expand Down Expand Up @@ -325,6 +326,7 @@ mod test {
}],
segments: None,
query: None,
meta: None,
},
);

Expand Down Expand Up @@ -360,6 +362,7 @@ mod test {
}],
segments: None,
query: None,
meta: None,
},
);

Expand Down
1 change: 1 addition & 0 deletions server/src/http/unleash_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ mod tests {
],
segments: None,
query: None,
meta: None,
}
}

Expand Down
1 change: 1 addition & 0 deletions server/src/internal_backstage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ mod tests {
query: None,
segments: None,
version: 2,
meta: None,
};
let client_features = FeatureCache::default();
client_features.insert(
Expand Down
1 change: 1 addition & 0 deletions server/src/offline/offline_hotload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ fn make_simple_bootstrap(simple_bootstrap: HashMap<String, SimpleFeature>) -> Cl
features,
segments: None,
query: None,
meta: None,
}
}

Expand Down
1 change: 1 addition & 0 deletions server/src/persistence/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ mod tests {
version: 2,
segments: None,
query: None,
meta: None,
};

let formatted_data = vec![("some-environment".into(), client_features)];
Expand Down
1 change: 1 addition & 0 deletions server/src/ready_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ mod tests {
query: None,
segments: None,
version: 2,
meta: None,
};
let client_features: FeatureCache = FeatureCache::default();
client_features.insert(
Expand Down
1 change: 1 addition & 0 deletions server/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ pub enum TokenType {
}

#[derive(Clone, Debug)]
#[allow(clippy::large_enum_variant)]
pub enum ClientFeaturesResponse {
NoUpdate(EntityTag),
Updated(ClientFeatures, Option<EntityTag>),
Expand Down
1 change: 1 addition & 0 deletions server/tests/redis_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ async fn redis_saves_and_restores_features_correctly() {
query: None,
segments: None,
version: 2,
meta: None,
};
let environment = "development";
redis_persister
Expand Down
1 change: 1 addition & 0 deletions server/tests/s3_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ mod s3_tests {
],
segments: None,
query: None,
meta: None,
};
let config = s3::config::Config::builder()
.region(Region::new("us-east-1"))
Expand Down
1 change: 1 addition & 0 deletions server/tests/streaming_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ mod streaming_test {
environment: Some("development".into()),
inline_segment_constraints: Some(false),
}),
meta: None,
};

let mut stream = es_client.stream();
Expand Down

0 comments on commit 4b80ea9

Please sign in to comment.