Skip to content

Commit 8cb5619

Browse files
authored
fix: correlation data management (#1078)
- Bugfix for correlation where deletion was not happening correctly - Added title to CorrelationRequest and CorrelationConfig structs
1 parent 9122158 commit 8cb5619

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/correlation/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ pub enum CorrelationVersion {
150150
#[serde(rename_all = "camelCase")]
151151
pub struct CorrelationConfig {
152152
pub version: CorrelationVersion,
153+
pub title: String,
153154
pub id: String,
154155
pub table_configs: Vec<TableConfig>,
155156
pub join_config: JoinConfig,
@@ -164,6 +165,7 @@ impl CorrelationConfig {}
164165
#[serde(rename_all = "camelCase")]
165166
pub struct CorrelationRequest {
166167
pub version: CorrelationVersion,
168+
pub title: String,
167169
pub table_configs: Vec<TableConfig>,
168170
pub join_config: JoinConfig,
169171
pub filter: Option<FilterQuery>,
@@ -175,6 +177,7 @@ impl From<CorrelationRequest> for CorrelationConfig {
175177
fn from(val: CorrelationRequest) -> Self {
176178
Self {
177179
version: val.version,
180+
title: val.title,
178181
id: get_hash(Utc::now().timestamp_micros().to_string().as_str()),
179182
table_configs: val.table_configs,
180183
join_config: val.join_config,
@@ -189,6 +192,7 @@ impl CorrelationRequest {
189192
pub fn generate_correlation_config(self, id: String) -> CorrelationConfig {
190193
CorrelationConfig {
191194
version: self.version,
195+
title: self.title,
192196
id,
193197
table_configs: self.table_configs,
194198
join_config: self.join_config,

src/handlers/http/correlation.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,10 @@ pub async fn delete(req: HttpRequest) -> Result<impl Responder, CorrelationError
143143

144144
// Delete from disk
145145
let store = CONFIG.storage().get_object_store();
146-
let path =
147-
RelativePathBuf::from_iter([CORRELATIONS_ROOT_DIRECTORY, &correlation.id.to_string()]);
146+
let path = RelativePathBuf::from_iter([
147+
CORRELATIONS_ROOT_DIRECTORY,
148+
&format!("{}.json", correlation_id),
149+
]);
148150
store.delete_object(&path).await?;
149151

150152
// Delete from memory

0 commit comments

Comments
 (0)