Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sizes of cursors and pages are integers in REST. #3938

Merged
merged 1 commit into from
Jul 19, 2024
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
4 changes: 2 additions & 2 deletions cmd/cli/app/history/history_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func listCommand(ctx context.Context, cmd *cobra.Command, _ []string, conn *grpc

// page options
cursorStr := viper.GetString("cursor")
size := viper.GetUint64("size")
size := viper.GetUint32("size")

format := viper.GetString("output")

Expand Down Expand Up @@ -141,7 +141,7 @@ func listCommand(ctx context.Context, cmd *cobra.Command, _ []string, conn *grpc
return nil
}

func cursorFromOptions(cursorStr string, size uint64) *minderv1.Cursor {
func cursorFromOptions(cursorStr string, size uint32) *minderv1.Cursor {
var cursor *minderv1.Cursor
if cursorStr != "" || size != 0 {
cursor = &minderv1.Cursor{}
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/ref/proto.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/controlplane/handlers_evalstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ import (
)

const (
defaultPageSize uint64 = 25
defaultPageSize uint32 = 25
// Maximum page size has a conservative value at the moment,
// we can raise it once we have more insight on its
// performance impact.
maxPageSize uint64 = 25
maxPageSize uint32 = 25
)

// ListEvaluationHistory lists current and past evaluation results for
Expand Down Expand Up @@ -193,7 +193,7 @@ func fromEvaluationHistoryRow(
return res, nil
}

func makeCursor(cursor []byte, size uint64) *minderv1.Cursor {
func makeCursor(cursor []byte, size uint32) *minderv1.Cursor {
return &minderv1.Cursor{
Cursor: base64.StdEncoding.EncodeToString(cursor),
Size: size,
Expand Down
2 changes: 1 addition & 1 deletion internal/history/mock/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/history/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type EvaluationHistoryService interface {
ctx context.Context,
qtx db.Querier,
cursor *ListEvaluationCursor,
size uint64,
size uint32,
filter ListEvaluationFilter,
) (*ListEvaluationHistoryResult, error)
}
Expand Down Expand Up @@ -184,7 +184,7 @@ func (_ *evaluationHistoryService) ListEvaluationHistory(
ctx context.Context,
qtx db.Querier,
cursor *ListEvaluationCursor,
size uint64,
size uint32,
filter ListEvaluationFilter,
) (*ListEvaluationHistoryResult, error) {
params := db.ListEvaluationHistoryParams{
Expand Down
2 changes: 1 addition & 1 deletion internal/history/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func TestListEvaluationHistory(t *testing.T) {
name string
dbSetup dbf.DBMockBuilder
cursor *ListEvaluationCursor
size uint64
size uint32
filter ListEvaluationFilter
checkf func(*testing.T, *ListEvaluationHistoryResult)
err bool
Expand Down
12 changes: 6 additions & 6 deletions pkg/api/openapi/minder/v1/minder.swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pkg/api/protobuf/go/minder/v1/minder.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions proto/minder/v1/minder.proto
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@
// an per-rpc basis.
string cursor = 1;
// size is the number of items to retrieve from the collection.
uint64 size = 2;
uint32 size = 2;

Check failure on line 106 in proto/minder/v1/minder.proto

View workflow job for this annotation

GitHub Actions / proto-breaking-changes

Field "2" with name "size" on message "Cursor" changed type from "uint64" to "uint32". See https://developers.google.com/protocol-buffers/docs/proto3#updating for wire compatibility rules and https://developers.google.com/protocol-buffers/docs/proto3#json for JSON compatibility rules.
}

// CursorPage message used in response messages. Its purpose is to
// send to clients links pointing to next and/or previous collection
// subsets with respect to the one containing this struct.
message CursorPage {
// Total number of records matching the request. This is optional.
uint64 total_records = 1;
uint32 total_records = 1;

Check failure on line 114 in proto/minder/v1/minder.proto

View workflow job for this annotation

GitHub Actions / proto-breaking-changes

Field "1" with name "total_records" on message "CursorPage" changed type from "uint64" to "uint32". See https://developers.google.com/protocol-buffers/docs/proto3#updating for wire compatibility rules and https://developers.google.com/protocol-buffers/docs/proto3#json for JSON compatibility rules.
// Cursor pointing to retrieve results logically placed after the
// ones shipped with the message containing this struct.
Cursor next = 2;
Expand Down
Loading