Add an updated flag to backup details (#1813)
## Description Adds a flag in backup details that indicates whether the item in that backup is new/updated. Currently always set to `true` but once we implement #1800 - we will set this to false for existing items from base snapshots. ## Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No ## Type of change <!--- Please check the type of change your PR introduces: ---> - [x] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [ ] 💻 CI/Deployment - [ ] 🐹 Trivial/Minor ## Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #1812 ## Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
0b5bf1bc8e
commit
debe74a113
@ -415,6 +415,7 @@ func restoreCollection(
|
||||
itemPath.String(),
|
||||
itemPath.ShortRef(),
|
||||
"",
|
||||
true,
|
||||
details.ItemInfo{
|
||||
Exchange: info,
|
||||
})
|
||||
|
||||
@ -171,6 +171,7 @@ func RestoreCollection(
|
||||
itemPath.String(),
|
||||
itemPath.ShortRef(),
|
||||
"",
|
||||
true,
|
||||
itemInfo)
|
||||
|
||||
metrics.Successes++
|
||||
|
||||
@ -157,6 +157,7 @@ func (cp *corsoProgress) FinishedFile(relativePath string, err error) {
|
||||
d.repoPath.String(),
|
||||
d.repoPath.ShortRef(),
|
||||
parent.ShortRef(),
|
||||
true,
|
||||
d.info,
|
||||
)
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ func (suite *StreamStoreIntegrationSuite) TestDetails() {
|
||||
|
||||
deets := &details.Details{}
|
||||
|
||||
deets.Add("ref", "shortref", "parentref",
|
||||
deets.Add("ref", "shortref", "parentref", true,
|
||||
details.ItemInfo{
|
||||
Exchange: &details.ExchangeInfo{
|
||||
Subject: "hello world",
|
||||
@ -69,6 +69,7 @@ func (suite *StreamStoreIntegrationSuite) TestDetails() {
|
||||
assert.Equal(t, deets.Entries[0].ParentRef, readDeets.Entries[0].ParentRef)
|
||||
assert.Equal(t, deets.Entries[0].ShortRef, readDeets.Entries[0].ShortRef)
|
||||
assert.Equal(t, deets.Entries[0].RepoRef, readDeets.Entries[0].RepoRef)
|
||||
assert.Equal(t, deets.Entries[0].Updated, readDeets.Entries[0].Updated)
|
||||
assert.NotNil(t, readDeets.Entries[0].Exchange)
|
||||
assert.Equal(t, *deets.Entries[0].Exchange, *readDeets.Entries[0].Exchange)
|
||||
}
|
||||
|
||||
@ -115,13 +115,14 @@ type Details struct {
|
||||
knownFolders map[string]struct{} `json:"-"`
|
||||
}
|
||||
|
||||
func (d *Details) Add(repoRef, shortRef, parentRef string, info ItemInfo) {
|
||||
func (d *Details) Add(repoRef, shortRef, parentRef string, updated bool, info ItemInfo) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
d.Entries = append(d.Entries, DetailsEntry{
|
||||
RepoRef: repoRef,
|
||||
ShortRef: shortRef,
|
||||
ParentRef: parentRef,
|
||||
Updated: updated,
|
||||
ItemInfo: info,
|
||||
})
|
||||
}
|
||||
@ -163,6 +164,9 @@ type DetailsEntry struct {
|
||||
RepoRef string `json:"repoRef"`
|
||||
ShortRef string `json:"shortRef"`
|
||||
ParentRef string `json:"parentRef,omitempty"`
|
||||
// Indicates the item was added or updated in this backup
|
||||
// Always `true` for full backups
|
||||
Updated bool `json:"updated"`
|
||||
ItemInfo
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user