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

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 {