Skip to content

Commit

Permalink
Drop pointer for page size fields (cadence-workflow#3935)
Browse files Browse the repository at this point in the history
  • Loading branch information
vytautas-karpavicius authored Jan 29, 2021
1 parent 5733f4f commit 4f45930
Show file tree
Hide file tree
Showing 18 changed files with 82 additions and 82 deletions.
2 changes: 1 addition & 1 deletion common/domain/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func (s *domainHandlerCommonSuite) TestListDomain() {
var token []byte
for doPaging := true; doPaging; doPaging = len(token) > 0 {
resp, err := s.handler.ListDomains(context.Background(), &types.ListDomainsRequest{
PageSize: common.Int32Ptr(pagesize),
PageSize: pagesize,
NextPageToken: token,
})
s.Nil(err)
Expand Down
24 changes: 12 additions & 12 deletions common/types/mapper/thrift/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -2344,7 +2344,7 @@ func FromGetWorkflowExecutionHistoryRequest(t *types.GetWorkflowExecutionHistory
return &shared.GetWorkflowExecutionHistoryRequest{
Domain: &t.Domain,
Execution: FromWorkflowExecution(t.Execution),
MaximumPageSize: t.MaximumPageSize,
MaximumPageSize: &t.MaximumPageSize,
NextPageToken: t.NextPageToken,
WaitForNewEvent: t.WaitForNewEvent,
HistoryEventFilterType: FromHistoryEventFilterType(t.HistoryEventFilterType),
Expand All @@ -2360,7 +2360,7 @@ func ToGetWorkflowExecutionHistoryRequest(t *shared.GetWorkflowExecutionHistoryR
return &types.GetWorkflowExecutionHistoryRequest{
Domain: t.GetDomain(),
Execution: ToWorkflowExecution(t.Execution),
MaximumPageSize: t.MaximumPageSize,
MaximumPageSize: t.GetMaximumPageSize(),
NextPageToken: t.NextPageToken,
WaitForNewEvent: t.WaitForNewEvent,
HistoryEventFilterType: ToHistoryEventFilterType(t.HistoryEventFilterType),
Expand Down Expand Up @@ -2733,7 +2733,7 @@ func FromListArchivedWorkflowExecutionsRequest(t *types.ListArchivedWorkflowExec
}
return &shared.ListArchivedWorkflowExecutionsRequest{
Domain: &t.Domain,
PageSize: t.PageSize,
PageSize: &t.PageSize,
NextPageToken: t.NextPageToken,
Query: t.Query,
}
Expand All @@ -2746,7 +2746,7 @@ func ToListArchivedWorkflowExecutionsRequest(t *shared.ListArchivedWorkflowExecu
}
return &types.ListArchivedWorkflowExecutionsRequest{
Domain: t.GetDomain(),
PageSize: t.PageSize,
PageSize: t.GetPageSize(),
NextPageToken: t.NextPageToken,
Query: t.Query,
}
Expand Down Expand Up @@ -2781,7 +2781,7 @@ func FromListClosedWorkflowExecutionsRequest(t *types.ListClosedWorkflowExecutio
}
return &shared.ListClosedWorkflowExecutionsRequest{
Domain: &t.Domain,
MaximumPageSize: t.MaximumPageSize,
MaximumPageSize: &t.MaximumPageSize,
NextPageToken: t.NextPageToken,
StartTimeFilter: FromStartTimeFilter(t.StartTimeFilter),
ExecutionFilter: FromWorkflowExecutionFilter(t.ExecutionFilter),
Expand All @@ -2797,7 +2797,7 @@ func ToListClosedWorkflowExecutionsRequest(t *shared.ListClosedWorkflowExecution
}
return &types.ListClosedWorkflowExecutionsRequest{
Domain: t.GetDomain(),
MaximumPageSize: t.MaximumPageSize,
MaximumPageSize: t.GetMaximumPageSize(),
NextPageToken: t.NextPageToken,
StartTimeFilter: ToStartTimeFilter(t.StartTimeFilter),
ExecutionFilter: ToWorkflowExecutionFilter(t.ExecutionFilter),
Expand Down Expand Up @@ -2834,7 +2834,7 @@ func FromListDomainsRequest(t *types.ListDomainsRequest) *shared.ListDomainsRequ
return nil
}
return &shared.ListDomainsRequest{
PageSize: t.PageSize,
PageSize: &t.PageSize,
NextPageToken: t.NextPageToken,
}
}
Expand All @@ -2845,7 +2845,7 @@ func ToListDomainsRequest(t *shared.ListDomainsRequest) *types.ListDomainsReques
return nil
}
return &types.ListDomainsRequest{
PageSize: t.PageSize,
PageSize: t.GetPageSize(),
NextPageToken: t.NextPageToken,
}
}
Expand Down Expand Up @@ -2879,7 +2879,7 @@ func FromListOpenWorkflowExecutionsRequest(t *types.ListOpenWorkflowExecutionsRe
}
return &shared.ListOpenWorkflowExecutionsRequest{
Domain: &t.Domain,
MaximumPageSize: t.MaximumPageSize,
MaximumPageSize: &t.MaximumPageSize,
NextPageToken: t.NextPageToken,
StartTimeFilter: FromStartTimeFilter(t.StartTimeFilter),
ExecutionFilter: FromWorkflowExecutionFilter(t.ExecutionFilter),
Expand All @@ -2894,7 +2894,7 @@ func ToListOpenWorkflowExecutionsRequest(t *shared.ListOpenWorkflowExecutionsReq
}
return &types.ListOpenWorkflowExecutionsRequest{
Domain: t.GetDomain(),
MaximumPageSize: t.MaximumPageSize,
MaximumPageSize: t.GetMaximumPageSize(),
NextPageToken: t.NextPageToken,
StartTimeFilter: ToStartTimeFilter(t.StartTimeFilter),
ExecutionFilter: ToWorkflowExecutionFilter(t.ExecutionFilter),
Expand Down Expand Up @@ -2975,7 +2975,7 @@ func FromListWorkflowExecutionsRequest(t *types.ListWorkflowExecutionsRequest) *
}
return &shared.ListWorkflowExecutionsRequest{
Domain: &t.Domain,
PageSize: t.PageSize,
PageSize: &t.PageSize,
NextPageToken: t.NextPageToken,
Query: t.Query,
}
Expand All @@ -2988,7 +2988,7 @@ func ToListWorkflowExecutionsRequest(t *shared.ListWorkflowExecutionsRequest) *t
}
return &types.ListWorkflowExecutionsRequest{
Domain: t.GetDomain(),
PageSize: t.PageSize,
PageSize: t.GetPageSize(),
NextPageToken: t.NextPageToken,
Query: t.Query,
}
Expand Down
36 changes: 18 additions & 18 deletions common/types/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -3403,7 +3403,7 @@ func (v *GetSearchAttributesResponse) GetKeys() (o map[string]IndexedValueType)
type GetWorkflowExecutionHistoryRequest struct {
Domain string `json:"domain,omitempty"`
Execution *WorkflowExecution `json:"execution,omitempty"`
MaximumPageSize *int32 `json:"maximumPageSize,omitempty"`
MaximumPageSize int32 `json:"maximumPageSize,omitempty"`
NextPageToken []byte `json:"nextPageToken,omitempty"`
WaitForNewEvent *bool `json:"waitForNewEvent,omitempty"`
HistoryEventFilterType *HistoryEventFilterType `json:"HistoryEventFilterType,omitempty"`
Expand All @@ -3428,8 +3428,8 @@ func (v *GetWorkflowExecutionHistoryRequest) GetExecution() (o *WorkflowExecutio

// GetMaximumPageSize is an internal getter (TBD...)
func (v *GetWorkflowExecutionHistoryRequest) GetMaximumPageSize() (o int32) {
if v != nil && v.MaximumPageSize != nil {
return *v.MaximumPageSize
if v != nil {
return v.MaximumPageSize
}
return
}
Expand Down Expand Up @@ -4193,7 +4193,7 @@ func (v *LimitExceededError) GetMessage() (o string) {
// ListArchivedWorkflowExecutionsRequest is an internal type (TBD...)
type ListArchivedWorkflowExecutionsRequest struct {
Domain string `json:"domain,omitempty"`
PageSize *int32 `json:"pageSize,omitempty"`
PageSize int32 `json:"pageSize,omitempty"`
NextPageToken []byte `json:"nextPageToken,omitempty"`
Query *string `json:"query,omitempty"`
}
Expand All @@ -4208,8 +4208,8 @@ func (v *ListArchivedWorkflowExecutionsRequest) GetDomain() (o string) {

// GetPageSize is an internal getter (TBD...)
func (v *ListArchivedWorkflowExecutionsRequest) GetPageSize() (o int32) {
if v != nil && v.PageSize != nil {
return *v.PageSize
if v != nil {
return v.PageSize
}
return
}
Expand Down Expand Up @@ -4255,7 +4255,7 @@ func (v *ListArchivedWorkflowExecutionsResponse) GetNextPageToken() (o []byte) {
// ListClosedWorkflowExecutionsRequest is an internal type (TBD...)
type ListClosedWorkflowExecutionsRequest struct {
Domain string `json:"domain,omitempty"`
MaximumPageSize *int32 `json:"maximumPageSize,omitempty"`
MaximumPageSize int32 `json:"maximumPageSize,omitempty"`
NextPageToken []byte `json:"nextPageToken,omitempty"`
StartTimeFilter *StartTimeFilter `json:"StartTimeFilter,omitempty"`
ExecutionFilter *WorkflowExecutionFilter `json:"executionFilter,omitempty"`
Expand All @@ -4273,8 +4273,8 @@ func (v *ListClosedWorkflowExecutionsRequest) GetDomain() (o string) {

// GetMaximumPageSize is an internal getter (TBD...)
func (v *ListClosedWorkflowExecutionsRequest) GetMaximumPageSize() (o int32) {
if v != nil && v.MaximumPageSize != nil {
return *v.MaximumPageSize
if v != nil {
return v.MaximumPageSize
}
return
}
Expand Down Expand Up @@ -4343,14 +4343,14 @@ func (v *ListClosedWorkflowExecutionsResponse) GetNextPageToken() (o []byte) {

// ListDomainsRequest is an internal type (TBD...)
type ListDomainsRequest struct {
PageSize *int32 `json:"pageSize,omitempty"`
PageSize int32 `json:"pageSize,omitempty"`
NextPageToken []byte `json:"nextPageToken,omitempty"`
}

// GetPageSize is an internal getter (TBD...)
func (v *ListDomainsRequest) GetPageSize() (o int32) {
if v != nil && v.PageSize != nil {
return *v.PageSize
if v != nil {
return v.PageSize
}
return
}
Expand Down Expand Up @@ -4388,7 +4388,7 @@ func (v *ListDomainsResponse) GetNextPageToken() (o []byte) {
// ListOpenWorkflowExecutionsRequest is an internal type (TBD...)
type ListOpenWorkflowExecutionsRequest struct {
Domain string `json:"domain,omitempty"`
MaximumPageSize *int32 `json:"maximumPageSize,omitempty"`
MaximumPageSize int32 `json:"maximumPageSize,omitempty"`
NextPageToken []byte `json:"nextPageToken,omitempty"`
StartTimeFilter *StartTimeFilter `json:"StartTimeFilter,omitempty"`
ExecutionFilter *WorkflowExecutionFilter `json:"executionFilter,omitempty"`
Expand All @@ -4405,8 +4405,8 @@ func (v *ListOpenWorkflowExecutionsRequest) GetDomain() (o string) {

// GetMaximumPageSize is an internal getter (TBD...)
func (v *ListOpenWorkflowExecutionsRequest) GetMaximumPageSize() (o int32) {
if v != nil && v.MaximumPageSize != nil {
return *v.MaximumPageSize
if v != nil {
return v.MaximumPageSize
}
return
}
Expand Down Expand Up @@ -4512,7 +4512,7 @@ func (v *ListTaskListPartitionsResponse) GetDecisionTaskListPartitions() (o []*T
// ListWorkflowExecutionsRequest is an internal type (TBD...)
type ListWorkflowExecutionsRequest struct {
Domain string `json:"domain,omitempty"`
PageSize *int32 `json:"pageSize,omitempty"`
PageSize int32 `json:"pageSize,omitempty"`
NextPageToken []byte `json:"nextPageToken,omitempty"`
Query *string `json:"query,omitempty"`
}
Expand All @@ -4527,8 +4527,8 @@ func (v *ListWorkflowExecutionsRequest) GetDomain() (o string) {

// GetPageSize is an internal getter (TBD...)
func (v *ListWorkflowExecutionsRequest) GetPageSize() (o int32) {
if v != nil && v.PageSize != nil {
return *v.PageSize
if v != nil {
return v.PageSize
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion host/archival_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (s *integrationSuite) TestVisibilityArchival() {
executions = []*types.WorkflowExecutionInfo{}
request := &types.ListArchivedWorkflowExecutionsRequest{
Domain: s.archivalDomainName,
PageSize: common.Int32Ptr(2),
PageSize: 2,
Query: common.StringPtr(fmt.Sprintf("CloseTime >= %v and CloseTime <= %v and WorkflowType = '%s'", startTime, endTime, workflowType)),
}
for len(executions) == 0 || request.NextPageToken != nil {
Expand Down
16 changes: 8 additions & 8 deletions host/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (s *elasticsearchIntegrationSuite) TestListOpenWorkflow() {
startFilter.LatestTime = common.Int64Ptr(time.Now().UnixNano())
resp, err := s.engine.ListOpenWorkflowExecutions(createContext(), &types.ListOpenWorkflowExecutionsRequest{
Domain: s.domainName,
MaximumPageSize: common.Int32Ptr(defaultTestValueOfESIndexMaxResultWindow),
MaximumPageSize: defaultTestValueOfESIndexMaxResultWindow,
StartTimeFilter: startFilter,
ExecutionFilter: &types.WorkflowExecutionFilter{
WorkflowID: common.StringPtr(id),
Expand Down Expand Up @@ -227,7 +227,7 @@ func (s *elasticsearchIntegrationSuite) TestListWorkflow_SearchAttribute() {

listRequest := &types.ListWorkflowExecutionsRequest{
Domain: s.domainName,
PageSize: common.Int32Ptr(int32(2)),
PageSize: int32(2),
Query: common.StringPtr(fmt.Sprintf(`WorkflowType = '%s' and CloseTime = missing and BinaryChecksums = 'binary-v1'`, wt)),
}
// verify upsert data is on ES
Expand Down Expand Up @@ -309,7 +309,7 @@ func (s *elasticsearchIntegrationSuite) TestListWorkflow_OrQuery() {
var openExecution *types.WorkflowExecutionInfo
listRequest := &types.ListWorkflowExecutionsRequest{
Domain: s.domainName,
PageSize: common.Int32Ptr(defaultTestValueOfESIndexMaxResultWindow),
PageSize: defaultTestValueOfESIndexMaxResultWindow,
Query: common.StringPtr(query1),
}
for i := 0; i < numOfRetry; i++ {
Expand Down Expand Up @@ -398,7 +398,7 @@ func (s *elasticsearchIntegrationSuite) TestListWorkflow_MaxWindowSize() {

listRequest := &types.ListWorkflowExecutionsRequest{
Domain: s.domainName,
PageSize: common.Int32Ptr(int32(defaultTestValueOfESIndexMaxResultWindow)),
PageSize: int32(defaultTestValueOfESIndexMaxResultWindow),
NextPageToken: nextPageToken,
Query: common.StringPtr(fmt.Sprintf(`WorkflowType = '%s' and CloseTime = missing`, wt)),
}
Expand Down Expand Up @@ -467,7 +467,7 @@ func (s *elasticsearchIntegrationSuite) TestListWorkflow_OrderBy() {
var openExecutions []*types.WorkflowExecutionInfo
listRequest := &types.ListWorkflowExecutionsRequest{
Domain: s.domainName,
PageSize: common.Int32Ptr(pageSize),
PageSize: pageSize,
Query: common.StringPtr(query1),
}
for i := 0; i < numOfRetry; i++ {
Expand Down Expand Up @@ -574,7 +574,7 @@ func (s *elasticsearchIntegrationSuite) testListWorkflowHelper(numOfWorkflows, p

listRequest := &types.ListWorkflowExecutionsRequest{
Domain: s.domainName,
PageSize: common.Int32Ptr(int32(pageSize)),
PageSize: int32(pageSize),
NextPageToken: nextPageToken,
Query: common.StringPtr(fmt.Sprintf(`WorkflowType = '%s' and CloseTime = missing`, wType)),
}
Expand Down Expand Up @@ -630,7 +630,7 @@ func (s *elasticsearchIntegrationSuite) testHelperForReadOnce(runID, query strin
var openExecution *types.WorkflowExecutionInfo
listRequest := &types.ListWorkflowExecutionsRequest{
Domain: s.domainName,
PageSize: common.Int32Ptr(defaultTestValueOfESIndexMaxResultWindow),
PageSize: defaultTestValueOfESIndexMaxResultWindow,
Query: common.StringPtr(query),
}
for i := 0; i < numOfRetry; i++ {
Expand Down Expand Up @@ -903,7 +903,7 @@ func (s *elasticsearchIntegrationSuite) TestUpsertWorkflowExecution() {
// verify upsert data is on ES
listRequest := &types.ListWorkflowExecutionsRequest{
Domain: s.domainName,
PageSize: common.Int32Ptr(int32(2)),
PageSize: int32(2),
Query: common.StringPtr(fmt.Sprintf(`WorkflowType = '%s' and CloseTime = missing`, wt)),
}
verified := false
Expand Down
Loading

0 comments on commit 4f45930

Please sign in to comment.