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,17 +28,18 @@ const (
RestoreEnd = "restore-end"
// Event Data Keys
BackupID = "backup-id"
DataRetrieved = "data-retrieved"
DataStored = "data-stored"
Duration = "duration"
EndTime = "end-time"
ItemsRead = "items-read"
ItemsWritten = "items-written"
Resources = "resources"
Service = "service"
StartTime = "start-time"
Status = "status"
BackupCreateTime = "backup-creation-time"
BackupID = "backup-id"
DataRetrieved = "data-retrieved"
DataStored = "data-stored"
Duration = "duration"
EndTime = "end-time"
ItemsRead = "items-read"
ItemsWritten = "items-written"
Resources = "resources"
Service = "service"
StartTime = "start-time"
Status = "status"
)
type Eventer interface {

View File

@ -95,7 +95,6 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) {
events.StartTime: startTime,
events.Service: op.Selectors.Service.String(),
// 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) {
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
opStats := restoreStats{}
// TODO: persist results?
@ -121,6 +106,18 @@ func (op *RestoreOperation) Run(ctx context.Context) (err error) {
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
switch op.Selectors.Service {