Create a helper to go from a reason to a reason with the metadata service of the original reason (#5092)
Will be used in later PRs to help make long-running streamstore snapshots safer to create if they ever go past the kopia checkpoint interval --- #### 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 - [x] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) merge after: * #5091 #### Test Plan - [ ] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
dd9bba6caa
commit
e45b3565ad
@ -17,6 +17,8 @@ type Reasoner interface {
|
||||
// SubtreePath returns the path prefix for data in existing backups that have
|
||||
// parameters (tenant, protected resourced, etc) that match this Reasoner.
|
||||
SubtreePath() (path.Path, error)
|
||||
// ToMetadata returns the corresponding metadata reason for this reason.
|
||||
ToMetadata() Reasoner
|
||||
}
|
||||
|
||||
func NewReason(
|
||||
@ -67,3 +69,11 @@ func (r reason) SubtreePath() (path.Path, error) {
|
||||
|
||||
return p, clues.Wrap(err, "building path").OrNil()
|
||||
}
|
||||
|
||||
func (r reason) ToMetadata() Reasoner {
|
||||
return NewReason(
|
||||
r.Tenant(),
|
||||
r.ProtectedResource(),
|
||||
r.Service().ToMetadata(),
|
||||
r.Category())
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user