track backup creation time on restore start (#918)

## Type of change

- [x] 🐹 Trivial/Minor

## Issue(s)

* #894

## Test Plan

- [x] 💪 Manual
This commit is contained in:
Keepers 2022-09-23 14:22:06 -06:00 committed by GitHub
parent 824f02469c
commit 679b32697b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 27 deletions

View File

@ -28,6 +28,7 @@ const (
RestoreEnd = "restore-end" RestoreEnd = "restore-end"
// Event Data Keys // Event Data Keys
BackupCreateTime = "backup-creation-time"
BackupID = "backup-id" BackupID = "backup-id"
DataRetrieved = "data-retrieved" DataRetrieved = "data-retrieved"
DataStored = "data-stored" DataStored = "data-stored"

View File

@ -95,7 +95,6 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) {
events.StartTime: startTime, events.StartTime: startTime,
events.Service: op.Selectors.Service.String(), events.Service: op.Selectors.Service.String(),
// TODO: initial backup ID, // TODO: initial backup ID,
// TODO: events.ExchangeResources: <count of resources>,
}, },
) )

View File

@ -86,21 +86,6 @@ type restoreStats struct {
func (op *RestoreOperation) Run(ctx context.Context) (err error) { func (op *RestoreOperation) Run(ctx context.Context) (err error) {
startTime := time.Now() startTime := time.Now()
// TODO: persist initial state of restoreOperation in modelstore
op.bus.Event(
ctx,
events.RestoreStart,
map[string]any{
events.StartTime: startTime,
events.Service: op.Selectors.Service.String(),
events.BackupID: op.BackupID,
// TODO: initial backup ID,
// TODO: events.ExchangeResources: <count of resources>,
// TODO: source backup time,
// TODO: restore options,
},
)
// persist operation results to the model store on exit // persist operation results to the model store on exit
opStats := restoreStats{} opStats := restoreStats{}
// TODO: persist results? // TODO: persist results?
@ -121,6 +106,18 @@ func (op *RestoreOperation) Run(ctx context.Context) (err error) {
return err return err
} }
// TODO: persist initial state of restoreOperation in modelstore
op.bus.Event(
ctx,
events.RestoreStart,
map[string]any{
events.StartTime: startTime,
events.BackupID: op.BackupID,
events.BackupCreateTime: b.CreationTime,
// TODO: restore options,
},
)
var fds *details.Details var fds *details.Details
switch op.Selectors.Service { switch op.Selectors.Service {