Storage: Add mode 2 dual writing improvements (#87204)

* Fix mode 2 List test
* Set origin timestamp during conversion to k8s resource
* Add instructions for updating a playlist
* Handle partial deletions of a collection in mode 2
This commit is contained in:
Arati R
2024-05-02 16:06:51 +02:00
committed by GitHub
parent b1d98939e1
commit 9e6de035c0
7 changed files with 173 additions and 85 deletions

View File

@@ -91,9 +91,11 @@ func convertToK8sResource(v *playlistsvc.PlaylistDTO, namespacer request.Namespa
if err == nil {
meta.SetUpdatedTimestampMillis(v.UpdatedAt)
if v.Id > 0 {
createdAt := time.UnixMilli(v.CreatedAt)
meta.SetOriginInfo(&utils.ResourceOriginInfo{
Name: "SQL",
Key: fmt.Sprintf("%d", v.Id),
Name: "SQL",
Key: fmt.Sprintf("%d", v.Id),
Timestamp: &createdAt,
})
}
}

View File

@@ -44,6 +44,7 @@ func TestPlaylistConversion(t *testing.T) {
"annotations": {
"grafana.app/originKey": "123",
"grafana.app/originName": "SQL",
"grafana.app/originTimestamp":"1970-01-01T00:00:12Z",
"grafana.app/updatedTimestamp": "1970-01-01T00:00:54Z"
}
},