From 5cfdd2269c2a5106e78c3d5458789de7f030ccfe Mon Sep 17 00:00:00 2001 From: Elijah Date: Fri, 6 Oct 2023 13:17:40 -1000 Subject: [PATCH] fix: fill/rename LastVerified -> LastUpdated in replica (#136) closes #132 closes #137 --- api/server/handler.go | 2 +- blob/blob.go | 8 ++++---- integration/singularity/store.go | 13 +++++++++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/api/server/handler.go b/api/server/handler.go index 4db7048..851b65c 100644 --- a/api/server/handler.go +++ b/api/server/handler.go @@ -158,7 +158,7 @@ func (m *HttpServer) handleBlobGetStatusByID(w http.ResponseWriter, r *http.Requ response.Replicas = append(response.Replicas, api.Replica{ Provider: replica.Provider, Status: replica.Status, - LastVerified: replica.LastVerified, + LastVerified: replica.LastUpdated, Expiration: replica.Expiration, }) } diff --git a/blob/blob.go b/blob/blob.go index 35e9102..29d7553 100644 --- a/blob/blob.go +++ b/blob/blob.go @@ -36,10 +36,10 @@ type ( Replicas []Replica } Replica struct { - Provider string - Status string - LastVerified time.Time - Expiration time.Time + Provider string + Status string + LastUpdated time.Time + Expiration time.Time } Store interface { Put(context.Context, io.ReadCloser) (*Descriptor, error) diff --git a/integration/singularity/store.go b/integration/singularity/store.go index 32a8f7e..b209857 100644 --- a/integration/singularity/store.go +++ b/integration/singularity/store.go @@ -462,11 +462,16 @@ func (s *SingularityStore) Describe(ctx context.Context, id blob.ID) (*blob.Desc } replicas := make([]blob.Replica, 0, len(getFileDealsRes.Payload)) for _, deal := range getFileDealsRes.Payload { + updatedAt, err := time.Parse("2006-01-02 15:04:05-07:00", deal.UpdatedAt) + if err != nil { + updatedAt = time.Time{} + } + replicas = append(replicas, blob.Replica{ - // TODO: figure out how to get LastVerified - Provider: deal.Provider, - Status: string(deal.State), - Expiration: epochutil.EpochToTime(int32(deal.EndEpoch)), + LastUpdated: updatedAt, + Provider: deal.Provider, + Status: string(deal.State), + Expiration: epochutil.EpochToTime(int32(deal.EndEpoch)), }) } descriptor.Status = &blob.Status{