Uploaded image for project: 'Aurora'
  1. Aurora
  2. AURORA-1991

TaskEvents in API Thrift should have optional parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.19.1
    • 0.21
    • Client
    • None

    Description

      What?

      Struct TaskQuery should have optional parameters in order to be able to be used in languages like Go where types does not have a null value by default.

      The following is the autogenerated code created by Thrift with optional parameters and without optional parameters in Golang:

      Without Optional Parameters

      type TaskQuery struct {
        // unused field # 1
        JobName string `thrift:"jobName,2" json:"jobName"`
        // unused field # 3
        TaskIds map[string]bool `thrift:"taskIds,4" json:"taskIds"`
        Statuses map[ScheduleStatus]bool `thrift:"statuses,5" json:"statuses"`
        // unused field # 6
        InstanceIds map[int32]bool `thrift:"instanceIds,7" json:"instanceIds"`
        // unused field # 8
        Environment string `thrift:"environment,9" json:"environment"`
        SlaveHosts map[string]bool `thrift:"slaveHosts,10" json:"slaveHosts"`
        JobKeys map[*JobKey]bool `thrift:"jobKeys,11" json:"jobKeys"`
        Offset int32 `thrift:"offset,12" json:"offset"`
        Limit int32 `thrift:"limit,13" json:"limit"`
        Role string `thrift:"role,14" json:"role"`
      }
      

      With Optional Parameters

      type TaskQuery struct {
      	// unused field # 1
      	JobName *string `thrift:"jobName,2" json:"jobName"`
      	// unused field # 3
      	TaskIds  map[string]bool         `thrift:"taskIds,4" json:"taskIds"`
      	Statuses map[ScheduleStatus]bool `thrift:"statuses,5" json:"statuses"`
      	// unused field # 6
      	InstanceIds map[int32]bool `thrift:"instanceIds,7" json:"instanceIds"`
      	// unused field # 8
      	Environment *string          `thrift:"environment,9" json:"environment"`
      	SlaveHosts  map[string]bool  `thrift:"slaveHosts,10" json:"slaveHosts"`
      	JobKeys     map[*JobKey]bool `thrift:"jobKeys,11" json:"jobKeys"`
      	Offset      *int32           `thrift:"offset,12" json:"offset"`
      	Limit       *int32           `thrift:"limit,13" json:"limit"`
      	Role        *string          `thrift:"role,14" json:"role"`
      }
      

      It can be seen that with an optional parameters like JobName, Role and Environment now can be set with a null value

      Why?

      With the current structure of the TaskQuery object, it is not possible to make queries without explicitly setting all the fields of the TaskQuery object in Golang. Moreover, the lack of a null value in the structure of the TaskQuery object limits the type of queries that can be obtained from the Aurora Thrift API in Golang since a parameter cannot be skipped.

      Attachments

        Activity

          People

            ezetowers Ezequiel Torres
            ezetowers Ezequiel Torres
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: