Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/seqapi/v1/seq_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ message FetchAsyncSearchResultResponse {
uint64 disk_usage = 8;
string meta = 9;
Error error = 10;
optional google.protobuf.Timestamp done_at = 12;
}

message GetAsyncSearchesListRequest {
Expand All @@ -322,6 +323,7 @@ message GetAsyncSearchesListResponse {
uint64 disk_usage = 8;
string owner_name = 9;
optional string error = 10;
optional google.protobuf.Timestamp done_at = 11;
}

repeated ListItem searches = 1;
Expand Down
2 changes: 2 additions & 0 deletions internal/api/seqapi/v1/grpc/fetch_async_search_result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func TestServeFetchAsyncSearchResult(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
Meta: meta,
Expand Down Expand Up @@ -177,6 +178,7 @@ func TestServeFetchAsyncSearchResult(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
Meta: meta,
Expand Down
3 changes: 3 additions & 0 deletions internal/api/seqapi/v1/grpc/get_async_searches_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func TestServeGetAsyncSearchesList(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
OwnerName: mockUserName1,
Expand Down Expand Up @@ -118,6 +119,7 @@ func TestServeGetAsyncSearchesList(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
OwnerName: mockUserName1,
Expand Down Expand Up @@ -151,6 +153,7 @@ func TestServeGetAsyncSearchesList(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
OwnerName: mockUserName1,
Expand Down
8 changes: 8 additions & 0 deletions internal/api/seqapi/v1/http/fetch_async_search_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ type fetchAsyncSearchResultResponse struct {
StartedAt time.Time `json:"started_at" format:"date-time"`
ExpiresAt time.Time `json:"expires_at" format:"date-time"`
CanceledAt *time.Time `json:"canceled_at,omitempty" format:"date-time"`
DoneAt *time.Time `json:"done_at,omitempty" format:"date-time"`
Progress float64 `json:"progress"`
DiskUsage string `json:"disk_usage" format:"int64"`
Meta string `json:"meta"`
Expand All @@ -124,13 +125,20 @@ func fetchAsyncSearchResultResponseFromProto(resp *seqapi.FetchAsyncSearchResult
canceledAt = &t
}

var doneAt *time.Time
if resp.DoneAt != nil {
t := resp.DoneAt.AsTime()
doneAt = &t
}

return fetchAsyncSearchResultResponse{
Status: asyncSearchStatusFromProto(resp.Status),
Request: startAsyncSearchRequestFromProto(resp.Request),
Response: asyncSearchResponseFromProto(resp.Response, resp.Request.Aggs),
StartedAt: resp.StartedAt.AsTime(),
ExpiresAt: resp.ExpiresAt.AsTime(),
CanceledAt: canceledAt,
DoneAt: doneAt,
Progress: resp.Progress,
DiskUsage: strconv.FormatUint(resp.DiskUsage, 10),
Meta: resp.Meta,
Expand Down
4 changes: 4 additions & 0 deletions internal/api/seqapi/v1/http/fetch_async_search_result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ func TestServeFetchAsyncSearchResult(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
Error: &seqapi.Error{
Expand Down Expand Up @@ -270,6 +271,7 @@ func TestServeFetchAsyncSearchResult(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
Error: &seqapi.Error{
Expand Down Expand Up @@ -325,6 +327,7 @@ func TestServeFetchAsyncSearchResult(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
Error: &seqapi.Error{
Expand Down Expand Up @@ -378,6 +381,7 @@ func TestServeFetchAsyncSearchResult(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
Error: &seqapi.Error{
Expand Down
8 changes: 8 additions & 0 deletions internal/api/seqapi/v1/http/get_async_searches_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ type asyncSearchesListItem struct {
StartedAt time.Time `json:"started_at" format:"date-time"`
ExpiresAt time.Time `json:"expires_at" format:"date-time"`
CanceledAt *time.Time `json:"canceled_at,omitempty" format:"date-time"`
DoneAt *time.Time `json:"done_at,omitempty" format:"date-time"`
Progress float64 `json:"progress"`
DiskUsage string `json:"disk_usage" format:"int64"`
OwnerName string `json:"owner_name"`
Expand All @@ -139,13 +140,20 @@ func getAsyncSearchesListResponseFromProto(resp *seqapi.GetAsyncSearchesListResp
canceledAt = &t
}

var doneAt *time.Time
if s.DoneAt != nil {
t := s.DoneAt.AsTime()
doneAt = &t
}

searches = append(searches, asyncSearchesListItem{
SearchID: s.SearchId,
Status: asyncSearchStatusFromProto(s.Status),
Request: startAsyncSearchRequestFromProto(s.Request),
StartedAt: s.StartedAt.AsTime(),
ExpiresAt: s.ExpiresAt.AsTime(),
CanceledAt: canceledAt,
DoneAt: doneAt,
Progress: s.Progress,
DiskUsage: strconv.FormatUint(s.DiskUsage, 10),
OwnerName: s.OwnerName,
Expand Down
8 changes: 8 additions & 0 deletions internal/api/seqapi/v1/http/get_async_searches_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func TestServeGetAsyncSearchesList(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
OwnerName: mockUserName1,
Expand Down Expand Up @@ -112,6 +113,7 @@ func TestServeGetAsyncSearchesList(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
OwnerName: mockUserName1,
Expand Down Expand Up @@ -175,6 +177,7 @@ func TestServeGetAsyncSearchesList(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
OwnerName: mockUserName1,
Expand Down Expand Up @@ -206,6 +209,7 @@ func TestServeGetAsyncSearchesList(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
OwnerName: mockUserName1,
Expand Down Expand Up @@ -235,6 +239,7 @@ func TestServeGetAsyncSearchesList(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
OwnerName: mockUserName1,
Expand Down Expand Up @@ -262,6 +267,7 @@ func TestServeGetAsyncSearchesList(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
OwnerName: mockUserName1,
Expand Down Expand Up @@ -308,6 +314,7 @@ func TestServeGetAsyncSearchesList(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
OwnerName: mockUserName1,
Expand Down Expand Up @@ -335,6 +342,7 @@ func TestServeGetAsyncSearchesList(t *testing.T) {
},
StartedAt: timestamppb.New(testTimestamp.Add(-30 * time.Second)),
ExpiresAt: timestamppb.New(testTimestamp.Add(30 * time.Second)),
DoneAt: timestamppb.New(testTimestamp),
Progress: 1,
DiskUsage: 512,
OwnerName: mockUserName1,
Expand Down
2 changes: 2 additions & 0 deletions internal/pkg/client/seqdb/grpc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ func (p *proxyFetchAsyncSearchResultResp) toProto() (*seqapi.FetchAsyncSearchRes
StartedAt: p.StartedAt,
ExpiresAt: p.ExpiresAt,
CanceledAt: p.CanceledAt,
DoneAt: p.DoneAt,
Progress: p.Progress,
DiskUsage: p.DiskUsage,
Error: (*proxyError)(p.Error).toProto(),
Expand Down Expand Up @@ -440,6 +441,7 @@ func (p *proxyGetAsyncSearchesListResp) toProto() *seqapi.GetAsyncSearchesListRe
StartedAt: s.StartedAt,
ExpiresAt: s.ExpiresAt,
CanceledAt: s.CanceledAt,
DoneAt: s.DoneAt,
Progress: s.Progress,
DiskUsage: s.DiskUsage,
Error: s.Error,
Expand Down
Loading
Loading