diff --git a/.aurora-config/security.ini b/.aurora-config/security.ini deleted file mode 100644 index 411fedb..0000000 --- a/.aurora-config/security.ini +++ /dev/null @@ -1,5 +0,0 @@ -[users] -aurora = secret, admin - -[roles] -admin = * diff --git a/.auroraversion b/.auroraversion index 8854156..ca222b7 100644 --- a/.auroraversion +++ b/.auroraversion @@ -1 +1 @@ -0.21.0 +0.23.0 diff --git a/.github/main.yml b/.github/main.yml new file mode 100644 index 0000000..0445266 --- /dev/null +++ b/.github/main.yml @@ -0,0 +1,25 @@ +name: CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup Go for use with actions + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Install goimports + run: go get golang.org/x/tools/cmd/goimports + - name: Set env with list of directories in repo containin go code + run: echo GO_USR_DIRS=$(go list -f {{.Dir}} ./... | grep -E -v "/gen-go/|/vendor/") >> $GITHUB_ENV + - name: Run goimports check + run: test -z "`for d in $GO_USR_DIRS; do goimports -d $d/*.go | tee /dev/stderr; done`" + - name: Create aurora/mesos docker cluster + run: docker-compose up -d + - name: Run tests + run: go test -timeout 35m -race -coverprofile=coverage.txt -covermode=atomic -v github.com/paypal/gorealis diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..6c1890f --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,57 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ main ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ main ] + schedule: + - cron: '34 4 * * 3' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + - run: go build examples/client.go + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..7edfc51 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup Go for use with actions + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Install goimports + run: go get golang.org/x/tools/cmd/goimports + - name: Set env with list of directories in repo containin go code + run: echo GO_USR_DIRS=$(go list -f {{.Dir}} ./... | grep -E -v "/gen-go/|/vendor/") >> $GITHUB_ENV + - name: Run goimports check + run: test -z "`for d in $GO_USR_DIRS; do goimports -d $d/*.go | tee /dev/stderr; done`" + - name: Create aurora/mesos docker cluster + run: docker-compose up -d + - name: Run tests + run: go test -timeout 35m -race -coverprofile=coverage.txt -covermode=atomic -v github.com/paypal/gorealis diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..dd37918 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,71 @@ +# This file contains all available configuration options +# with their default values. + +# options for analysis running +run: + # default concurrency is a available CPU number + concurrency: 4 + + # timeout for analysis, e.g. 30s, 5m, default is 1m + deadline: 1m + + # exit code when at least one issue was found, default is 1 + issues-exit-code: 1 + + # include test files or not, default is true + tests: true + + skip-dirs: + - gen-go/ + +# output configuration options +output: + # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" + format: colored-line-number + + # print lines of code with issue, default is true + print-issued-lines: true + + # print linter name in the end of issue text, default is true + print-linter-name: true + + +# all available settings of specific linters +linters-settings: + errcheck: + # report about not checking of errors in type assetions: `a := b.(MyStruct)`; + # default is false: such cases aren't reported by default. + check-type-assertions: true + + # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; + # default is false: such cases aren't reported by default. + check-blank: true + govet: + # report about shadowed variables + check-shadowing: true + goconst: + # minimal length of string constant, 3 by default + min-len: 3 + # minimal occurrences count to trigger, 3 by default + min-occurrences: 2 + misspell: + # Correct spellings using locale preferences for US or UK. + # Default is to use a neutral variety of English. + # Setting locale to US will correct the British spelling of 'colour' to 'color'. + locale: US + lll: + # max line length, lines longer will be reported. Default is 120. + # '\t' is counted as 1 character by default, and can be changed with the tab-width option + line-length: 120 + # tab width in spaces. Default to 1. + tab-width: 4 + +linters: + enable: + - govet + - goimports + - golint + - lll + - goconst + enable-all: false + fast: false diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8e6f3e7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -sudo: required - -language: go - -go: - - "1.11.x" - -env: - global: - - GO_USR_DIRS=$(go list -f {{.Dir}} ./... | grep -E -v "/gen-go/|/vendor/") - -services: - - docker - -before_install: - - go get golang.org/x/tools/cmd/goimports - - test -z "`for d in $GO_USR_DIRS; do goimports -d $d/*.go | tee /dev/stderr; done`" - -install: - - docker-compose up -d - -script: - - go test -race -coverprofile=coverage.txt -covermode=atomic -v github.com/paypal/gorealis - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9cfbaef --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,62 @@ +1.25.1 (unreleased) + +1.25.0 + +* Add priority api + +1.24.0 + +* enable default sla for slaDrain +* Changes Travis CI badge to Github Actions badge +* Bug fix for auto paused update monitor +* Adds support for running CI on github actions + +1.23.0 + +* First release tested against Aurora Scheduler 0.23.0 + +1.22.5 + +* Upgrading to thrift 0.14.0 + +1.22.4 + +* Updates which result in a no-op now return a response value so that the caller may analyze it to determine what happened + +1.22.3 + +* Contains a monitor timeout fix. Previously an error was being left unchecked which made a specific monitor timining out not be handled properly. + +1.22.2 + +* Bug fix: Change in retry mechanism created a deadlock. This release reverts that particular change. + +1.22.1 + +* Adding safeguards against setting multiple constraints with the same name for a single task. + +1.22.0 + +* CreateService and StartJobUpdate do not continue retrying if a timeout has been encountered +by the HTTP client. Instead they now return an error that conforms to the Timedout interface. +Users can check for a Timedout error by using `realis.IsTimeout(err)`. +* New API function VariableBatchStep has been added which returns the current batch at which +a Variable Batch Update configured Update is currently in. +* Added new PauseUpdateMonitor which monitors an update until it is an `ROLL_FORWARD_PAUSED` state. +* Added variableBatchStep command to sample client to be used for testing new VariableBatchStep api. +* JobUpdateStatus has changed function signature from: +`JobUpdateStatus(updateKey aurora.JobUpdateKey, desiredStatuses map[aurora.JobUpdateStatus]bool, interval, timeout time.Duration) (aurora.JobUpdateStatus, error)` +to +`JobUpdateStatus(updateKey aurora.JobUpdateKey, desiredStatuses []aurora.JobUpdateStatus, interval, timeout time.Duration) (aurora.JobUpdateStatus, error)` +* Added TerminalUpdateStates function which returns an slice containing all UpdateStates which are considered terminal states. + +1.21.0 + +* Version numbering change. Future versions will be labled X.Y.Z where X is the major version, Y is the Aurora version the library has been tested against (e.g. 21 -> 0.21.0), and X is the minor revision. +* Moved to Thrift 0.12.0 code generator and go library. +* `aurora.ACTIVE_STATES`, `aurora.SLAVE_ASSIGNED_STATES`, `aurora.LIVE_STATES`, `aurora.TERMINAL_STATES`, `aurora.ACTIVE_JOB_UPDATE_STATES`, `aurora.AWAITNG_PULSE_JOB_UPDATE_STATES` are all now generated as a slices. +* Please use `realis.ActiveStates`, `realis.SlaveAssignedStates`,`realis.LiveStates`, `realis.TerminalStates`, `realis.ActiveJobUpdateStates`, `realis.AwaitingPulseJobUpdateStates` in their places when map representations are needed. +* `GetInstanceIds(key *aurora.JobKey, states map[aurora.ScheduleStatus]bool) (map[int32]bool, error)` has changed signature to ` GetInstanceIds(key *aurora.JobKey, states []aurora.ScheduleStatus) ([]int32, error)` +* Adding support for GPU as resource. +* Changing compose environment to Aurora snapshot in order to support staggered update. +* Adding staggered updates API. diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 4b34e9d..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,60 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - branch = "0.12.0" - digest = "1:89696c38cec777120b8b1bb5e2d363d655cf2e1e7d8c851919aaa0fd576d9b86" - name = "github.com/apache/thrift" - packages = ["lib/go/thrift"] - pruneopts = "" - revision = "384647d290e2e4a55a14b1b7ef1b7e66293a2c33" - -[[projects]] - digest = "1:0deddd908b6b4b768cfc272c16ee61e7088a60f7fe2f06c547bd3d8e1f8b8e77" - name = "github.com/davecgh/go-spew" - packages = ["spew"] - pruneopts = "" - revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73" - version = "v1.1.1" - -[[projects]] - digest = "1:df48fb76fb2a40edea0c9b3d960bc95e326660d82ff1114e1f88001f7a236b40" - name = "github.com/pkg/errors" - packages = ["."] - pruneopts = "" - revision = "e881fd58d78e04cf6d0de1217f8707c8cc2249bc" - -[[projects]] - digest = "1:256484dbbcd271f9ecebc6795b2df8cad4c458dd0f5fd82a8c2fa0c29f233411" - name = "github.com/pmezard/go-difflib" - packages = ["difflib"] - pruneopts = "" - revision = "792786c7400a136282c1664665ae0a8db921c6c2" - version = "v1.0.0" - -[[projects]] - digest = "1:78bea5e26e82826dacc5fd64a1013a6711b7075ec8072819b89e6ad76cb8196d" - name = "github.com/samuel/go-zookeeper" - packages = ["zk"] - pruneopts = "" - revision = "471cd4e61d7a78ece1791fa5faa0345dc8c7d5a5" - -[[projects]] - digest = "1:c587772fb8ad29ad4db67575dad25ba17a51f072ff18a22b4f0257a4d9c24f75" - name = "github.com/stretchr/testify" - packages = ["assert"] - pruneopts = "" - revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686" - version = "v1.2.2" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "github.com/apache/thrift/lib/go/thrift", - "github.com/pkg/errors", - "github.com/samuel/go-zookeeper/zk", - "github.com/stretchr/testify/assert", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 92a82d1..0000000 --- a/Gopkg.toml +++ /dev/null @@ -1,16 +0,0 @@ -[[constraint]] - name = "github.com/apache/thrift" - branch = "0.12.0" - -[[constraint]] - name = "github.com/pkg/errors" - revision = "e881fd58d78e04cf6d0de1217f8707c8cc2249bc" - -[[constraint]] - name = "github.com/samuel/go-zookeeper" - revision = "471cd4e61d7a78ece1791fa5faa0345dc8c7d5a5" - -[[constraint]] - name = "github.com/stretchr/testify" - version = "1.2.0" - diff --git a/README.md b/README.md index c01afbd..0ce8bc1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -# gorealis [![GoDoc](https://godoc.org/github.com/paypal/gorealis?status.svg)](https://godoc.org/github.com/paypal/gorealis) [![Build Status](https://travis-ci.org/paypal/gorealis.svg?branch=master)](https://travis-ci.org/paypal/gorealis) [![codecov](https://codecov.io/gh/paypal/gorealis/branch/master-v2.0/graph/badge.svg)](https://codecov.io/gh/paypal/gorealis/branch/master-v2.0) +# gorealis [![GoDoc](https://godoc.org/github.com/paypal/gorealis?status.svg)](https://godoc.org/github.com/paypal/gorealis) ![CI Build Status](https://github.com/paypal/gorealis/actions/workflows/main.yml/badge.svg) [![codecov](https://codecov.io/gh/paypal/gorealis/branch/main/graph/badge.svg)](https://codecov.io/gh/paypal/gorealis) -Go library for interacting with [Apache Aurora](https://github.com/apache/aurora). +Version 1 of Go library for interacting with [Aurora Scheduler](https://github.com/aurora-scheduler/aurora). + +Version 2 of this library can be found [here](https://github.com/aurora-scheduler/gorealis). ### Aurora version compatibility Please see [.auroraversion](./.auroraversion) to see the latest Aurora version against which this @@ -14,7 +16,7 @@ library has been tested. ## Projects using gorealis -* [australis](https://github.com/rdelval/australis) +* [australis](https://github.com/aurora-scheduler/australis) ## Contributions Contributions are always welcome. Please raise an issue to discuss a contribution before it is made. diff --git a/auroraAPI.thrift b/auroraAPI.thrift index 063774d..3e43f6f 100644 --- a/auroraAPI.thrift +++ b/auroraAPI.thrift @@ -716,9 +716,40 @@ struct JobUpdateKey { 2: string id } +/** Limits the amount of active changes being made to instances to groupSize. */ +struct QueueJobUpdateStrategy { + 1: i32 groupSize +} + +/** Similar to Queue strategy but will not start a new group until all instances in an active + * group have finished updating. + */ +struct BatchJobUpdateStrategy { + 1: i32 groupSize + /* Update will pause automatically after each batch completes */ + 2: bool autopauseAfterBatch +} + +/** Same as Batch strategy but each time an active group completes, the size of the next active + * group may change. + */ +struct VariableBatchJobUpdateStrategy { + 1: list groupSizes + /* Update will pause automatically after each batch completes */ + 2: bool autopauseAfterBatch +} + +union JobUpdateStrategy { + 1: QueueJobUpdateStrategy queueStrategy + 2: BatchJobUpdateStrategy batchStrategy + 3: VariableBatchJobUpdateStrategy varBatchStrategy +} + /** Job update thresholds and limits. */ struct JobUpdateSettings { - /** Max number of instances being updated at any given moment. */ + /** Deprecated, please set value inside of desired update strategy instead. + * Max number of instances being updated at any given moment. + */ 1: i32 updateGroupSize /** Max number of instance failures to tolerate before marking instance as FAILED. */ @@ -736,7 +767,7 @@ struct JobUpdateSettings { /** Instance IDs to act on. All instances will be affected if this is not set. */ 7: set updateOnlyTheseInstances - /** + /** Deprecated, please set updateStrategy to the Batch strategy instead. * If true, use updateGroupSize as strict batching boundaries, and avoid proceeding to another * batch until the preceding batch finishes updating. */ @@ -755,6 +786,9 @@ struct JobUpdateSettings { * differs between the old and new task configurations, updates will use the newest configuration. */ 10: optional bool slaAware + + /** Update strategy to be used for the update. See JobUpdateStrategy for choices. */ + 11: optional JobUpdateStrategy updateStrategy } /** Event marking a state transition in job update lifecycle. */ diff --git a/clusters.go b/clusters.go index 49e93f6..339dc38 100644 --- a/clusters.go +++ b/clusters.go @@ -21,6 +21,8 @@ import ( "github.com/pkg/errors" ) +// Cluster contains the definition of the clusters.json file used by the default Aurora +// client for configuration type Cluster struct { Name string `json:"name"` AgentRoot string `json:"slave_root"` @@ -33,7 +35,8 @@ type Cluster struct { AuthMechanism string `json:"auth_mechanism"` } -// Loads clusters.json file traditionally located at /etc/aurora/clusters.json +// LoadClusters loads clusters.json file traditionally located at /etc/aurora/clusters.json +// for use with a gorealis client func LoadClusters(config string) (map[string]Cluster, error) { file, err := os.Open(config) @@ -54,14 +57,3 @@ func LoadClusters(config string) (map[string]Cluster, error) { return m, nil } - -func GetDefaultClusterFromZKUrl(zkURL string) *Cluster { - return &Cluster{ - Name: "defaultCluster", - AuthMechanism: "UNAUTHENTICATED", - ZK: zkURL, - SchedZKPath: "/aurora/scheduler", - AgentRunDir: "latest", - AgentRoot: "/var/lib/mesos", - } -} diff --git a/clusters_test.go b/clusters_test.go index 48af5c9..0663cdc 100644 --- a/clusters_test.go +++ b/clusters_test.go @@ -18,7 +18,7 @@ import ( "fmt" "testing" - realis "github.com/paypal/gorealis/v2" + realis "github.com/paypal/gorealis" "github.com/stretchr/testify/assert" ) diff --git a/container.go b/container.go index 872dbac..7c51d2f 100644 --- a/container.go +++ b/container.go @@ -15,31 +15,44 @@ package realis import ( - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" + "github.com/paypal/gorealis/gen-go/apache/aurora" ) +// Container is an interface that defines a single function needed to create +// an Aurora container type. It exists because the code must support both Mesos +// and Docker containers. type Container interface { Build() *aurora.Container } +// MesosContainer is a Mesos style container that can be used by Aurora Jobs. +type MesosContainer struct { + container *aurora.MesosContainer +} + +// DockerContainer is a vanilla Docker style container that can be used by Aurora Jobs. type DockerContainer struct { container *aurora.DockerContainer } -func NewDockerContainer() *DockerContainer { - return &DockerContainer{container: aurora.NewDockerContainer()} +// NewDockerContainer creates a new Aurora compatible Docker container configuration. +func NewDockerContainer() DockerContainer { + return DockerContainer{container: aurora.NewDockerContainer()} } -func (c *DockerContainer) Build() *aurora.Container { +// Build creates an Aurora container based upon the configuration provided. +func (c DockerContainer) Build() *aurora.Container { return &aurora.Container{Docker: c.container} } -func (c *DockerContainer) Image(image string) *DockerContainer { +// Image adds the name of a Docker image to be used by the Job when running. +func (c DockerContainer) Image(image string) DockerContainer { c.container.Image = image return c } -func (c *DockerContainer) AddParameter(name, value string) *DockerContainer { +// AddParameter adds a parameter to be passed to Docker when the container is run. +func (c DockerContainer) AddParameter(name, value string) DockerContainer { c.container.Parameters = append(c.container.Parameters, &aurora.DockerParameter{ Name: name, Value: value, @@ -47,19 +60,18 @@ func (c *DockerContainer) AddParameter(name, value string) *DockerContainer { return c } -type MesosContainer struct { - container *aurora.MesosContainer +// NewMesosContainer creates a Mesos style container to be configured and built for use by an Aurora Job. +func NewMesosContainer() MesosContainer { + return MesosContainer{container: aurora.NewMesosContainer()} } -func NewMesosContainer() *MesosContainer { - return &MesosContainer{container: aurora.NewMesosContainer()} -} - -func (c *MesosContainer) Build() *aurora.Container { +// Build creates a Mesos style Aurora container configuration to be passed on to the Aurora Job. +func (c MesosContainer) Build() *aurora.Container { return &aurora.Container{Mesos: c.container} } -func (c *MesosContainer) DockerImage(name, tag string) *MesosContainer { +// DockerImage configures the Mesos container to use a specific Docker image when being run. +func (c MesosContainer) DockerImage(name, tag string) MesosContainer { if c.container.Image == nil { c.container.Image = aurora.NewImage() } @@ -68,20 +80,12 @@ func (c *MesosContainer) DockerImage(name, tag string) *MesosContainer { return c } -func (c *MesosContainer) AppcImage(name, imageId string) *MesosContainer { +// AppcImage configures the Mesos container to use an image in the Appc format to run the container. +func (c MesosContainer) AppcImage(name, imageID string) MesosContainer { if c.container.Image == nil { c.container.Image = aurora.NewImage() } - c.container.Image.Appc = &aurora.AppcImage{Name: name, ImageId: imageId} - return c -} - -func (c *MesosContainer) AddVolume(hostPath, containerPath string, mode aurora.Mode) *MesosContainer { - c.container.Volumes = append(c.container.Volumes, &aurora.Volume{ - HostPath: hostPath, - ContainerPath: containerPath, - Mode: mode}) - + c.container.Image.Appc = &aurora.AppcImage{Name: name, ImageId: imageID} return c } diff --git a/docker-compose.yml b/docker-compose.yml index 3632491..9c6169f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,7 @@ services: ipv4_address: 192.168.33.2 master: - image: rdelvalle/mesos-master:1.5.1 + image: aurorascheduler/mesos-master:1.7.2 restart: on-failure ports: - "5050:5050" @@ -32,12 +32,13 @@ services: - zk agent-one: - image: rdelvalle/mesos-agent:1.5.1 + image: aurorascheduler/mesos-agent:1.7.2 pid: host restart: on-failure ports: - "5051:5051" environment: + MESOS_ATTRIBUTES: 'zone:west' MESOS_MASTER: zk://192.168.33.2:2181/mesos MESOS_CONTAINERIZERS: docker,mesos MESOS_PORT: 5051 @@ -55,8 +56,33 @@ services: depends_on: - zk + agent-two: + image: aurorascheduler/mesos-agent:1.7.2 + pid: host + restart: on-failure + ports: + - "5061:5061" + environment: + MESOS_ATTRIBUTES: 'zone:east' + MESOS_MASTER: zk://192.168.33.2:2181/mesos + MESOS_CONTAINERIZERS: docker,mesos + MESOS_HOSTNAME: localhost + MESOS_PORT: 5061 + MESOS_RESOURCES: ports(*):[11000-11999] + MESOS_SYSTEMD_ENABLE_SUPPORT: 'false' + MESOS_WORK_DIR: /tmp/mesos + networks: + aurora_cluster: + ipv4_address: 192.168.33.5 + + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup + - /var/run/docker.sock:/var/run/docker.sock + depends_on: + - zk + aurora-one: - image: rdelvalle/aurora:0.21.0 + image: aurorascheduler/scheduler:0.23.0 pid: host ports: - "8081:8081" @@ -65,12 +91,7 @@ services: CLUSTER_NAME: test-cluster ZK_ENDPOINTS: "192.168.33.2:2181" MESOS_MASTER: "zk://192.168.33.2:2181/mesos" - EXTRA_SCHEDULER_ARGS: > - -http_authentication_mechanism=BASIC - -shiro_realm_modules=INI_AUTHNZ - -shiro_ini_path=/etc/aurora/security.ini - volumes: - - ./.aurora-config:/etc/aurora + EXTRA_SCHEDULER_ARGS: "-min_required_instances_for_sla_check=1" networks: aurora_cluster: ipv4_address: 192.168.33.7 diff --git a/docs/getting-started.md b/docs/getting-started.md index b16ac3f..d45477c 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -88,12 +88,6 @@ On Ubuntu, restarting the aurora-scheduler can be achieved by running the follow $ sudo service aurora-scheduler restart ``` -### Using a custom client -Pystachio does not yet support launching tasks using custom executors. Therefore, a custom -client must be used in order to launch tasks using a custom executor. In this case, -we will be using [gorealis](https://github.com/paypal/gorealis) to launch a task with -the compose executor on Aurora. - ## Using [dce-go](https://github.com/paypal/dce-go) Instead of manually configuring Aurora to run the docker-compose executor, one can follow the instructions provided [here](https://github.com/paypal/dce-go/blob/develop/docs/environment.md) to quickly create a DCE environment that would include mesos, aurora, golang1.7, docker, docker-compose and DCE installed. @@ -107,80 +101,12 @@ Mesos endpoint --> http://192.168.33.8:5050 ### Installing Go -#### Linux +Follow the instructions at the official golang website: [golang.org/doc/install](https://golang.org/doc/install) -##### Ubuntu +### Installing docker-compose -###### Adding a PPA and install via apt-get -``` -$ sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable -$ sudo apt-get update -$ sudo apt-get install golang -``` - -###### Configuring the GOPATH - -Configure the environment to be able to compile and run Go code. -``` -$ mkdir $HOME/go -$ echo export GOPATH=$HOME/go >> $HOME/.bashrc -$ echo export GOROOT=/usr/lib/go >> $HOME/.bashrc -$ echo export PATH=$PATH:$GOPATH/bin >> $HOME/.bashrc -$ echo export PATH=$PATH:$GOROOT/bin >> $HOME/.bashrc -``` - -Finally we must reload the .bashrc configuration: -``` -$ source $HOME/.bashrc -``` - -#### OS X - -One way to install go on OS X is by using [Homebrew](http://brew.sh/) - -##### Installing Homebrew -Run the following command from the terminal to install Hombrew: -``` -$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -``` - -##### Installing Go using Hombrew - -Run the following command from the terminal to install Go: -``` -$ brew install go -``` - -##### Configuring the GOPATH - -Configure the environment to be able to compile and run Go code. -``` -$ mkdir $HOME/go -$ echo export GOPATH=$HOME/go >> $HOME/.profile -$ echo export GOROOT=/usr/local/opt/go/libexec >> $HOME/.profile -$ echo export PATH=$PATH:$GOPATH/bin >> $HOME/.profile -$ echo export PATH=$PATH:$GOROOT/bin >> $HOME/.profile -``` - -Finally we must reload the .profile configuration: -``` -$ source $HOME/.profile -``` - -#### Windows - -Download and run the msi installer from https://golang.org/dl/ - -## Installing Docker Compose (if manually configured Aurora) -To show Aurora's new multi executor feature, we need to use at least one custom executor. -In this case we will be using the [docker-compose-executor](https://github.com/mesos/docker-compose-executor). - -In order to run the docker-compose executor, each agent must have docker-compose installed on it. - -This can be done using pip: -``` -$ sudo pip install docker-compose -``` +Agents which will run dce-go will need docker-compose in order to sucessfully run the executor. +Instructions for installing docker-compose on various platforms may be found on Docker's webiste: [docs.docker.com/compose/install/](https://docs.docker.com/compose/install/) ## Downloading gorealis Finally, we must get `gorealis` using the `go get` command: @@ -192,7 +118,7 @@ go get github.com/paypal/gorealis # Creating Aurora Jobs ## Creating a thermos job -To demonstrate that we are able to run jobs using different executors on the +To demonstrate that we are able to run jobs using different executors on the same scheduler, we'll first launch a thermos job using the default Aurora Client. We can use a sample job for this: @@ -259,8 +185,8 @@ go run $GOPATH/src/github.com/paypal/gorealis/examples/client.go -executor=compo ``` If everything went according to plan, a new job will be shown in the Aurora UI. -We can further investigate inside the Mesos task sandbox. Inside the sandbox, under -the sample-app folder, we can find a docker-compose.yml-generated.yml. If we inspect this file, +We can further investigate inside the Mesos task sandbox. Inside the sandbox, under +the sample-app folder, we can find a docker-compose.yml-generated.yml. If we inspect this file, we can find the port at which we can find the web server we launched. Under Web->Ports, we find the port Mesos allocated. We can then navigate to: @@ -269,10 +195,10 @@ Under Web->Ports, we find the port Mesos allocated. We can then navigate to: A message from the executor should greet us. ## Creating a Thermos job using gorealis -It is also possible to create a thermos job using gorealis. To do this, however, +It is also possible to create a thermos job using gorealis. To do this, however, a thermos payload is required. A thermos payload consists of a JSON blob that details the entire task as it exists inside the Aurora Scheduler. *Creating the blob is unfortunately -out of the scope of what gorealis does*, so a thermos payload must be generated beforehand or +out of the scope of what gorealis does*, so a thermos payload must be generated beforehand or retrieved from the structdump of an existing task for testing purposes. A sample thermos JSON payload may be found [here](../examples/thermos_payload.json) in the examples folder. diff --git a/docs/leveraging-the-library.md b/docs/leveraging-the-library.md index 464bddd..e13ca2c 100644 --- a/docs/leveraging-the-library.md +++ b/docs/leveraging-the-library.md @@ -57,4 +57,19 @@ updateJob := realis.NewUpdateJob(job) updateJob.InstanceCount(1) updateJob.Ram(128) msg, err := r.UpdateJob(updateJob, "") -``` \ No newline at end of file +``` + + +* Handling a timeout scenario: + +When sending an API call to Aurora, the call may timeout at the client side. +This means that the time limit has been reached while waiting for the scheduler +to reply. In such a case it is recommended that the timeout is increased through +the use of the `realis.TimeoutMS()` option. + +As these timeouts cannot be totally avoided, there exists a mechanism to mitigate such +scenarios. The `StartJobUpdate` and `CreateService` API will return an error that +implements the Timeout interface. + +An error can be checked to see if it is a Timeout error by using the `realis.IsTimeout()` +function. \ No newline at end of file diff --git a/docs/using-the-sample-client.md b/docs/using-the-sample-client.md index f2de6d9..7e20455 100644 --- a/docs/using-the-sample-client.md +++ b/docs/using-the-sample-client.md @@ -1,6 +1,6 @@ # Using the Sample client -## Usage: +## Usage: ``` Usage of ./client: -cluster string diff --git a/errors.go b/errors.go index 655f7c4..d865aea 100644 --- a/errors.go +++ b/errors.go @@ -17,12 +17,14 @@ package realis // Using a pattern described by Dave Cheney to differentiate errors // https://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully -// Timedout errors are returned when a function is unable to continue executing due +// Timeout errors are returned when a function is unable to continue executing due // to a time constraint or meeting a set number of retries. type timeout interface { Timedout() bool } +// IsTimeout returns true if the error being passed as an argument implements the Timeout interface +// and the Timedout function returns true. func IsTimeout(err error) bool { temp, ok := err.(timeout) return ok && temp.Timedout() @@ -61,41 +63,42 @@ func (r *retryErr) RetryCount() int { return r.retryCount } -// Helper function for testing verification to avoid whitebox testing +// ToRetryCount is a helper function for testing verification to avoid whitebox testing // as well as keeping retryErr as a private. // Should NOT be used under any other context. func ToRetryCount(err error) *retryErr { if retryErr, ok := err.(*retryErr); ok { return retryErr - } else { - return nil } + return nil } func newRetryError(err error, retryCount int) *retryErr { return &retryErr{error: err, timedout: true, retryCount: retryCount} } -// Temporary errors indicate that the action may and should be retried. +// Temporary errors indicate that the action may or should be retried. type temporary interface { Temporary() bool } +// IsTemporary indicates whether the error passed in as an argument implements the temporary interface +// and if the Temporary function returns true. func IsTemporary(err error) bool { temp, ok := err.(temporary) return ok && temp.Temporary() } -type TemporaryErr struct { +type temporaryErr struct { error temporary bool } -func (t *TemporaryErr) Temporary() bool { +func (t *temporaryErr) Temporary() bool { return t.temporary } -// Retrying after receiving this error is advised -func NewTemporaryError(err error) *TemporaryErr { - return &TemporaryErr{error: err, temporary: true} +// NewTemporaryError creates a new error which satisfies the Temporary interface. +func NewTemporaryError(err error) *temporaryErr { + return &temporaryErr{error: err, temporary: true} } diff --git a/examples/client.go b/examples/client.go index 7d9691f..69e3751 100644 --- a/examples/client.go +++ b/examples/client.go @@ -17,22 +17,24 @@ package main import ( "flag" "fmt" + "io/ioutil" "log" "strings" "time" - realis "github.com/paypal/gorealis/v2" - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" + realis "github.com/paypal/gorealis" + "github.com/paypal/gorealis/gen-go/apache/aurora" + "github.com/paypal/gorealis/response" ) var cmd, executor, url, clustersConfig, clusterName, updateId, username, password, zkUrl, hostList, role string var caCertsPath string var clientKey, clientCert string -var ConnectionTimeout = 20 * time.Second +var ConnectionTimeout = 20000 func init() { - flag.StringVar(&cmd, "cmd", "", "Aurora Job request type to send to Aurora Scheduler") + flag.StringVar(&cmd, "cmd", "", "Job request type to send to Aurora Scheduler") flag.StringVar(&executor, "executor", "thermos", "Executor to use") flag.StringVar(&url, "url", "", "URL at which the Aurora Scheduler exists as [url]:[port]") flag.StringVar(&clustersConfig, "clusters", "", "Location of the clusters.json file used by aurora.") @@ -72,14 +74,15 @@ func init() { func main() { - var job *realis.AuroraJob + var job realis.Job var err error - var r *realis.Client + var monitor *realis.Monitor + var r realis.Realis clientOptions := []realis.ClientOption{ realis.BasicAuth(username, password), realis.ThriftJSON(), - realis.Timeout(ConnectionTimeout), + realis.TimeoutMS(ConnectionTimeout), realis.BackOff(realis.Backoff{ Steps: 2, Duration: 10 * time.Second, @@ -97,36 +100,39 @@ func main() { } if caCertsPath != "" { - clientOptions = append(clientOptions, realis.CertsPath(caCertsPath)) + clientOptions = append(clientOptions, realis.Certspath(caCertsPath)) } if clientKey != "" && clientCert != "" { clientOptions = append(clientOptions, realis.ClientCerts(clientKey, clientCert)) } - r, err = realis.NewClient(clientOptions...) + r, err = realis.NewRealisClient(clientOptions...) if err != nil { log.Fatalln(err) } + monitor = &realis.Monitor{Client: r} defer r.Close() switch executor { case "thermos": - thermosExec := realis.ThermosExecutor{} - thermosExec.AddProcess(realis.NewThermosProcess("boostrap", "echo bootsrapping")). - AddProcess(realis.NewThermosProcess("hello_gorealis", "while true; do echo hello world from gorealis; sleep 10; done")) + payload, err := ioutil.ReadFile("examples/thermos_payload.json") + if err != nil { + log.Fatalln("Error reading json config file: ", err) + } job = realis.NewJob(). Environment("prod"). Role("vagrant"). Name("hello_world_from_gorealis"). + ExecutorName(aurora.AURORA_EXECUTOR_NAME). + ExecutorData(string(payload)). CPU(1). RAM(64). Disk(100). IsService(true). InstanceCount(1). - AddPorts(1). - ThermosExecutor(thermosExec) + AddPorts(1) case "compose": job = realis.NewJob(). Environment("prod"). @@ -160,13 +166,14 @@ func main() { switch cmd { case "create": fmt.Println("Creating job") - err := r.CreateJob(job) + resp, err := r.CreateJob(job) if err != nil { log.Fatalln(err) } + fmt.Println(resp.String()) - if ok, mErr := r.MonitorInstances(job.JobKey(), job.GetInstanceCount(), 5*time.Second, 50*time.Second); !ok || mErr != nil { - err := r.KillJob(job.JobKey()) + if ok, mErr := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 5, 50); !ok || mErr != nil { + _, err := r.KillJob(job.JobKey()) if err != nil { log.Fatalln(err) } @@ -176,17 +183,18 @@ func main() { case "createService": // Create a service with three instances using the update API instead of the createJob API fmt.Println("Creating service") - settings := realis.JobUpdateFromAuroraTask(job.AuroraTask()).InstanceCount(3) - - result, err := r.CreateService(settings) + settings := realis.NewUpdateSettings() + job.InstanceCount(3) + resp, result, err := r.CreateService(job, settings) if err != nil { - log.Fatal("error: ", err) + log.Println("error: ", err) + log.Fatal("response: ", resp.String()) } fmt.Println(result.String()) - if ok, mErr := r.MonitorJobUpdate(*result.GetKey(), 5*time.Second, 180*time.Second); !ok || mErr != nil { - err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out") - err = r.KillJob(job.JobKey()) + if ok, mErr := monitor.JobUpdate(*result.GetKey(), 5, 180); !ok || mErr != nil { + _, err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out") + _, err = r.KillJob(job.JobKey()) if err != nil { log.Fatal(err) } @@ -197,13 +205,14 @@ func main() { fmt.Println("Creating a docker based job") container := realis.NewDockerContainer().Image("python:2.7").AddParameter("network", "host") job.Container(container) - err := r.CreateJob(job) + resp, err := r.CreateJob(job) if err != nil { log.Fatal(err) } + fmt.Println(resp.String()) - if ok, err := r.MonitorInstances(job.JobKey(), job.GetInstanceCount(), 10*time.Second, 300*time.Second); !ok || err != nil { - err := r.KillJob(job.JobKey()) + if ok, err := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 10, 300); !ok || err != nil { + _, err := r.KillJob(job.JobKey()) if err != nil { log.Fatal(err) } @@ -213,13 +222,14 @@ func main() { fmt.Println("Creating a docker based job") container := realis.NewMesosContainer().DockerImage("python", "2.7") job.Container(container) - err := r.CreateJob(job) + resp, err := r.CreateJob(job) if err != nil { log.Fatal(err) } + fmt.Println(resp.String()) - if ok, err := r.MonitorInstances(job.JobKey(), job.GetInstanceCount(), 10*time.Second, 300*time.Second); !ok || err != nil { - err := r.KillJob(job.JobKey()) + if ok, err := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 10, 300); !ok || err != nil { + _, err := r.KillJob(job.JobKey()) if err != nil { log.Fatal(err) } @@ -230,44 +240,50 @@ func main() { // Cron config job.CronSchedule("* * * * *") job.IsService(false) - err := r.ScheduleCronJob(job) + resp, err := r.ScheduleCronJob(job) if err != nil { log.Fatal(err) } + fmt.Println(resp.String()) case "startCron": fmt.Println("Starting a Cron job") - err := r.StartCronJob(job.JobKey()) + resp, err := r.StartCronJob(job.JobKey()) if err != nil { log.Fatal(err) } + fmt.Println(resp.String()) case "descheduleCron": fmt.Println("Descheduling a Cron job") - err := r.DescheduleCronJob(job.JobKey()) + resp, err := r.DescheduleCronJob(job.JobKey()) if err != nil { log.Fatal(err) } + fmt.Println(resp.String()) case "kill": fmt.Println("Killing job") - err := r.KillJob(job.JobKey()) + resp, err := r.KillJob(job.JobKey()) if err != nil { log.Fatal(err) } - if ok, err := r.MonitorInstances(job.JobKey(), 0, 5*time.Second, 50*time.Second); !ok || err != nil { + if ok, err := monitor.Instances(job.JobKey(), 0, 5, 50); !ok || err != nil { log.Fatal("Unable to kill all instances of job") } + fmt.Println(resp.String()) case "restart": fmt.Println("Restarting job") - err := r.RestartJob(job.JobKey()) + resp, err := r.RestartJob(job.JobKey()) if err != nil { log.Fatal(err) } + fmt.Println(resp.String()) + case "liveCount": fmt.Println("Getting instance count") @@ -286,110 +302,106 @@ func main() { log.Fatal(err) } - fmt.Println("Active instances: ", live) + fmt.Println("Number of live instances: ", len(live)) case "flexUp": fmt.Println("Flexing up job") - numOfInstances := 4 + numOfInstances := int32(4) live, err := r.GetInstanceIds(job.JobKey(), aurora.ACTIVE_STATES) if err != nil { log.Fatal(err) } - currInstances := len(live) + currInstances := int32(len(live)) fmt.Println("Current num of instances: ", currInstances) - - key := job.JobKey() - err = r.AddInstances(aurora.InstanceKey{ - JobKey: &key, + resp, err := r.AddInstances(aurora.InstanceKey{ + JobKey: job.JobKey(), InstanceId: live[0], }, - int32(numOfInstances)) + numOfInstances) if err != nil { log.Fatal(err) } - if ok, err := r.MonitorInstances(job.JobKey(), int32(currInstances+numOfInstances), 5*time.Second, 50*time.Second); !ok || err != nil { + if ok, err := monitor.Instances(job.JobKey(), currInstances+numOfInstances, 5, 50); !ok || err != nil { fmt.Println("Flexing up failed") } + fmt.Println(resp.String()) case "flexDown": fmt.Println("Flexing down job") - numOfInstances := 2 + numOfInstances := int32(2) live, err := r.GetInstanceIds(job.JobKey(), aurora.ACTIVE_STATES) if err != nil { log.Fatal(err) } - currInstances := len(live) + currInstances := int32(len(live)) fmt.Println("Current num of instances: ", currInstances) - err = r.RemoveInstances(job.JobKey(), numOfInstances) + resp, err := r.RemoveInstances(job.JobKey(), numOfInstances) if err != nil { log.Fatal(err) } - if ok, err := r.MonitorInstances(job.JobKey(), int32(currInstances-numOfInstances), 5*time.Second, 100*time.Second); !ok || err != nil { + if ok, err := monitor.Instances(job.JobKey(), currInstances-numOfInstances, 5, 100); !ok || err != nil { fmt.Println("flexDown failed") } + fmt.Println(resp.String()) + case "update": fmt.Println("Updating a job with with more RAM and to 5 instances") live, err := r.GetInstanceIds(job.JobKey(), aurora.ACTIVE_STATES) if err != nil { log.Fatal(err) } - - key := job.JobKey() taskConfig, err := r.FetchTaskConfig(aurora.InstanceKey{ - JobKey: &key, + JobKey: job.JobKey(), InstanceId: live[0], }) if err != nil { log.Fatal(err) } - updateJob := realis.JobUpdateFromConfig(taskConfig).InstanceCount(5).RAM(128) + updateJob := realis.NewDefaultUpdateJob(taskConfig) + updateJob.InstanceCount(5).RAM(128) - result, err := r.StartJobUpdate(updateJob, "") + resp, err := r.StartJobUpdate(updateJob, "") if err != nil { log.Fatal(err) } - jobUpdateKey := result.GetKey() - _, err = r.MonitorJobUpdate(*jobUpdateKey, 5*time.Second, 6*time.Minute) - if err != nil { - log.Fatal(err) - } + jobUpdateKey := response.JobUpdateKey(resp) + monitor.JobUpdate(*jobUpdateKey, 5, 500) case "pauseJobUpdate": - key := job.JobKey() - err := r.PauseJobUpdate(&aurora.JobUpdateKey{ - Job: &key, + resp, err := r.PauseJobUpdate(&aurora.JobUpdateKey{ + Job: job.JobKey(), ID: updateId, }, "") if err != nil { log.Fatal(err) } + fmt.Println("PauseJobUpdate response: ", resp.String()) case "resumeJobUpdate": - key := job.JobKey() - err := r.ResumeJobUpdate(aurora.JobUpdateKey{ - Job: &key, + resp, err := r.ResumeJobUpdate(&aurora.JobUpdateKey{ + Job: job.JobKey(), ID: updateId, }, "") if err != nil { log.Fatal(err) } + fmt.Println("ResumeJobUpdate response: ", resp.String()) case "pulseJobUpdate": - key := job.JobKey() - resp, err := r.PulseJobUpdate(aurora.JobUpdateKey{ - Job: &key, + resp, err := r.PulseJobUpdate(&aurora.JobUpdateKey{ + Job: job.JobKey(), ID: updateId, }) if err != nil { @@ -399,10 +411,9 @@ func main() { fmt.Println("PulseJobUpdate response: ", resp.String()) case "updateDetails": - key := job.JobKey() - result, err := r.JobUpdateDetails(aurora.JobUpdateQuery{ + resp, err := r.JobUpdateDetails(aurora.JobUpdateQuery{ Key: &aurora.JobUpdateKey{ - Job: &key, + Job: job.JobKey(), ID: updateId, }, Limit: 1, @@ -412,13 +423,12 @@ func main() { log.Fatal(err) } - fmt.Println(result) + fmt.Println(response.JobUpdateDetails(resp)) case "abortUpdate": fmt.Println("Abort update") - key := job.JobKey() - err := r.AbortJobUpdate(aurora.JobUpdateKey{ - Job: &key, + resp, err := r.AbortJobUpdate(aurora.JobUpdateKey{ + Job: job.JobKey(), ID: updateId, }, "") @@ -426,12 +436,12 @@ func main() { if err != nil { log.Fatal(err) } + fmt.Println(resp.String()) case "rollbackUpdate": fmt.Println("Abort update") - key := job.JobKey() - err := r.RollbackJobUpdate(aurora.JobUpdateKey{ - Job: &key, + resp, err := r.RollbackJobUpdate(aurora.JobUpdateKey{ + Job: job.JobKey(), ID: updateId, }, "") @@ -439,6 +449,7 @@ func main() { if err != nil { log.Fatal(err) } + fmt.Println(resp.String()) case "taskConfig": fmt.Println("Getting job info") @@ -447,9 +458,8 @@ func main() { log.Fatal(err) } - key := job.JobKey() config, err := r.FetchTaskConfig(aurora.InstanceKey{ - JobKey: &key, + JobKey: job.JobKey(), InstanceId: live[0], }) @@ -461,10 +471,9 @@ func main() { case "updatesummary": fmt.Println("Getting job update summary") - key := job.JobKey() jobquery := &aurora.JobUpdateQuery{ - Role: &key.Role, - JobKey: &key, + Role: &job.JobKey().Role, + JobKey: job.JobKey(), } updatesummary, err := r.GetJobUpdateSummaries(jobquery) if err != nil { @@ -475,11 +484,10 @@ func main() { case "taskStatus": fmt.Println("Getting task status") - key := job.JobKey() taskQ := &aurora.TaskQuery{ - Role: &key.Role, - Environment: &key.Environment, - JobName: &key.Name, + Role: &job.JobKey().Role, + Environment: &job.JobKey().Environment, + JobName: &job.JobKey().Name, } tasks, err := r.GetTaskStatus(taskQ) if err != nil { @@ -491,11 +499,10 @@ func main() { case "tasksWithoutConfig": fmt.Println("Getting task status") - key := job.JobKey() taskQ := &aurora.TaskQuery{ - Role: &key.Role, - Environment: &key.Environment, - JobName: &key.Name, + Role: &job.JobKey().Role, + Environment: &job.JobKey().Environment, + JobName: &job.JobKey().Name, } tasks, err := r.GetTasksWithoutConfigs(taskQ) if err != nil { @@ -511,17 +518,17 @@ func main() { log.Fatal("No hosts specified to drain") } hosts := strings.Split(hostList, ",") - _, err := r.DrainHosts(hosts...) + _, result, err := r.DrainHosts(hosts...) if err != nil { log.Fatalf("error: %+v\n", err.Error()) } // Monitor change to DRAINING and DRAINED mode - hostResult, err := r.MonitorHostMaintenance( + hostResult, err := monitor.HostMaintenance( hosts, []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING}, - 5*time.Second, - 10*time.Second) + 5, + 10) if err != nil { for host, ok := range hostResult { if !ok { @@ -531,6 +538,8 @@ func main() { log.Fatalf("error: %+v\n", err.Error()) } + fmt.Print(result.String()) + case "SLADrainHosts": fmt.Println("Setting hosts to DRAINING using SLA aware draining") if hostList == "" { @@ -540,17 +549,17 @@ func main() { policy := aurora.SlaPolicy{PercentageSlaPolicy: &aurora.PercentageSlaPolicy{Percentage: 50.0}} - _, err := r.SLADrainHosts(&policy, 30, hosts...) + result, err := r.SLADrainHosts(&policy, 30, hosts...) if err != nil { log.Fatalf("error: %+v\n", err.Error()) } // Monitor change to DRAINING and DRAINED mode - hostResult, err := r.MonitorHostMaintenance( + hostResult, err := monitor.HostMaintenance( hosts, []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING}, - 5*time.Second, - 10*time.Second) + 5, + 10) if err != nil { for host, ok := range hostResult { if !ok { @@ -560,23 +569,25 @@ func main() { log.Fatalf("error: %+v\n", err.Error()) } + fmt.Print(result.String()) + case "endMaintenance": fmt.Println("Setting hosts to ACTIVE") if hostList == "" { log.Fatal("No hosts specified to drain") } hosts := strings.Split(hostList, ",") - _, err := r.EndMaintenance(hosts...) + _, result, err := r.EndMaintenance(hosts...) if err != nil { log.Fatalf("error: %+v\n", err.Error()) } // Monitor change to DRAINING and DRAINED mode - hostResult, err := r.MonitorHostMaintenance( + hostResult, err := monitor.HostMaintenance( hosts, []aurora.MaintenanceMode{aurora.MaintenanceMode_NONE}, - 5*time.Second, - 10*time.Second) + 5, + 10) if err != nil { for host, ok := range hostResult { if !ok { @@ -586,13 +597,14 @@ func main() { log.Fatalf("error: %+v\n", err.Error()) } + fmt.Print(result.String()) + case "getPendingReasons": fmt.Println("Getting pending reasons") - key := job.JobKey() taskQ := &aurora.TaskQuery{ - Role: &key.Role, - Environment: &key.Environment, - JobName: &key.Name, + Role: &job.JobKey().Role, + Environment: &job.JobKey().Environment, + JobName: &job.JobKey().Name, } reasons, err := r.GetPendingReason(taskQ) if err != nil { @@ -604,7 +616,7 @@ func main() { case "getJobs": fmt.Println("GetJobs...role: ", role) - result, err := r.GetJobs(role) + _, result, err := r.GetJobs(role) if err != nil { log.Fatalf("error: %+v\n", err.Error()) } diff --git a/examples/jsonClient.go b/examples/jsonClient.go index 4696474..c138a63 100644 --- a/examples/jsonClient.go +++ b/examples/jsonClient.go @@ -23,8 +23,8 @@ import ( "os" "time" - realis "github.com/paypal/gorealis/v2" - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" + realis "github.com/paypal/gorealis" + "github.com/paypal/gorealis/gen-go/apache/aurora" "github.com/pkg/errors" ) @@ -125,7 +125,7 @@ func init() { } } -func CreateRealisClient(config *Config) (*realis.Client, error) { +func CreateRealisClient(config *Config) (realis.Realis, error) { var transportOption realis.ClientOption // Configuring transport protocol. If not transport is provided, then using JSON as the // default transport protocol. @@ -157,7 +157,7 @@ func CreateRealisClient(config *Config) (*realis.Client, error) { clientOptions = append(clientOptions, realis.Debug()) } - return realis.NewClient(clientOptions...) + return realis.NewRealisClient(clientOptions...) } func main() { @@ -165,6 +165,7 @@ func main() { fmt.Println(clientCreationErr) os.Exit(1) } else { + monitor := &realis.Monitor{Client: r} defer r.Close() uris := job.URIs labels := job.Labels @@ -204,18 +205,20 @@ func main() { } fmt.Println("Creating Job...") - if jobCreationErr := r.CreateJob(auroraJob); jobCreationErr != nil { + if resp, jobCreationErr := r.CreateJob(auroraJob); jobCreationErr != nil { fmt.Println("Error creating Aurora job: ", jobCreationErr) os.Exit(1) } else { - if ok, monitorErr := r.MonitorInstances(auroraJob.JobKey(), auroraJob.GetInstanceCount(), 5, 50); !ok || monitorErr != nil { - if jobErr := r.KillJob(auroraJob.JobKey()); jobErr != - nil { - fmt.Println(jobErr) - os.Exit(1) - } else { - fmt.Println("ok: ", ok) - fmt.Println("jobErr: ", jobErr) + if resp.ResponseCode == aurora.ResponseCode_OK { + if ok, monitorErr := monitor.Instances(auroraJob.JobKey(), auroraJob.GetInstanceCount(), 5, 50); !ok || monitorErr != nil { + if _, jobErr := r.KillJob(auroraJob.JobKey()); jobErr != + nil { + fmt.Println(jobErr) + os.Exit(1) + } else { + fmt.Println("ok: ", ok) + fmt.Println("jobErr: ", jobErr) + } } } } diff --git a/examples/thermos_payload.json b/examples/thermos_payload.json new file mode 100644 index 0000000..db630fb --- /dev/null +++ b/examples/thermos_payload.json @@ -0,0 +1,62 @@ +{ + "environment": "prod", + "health_check_config": { + "initial_interval_secs": 15.0, + "health_checker": { + "http": { + "expected_response_code": 0, + "endpoint": "/health", + "expected_response": "ok" + } + }, + "interval_secs": 10.0, + "timeout_secs": 1.0, + "max_consecutive_failures": 0 + }, + "name": "hello_world_from_gorealis", + "service": false, + "max_task_failures": 1, + "cron_collision_policy": "KILL_EXISTING", + "enable_hooks": false, + "cluster": "devcluster", + "task": { + "processes": [ + { + "daemon": false, + "name": "hello", + "ephemeral": false, + "max_failures": 1, + "min_duration": 5, + "cmdline": "\n while true; do\n echo hello world from gorealis\n sleep 10\n done\n ", + "final": false + } + ], + "name": "hello", + "finalization_wait": 30, + "max_failures": 1, + "max_concurrency": 0, + "resources": { + "gpu": 0, + "disk": 134217728, + "ram": 134217728, + "cpu": 1.0 + }, + "constraints": [ + { + "order": [ + "hello" + ] + } + ] + }, + "production": false, + "role": "vagrant", + "lifecycle": { + "http": { + "graceful_shutdown_endpoint": "/quitquitquit", + "port": "health", + "shutdown_endpoint": "/abortabortabort" + } + }, + "priority": 0 +} \ No newline at end of file diff --git a/examples/thermos_payload_minimal.json b/examples/thermos_payload_minimal.json deleted file mode 100644 index ae7b0ab..0000000 --- a/examples/thermos_payload_minimal.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "task": { - "processes": [ - { - "daemon": false, - "name": "hello", - "ephemeral": false, - "max_failures": 1, - "min_duration": 5, - "cmdline": "\n while true; do\n echo hello world from gorealis\n sleep 10\n done\n ", - "final": false - } - ], - "resources": { - "gpu": 0, - "disk": 134217728, - "ram": 134217728, - "cpu": 1.1 - }, - "constraints": [ - { - "order": [ - "hello" - ] - } - ] - } -} diff --git a/gen-go/apache/aurora/GoUnusedProtection__.go b/gen-go/apache/aurora/GoUnusedProtection__.go index 6ba25e0..462b3b4 100644 --- a/gen-go/apache/aurora/GoUnusedProtection__.go +++ b/gen-go/apache/aurora/GoUnusedProtection__.go @@ -1,5 +1,4 @@ -// Autogenerated by Thrift Compiler (0.12.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. package aurora diff --git a/gen-go/apache/aurora/auroraAPI-consts.go b/gen-go/apache/aurora/auroraAPI-consts.go index 6e79077..d4a319e 100644 --- a/gen-go/apache/aurora/auroraAPI-consts.go +++ b/gen-go/apache/aurora/auroraAPI-consts.go @@ -1,13 +1,12 @@ -// Autogenerated by Thrift Compiler (0.12.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. package aurora -import ( +import( "bytes" "context" - "reflect" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" ) @@ -15,7 +14,7 @@ import ( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal const AURORA_EXECUTOR_NAME = "AuroraExecutor" diff --git a/gen-go/apache/aurora/auroraAPI.go b/gen-go/apache/aurora/auroraAPI.go index 36cde22..914d268 100644 --- a/gen-go/apache/aurora/auroraAPI.go +++ b/gen-go/apache/aurora/auroraAPI.go @@ -1,15 +1,14 @@ -// Autogenerated by Thrift Compiler (0.12.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. package aurora -import ( +import( "bytes" "context" - "reflect" "database/sql/driver" "errors" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" ) @@ -17,7 +16,7 @@ import ( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal type ResponseCode int64 @@ -567,14 +566,14 @@ func NewIdentity() *Identity { func (p *Identity) GetUser() string { return p.User } -func (p *Identity) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Identity) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -582,31 +581,31 @@ func (p *Identity) Read(iprot thrift.TProtocol) error { switch fieldId { case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Identity) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Identity) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.User = v @@ -614,29 +613,39 @@ func (p *Identity) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Identity) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Identity"); err != nil { +func (p *Identity) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Identity"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Identity) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("user", thrift.STRING, 2); err != nil { +func (p *Identity) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "user", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:user: ", p), err) } - if err := oprot.WriteString(string(p.User)); err != nil { + if err := oprot.WriteString(ctx, string(p.User)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.user (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:user: ", p), err) } return err } +func (p *Identity) Equals(other *Identity) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.User != other.User { return false } + return true +} + func (p *Identity) String() string { if p == nil { return "" @@ -666,14 +675,14 @@ func (p *Attribute) GetName() string { func (p *Attribute) GetValues() []string { return p.Values } -func (p *Attribute) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Attribute) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -681,41 +690,41 @@ func (p *Attribute) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Attribute) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Attribute) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -723,8 +732,8 @@ func (p *Attribute) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Attribute) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *Attribute) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } @@ -732,68 +741,86 @@ func (p *Attribute) ReadField2(iprot thrift.TProtocol) error { p.Values = tSet for i := 0; i < size; i ++ { var _elem0 string - if v, err := iprot.ReadString(); err != nil { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { _elem0 = v } p.Values = append(p.Values, _elem0) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *Attribute) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Attribute"); err != nil { +func (p *Attribute) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Attribute"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Attribute) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *Attribute) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *Attribute) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("values", thrift.SET, 2); err != nil { +func (p *Attribute) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "values", thrift.SET, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:values: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRING, len(p.Values)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRING, len(p.Values)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -849,14 +876,14 @@ func (p *HostAttributes) IsSetSlaveId() bool { return p.SlaveId != nil } -func (p *HostAttributes) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *HostAttributes) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -864,61 +891,61 @@ func (p *HostAttributes) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *HostAttributes) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *HostAttributes) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Host = v @@ -926,28 +953,28 @@ func (p *HostAttributes) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *HostAttributes) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *HostAttributes) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Attribute, 0, size) p.Attributes = tSet for i := 0; i < size; i ++ { - _elem1 := &Attribute{} - if err := _elem1.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem1), err) + _elem2 := &Attribute{} + if err := _elem2.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err) } - p.Attributes = append(p.Attributes, _elem1) + p.Attributes = append(p.Attributes, _elem2) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *HostAttributes) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *HostAttributes) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { temp := MaintenanceMode(v) @@ -956,8 +983,8 @@ func (p *HostAttributes) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *HostAttributes) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *HostAttributes) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.SlaveId = &v @@ -965,82 +992,112 @@ func (p *HostAttributes) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *HostAttributes) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("HostAttributes"); err != nil { +func (p *HostAttributes) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "HostAttributes"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *HostAttributes) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("host", thrift.STRING, 1); err != nil { +func (p *HostAttributes) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:host: ", p), err) } - if err := oprot.WriteString(string(p.Host)); err != nil { + if err := oprot.WriteString(ctx, string(p.Host)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.host (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:host: ", p), err) } return err } -func (p *HostAttributes) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("attributes", thrift.SET, 2); err != nil { +func (p *HostAttributes) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "attributes", thrift.SET, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:attributes: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Attributes)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Attributes)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -1071,14 +1128,14 @@ func (p *ValueConstraint) GetNegated() bool { func (p *ValueConstraint) GetValues() []string { return p.Values } -func (p *ValueConstraint) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ValueConstraint) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1086,41 +1143,41 @@ func (p *ValueConstraint) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.BOOL { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ValueConstraint) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *ValueConstraint) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Negated = v @@ -1128,77 +1185,95 @@ func (p *ValueConstraint) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *ValueConstraint) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *ValueConstraint) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]string, 0, size) p.Values = tSet for i := 0; i < size; i ++ { -var _elem2 string - if v, err := iprot.ReadString(); err != nil { +var _elem4 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem2 = v + _elem4 = v } - p.Values = append(p.Values, _elem2) + p.Values = append(p.Values, _elem4) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *ValueConstraint) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ValueConstraint"); err != nil { +func (p *ValueConstraint) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ValueConstraint"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ValueConstraint) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("negated", thrift.BOOL, 1); err != nil { +func (p *ValueConstraint) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "negated", thrift.BOOL, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:negated: ", p), err) } - if err := oprot.WriteBool(bool(p.Negated)); err != nil { + if err := oprot.WriteBool(ctx, bool(p.Negated)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.negated (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:negated: ", p), err) } return err } -func (p *ValueConstraint) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("values", thrift.SET, 2); err != nil { +func (p *ValueConstraint) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "values", thrift.SET, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:values: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRING, len(p.Values)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRING, len(p.Values)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -1223,14 +1298,14 @@ func NewLimitConstraint() *LimitConstraint { func (p *LimitConstraint) GetLimit() int32 { return p.Limit } -func (p *LimitConstraint) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *LimitConstraint) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1238,31 +1313,31 @@ func (p *LimitConstraint) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *LimitConstraint) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *LimitConstraint) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Limit = v @@ -1270,29 +1345,39 @@ func (p *LimitConstraint) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *LimitConstraint) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("LimitConstraint"); err != nil { +func (p *LimitConstraint) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "LimitConstraint"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *LimitConstraint) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("limit", thrift.I32, 1); err != nil { +func (p *LimitConstraint) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "limit", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:limit: ", p), err) } - if err := oprot.WriteI32(int32(p.Limit)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Limit)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.limit (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:limit: ", p), err) } return err } +func (p *LimitConstraint) Equals(other *LimitConstraint) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Limit != other.Limit { return false } + return true +} + func (p *LimitConstraint) String() string { if p == nil { return "" @@ -1348,14 +1433,14 @@ func (p *TaskConstraint) IsSetLimit() bool { return p.Limit != nil } -func (p *TaskConstraint) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *TaskConstraint) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1363,98 +1448,109 @@ func (p *TaskConstraint) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *TaskConstraint) ReadField1(iprot thrift.TProtocol) error { +func (p *TaskConstraint) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Value = &ValueConstraint{} - if err := p.Value.Read(iprot); err != nil { + if err := p.Value.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Value), err) } return nil } -func (p *TaskConstraint) ReadField2(iprot thrift.TProtocol) error { +func (p *TaskConstraint) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Limit = &LimitConstraint{} - if err := p.Limit.Read(iprot); err != nil { + if err := p.Limit.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Limit), err) } return nil } -func (p *TaskConstraint) Write(oprot thrift.TProtocol) error { +func (p *TaskConstraint) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsTaskConstraint(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("TaskConstraint"); err != nil { + if err := oprot.WriteStructBegin(ctx, "TaskConstraint"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TaskConstraint) writeField1(oprot thrift.TProtocol) (err error) { +func (p *TaskConstraint) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetValue() { - if err := oprot.WriteFieldBegin("value", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:value: ", p), err) } - if err := p.Value.Write(oprot); err != nil { + if err := p.Value.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Value), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:value: ", p), err) } } return err } -func (p *TaskConstraint) writeField2(oprot thrift.TProtocol) (err error) { +func (p *TaskConstraint) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetLimit() { - if err := oprot.WriteFieldBegin("limit", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "limit", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:limit: ", p), err) } - if err := p.Limit.Write(oprot); err != nil { + if err := p.Limit.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Limit), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:limit: ", p), err) } } return err } +func (p *TaskConstraint) Equals(other *TaskConstraint) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Value.Equals(other.Value) { return false } + if !p.Limit.Equals(other.Limit) { return false } + return true +} + func (p *TaskConstraint) String() string { if p == nil { return "" @@ -1491,14 +1587,14 @@ func (p *Constraint) IsSetConstraint() bool { return p.Constraint != nil } -func (p *Constraint) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Constraint) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1506,41 +1602,41 @@ func (p *Constraint) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Constraint) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Constraint) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -1548,49 +1644,60 @@ func (p *Constraint) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Constraint) ReadField2(iprot thrift.TProtocol) error { +func (p *Constraint) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Constraint = &TaskConstraint{} - if err := p.Constraint.Read(iprot); err != nil { + if err := p.Constraint.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Constraint), err) } return nil } -func (p *Constraint) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Constraint"); err != nil { +func (p *Constraint) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Constraint"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Constraint) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *Constraint) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *Constraint) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("constraint", thrift.STRUCT, 2); err != nil { +func (p *Constraint) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "constraint", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:constraint: ", p), err) } - if err := p.Constraint.Write(oprot); err != nil { + if err := p.Constraint.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Constraint), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:constraint: ", p), err) } return err } +func (p *Constraint) Equals(other *Constraint) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Name != other.Name { return false } + if !p.Constraint.Equals(other.Constraint) { return false } + return true +} + func (p *Constraint) String() string { if p == nil { return "" @@ -1624,14 +1731,14 @@ func (p *Package) GetName() string { func (p *Package) GetVersion() int32 { return p.Version } -func (p *Package) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Package) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1639,51 +1746,51 @@ func (p *Package) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Package) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Package) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Role = v @@ -1691,8 +1798,8 @@ func (p *Package) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Package) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Package) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Name = v @@ -1700,8 +1807,8 @@ func (p *Package) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Package) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Package) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.Version = v @@ -1709,51 +1816,63 @@ func (p *Package) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Package) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Package"); err != nil { +func (p *Package) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Package"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Package) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("role", thrift.STRING, 1); err != nil { +func (p *Package) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "role", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:role: ", p), err) } - if err := oprot.WriteString(string(p.Role)); err != nil { + if err := oprot.WriteString(ctx, string(p.Role)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.role (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:role: ", p), err) } return err } -func (p *Package) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 2); err != nil { +func (p *Package) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:name: ", p), err) } return err } -func (p *Package) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("version", thrift.I32, 3); err != nil { +func (p *Package) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "version", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:version: ", p), err) } - if err := oprot.WriteI32(int32(p.Version)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Version)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.version (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:version: ", p), err) } return err } +func (p *Package) Equals(other *Package) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Role != other.Role { return false } + if p.Name != other.Name { return false } + if p.Version != other.Version { return false } + return true +} + func (p *Package) String() string { if p == nil { return "" @@ -1783,14 +1902,14 @@ func (p *Metadata) GetKey() string { func (p *Metadata) GetValue() string { return p.Value } -func (p *Metadata) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Metadata) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1798,41 +1917,41 @@ func (p *Metadata) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Metadata) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Metadata) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Key = v @@ -1840,8 +1959,8 @@ func (p *Metadata) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Metadata) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Metadata) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Value = v @@ -1849,40 +1968,51 @@ func (p *Metadata) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Metadata) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Metadata"); err != nil { +func (p *Metadata) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Metadata"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Metadata) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRING, 1); err != nil { +func (p *Metadata) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) } - if err := oprot.WriteString(string(p.Key)); err != nil { + if err := oprot.WriteString(ctx, string(p.Key)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) } return err } -func (p *Metadata) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil { +func (p *Metadata) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) } - if err := oprot.WriteString(string(p.Value)); err != nil { + if err := oprot.WriteString(ctx, string(p.Value)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) } return err } +func (p *Metadata) Equals(other *Metadata) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Key != other.Key { return false } + if p.Value != other.Value { return false } + return true +} + func (p *Metadata) String() string { if p == nil { return "" @@ -1918,14 +2048,14 @@ func (p *JobKey) GetEnvironment() string { func (p *JobKey) GetName() string { return p.Name } -func (p *JobKey) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobKey) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1933,51 +2063,51 @@ func (p *JobKey) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobKey) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobKey) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Role = v @@ -1985,8 +2115,8 @@ func (p *JobKey) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *JobKey) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobKey) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Environment = v @@ -1994,8 +2124,8 @@ func (p *JobKey) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobKey) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobKey) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.Name = v @@ -2003,51 +2133,63 @@ func (p *JobKey) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobKey) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobKey"); err != nil { +func (p *JobKey) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobKey"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobKey) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("role", thrift.STRING, 1); err != nil { +func (p *JobKey) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "role", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:role: ", p), err) } - if err := oprot.WriteString(string(p.Role)); err != nil { + if err := oprot.WriteString(ctx, string(p.Role)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.role (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:role: ", p), err) } return err } -func (p *JobKey) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("environment", thrift.STRING, 2); err != nil { +func (p *JobKey) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "environment", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:environment: ", p), err) } - if err := oprot.WriteString(string(p.Environment)); err != nil { + if err := oprot.WriteString(ctx, string(p.Environment)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.environment (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:environment: ", p), err) } return err } -func (p *JobKey) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 3); err != nil { +func (p *JobKey) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:name: ", p), err) } return err } +func (p *JobKey) Equals(other *JobKey) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Role != other.Role { return false } + if p.Environment != other.Environment { return false } + if p.Name != other.Name { return false } + return true +} + func (p *JobKey) String() string { if p == nil { return "" @@ -2087,14 +2229,14 @@ func (p *LockKey) IsSetJob() bool { return p.Job != nil } -func (p *LockKey) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *LockKey) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2102,66 +2244,76 @@ func (p *LockKey) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *LockKey) ReadField1(iprot thrift.TProtocol) error { +func (p *LockKey) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *LockKey) Write(oprot thrift.TProtocol) error { +func (p *LockKey) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsLockKey(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("LockKey"); err != nil { + if err := oprot.WriteStructBegin(ctx, "LockKey"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *LockKey) writeField1(oprot thrift.TProtocol) (err error) { +func (p *LockKey) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetJob() { - if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "job", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:job: ", p), err) } - if err := p.Job.Write(oprot); err != nil { + if err := p.Job.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:job: ", p), err) } } return err } +func (p *LockKey) Equals(other *LockKey) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Job.Equals(other.Job) { return false } + return true +} + func (p *LockKey) String() string { if p == nil { return "" @@ -2223,14 +2375,14 @@ func (p *Lock) IsSetMessage() bool { return p.Message != nil } -func (p *Lock) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Lock) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2238,79 +2390,79 @@ func (p *Lock) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.I64 { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.STRING { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Lock) ReadField1(iprot thrift.TProtocol) error { +func (p *Lock) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Key = &LockKey{} - if err := p.Key.Read(iprot); err != nil { + if err := p.Key.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) } return nil } -func (p *Lock) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Lock) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Token = v @@ -2318,8 +2470,8 @@ func (p *Lock) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Lock) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Lock) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.User = v @@ -2327,8 +2479,8 @@ func (p *Lock) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Lock) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Lock) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.TimestampMs = v @@ -2336,8 +2488,8 @@ func (p *Lock) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *Lock) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Lock) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { p.Message = &v @@ -2345,76 +2497,95 @@ func (p *Lock) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *Lock) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Lock"); err != nil { +func (p *Lock) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Lock"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Lock) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRUCT, 1); err != nil { +func (p *Lock) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) } - if err := p.Key.Write(oprot); err != nil { + if err := p.Key.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) } return err } -func (p *Lock) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("token", thrift.STRING, 2); err != nil { +func (p *Lock) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "token", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:token: ", p), err) } - if err := oprot.WriteString(string(p.Token)); err != nil { + if err := oprot.WriteString(ctx, string(p.Token)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.token (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:token: ", p), err) } return err } -func (p *Lock) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("user", thrift.STRING, 3); err != nil { +func (p *Lock) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "user", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:user: ", p), err) } - if err := oprot.WriteString(string(p.User)); err != nil { + if err := oprot.WriteString(ctx, string(p.User)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.user (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:user: ", p), err) } return err } -func (p *Lock) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timestampMs", thrift.I64, 4); err != nil { +func (p *Lock) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestampMs", thrift.I64, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:timestampMs: ", p), err) } - if err := oprot.WriteI64(int64(p.TimestampMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TimestampMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timestampMs (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:timestampMs: ", p), err) } return err } -func (p *Lock) writeField5(oprot thrift.TProtocol) (err error) { +func (p *Lock) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMessage() { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 5); err != nil { + if err := oprot.WriteFieldBegin(ctx, "message", thrift.STRING, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:message: ", p), err) } - if err := oprot.WriteString(string(*p.Message)); err != nil { + if err := oprot.WriteString(ctx, string(*p.Message)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.message (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:message: ", p), err) } } return err } +func (p *Lock) Equals(other *Lock) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Key.Equals(other.Key) { return false } + if p.Token != other.Token { return false } + if p.User != other.User { return false } + if p.TimestampMs != other.TimestampMs { return false } + if p.Message != other.Message { + if p.Message == nil || other.Message == nil { + return false + } + if (*p.Message) != (*other.Message) { return false } + } + return true +} + func (p *Lock) String() string { if p == nil { return "" @@ -2451,14 +2622,14 @@ func (p *InstanceKey) IsSetJobKey() bool { return p.JobKey != nil } -func (p *InstanceKey) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *InstanceKey) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2466,49 +2637,49 @@ func (p *InstanceKey) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *InstanceKey) ReadField1(iprot thrift.TProtocol) error { +func (p *InstanceKey) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.JobKey = &JobKey{} - if err := p.JobKey.Read(iprot); err != nil { + if err := p.JobKey.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.JobKey), err) } return nil } -func (p *InstanceKey) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *InstanceKey) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.InstanceId = v @@ -2516,41 +2687,52 @@ func (p *InstanceKey) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *InstanceKey) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("InstanceKey"); err != nil { +func (p *InstanceKey) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "InstanceKey"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *InstanceKey) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("jobKey", thrift.STRUCT, 1); err != nil { +func (p *InstanceKey) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "jobKey", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:jobKey: ", p), err) } - if err := p.JobKey.Write(oprot); err != nil { + if err := p.JobKey.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobKey), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:jobKey: ", p), err) } return err } -func (p *InstanceKey) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instanceId", thrift.I32, 2); err != nil { +func (p *InstanceKey) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instanceId", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:instanceId: ", p), err) } - if err := oprot.WriteI32(int32(p.InstanceId)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.InstanceId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.instanceId (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:instanceId: ", p), err) } return err } +func (p *InstanceKey) Equals(other *InstanceKey) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.JobKey.Equals(other.JobKey) { return false } + if p.InstanceId != other.InstanceId { return false } + return true +} + func (p *InstanceKey) String() string { if p == nil { return "" @@ -2600,14 +2782,14 @@ func (p *MesosFetcherURI) IsSetCache() bool { return p.Cache != nil } -func (p *MesosFetcherURI) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *MesosFetcherURI) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2615,51 +2797,51 @@ func (p *MesosFetcherURI) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.BOOL { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.BOOL { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *MesosFetcherURI) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *MesosFetcherURI) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Value = v @@ -2667,8 +2849,8 @@ func (p *MesosFetcherURI) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *MesosFetcherURI) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *MesosFetcherURI) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Extract = &v @@ -2676,8 +2858,8 @@ func (p *MesosFetcherURI) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *MesosFetcherURI) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *MesosFetcherURI) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.Cache = &v @@ -2685,55 +2867,77 @@ func (p *MesosFetcherURI) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *MesosFetcherURI) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("MesosFetcherURI"); err != nil { +func (p *MesosFetcherURI) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "MesosFetcherURI"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *MesosFetcherURI) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 1); err != nil { +func (p *MesosFetcherURI) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:value: ", p), err) } - if err := oprot.WriteString(string(p.Value)); err != nil { + if err := oprot.WriteString(ctx, string(p.Value)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.value (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:value: ", p), err) } return err } -func (p *MesosFetcherURI) writeField2(oprot thrift.TProtocol) (err error) { +func (p *MesosFetcherURI) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetExtract() { - if err := oprot.WriteFieldBegin("extract", thrift.BOOL, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "extract", thrift.BOOL, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:extract: ", p), err) } - if err := oprot.WriteBool(bool(*p.Extract)); err != nil { + if err := oprot.WriteBool(ctx, bool(*p.Extract)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.extract (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:extract: ", p), err) } } return err } -func (p *MesosFetcherURI) writeField3(oprot thrift.TProtocol) (err error) { +func (p *MesosFetcherURI) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetCache() { - if err := oprot.WriteFieldBegin("cache", thrift.BOOL, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "cache", thrift.BOOL, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:cache: ", p), err) } - if err := oprot.WriteBool(bool(*p.Cache)); err != nil { + if err := oprot.WriteBool(ctx, bool(*p.Cache)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.cache (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:cache: ", p), err) } } return err } +func (p *MesosFetcherURI) Equals(other *MesosFetcherURI) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Value != other.Value { return false } + if p.Extract != other.Extract { + if p.Extract == nil || other.Extract == nil { + return false + } + if (*p.Extract) != (*other.Extract) { return false } + } + if p.Cache != other.Cache { + if p.Cache == nil || other.Cache == nil { + return false + } + if (*p.Cache) != (*other.Cache) { return false } + } + return true +} + func (p *MesosFetcherURI) String() string { if p == nil { return "" @@ -2761,14 +2965,14 @@ func (p *ExecutorConfig) GetName() string { func (p *ExecutorConfig) GetData() string { return p.Data } -func (p *ExecutorConfig) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ExecutorConfig) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2776,41 +2980,41 @@ func (p *ExecutorConfig) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ExecutorConfig) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ExecutorConfig) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -2818,8 +3022,8 @@ func (p *ExecutorConfig) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *ExecutorConfig) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ExecutorConfig) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Data = v @@ -2827,40 +3031,51 @@ func (p *ExecutorConfig) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *ExecutorConfig) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ExecutorConfig"); err != nil { +func (p *ExecutorConfig) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ExecutorConfig"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ExecutorConfig) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *ExecutorConfig) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *ExecutorConfig) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("data", thrift.STRING, 2); err != nil { +func (p *ExecutorConfig) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "data", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:data: ", p), err) } - if err := oprot.WriteString(string(p.Data)); err != nil { + if err := oprot.WriteString(ctx, string(p.Data)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.data (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:data: ", p), err) } return err } +func (p *ExecutorConfig) Equals(other *ExecutorConfig) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Name != other.Name { return false } + if p.Data != other.Data { return false } + return true +} + func (p *ExecutorConfig) String() string { if p == nil { return "" @@ -2896,14 +3111,14 @@ func (p *Volume) GetHostPath() string { func (p *Volume) GetMode() Mode { return p.Mode } -func (p *Volume) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Volume) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2911,51 +3126,51 @@ func (p *Volume) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Volume) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Volume) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.ContainerPath = v @@ -2963,8 +3178,8 @@ func (p *Volume) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Volume) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Volume) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.HostPath = v @@ -2972,8 +3187,8 @@ func (p *Volume) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Volume) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Volume) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { temp := Mode(v) @@ -2982,51 +3197,63 @@ func (p *Volume) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Volume) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Volume"); err != nil { +func (p *Volume) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Volume"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Volume) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("containerPath", thrift.STRING, 1); err != nil { +func (p *Volume) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "containerPath", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:containerPath: ", p), err) } - if err := oprot.WriteString(string(p.ContainerPath)); err != nil { + if err := oprot.WriteString(ctx, string(p.ContainerPath)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.containerPath (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:containerPath: ", p), err) } return err } -func (p *Volume) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hostPath", thrift.STRING, 2); err != nil { +func (p *Volume) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hostPath", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:hostPath: ", p), err) } - if err := oprot.WriteString(string(p.HostPath)); err != nil { + if err := oprot.WriteString(ctx, string(p.HostPath)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.hostPath (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:hostPath: ", p), err) } return err } -func (p *Volume) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("mode", thrift.I32, 3); err != nil { +func (p *Volume) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "mode", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:mode: ", p), err) } - if err := oprot.WriteI32(int32(p.Mode)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Mode)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.mode (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:mode: ", p), err) } return err } +func (p *Volume) Equals(other *Volume) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.ContainerPath != other.ContainerPath { return false } + if p.HostPath != other.HostPath { return false } + if p.Mode != other.Mode { return false } + return true +} + func (p *Volume) String() string { if p == nil { return "" @@ -3056,14 +3283,14 @@ func (p *DockerImage) GetName() string { func (p *DockerImage) GetTag() string { return p.Tag } -func (p *DockerImage) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *DockerImage) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3071,41 +3298,41 @@ func (p *DockerImage) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *DockerImage) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *DockerImage) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -3113,8 +3340,8 @@ func (p *DockerImage) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *DockerImage) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *DockerImage) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Tag = v @@ -3122,40 +3349,51 @@ func (p *DockerImage) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *DockerImage) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("DockerImage"); err != nil { +func (p *DockerImage) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "DockerImage"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *DockerImage) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *DockerImage) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *DockerImage) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("tag", thrift.STRING, 2); err != nil { +func (p *DockerImage) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "tag", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tag: ", p), err) } - if err := oprot.WriteString(string(p.Tag)); err != nil { + if err := oprot.WriteString(ctx, string(p.Tag)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.tag (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tag: ", p), err) } return err } +func (p *DockerImage) Equals(other *DockerImage) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Name != other.Name { return false } + if p.Tag != other.Tag { return false } + return true +} + func (p *DockerImage) String() string { if p == nil { return "" @@ -3185,14 +3423,14 @@ func (p *AppcImage) GetName() string { func (p *AppcImage) GetImageId() string { return p.ImageId } -func (p *AppcImage) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AppcImage) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3200,41 +3438,41 @@ func (p *AppcImage) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AppcImage) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AppcImage) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -3242,8 +3480,8 @@ func (p *AppcImage) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *AppcImage) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AppcImage) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.ImageId = v @@ -3251,40 +3489,51 @@ func (p *AppcImage) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *AppcImage) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("AppcImage"); err != nil { +func (p *AppcImage) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "AppcImage"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AppcImage) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *AppcImage) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *AppcImage) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("imageId", thrift.STRING, 2); err != nil { +func (p *AppcImage) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "imageId", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:imageId: ", p), err) } - if err := oprot.WriteString(string(p.ImageId)); err != nil { + if err := oprot.WriteString(ctx, string(p.ImageId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.imageId (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:imageId: ", p), err) } return err } +func (p *AppcImage) Equals(other *AppcImage) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Name != other.Name { return false } + if p.ImageId != other.ImageId { return false } + return true +} + func (p *AppcImage) String() string { if p == nil { return "" @@ -3340,14 +3589,14 @@ func (p *Image) IsSetAppc() bool { return p.Appc != nil } -func (p *Image) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Image) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3355,98 +3604,109 @@ func (p *Image) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Image) ReadField1(iprot thrift.TProtocol) error { +func (p *Image) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Docker = &DockerImage{} - if err := p.Docker.Read(iprot); err != nil { + if err := p.Docker.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Docker), err) } return nil } -func (p *Image) ReadField2(iprot thrift.TProtocol) error { +func (p *Image) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Appc = &AppcImage{} - if err := p.Appc.Read(iprot); err != nil { + if err := p.Appc.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Appc), err) } return nil } -func (p *Image) Write(oprot thrift.TProtocol) error { +func (p *Image) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsImage(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("Image"); err != nil { + if err := oprot.WriteStructBegin(ctx, "Image"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Image) writeField1(oprot thrift.TProtocol) (err error) { +func (p *Image) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDocker() { - if err := oprot.WriteFieldBegin("docker", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "docker", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:docker: ", p), err) } - if err := p.Docker.Write(oprot); err != nil { + if err := p.Docker.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Docker), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:docker: ", p), err) } } return err } -func (p *Image) writeField2(oprot thrift.TProtocol) (err error) { +func (p *Image) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetAppc() { - if err := oprot.WriteFieldBegin("appc", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "appc", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:appc: ", p), err) } - if err := p.Appc.Write(oprot); err != nil { + if err := p.Appc.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Appc), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:appc: ", p), err) } } return err } +func (p *Image) Equals(other *Image) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Docker.Equals(other.Docker) { return false } + if !p.Appc.Equals(other.Appc) { return false } + return true +} + func (p *Image) String() string { if p == nil { return "" @@ -3488,14 +3748,14 @@ func (p *MesosContainer) IsSetVolumes() bool { return p.Volumes != nil } -func (p *MesosContainer) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *MesosContainer) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3503,115 +3763,130 @@ func (p *MesosContainer) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.LIST { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *MesosContainer) ReadField1(iprot thrift.TProtocol) error { +func (p *MesosContainer) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Image = &Image{} - if err := p.Image.Read(iprot); err != nil { + if err := p.Image.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Image), err) } return nil } -func (p *MesosContainer) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *MesosContainer) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*Volume, 0, size) p.Volumes = tSlice for i := 0; i < size; i ++ { - _elem3 := &Volume{} - if err := _elem3.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err) + _elem6 := &Volume{} + if err := _elem6.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem6), err) } - p.Volumes = append(p.Volumes, _elem3) + p.Volumes = append(p.Volumes, _elem6) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *MesosContainer) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("MesosContainer"); err != nil { +func (p *MesosContainer) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "MesosContainer"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *MesosContainer) writeField1(oprot thrift.TProtocol) (err error) { +func (p *MesosContainer) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetImage() { - if err := oprot.WriteFieldBegin("image", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "image", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:image: ", p), err) } - if err := p.Image.Write(oprot); err != nil { + if err := p.Image.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Image), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:image: ", p), err) } } return err } -func (p *MesosContainer) writeField2(oprot thrift.TProtocol) (err error) { +func (p *MesosContainer) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetVolumes() { - if err := oprot.WriteFieldBegin("volumes", thrift.LIST, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "volumes", thrift.LIST, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:volumes: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Volumes)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Volumes)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Volumes { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:volumes: ", p), err) } } return err } +func (p *MesosContainer) Equals(other *MesosContainer) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Image.Equals(other.Image) { return false } + if len(p.Volumes) != len(other.Volumes) { return false } + for i, _tgt := range p.Volumes { + _src7 := other.Volumes[i] + if !_tgt.Equals(_src7) { return false } + } + return true +} + func (p *MesosContainer) String() string { if p == nil { return "" @@ -3641,14 +3916,14 @@ func (p *DockerParameter) GetName() string { func (p *DockerParameter) GetValue() string { return p.Value } -func (p *DockerParameter) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *DockerParameter) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3656,41 +3931,41 @@ func (p *DockerParameter) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *DockerParameter) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *DockerParameter) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -3698,8 +3973,8 @@ func (p *DockerParameter) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *DockerParameter) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *DockerParameter) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Value = v @@ -3707,40 +3982,51 @@ func (p *DockerParameter) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *DockerParameter) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("DockerParameter"); err != nil { +func (p *DockerParameter) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "DockerParameter"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *DockerParameter) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *DockerParameter) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *DockerParameter) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil { +func (p *DockerParameter) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) } - if err := oprot.WriteString(string(p.Value)); err != nil { + if err := oprot.WriteString(ctx, string(p.Value)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) } return err } +func (p *DockerParameter) Equals(other *DockerParameter) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Name != other.Name { return false } + if p.Value != other.Value { return false } + return true +} + func (p *DockerParameter) String() string { if p == nil { return "" @@ -3775,14 +4061,14 @@ func (p *DockerContainer) IsSetParameters() bool { return p.Parameters != nil } -func (p *DockerContainer) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *DockerContainer) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3790,41 +4076,41 @@ func (p *DockerContainer) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.LIST { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *DockerContainer) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *DockerContainer) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Image = v @@ -3832,71 +4118,86 @@ func (p *DockerContainer) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *DockerContainer) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *DockerContainer) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*DockerParameter, 0, size) p.Parameters = tSlice for i := 0; i < size; i ++ { - _elem4 := &DockerParameter{} - if err := _elem4.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err) + _elem8 := &DockerParameter{} + if err := _elem8.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem8), err) } - p.Parameters = append(p.Parameters, _elem4) + p.Parameters = append(p.Parameters, _elem8) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *DockerContainer) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("DockerContainer"); err != nil { +func (p *DockerContainer) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "DockerContainer"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *DockerContainer) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("image", thrift.STRING, 1); err != nil { +func (p *DockerContainer) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "image", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:image: ", p), err) } - if err := oprot.WriteString(string(p.Image)); err != nil { + if err := oprot.WriteString(ctx, string(p.Image)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.image (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:image: ", p), err) } return err } -func (p *DockerContainer) writeField2(oprot thrift.TProtocol) (err error) { +func (p *DockerContainer) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetParameters() { - if err := oprot.WriteFieldBegin("parameters", thrift.LIST, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "parameters", thrift.LIST, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:parameters: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Parameters)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Parameters)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Parameters { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:parameters: ", p), err) } } return err } +func (p *DockerContainer) Equals(other *DockerContainer) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Image != other.Image { return false } + if len(p.Parameters) != len(other.Parameters) { return false } + for i, _tgt := range p.Parameters { + _src9 := other.Parameters[i] + if !_tgt.Equals(_src9) { return false } + } + return true +} + func (p *DockerContainer) String() string { if p == nil { return "" @@ -3952,14 +4253,14 @@ func (p *Container) IsSetDocker() bool { return p.Docker != nil } -func (p *Container) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Container) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3967,98 +4268,109 @@ func (p *Container) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Container) ReadField1(iprot thrift.TProtocol) error { +func (p *Container) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Mesos = &MesosContainer{} - if err := p.Mesos.Read(iprot); err != nil { + if err := p.Mesos.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Mesos), err) } return nil } -func (p *Container) ReadField2(iprot thrift.TProtocol) error { +func (p *Container) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Docker = &DockerContainer{} - if err := p.Docker.Read(iprot); err != nil { + if err := p.Docker.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Docker), err) } return nil } -func (p *Container) Write(oprot thrift.TProtocol) error { +func (p *Container) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsContainer(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("Container"); err != nil { + if err := oprot.WriteStructBegin(ctx, "Container"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Container) writeField1(oprot thrift.TProtocol) (err error) { +func (p *Container) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMesos() { - if err := oprot.WriteFieldBegin("mesos", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "mesos", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:mesos: ", p), err) } - if err := p.Mesos.Write(oprot); err != nil { + if err := p.Mesos.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Mesos), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:mesos: ", p), err) } } return err } -func (p *Container) writeField2(oprot thrift.TProtocol) (err error) { +func (p *Container) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDocker() { - if err := oprot.WriteFieldBegin("docker", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "docker", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:docker: ", p), err) } - if err := p.Docker.Write(oprot); err != nil { + if err := p.Docker.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Docker), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:docker: ", p), err) } } return err } +func (p *Container) Equals(other *Container) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Mesos.Equals(other.Mesos) { return false } + if !p.Docker.Equals(other.Docker) { return false } + return true +} + func (p *Container) String() string { if p == nil { return "" @@ -4162,14 +4474,14 @@ func (p *Resource) IsSetNumGpus() bool { return p.NumGpus != nil } -func (p *Resource) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Resource) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -4177,71 +4489,71 @@ func (p *Resource) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.DOUBLE { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.I64 { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Resource) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { +func (p *Resource) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.NumCpus = &v @@ -4249,8 +4561,8 @@ func (p *Resource) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Resource) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Resource) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.RamMb = &v @@ -4258,8 +4570,8 @@ func (p *Resource) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Resource) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Resource) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.DiskMb = &v @@ -4267,8 +4579,8 @@ func (p *Resource) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Resource) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Resource) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.NamedPort = &v @@ -4276,8 +4588,8 @@ func (p *Resource) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *Resource) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Resource) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { p.NumGpus = &v @@ -4285,86 +4597,125 @@ func (p *Resource) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *Resource) Write(oprot thrift.TProtocol) error { +func (p *Resource) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsResource(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("Resource"); err != nil { + if err := oprot.WriteStructBegin(ctx, "Resource"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Resource) writeField1(oprot thrift.TProtocol) (err error) { +func (p *Resource) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetNumCpus() { - if err := oprot.WriteFieldBegin("numCpus", thrift.DOUBLE, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "numCpus", thrift.DOUBLE, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:numCpus: ", p), err) } - if err := oprot.WriteDouble(float64(*p.NumCpus)); err != nil { + if err := oprot.WriteDouble(ctx, float64(*p.NumCpus)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.numCpus (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:numCpus: ", p), err) } } return err } -func (p *Resource) writeField2(oprot thrift.TProtocol) (err error) { +func (p *Resource) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetRamMb() { - if err := oprot.WriteFieldBegin("ramMb", thrift.I64, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "ramMb", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:ramMb: ", p), err) } - if err := oprot.WriteI64(int64(*p.RamMb)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.RamMb)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ramMb (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:ramMb: ", p), err) } } return err } -func (p *Resource) writeField3(oprot thrift.TProtocol) (err error) { +func (p *Resource) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDiskMb() { - if err := oprot.WriteFieldBegin("diskMb", thrift.I64, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "diskMb", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:diskMb: ", p), err) } - if err := oprot.WriteI64(int64(*p.DiskMb)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.DiskMb)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.diskMb (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:diskMb: ", p), err) } } return err } -func (p *Resource) writeField4(oprot thrift.TProtocol) (err error) { +func (p *Resource) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetNamedPort() { - if err := oprot.WriteFieldBegin("namedPort", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "namedPort", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:namedPort: ", p), err) } - if err := oprot.WriteString(string(*p.NamedPort)); err != nil { + if err := oprot.WriteString(ctx, string(*p.NamedPort)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.namedPort (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:namedPort: ", p), err) } } return err } -func (p *Resource) writeField5(oprot thrift.TProtocol) (err error) { +func (p *Resource) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetNumGpus() { - if err := oprot.WriteFieldBegin("numGpus", thrift.I64, 5); err != nil { + if err := oprot.WriteFieldBegin(ctx, "numGpus", thrift.I64, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:numGpus: ", p), err) } - if err := oprot.WriteI64(int64(*p.NumGpus)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.NumGpus)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.numGpus (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:numGpus: ", p), err) } } return err } +func (p *Resource) Equals(other *Resource) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.NumCpus != other.NumCpus { + if p.NumCpus == nil || other.NumCpus == nil { + return false + } + if (*p.NumCpus) != (*other.NumCpus) { return false } + } + if p.RamMb != other.RamMb { + if p.RamMb == nil || other.RamMb == nil { + return false + } + if (*p.RamMb) != (*other.RamMb) { return false } + } + if p.DiskMb != other.DiskMb { + if p.DiskMb == nil || other.DiskMb == nil { + return false + } + if (*p.DiskMb) != (*other.DiskMb) { return false } + } + if p.NamedPort != other.NamedPort { + if p.NamedPort == nil || other.NamedPort == nil { + return false + } + if (*p.NamedPort) != (*other.NamedPort) { return false } + } + if p.NumGpus != other.NumGpus { + if p.NumGpus == nil || other.NumGpus == nil { + return false + } + if (*p.NumGpus) != (*other.NumGpus) { return false } + } + return true +} + func (p *Resource) String() string { if p == nil { return "" @@ -4399,14 +4750,14 @@ func (p *PartitionPolicy) IsSetDelaySecs() bool { return p.DelaySecs != nil } -func (p *PartitionPolicy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *PartitionPolicy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -4414,41 +4765,41 @@ func (p *PartitionPolicy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.BOOL { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *PartitionPolicy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *PartitionPolicy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Reschedule = v @@ -4456,8 +4807,8 @@ func (p *PartitionPolicy) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *PartitionPolicy) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *PartitionPolicy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.DelaySecs = &v @@ -4465,42 +4816,58 @@ func (p *PartitionPolicy) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *PartitionPolicy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("PartitionPolicy"); err != nil { +func (p *PartitionPolicy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "PartitionPolicy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *PartitionPolicy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("reschedule", thrift.BOOL, 1); err != nil { +func (p *PartitionPolicy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "reschedule", thrift.BOOL, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:reschedule: ", p), err) } - if err := oprot.WriteBool(bool(p.Reschedule)); err != nil { + if err := oprot.WriteBool(ctx, bool(p.Reschedule)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.reschedule (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:reschedule: ", p), err) } return err } -func (p *PartitionPolicy) writeField2(oprot thrift.TProtocol) (err error) { +func (p *PartitionPolicy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDelaySecs() { - if err := oprot.WriteFieldBegin("delaySecs", thrift.I64, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "delaySecs", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:delaySecs: ", p), err) } - if err := oprot.WriteI64(int64(*p.DelaySecs)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.DelaySecs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.delaySecs (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:delaySecs: ", p), err) } } return err } +func (p *PartitionPolicy) Equals(other *PartitionPolicy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Reschedule != other.Reschedule { return false } + if p.DelaySecs != other.DelaySecs { + if p.DelaySecs == nil || other.DelaySecs == nil { + return false + } + if (*p.DelaySecs) != (*other.DelaySecs) { return false } + } + return true +} + func (p *PartitionPolicy) String() string { if p == nil { return "" @@ -4530,14 +4897,14 @@ func (p *PercentageSlaPolicy) GetPercentage() float64 { func (p *PercentageSlaPolicy) GetDurationSecs() int64 { return p.DurationSecs } -func (p *PercentageSlaPolicy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *PercentageSlaPolicy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -4545,41 +4912,41 @@ func (p *PercentageSlaPolicy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.DOUBLE { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *PercentageSlaPolicy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { +func (p *PercentageSlaPolicy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Percentage = v @@ -4587,8 +4954,8 @@ func (p *PercentageSlaPolicy) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *PercentageSlaPolicy) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *PercentageSlaPolicy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.DurationSecs = v @@ -4596,40 +4963,51 @@ func (p *PercentageSlaPolicy) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *PercentageSlaPolicy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("PercentageSlaPolicy"); err != nil { +func (p *PercentageSlaPolicy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "PercentageSlaPolicy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *PercentageSlaPolicy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("percentage", thrift.DOUBLE, 1); err != nil { +func (p *PercentageSlaPolicy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "percentage", thrift.DOUBLE, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:percentage: ", p), err) } - if err := oprot.WriteDouble(float64(p.Percentage)); err != nil { + if err := oprot.WriteDouble(ctx, float64(p.Percentage)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.percentage (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:percentage: ", p), err) } return err } -func (p *PercentageSlaPolicy) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("durationSecs", thrift.I64, 2); err != nil { +func (p *PercentageSlaPolicy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "durationSecs", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:durationSecs: ", p), err) } - if err := oprot.WriteI64(int64(p.DurationSecs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.DurationSecs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.durationSecs (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:durationSecs: ", p), err) } return err } +func (p *PercentageSlaPolicy) Equals(other *PercentageSlaPolicy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Percentage != other.Percentage { return false } + if p.DurationSecs != other.DurationSecs { return false } + return true +} + func (p *PercentageSlaPolicy) String() string { if p == nil { return "" @@ -4659,14 +5037,14 @@ func (p *CountSlaPolicy) GetCount() int64 { func (p *CountSlaPolicy) GetDurationSecs() int64 { return p.DurationSecs } -func (p *CountSlaPolicy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *CountSlaPolicy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -4674,41 +5052,41 @@ func (p *CountSlaPolicy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I64 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *CountSlaPolicy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *CountSlaPolicy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Count = v @@ -4716,8 +5094,8 @@ func (p *CountSlaPolicy) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *CountSlaPolicy) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *CountSlaPolicy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.DurationSecs = v @@ -4725,40 +5103,51 @@ func (p *CountSlaPolicy) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *CountSlaPolicy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("CountSlaPolicy"); err != nil { +func (p *CountSlaPolicy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "CountSlaPolicy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *CountSlaPolicy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("count", thrift.I64, 1); err != nil { +func (p *CountSlaPolicy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "count", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:count: ", p), err) } - if err := oprot.WriteI64(int64(p.Count)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.Count)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.count (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:count: ", p), err) } return err } -func (p *CountSlaPolicy) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("durationSecs", thrift.I64, 2); err != nil { +func (p *CountSlaPolicy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "durationSecs", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:durationSecs: ", p), err) } - if err := oprot.WriteI64(int64(p.DurationSecs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.DurationSecs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.durationSecs (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:durationSecs: ", p), err) } return err } +func (p *CountSlaPolicy) Equals(other *CountSlaPolicy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Count != other.Count { return false } + if p.DurationSecs != other.DurationSecs { return false } + return true +} + func (p *CountSlaPolicy) String() string { if p == nil { return "" @@ -4788,14 +5177,14 @@ func (p *CoordinatorSlaPolicy) GetCoordinatorUrl() string { func (p *CoordinatorSlaPolicy) GetStatusKey() string { return p.StatusKey } -func (p *CoordinatorSlaPolicy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *CoordinatorSlaPolicy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -4803,41 +5192,41 @@ func (p *CoordinatorSlaPolicy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *CoordinatorSlaPolicy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *CoordinatorSlaPolicy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.CoordinatorUrl = v @@ -4845,8 +5234,8 @@ func (p *CoordinatorSlaPolicy) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *CoordinatorSlaPolicy) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *CoordinatorSlaPolicy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.StatusKey = v @@ -4854,40 +5243,51 @@ func (p *CoordinatorSlaPolicy) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *CoordinatorSlaPolicy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("CoordinatorSlaPolicy"); err != nil { +func (p *CoordinatorSlaPolicy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "CoordinatorSlaPolicy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *CoordinatorSlaPolicy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("coordinatorUrl", thrift.STRING, 1); err != nil { +func (p *CoordinatorSlaPolicy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "coordinatorUrl", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:coordinatorUrl: ", p), err) } - if err := oprot.WriteString(string(p.CoordinatorUrl)); err != nil { + if err := oprot.WriteString(ctx, string(p.CoordinatorUrl)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.coordinatorUrl (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:coordinatorUrl: ", p), err) } return err } -func (p *CoordinatorSlaPolicy) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("statusKey", thrift.STRING, 2); err != nil { +func (p *CoordinatorSlaPolicy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statusKey", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:statusKey: ", p), err) } - if err := oprot.WriteString(string(p.StatusKey)); err != nil { + if err := oprot.WriteString(ctx, string(p.StatusKey)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.statusKey (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:statusKey: ", p), err) } return err } +func (p *CoordinatorSlaPolicy) Equals(other *CoordinatorSlaPolicy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.CoordinatorUrl != other.CoordinatorUrl { return false } + if p.StatusKey != other.StatusKey { return false } + return true +} + func (p *CoordinatorSlaPolicy) String() string { if p == nil { return "" @@ -4959,14 +5359,14 @@ func (p *SlaPolicy) IsSetCoordinatorSlaPolicy() bool { return p.CoordinatorSlaPolicy != nil } -func (p *SlaPolicy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *SlaPolicy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -4974,130 +5374,142 @@ func (p *SlaPolicy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *SlaPolicy) ReadField1(iprot thrift.TProtocol) error { +func (p *SlaPolicy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.PercentageSlaPolicy = &PercentageSlaPolicy{} - if err := p.PercentageSlaPolicy.Read(iprot); err != nil { + if err := p.PercentageSlaPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.PercentageSlaPolicy), err) } return nil } -func (p *SlaPolicy) ReadField2(iprot thrift.TProtocol) error { +func (p *SlaPolicy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.CountSlaPolicy = &CountSlaPolicy{} - if err := p.CountSlaPolicy.Read(iprot); err != nil { + if err := p.CountSlaPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.CountSlaPolicy), err) } return nil } -func (p *SlaPolicy) ReadField3(iprot thrift.TProtocol) error { +func (p *SlaPolicy) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.CoordinatorSlaPolicy = &CoordinatorSlaPolicy{} - if err := p.CoordinatorSlaPolicy.Read(iprot); err != nil { + if err := p.CoordinatorSlaPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.CoordinatorSlaPolicy), err) } return nil } -func (p *SlaPolicy) Write(oprot thrift.TProtocol) error { +func (p *SlaPolicy) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsSlaPolicy(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("SlaPolicy"); err != nil { + if err := oprot.WriteStructBegin(ctx, "SlaPolicy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *SlaPolicy) writeField1(oprot thrift.TProtocol) (err error) { +func (p *SlaPolicy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetPercentageSlaPolicy() { - if err := oprot.WriteFieldBegin("percentageSlaPolicy", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "percentageSlaPolicy", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:percentageSlaPolicy: ", p), err) } - if err := p.PercentageSlaPolicy.Write(oprot); err != nil { + if err := p.PercentageSlaPolicy.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.PercentageSlaPolicy), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:percentageSlaPolicy: ", p), err) } } return err } -func (p *SlaPolicy) writeField2(oprot thrift.TProtocol) (err error) { +func (p *SlaPolicy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetCountSlaPolicy() { - if err := oprot.WriteFieldBegin("countSlaPolicy", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "countSlaPolicy", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:countSlaPolicy: ", p), err) } - if err := p.CountSlaPolicy.Write(oprot); err != nil { + if err := p.CountSlaPolicy.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.CountSlaPolicy), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:countSlaPolicy: ", p), err) } } return err } -func (p *SlaPolicy) writeField3(oprot thrift.TProtocol) (err error) { +func (p *SlaPolicy) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetCoordinatorSlaPolicy() { - if err := oprot.WriteFieldBegin("coordinatorSlaPolicy", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "coordinatorSlaPolicy", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:coordinatorSlaPolicy: ", p), err) } - if err := p.CoordinatorSlaPolicy.Write(oprot); err != nil { + if err := p.CoordinatorSlaPolicy.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.CoordinatorSlaPolicy), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:coordinatorSlaPolicy: ", p), err) } } return err } +func (p *SlaPolicy) Equals(other *SlaPolicy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.PercentageSlaPolicy.Equals(other.PercentageSlaPolicy) { return false } + if !p.CountSlaPolicy.Equals(other.CountSlaPolicy) { return false } + if !p.CoordinatorSlaPolicy.Equals(other.CoordinatorSlaPolicy) { return false } + return true +} + func (p *SlaPolicy) String() string { if p == nil { return "" @@ -5308,14 +5720,14 @@ func (p *TaskConfig) IsSetContainer() bool { return p.Container != nil } -func (p *TaskConfig) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *TaskConfig) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -5323,207 +5735,207 @@ func (p *TaskConfig) Read(iprot thrift.TProtocol) error { switch fieldId { case 28: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField28(iprot); err != nil { + if err := p.ReadField28(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 17: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField17(iprot); err != nil { + if err := p.ReadField17(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.BOOL { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 11: if fieldTypeId == thrift.I32 { - if err := p.ReadField11(iprot); err != nil { + if err := p.ReadField11(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 13: if fieldTypeId == thrift.I32 { - if err := p.ReadField13(iprot); err != nil { + if err := p.ReadField13(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 18: if fieldTypeId == thrift.BOOL { - if err := p.ReadField18(iprot); err != nil { + if err := p.ReadField18(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 30: if fieldTypeId == thrift.STRING { - if err := p.ReadField30(iprot); err != nil { + if err := p.ReadField30(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 32: if fieldTypeId == thrift.SET { - if err := p.ReadField32(iprot); err != nil { + if err := p.ReadField32(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 20: if fieldTypeId == thrift.SET { - if err := p.ReadField20(iprot); err != nil { + if err := p.ReadField20(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 33: if fieldTypeId == thrift.SET { - if err := p.ReadField33(iprot); err != nil { + if err := p.ReadField33(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 22: if fieldTypeId == thrift.MAP { - if err := p.ReadField22(iprot); err != nil { + if err := p.ReadField22(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 23: if fieldTypeId == thrift.STRING { - if err := p.ReadField23(iprot); err != nil { + if err := p.ReadField23(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 25: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField25(iprot); err != nil { + if err := p.ReadField25(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 27: if fieldTypeId == thrift.SET { - if err := p.ReadField27(iprot); err != nil { + if err := p.ReadField27(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 34: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField34(iprot); err != nil { + if err := p.ReadField34(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 35: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField35(iprot); err != nil { + if err := p.ReadField35(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 29: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField29(iprot); err != nil { + if err := p.ReadField29(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *TaskConfig) ReadField28(iprot thrift.TProtocol) error { +func (p *TaskConfig) ReadField28(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *TaskConfig) ReadField17(iprot thrift.TProtocol) error { +func (p *TaskConfig) ReadField17(ctx context.Context, iprot thrift.TProtocol) error { p.Owner = &Identity{} - if err := p.Owner.Read(iprot); err != nil { + if err := p.Owner.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Owner), err) } return nil } -func (p *TaskConfig) ReadField7(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *TaskConfig) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 7: ", err) } else { p.IsService = v @@ -5531,8 +5943,8 @@ func (p *TaskConfig) ReadField7(iprot thrift.TProtocol) error { return nil } -func (p *TaskConfig) ReadField11(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *TaskConfig) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 11: ", err) } else { p.Priority = v @@ -5540,8 +5952,8 @@ func (p *TaskConfig) ReadField11(iprot thrift.TProtocol) error { return nil } -func (p *TaskConfig) ReadField13(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *TaskConfig) ReadField13(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 13: ", err) } else { p.MaxTaskFailures = v @@ -5549,8 +5961,8 @@ func (p *TaskConfig) ReadField13(iprot thrift.TProtocol) error { return nil } -func (p *TaskConfig) ReadField18(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *TaskConfig) ReadField18(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 18: ", err) } else { p.Production = &v @@ -5558,8 +5970,8 @@ func (p *TaskConfig) ReadField18(iprot thrift.TProtocol) error { return nil } -func (p *TaskConfig) ReadField30(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskConfig) ReadField30(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 30: ", err) } else { p.Tier = &v @@ -5567,96 +5979,96 @@ func (p *TaskConfig) ReadField30(iprot thrift.TProtocol) error { return nil } -func (p *TaskConfig) ReadField32(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskConfig) ReadField32(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Resource, 0, size) p.Resources = tSet for i := 0; i < size; i ++ { - _elem5 := &Resource{} - if err := _elem5.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem5), err) + _elem10 := &Resource{} + if err := _elem10.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err) } - p.Resources = append(p.Resources, _elem5) + p.Resources = append(p.Resources, _elem10) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskConfig) ReadField20(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskConfig) ReadField20(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Constraint, 0, size) p.Constraints = tSet for i := 0; i < size; i ++ { - _elem6 := &Constraint{} - if err := _elem6.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem6), err) + _elem11 := &Constraint{} + if err := _elem11.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem11), err) } - p.Constraints = append(p.Constraints, _elem6) + p.Constraints = append(p.Constraints, _elem11) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskConfig) ReadField33(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskConfig) ReadField33(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*MesosFetcherURI, 0, size) p.MesosFetcherUris = tSet for i := 0; i < size; i ++ { - _elem7 := &MesosFetcherURI{} - if err := _elem7.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem7), err) + _elem12 := &MesosFetcherURI{} + if err := _elem12.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem12), err) } - p.MesosFetcherUris = append(p.MesosFetcherUris, _elem7) + p.MesosFetcherUris = append(p.MesosFetcherUris, _elem12) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskConfig) ReadField22(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() +func (p *TaskConfig) ReadField22(ctx context.Context, iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin(ctx) if err != nil { return thrift.PrependError("error reading map begin: ", err) } tMap := make(map[string]string, size) p.TaskLinks = tMap for i := 0; i < size; i ++ { -var _key8 string - if v, err := iprot.ReadString(); err != nil { +var _key13 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _key8 = v + _key13 = v } -var _val9 string - if v, err := iprot.ReadString(); err != nil { +var _val14 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _val9 = v + _val14 = v } - p.TaskLinks[_key8] = _val9 + p.TaskLinks[_key13] = _val14 } - if err := iprot.ReadMapEnd(); err != nil { + if err := iprot.ReadMapEnd(ctx); err != nil { return thrift.PrependError("error reading map end: ", err) } return nil } -func (p *TaskConfig) ReadField23(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskConfig) ReadField23(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 23: ", err) } else { p.ContactEmail = &v @@ -5664,355 +6076,428 @@ func (p *TaskConfig) ReadField23(iprot thrift.TProtocol) error { return nil } -func (p *TaskConfig) ReadField25(iprot thrift.TProtocol) error { +func (p *TaskConfig) ReadField25(ctx context.Context, iprot thrift.TProtocol) error { p.ExecutorConfig = &ExecutorConfig{} - if err := p.ExecutorConfig.Read(iprot); err != nil { + if err := p.ExecutorConfig.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ExecutorConfig), err) } return nil } -func (p *TaskConfig) ReadField27(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskConfig) ReadField27(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Metadata, 0, size) p.Metadata = tSet for i := 0; i < size; i ++ { - _elem10 := &Metadata{} - if err := _elem10.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err) + _elem15 := &Metadata{} + if err := _elem15.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem15), err) } - p.Metadata = append(p.Metadata, _elem10) + p.Metadata = append(p.Metadata, _elem15) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskConfig) ReadField34(iprot thrift.TProtocol) error { +func (p *TaskConfig) ReadField34(ctx context.Context, iprot thrift.TProtocol) error { p.PartitionPolicy = &PartitionPolicy{} - if err := p.PartitionPolicy.Read(iprot); err != nil { + if err := p.PartitionPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.PartitionPolicy), err) } return nil } -func (p *TaskConfig) ReadField35(iprot thrift.TProtocol) error { +func (p *TaskConfig) ReadField35(ctx context.Context, iprot thrift.TProtocol) error { p.SlaPolicy = &SlaPolicy{} - if err := p.SlaPolicy.Read(iprot); err != nil { + if err := p.SlaPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.SlaPolicy), err) } return nil } -func (p *TaskConfig) ReadField29(iprot thrift.TProtocol) error { +func (p *TaskConfig) ReadField29(ctx context.Context, iprot thrift.TProtocol) error { p.Container = &Container{} - if err := p.Container.Read(iprot); err != nil { + if err := p.Container.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Container), err) } return nil } -func (p *TaskConfig) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("TaskConfig"); err != nil { +func (p *TaskConfig) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TaskConfig"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField11(oprot); err != nil { return err } - if err := p.writeField13(oprot); err != nil { return err } - if err := p.writeField17(oprot); err != nil { return err } - if err := p.writeField18(oprot); err != nil { return err } - if err := p.writeField20(oprot); err != nil { return err } - if err := p.writeField22(oprot); err != nil { return err } - if err := p.writeField23(oprot); err != nil { return err } - if err := p.writeField25(oprot); err != nil { return err } - if err := p.writeField27(oprot); err != nil { return err } - if err := p.writeField28(oprot); err != nil { return err } - if err := p.writeField29(oprot); err != nil { return err } - if err := p.writeField30(oprot); err != nil { return err } - if err := p.writeField32(oprot); err != nil { return err } - if err := p.writeField33(oprot); err != nil { return err } - if err := p.writeField34(oprot); err != nil { return err } - if err := p.writeField35(oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField11(ctx, oprot); err != nil { return err } + if err := p.writeField13(ctx, oprot); err != nil { return err } + if err := p.writeField17(ctx, oprot); err != nil { return err } + if err := p.writeField18(ctx, oprot); err != nil { return err } + if err := p.writeField20(ctx, oprot); err != nil { return err } + if err := p.writeField22(ctx, oprot); err != nil { return err } + if err := p.writeField23(ctx, oprot); err != nil { return err } + if err := p.writeField25(ctx, oprot); err != nil { return err } + if err := p.writeField27(ctx, oprot); err != nil { return err } + if err := p.writeField28(ctx, oprot); err != nil { return err } + if err := p.writeField29(ctx, oprot); err != nil { return err } + if err := p.writeField30(ctx, oprot); err != nil { return err } + if err := p.writeField32(ctx, oprot); err != nil { return err } + if err := p.writeField33(ctx, oprot); err != nil { return err } + if err := p.writeField34(ctx, oprot); err != nil { return err } + if err := p.writeField35(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TaskConfig) writeField7(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("isService", thrift.BOOL, 7); err != nil { +func (p *TaskConfig) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "isService", thrift.BOOL, 7); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:isService: ", p), err) } - if err := oprot.WriteBool(bool(p.IsService)); err != nil { + if err := oprot.WriteBool(ctx, bool(p.IsService)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.isService (7) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 7:isService: ", p), err) } return err } -func (p *TaskConfig) writeField11(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("priority", thrift.I32, 11); err != nil { +func (p *TaskConfig) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "priority", thrift.I32, 11); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:priority: ", p), err) } - if err := oprot.WriteI32(int32(p.Priority)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Priority)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.priority (11) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 11:priority: ", p), err) } return err } -func (p *TaskConfig) writeField13(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("maxTaskFailures", thrift.I32, 13); err != nil { +func (p *TaskConfig) writeField13(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "maxTaskFailures", thrift.I32, 13); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 13:maxTaskFailures: ", p), err) } - if err := oprot.WriteI32(int32(p.MaxTaskFailures)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.MaxTaskFailures)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.maxTaskFailures (13) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 13:maxTaskFailures: ", p), err) } return err } -func (p *TaskConfig) writeField17(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("owner", thrift.STRUCT, 17); err != nil { +func (p *TaskConfig) writeField17(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "owner", thrift.STRUCT, 17); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 17:owner: ", p), err) } - if err := p.Owner.Write(oprot); err != nil { + if err := p.Owner.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Owner), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 17:owner: ", p), err) } return err } -func (p *TaskConfig) writeField18(oprot thrift.TProtocol) (err error) { +func (p *TaskConfig) writeField18(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetProduction() { - if err := oprot.WriteFieldBegin("production", thrift.BOOL, 18); err != nil { + if err := oprot.WriteFieldBegin(ctx, "production", thrift.BOOL, 18); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 18:production: ", p), err) } - if err := oprot.WriteBool(bool(*p.Production)); err != nil { + if err := oprot.WriteBool(ctx, bool(*p.Production)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.production (18) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 18:production: ", p), err) } } return err } -func (p *TaskConfig) writeField20(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("constraints", thrift.SET, 20); err != nil { +func (p *TaskConfig) writeField20(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "constraints", thrift.SET, 20); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 20:constraints: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Constraints)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Constraints)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -6035,14 +6520,14 @@ func NewResourceAggregate() *ResourceAggregate { func (p *ResourceAggregate) GetResources() []*Resource { return p.Resources } -func (p *ResourceAggregate) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ResourceAggregate) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -6050,88 +6535,105 @@ func (p *ResourceAggregate) Read(iprot thrift.TProtocol) error { switch fieldId { case 4: if fieldTypeId == thrift.SET { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ResourceAggregate) ReadField4(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *ResourceAggregate) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Resource, 0, size) p.Resources = tSet for i := 0; i < size; i ++ { - _elem11 := &Resource{} - if err := _elem11.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem11), err) + _elem21 := &Resource{} + if err := _elem21.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem21), err) } - p.Resources = append(p.Resources, _elem11) + p.Resources = append(p.Resources, _elem21) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *ResourceAggregate) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ResourceAggregate"); err != nil { +func (p *ResourceAggregate) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ResourceAggregate"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ResourceAggregate) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("resources", thrift.SET, 4); err != nil { +func (p *ResourceAggregate) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "resources", thrift.SET, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:resources: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Resources)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Resources)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -6216,14 +6718,14 @@ func (p *JobConfiguration) IsSetTaskConfig() bool { return p.TaskConfig != nil } -func (p *JobConfiguration) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobConfiguration) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -6231,97 +6733,97 @@ func (p *JobConfiguration) Read(iprot thrift.TProtocol) error { switch fieldId { case 9: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField9(iprot); err != nil { + if err := p.ReadField9(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.I32 { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 8: if fieldTypeId == thrift.I32 { - if err := p.ReadField8(iprot); err != nil { + if err := p.ReadField8(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobConfiguration) ReadField9(iprot thrift.TProtocol) error { +func (p *JobConfiguration) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { p.Key = &JobKey{} - if err := p.Key.Read(iprot); err != nil { + if err := p.Key.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) } return nil } -func (p *JobConfiguration) ReadField7(iprot thrift.TProtocol) error { +func (p *JobConfiguration) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { p.Owner = &Identity{} - if err := p.Owner.Read(iprot); err != nil { + if err := p.Owner.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Owner), err) } return nil } -func (p *JobConfiguration) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobConfiguration) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.CronSchedule = &v @@ -6329,8 +6831,8 @@ func (p *JobConfiguration) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *JobConfiguration) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobConfiguration) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { temp := CronCollisionPolicy(v) @@ -6339,16 +6841,16 @@ func (p *JobConfiguration) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *JobConfiguration) ReadField6(iprot thrift.TProtocol) error { +func (p *JobConfiguration) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { p.TaskConfig = &TaskConfig{} - if err := p.TaskConfig.Read(iprot); err != nil { + if err := p.TaskConfig.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.TaskConfig), err) } return nil } -func (p *JobConfiguration) ReadField8(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobConfiguration) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 8: ", err) } else { p.InstanceCount = v @@ -6356,89 +6858,109 @@ func (p *JobConfiguration) ReadField8(iprot thrift.TProtocol) error { return nil } -func (p *JobConfiguration) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobConfiguration"); err != nil { +func (p *JobConfiguration) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobConfiguration"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField8(oprot); err != nil { return err } - if err := p.writeField9(oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobConfiguration) writeField4(oprot thrift.TProtocol) (err error) { +func (p *JobConfiguration) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetCronSchedule() { - if err := oprot.WriteFieldBegin("cronSchedule", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "cronSchedule", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:cronSchedule: ", p), err) } - if err := oprot.WriteString(string(*p.CronSchedule)); err != nil { + if err := oprot.WriteString(ctx, string(*p.CronSchedule)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.cronSchedule (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:cronSchedule: ", p), err) } } return err } -func (p *JobConfiguration) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("cronCollisionPolicy", thrift.I32, 5); err != nil { +func (p *JobConfiguration) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "cronCollisionPolicy", thrift.I32, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:cronCollisionPolicy: ", p), err) } - if err := oprot.WriteI32(int32(p.CronCollisionPolicy)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.CronCollisionPolicy)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.cronCollisionPolicy (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:cronCollisionPolicy: ", p), err) } return err } -func (p *JobConfiguration) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskConfig", thrift.STRUCT, 6); err != nil { +func (p *JobConfiguration) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskConfig", thrift.STRUCT, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:taskConfig: ", p), err) } - if err := p.TaskConfig.Write(oprot); err != nil { + if err := p.TaskConfig.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TaskConfig), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:taskConfig: ", p), err) } return err } -func (p *JobConfiguration) writeField7(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("owner", thrift.STRUCT, 7); err != nil { +func (p *JobConfiguration) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "owner", thrift.STRUCT, 7); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:owner: ", p), err) } - if err := p.Owner.Write(oprot); err != nil { + if err := p.Owner.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Owner), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 7:owner: ", p), err) } return err } -func (p *JobConfiguration) writeField8(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instanceCount", thrift.I32, 8); err != nil { +func (p *JobConfiguration) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instanceCount", thrift.I32, 8); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:instanceCount: ", p), err) } - if err := oprot.WriteI32(int32(p.InstanceCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.InstanceCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.instanceCount (8) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 8:instanceCount: ", p), err) } return err } -func (p *JobConfiguration) writeField9(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRUCT, 9); err != nil { +func (p *JobConfiguration) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRUCT, 9); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:key: ", p), err) } - if err := p.Key.Write(oprot); err != nil { + if err := p.Key.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 9:key: ", p), err) } return err } +func (p *JobConfiguration) Equals(other *JobConfiguration) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.CronSchedule != other.CronSchedule { + if p.CronSchedule == nil || other.CronSchedule == nil { + return false + } + if (*p.CronSchedule) != (*other.CronSchedule) { return false } + } + if p.CronCollisionPolicy != other.CronCollisionPolicy { return false } + if !p.TaskConfig.Equals(other.TaskConfig) { return false } + if !p.Owner.Equals(other.Owner) { return false } + if p.InstanceCount != other.InstanceCount { return false } + if !p.Key.Equals(other.Key) { return false } + return true +} + func (p *JobConfiguration) String() string { if p == nil { return "" @@ -6478,14 +7000,14 @@ func (p *JobStats) GetFailedTaskCount() int32 { func (p *JobStats) GetPendingTaskCount() int32 { return p.PendingTaskCount } -func (p *JobStats) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobStats) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -6493,61 +7015,61 @@ func (p *JobStats) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.I32 { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobStats) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobStats) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.ActiveTaskCount = v @@ -6555,8 +7077,8 @@ func (p *JobStats) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *JobStats) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobStats) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.FinishedTaskCount = v @@ -6564,8 +7086,8 @@ func (p *JobStats) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobStats) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobStats) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.FailedTaskCount = v @@ -6573,8 +7095,8 @@ func (p *JobStats) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobStats) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobStats) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.PendingTaskCount = v @@ -6582,62 +7104,75 @@ func (p *JobStats) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *JobStats) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobStats"); err != nil { +func (p *JobStats) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobStats"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobStats) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("activeTaskCount", thrift.I32, 1); err != nil { +func (p *JobStats) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "activeTaskCount", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:activeTaskCount: ", p), err) } - if err := oprot.WriteI32(int32(p.ActiveTaskCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.ActiveTaskCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.activeTaskCount (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:activeTaskCount: ", p), err) } return err } -func (p *JobStats) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("finishedTaskCount", thrift.I32, 2); err != nil { +func (p *JobStats) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "finishedTaskCount", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:finishedTaskCount: ", p), err) } - if err := oprot.WriteI32(int32(p.FinishedTaskCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.FinishedTaskCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.finishedTaskCount (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:finishedTaskCount: ", p), err) } return err } -func (p *JobStats) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("failedTaskCount", thrift.I32, 3); err != nil { +func (p *JobStats) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "failedTaskCount", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:failedTaskCount: ", p), err) } - if err := oprot.WriteI32(int32(p.FailedTaskCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.FailedTaskCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.failedTaskCount (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:failedTaskCount: ", p), err) } return err } -func (p *JobStats) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("pendingTaskCount", thrift.I32, 4); err != nil { +func (p *JobStats) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "pendingTaskCount", thrift.I32, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:pendingTaskCount: ", p), err) } - if err := oprot.WriteI32(int32(p.PendingTaskCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.PendingTaskCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.pendingTaskCount (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:pendingTaskCount: ", p), err) } return err } +func (p *JobStats) Equals(other *JobStats) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.ActiveTaskCount != other.ActiveTaskCount { return false } + if p.FinishedTaskCount != other.FinishedTaskCount { return false } + if p.FailedTaskCount != other.FailedTaskCount { return false } + if p.PendingTaskCount != other.PendingTaskCount { return false } + return true +} + func (p *JobStats) String() string { if p == nil { return "" @@ -6692,14 +7227,14 @@ func (p *JobSummary) IsSetNextCronRunMs() bool { return p.NextCronRunMs != nil } -func (p *JobSummary) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobSummary) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -6707,67 +7242,67 @@ func (p *JobSummary) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobSummary) ReadField1(iprot thrift.TProtocol) error { +func (p *JobSummary) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobConfiguration{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *JobSummary) ReadField2(iprot thrift.TProtocol) error { +func (p *JobSummary) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Stats = &JobStats{} - if err := p.Stats.Read(iprot); err != nil { + if err := p.Stats.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Stats), err) } return nil } -func (p *JobSummary) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *JobSummary) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.NextCronRunMs = &v @@ -6775,55 +7310,72 @@ func (p *JobSummary) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobSummary) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobSummary"); err != nil { +func (p *JobSummary) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobSummary"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobSummary) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 1); err != nil { +func (p *JobSummary) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "job", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:job: ", p), err) } - if err := p.Job.Write(oprot); err != nil { + if err := p.Job.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:job: ", p), err) } return err } -func (p *JobSummary) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("stats", thrift.STRUCT, 2); err != nil { +func (p *JobSummary) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "stats", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:stats: ", p), err) } - if err := p.Stats.Write(oprot); err != nil { + if err := p.Stats.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Stats), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:stats: ", p), err) } return err } -func (p *JobSummary) writeField3(oprot thrift.TProtocol) (err error) { +func (p *JobSummary) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetNextCronRunMs() { - if err := oprot.WriteFieldBegin("nextCronRunMs", thrift.I64, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "nextCronRunMs", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:nextCronRunMs: ", p), err) } - if err := oprot.WriteI64(int64(*p.NextCronRunMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.NextCronRunMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.nextCronRunMs (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:nextCronRunMs: ", p), err) } } return err } +func (p *JobSummary) Equals(other *JobSummary) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Job.Equals(other.Job) { return false } + if !p.Stats.Equals(other.Stats) { return false } + if p.NextCronRunMs != other.NextCronRunMs { + if p.NextCronRunMs == nil || other.NextCronRunMs == nil { + return false + } + if (*p.NextCronRunMs) != (*other.NextCronRunMs) { return false } + } + return true +} + func (p *JobSummary) String() string { if p == nil { return "" @@ -6853,14 +7405,14 @@ func (p *Range) GetFirst() int32 { func (p *Range) GetLast() int32 { return p.Last } -func (p *Range) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Range) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -6868,41 +7420,41 @@ func (p *Range) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Range) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Range) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.First = v @@ -6910,8 +7462,8 @@ func (p *Range) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Range) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Range) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Last = v @@ -6919,40 +7471,51 @@ func (p *Range) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Range) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Range"); err != nil { +func (p *Range) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Range"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Range) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("first", thrift.I32, 1); err != nil { +func (p *Range) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "first", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:first: ", p), err) } - if err := oprot.WriteI32(int32(p.First)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.First)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.first (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:first: ", p), err) } return err } -func (p *Range) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("last", thrift.I32, 2); err != nil { +func (p *Range) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "last", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:last: ", p), err) } - if err := oprot.WriteI32(int32(p.Last)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Last)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.last (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:last: ", p), err) } return err } +func (p *Range) Equals(other *Range) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.First != other.First { return false } + if p.Last != other.Last { return false } + return true +} + func (p *Range) String() string { if p == nil { return "" @@ -6988,14 +7551,14 @@ func (p *ConfigGroup) IsSetConfig() bool { return p.Config != nil } -func (p *ConfigGroup) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ConfigGroup) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -7003,118 +7566,136 @@ func (p *ConfigGroup) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.SET { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ConfigGroup) ReadField1(iprot thrift.TProtocol) error { +func (p *ConfigGroup) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Config = &TaskConfig{} - if err := p.Config.Read(iprot); err != nil { + if err := p.Config.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Config), err) } return nil } -func (p *ConfigGroup) ReadField3(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *ConfigGroup) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Range, 0, size) p.Instances = tSet for i := 0; i < size; i ++ { - _elem12 := &Range{} - if err := _elem12.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem12), err) + _elem23 := &Range{} + if err := _elem23.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem23), err) } - p.Instances = append(p.Instances, _elem12) + p.Instances = append(p.Instances, _elem23) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *ConfigGroup) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ConfigGroup"); err != nil { +func (p *ConfigGroup) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ConfigGroup"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ConfigGroup) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("config", thrift.STRUCT, 1); err != nil { +func (p *ConfigGroup) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "config", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:config: ", p), err) } - if err := p.Config.Write(oprot); err != nil { + if err := p.Config.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Config), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:config: ", p), err) } return err } -func (p *ConfigGroup) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instances", thrift.SET, 3); err != nil { +func (p *ConfigGroup) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instances", thrift.SET, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:instances: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Instances)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Instances)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -7149,14 +7730,14 @@ func (p *ConfigSummary) IsSetKey() bool { return p.Key != nil } -func (p *ConfigSummary) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ConfigSummary) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -7164,118 +7745,136 @@ func (p *ConfigSummary) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ConfigSummary) ReadField1(iprot thrift.TProtocol) error { +func (p *ConfigSummary) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Key = &JobKey{} - if err := p.Key.Read(iprot); err != nil { + if err := p.Key.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) } return nil } -func (p *ConfigSummary) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *ConfigSummary) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*ConfigGroup, 0, size) p.Groups = tSet for i := 0; i < size; i ++ { - _elem13 := &ConfigGroup{} - if err := _elem13.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem13), err) + _elem25 := &ConfigGroup{} + if err := _elem25.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem25), err) } - p.Groups = append(p.Groups, _elem13) + p.Groups = append(p.Groups, _elem25) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *ConfigSummary) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ConfigSummary"); err != nil { +func (p *ConfigSummary) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ConfigSummary"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ConfigSummary) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRUCT, 1); err != nil { +func (p *ConfigSummary) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) } - if err := p.Key.Write(oprot); err != nil { + if err := p.Key.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) } return err } -func (p *ConfigSummary) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("groups", thrift.SET, 2); err != nil { +func (p *ConfigSummary) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "groups", thrift.SET, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:groups: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Groups)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Groups)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -7305,14 +7904,14 @@ func (p *PopulateJobResult_) IsSetTaskConfig() bool { return p.TaskConfig != nil } -func (p *PopulateJobResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *PopulateJobResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -7320,61 +7919,71 @@ func (p *PopulateJobResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *PopulateJobResult_) ReadField2(iprot thrift.TProtocol) error { +func (p *PopulateJobResult_) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.TaskConfig = &TaskConfig{} - if err := p.TaskConfig.Read(iprot); err != nil { + if err := p.TaskConfig.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.TaskConfig), err) } return nil } -func (p *PopulateJobResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("PopulateJobResult"); err != nil { +func (p *PopulateJobResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "PopulateJobResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *PopulateJobResult_) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskConfig", thrift.STRUCT, 2); err != nil { +func (p *PopulateJobResult_) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskConfig", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:taskConfig: ", p), err) } - if err := p.TaskConfig.Write(oprot); err != nil { + if err := p.TaskConfig.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TaskConfig), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:taskConfig: ", p), err) } return err } +func (p *PopulateJobResult_) Equals(other *PopulateJobResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.TaskConfig.Equals(other.TaskConfig) { return false } + return true +} + func (p *PopulateJobResult_) String() string { if p == nil { return "" @@ -7455,14 +8064,14 @@ func (p *GetQuotaResult_) IsSetNonProdDedicatedConsumption() bool { return p.NonProdDedicatedConsumption != nil } -func (p *GetQuotaResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetQuotaResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -7470,189 +8079,203 @@ func (p *GetQuotaResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetQuotaResult_) ReadField1(iprot thrift.TProtocol) error { +func (p *GetQuotaResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Quota = &ResourceAggregate{} - if err := p.Quota.Read(iprot); err != nil { + if err := p.Quota.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Quota), err) } return nil } -func (p *GetQuotaResult_) ReadField2(iprot thrift.TProtocol) error { +func (p *GetQuotaResult_) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.ProdSharedConsumption = &ResourceAggregate{} - if err := p.ProdSharedConsumption.Read(iprot); err != nil { + if err := p.ProdSharedConsumption.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ProdSharedConsumption), err) } return nil } -func (p *GetQuotaResult_) ReadField3(iprot thrift.TProtocol) error { +func (p *GetQuotaResult_) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.NonProdSharedConsumption = &ResourceAggregate{} - if err := p.NonProdSharedConsumption.Read(iprot); err != nil { + if err := p.NonProdSharedConsumption.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.NonProdSharedConsumption), err) } return nil } -func (p *GetQuotaResult_) ReadField4(iprot thrift.TProtocol) error { +func (p *GetQuotaResult_) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.ProdDedicatedConsumption = &ResourceAggregate{} - if err := p.ProdDedicatedConsumption.Read(iprot); err != nil { + if err := p.ProdDedicatedConsumption.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ProdDedicatedConsumption), err) } return nil } -func (p *GetQuotaResult_) ReadField5(iprot thrift.TProtocol) error { +func (p *GetQuotaResult_) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { p.NonProdDedicatedConsumption = &ResourceAggregate{} - if err := p.NonProdDedicatedConsumption.Read(iprot); err != nil { + if err := p.NonProdDedicatedConsumption.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.NonProdDedicatedConsumption), err) } return nil } -func (p *GetQuotaResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetQuotaResult"); err != nil { +func (p *GetQuotaResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetQuotaResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetQuotaResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("quota", thrift.STRUCT, 1); err != nil { +func (p *GetQuotaResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "quota", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:quota: ", p), err) } - if err := p.Quota.Write(oprot); err != nil { + if err := p.Quota.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Quota), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:quota: ", p), err) } return err } -func (p *GetQuotaResult_) writeField2(oprot thrift.TProtocol) (err error) { +func (p *GetQuotaResult_) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetProdSharedConsumption() { - if err := oprot.WriteFieldBegin("prodSharedConsumption", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "prodSharedConsumption", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prodSharedConsumption: ", p), err) } - if err := p.ProdSharedConsumption.Write(oprot); err != nil { + if err := p.ProdSharedConsumption.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ProdSharedConsumption), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prodSharedConsumption: ", p), err) } } return err } -func (p *GetQuotaResult_) writeField3(oprot thrift.TProtocol) (err error) { +func (p *GetQuotaResult_) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetNonProdSharedConsumption() { - if err := oprot.WriteFieldBegin("nonProdSharedConsumption", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "nonProdSharedConsumption", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:nonProdSharedConsumption: ", p), err) } - if err := p.NonProdSharedConsumption.Write(oprot); err != nil { + if err := p.NonProdSharedConsumption.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.NonProdSharedConsumption), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:nonProdSharedConsumption: ", p), err) } } return err } -func (p *GetQuotaResult_) writeField4(oprot thrift.TProtocol) (err error) { +func (p *GetQuotaResult_) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetProdDedicatedConsumption() { - if err := oprot.WriteFieldBegin("prodDedicatedConsumption", thrift.STRUCT, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "prodDedicatedConsumption", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:prodDedicatedConsumption: ", p), err) } - if err := p.ProdDedicatedConsumption.Write(oprot); err != nil { + if err := p.ProdDedicatedConsumption.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ProdDedicatedConsumption), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:prodDedicatedConsumption: ", p), err) } } return err } -func (p *GetQuotaResult_) writeField5(oprot thrift.TProtocol) (err error) { +func (p *GetQuotaResult_) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetNonProdDedicatedConsumption() { - if err := oprot.WriteFieldBegin("nonProdDedicatedConsumption", thrift.STRUCT, 5); err != nil { + if err := oprot.WriteFieldBegin(ctx, "nonProdDedicatedConsumption", thrift.STRUCT, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:nonProdDedicatedConsumption: ", p), err) } - if err := p.NonProdDedicatedConsumption.Write(oprot); err != nil { + if err := p.NonProdDedicatedConsumption.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.NonProdDedicatedConsumption), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:nonProdDedicatedConsumption: ", p), err) } } return err } +func (p *GetQuotaResult_) Equals(other *GetQuotaResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Quota.Equals(other.Quota) { return false } + if !p.ProdSharedConsumption.Equals(other.ProdSharedConsumption) { return false } + if !p.NonProdSharedConsumption.Equals(other.NonProdSharedConsumption) { return false } + if !p.ProdDedicatedConsumption.Equals(other.ProdDedicatedConsumption) { return false } + if !p.NonProdDedicatedConsumption.Equals(other.NonProdDedicatedConsumption) { return false } + return true +} + func (p *GetQuotaResult_) String() string { if p == nil { return "" @@ -7708,14 +8331,14 @@ func (p *TaskEvent) IsSetScheduler() bool { return p.Scheduler != nil } -func (p *TaskEvent) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *TaskEvent) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -7723,61 +8346,61 @@ func (p *TaskEvent) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I64 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *TaskEvent) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *TaskEvent) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Timestamp = v @@ -7785,8 +8408,8 @@ func (p *TaskEvent) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *TaskEvent) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *TaskEvent) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { temp := ScheduleStatus(v) @@ -7795,8 +8418,8 @@ func (p *TaskEvent) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *TaskEvent) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskEvent) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.Message = &v @@ -7804,8 +8427,8 @@ func (p *TaskEvent) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *TaskEvent) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskEvent) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.Scheduler = &v @@ -7813,66 +8436,89 @@ func (p *TaskEvent) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *TaskEvent) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("TaskEvent"); err != nil { +func (p *TaskEvent) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TaskEvent"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TaskEvent) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timestamp", thrift.I64, 1); err != nil { +func (p *TaskEvent) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err) } - if err := oprot.WriteI64(int64(p.Timestamp)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err) } return err } -func (p *TaskEvent) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.I32, 2); err != nil { +func (p *TaskEvent) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:status: ", p), err) } - if err := oprot.WriteI32(int32(p.Status)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Status)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.status (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:status: ", p), err) } return err } -func (p *TaskEvent) writeField3(oprot thrift.TProtocol) (err error) { +func (p *TaskEvent) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMessage() { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "message", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:message: ", p), err) } - if err := oprot.WriteString(string(*p.Message)); err != nil { + if err := oprot.WriteString(ctx, string(*p.Message)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.message (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:message: ", p), err) } } return err } -func (p *TaskEvent) writeField4(oprot thrift.TProtocol) (err error) { +func (p *TaskEvent) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetScheduler() { - if err := oprot.WriteFieldBegin("scheduler", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "scheduler", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:scheduler: ", p), err) } - if err := oprot.WriteString(string(*p.Scheduler)); err != nil { + if err := oprot.WriteString(ctx, string(*p.Scheduler)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.scheduler (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:scheduler: ", p), err) } } return err } +func (p *TaskEvent) Equals(other *TaskEvent) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Timestamp != other.Timestamp { return false } + if p.Status != other.Status { return false } + if p.Message != other.Message { + if p.Message == nil || other.Message == nil { + return false + } + if (*p.Message) != (*other.Message) { return false } + } + if p.Scheduler != other.Scheduler { + if p.Scheduler == nil || other.Scheduler == nil { + return false + } + if (*p.Scheduler) != (*other.Scheduler) { return false } + } + return true +} + func (p *TaskEvent) String() string { if p == nil { return "" @@ -7936,14 +8582,14 @@ func (p *AssignedTask) IsSetTask() bool { return p.Task != nil } -func (p *AssignedTask) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AssignedTask) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -7951,81 +8597,81 @@ func (p *AssignedTask) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.MAP { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.I32 { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AssignedTask) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AssignedTask) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.TaskId = v @@ -8033,8 +8679,8 @@ func (p *AssignedTask) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *AssignedTask) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AssignedTask) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.SlaveId = v @@ -8042,8 +8688,8 @@ func (p *AssignedTask) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *AssignedTask) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AssignedTask) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.SlaveHost = v @@ -8051,44 +8697,44 @@ func (p *AssignedTask) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *AssignedTask) ReadField4(iprot thrift.TProtocol) error { +func (p *AssignedTask) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.Task = &TaskConfig{} - if err := p.Task.Read(iprot); err != nil { + if err := p.Task.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Task), err) } return nil } -func (p *AssignedTask) ReadField5(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() +func (p *AssignedTask) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin(ctx) if err != nil { return thrift.PrependError("error reading map begin: ", err) } tMap := make(map[string]int32, size) p.AssignedPorts = tMap for i := 0; i < size; i ++ { -var _key14 string - if v, err := iprot.ReadString(); err != nil { +var _key27 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _key14 = v + _key27 = v } -var _val15 int32 - if v, err := iprot.ReadI32(); err != nil { +var _val28 int32 + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _val15 = v + _val28 = v } - p.AssignedPorts[_key14] = _val15 + p.AssignedPorts[_key27] = _val28 } - if err := iprot.ReadMapEnd(); err != nil { + if err := iprot.ReadMapEnd(ctx); err != nil { return thrift.PrependError("error reading map end: ", err) } return nil } -func (p *AssignedTask) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *AssignedTask) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 6: ", err) } else { p.InstanceId = v @@ -8096,95 +8742,114 @@ func (p *AssignedTask) ReadField6(iprot thrift.TProtocol) error { return nil } -func (p *AssignedTask) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("AssignedTask"); err != nil { +func (p *AssignedTask) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "AssignedTask"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AssignedTask) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskId", thrift.STRING, 1); err != nil { +func (p *AssignedTask) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskId", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:taskId: ", p), err) } - if err := oprot.WriteString(string(p.TaskId)); err != nil { + if err := oprot.WriteString(ctx, string(p.TaskId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.taskId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:taskId: ", p), err) } return err } -func (p *AssignedTask) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("slaveId", thrift.STRING, 2); err != nil { +func (p *AssignedTask) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "slaveId", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:slaveId: ", p), err) } - if err := oprot.WriteString(string(p.SlaveId)); err != nil { + if err := oprot.WriteString(ctx, string(p.SlaveId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.slaveId (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:slaveId: ", p), err) } return err } -func (p *AssignedTask) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("slaveHost", thrift.STRING, 3); err != nil { +func (p *AssignedTask) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "slaveHost", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:slaveHost: ", p), err) } - if err := oprot.WriteString(string(p.SlaveHost)); err != nil { + if err := oprot.WriteString(ctx, string(p.SlaveHost)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.slaveHost (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:slaveHost: ", p), err) } return err } -func (p *AssignedTask) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("task", thrift.STRUCT, 4); err != nil { +func (p *AssignedTask) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "task", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:task: ", p), err) } - if err := p.Task.Write(oprot); err != nil { + if err := p.Task.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Task), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:task: ", p), err) } return err } -func (p *AssignedTask) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("assignedPorts", thrift.MAP, 5); err != nil { +func (p *AssignedTask) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "assignedPorts", thrift.MAP, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:assignedPorts: ", p), err) } - if err := oprot.WriteMapBegin(thrift.STRING, thrift.I32, len(p.AssignedPorts)); err != nil { + if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.I32, len(p.AssignedPorts)); err != nil { return thrift.PrependError("error writing map begin: ", err) } for k, v := range p.AssignedPorts { - if err := oprot.WriteString(string(k)); err != nil { + if err := oprot.WriteString(ctx, string(k)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteI32(int32(v)); err != nil { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } - if err := oprot.WriteMapEnd(); err != nil { + if err := oprot.WriteMapEnd(ctx); err != nil { return thrift.PrependError("error writing map end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:assignedPorts: ", p), err) } return err } -func (p *AssignedTask) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instanceId", thrift.I32, 6); err != nil { +func (p *AssignedTask) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instanceId", thrift.I32, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:instanceId: ", p), err) } - if err := oprot.WriteI32(int32(p.InstanceId)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.InstanceId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.instanceId (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:instanceId: ", p), err) } return err } +func (p *AssignedTask) Equals(other *AssignedTask) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.TaskId != other.TaskId { return false } + if p.SlaveId != other.SlaveId { return false } + if p.SlaveHost != other.SlaveHost { return false } + if !p.Task.Equals(other.Task) { return false } + if len(p.AssignedPorts) != len(other.AssignedPorts) { return false } + for k, _tgt := range p.AssignedPorts { + _src29 := other.AssignedPorts[k] + if _tgt != _src29 { return false } + } + if p.InstanceId != other.InstanceId { return false } + return true +} + func (p *AssignedTask) String() string { if p == nil { return "" @@ -8247,14 +8912,14 @@ func (p *ScheduledTask) IsSetAssignedTask() bool { return p.AssignedTask != nil } -func (p *ScheduledTask) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ScheduledTask) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -8262,89 +8927,89 @@ func (p *ScheduledTask) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.I32 { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.LIST { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.STRING { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ScheduledTask) ReadField1(iprot thrift.TProtocol) error { +func (p *ScheduledTask) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.AssignedTask = &AssignedTask{} - if err := p.AssignedTask.Read(iprot); err != nil { + if err := p.AssignedTask.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.AssignedTask), err) } return nil } -func (p *ScheduledTask) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *ScheduledTask) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { temp := ScheduleStatus(v) @@ -8353,8 +9018,8 @@ func (p *ScheduledTask) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *ScheduledTask) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *ScheduledTask) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.FailureCount = v @@ -8362,8 +9027,8 @@ func (p *ScheduledTask) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *ScheduledTask) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *ScheduledTask) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 6: ", err) } else { p.TimesPartitioned = v @@ -8371,28 +9036,28 @@ func (p *ScheduledTask) ReadField6(iprot thrift.TProtocol) error { return nil } -func (p *ScheduledTask) ReadField4(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *ScheduledTask) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*TaskEvent, 0, size) p.TaskEvents = tSlice for i := 0; i < size; i ++ { - _elem16 := &TaskEvent{} - if err := _elem16.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem16), err) + _elem30 := &TaskEvent{} + if err := _elem30.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem30), err) } - p.TaskEvents = append(p.TaskEvents, _elem16) + p.TaskEvents = append(p.TaskEvents, _elem30) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *ScheduledTask) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ScheduledTask) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { p.AncestorId = v @@ -8400,94 +9065,113 @@ func (p *ScheduledTask) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *ScheduledTask) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ScheduledTask"); err != nil { +func (p *ScheduledTask) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ScheduledTask"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ScheduledTask) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("assignedTask", thrift.STRUCT, 1); err != nil { +func (p *ScheduledTask) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "assignedTask", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:assignedTask: ", p), err) } - if err := p.AssignedTask.Write(oprot); err != nil { + if err := p.AssignedTask.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.AssignedTask), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:assignedTask: ", p), err) } return err } -func (p *ScheduledTask) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.I32, 2); err != nil { +func (p *ScheduledTask) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:status: ", p), err) } - if err := oprot.WriteI32(int32(p.Status)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Status)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.status (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:status: ", p), err) } return err } -func (p *ScheduledTask) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("failureCount", thrift.I32, 3); err != nil { +func (p *ScheduledTask) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "failureCount", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:failureCount: ", p), err) } - if err := oprot.WriteI32(int32(p.FailureCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.FailureCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.failureCount (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:failureCount: ", p), err) } return err } -func (p *ScheduledTask) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskEvents", thrift.LIST, 4); err != nil { +func (p *ScheduledTask) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskEvents", thrift.LIST, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:taskEvents: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.TaskEvents)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.TaskEvents)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.TaskEvents { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:taskEvents: ", p), err) } return err } -func (p *ScheduledTask) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ancestorId", thrift.STRING, 5); err != nil { +func (p *ScheduledTask) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "ancestorId", thrift.STRING, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:ancestorId: ", p), err) } - if err := oprot.WriteString(string(p.AncestorId)); err != nil { + if err := oprot.WriteString(ctx, string(p.AncestorId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ancestorId (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:ancestorId: ", p), err) } return err } -func (p *ScheduledTask) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timesPartitioned", thrift.I32, 6); err != nil { +func (p *ScheduledTask) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timesPartitioned", thrift.I32, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:timesPartitioned: ", p), err) } - if err := oprot.WriteI32(int32(p.TimesPartitioned)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.TimesPartitioned)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timesPartitioned (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:timesPartitioned: ", p), err) } return err } +func (p *ScheduledTask) Equals(other *ScheduledTask) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.AssignedTask.Equals(other.AssignedTask) { return false } + if p.Status != other.Status { return false } + if p.FailureCount != other.FailureCount { return false } + if len(p.TaskEvents) != len(other.TaskEvents) { return false } + for i, _tgt := range p.TaskEvents { + _src31 := other.TaskEvents[i] + if !_tgt.Equals(_src31) { return false } + } + if p.AncestorId != other.AncestorId { return false } + if p.TimesPartitioned != other.TimesPartitioned { return false } + return true +} + func (p *ScheduledTask) String() string { if p == nil { return "" @@ -8509,14 +9193,14 @@ func NewScheduleStatusResult_() *ScheduleStatusResult_ { func (p *ScheduleStatusResult_) GetTasks() []*ScheduledTask { return p.Tasks } -func (p *ScheduleStatusResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ScheduleStatusResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -8524,81 +9208,95 @@ func (p *ScheduleStatusResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.LIST { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ScheduleStatusResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *ScheduleStatusResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*ScheduledTask, 0, size) p.Tasks = tSlice for i := 0; i < size; i ++ { - _elem17 := &ScheduledTask{} - if err := _elem17.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem17), err) + _elem32 := &ScheduledTask{} + if err := _elem32.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem32), err) } - p.Tasks = append(p.Tasks, _elem17) + p.Tasks = append(p.Tasks, _elem32) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *ScheduleStatusResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ScheduleStatusResult"); err != nil { +func (p *ScheduleStatusResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ScheduleStatusResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ScheduleStatusResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("tasks", thrift.LIST, 1); err != nil { +func (p *ScheduleStatusResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "tasks", thrift.LIST, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:tasks: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Tasks)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Tasks)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Tasks { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:tasks: ", p), err) } return err } +func (p *ScheduleStatusResult_) Equals(other *ScheduleStatusResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if len(p.Tasks) != len(other.Tasks) { return false } + for i, _tgt := range p.Tasks { + _src33 := other.Tasks[i] + if !_tgt.Equals(_src33) { return false } + } + return true +} + func (p *ScheduleStatusResult_) String() string { if p == nil { return "" @@ -8620,14 +9318,14 @@ func NewGetJobsResult_() *GetJobsResult_ { func (p *GetJobsResult_) GetConfigs() []*JobConfiguration { return p.Configs } -func (p *GetJobsResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetJobsResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -8635,88 +9333,105 @@ func (p *GetJobsResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetJobsResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetJobsResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*JobConfiguration, 0, size) p.Configs = tSet for i := 0; i < size; i ++ { - _elem18 := &JobConfiguration{} - if err := _elem18.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem18), err) + _elem34 := &JobConfiguration{} + if err := _elem34.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem34), err) } - p.Configs = append(p.Configs, _elem18) + p.Configs = append(p.Configs, _elem34) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetJobsResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetJobsResult"); err != nil { +func (p *GetJobsResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetJobsResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetJobsResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("configs", thrift.SET, 1); err != nil { +func (p *GetJobsResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "configs", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:configs: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Configs)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Configs)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -8859,14 +9574,14 @@ func (p *TaskQuery) IsSetLimit() bool { return p.Limit != nil } -func (p *TaskQuery) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *TaskQuery) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -8874,121 +9589,121 @@ func (p *TaskQuery) Read(iprot thrift.TProtocol) error { switch fieldId { case 14: if fieldTypeId == thrift.STRING { - if err := p.ReadField14(iprot); err != nil { + if err := p.ReadField14(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 9: if fieldTypeId == thrift.STRING { - if err := p.ReadField9(iprot); err != nil { + if err := p.ReadField9(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.SET { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.SET { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.SET { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 10: if fieldTypeId == thrift.SET { - if err := p.ReadField10(iprot); err != nil { + if err := p.ReadField10(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 11: if fieldTypeId == thrift.SET { - if err := p.ReadField11(iprot); err != nil { + if err := p.ReadField11(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 12: if fieldTypeId == thrift.I32 { - if err := p.ReadField12(iprot); err != nil { + if err := p.ReadField12(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 13: if fieldTypeId == thrift.I32 { - if err := p.ReadField13(iprot); err != nil { + if err := p.ReadField13(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *TaskQuery) ReadField14(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskQuery) ReadField14(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 14: ", err) } else { p.Role = &v @@ -8996,8 +9711,8 @@ func (p *TaskQuery) ReadField14(iprot thrift.TProtocol) error { return nil } -func (p *TaskQuery) ReadField9(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskQuery) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 9: ", err) } else { p.Environment = &v @@ -9005,8 +9720,8 @@ func (p *TaskQuery) ReadField9(iprot thrift.TProtocol) error { return nil } -func (p *TaskQuery) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskQuery) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.JobName = &v @@ -9014,117 +9729,117 @@ func (p *TaskQuery) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *TaskQuery) ReadField4(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskQuery) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]string, 0, size) p.TaskIds = tSet for i := 0; i < size; i ++ { -var _elem19 string - if v, err := iprot.ReadString(); err != nil { +var _elem36 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem19 = v + _elem36 = v } - p.TaskIds = append(p.TaskIds, _elem19) + p.TaskIds = append(p.TaskIds, _elem36) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskQuery) ReadField5(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskQuery) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]ScheduleStatus, 0, size) p.Statuses = tSet for i := 0; i < size; i ++ { -var _elem20 ScheduleStatus - if v, err := iprot.ReadI32(); err != nil { +var _elem37 ScheduleStatus + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { temp := ScheduleStatus(v) - _elem20 = temp + _elem37 = temp } - p.Statuses = append(p.Statuses, _elem20) + p.Statuses = append(p.Statuses, _elem37) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskQuery) ReadField7(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskQuery) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]int32, 0, size) p.InstanceIds = tSet for i := 0; i < size; i ++ { -var _elem21 int32 - if v, err := iprot.ReadI32(); err != nil { +var _elem38 int32 + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem21 = v + _elem38 = v } - p.InstanceIds = append(p.InstanceIds, _elem21) + p.InstanceIds = append(p.InstanceIds, _elem38) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskQuery) ReadField10(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskQuery) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]string, 0, size) p.SlaveHosts = tSet for i := 0; i < size; i ++ { -var _elem22 string - if v, err := iprot.ReadString(); err != nil { +var _elem39 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem22 = v + _elem39 = v } - p.SlaveHosts = append(p.SlaveHosts, _elem22) + p.SlaveHosts = append(p.SlaveHosts, _elem39) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskQuery) ReadField11(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskQuery) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*JobKey, 0, size) p.JobKeys = tSet for i := 0; i < size; i ++ { - _elem23 := &JobKey{} - if err := _elem23.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem23), err) + _elem40 := &JobKey{} + if err := _elem40.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem40), err) } - p.JobKeys = append(p.JobKeys, _elem23) + p.JobKeys = append(p.JobKeys, _elem40) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskQuery) ReadField12(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *TaskQuery) ReadField12(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 12: ", err) } else { p.Offset = &v @@ -9132,8 +9847,8 @@ func (p *TaskQuery) ReadField12(iprot thrift.TProtocol) error { return nil } -func (p *TaskQuery) ReadField13(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *TaskQuery) ReadField13(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 13: ", err) } else { p.Limit = &v @@ -9141,224 +9856,303 @@ func (p *TaskQuery) ReadField13(iprot thrift.TProtocol) error { return nil } -func (p *TaskQuery) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("TaskQuery"); err != nil { +func (p *TaskQuery) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TaskQuery"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField9(oprot); err != nil { return err } - if err := p.writeField10(oprot); err != nil { return err } - if err := p.writeField11(oprot); err != nil { return err } - if err := p.writeField12(oprot); err != nil { return err } - if err := p.writeField13(oprot); err != nil { return err } - if err := p.writeField14(oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } + if err := p.writeField10(ctx, oprot); err != nil { return err } + if err := p.writeField11(ctx, oprot); err != nil { return err } + if err := p.writeField12(ctx, oprot); err != nil { return err } + if err := p.writeField13(ctx, oprot); err != nil { return err } + if err := p.writeField14(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TaskQuery) writeField2(oprot thrift.TProtocol) (err error) { +func (p *TaskQuery) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetJobName() { - if err := oprot.WriteFieldBegin("jobName", thrift.STRING, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "jobName", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:jobName: ", p), err) } - if err := oprot.WriteString(string(*p.JobName)); err != nil { + if err := oprot.WriteString(ctx, string(*p.JobName)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.jobName (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:jobName: ", p), err) } } return err } -func (p *TaskQuery) writeField4(oprot thrift.TProtocol) (err error) { +func (p *TaskQuery) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetTaskIds() { - if err := oprot.WriteFieldBegin("taskIds", thrift.SET, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "taskIds", thrift.SET, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:taskIds: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRING, len(p.TaskIds)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRING, len(p.TaskIds)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -9386,14 +10180,14 @@ func (p *HostStatus) GetHost() string { func (p *HostStatus) GetMode() MaintenanceMode { return p.Mode } -func (p *HostStatus) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *HostStatus) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -9401,41 +10195,41 @@ func (p *HostStatus) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *HostStatus) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *HostStatus) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Host = v @@ -9443,8 +10237,8 @@ func (p *HostStatus) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *HostStatus) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *HostStatus) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { temp := MaintenanceMode(v) @@ -9453,40 +10247,51 @@ func (p *HostStatus) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *HostStatus) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("HostStatus"); err != nil { +func (p *HostStatus) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "HostStatus"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *HostStatus) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("host", thrift.STRING, 1); err != nil { +func (p *HostStatus) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:host: ", p), err) } - if err := oprot.WriteString(string(p.Host)); err != nil { + if err := oprot.WriteString(ctx, string(p.Host)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.host (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:host: ", p), err) } return err } -func (p *HostStatus) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("mode", thrift.I32, 2); err != nil { +func (p *HostStatus) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "mode", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:mode: ", p), err) } - if err := oprot.WriteI32(int32(p.Mode)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Mode)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.mode (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:mode: ", p), err) } return err } +func (p *HostStatus) Equals(other *HostStatus) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Host != other.Host { return false } + if p.Mode != other.Mode { return false } + return true +} + func (p *HostStatus) String() string { if p == nil { return "" @@ -9520,14 +10325,14 @@ func (p *RoleSummary) GetJobCount() int32 { func (p *RoleSummary) GetCronJobCount() int32 { return p.CronJobCount } -func (p *RoleSummary) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *RoleSummary) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -9535,51 +10340,51 @@ func (p *RoleSummary) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *RoleSummary) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *RoleSummary) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Role = v @@ -9587,8 +10392,8 @@ func (p *RoleSummary) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *RoleSummary) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *RoleSummary) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.JobCount = v @@ -9596,8 +10401,8 @@ func (p *RoleSummary) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *RoleSummary) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *RoleSummary) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.CronJobCount = v @@ -9605,51 +10410,63 @@ func (p *RoleSummary) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *RoleSummary) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("RoleSummary"); err != nil { +func (p *RoleSummary) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "RoleSummary"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *RoleSummary) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("role", thrift.STRING, 1); err != nil { +func (p *RoleSummary) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "role", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:role: ", p), err) } - if err := oprot.WriteString(string(p.Role)); err != nil { + if err := oprot.WriteString(ctx, string(p.Role)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.role (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:role: ", p), err) } return err } -func (p *RoleSummary) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("jobCount", thrift.I32, 2); err != nil { +func (p *RoleSummary) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "jobCount", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:jobCount: ", p), err) } - if err := oprot.WriteI32(int32(p.JobCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.JobCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.jobCount (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:jobCount: ", p), err) } return err } -func (p *RoleSummary) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("cronJobCount", thrift.I32, 3); err != nil { +func (p *RoleSummary) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "cronJobCount", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:cronJobCount: ", p), err) } - if err := oprot.WriteI32(int32(p.CronJobCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.CronJobCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.cronJobCount (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:cronJobCount: ", p), err) } return err } +func (p *RoleSummary) Equals(other *RoleSummary) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Role != other.Role { return false } + if p.JobCount != other.JobCount { return false } + if p.CronJobCount != other.CronJobCount { return false } + return true +} + func (p *RoleSummary) String() string { if p == nil { return "" @@ -9671,14 +10488,14 @@ func NewHosts() *Hosts { func (p *Hosts) GetHostNames() []string { return p.HostNames } -func (p *Hosts) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Hosts) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -9686,89 +10503,106 @@ func (p *Hosts) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Hosts) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *Hosts) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]string, 0, size) p.HostNames = tSet for i := 0; i < size; i ++ { -var _elem24 string - if v, err := iprot.ReadString(); err != nil { +var _elem46 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem24 = v + _elem46 = v } - p.HostNames = append(p.HostNames, _elem24) + p.HostNames = append(p.HostNames, _elem46) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *Hosts) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Hosts"); err != nil { +func (p *Hosts) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Hosts"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Hosts) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hostNames", thrift.SET, 1); err != nil { +func (p *Hosts) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hostNames", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hostNames: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRING, len(p.HostNames)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRING, len(p.HostNames)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -9796,14 +10630,14 @@ func (p *PendingReason) GetTaskId() string { func (p *PendingReason) GetReason() string { return p.Reason } -func (p *PendingReason) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *PendingReason) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -9811,41 +10645,41 @@ func (p *PendingReason) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *PendingReason) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *PendingReason) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.TaskId = v @@ -9853,8 +10687,8 @@ func (p *PendingReason) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *PendingReason) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *PendingReason) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Reason = v @@ -9862,40 +10696,51 @@ func (p *PendingReason) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *PendingReason) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("PendingReason"); err != nil { +func (p *PendingReason) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "PendingReason"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *PendingReason) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskId", thrift.STRING, 1); err != nil { +func (p *PendingReason) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskId", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:taskId: ", p), err) } - if err := oprot.WriteString(string(p.TaskId)); err != nil { + if err := oprot.WriteString(ctx, string(p.TaskId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.taskId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:taskId: ", p), err) } return err } -func (p *PendingReason) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("reason", thrift.STRING, 2); err != nil { +func (p *PendingReason) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "reason", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:reason: ", p), err) } - if err := oprot.WriteString(string(p.Reason)); err != nil { + if err := oprot.WriteString(ctx, string(p.Reason)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.reason (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:reason: ", p), err) } return err } +func (p *PendingReason) Equals(other *PendingReason) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.TaskId != other.TaskId { return false } + if p.Reason != other.Reason { return false } + return true +} + func (p *PendingReason) String() string { if p == nil { return "" @@ -9932,14 +10777,14 @@ func (p *JobUpdateKey) IsSetJob() bool { return p.Job != nil } -func (p *JobUpdateKey) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateKey) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -9947,49 +10792,49 @@ func (p *JobUpdateKey) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateKey) ReadField1(iprot thrift.TProtocol) error { +func (p *JobUpdateKey) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *JobUpdateKey) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobUpdateKey) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.ID = v @@ -9997,41 +10842,52 @@ func (p *JobUpdateKey) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateKey) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateKey"); err != nil { +func (p *JobUpdateKey) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateKey"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateKey) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 1); err != nil { +func (p *JobUpdateKey) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "job", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:job: ", p), err) } - if err := p.Job.Write(oprot); err != nil { + if err := p.Job.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:job: ", p), err) } return err } -func (p *JobUpdateKey) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("id", thrift.STRING, 2); err != nil { +func (p *JobUpdateKey) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "id", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:id: ", p), err) } - if err := oprot.WriteString(string(p.ID)); err != nil { + if err := oprot.WriteString(ctx, string(p.ID)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.id (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:id: ", p), err) } return err } +func (p *JobUpdateKey) Equals(other *JobUpdateKey) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Job.Equals(other.Job) { return false } + if p.ID != other.ID { return false } + return true +} + func (p *JobUpdateKey) String() string { if p == nil { return "" @@ -10039,16 +10895,648 @@ func (p *JobUpdateKey) String() string { return fmt.Sprintf("JobUpdateKey(%+v)", *p) } +// Limits the amount of active changes being made to instances to groupSize. +// +// Attributes: +// - GroupSize +type QueueJobUpdateStrategy struct { + GroupSize int32 `thrift:"groupSize,1" db:"groupSize" json:"groupSize"` +} + +func NewQueueJobUpdateStrategy() *QueueJobUpdateStrategy { + return &QueueJobUpdateStrategy{} +} + + +func (p *QueueJobUpdateStrategy) GetGroupSize() int32 { + return p.GroupSize +} +func (p *QueueJobUpdateStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.I32 { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *QueueJobUpdateStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.GroupSize = v +} + return nil +} + +func (p *QueueJobUpdateStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "QueueJobUpdateStrategy"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *QueueJobUpdateStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "groupSize", thrift.I32, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:groupSize: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.GroupSize)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.groupSize (1) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:groupSize: ", p), err) } + return err +} + +func (p *QueueJobUpdateStrategy) Equals(other *QueueJobUpdateStrategy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.GroupSize != other.GroupSize { return false } + return true +} + +func (p *QueueJobUpdateStrategy) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("QueueJobUpdateStrategy(%+v)", *p) +} + +// Similar to Queue strategy but will not start a new group until all instances in an active +// group have finished updating. +// +// Attributes: +// - GroupSize +// - AutopauseAfterBatch +type BatchJobUpdateStrategy struct { + GroupSize int32 `thrift:"groupSize,1" db:"groupSize" json:"groupSize"` + AutopauseAfterBatch bool `thrift:"autopauseAfterBatch,2" db:"autopauseAfterBatch" json:"autopauseAfterBatch"` +} + +func NewBatchJobUpdateStrategy() *BatchJobUpdateStrategy { + return &BatchJobUpdateStrategy{} +} + + +func (p *BatchJobUpdateStrategy) GetGroupSize() int32 { + return p.GroupSize +} + +func (p *BatchJobUpdateStrategy) GetAutopauseAfterBatch() bool { + return p.AutopauseAfterBatch +} +func (p *BatchJobUpdateStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.I32 { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *BatchJobUpdateStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.GroupSize = v +} + return nil +} + +func (p *BatchJobUpdateStrategy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.AutopauseAfterBatch = v +} + return nil +} + +func (p *BatchJobUpdateStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "BatchJobUpdateStrategy"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *BatchJobUpdateStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "groupSize", thrift.I32, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:groupSize: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.GroupSize)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.groupSize (1) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:groupSize: ", p), err) } + return err +} + +func (p *BatchJobUpdateStrategy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "autopauseAfterBatch", thrift.BOOL, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:autopauseAfterBatch: ", p), err) } + if err := oprot.WriteBool(ctx, bool(p.AutopauseAfterBatch)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.autopauseAfterBatch (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:autopauseAfterBatch: ", p), err) } + return err +} + +func (p *BatchJobUpdateStrategy) Equals(other *BatchJobUpdateStrategy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.GroupSize != other.GroupSize { return false } + if p.AutopauseAfterBatch != other.AutopauseAfterBatch { return false } + return true +} + +func (p *BatchJobUpdateStrategy) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("BatchJobUpdateStrategy(%+v)", *p) +} + +// Same as Batch strategy but each time an active group completes, the size of the next active +// group may change. +// +// Attributes: +// - GroupSizes +// - AutopauseAfterBatch +type VariableBatchJobUpdateStrategy struct { + GroupSizes []int32 `thrift:"groupSizes,1" db:"groupSizes" json:"groupSizes"` + AutopauseAfterBatch bool `thrift:"autopauseAfterBatch,2" db:"autopauseAfterBatch" json:"autopauseAfterBatch"` +} + +func NewVariableBatchJobUpdateStrategy() *VariableBatchJobUpdateStrategy { + return &VariableBatchJobUpdateStrategy{} +} + + +func (p *VariableBatchJobUpdateStrategy) GetGroupSizes() []int32 { + return p.GroupSizes +} + +func (p *VariableBatchJobUpdateStrategy) GetAutopauseAfterBatch() bool { + return p.AutopauseAfterBatch +} +func (p *VariableBatchJobUpdateStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.LIST { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *VariableBatchJobUpdateStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int32, 0, size) + p.GroupSizes = tSlice + for i := 0; i < size; i ++ { +var _elem48 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem48 = v +} + p.GroupSizes = append(p.GroupSizes, _elem48) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *VariableBatchJobUpdateStrategy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.AutopauseAfterBatch = v +} + return nil +} + +func (p *VariableBatchJobUpdateStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "VariableBatchJobUpdateStrategy"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *VariableBatchJobUpdateStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "groupSizes", thrift.LIST, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:groupSizes: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.GroupSizes)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.GroupSizes { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:groupSizes: ", p), err) } + return err +} + +func (p *VariableBatchJobUpdateStrategy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "autopauseAfterBatch", thrift.BOOL, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:autopauseAfterBatch: ", p), err) } + if err := oprot.WriteBool(ctx, bool(p.AutopauseAfterBatch)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.autopauseAfterBatch (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:autopauseAfterBatch: ", p), err) } + return err +} + +func (p *VariableBatchJobUpdateStrategy) Equals(other *VariableBatchJobUpdateStrategy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if len(p.GroupSizes) != len(other.GroupSizes) { return false } + for i, _tgt := range p.GroupSizes { + _src49 := other.GroupSizes[i] + if _tgt != _src49 { return false } + } + if p.AutopauseAfterBatch != other.AutopauseAfterBatch { return false } + return true +} + +func (p *VariableBatchJobUpdateStrategy) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("VariableBatchJobUpdateStrategy(%+v)", *p) +} + +// Attributes: +// - QueueStrategy +// - BatchStrategy +// - VarBatchStrategy +type JobUpdateStrategy struct { + QueueStrategy *QueueJobUpdateStrategy `thrift:"queueStrategy,1" db:"queueStrategy" json:"queueStrategy,omitempty"` + BatchStrategy *BatchJobUpdateStrategy `thrift:"batchStrategy,2" db:"batchStrategy" json:"batchStrategy,omitempty"` + VarBatchStrategy *VariableBatchJobUpdateStrategy `thrift:"varBatchStrategy,3" db:"varBatchStrategy" json:"varBatchStrategy,omitempty"` +} + +func NewJobUpdateStrategy() *JobUpdateStrategy { + return &JobUpdateStrategy{} +} + +var JobUpdateStrategy_QueueStrategy_DEFAULT *QueueJobUpdateStrategy +func (p *JobUpdateStrategy) GetQueueStrategy() *QueueJobUpdateStrategy { + if !p.IsSetQueueStrategy() { + return JobUpdateStrategy_QueueStrategy_DEFAULT + } +return p.QueueStrategy +} +var JobUpdateStrategy_BatchStrategy_DEFAULT *BatchJobUpdateStrategy +func (p *JobUpdateStrategy) GetBatchStrategy() *BatchJobUpdateStrategy { + if !p.IsSetBatchStrategy() { + return JobUpdateStrategy_BatchStrategy_DEFAULT + } +return p.BatchStrategy +} +var JobUpdateStrategy_VarBatchStrategy_DEFAULT *VariableBatchJobUpdateStrategy +func (p *JobUpdateStrategy) GetVarBatchStrategy() *VariableBatchJobUpdateStrategy { + if !p.IsSetVarBatchStrategy() { + return JobUpdateStrategy_VarBatchStrategy_DEFAULT + } +return p.VarBatchStrategy +} +func (p *JobUpdateStrategy) CountSetFieldsJobUpdateStrategy() int { + count := 0 + if (p.IsSetQueueStrategy()) { + count++ + } + if (p.IsSetBatchStrategy()) { + count++ + } + if (p.IsSetVarBatchStrategy()) { + count++ + } + return count + +} + +func (p *JobUpdateStrategy) IsSetQueueStrategy() bool { + return p.QueueStrategy != nil +} + +func (p *JobUpdateStrategy) IsSetBatchStrategy() bool { + return p.BatchStrategy != nil +} + +func (p *JobUpdateStrategy) IsSetVarBatchStrategy() bool { + return p.VarBatchStrategy != nil +} + +func (p *JobUpdateStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 3: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *JobUpdateStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.QueueStrategy = &QueueJobUpdateStrategy{} + if err := p.QueueStrategy.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.QueueStrategy), err) + } + return nil +} + +func (p *JobUpdateStrategy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + p.BatchStrategy = &BatchJobUpdateStrategy{} + if err := p.BatchStrategy.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.BatchStrategy), err) + } + return nil +} + +func (p *JobUpdateStrategy) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + p.VarBatchStrategy = &VariableBatchJobUpdateStrategy{} + if err := p.VarBatchStrategy.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.VarBatchStrategy), err) + } + return nil +} + +func (p *JobUpdateStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if c := p.CountSetFieldsJobUpdateStrategy(); c != 1 { + return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) + } + if err := oprot.WriteStructBegin(ctx, "JobUpdateStrategy"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *JobUpdateStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetQueueStrategy() { + if err := oprot.WriteFieldBegin(ctx, "queueStrategy", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:queueStrategy: ", p), err) } + if err := p.QueueStrategy.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.QueueStrategy), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:queueStrategy: ", p), err) } + } + return err +} + +func (p *JobUpdateStrategy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetBatchStrategy() { + if err := oprot.WriteFieldBegin(ctx, "batchStrategy", thrift.STRUCT, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:batchStrategy: ", p), err) } + if err := p.BatchStrategy.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.BatchStrategy), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:batchStrategy: ", p), err) } + } + return err +} + +func (p *JobUpdateStrategy) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetVarBatchStrategy() { + if err := oprot.WriteFieldBegin(ctx, "varBatchStrategy", thrift.STRUCT, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:varBatchStrategy: ", p), err) } + if err := p.VarBatchStrategy.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.VarBatchStrategy), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:varBatchStrategy: ", p), err) } + } + return err +} + +func (p *JobUpdateStrategy) Equals(other *JobUpdateStrategy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.QueueStrategy.Equals(other.QueueStrategy) { return false } + if !p.BatchStrategy.Equals(other.BatchStrategy) { return false } + if !p.VarBatchStrategy.Equals(other.VarBatchStrategy) { return false } + return true +} + +func (p *JobUpdateStrategy) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobUpdateStrategy(%+v)", *p) +} + // Job update thresholds and limits. // // Attributes: -// - UpdateGroupSize: Max number of instances being updated at any given moment. +// - UpdateGroupSize: Deprecated, please set value inside of desired update strategy instead. +// Max number of instances being updated at any given moment. // - MaxPerInstanceFailures: Max number of instance failures to tolerate before marking instance as FAILED. // - MaxFailedInstances: Max number of FAILED instances to tolerate before terminating the update. // - MinWaitInInstanceRunningMs: Min time to watch a RUNNING instance. // - RollbackOnFailure: If true, enables failed update rollback. // - UpdateOnlyTheseInstances: Instance IDs to act on. All instances will be affected if this is not set. -// - WaitForBatchCompletion: If true, use updateGroupSize as strict batching boundaries, and avoid proceeding to another +// - WaitForBatchCompletion: Deprecated, please set updateStrategy to the Batch strategy instead. +// If true, use updateGroupSize as strict batching boundaries, and avoid proceeding to another // batch until the preceding batch finishes updating. // - BlockIfNoPulsesAfterMs: If set, requires external calls to pulseJobUpdate RPC within the specified rate for the // update to make progress. If no pulses received within specified interval the update will @@ -10056,6 +11544,7 @@ func (p *JobUpdateKey) String() string { // unblocked by a fresh pulseJobUpdate call. // - SlaAware: If true, updates will obey the SLA requirements of the tasks being updated. If the SLA policy // differs between the old and new task configurations, updates will use the newest configuration. +// - UpdateStrategy: Update strategy to be used for the update. See JobUpdateStrategy for choices. type JobUpdateSettings struct { UpdateGroupSize int32 `thrift:"updateGroupSize,1" db:"updateGroupSize" json:"updateGroupSize"` MaxPerInstanceFailures int32 `thrift:"maxPerInstanceFailures,2" db:"maxPerInstanceFailures" json:"maxPerInstanceFailures"` @@ -10067,6 +11556,7 @@ type JobUpdateSettings struct { WaitForBatchCompletion bool `thrift:"waitForBatchCompletion,8" db:"waitForBatchCompletion" json:"waitForBatchCompletion"` BlockIfNoPulsesAfterMs *int32 `thrift:"blockIfNoPulsesAfterMs,9" db:"blockIfNoPulsesAfterMs" json:"blockIfNoPulsesAfterMs,omitempty"` SlaAware *bool `thrift:"slaAware,10" db:"slaAware" json:"slaAware,omitempty"` + UpdateStrategy *JobUpdateStrategy `thrift:"updateStrategy,11" db:"updateStrategy" json:"updateStrategy,omitempty"` } func NewJobUpdateSettings() *JobUpdateSettings { @@ -10115,6 +11605,13 @@ func (p *JobUpdateSettings) GetSlaAware() bool { } return *p.SlaAware } +var JobUpdateSettings_UpdateStrategy_DEFAULT *JobUpdateStrategy +func (p *JobUpdateSettings) GetUpdateStrategy() *JobUpdateStrategy { + if !p.IsSetUpdateStrategy() { + return JobUpdateSettings_UpdateStrategy_DEFAULT + } +return p.UpdateStrategy +} func (p *JobUpdateSettings) IsSetBlockIfNoPulsesAfterMs() bool { return p.BlockIfNoPulsesAfterMs != nil } @@ -10123,14 +11620,18 @@ func (p *JobUpdateSettings) IsSetSlaAware() bool { return p.SlaAware != nil } -func (p *JobUpdateSettings) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateSettings) IsSetUpdateStrategy() bool { + return p.UpdateStrategy != nil +} + +func (p *JobUpdateSettings) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -10138,111 +11639,121 @@ func (p *JobUpdateSettings) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.I32 { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.BOOL { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.SET { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 8: if fieldTypeId == thrift.BOOL { - if err := p.ReadField8(iprot); err != nil { + if err := p.ReadField8(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 9: if fieldTypeId == thrift.I32 { - if err := p.ReadField9(iprot); err != nil { + if err := p.ReadField9(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 10: if fieldTypeId == thrift.BOOL { - if err := p.ReadField10(iprot); err != nil { + if err := p.ReadField10(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 11: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField11(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateSettings) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateSettings) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.UpdateGroupSize = v @@ -10250,8 +11761,8 @@ func (p *JobUpdateSettings) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateSettings) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.MaxPerInstanceFailures = v @@ -10259,8 +11770,8 @@ func (p *JobUpdateSettings) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateSettings) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.MaxFailedInstances = v @@ -10268,8 +11779,8 @@ func (p *JobUpdateSettings) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateSettings) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { p.MinWaitInInstanceRunningMs = v @@ -10277,8 +11788,8 @@ func (p *JobUpdateSettings) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *JobUpdateSettings) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 6: ", err) } else { p.RollbackOnFailure = v @@ -10286,28 +11797,28 @@ func (p *JobUpdateSettings) ReadField6(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField7(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *JobUpdateSettings) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Range, 0, size) p.UpdateOnlyTheseInstances = tSet for i := 0; i < size; i ++ { - _elem25 := &Range{} - if err := _elem25.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem25), err) + _elem50 := &Range{} + if err := _elem50.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem50), err) } - p.UpdateOnlyTheseInstances = append(p.UpdateOnlyTheseInstances, _elem25) + p.UpdateOnlyTheseInstances = append(p.UpdateOnlyTheseInstances, _elem50) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *JobUpdateSettings) ReadField8(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *JobUpdateSettings) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 8: ", err) } else { p.WaitForBatchCompletion = v @@ -10315,8 +11826,8 @@ func (p *JobUpdateSettings) ReadField8(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField9(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateSettings) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 9: ", err) } else { p.BlockIfNoPulsesAfterMs = &v @@ -10324,8 +11835,8 @@ func (p *JobUpdateSettings) ReadField9(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField10(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *JobUpdateSettings) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 10: ", err) } else { p.SlaAware = &v @@ -10333,137 +11844,195 @@ func (p *JobUpdateSettings) ReadField10(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateSettings"); err != nil { +func (p *JobUpdateSettings) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { + p.UpdateStrategy = &JobUpdateStrategy{} + if err := p.UpdateStrategy.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.UpdateStrategy), err) + } + return nil +} + +func (p *JobUpdateSettings) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateSettings"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField8(oprot); err != nil { return err } - if err := p.writeField9(oprot); err != nil { return err } - if err := p.writeField10(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } + if err := p.writeField10(ctx, oprot); err != nil { return err } + if err := p.writeField11(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateSettings) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("updateGroupSize", thrift.I32, 1); err != nil { +func (p *JobUpdateSettings) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "updateGroupSize", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:updateGroupSize: ", p), err) } - if err := oprot.WriteI32(int32(p.UpdateGroupSize)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.UpdateGroupSize)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.updateGroupSize (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:updateGroupSize: ", p), err) } return err } -func (p *JobUpdateSettings) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("maxPerInstanceFailures", thrift.I32, 2); err != nil { +func (p *JobUpdateSettings) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "maxPerInstanceFailures", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:maxPerInstanceFailures: ", p), err) } - if err := oprot.WriteI32(int32(p.MaxPerInstanceFailures)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.MaxPerInstanceFailures)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.maxPerInstanceFailures (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:maxPerInstanceFailures: ", p), err) } return err } -func (p *JobUpdateSettings) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("maxFailedInstances", thrift.I32, 3); err != nil { +func (p *JobUpdateSettings) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "maxFailedInstances", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:maxFailedInstances: ", p), err) } - if err := oprot.WriteI32(int32(p.MaxFailedInstances)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.MaxFailedInstances)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.maxFailedInstances (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:maxFailedInstances: ", p), err) } return err } -func (p *JobUpdateSettings) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("minWaitInInstanceRunningMs", thrift.I32, 5); err != nil { +func (p *JobUpdateSettings) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "minWaitInInstanceRunningMs", thrift.I32, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:minWaitInInstanceRunningMs: ", p), err) } - if err := oprot.WriteI32(int32(p.MinWaitInInstanceRunningMs)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.MinWaitInInstanceRunningMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.minWaitInInstanceRunningMs (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:minWaitInInstanceRunningMs: ", p), err) } return err } -func (p *JobUpdateSettings) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("rollbackOnFailure", thrift.BOOL, 6); err != nil { +func (p *JobUpdateSettings) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "rollbackOnFailure", thrift.BOOL, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:rollbackOnFailure: ", p), err) } - if err := oprot.WriteBool(bool(p.RollbackOnFailure)); err != nil { + if err := oprot.WriteBool(ctx, bool(p.RollbackOnFailure)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.rollbackOnFailure (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:rollbackOnFailure: ", p), err) } return err } -func (p *JobUpdateSettings) writeField7(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("updateOnlyTheseInstances", thrift.SET, 7); err != nil { +func (p *JobUpdateSettings) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "updateOnlyTheseInstances", thrift.SET, 7); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:updateOnlyTheseInstances: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.UpdateOnlyTheseInstances)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.UpdateOnlyTheseInstances)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -10520,14 +12089,14 @@ func (p *JobUpdateEvent) IsSetMessage() bool { return p.Message != nil } -func (p *JobUpdateEvent) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateEvent) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -10535,61 +12104,61 @@ func (p *JobUpdateEvent) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateEvent) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateEvent) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { temp := JobUpdateStatus(v) @@ -10598,8 +12167,8 @@ func (p *JobUpdateEvent) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateEvent) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *JobUpdateEvent) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.TimestampMs = v @@ -10607,8 +12176,8 @@ func (p *JobUpdateEvent) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateEvent) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobUpdateEvent) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.User = &v @@ -10616,8 +12185,8 @@ func (p *JobUpdateEvent) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateEvent) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobUpdateEvent) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.Message = &v @@ -10625,66 +12194,89 @@ func (p *JobUpdateEvent) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateEvent) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateEvent"); err != nil { +func (p *JobUpdateEvent) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateEvent"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateEvent) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.I32, 1); err != nil { +func (p *JobUpdateEvent) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := oprot.WriteI32(int32(p.Status)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Status)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.status (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } return err } -func (p *JobUpdateEvent) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timestampMs", thrift.I64, 2); err != nil { +func (p *JobUpdateEvent) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestampMs", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:timestampMs: ", p), err) } - if err := oprot.WriteI64(int64(p.TimestampMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TimestampMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timestampMs (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:timestampMs: ", p), err) } return err } -func (p *JobUpdateEvent) writeField3(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateEvent) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetUser() { - if err := oprot.WriteFieldBegin("user", thrift.STRING, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "user", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:user: ", p), err) } - if err := oprot.WriteString(string(*p.User)); err != nil { + if err := oprot.WriteString(ctx, string(*p.User)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.user (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:user: ", p), err) } } return err } -func (p *JobUpdateEvent) writeField4(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateEvent) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMessage() { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "message", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:message: ", p), err) } - if err := oprot.WriteString(string(*p.Message)); err != nil { + if err := oprot.WriteString(ctx, string(*p.Message)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.message (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:message: ", p), err) } } return err } +func (p *JobUpdateEvent) Equals(other *JobUpdateEvent) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Status != other.Status { return false } + if p.TimestampMs != other.TimestampMs { return false } + if p.User != other.User { + if p.User == nil || other.User == nil { + return false + } + if (*p.User) != (*other.User) { return false } + } + if p.Message != other.Message { + if p.Message == nil || other.Message == nil { + return false + } + if (*p.Message) != (*other.Message) { return false } + } + return true +} + func (p *JobUpdateEvent) String() string { if p == nil { return "" @@ -10733,14 +12325,14 @@ func (p *JobInstanceUpdateEvent) IsSetMessage() bool { return p.Message != nil } -func (p *JobInstanceUpdateEvent) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobInstanceUpdateEvent) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -10748,61 +12340,61 @@ func (p *JobInstanceUpdateEvent) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobInstanceUpdateEvent) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobInstanceUpdateEvent) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.InstanceId = v @@ -10810,8 +12402,8 @@ func (p *JobInstanceUpdateEvent) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *JobInstanceUpdateEvent) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *JobInstanceUpdateEvent) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.TimestampMs = v @@ -10819,8 +12411,8 @@ func (p *JobInstanceUpdateEvent) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobInstanceUpdateEvent) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobInstanceUpdateEvent) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { temp := JobUpdateAction(v) @@ -10829,8 +12421,8 @@ func (p *JobInstanceUpdateEvent) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobInstanceUpdateEvent) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobInstanceUpdateEvent) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.Message = &v @@ -10838,64 +12430,82 @@ func (p *JobInstanceUpdateEvent) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *JobInstanceUpdateEvent) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobInstanceUpdateEvent"); err != nil { +func (p *JobInstanceUpdateEvent) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobInstanceUpdateEvent"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobInstanceUpdateEvent) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instanceId", thrift.I32, 1); err != nil { +func (p *JobInstanceUpdateEvent) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instanceId", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:instanceId: ", p), err) } - if err := oprot.WriteI32(int32(p.InstanceId)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.InstanceId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.instanceId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:instanceId: ", p), err) } return err } -func (p *JobInstanceUpdateEvent) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timestampMs", thrift.I64, 2); err != nil { +func (p *JobInstanceUpdateEvent) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestampMs", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:timestampMs: ", p), err) } - if err := oprot.WriteI64(int64(p.TimestampMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TimestampMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timestampMs (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:timestampMs: ", p), err) } return err } -func (p *JobInstanceUpdateEvent) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("action", thrift.I32, 3); err != nil { +func (p *JobInstanceUpdateEvent) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "action", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:action: ", p), err) } - if err := oprot.WriteI32(int32(p.Action)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Action)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.action (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:action: ", p), err) } return err } -func (p *JobInstanceUpdateEvent) writeField4(oprot thrift.TProtocol) (err error) { +func (p *JobInstanceUpdateEvent) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMessage() { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "message", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:message: ", p), err) } - if err := oprot.WriteString(string(*p.Message)); err != nil { + if err := oprot.WriteString(ctx, string(*p.Message)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.message (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:message: ", p), err) } } return err } +func (p *JobInstanceUpdateEvent) Equals(other *JobInstanceUpdateEvent) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.InstanceId != other.InstanceId { return false } + if p.TimestampMs != other.TimestampMs { return false } + if p.Action != other.Action { return false } + if p.Message != other.Message { + if p.Message == nil || other.Message == nil { + return false + } + if (*p.Message) != (*other.Message) { return false } + } + return true +} + func (p *JobInstanceUpdateEvent) String() string { if p == nil { return "" @@ -10932,14 +12542,14 @@ func (p *InstanceTaskConfig) IsSetTask() bool { return p.Task != nil } -func (p *InstanceTaskConfig) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *InstanceTaskConfig) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -10947,118 +12557,136 @@ func (p *InstanceTaskConfig) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *InstanceTaskConfig) ReadField1(iprot thrift.TProtocol) error { +func (p *InstanceTaskConfig) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Task = &TaskConfig{} - if err := p.Task.Read(iprot); err != nil { + if err := p.Task.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Task), err) } return nil } -func (p *InstanceTaskConfig) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *InstanceTaskConfig) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Range, 0, size) p.Instances = tSet for i := 0; i < size; i ++ { - _elem26 := &Range{} - if err := _elem26.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem26), err) + _elem52 := &Range{} + if err := _elem52.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem52), err) } - p.Instances = append(p.Instances, _elem26) + p.Instances = append(p.Instances, _elem52) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *InstanceTaskConfig) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("InstanceTaskConfig"); err != nil { +func (p *InstanceTaskConfig) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "InstanceTaskConfig"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *InstanceTaskConfig) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("task", thrift.STRUCT, 1); err != nil { +func (p *InstanceTaskConfig) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "task", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:task: ", p), err) } - if err := p.Task.Write(oprot); err != nil { + if err := p.Task.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Task), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:task: ", p), err) } return err } -func (p *InstanceTaskConfig) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instances", thrift.SET, 2); err != nil { +func (p *InstanceTaskConfig) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instances", thrift.SET, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:instances: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Instances)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Instances)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -11094,14 +12722,14 @@ func (p *JobUpdateState) GetCreatedTimestampMs() int64 { func (p *JobUpdateState) GetLastModifiedTimestampMs() int64 { return p.LastModifiedTimestampMs } -func (p *JobUpdateState) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateState) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -11109,51 +12737,51 @@ func (p *JobUpdateState) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateState) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateState) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { temp := JobUpdateStatus(v) @@ -11162,8 +12790,8 @@ func (p *JobUpdateState) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateState) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *JobUpdateState) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.CreatedTimestampMs = v @@ -11171,8 +12799,8 @@ func (p *JobUpdateState) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateState) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *JobUpdateState) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.LastModifiedTimestampMs = v @@ -11180,51 +12808,63 @@ func (p *JobUpdateState) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateState) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateState"); err != nil { +func (p *JobUpdateState) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateState"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateState) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.I32, 1); err != nil { +func (p *JobUpdateState) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := oprot.WriteI32(int32(p.Status)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Status)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.status (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } return err } -func (p *JobUpdateState) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("createdTimestampMs", thrift.I64, 2); err != nil { +func (p *JobUpdateState) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "createdTimestampMs", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:createdTimestampMs: ", p), err) } - if err := oprot.WriteI64(int64(p.CreatedTimestampMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.CreatedTimestampMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.createdTimestampMs (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:createdTimestampMs: ", p), err) } return err } -func (p *JobUpdateState) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("lastModifiedTimestampMs", thrift.I64, 3); err != nil { +func (p *JobUpdateState) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "lastModifiedTimestampMs", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:lastModifiedTimestampMs: ", p), err) } - if err := oprot.WriteI64(int64(p.LastModifiedTimestampMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.LastModifiedTimestampMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.lastModifiedTimestampMs (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:lastModifiedTimestampMs: ", p), err) } return err } +func (p *JobUpdateState) Equals(other *JobUpdateState) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Status != other.Status { return false } + if p.CreatedTimestampMs != other.CreatedTimestampMs { return false } + if p.LastModifiedTimestampMs != other.LastModifiedTimestampMs { return false } + return true +} + func (p *JobUpdateState) String() string { if p == nil { return "" @@ -11286,14 +12926,14 @@ func (p *JobUpdateSummary) IsSetMetadata() bool { return p.Metadata != nil } -func (p *JobUpdateSummary) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateSummary) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -11301,69 +12941,69 @@ func (p *JobUpdateSummary) Read(iprot thrift.TProtocol) error { switch fieldId { case 5: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.SET { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateSummary) ReadField5(iprot thrift.TProtocol) error { +func (p *JobUpdateSummary) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { p.Key = &JobUpdateKey{} - if err := p.Key.Read(iprot); err != nil { + if err := p.Key.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) } return nil } -func (p *JobUpdateSummary) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobUpdateSummary) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.User = v @@ -11371,110 +13011,130 @@ func (p *JobUpdateSummary) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSummary) ReadField4(iprot thrift.TProtocol) error { +func (p *JobUpdateSummary) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.State = &JobUpdateState{} - if err := p.State.Read(iprot); err != nil { + if err := p.State.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.State), err) } return nil } -func (p *JobUpdateSummary) ReadField6(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *JobUpdateSummary) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Metadata, 0, size) p.Metadata = tSet for i := 0; i < size; i ++ { - _elem27 := &Metadata{} - if err := _elem27.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem27), err) + _elem54 := &Metadata{} + if err := _elem54.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem54), err) } - p.Metadata = append(p.Metadata, _elem27) + p.Metadata = append(p.Metadata, _elem54) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *JobUpdateSummary) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateSummary"); err != nil { +func (p *JobUpdateSummary) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateSummary"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateSummary) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("user", thrift.STRING, 3); err != nil { +func (p *JobUpdateSummary) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "user", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:user: ", p), err) } - if err := oprot.WriteString(string(p.User)); err != nil { + if err := oprot.WriteString(ctx, string(p.User)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.user (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:user: ", p), err) } return err } -func (p *JobUpdateSummary) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("state", thrift.STRUCT, 4); err != nil { +func (p *JobUpdateSummary) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "state", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:state: ", p), err) } - if err := p.State.Write(oprot); err != nil { + if err := p.State.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.State), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:state: ", p), err) } return err } -func (p *JobUpdateSummary) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRUCT, 5); err != nil { +func (p *JobUpdateSummary) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRUCT, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:key: ", p), err) } - if err := p.Key.Write(oprot); err != nil { + if err := p.Key.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:key: ", p), err) } return err } -func (p *JobUpdateSummary) writeField6(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateSummary) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMetadata() { - if err := oprot.WriteFieldBegin("metadata", thrift.SET, 6); err != nil { + if err := oprot.WriteFieldBegin(ctx, "metadata", thrift.SET, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:metadata: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Metadata)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Metadata)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -11524,14 +13184,14 @@ func (p *JobUpdateInstructions) IsSetSettings() bool { return p.Settings != nil } -func (p *JobUpdateInstructions) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateInstructions) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -11539,148 +13199,167 @@ func (p *JobUpdateInstructions) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateInstructions) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *JobUpdateInstructions) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*InstanceTaskConfig, 0, size) p.InitialState = tSet for i := 0; i < size; i ++ { - _elem28 := &InstanceTaskConfig{} - if err := _elem28.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem28), err) + _elem56 := &InstanceTaskConfig{} + if err := _elem56.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem56), err) } - p.InitialState = append(p.InitialState, _elem28) + p.InitialState = append(p.InitialState, _elem56) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *JobUpdateInstructions) ReadField2(iprot thrift.TProtocol) error { +func (p *JobUpdateInstructions) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.DesiredState = &InstanceTaskConfig{} - if err := p.DesiredState.Read(iprot); err != nil { + if err := p.DesiredState.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DesiredState), err) } return nil } -func (p *JobUpdateInstructions) ReadField3(iprot thrift.TProtocol) error { +func (p *JobUpdateInstructions) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.Settings = &JobUpdateSettings{} - if err := p.Settings.Read(iprot); err != nil { + if err := p.Settings.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Settings), err) } return nil } -func (p *JobUpdateInstructions) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateInstructions"); err != nil { +func (p *JobUpdateInstructions) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateInstructions"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateInstructions) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("initialState", thrift.SET, 1); err != nil { +func (p *JobUpdateInstructions) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "initialState", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:initialState: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.InitialState)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.InitialState)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -11724,14 +13403,14 @@ func (p *JobUpdate) IsSetInstructions() bool { return p.Instructions != nil } -func (p *JobUpdate) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdate) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -11739,91 +13418,102 @@ func (p *JobUpdate) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdate) ReadField1(iprot thrift.TProtocol) error { +func (p *JobUpdate) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Summary = &JobUpdateSummary{} - if err := p.Summary.Read(iprot); err != nil { + if err := p.Summary.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Summary), err) } return nil } -func (p *JobUpdate) ReadField2(iprot thrift.TProtocol) error { +func (p *JobUpdate) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Instructions = &JobUpdateInstructions{} - if err := p.Instructions.Read(iprot); err != nil { + if err := p.Instructions.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Instructions), err) } return nil } -func (p *JobUpdate) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdate"); err != nil { +func (p *JobUpdate) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdate"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdate) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("summary", thrift.STRUCT, 1); err != nil { +func (p *JobUpdate) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "summary", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:summary: ", p), err) } - if err := p.Summary.Write(oprot); err != nil { + if err := p.Summary.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Summary), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:summary: ", p), err) } return err } -func (p *JobUpdate) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instructions", thrift.STRUCT, 2); err != nil { +func (p *JobUpdate) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instructions", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:instructions: ", p), err) } - if err := p.Instructions.Write(oprot); err != nil { + if err := p.Instructions.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Instructions), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:instructions: ", p), err) } return err } +func (p *JobUpdate) Equals(other *JobUpdate) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Summary.Equals(other.Summary) { return false } + if !p.Instructions.Equals(other.Instructions) { return false } + return true +} + func (p *JobUpdate) String() string { if p == nil { return "" @@ -11864,14 +13554,14 @@ func (p *JobUpdateDetails) IsSetUpdate() bool { return p.Update != nil } -func (p *JobUpdateDetails) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateDetails) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -11879,161 +13569,181 @@ func (p *JobUpdateDetails) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.LIST { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.LIST { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateDetails) ReadField1(iprot thrift.TProtocol) error { +func (p *JobUpdateDetails) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Update = &JobUpdate{} - if err := p.Update.Read(iprot); err != nil { + if err := p.Update.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Update), err) } return nil } -func (p *JobUpdateDetails) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *JobUpdateDetails) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*JobUpdateEvent, 0, size) p.UpdateEvents = tSlice for i := 0; i < size; i ++ { - _elem29 := &JobUpdateEvent{} - if err := _elem29.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem29), err) + _elem58 := &JobUpdateEvent{} + if err := _elem58.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem58), err) } - p.UpdateEvents = append(p.UpdateEvents, _elem29) + p.UpdateEvents = append(p.UpdateEvents, _elem58) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *JobUpdateDetails) ReadField3(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *JobUpdateDetails) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*JobInstanceUpdateEvent, 0, size) p.InstanceEvents = tSlice for i := 0; i < size; i ++ { - _elem30 := &JobInstanceUpdateEvent{} - if err := _elem30.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem30), err) + _elem59 := &JobInstanceUpdateEvent{} + if err := _elem59.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem59), err) } - p.InstanceEvents = append(p.InstanceEvents, _elem30) + p.InstanceEvents = append(p.InstanceEvents, _elem59) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *JobUpdateDetails) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateDetails"); err != nil { +func (p *JobUpdateDetails) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateDetails"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateDetails) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("update", thrift.STRUCT, 1); err != nil { +func (p *JobUpdateDetails) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "update", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:update: ", p), err) } - if err := p.Update.Write(oprot); err != nil { + if err := p.Update.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Update), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:update: ", p), err) } return err } -func (p *JobUpdateDetails) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("updateEvents", thrift.LIST, 2); err != nil { +func (p *JobUpdateDetails) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "updateEvents", thrift.LIST, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:updateEvents: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.UpdateEvents)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.UpdateEvents)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.UpdateEvents { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:updateEvents: ", p), err) } return err } -func (p *JobUpdateDetails) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instanceEvents", thrift.LIST, 3); err != nil { +func (p *JobUpdateDetails) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instanceEvents", thrift.LIST, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:instanceEvents: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.InstanceEvents)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.InstanceEvents)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.InstanceEvents { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:instanceEvents: ", p), err) } return err } +func (p *JobUpdateDetails) Equals(other *JobUpdateDetails) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Update.Equals(other.Update) { return false } + if len(p.UpdateEvents) != len(other.UpdateEvents) { return false } + for i, _tgt := range p.UpdateEvents { + _src60 := other.UpdateEvents[i] + if !_tgt.Equals(_src60) { return false } + } + if len(p.InstanceEvents) != len(other.InstanceEvents) { return false } + for i, _tgt := range p.InstanceEvents { + _src61 := other.InstanceEvents[i] + if !_tgt.Equals(_src61) { return false } + } + return true +} + func (p *JobUpdateDetails) String() string { if p == nil { return "" @@ -12094,14 +13804,14 @@ func (p *JobUpdateRequest) IsSetMetadata() bool { return p.Metadata != nil } -func (p *JobUpdateRequest) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateRequest) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -12109,69 +13819,69 @@ func (p *JobUpdateRequest) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.SET { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateRequest) ReadField1(iprot thrift.TProtocol) error { +func (p *JobUpdateRequest) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.TaskConfig = &TaskConfig{} - if err := p.TaskConfig.Read(iprot); err != nil { + if err := p.TaskConfig.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.TaskConfig), err) } return nil } -func (p *JobUpdateRequest) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateRequest) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.InstanceCount = v @@ -12179,110 +13889,130 @@ func (p *JobUpdateRequest) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateRequest) ReadField3(iprot thrift.TProtocol) error { +func (p *JobUpdateRequest) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.Settings = &JobUpdateSettings{} - if err := p.Settings.Read(iprot); err != nil { + if err := p.Settings.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Settings), err) } return nil } -func (p *JobUpdateRequest) ReadField4(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *JobUpdateRequest) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Metadata, 0, size) p.Metadata = tSet for i := 0; i < size; i ++ { - _elem31 := &Metadata{} - if err := _elem31.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem31), err) + _elem62 := &Metadata{} + if err := _elem62.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem62), err) } - p.Metadata = append(p.Metadata, _elem31) + p.Metadata = append(p.Metadata, _elem62) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *JobUpdateRequest) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateRequest"); err != nil { +func (p *JobUpdateRequest) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateRequest"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskConfig", thrift.STRUCT, 1); err != nil { +func (p *JobUpdateRequest) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskConfig", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:taskConfig: ", p), err) } - if err := p.TaskConfig.Write(oprot); err != nil { + if err := p.TaskConfig.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TaskConfig), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:taskConfig: ", p), err) } return err } -func (p *JobUpdateRequest) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instanceCount", thrift.I32, 2); err != nil { +func (p *JobUpdateRequest) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instanceCount", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:instanceCount: ", p), err) } - if err := oprot.WriteI32(int32(p.InstanceCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.InstanceCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.instanceCount (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:instanceCount: ", p), err) } return err } -func (p *JobUpdateRequest) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("settings", thrift.STRUCT, 3); err != nil { +func (p *JobUpdateRequest) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "settings", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:settings: ", p), err) } - if err := p.Settings.Write(oprot); err != nil { + if err := p.Settings.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Settings), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:settings: ", p), err) } return err } -func (p *JobUpdateRequest) writeField4(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateRequest) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMetadata() { - if err := oprot.WriteFieldBegin("metadata", thrift.SET, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "metadata", thrift.SET, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:metadata: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Metadata)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Metadata)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -12377,14 +14107,14 @@ func (p *JobUpdateQuery) IsSetUpdateStatuses() bool { return p.UpdateStatuses != nil } -func (p *JobUpdateQuery) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateQuery) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -12392,91 +14122,91 @@ func (p *JobUpdateQuery) Read(iprot thrift.TProtocol) error { switch fieldId { case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 8: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField8(iprot); err != nil { + if err := p.ReadField8(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.SET { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.I32 { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.I32 { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateQuery) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobUpdateQuery) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Role = &v @@ -12484,24 +14214,24 @@ func (p *JobUpdateQuery) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateQuery) ReadField8(iprot thrift.TProtocol) error { +func (p *JobUpdateQuery) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { p.Key = &JobUpdateKey{} - if err := p.Key.Read(iprot); err != nil { + if err := p.Key.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) } return nil } -func (p *JobUpdateQuery) ReadField3(iprot thrift.TProtocol) error { +func (p *JobUpdateQuery) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.JobKey = &JobKey{} - if err := p.JobKey.Read(iprot); err != nil { + if err := p.JobKey.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.JobKey), err) } return nil } -func (p *JobUpdateQuery) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobUpdateQuery) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.User = &v @@ -12509,31 +14239,31 @@ func (p *JobUpdateQuery) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateQuery) ReadField5(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *JobUpdateQuery) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]JobUpdateStatus, 0, size) p.UpdateStatuses = tSet for i := 0; i < size; i ++ { -var _elem32 JobUpdateStatus - if v, err := iprot.ReadI32(); err != nil { +var _elem64 JobUpdateStatus + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { temp := JobUpdateStatus(v) - _elem32 = temp + _elem64 = temp } - p.UpdateStatuses = append(p.UpdateStatuses, _elem32) + p.UpdateStatuses = append(p.UpdateStatuses, _elem64) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *JobUpdateQuery) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateQuery) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 6: ", err) } else { p.Offset = v @@ -12541,8 +14271,8 @@ func (p *JobUpdateQuery) ReadField6(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateQuery) ReadField7(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateQuery) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 7: ", err) } else { p.Limit = v @@ -12550,122 +14280,155 @@ func (p *JobUpdateQuery) ReadField7(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateQuery) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateQuery"); err != nil { +func (p *JobUpdateQuery) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateQuery"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField8(oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateQuery) writeField2(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateQuery) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetRole() { - if err := oprot.WriteFieldBegin("role", thrift.STRING, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "role", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:role: ", p), err) } - if err := oprot.WriteString(string(*p.Role)); err != nil { + if err := oprot.WriteString(ctx, string(*p.Role)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.role (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:role: ", p), err) } } return err } -func (p *JobUpdateQuery) writeField3(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateQuery) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetJobKey() { - if err := oprot.WriteFieldBegin("jobKey", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "jobKey", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:jobKey: ", p), err) } - if err := p.JobKey.Write(oprot); err != nil { + if err := p.JobKey.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobKey), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:jobKey: ", p), err) } } return err } -func (p *JobUpdateQuery) writeField4(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateQuery) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetUser() { - if err := oprot.WriteFieldBegin("user", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "user", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:user: ", p), err) } - if err := oprot.WriteString(string(*p.User)); err != nil { + if err := oprot.WriteString(ctx, string(*p.User)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.user (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:user: ", p), err) } } return err } -func (p *JobUpdateQuery) writeField5(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateQuery) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetUpdateStatuses() { - if err := oprot.WriteFieldBegin("updateStatuses", thrift.SET, 5); err != nil { + if err := oprot.WriteFieldBegin(ctx, "updateStatuses", thrift.SET, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:updateStatuses: ", p), err) } - if err := oprot.WriteSetBegin(thrift.I32, len(p.UpdateStatuses)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.I32, len(p.UpdateStatuses)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -12712,14 +14475,14 @@ func (p *HostMaintenanceRequest) IsSetDefaultSlaPolicy() bool { return p.DefaultSlaPolicy != nil } -func (p *HostMaintenanceRequest) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *HostMaintenanceRequest) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -12727,61 +14490,61 @@ func (p *HostMaintenanceRequest) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.I64 { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *HostMaintenanceRequest) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *HostMaintenanceRequest) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Host = v @@ -12789,16 +14552,16 @@ func (p *HostMaintenanceRequest) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *HostMaintenanceRequest) ReadField2(iprot thrift.TProtocol) error { +func (p *HostMaintenanceRequest) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.DefaultSlaPolicy = &SlaPolicy{} - if err := p.DefaultSlaPolicy.Read(iprot); err != nil { + if err := p.DefaultSlaPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DefaultSlaPolicy), err) } return nil } -func (p *HostMaintenanceRequest) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *HostMaintenanceRequest) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.TimeoutSecs = v @@ -12806,8 +14569,8 @@ func (p *HostMaintenanceRequest) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *HostMaintenanceRequest) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *HostMaintenanceRequest) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.CreatedTimestampMs = v @@ -12815,63 +14578,76 @@ func (p *HostMaintenanceRequest) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *HostMaintenanceRequest) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("HostMaintenanceRequest"); err != nil { +func (p *HostMaintenanceRequest) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "HostMaintenanceRequest"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *HostMaintenanceRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("host", thrift.STRING, 1); err != nil { +func (p *HostMaintenanceRequest) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:host: ", p), err) } - if err := oprot.WriteString(string(p.Host)); err != nil { + if err := oprot.WriteString(ctx, string(p.Host)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.host (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:host: ", p), err) } return err } -func (p *HostMaintenanceRequest) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("defaultSlaPolicy", thrift.STRUCT, 2); err != nil { +func (p *HostMaintenanceRequest) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "defaultSlaPolicy", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:defaultSlaPolicy: ", p), err) } - if err := p.DefaultSlaPolicy.Write(oprot); err != nil { + if err := p.DefaultSlaPolicy.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DefaultSlaPolicy), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:defaultSlaPolicy: ", p), err) } return err } -func (p *HostMaintenanceRequest) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timeoutSecs", thrift.I64, 3); err != nil { +func (p *HostMaintenanceRequest) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timeoutSecs", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:timeoutSecs: ", p), err) } - if err := oprot.WriteI64(int64(p.TimeoutSecs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TimeoutSecs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timeoutSecs (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:timeoutSecs: ", p), err) } return err } -func (p *HostMaintenanceRequest) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("createdTimestampMs", thrift.I64, 4); err != nil { +func (p *HostMaintenanceRequest) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "createdTimestampMs", thrift.I64, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:createdTimestampMs: ", p), err) } - if err := oprot.WriteI64(int64(p.CreatedTimestampMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.CreatedTimestampMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.createdTimestampMs (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:createdTimestampMs: ", p), err) } return err } +func (p *HostMaintenanceRequest) Equals(other *HostMaintenanceRequest) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Host != other.Host { return false } + if !p.DefaultSlaPolicy.Equals(other.DefaultSlaPolicy) { return false } + if p.TimeoutSecs != other.TimeoutSecs { return false } + if p.CreatedTimestampMs != other.CreatedTimestampMs { return false } + return true +} + func (p *HostMaintenanceRequest) String() string { if p == nil { return "" @@ -12893,14 +14669,14 @@ func NewListBackupsResult_() *ListBackupsResult_ { func (p *ListBackupsResult_) GetBackups() []string { return p.Backups } -func (p *ListBackupsResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ListBackupsResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -12908,89 +14684,106 @@ func (p *ListBackupsResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ListBackupsResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *ListBackupsResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]string, 0, size) p.Backups = tSet for i := 0; i < size; i ++ { -var _elem33 string - if v, err := iprot.ReadString(); err != nil { +var _elem66 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem33 = v + _elem66 = v } - p.Backups = append(p.Backups, _elem33) + p.Backups = append(p.Backups, _elem66) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *ListBackupsResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ListBackupsResult"); err != nil { +func (p *ListBackupsResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ListBackupsResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ListBackupsResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("backups", thrift.SET, 1); err != nil { +func (p *ListBackupsResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "backups", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:backups: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRING, len(p.Backups)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRING, len(p.Backups)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13012,14 +14805,14 @@ func NewStartMaintenanceResult_() *StartMaintenanceResult_ { func (p *StartMaintenanceResult_) GetStatuses() []*HostStatus { return p.Statuses } -func (p *StartMaintenanceResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *StartMaintenanceResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13027,88 +14820,105 @@ func (p *StartMaintenanceResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *StartMaintenanceResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *StartMaintenanceResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*HostStatus, 0, size) p.Statuses = tSet for i := 0; i < size; i ++ { - _elem34 := &HostStatus{} - if err := _elem34.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem34), err) + _elem68 := &HostStatus{} + if err := _elem68.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem68), err) } - p.Statuses = append(p.Statuses, _elem34) + p.Statuses = append(p.Statuses, _elem68) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *StartMaintenanceResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("StartMaintenanceResult"); err != nil { +func (p *StartMaintenanceResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "StartMaintenanceResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *StartMaintenanceResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("statuses", thrift.SET, 1); err != nil { +func (p *StartMaintenanceResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statuses", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:statuses: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Statuses)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Statuses)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13130,14 +14940,14 @@ func NewDrainHostsResult_() *DrainHostsResult_ { func (p *DrainHostsResult_) GetStatuses() []*HostStatus { return p.Statuses } -func (p *DrainHostsResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *DrainHostsResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13145,88 +14955,105 @@ func (p *DrainHostsResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *DrainHostsResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *DrainHostsResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*HostStatus, 0, size) p.Statuses = tSet for i := 0; i < size; i ++ { - _elem35 := &HostStatus{} - if err := _elem35.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem35), err) + _elem70 := &HostStatus{} + if err := _elem70.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem70), err) } - p.Statuses = append(p.Statuses, _elem35) + p.Statuses = append(p.Statuses, _elem70) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *DrainHostsResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("DrainHostsResult"); err != nil { +func (p *DrainHostsResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "DrainHostsResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *DrainHostsResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("statuses", thrift.SET, 1); err != nil { +func (p *DrainHostsResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statuses", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:statuses: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Statuses)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Statuses)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13248,14 +15075,14 @@ func NewQueryRecoveryResult_() *QueryRecoveryResult_ { func (p *QueryRecoveryResult_) GetTasks() []*ScheduledTask { return p.Tasks } -func (p *QueryRecoveryResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *QueryRecoveryResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13263,88 +15090,105 @@ func (p *QueryRecoveryResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *QueryRecoveryResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *QueryRecoveryResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*ScheduledTask, 0, size) p.Tasks = tSet for i := 0; i < size; i ++ { - _elem36 := &ScheduledTask{} - if err := _elem36.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem36), err) + _elem72 := &ScheduledTask{} + if err := _elem72.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem72), err) } - p.Tasks = append(p.Tasks, _elem36) + p.Tasks = append(p.Tasks, _elem72) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *QueryRecoveryResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("QueryRecoveryResult"); err != nil { +func (p *QueryRecoveryResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "QueryRecoveryResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *QueryRecoveryResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("tasks", thrift.SET, 1); err != nil { +func (p *QueryRecoveryResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "tasks", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:tasks: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Tasks)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Tasks)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13366,14 +15210,14 @@ func NewMaintenanceStatusResult_() *MaintenanceStatusResult_ { func (p *MaintenanceStatusResult_) GetStatuses() []*HostStatus { return p.Statuses } -func (p *MaintenanceStatusResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *MaintenanceStatusResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13381,88 +15225,105 @@ func (p *MaintenanceStatusResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *MaintenanceStatusResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *MaintenanceStatusResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*HostStatus, 0, size) p.Statuses = tSet for i := 0; i < size; i ++ { - _elem37 := &HostStatus{} - if err := _elem37.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem37), err) + _elem74 := &HostStatus{} + if err := _elem74.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem74), err) } - p.Statuses = append(p.Statuses, _elem37) + p.Statuses = append(p.Statuses, _elem74) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *MaintenanceStatusResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("MaintenanceStatusResult"); err != nil { +func (p *MaintenanceStatusResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "MaintenanceStatusResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *MaintenanceStatusResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("statuses", thrift.SET, 1); err != nil { +func (p *MaintenanceStatusResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statuses", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:statuses: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Statuses)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Statuses)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13484,14 +15345,14 @@ func NewEndMaintenanceResult_() *EndMaintenanceResult_ { func (p *EndMaintenanceResult_) GetStatuses() []*HostStatus { return p.Statuses } -func (p *EndMaintenanceResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *EndMaintenanceResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13499,88 +15360,105 @@ func (p *EndMaintenanceResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *EndMaintenanceResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *EndMaintenanceResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*HostStatus, 0, size) p.Statuses = tSet for i := 0; i < size; i ++ { - _elem38 := &HostStatus{} - if err := _elem38.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem38), err) + _elem76 := &HostStatus{} + if err := _elem76.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem76), err) } - p.Statuses = append(p.Statuses, _elem38) + p.Statuses = append(p.Statuses, _elem76) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *EndMaintenanceResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("EndMaintenanceResult"); err != nil { +func (p *EndMaintenanceResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "EndMaintenanceResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *EndMaintenanceResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("statuses", thrift.SET, 1); err != nil { +func (p *EndMaintenanceResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statuses", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:statuses: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Statuses)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Statuses)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13602,14 +15480,14 @@ func NewRoleSummaryResult_() *RoleSummaryResult_ { func (p *RoleSummaryResult_) GetSummaries() []*RoleSummary { return p.Summaries } -func (p *RoleSummaryResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *RoleSummaryResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13617,88 +15495,105 @@ func (p *RoleSummaryResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *RoleSummaryResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *RoleSummaryResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*RoleSummary, 0, size) p.Summaries = tSet for i := 0; i < size; i ++ { - _elem39 := &RoleSummary{} - if err := _elem39.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem39), err) + _elem78 := &RoleSummary{} + if err := _elem78.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem78), err) } - p.Summaries = append(p.Summaries, _elem39) + p.Summaries = append(p.Summaries, _elem78) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *RoleSummaryResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("RoleSummaryResult"); err != nil { +func (p *RoleSummaryResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "RoleSummaryResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *RoleSummaryResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("summaries", thrift.SET, 1); err != nil { +func (p *RoleSummaryResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "summaries", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:summaries: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Summaries)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Summaries)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13720,14 +15615,14 @@ func NewJobSummaryResult_() *JobSummaryResult_ { func (p *JobSummaryResult_) GetSummaries() []*JobSummary { return p.Summaries } -func (p *JobSummaryResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobSummaryResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13735,88 +15630,105 @@ func (p *JobSummaryResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobSummaryResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *JobSummaryResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*JobSummary, 0, size) p.Summaries = tSet for i := 0; i < size; i ++ { - _elem40 := &JobSummary{} - if err := _elem40.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem40), err) + _elem80 := &JobSummary{} + if err := _elem80.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem80), err) } - p.Summaries = append(p.Summaries, _elem40) + p.Summaries = append(p.Summaries, _elem80) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *JobSummaryResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobSummaryResult"); err != nil { +func (p *JobSummaryResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobSummaryResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobSummaryResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("summaries", thrift.SET, 1); err != nil { +func (p *JobSummaryResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "summaries", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:summaries: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Summaries)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Summaries)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13845,14 +15757,14 @@ func (p *ConfigSummaryResult_) IsSetSummary() bool { return p.Summary != nil } -func (p *ConfigSummaryResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ConfigSummaryResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13860,61 +15772,71 @@ func (p *ConfigSummaryResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ConfigSummaryResult_) ReadField1(iprot thrift.TProtocol) error { +func (p *ConfigSummaryResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Summary = &ConfigSummary{} - if err := p.Summary.Read(iprot); err != nil { + if err := p.Summary.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Summary), err) } return nil } -func (p *ConfigSummaryResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ConfigSummaryResult"); err != nil { +func (p *ConfigSummaryResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ConfigSummaryResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ConfigSummaryResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("summary", thrift.STRUCT, 1); err != nil { +func (p *ConfigSummaryResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "summary", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:summary: ", p), err) } - if err := p.Summary.Write(oprot); err != nil { + if err := p.Summary.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Summary), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:summary: ", p), err) } return err } +func (p *ConfigSummaryResult_) Equals(other *ConfigSummaryResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Summary.Equals(other.Summary) { return false } + return true +} + func (p *ConfigSummaryResult_) String() string { if p == nil { return "" @@ -13936,14 +15858,14 @@ func NewGetPendingReasonResult_() *GetPendingReasonResult_ { func (p *GetPendingReasonResult_) GetReasons() []*PendingReason { return p.Reasons } -func (p *GetPendingReasonResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetPendingReasonResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13951,88 +15873,105 @@ func (p *GetPendingReasonResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetPendingReasonResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetPendingReasonResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*PendingReason, 0, size) p.Reasons = tSet for i := 0; i < size; i ++ { - _elem41 := &PendingReason{} - if err := _elem41.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem41), err) + _elem82 := &PendingReason{} + if err := _elem82.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem82), err) } - p.Reasons = append(p.Reasons, _elem41) + p.Reasons = append(p.Reasons, _elem82) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetPendingReasonResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetPendingReasonResult"); err != nil { +func (p *GetPendingReasonResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetPendingReasonResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetPendingReasonResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("reasons", thrift.SET, 1); err != nil { +func (p *GetPendingReasonResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "reasons", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:reasons: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Reasons)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Reasons)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -14076,14 +16015,14 @@ func (p *StartJobUpdateResult_) IsSetUpdateSummary() bool { return p.UpdateSummary != nil } -func (p *StartJobUpdateResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *StartJobUpdateResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -14091,93 +16030,104 @@ func (p *StartJobUpdateResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *StartJobUpdateResult_) ReadField1(iprot thrift.TProtocol) error { +func (p *StartJobUpdateResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Key = &JobUpdateKey{} - if err := p.Key.Read(iprot); err != nil { + if err := p.Key.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) } return nil } -func (p *StartJobUpdateResult_) ReadField2(iprot thrift.TProtocol) error { +func (p *StartJobUpdateResult_) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.UpdateSummary = &JobUpdateSummary{} - if err := p.UpdateSummary.Read(iprot); err != nil { + if err := p.UpdateSummary.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.UpdateSummary), err) } return nil } -func (p *StartJobUpdateResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("StartJobUpdateResult"); err != nil { +func (p *StartJobUpdateResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "StartJobUpdateResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *StartJobUpdateResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRUCT, 1); err != nil { +func (p *StartJobUpdateResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) } - if err := p.Key.Write(oprot); err != nil { + if err := p.Key.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) } return err } -func (p *StartJobUpdateResult_) writeField2(oprot thrift.TProtocol) (err error) { +func (p *StartJobUpdateResult_) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetUpdateSummary() { - if err := oprot.WriteFieldBegin("updateSummary", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "updateSummary", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:updateSummary: ", p), err) } - if err := p.UpdateSummary.Write(oprot); err != nil { + if err := p.UpdateSummary.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.UpdateSummary), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:updateSummary: ", p), err) } } return err } +func (p *StartJobUpdateResult_) Equals(other *StartJobUpdateResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Key.Equals(other.Key) { return false } + if !p.UpdateSummary.Equals(other.UpdateSummary) { return false } + return true +} + func (p *StartJobUpdateResult_) String() string { if p == nil { return "" @@ -14201,14 +16151,14 @@ func NewGetJobUpdateSummariesResult_() *GetJobUpdateSummariesResult_ { func (p *GetJobUpdateSummariesResult_) GetUpdateSummaries() []*JobUpdateSummary { return p.UpdateSummaries } -func (p *GetJobUpdateSummariesResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetJobUpdateSummariesResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -14216,81 +16166,95 @@ func (p *GetJobUpdateSummariesResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.LIST { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetJobUpdateSummariesResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *GetJobUpdateSummariesResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*JobUpdateSummary, 0, size) p.UpdateSummaries = tSlice for i := 0; i < size; i ++ { - _elem42 := &JobUpdateSummary{} - if err := _elem42.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem42), err) + _elem84 := &JobUpdateSummary{} + if err := _elem84.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem84), err) } - p.UpdateSummaries = append(p.UpdateSummaries, _elem42) + p.UpdateSummaries = append(p.UpdateSummaries, _elem84) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *GetJobUpdateSummariesResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetJobUpdateSummariesResult"); err != nil { +func (p *GetJobUpdateSummariesResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetJobUpdateSummariesResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetJobUpdateSummariesResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("updateSummaries", thrift.LIST, 1); err != nil { +func (p *GetJobUpdateSummariesResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "updateSummaries", thrift.LIST, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:updateSummaries: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.UpdateSummaries)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.UpdateSummaries)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.UpdateSummaries { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:updateSummaries: ", p), err) } return err } +func (p *GetJobUpdateSummariesResult_) Equals(other *GetJobUpdateSummariesResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if len(p.UpdateSummaries) != len(other.UpdateSummaries) { return false } + for i, _tgt := range p.UpdateSummaries { + _src85 := other.UpdateSummaries[i] + if !_tgt.Equals(_src85) { return false } + } + return true +} + func (p *GetJobUpdateSummariesResult_) String() string { if p == nil { return "" @@ -14327,14 +16291,14 @@ func (p *GetJobUpdateDetailsResult_) IsSetDetails() bool { return p.Details != nil } -func (p *GetJobUpdateDetailsResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetJobUpdateDetailsResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -14342,111 +16306,126 @@ func (p *GetJobUpdateDetailsResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.LIST { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetJobUpdateDetailsResult_) ReadField1(iprot thrift.TProtocol) error { +func (p *GetJobUpdateDetailsResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Details = &JobUpdateDetails{} - if err := p.Details.Read(iprot); err != nil { + if err := p.Details.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Details), err) } return nil } -func (p *GetJobUpdateDetailsResult_) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *GetJobUpdateDetailsResult_) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*JobUpdateDetails, 0, size) p.DetailsList = tSlice for i := 0; i < size; i ++ { - _elem43 := &JobUpdateDetails{} - if err := _elem43.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem43), err) + _elem86 := &JobUpdateDetails{} + if err := _elem86.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem86), err) } - p.DetailsList = append(p.DetailsList, _elem43) + p.DetailsList = append(p.DetailsList, _elem86) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *GetJobUpdateDetailsResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetJobUpdateDetailsResult"); err != nil { +func (p *GetJobUpdateDetailsResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetJobUpdateDetailsResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetJobUpdateDetailsResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("details", thrift.STRUCT, 1); err != nil { +func (p *GetJobUpdateDetailsResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "details", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:details: ", p), err) } - if err := p.Details.Write(oprot); err != nil { + if err := p.Details.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Details), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:details: ", p), err) } return err } -func (p *GetJobUpdateDetailsResult_) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("detailsList", thrift.LIST, 2); err != nil { +func (p *GetJobUpdateDetailsResult_) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "detailsList", thrift.LIST, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:detailsList: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.DetailsList)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.DetailsList)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.DetailsList { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:detailsList: ", p), err) } return err } +func (p *GetJobUpdateDetailsResult_) Equals(other *GetJobUpdateDetailsResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Details.Equals(other.Details) { return false } + if len(p.DetailsList) != len(other.DetailsList) { return false } + for i, _tgt := range p.DetailsList { + _src87 := other.DetailsList[i] + if !_tgt.Equals(_src87) { return false } + } + return true +} + func (p *GetJobUpdateDetailsResult_) String() string { if p == nil { return "" @@ -14470,14 +16449,14 @@ func NewPulseJobUpdateResult_() *PulseJobUpdateResult_ { func (p *PulseJobUpdateResult_) GetStatus() JobUpdatePulseStatus { return p.Status } -func (p *PulseJobUpdateResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *PulseJobUpdateResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -14485,31 +16464,31 @@ func (p *PulseJobUpdateResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *PulseJobUpdateResult_) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *PulseJobUpdateResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { temp := JobUpdatePulseStatus(v) @@ -14518,29 +16497,39 @@ func (p *PulseJobUpdateResult_) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *PulseJobUpdateResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("PulseJobUpdateResult"); err != nil { +func (p *PulseJobUpdateResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "PulseJobUpdateResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *PulseJobUpdateResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.I32, 1); err != nil { +func (p *PulseJobUpdateResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := oprot.WriteI32(int32(p.Status)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Status)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.status (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } return err } +func (p *PulseJobUpdateResult_) Equals(other *PulseJobUpdateResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Status != other.Status { return false } + return true +} + func (p *PulseJobUpdateResult_) String() string { if p == nil { return "" @@ -14580,14 +16569,14 @@ func (p *GetJobUpdateDiffResult_) GetUpdate() []*ConfigGroup { func (p *GetJobUpdateDiffResult_) GetUnchanged() []*ConfigGroup { return p.Unchanged } -func (p *GetJobUpdateDiffResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetJobUpdateDiffResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -14595,259 +16584,300 @@ func (p *GetJobUpdateDiffResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.SET { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.SET { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetJobUpdateDiffResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetJobUpdateDiffResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*ConfigGroup, 0, size) p.Add = tSet for i := 0; i < size; i ++ { - _elem44 := &ConfigGroup{} - if err := _elem44.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem44), err) + _elem88 := &ConfigGroup{} + if err := _elem88.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem88), err) } - p.Add = append(p.Add, _elem44) + p.Add = append(p.Add, _elem88) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetJobUpdateDiffResult_) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetJobUpdateDiffResult_) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*ConfigGroup, 0, size) p.Remove = tSet for i := 0; i < size; i ++ { - _elem45 := &ConfigGroup{} - if err := _elem45.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem45), err) + _elem89 := &ConfigGroup{} + if err := _elem89.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem89), err) } - p.Remove = append(p.Remove, _elem45) + p.Remove = append(p.Remove, _elem89) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetJobUpdateDiffResult_) ReadField3(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetJobUpdateDiffResult_) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*ConfigGroup, 0, size) p.Update = tSet for i := 0; i < size; i ++ { - _elem46 := &ConfigGroup{} - if err := _elem46.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem46), err) + _elem90 := &ConfigGroup{} + if err := _elem90.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem90), err) } - p.Update = append(p.Update, _elem46) + p.Update = append(p.Update, _elem90) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetJobUpdateDiffResult_) ReadField4(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetJobUpdateDiffResult_) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*ConfigGroup, 0, size) p.Unchanged = tSet for i := 0; i < size; i ++ { - _elem47 := &ConfigGroup{} - if err := _elem47.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem47), err) + _elem91 := &ConfigGroup{} + if err := _elem91.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem91), err) } - p.Unchanged = append(p.Unchanged, _elem47) + p.Unchanged = append(p.Unchanged, _elem91) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetJobUpdateDiffResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetJobUpdateDiffResult"); err != nil { +func (p *GetJobUpdateDiffResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetJobUpdateDiffResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetJobUpdateDiffResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("add", thrift.SET, 1); err != nil { +func (p *GetJobUpdateDiffResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "add", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:add: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Add)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Add)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -14877,14 +16907,14 @@ func (p *TierConfig) GetName() string { func (p *TierConfig) GetSettings() map[string]string { return p.Settings } -func (p *TierConfig) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *TierConfig) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -14892,41 +16922,41 @@ func (p *TierConfig) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.MAP { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *TierConfig) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TierConfig) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -14934,78 +16964,93 @@ func (p *TierConfig) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *TierConfig) ReadField2(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() +func (p *TierConfig) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin(ctx) if err != nil { return thrift.PrependError("error reading map begin: ", err) } tMap := make(map[string]string, size) p.Settings = tMap for i := 0; i < size; i ++ { -var _key48 string - if v, err := iprot.ReadString(); err != nil { +var _key96 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _key48 = v + _key96 = v } -var _val49 string - if v, err := iprot.ReadString(); err != nil { +var _val97 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _val49 = v + _val97 = v } - p.Settings[_key48] = _val49 + p.Settings[_key96] = _val97 } - if err := iprot.ReadMapEnd(); err != nil { + if err := iprot.ReadMapEnd(ctx); err != nil { return thrift.PrependError("error reading map end: ", err) } return nil } -func (p *TierConfig) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("TierConfig"); err != nil { +func (p *TierConfig) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TierConfig"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TierConfig) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *TierConfig) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *TierConfig) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("settings", thrift.MAP, 2); err != nil { +func (p *TierConfig) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "settings", thrift.MAP, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:settings: ", p), err) } - if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.Settings)); err != nil { + if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(p.Settings)); err != nil { return thrift.PrependError("error writing map begin: ", err) } for k, v := range p.Settings { - if err := oprot.WriteString(string(k)); err != nil { + if err := oprot.WriteString(ctx, string(k)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteString(string(v)); err != nil { + if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } - if err := oprot.WriteMapEnd(); err != nil { + if err := oprot.WriteMapEnd(ctx); err != nil { return thrift.PrependError("error writing map end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:settings: ", p), err) } return err } +func (p *TierConfig) Equals(other *TierConfig) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Name != other.Name { return false } + if len(p.Settings) != len(other.Settings) { return false } + for k, _tgt := range p.Settings { + _src98 := other.Settings[k] + if _tgt != _src98 { return false } + } + return true +} + func (p *TierConfig) String() string { if p == nil { return "" @@ -15035,14 +17080,14 @@ func (p *GetTierConfigResult_) GetDefaultTierName() string { func (p *GetTierConfigResult_) GetTiers() []*TierConfig { return p.Tiers } -func (p *GetTierConfigResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetTierConfigResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -15050,41 +17095,41 @@ func (p *GetTierConfigResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetTierConfigResult_) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *GetTierConfigResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.DefaultTierName = v @@ -15092,76 +17137,94 @@ func (p *GetTierConfigResult_) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *GetTierConfigResult_) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetTierConfigResult_) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*TierConfig, 0, size) p.Tiers = tSet for i := 0; i < size; i ++ { - _elem50 := &TierConfig{} - if err := _elem50.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem50), err) + _elem99 := &TierConfig{} + if err := _elem99.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem99), err) } - p.Tiers = append(p.Tiers, _elem50) + p.Tiers = append(p.Tiers, _elem99) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetTierConfigResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetTierConfigResult"); err != nil { +func (p *GetTierConfigResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetTierConfigResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetTierConfigResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("defaultTierName", thrift.STRING, 1); err != nil { +func (p *GetTierConfigResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "defaultTierName", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:defaultTierName: ", p), err) } - if err := oprot.WriteString(string(p.DefaultTierName)); err != nil { + if err := oprot.WriteString(ctx, string(p.DefaultTierName)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.defaultTierName (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:defaultTierName: ", p), err) } return err } -func (p *GetTierConfigResult_) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("tiers", thrift.SET, 2); err != nil { +func (p *GetTierConfigResult_) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "tiers", thrift.SET, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tiers: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Tiers)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Tiers)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -15192,14 +17255,14 @@ func (p *ServerInfo) GetClusterName() string { func (p *ServerInfo) GetStatsUrlPrefix() string { return p.StatsUrlPrefix } -func (p *ServerInfo) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ServerInfo) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -15207,41 +17270,41 @@ func (p *ServerInfo) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ServerInfo) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ServerInfo) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.ClusterName = v @@ -15249,8 +17312,8 @@ func (p *ServerInfo) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *ServerInfo) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ServerInfo) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.StatsUrlPrefix = v @@ -15258,40 +17321,51 @@ func (p *ServerInfo) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *ServerInfo) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ServerInfo"); err != nil { +func (p *ServerInfo) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ServerInfo"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ServerInfo) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("clusterName", thrift.STRING, 1); err != nil { +func (p *ServerInfo) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "clusterName", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:clusterName: ", p), err) } - if err := oprot.WriteString(string(p.ClusterName)); err != nil { + if err := oprot.WriteString(ctx, string(p.ClusterName)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.clusterName (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:clusterName: ", p), err) } return err } -func (p *ServerInfo) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("statsUrlPrefix", thrift.STRING, 3); err != nil { +func (p *ServerInfo) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statsUrlPrefix", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:statsUrlPrefix: ", p), err) } - if err := oprot.WriteString(string(p.StatsUrlPrefix)); err != nil { + if err := oprot.WriteString(ctx, string(p.StatsUrlPrefix)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.statsUrlPrefix (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:statsUrlPrefix: ", p), err) } return err } +func (p *ServerInfo) Equals(other *ServerInfo) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.ClusterName != other.ClusterName { return false } + if p.StatsUrlPrefix != other.StatsUrlPrefix { return false } + return true +} + func (p *ServerInfo) String() string { if p == nil { return "" @@ -15636,14 +17710,14 @@ func (p *Result_) IsSetGetTierConfigResult_() bool { return p.GetTierConfigResult_ != nil } -func (p *Result_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Result_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -15651,674 +17725,703 @@ func (p *Result_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 8: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField8(iprot); err != nil { + if err := p.ReadField8(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 9: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField9(iprot); err != nil { + if err := p.ReadField9(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 10: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField10(iprot); err != nil { + if err := p.ReadField10(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 11: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField11(iprot); err != nil { + if err := p.ReadField11(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 17: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField17(iprot); err != nil { + if err := p.ReadField17(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 18: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField18(iprot); err != nil { + if err := p.ReadField18(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 20: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField20(iprot); err != nil { + if err := p.ReadField20(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 21: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField21(iprot); err != nil { + if err := p.ReadField21(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 22: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField22(iprot); err != nil { + if err := p.ReadField22(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 23: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField23(iprot); err != nil { + if err := p.ReadField23(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 24: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField24(iprot); err != nil { + if err := p.ReadField24(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 25: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField25(iprot); err != nil { + if err := p.ReadField25(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 26: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField26(iprot); err != nil { + if err := p.ReadField26(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 27: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField27(iprot); err != nil { + if err := p.ReadField27(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Result_) ReadField1(iprot thrift.TProtocol) error { +func (p *Result_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.PopulateJobResult_ = &PopulateJobResult_{} - if err := p.PopulateJobResult_.Read(iprot); err != nil { + if err := p.PopulateJobResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.PopulateJobResult_), err) } return nil } -func (p *Result_) ReadField3(iprot thrift.TProtocol) error { +func (p *Result_) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.ScheduleStatusResult_ = &ScheduleStatusResult_{} - if err := p.ScheduleStatusResult_.Read(iprot); err != nil { + if err := p.ScheduleStatusResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ScheduleStatusResult_), err) } return nil } -func (p *Result_) ReadField4(iprot thrift.TProtocol) error { +func (p *Result_) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.GetJobsResult_ = &GetJobsResult_{} - if err := p.GetJobsResult_.Read(iprot); err != nil { + if err := p.GetJobsResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetJobsResult_), err) } return nil } -func (p *Result_) ReadField5(iprot thrift.TProtocol) error { +func (p *Result_) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { p.GetQuotaResult_ = &GetQuotaResult_{} - if err := p.GetQuotaResult_.Read(iprot); err != nil { + if err := p.GetQuotaResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetQuotaResult_), err) } return nil } -func (p *Result_) ReadField6(iprot thrift.TProtocol) error { +func (p *Result_) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { p.ListBackupsResult_ = &ListBackupsResult_{} - if err := p.ListBackupsResult_.Read(iprot); err != nil { + if err := p.ListBackupsResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ListBackupsResult_), err) } return nil } -func (p *Result_) ReadField7(iprot thrift.TProtocol) error { +func (p *Result_) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { p.StartMaintenanceResult_ = &StartMaintenanceResult_{} - if err := p.StartMaintenanceResult_.Read(iprot); err != nil { + if err := p.StartMaintenanceResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.StartMaintenanceResult_), err) } return nil } -func (p *Result_) ReadField8(iprot thrift.TProtocol) error { +func (p *Result_) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { p.DrainHostsResult_ = &DrainHostsResult_{} - if err := p.DrainHostsResult_.Read(iprot); err != nil { + if err := p.DrainHostsResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DrainHostsResult_), err) } return nil } -func (p *Result_) ReadField9(iprot thrift.TProtocol) error { +func (p *Result_) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { p.QueryRecoveryResult_ = &QueryRecoveryResult_{} - if err := p.QueryRecoveryResult_.Read(iprot); err != nil { + if err := p.QueryRecoveryResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.QueryRecoveryResult_), err) } return nil } -func (p *Result_) ReadField10(iprot thrift.TProtocol) error { +func (p *Result_) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { p.MaintenanceStatusResult_ = &MaintenanceStatusResult_{} - if err := p.MaintenanceStatusResult_.Read(iprot); err != nil { + if err := p.MaintenanceStatusResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.MaintenanceStatusResult_), err) } return nil } -func (p *Result_) ReadField11(iprot thrift.TProtocol) error { +func (p *Result_) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { p.EndMaintenanceResult_ = &EndMaintenanceResult_{} - if err := p.EndMaintenanceResult_.Read(iprot); err != nil { + if err := p.EndMaintenanceResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.EndMaintenanceResult_), err) } return nil } -func (p *Result_) ReadField17(iprot thrift.TProtocol) error { +func (p *Result_) ReadField17(ctx context.Context, iprot thrift.TProtocol) error { p.RoleSummaryResult_ = &RoleSummaryResult_{} - if err := p.RoleSummaryResult_.Read(iprot); err != nil { + if err := p.RoleSummaryResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.RoleSummaryResult_), err) } return nil } -func (p *Result_) ReadField18(iprot thrift.TProtocol) error { +func (p *Result_) ReadField18(ctx context.Context, iprot thrift.TProtocol) error { p.JobSummaryResult_ = &JobSummaryResult_{} - if err := p.JobSummaryResult_.Read(iprot); err != nil { + if err := p.JobSummaryResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.JobSummaryResult_), err) } return nil } -func (p *Result_) ReadField20(iprot thrift.TProtocol) error { +func (p *Result_) ReadField20(ctx context.Context, iprot thrift.TProtocol) error { p.ConfigSummaryResult_ = &ConfigSummaryResult_{} - if err := p.ConfigSummaryResult_.Read(iprot); err != nil { + if err := p.ConfigSummaryResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ConfigSummaryResult_), err) } return nil } -func (p *Result_) ReadField21(iprot thrift.TProtocol) error { +func (p *Result_) ReadField21(ctx context.Context, iprot thrift.TProtocol) error { p.GetPendingReasonResult_ = &GetPendingReasonResult_{} - if err := p.GetPendingReasonResult_.Read(iprot); err != nil { + if err := p.GetPendingReasonResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetPendingReasonResult_), err) } return nil } -func (p *Result_) ReadField22(iprot thrift.TProtocol) error { +func (p *Result_) ReadField22(ctx context.Context, iprot thrift.TProtocol) error { p.StartJobUpdateResult_ = &StartJobUpdateResult_{} - if err := p.StartJobUpdateResult_.Read(iprot); err != nil { + if err := p.StartJobUpdateResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.StartJobUpdateResult_), err) } return nil } -func (p *Result_) ReadField23(iprot thrift.TProtocol) error { +func (p *Result_) ReadField23(ctx context.Context, iprot thrift.TProtocol) error { p.GetJobUpdateSummariesResult_ = &GetJobUpdateSummariesResult_{} - if err := p.GetJobUpdateSummariesResult_.Read(iprot); err != nil { + if err := p.GetJobUpdateSummariesResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetJobUpdateSummariesResult_), err) } return nil } -func (p *Result_) ReadField24(iprot thrift.TProtocol) error { +func (p *Result_) ReadField24(ctx context.Context, iprot thrift.TProtocol) error { p.GetJobUpdateDetailsResult_ = &GetJobUpdateDetailsResult_{} - if err := p.GetJobUpdateDetailsResult_.Read(iprot); err != nil { + if err := p.GetJobUpdateDetailsResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetJobUpdateDetailsResult_), err) } return nil } -func (p *Result_) ReadField25(iprot thrift.TProtocol) error { +func (p *Result_) ReadField25(ctx context.Context, iprot thrift.TProtocol) error { p.PulseJobUpdateResult_ = &PulseJobUpdateResult_{} - if err := p.PulseJobUpdateResult_.Read(iprot); err != nil { + if err := p.PulseJobUpdateResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.PulseJobUpdateResult_), err) } return nil } -func (p *Result_) ReadField26(iprot thrift.TProtocol) error { +func (p *Result_) ReadField26(ctx context.Context, iprot thrift.TProtocol) error { p.GetJobUpdateDiffResult_ = &GetJobUpdateDiffResult_{} - if err := p.GetJobUpdateDiffResult_.Read(iprot); err != nil { + if err := p.GetJobUpdateDiffResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetJobUpdateDiffResult_), err) } return nil } -func (p *Result_) ReadField27(iprot thrift.TProtocol) error { +func (p *Result_) ReadField27(ctx context.Context, iprot thrift.TProtocol) error { p.GetTierConfigResult_ = &GetTierConfigResult_{} - if err := p.GetTierConfigResult_.Read(iprot); err != nil { + if err := p.GetTierConfigResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetTierConfigResult_), err) } return nil } -func (p *Result_) Write(oprot thrift.TProtocol) error { +func (p *Result_) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsResult_(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("Result"); err != nil { + if err := oprot.WriteStructBegin(ctx, "Result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField8(oprot); err != nil { return err } - if err := p.writeField9(oprot); err != nil { return err } - if err := p.writeField10(oprot); err != nil { return err } - if err := p.writeField11(oprot); err != nil { return err } - if err := p.writeField17(oprot); err != nil { return err } - if err := p.writeField18(oprot); err != nil { return err } - if err := p.writeField20(oprot); err != nil { return err } - if err := p.writeField21(oprot); err != nil { return err } - if err := p.writeField22(oprot); err != nil { return err } - if err := p.writeField23(oprot); err != nil { return err } - if err := p.writeField24(oprot); err != nil { return err } - if err := p.writeField25(oprot); err != nil { return err } - if err := p.writeField26(oprot); err != nil { return err } - if err := p.writeField27(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } + if err := p.writeField10(ctx, oprot); err != nil { return err } + if err := p.writeField11(ctx, oprot); err != nil { return err } + if err := p.writeField17(ctx, oprot); err != nil { return err } + if err := p.writeField18(ctx, oprot); err != nil { return err } + if err := p.writeField20(ctx, oprot); err != nil { return err } + if err := p.writeField21(ctx, oprot); err != nil { return err } + if err := p.writeField22(ctx, oprot); err != nil { return err } + if err := p.writeField23(ctx, oprot); err != nil { return err } + if err := p.writeField24(ctx, oprot); err != nil { return err } + if err := p.writeField25(ctx, oprot); err != nil { return err } + if err := p.writeField26(ctx, oprot); err != nil { return err } + if err := p.writeField27(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Result_) writeField1(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetPopulateJobResult_() { - if err := oprot.WriteFieldBegin("populateJobResult", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "populateJobResult", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:populateJobResult: ", p), err) } - if err := p.PopulateJobResult_.Write(oprot); err != nil { + if err := p.PopulateJobResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.PopulateJobResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:populateJobResult: ", p), err) } } return err } -func (p *Result_) writeField3(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetScheduleStatusResult_() { - if err := oprot.WriteFieldBegin("scheduleStatusResult", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "scheduleStatusResult", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:scheduleStatusResult: ", p), err) } - if err := p.ScheduleStatusResult_.Write(oprot); err != nil { + if err := p.ScheduleStatusResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ScheduleStatusResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:scheduleStatusResult: ", p), err) } } return err } -func (p *Result_) writeField4(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetJobsResult_() { - if err := oprot.WriteFieldBegin("getJobsResult", thrift.STRUCT, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getJobsResult", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:getJobsResult: ", p), err) } - if err := p.GetJobsResult_.Write(oprot); err != nil { + if err := p.GetJobsResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetJobsResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:getJobsResult: ", p), err) } } return err } -func (p *Result_) writeField5(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetQuotaResult_() { - if err := oprot.WriteFieldBegin("getQuotaResult", thrift.STRUCT, 5); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getQuotaResult", thrift.STRUCT, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:getQuotaResult: ", p), err) } - if err := p.GetQuotaResult_.Write(oprot); err != nil { + if err := p.GetQuotaResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetQuotaResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:getQuotaResult: ", p), err) } } return err } -func (p *Result_) writeField6(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetListBackupsResult_() { - if err := oprot.WriteFieldBegin("listBackupsResult", thrift.STRUCT, 6); err != nil { + if err := oprot.WriteFieldBegin(ctx, "listBackupsResult", thrift.STRUCT, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:listBackupsResult: ", p), err) } - if err := p.ListBackupsResult_.Write(oprot); err != nil { + if err := p.ListBackupsResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ListBackupsResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:listBackupsResult: ", p), err) } } return err } -func (p *Result_) writeField7(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetStartMaintenanceResult_() { - if err := oprot.WriteFieldBegin("startMaintenanceResult", thrift.STRUCT, 7); err != nil { + if err := oprot.WriteFieldBegin(ctx, "startMaintenanceResult", thrift.STRUCT, 7); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:startMaintenanceResult: ", p), err) } - if err := p.StartMaintenanceResult_.Write(oprot); err != nil { + if err := p.StartMaintenanceResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.StartMaintenanceResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 7:startMaintenanceResult: ", p), err) } } return err } -func (p *Result_) writeField8(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDrainHostsResult_() { - if err := oprot.WriteFieldBegin("drainHostsResult", thrift.STRUCT, 8); err != nil { + if err := oprot.WriteFieldBegin(ctx, "drainHostsResult", thrift.STRUCT, 8); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:drainHostsResult: ", p), err) } - if err := p.DrainHostsResult_.Write(oprot); err != nil { + if err := p.DrainHostsResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DrainHostsResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 8:drainHostsResult: ", p), err) } } return err } -func (p *Result_) writeField9(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetQueryRecoveryResult_() { - if err := oprot.WriteFieldBegin("queryRecoveryResult", thrift.STRUCT, 9); err != nil { + if err := oprot.WriteFieldBegin(ctx, "queryRecoveryResult", thrift.STRUCT, 9); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:queryRecoveryResult: ", p), err) } - if err := p.QueryRecoveryResult_.Write(oprot); err != nil { + if err := p.QueryRecoveryResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.QueryRecoveryResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 9:queryRecoveryResult: ", p), err) } } return err } -func (p *Result_) writeField10(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMaintenanceStatusResult_() { - if err := oprot.WriteFieldBegin("maintenanceStatusResult", thrift.STRUCT, 10); err != nil { + if err := oprot.WriteFieldBegin(ctx, "maintenanceStatusResult", thrift.STRUCT, 10); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:maintenanceStatusResult: ", p), err) } - if err := p.MaintenanceStatusResult_.Write(oprot); err != nil { + if err := p.MaintenanceStatusResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.MaintenanceStatusResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 10:maintenanceStatusResult: ", p), err) } } return err } -func (p *Result_) writeField11(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetEndMaintenanceResult_() { - if err := oprot.WriteFieldBegin("endMaintenanceResult", thrift.STRUCT, 11); err != nil { + if err := oprot.WriteFieldBegin(ctx, "endMaintenanceResult", thrift.STRUCT, 11); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:endMaintenanceResult: ", p), err) } - if err := p.EndMaintenanceResult_.Write(oprot); err != nil { + if err := p.EndMaintenanceResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.EndMaintenanceResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 11:endMaintenanceResult: ", p), err) } } return err } -func (p *Result_) writeField17(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField17(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetRoleSummaryResult_() { - if err := oprot.WriteFieldBegin("roleSummaryResult", thrift.STRUCT, 17); err != nil { + if err := oprot.WriteFieldBegin(ctx, "roleSummaryResult", thrift.STRUCT, 17); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 17:roleSummaryResult: ", p), err) } - if err := p.RoleSummaryResult_.Write(oprot); err != nil { + if err := p.RoleSummaryResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.RoleSummaryResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 17:roleSummaryResult: ", p), err) } } return err } -func (p *Result_) writeField18(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField18(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetJobSummaryResult_() { - if err := oprot.WriteFieldBegin("jobSummaryResult", thrift.STRUCT, 18); err != nil { + if err := oprot.WriteFieldBegin(ctx, "jobSummaryResult", thrift.STRUCT, 18); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 18:jobSummaryResult: ", p), err) } - if err := p.JobSummaryResult_.Write(oprot); err != nil { + if err := p.JobSummaryResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobSummaryResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 18:jobSummaryResult: ", p), err) } } return err } -func (p *Result_) writeField20(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField20(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetConfigSummaryResult_() { - if err := oprot.WriteFieldBegin("configSummaryResult", thrift.STRUCT, 20); err != nil { + if err := oprot.WriteFieldBegin(ctx, "configSummaryResult", thrift.STRUCT, 20); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 20:configSummaryResult: ", p), err) } - if err := p.ConfigSummaryResult_.Write(oprot); err != nil { + if err := p.ConfigSummaryResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ConfigSummaryResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 20:configSummaryResult: ", p), err) } } return err } -func (p *Result_) writeField21(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField21(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetPendingReasonResult_() { - if err := oprot.WriteFieldBegin("getPendingReasonResult", thrift.STRUCT, 21); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getPendingReasonResult", thrift.STRUCT, 21); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 21:getPendingReasonResult: ", p), err) } - if err := p.GetPendingReasonResult_.Write(oprot); err != nil { + if err := p.GetPendingReasonResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetPendingReasonResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 21:getPendingReasonResult: ", p), err) } } return err } -func (p *Result_) writeField22(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField22(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetStartJobUpdateResult_() { - if err := oprot.WriteFieldBegin("startJobUpdateResult", thrift.STRUCT, 22); err != nil { + if err := oprot.WriteFieldBegin(ctx, "startJobUpdateResult", thrift.STRUCT, 22); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 22:startJobUpdateResult: ", p), err) } - if err := p.StartJobUpdateResult_.Write(oprot); err != nil { + if err := p.StartJobUpdateResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.StartJobUpdateResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 22:startJobUpdateResult: ", p), err) } } return err } -func (p *Result_) writeField23(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField23(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetJobUpdateSummariesResult_() { - if err := oprot.WriteFieldBegin("getJobUpdateSummariesResult", thrift.STRUCT, 23); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getJobUpdateSummariesResult", thrift.STRUCT, 23); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 23:getJobUpdateSummariesResult: ", p), err) } - if err := p.GetJobUpdateSummariesResult_.Write(oprot); err != nil { + if err := p.GetJobUpdateSummariesResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetJobUpdateSummariesResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 23:getJobUpdateSummariesResult: ", p), err) } } return err } -func (p *Result_) writeField24(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField24(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetJobUpdateDetailsResult_() { - if err := oprot.WriteFieldBegin("getJobUpdateDetailsResult", thrift.STRUCT, 24); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getJobUpdateDetailsResult", thrift.STRUCT, 24); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 24:getJobUpdateDetailsResult: ", p), err) } - if err := p.GetJobUpdateDetailsResult_.Write(oprot); err != nil { + if err := p.GetJobUpdateDetailsResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetJobUpdateDetailsResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 24:getJobUpdateDetailsResult: ", p), err) } } return err } -func (p *Result_) writeField25(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField25(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetPulseJobUpdateResult_() { - if err := oprot.WriteFieldBegin("pulseJobUpdateResult", thrift.STRUCT, 25); err != nil { + if err := oprot.WriteFieldBegin(ctx, "pulseJobUpdateResult", thrift.STRUCT, 25); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 25:pulseJobUpdateResult: ", p), err) } - if err := p.PulseJobUpdateResult_.Write(oprot); err != nil { + if err := p.PulseJobUpdateResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.PulseJobUpdateResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 25:pulseJobUpdateResult: ", p), err) } } return err } -func (p *Result_) writeField26(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField26(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetJobUpdateDiffResult_() { - if err := oprot.WriteFieldBegin("getJobUpdateDiffResult", thrift.STRUCT, 26); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getJobUpdateDiffResult", thrift.STRUCT, 26); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 26:getJobUpdateDiffResult: ", p), err) } - if err := p.GetJobUpdateDiffResult_.Write(oprot); err != nil { + if err := p.GetJobUpdateDiffResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetJobUpdateDiffResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 26:getJobUpdateDiffResult: ", p), err) } } return err } -func (p *Result_) writeField27(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField27(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetTierConfigResult_() { - if err := oprot.WriteFieldBegin("getTierConfigResult", thrift.STRUCT, 27); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getTierConfigResult", thrift.STRUCT, 27); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 27:getTierConfigResult: ", p), err) } - if err := p.GetTierConfigResult_.Write(oprot); err != nil { + if err := p.GetTierConfigResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetTierConfigResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 27:getTierConfigResult: ", p), err) } } return err } +func (p *Result_) Equals(other *Result_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.PopulateJobResult_.Equals(other.PopulateJobResult_) { return false } + if !p.ScheduleStatusResult_.Equals(other.ScheduleStatusResult_) { return false } + if !p.GetJobsResult_.Equals(other.GetJobsResult_) { return false } + if !p.GetQuotaResult_.Equals(other.GetQuotaResult_) { return false } + if !p.ListBackupsResult_.Equals(other.ListBackupsResult_) { return false } + if !p.StartMaintenanceResult_.Equals(other.StartMaintenanceResult_) { return false } + if !p.DrainHostsResult_.Equals(other.DrainHostsResult_) { return false } + if !p.QueryRecoveryResult_.Equals(other.QueryRecoveryResult_) { return false } + if !p.MaintenanceStatusResult_.Equals(other.MaintenanceStatusResult_) { return false } + if !p.EndMaintenanceResult_.Equals(other.EndMaintenanceResult_) { return false } + if !p.RoleSummaryResult_.Equals(other.RoleSummaryResult_) { return false } + if !p.JobSummaryResult_.Equals(other.JobSummaryResult_) { return false } + if !p.ConfigSummaryResult_.Equals(other.ConfigSummaryResult_) { return false } + if !p.GetPendingReasonResult_.Equals(other.GetPendingReasonResult_) { return false } + if !p.StartJobUpdateResult_.Equals(other.StartJobUpdateResult_) { return false } + if !p.GetJobUpdateSummariesResult_.Equals(other.GetJobUpdateSummariesResult_) { return false } + if !p.GetJobUpdateDetailsResult_.Equals(other.GetJobUpdateDetailsResult_) { return false } + if !p.PulseJobUpdateResult_.Equals(other.PulseJobUpdateResult_) { return false } + if !p.GetJobUpdateDiffResult_.Equals(other.GetJobUpdateDiffResult_) { return false } + if !p.GetTierConfigResult_.Equals(other.GetTierConfigResult_) { return false } + return true +} + func (p *Result_) String() string { if p == nil { return "" @@ -16340,14 +18443,14 @@ func NewResponseDetail() *ResponseDetail { func (p *ResponseDetail) GetMessage() string { return p.Message } -func (p *ResponseDetail) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ResponseDetail) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -16355,31 +18458,31 @@ func (p *ResponseDetail) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ResponseDetail) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ResponseDetail) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Message = v @@ -16387,29 +18490,39 @@ func (p *ResponseDetail) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *ResponseDetail) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ResponseDetail"); err != nil { +func (p *ResponseDetail) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ResponseDetail"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ResponseDetail) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 1); err != nil { +func (p *ResponseDetail) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "message", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:message: ", p), err) } - if err := oprot.WriteString(string(p.Message)); err != nil { + if err := oprot.WriteString(ctx, string(p.Message)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.message (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:message: ", p), err) } return err } +func (p *ResponseDetail) Equals(other *ResponseDetail) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Message != other.Message { return false } + return true +} + func (p *ResponseDetail) String() string { if p == nil { return "" @@ -16466,14 +18579,14 @@ func (p *Response) IsSetResult_() bool { return p.Result_ != nil } -func (p *Response) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Response) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -16481,61 +18594,61 @@ func (p *Response) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.LIST { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Response) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Response) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { temp := ResponseCode(v) @@ -16544,111 +18657,128 @@ func (p *Response) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Response) ReadField5(iprot thrift.TProtocol) error { +func (p *Response) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { p.ServerInfo = &ServerInfo{} - if err := p.ServerInfo.Read(iprot); err != nil { + if err := p.ServerInfo.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ServerInfo), err) } return nil } -func (p *Response) ReadField3(iprot thrift.TProtocol) error { +func (p *Response) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.Result_ = &Result_{} - if err := p.Result_.Read(iprot); err != nil { + if err := p.Result_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Result_), err) } return nil } -func (p *Response) ReadField6(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *Response) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*ResponseDetail, 0, size) p.Details = tSlice for i := 0; i < size; i ++ { - _elem51 := &ResponseDetail{} - if err := _elem51.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem51), err) + _elem101 := &ResponseDetail{} + if err := _elem101.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem101), err) } - p.Details = append(p.Details, _elem51) + p.Details = append(p.Details, _elem101) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *Response) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Response"); err != nil { +func (p *Response) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Response"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Response) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("responseCode", thrift.I32, 1); err != nil { +func (p *Response) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "responseCode", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:responseCode: ", p), err) } - if err := oprot.WriteI32(int32(p.ResponseCode)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.ResponseCode)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.responseCode (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:responseCode: ", p), err) } return err } -func (p *Response) writeField3(oprot thrift.TProtocol) (err error) { +func (p *Response) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetResult_() { - if err := oprot.WriteFieldBegin("result", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "result", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:result: ", p), err) } - if err := p.Result_.Write(oprot); err != nil { + if err := p.Result_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Result_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:result: ", p), err) } } return err } -func (p *Response) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("serverInfo", thrift.STRUCT, 5); err != nil { +func (p *Response) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "serverInfo", thrift.STRUCT, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:serverInfo: ", p), err) } - if err := p.ServerInfo.Write(oprot); err != nil { + if err := p.ServerInfo.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ServerInfo), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:serverInfo: ", p), err) } return err } -func (p *Response) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("details", thrift.LIST, 6); err != nil { +func (p *Response) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "details", thrift.LIST, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:details: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Details)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Details)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Details { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:details: ", p), err) } return err } +func (p *Response) Equals(other *Response) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.ResponseCode != other.ResponseCode { return false } + if !p.Result_.Equals(other.Result_) { return false } + if !p.ServerInfo.Equals(other.ServerInfo) { return false } + if len(p.Details) != len(other.Details) { return false } + for i, _tgt := range p.Details { + _src102 := other.Details[i] + if !_tgt.Equals(_src102) { return false } + } + return true +} + func (p *Response) String() string { if p == nil { return "" @@ -16677,14 +18807,14 @@ func (p *ExplicitReconciliationSettings) IsSetBatchSize() bool { return p.BatchSize != nil } -func (p *ExplicitReconciliationSettings) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ExplicitReconciliationSettings) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -16692,31 +18822,31 @@ func (p *ExplicitReconciliationSettings) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ExplicitReconciliationSettings) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *ExplicitReconciliationSettings) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.BatchSize = &v @@ -16724,31 +18854,46 @@ func (p *ExplicitReconciliationSettings) ReadField1(iprot thrift.TProtocol) err return nil } -func (p *ExplicitReconciliationSettings) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ExplicitReconciliationSettings"); err != nil { +func (p *ExplicitReconciliationSettings) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ExplicitReconciliationSettings"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ExplicitReconciliationSettings) writeField1(oprot thrift.TProtocol) (err error) { +func (p *ExplicitReconciliationSettings) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetBatchSize() { - if err := oprot.WriteFieldBegin("batchSize", thrift.I32, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "batchSize", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batchSize: ", p), err) } - if err := oprot.WriteI32(int32(*p.BatchSize)); err != nil { + if err := oprot.WriteI32(ctx, int32(*p.BatchSize)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.batchSize (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batchSize: ", p), err) } } return err } +func (p *ExplicitReconciliationSettings) Equals(other *ExplicitReconciliationSettings) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.BatchSize != other.BatchSize { + if p.BatchSize == nil || other.BatchSize == nil { + return false + } + if (*p.BatchSize) != (*other.BatchSize) { return false } + } + return true +} + func (p *ExplicitReconciliationSettings) String() string { if p == nil { return "" @@ -16823,6 +18968,7 @@ type ReadOnlyScheduler interface { type ReadOnlySchedulerClient struct { c thrift.TClient + meta thrift.ResponseMeta } func NewReadOnlySchedulerClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ReadOnlySchedulerClient { @@ -16846,14 +18992,26 @@ func NewReadOnlySchedulerClient(c thrift.TClient) *ReadOnlySchedulerClient { func (p *ReadOnlySchedulerClient) Client_() thrift.TClient { return p.c } + +func (p *ReadOnlySchedulerClient) LastResponseMeta_() thrift.ResponseMeta { + return p.meta +} + +func (p *ReadOnlySchedulerClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { + p.meta = meta +} + // Returns a summary of the jobs grouped by role. func (p *ReadOnlySchedulerClient) GetRoleSummary(ctx context.Context) (r *Response, err error) { - var _args52 ReadOnlySchedulerGetRoleSummaryArgs - var _result53 ReadOnlySchedulerGetRoleSummaryResult - if err = p.Client_().Call(ctx, "getRoleSummary", &_args52, &_result53); err != nil { + var _args103 ReadOnlySchedulerGetRoleSummaryArgs + var _result104 ReadOnlySchedulerGetRoleSummaryResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getRoleSummary", &_args103, &_result104) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result53.GetSuccess(), nil + return _result104.GetSuccess(), nil } // Returns a summary of jobs, optionally only those owned by a specific role. @@ -16861,13 +19019,16 @@ func (p *ReadOnlySchedulerClient) GetRoleSummary(ctx context.Context) (r *Respon // Parameters: // - Role func (p *ReadOnlySchedulerClient) GetJobSummary(ctx context.Context, role string) (r *Response, err error) { - var _args54 ReadOnlySchedulerGetJobSummaryArgs - _args54.Role = role - var _result55 ReadOnlySchedulerGetJobSummaryResult - if err = p.Client_().Call(ctx, "getJobSummary", &_args54, &_result55); err != nil { + var _args105 ReadOnlySchedulerGetJobSummaryArgs + _args105.Role = role + var _result106 ReadOnlySchedulerGetJobSummaryResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getJobSummary", &_args105, &_result106) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result55.GetSuccess(), nil + return _result106.GetSuccess(), nil } // Fetches the status of tasks. @@ -16875,13 +19036,16 @@ func (p *ReadOnlySchedulerClient) GetJobSummary(ctx context.Context, role string // Parameters: // - Query func (p *ReadOnlySchedulerClient) GetTasksStatus(ctx context.Context, query *TaskQuery) (r *Response, err error) { - var _args56 ReadOnlySchedulerGetTasksStatusArgs - _args56.Query = query - var _result57 ReadOnlySchedulerGetTasksStatusResult - if err = p.Client_().Call(ctx, "getTasksStatus", &_args56, &_result57); err != nil { + var _args107 ReadOnlySchedulerGetTasksStatusArgs + _args107.Query = query + var _result108 ReadOnlySchedulerGetTasksStatusResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getTasksStatus", &_args107, &_result108) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result57.GetSuccess(), nil + return _result108.GetSuccess(), nil } // Same as getTaskStatus but without the TaskConfig.ExecutorConfig data set. @@ -16890,13 +19054,16 @@ func (p *ReadOnlySchedulerClient) GetTasksStatus(ctx context.Context, query *Tas // Parameters: // - Query func (p *ReadOnlySchedulerClient) GetTasksWithoutConfigs(ctx context.Context, query *TaskQuery) (r *Response, err error) { - var _args58 ReadOnlySchedulerGetTasksWithoutConfigsArgs - _args58.Query = query - var _result59 ReadOnlySchedulerGetTasksWithoutConfigsResult - if err = p.Client_().Call(ctx, "getTasksWithoutConfigs", &_args58, &_result59); err != nil { + var _args109 ReadOnlySchedulerGetTasksWithoutConfigsArgs + _args109.Query = query + var _result110 ReadOnlySchedulerGetTasksWithoutConfigsResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getTasksWithoutConfigs", &_args109, &_result110) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result59.GetSuccess(), nil + return _result110.GetSuccess(), nil } // Returns user-friendly reasons (if available) for tasks retained in PENDING state. @@ -16904,13 +19071,16 @@ func (p *ReadOnlySchedulerClient) GetTasksWithoutConfigs(ctx context.Context, qu // Parameters: // - Query func (p *ReadOnlySchedulerClient) GetPendingReason(ctx context.Context, query *TaskQuery) (r *Response, err error) { - var _args60 ReadOnlySchedulerGetPendingReasonArgs - _args60.Query = query - var _result61 ReadOnlySchedulerGetPendingReasonResult - if err = p.Client_().Call(ctx, "getPendingReason", &_args60, &_result61); err != nil { + var _args111 ReadOnlySchedulerGetPendingReasonArgs + _args111.Query = query + var _result112 ReadOnlySchedulerGetPendingReasonResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getPendingReason", &_args111, &_result112) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result61.GetSuccess(), nil + return _result112.GetSuccess(), nil } // Fetches the configuration summary of active tasks for the specified job. @@ -16918,13 +19088,16 @@ func (p *ReadOnlySchedulerClient) GetPendingReason(ctx context.Context, query *T // Parameters: // - Job func (p *ReadOnlySchedulerClient) GetConfigSummary(ctx context.Context, job *JobKey) (r *Response, err error) { - var _args62 ReadOnlySchedulerGetConfigSummaryArgs - _args62.Job = job - var _result63 ReadOnlySchedulerGetConfigSummaryResult - if err = p.Client_().Call(ctx, "getConfigSummary", &_args62, &_result63); err != nil { + var _args113 ReadOnlySchedulerGetConfigSummaryArgs + _args113.Job = job + var _result114 ReadOnlySchedulerGetConfigSummaryResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getConfigSummary", &_args113, &_result114) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result63.GetSuccess(), nil + return _result114.GetSuccess(), nil } // Fetches the status of jobs. @@ -16933,13 +19106,16 @@ func (p *ReadOnlySchedulerClient) GetConfigSummary(ctx context.Context, job *Job // Parameters: // - OwnerRole func (p *ReadOnlySchedulerClient) GetJobs(ctx context.Context, ownerRole string) (r *Response, err error) { - var _args64 ReadOnlySchedulerGetJobsArgs - _args64.OwnerRole = ownerRole - var _result65 ReadOnlySchedulerGetJobsResult - if err = p.Client_().Call(ctx, "getJobs", &_args64, &_result65); err != nil { + var _args115 ReadOnlySchedulerGetJobsArgs + _args115.OwnerRole = ownerRole + var _result116 ReadOnlySchedulerGetJobsResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getJobs", &_args115, &_result116) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result65.GetSuccess(), nil + return _result116.GetSuccess(), nil } // Fetches the quota allocated for a user. @@ -16947,13 +19123,16 @@ func (p *ReadOnlySchedulerClient) GetJobs(ctx context.Context, ownerRole string) // Parameters: // - OwnerRole func (p *ReadOnlySchedulerClient) GetQuota(ctx context.Context, ownerRole string) (r *Response, err error) { - var _args66 ReadOnlySchedulerGetQuotaArgs - _args66.OwnerRole = ownerRole - var _result67 ReadOnlySchedulerGetQuotaResult - if err = p.Client_().Call(ctx, "getQuota", &_args66, &_result67); err != nil { + var _args117 ReadOnlySchedulerGetQuotaArgs + _args117.OwnerRole = ownerRole + var _result118 ReadOnlySchedulerGetQuotaResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getQuota", &_args117, &_result118) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result67.GetSuccess(), nil + return _result118.GetSuccess(), nil } // Populates fields in a job configuration as though it were about to be run. @@ -16962,13 +19141,16 @@ func (p *ReadOnlySchedulerClient) GetQuota(ctx context.Context, ownerRole string // Parameters: // - Description func (p *ReadOnlySchedulerClient) PopulateJobConfig(ctx context.Context, description *JobConfiguration) (r *Response, err error) { - var _args68 ReadOnlySchedulerPopulateJobConfigArgs - _args68.Description = description - var _result69 ReadOnlySchedulerPopulateJobConfigResult - if err = p.Client_().Call(ctx, "populateJobConfig", &_args68, &_result69); err != nil { + var _args119 ReadOnlySchedulerPopulateJobConfigArgs + _args119.Description = description + var _result120 ReadOnlySchedulerPopulateJobConfigResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "populateJobConfig", &_args119, &_result120) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result69.GetSuccess(), nil + return _result120.GetSuccess(), nil } // Gets job update summaries. @@ -16976,13 +19158,16 @@ func (p *ReadOnlySchedulerClient) PopulateJobConfig(ctx context.Context, descrip // Parameters: // - JobUpdateQuery func (p *ReadOnlySchedulerClient) GetJobUpdateSummaries(ctx context.Context, jobUpdateQuery *JobUpdateQuery) (r *Response, err error) { - var _args70 ReadOnlySchedulerGetJobUpdateSummariesArgs - _args70.JobUpdateQuery = jobUpdateQuery - var _result71 ReadOnlySchedulerGetJobUpdateSummariesResult - if err = p.Client_().Call(ctx, "getJobUpdateSummaries", &_args70, &_result71); err != nil { + var _args121 ReadOnlySchedulerGetJobUpdateSummariesArgs + _args121.JobUpdateQuery = jobUpdateQuery + var _result122 ReadOnlySchedulerGetJobUpdateSummariesResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getJobUpdateSummaries", &_args121, &_result122) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result71.GetSuccess(), nil + return _result122.GetSuccess(), nil } // Gets job update details. @@ -16990,13 +19175,16 @@ func (p *ReadOnlySchedulerClient) GetJobUpdateSummaries(ctx context.Context, job // Parameters: // - Query func (p *ReadOnlySchedulerClient) GetJobUpdateDetails(ctx context.Context, query *JobUpdateQuery) (r *Response, err error) { - var _args72 ReadOnlySchedulerGetJobUpdateDetailsArgs - _args72.Query = query - var _result73 ReadOnlySchedulerGetJobUpdateDetailsResult - if err = p.Client_().Call(ctx, "getJobUpdateDetails", &_args72, &_result73); err != nil { + var _args123 ReadOnlySchedulerGetJobUpdateDetailsArgs + _args123.Query = query + var _result124 ReadOnlySchedulerGetJobUpdateDetailsResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getJobUpdateDetails", &_args123, &_result124) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result73.GetSuccess(), nil + return _result124.GetSuccess(), nil } // Gets the diff between client (desired) and server (current) job states. @@ -17004,23 +19192,29 @@ func (p *ReadOnlySchedulerClient) GetJobUpdateDetails(ctx context.Context, query // Parameters: // - Request func (p *ReadOnlySchedulerClient) GetJobUpdateDiff(ctx context.Context, request *JobUpdateRequest) (r *Response, err error) { - var _args74 ReadOnlySchedulerGetJobUpdateDiffArgs - _args74.Request = request - var _result75 ReadOnlySchedulerGetJobUpdateDiffResult - if err = p.Client_().Call(ctx, "getJobUpdateDiff", &_args74, &_result75); err != nil { + var _args125 ReadOnlySchedulerGetJobUpdateDiffArgs + _args125.Request = request + var _result126 ReadOnlySchedulerGetJobUpdateDiffResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getJobUpdateDiff", &_args125, &_result126) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result75.GetSuccess(), nil + return _result126.GetSuccess(), nil } // Gets tier configurations. func (p *ReadOnlySchedulerClient) GetTierConfigs(ctx context.Context) (r *Response, err error) { - var _args76 ReadOnlySchedulerGetTierConfigsArgs - var _result77 ReadOnlySchedulerGetTierConfigsResult - if err = p.Client_().Call(ctx, "getTierConfigs", &_args76, &_result77); err != nil { + var _args127 ReadOnlySchedulerGetTierConfigsArgs + var _result128 ReadOnlySchedulerGetTierConfigsResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getTierConfigs", &_args127, &_result128) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result77.GetSuccess(), nil + return _result128.GetSuccess(), nil } type ReadOnlySchedulerProcessor struct { @@ -17043,37 +19237,37 @@ func (p *ReadOnlySchedulerProcessor) ProcessorMap() map[string]thrift.TProcessor func NewReadOnlySchedulerProcessor(handler ReadOnlyScheduler) *ReadOnlySchedulerProcessor { - self78 := &ReadOnlySchedulerProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} - self78.processorMap["getRoleSummary"] = &readOnlySchedulerProcessorGetRoleSummary{handler:handler} - self78.processorMap["getJobSummary"] = &readOnlySchedulerProcessorGetJobSummary{handler:handler} - self78.processorMap["getTasksStatus"] = &readOnlySchedulerProcessorGetTasksStatus{handler:handler} - self78.processorMap["getTasksWithoutConfigs"] = &readOnlySchedulerProcessorGetTasksWithoutConfigs{handler:handler} - self78.processorMap["getPendingReason"] = &readOnlySchedulerProcessorGetPendingReason{handler:handler} - self78.processorMap["getConfigSummary"] = &readOnlySchedulerProcessorGetConfigSummary{handler:handler} - self78.processorMap["getJobs"] = &readOnlySchedulerProcessorGetJobs{handler:handler} - self78.processorMap["getQuota"] = &readOnlySchedulerProcessorGetQuota{handler:handler} - self78.processorMap["populateJobConfig"] = &readOnlySchedulerProcessorPopulateJobConfig{handler:handler} - self78.processorMap["getJobUpdateSummaries"] = &readOnlySchedulerProcessorGetJobUpdateSummaries{handler:handler} - self78.processorMap["getJobUpdateDetails"] = &readOnlySchedulerProcessorGetJobUpdateDetails{handler:handler} - self78.processorMap["getJobUpdateDiff"] = &readOnlySchedulerProcessorGetJobUpdateDiff{handler:handler} - self78.processorMap["getTierConfigs"] = &readOnlySchedulerProcessorGetTierConfigs{handler:handler} -return self78 + self129 := &ReadOnlySchedulerProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} + self129.processorMap["getRoleSummary"] = &readOnlySchedulerProcessorGetRoleSummary{handler:handler} + self129.processorMap["getJobSummary"] = &readOnlySchedulerProcessorGetJobSummary{handler:handler} + self129.processorMap["getTasksStatus"] = &readOnlySchedulerProcessorGetTasksStatus{handler:handler} + self129.processorMap["getTasksWithoutConfigs"] = &readOnlySchedulerProcessorGetTasksWithoutConfigs{handler:handler} + self129.processorMap["getPendingReason"] = &readOnlySchedulerProcessorGetPendingReason{handler:handler} + self129.processorMap["getConfigSummary"] = &readOnlySchedulerProcessorGetConfigSummary{handler:handler} + self129.processorMap["getJobs"] = &readOnlySchedulerProcessorGetJobs{handler:handler} + self129.processorMap["getQuota"] = &readOnlySchedulerProcessorGetQuota{handler:handler} + self129.processorMap["populateJobConfig"] = &readOnlySchedulerProcessorPopulateJobConfig{handler:handler} + self129.processorMap["getJobUpdateSummaries"] = &readOnlySchedulerProcessorGetJobUpdateSummaries{handler:handler} + self129.processorMap["getJobUpdateDetails"] = &readOnlySchedulerProcessorGetJobUpdateDetails{handler:handler} + self129.processorMap["getJobUpdateDiff"] = &readOnlySchedulerProcessorGetJobUpdateDiff{handler:handler} + self129.processorMap["getTierConfigs"] = &readOnlySchedulerProcessorGetTierConfigs{handler:handler} +return self129 } func (p *ReadOnlySchedulerProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err := iprot.ReadMessageBegin() - if err != nil { return false, err } + name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) + if err2 != nil { return false, thrift.WrapTException(err2) } if processor, ok := p.GetProcessorFunction(name); ok { return processor.Process(ctx, seqId, iprot, oprot) } - iprot.Skip(thrift.STRUCT) - iprot.ReadMessageEnd() - x79 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) - oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) - x79.Write(oprot) - oprot.WriteMessageEnd() + iprot.Skip(ctx, thrift.STRUCT) + iprot.ReadMessageEnd(ctx) + x130 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) + oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) + x130.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, x79 + return false, x130 } @@ -17083,41 +19277,72 @@ type readOnlySchedulerProcessorGetRoleSummary struct { func (p *readOnlySchedulerProcessorGetRoleSummary) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetRoleSummaryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getRoleSummary", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getRoleSummary", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetRoleSummaryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetRoleSummary(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getRoleSummary: " + err2.Error()) - oprot.WriteMessageBegin("getRoleSummary", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getRoleSummary", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getRoleSummary", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getRoleSummary", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17131,41 +19356,72 @@ type readOnlySchedulerProcessorGetJobSummary struct { func (p *readOnlySchedulerProcessorGetJobSummary) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetJobSummaryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getJobSummary", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getJobSummary", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetJobSummaryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetJobSummary(ctx, args.Role); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobSummary: " + err2.Error()) - oprot.WriteMessageBegin("getJobSummary", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getJobSummary", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getJobSummary", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getJobSummary", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17179,41 +19435,72 @@ type readOnlySchedulerProcessorGetTasksStatus struct { func (p *readOnlySchedulerProcessorGetTasksStatus) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetTasksStatusArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTasksStatus", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getTasksStatus", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetTasksStatusResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetTasksStatus(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTasksStatus: " + err2.Error()) - oprot.WriteMessageBegin("getTasksStatus", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getTasksStatus", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getTasksStatus", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getTasksStatus", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17227,41 +19514,72 @@ type readOnlySchedulerProcessorGetTasksWithoutConfigs struct { func (p *readOnlySchedulerProcessorGetTasksWithoutConfigs) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetTasksWithoutConfigsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTasksWithoutConfigs", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getTasksWithoutConfigs", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetTasksWithoutConfigsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetTasksWithoutConfigs(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTasksWithoutConfigs: " + err2.Error()) - oprot.WriteMessageBegin("getTasksWithoutConfigs", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getTasksWithoutConfigs", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getTasksWithoutConfigs", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getTasksWithoutConfigs", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17275,41 +19593,72 @@ type readOnlySchedulerProcessorGetPendingReason struct { func (p *readOnlySchedulerProcessorGetPendingReason) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetPendingReasonArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getPendingReason", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getPendingReason", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetPendingReasonResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetPendingReason(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getPendingReason: " + err2.Error()) - oprot.WriteMessageBegin("getPendingReason", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getPendingReason", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getPendingReason", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getPendingReason", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17323,41 +19672,72 @@ type readOnlySchedulerProcessorGetConfigSummary struct { func (p *readOnlySchedulerProcessorGetConfigSummary) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetConfigSummaryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getConfigSummary", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getConfigSummary", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetConfigSummaryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetConfigSummary(ctx, args.Job); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getConfigSummary: " + err2.Error()) - oprot.WriteMessageBegin("getConfigSummary", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getConfigSummary", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getConfigSummary", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getConfigSummary", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17371,41 +19751,72 @@ type readOnlySchedulerProcessorGetJobs struct { func (p *readOnlySchedulerProcessorGetJobs) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetJobsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getJobs", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getJobs", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetJobsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetJobs(ctx, args.OwnerRole); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobs: " + err2.Error()) - oprot.WriteMessageBegin("getJobs", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getJobs", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getJobs", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getJobs", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17419,41 +19830,72 @@ type readOnlySchedulerProcessorGetQuota struct { func (p *readOnlySchedulerProcessorGetQuota) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetQuotaArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getQuota", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getQuota", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetQuotaResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetQuota(ctx, args.OwnerRole); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getQuota: " + err2.Error()) - oprot.WriteMessageBegin("getQuota", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getQuota", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getQuota", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getQuota", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17467,41 +19909,72 @@ type readOnlySchedulerProcessorPopulateJobConfig struct { func (p *readOnlySchedulerProcessorPopulateJobConfig) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerPopulateJobConfigArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("populateJobConfig", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "populateJobConfig", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerPopulateJobConfigResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.PopulateJobConfig(ctx, args.Description); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing populateJobConfig: " + err2.Error()) - oprot.WriteMessageBegin("populateJobConfig", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "populateJobConfig", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("populateJobConfig", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "populateJobConfig", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17515,41 +19988,72 @@ type readOnlySchedulerProcessorGetJobUpdateSummaries struct { func (p *readOnlySchedulerProcessorGetJobUpdateSummaries) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetJobUpdateSummariesArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getJobUpdateSummaries", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getJobUpdateSummaries", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetJobUpdateSummariesResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetJobUpdateSummaries(ctx, args.JobUpdateQuery); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobUpdateSummaries: " + err2.Error()) - oprot.WriteMessageBegin("getJobUpdateSummaries", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getJobUpdateSummaries", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getJobUpdateSummaries", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getJobUpdateSummaries", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17563,41 +20067,72 @@ type readOnlySchedulerProcessorGetJobUpdateDetails struct { func (p *readOnlySchedulerProcessorGetJobUpdateDetails) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetJobUpdateDetailsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getJobUpdateDetails", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getJobUpdateDetails", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetJobUpdateDetailsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetJobUpdateDetails(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobUpdateDetails: " + err2.Error()) - oprot.WriteMessageBegin("getJobUpdateDetails", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getJobUpdateDetails", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getJobUpdateDetails", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getJobUpdateDetails", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17611,41 +20146,72 @@ type readOnlySchedulerProcessorGetJobUpdateDiff struct { func (p *readOnlySchedulerProcessorGetJobUpdateDiff) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetJobUpdateDiffArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getJobUpdateDiff", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getJobUpdateDiff", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetJobUpdateDiffResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetJobUpdateDiff(ctx, args.Request); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobUpdateDiff: " + err2.Error()) - oprot.WriteMessageBegin("getJobUpdateDiff", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getJobUpdateDiff", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getJobUpdateDiff", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getJobUpdateDiff", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17659,41 +20225,72 @@ type readOnlySchedulerProcessorGetTierConfigs struct { func (p *readOnlySchedulerProcessorGetTierConfigs) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetTierConfigsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTierConfigs", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getTierConfigs", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetTierConfigsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetTierConfigs(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTierConfigs: " + err2.Error()) - oprot.WriteMessageBegin("getTierConfigs", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getTierConfigs", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getTierConfigs", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getTierConfigs", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17711,39 +20308,39 @@ func NewReadOnlySchedulerGetRoleSummaryArgs() *ReadOnlySchedulerGetRoleSummaryAr return &ReadOnlySchedulerGetRoleSummaryArgs{} } -func (p *ReadOnlySchedulerGetRoleSummaryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetRoleSummaryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetRoleSummaryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getRoleSummary_args"); err != nil { +func (p *ReadOnlySchedulerGetRoleSummaryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getRoleSummary_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -17776,14 +20373,14 @@ func (p *ReadOnlySchedulerGetRoleSummaryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetRoleSummaryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetRoleSummaryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -17791,58 +20388,58 @@ func (p *ReadOnlySchedulerGetRoleSummaryResult) Read(iprot thrift.TProtocol) err switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetRoleSummaryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetRoleSummaryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetRoleSummaryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getRoleSummary_result"); err != nil { +func (p *ReadOnlySchedulerGetRoleSummaryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getRoleSummary_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetRoleSummaryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetRoleSummaryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -17869,14 +20466,14 @@ func NewReadOnlySchedulerGetJobSummaryArgs() *ReadOnlySchedulerGetJobSummaryArgs func (p *ReadOnlySchedulerGetJobSummaryArgs) GetRole() string { return p.Role } -func (p *ReadOnlySchedulerGetJobSummaryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobSummaryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -17884,31 +20481,31 @@ func (p *ReadOnlySchedulerGetJobSummaryArgs) Read(iprot thrift.TProtocol) error switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobSummaryArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ReadOnlySchedulerGetJobSummaryArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Role = v @@ -17916,25 +20513,25 @@ func (p *ReadOnlySchedulerGetJobSummaryArgs) ReadField1(iprot thrift.TProtocol) return nil } -func (p *ReadOnlySchedulerGetJobSummaryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobSummary_args"); err != nil { +func (p *ReadOnlySchedulerGetJobSummaryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobSummary_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobSummaryArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("role", thrift.STRING, 1); err != nil { +func (p *ReadOnlySchedulerGetJobSummaryArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "role", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:role: ", p), err) } - if err := oprot.WriteString(string(p.Role)); err != nil { + if err := oprot.WriteString(ctx, string(p.Role)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.role (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:role: ", p), err) } return err } @@ -17967,14 +20564,14 @@ func (p *ReadOnlySchedulerGetJobSummaryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetJobSummaryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobSummaryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -17982,58 +20579,58 @@ func (p *ReadOnlySchedulerGetJobSummaryResult) Read(iprot thrift.TProtocol) erro switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobSummaryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobSummaryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetJobSummaryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobSummary_result"); err != nil { +func (p *ReadOnlySchedulerGetJobSummaryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobSummary_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobSummaryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetJobSummaryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -18067,14 +20664,14 @@ func (p *ReadOnlySchedulerGetTasksStatusArgs) IsSetQuery() bool { return p.Query != nil } -func (p *ReadOnlySchedulerGetTasksStatusArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetTasksStatusArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18082,57 +20679,57 @@ func (p *ReadOnlySchedulerGetTasksStatusArgs) Read(iprot thrift.TProtocol) error switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetTasksStatusArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetTasksStatusArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &TaskQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *ReadOnlySchedulerGetTasksStatusArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTasksStatus_args"); err != nil { +func (p *ReadOnlySchedulerGetTasksStatusArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getTasksStatus_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetTasksStatusArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerGetTasksStatusArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) } return err } @@ -18165,14 +20762,14 @@ func (p *ReadOnlySchedulerGetTasksStatusResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetTasksStatusResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetTasksStatusResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18180,58 +20777,58 @@ func (p *ReadOnlySchedulerGetTasksStatusResult) Read(iprot thrift.TProtocol) err switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetTasksStatusResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetTasksStatusResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetTasksStatusResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTasksStatus_result"); err != nil { +func (p *ReadOnlySchedulerGetTasksStatusResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getTasksStatus_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetTasksStatusResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetTasksStatusResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -18265,14 +20862,14 @@ func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) IsSetQuery() bool { return p.Query != nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18280,57 +20877,57 @@ func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) Read(iprot thrift.TProtoco switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &TaskQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTasksWithoutConfigs_args"); err != nil { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getTasksWithoutConfigs_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) } return err } @@ -18363,14 +20960,14 @@ func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18378,58 +20975,58 @@ func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) Read(iprot thrift.TProto switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTasksWithoutConfigs_result"); err != nil { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getTasksWithoutConfigs_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -18463,14 +21060,14 @@ func (p *ReadOnlySchedulerGetPendingReasonArgs) IsSetQuery() bool { return p.Query != nil } -func (p *ReadOnlySchedulerGetPendingReasonArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetPendingReasonArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18478,57 +21075,57 @@ func (p *ReadOnlySchedulerGetPendingReasonArgs) Read(iprot thrift.TProtocol) err switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetPendingReasonArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetPendingReasonArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &TaskQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *ReadOnlySchedulerGetPendingReasonArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getPendingReason_args"); err != nil { +func (p *ReadOnlySchedulerGetPendingReasonArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getPendingReason_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetPendingReasonArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerGetPendingReasonArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) } return err } @@ -18561,14 +21158,14 @@ func (p *ReadOnlySchedulerGetPendingReasonResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetPendingReasonResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetPendingReasonResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18576,58 +21173,58 @@ func (p *ReadOnlySchedulerGetPendingReasonResult) Read(iprot thrift.TProtocol) e switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetPendingReasonResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetPendingReasonResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetPendingReasonResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getPendingReason_result"); err != nil { +func (p *ReadOnlySchedulerGetPendingReasonResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getPendingReason_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetPendingReasonResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetPendingReasonResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -18661,14 +21258,14 @@ func (p *ReadOnlySchedulerGetConfigSummaryArgs) IsSetJob() bool { return p.Job != nil } -func (p *ReadOnlySchedulerGetConfigSummaryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetConfigSummaryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18676,57 +21273,57 @@ func (p *ReadOnlySchedulerGetConfigSummaryArgs) Read(iprot thrift.TProtocol) err switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetConfigSummaryArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetConfigSummaryArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *ReadOnlySchedulerGetConfigSummaryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getConfigSummary_args"); err != nil { +func (p *ReadOnlySchedulerGetConfigSummaryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getConfigSummary_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetConfigSummaryArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerGetConfigSummaryArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "job", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:job: ", p), err) } - if err := p.Job.Write(oprot); err != nil { + if err := p.Job.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:job: ", p), err) } return err } @@ -18759,14 +21356,14 @@ func (p *ReadOnlySchedulerGetConfigSummaryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetConfigSummaryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetConfigSummaryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18774,58 +21371,58 @@ func (p *ReadOnlySchedulerGetConfigSummaryResult) Read(iprot thrift.TProtocol) e switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetConfigSummaryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetConfigSummaryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetConfigSummaryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getConfigSummary_result"); err != nil { +func (p *ReadOnlySchedulerGetConfigSummaryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getConfigSummary_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetConfigSummaryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetConfigSummaryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -18852,14 +21449,14 @@ func NewReadOnlySchedulerGetJobsArgs() *ReadOnlySchedulerGetJobsArgs { func (p *ReadOnlySchedulerGetJobsArgs) GetOwnerRole() string { return p.OwnerRole } -func (p *ReadOnlySchedulerGetJobsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18867,31 +21464,31 @@ func (p *ReadOnlySchedulerGetJobsArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobsArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ReadOnlySchedulerGetJobsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.OwnerRole = v @@ -18899,25 +21496,25 @@ func (p *ReadOnlySchedulerGetJobsArgs) ReadField1(iprot thrift.TProtocol) error return nil } -func (p *ReadOnlySchedulerGetJobsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobs_args"); err != nil { +func (p *ReadOnlySchedulerGetJobsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobs_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ownerRole", thrift.STRING, 1); err != nil { +func (p *ReadOnlySchedulerGetJobsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "ownerRole", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ownerRole: ", p), err) } - if err := oprot.WriteString(string(p.OwnerRole)); err != nil { + if err := oprot.WriteString(ctx, string(p.OwnerRole)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ownerRole (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ownerRole: ", p), err) } return err } @@ -18950,14 +21547,14 @@ func (p *ReadOnlySchedulerGetJobsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetJobsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18965,58 +21562,58 @@ func (p *ReadOnlySchedulerGetJobsResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetJobsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobs_result"); err != nil { +func (p *ReadOnlySchedulerGetJobsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobs_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetJobsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -19043,14 +21640,14 @@ func NewReadOnlySchedulerGetQuotaArgs() *ReadOnlySchedulerGetQuotaArgs { func (p *ReadOnlySchedulerGetQuotaArgs) GetOwnerRole() string { return p.OwnerRole } -func (p *ReadOnlySchedulerGetQuotaArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetQuotaArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19058,31 +21655,31 @@ func (p *ReadOnlySchedulerGetQuotaArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetQuotaArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ReadOnlySchedulerGetQuotaArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.OwnerRole = v @@ -19090,25 +21687,25 @@ func (p *ReadOnlySchedulerGetQuotaArgs) ReadField1(iprot thrift.TProtocol) erro return nil } -func (p *ReadOnlySchedulerGetQuotaArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getQuota_args"); err != nil { +func (p *ReadOnlySchedulerGetQuotaArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getQuota_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetQuotaArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ownerRole", thrift.STRING, 1); err != nil { +func (p *ReadOnlySchedulerGetQuotaArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "ownerRole", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ownerRole: ", p), err) } - if err := oprot.WriteString(string(p.OwnerRole)); err != nil { + if err := oprot.WriteString(ctx, string(p.OwnerRole)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ownerRole (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ownerRole: ", p), err) } return err } @@ -19141,14 +21738,14 @@ func (p *ReadOnlySchedulerGetQuotaResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetQuotaResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetQuotaResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19156,58 +21753,58 @@ func (p *ReadOnlySchedulerGetQuotaResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetQuotaResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetQuotaResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetQuotaResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getQuota_result"); err != nil { +func (p *ReadOnlySchedulerGetQuotaResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getQuota_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetQuotaResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetQuotaResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -19241,14 +21838,14 @@ func (p *ReadOnlySchedulerPopulateJobConfigArgs) IsSetDescription() bool { return p.Description != nil } -func (p *ReadOnlySchedulerPopulateJobConfigArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerPopulateJobConfigArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19256,57 +21853,57 @@ func (p *ReadOnlySchedulerPopulateJobConfigArgs) Read(iprot thrift.TProtocol) er switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerPopulateJobConfigArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerPopulateJobConfigArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Description = &JobConfiguration{} - if err := p.Description.Read(iprot); err != nil { + if err := p.Description.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Description), err) } return nil } -func (p *ReadOnlySchedulerPopulateJobConfigArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("populateJobConfig_args"); err != nil { +func (p *ReadOnlySchedulerPopulateJobConfigArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "populateJobConfig_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerPopulateJobConfigArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("description", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerPopulateJobConfigArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "description", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:description: ", p), err) } - if err := p.Description.Write(oprot); err != nil { + if err := p.Description.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Description), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:description: ", p), err) } return err } @@ -19339,14 +21936,14 @@ func (p *ReadOnlySchedulerPopulateJobConfigResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerPopulateJobConfigResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerPopulateJobConfigResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19354,58 +21951,58 @@ func (p *ReadOnlySchedulerPopulateJobConfigResult) Read(iprot thrift.TProtocol) switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerPopulateJobConfigResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerPopulateJobConfigResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerPopulateJobConfigResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("populateJobConfig_result"); err != nil { +func (p *ReadOnlySchedulerPopulateJobConfigResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "populateJobConfig_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerPopulateJobConfigResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerPopulateJobConfigResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -19439,14 +22036,14 @@ func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) IsSetJobUpdateQuery() bool return p.JobUpdateQuery != nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19454,57 +22051,57 @@ func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) Read(iprot thrift.TProtocol switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.JobUpdateQuery = &JobUpdateQuery{} - if err := p.JobUpdateQuery.Read(iprot); err != nil { + if err := p.JobUpdateQuery.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.JobUpdateQuery), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobUpdateSummaries_args"); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobUpdateSummaries_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("jobUpdateQuery", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "jobUpdateQuery", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:jobUpdateQuery: ", p), err) } - if err := p.JobUpdateQuery.Write(oprot); err != nil { + if err := p.JobUpdateQuery.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobUpdateQuery), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:jobUpdateQuery: ", p), err) } return err } @@ -19537,14 +22134,14 @@ func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19552,58 +22149,58 @@ func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) Read(iprot thrift.TProtoc switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobUpdateSummaries_result"); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobUpdateSummaries_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -19638,14 +22235,14 @@ func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) IsSetQuery() bool { return p.Query != nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19653,57 +22250,57 @@ func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) Read(iprot thrift.TProtocol) switch fieldId { case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) ReadField2(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &JobUpdateQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobUpdateDetails_args"); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobUpdateDetails_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 2); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:query: ", p), err) } return err } @@ -19736,14 +22333,14 @@ func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19751,58 +22348,58 @@ func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) Read(iprot thrift.TProtocol switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobUpdateDetails_result"); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobUpdateDetails_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -19836,14 +22433,14 @@ func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) IsSetRequest() bool { return p.Request != nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19851,57 +22448,57 @@ func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) Read(iprot thrift.TProtocol) err switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Request = &JobUpdateRequest{} - if err := p.Request.Read(iprot); err != nil { + if err := p.Request.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Request), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobUpdateDiff_args"); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobUpdateDiff_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "request", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:request: ", p), err) } - if err := p.Request.Write(oprot); err != nil { + if err := p.Request.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Request), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:request: ", p), err) } return err } @@ -19934,14 +22531,14 @@ func (p *ReadOnlySchedulerGetJobUpdateDiffResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19949,58 +22546,58 @@ func (p *ReadOnlySchedulerGetJobUpdateDiffResult) Read(iprot thrift.TProtocol) e switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobUpdateDiff_result"); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobUpdateDiff_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -20020,39 +22617,39 @@ func NewReadOnlySchedulerGetTierConfigsArgs() *ReadOnlySchedulerGetTierConfigsAr return &ReadOnlySchedulerGetTierConfigsArgs{} } -func (p *ReadOnlySchedulerGetTierConfigsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetTierConfigsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetTierConfigsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTierConfigs_args"); err != nil { +func (p *ReadOnlySchedulerGetTierConfigsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getTierConfigs_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -20085,14 +22682,14 @@ func (p *ReadOnlySchedulerGetTierConfigsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetTierConfigsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetTierConfigsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -20100,58 +22697,58 @@ func (p *ReadOnlySchedulerGetTierConfigsResult) Read(iprot thrift.TProtocol) err switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetTierConfigsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetTierConfigsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetTierConfigsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTierConfigs_result"); err != nil { +func (p *ReadOnlySchedulerGetTierConfigsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getTierConfigs_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetTierConfigsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetTierConfigsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -20280,13 +22877,16 @@ func NewAuroraSchedulerManagerClient(c thrift.TClient) *AuroraSchedulerManagerCl // Parameters: // - Description func (p *AuroraSchedulerManagerClient) CreateJob(ctx context.Context, description *JobConfiguration) (r *Response, err error) { - var _args131 AuroraSchedulerManagerCreateJobArgs - _args131.Description = description - var _result132 AuroraSchedulerManagerCreateJobResult - if err = p.Client_().Call(ctx, "createJob", &_args131, &_result132); err != nil { + var _args182 AuroraSchedulerManagerCreateJobArgs + _args182.Description = description + var _result183 AuroraSchedulerManagerCreateJobResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "createJob", &_args182, &_result183) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result132.GetSuccess(), nil + return _result183.GetSuccess(), nil } // Enters a job into the cron schedule, without actually starting the job. @@ -20296,13 +22896,16 @@ func (p *AuroraSchedulerManagerClient) CreateJob(ctx context.Context, descriptio // Parameters: // - Description func (p *AuroraSchedulerManagerClient) ScheduleCronJob(ctx context.Context, description *JobConfiguration) (r *Response, err error) { - var _args133 AuroraSchedulerManagerScheduleCronJobArgs - _args133.Description = description - var _result134 AuroraSchedulerManagerScheduleCronJobResult - if err = p.Client_().Call(ctx, "scheduleCronJob", &_args133, &_result134); err != nil { + var _args184 AuroraSchedulerManagerScheduleCronJobArgs + _args184.Description = description + var _result185 AuroraSchedulerManagerScheduleCronJobResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "scheduleCronJob", &_args184, &_result185) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result134.GetSuccess(), nil + return _result185.GetSuccess(), nil } // Removes a job from the cron schedule. The request will be denied if the job was not previously @@ -20311,13 +22914,16 @@ func (p *AuroraSchedulerManagerClient) ScheduleCronJob(ctx context.Context, desc // Parameters: // - Job func (p *AuroraSchedulerManagerClient) DescheduleCronJob(ctx context.Context, job *JobKey) (r *Response, err error) { - var _args135 AuroraSchedulerManagerDescheduleCronJobArgs - _args135.Job = job - var _result136 AuroraSchedulerManagerDescheduleCronJobResult - if err = p.Client_().Call(ctx, "descheduleCronJob", &_args135, &_result136); err != nil { + var _args186 AuroraSchedulerManagerDescheduleCronJobArgs + _args186.Job = job + var _result187 AuroraSchedulerManagerDescheduleCronJobResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "descheduleCronJob", &_args186, &_result187) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result136.GetSuccess(), nil + return _result187.GetSuccess(), nil } // Starts a cron job immediately. The request will be denied if the specified job does not @@ -20326,13 +22932,16 @@ func (p *AuroraSchedulerManagerClient) DescheduleCronJob(ctx context.Context, jo // Parameters: // - Job func (p *AuroraSchedulerManagerClient) StartCronJob(ctx context.Context, job *JobKey) (r *Response, err error) { - var _args137 AuroraSchedulerManagerStartCronJobArgs - _args137.Job = job - var _result138 AuroraSchedulerManagerStartCronJobResult - if err = p.Client_().Call(ctx, "startCronJob", &_args137, &_result138); err != nil { + var _args188 AuroraSchedulerManagerStartCronJobArgs + _args188.Job = job + var _result189 AuroraSchedulerManagerStartCronJobResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "startCronJob", &_args188, &_result189) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result138.GetSuccess(), nil + return _result189.GetSuccess(), nil } // Restarts a batch of shards. @@ -20341,14 +22950,17 @@ func (p *AuroraSchedulerManagerClient) StartCronJob(ctx context.Context, job *Jo // - Job // - ShardIds func (p *AuroraSchedulerManagerClient) RestartShards(ctx context.Context, job *JobKey, shardIds []int32) (r *Response, err error) { - var _args139 AuroraSchedulerManagerRestartShardsArgs - _args139.Job = job - _args139.ShardIds = shardIds - var _result140 AuroraSchedulerManagerRestartShardsResult - if err = p.Client_().Call(ctx, "restartShards", &_args139, &_result140); err != nil { + var _args190 AuroraSchedulerManagerRestartShardsArgs + _args190.Job = job + _args190.ShardIds = shardIds + var _result191 AuroraSchedulerManagerRestartShardsResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "restartShards", &_args190, &_result191) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result140.GetSuccess(), nil + return _result191.GetSuccess(), nil } // Initiates a kill on tasks. @@ -20358,15 +22970,18 @@ func (p *AuroraSchedulerManagerClient) RestartShards(ctx context.Context, job *J // - Instances // - Message func (p *AuroraSchedulerManagerClient) KillTasks(ctx context.Context, job *JobKey, instances []int32, message string) (r *Response, err error) { - var _args141 AuroraSchedulerManagerKillTasksArgs - _args141.Job = job - _args141.Instances = instances - _args141.Message = message - var _result142 AuroraSchedulerManagerKillTasksResult - if err = p.Client_().Call(ctx, "killTasks", &_args141, &_result142); err != nil { + var _args192 AuroraSchedulerManagerKillTasksArgs + _args192.Job = job + _args192.Instances = instances + _args192.Message = message + var _result193 AuroraSchedulerManagerKillTasksResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "killTasks", &_args192, &_result193) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result142.GetSuccess(), nil + return _result193.GetSuccess(), nil } // Adds new instances with the TaskConfig of the existing instance pointed by the key. @@ -20375,14 +22990,17 @@ func (p *AuroraSchedulerManagerClient) KillTasks(ctx context.Context, job *JobKe // - Key // - Count func (p *AuroraSchedulerManagerClient) AddInstances(ctx context.Context, key *InstanceKey, count int32) (r *Response, err error) { - var _args143 AuroraSchedulerManagerAddInstancesArgs - _args143.Key = key - _args143.Count = count - var _result144 AuroraSchedulerManagerAddInstancesResult - if err = p.Client_().Call(ctx, "addInstances", &_args143, &_result144); err != nil { + var _args194 AuroraSchedulerManagerAddInstancesArgs + _args194.Key = key + _args194.Count = count + var _result195 AuroraSchedulerManagerAddInstancesResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "addInstances", &_args194, &_result195) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result144.GetSuccess(), nil + return _result195.GetSuccess(), nil } // Replaces the template (configuration) for the existing cron job. @@ -20391,13 +23009,16 @@ func (p *AuroraSchedulerManagerClient) AddInstances(ctx context.Context, key *In // Parameters: // - Config func (p *AuroraSchedulerManagerClient) ReplaceCronTemplate(ctx context.Context, config *JobConfiguration) (r *Response, err error) { - var _args145 AuroraSchedulerManagerReplaceCronTemplateArgs - _args145.Config = config - var _result146 AuroraSchedulerManagerReplaceCronTemplateResult - if err = p.Client_().Call(ctx, "replaceCronTemplate", &_args145, &_result146); err != nil { + var _args196 AuroraSchedulerManagerReplaceCronTemplateArgs + _args196.Config = config + var _result197 AuroraSchedulerManagerReplaceCronTemplateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "replaceCronTemplate", &_args196, &_result197) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result146.GetSuccess(), nil + return _result197.GetSuccess(), nil } // Starts update of the existing service job. @@ -20406,14 +23027,17 @@ func (p *AuroraSchedulerManagerClient) ReplaceCronTemplate(ctx context.Context, // - Request: A description of how to change the job. // - Message: A user-specified message to include with the induced job update state change. func (p *AuroraSchedulerManagerClient) StartJobUpdate(ctx context.Context, request *JobUpdateRequest, message string) (r *Response, err error) { - var _args147 AuroraSchedulerManagerStartJobUpdateArgs - _args147.Request = request - _args147.Message = message - var _result148 AuroraSchedulerManagerStartJobUpdateResult - if err = p.Client_().Call(ctx, "startJobUpdate", &_args147, &_result148); err != nil { + var _args198 AuroraSchedulerManagerStartJobUpdateArgs + _args198.Request = request + _args198.Message = message + var _result199 AuroraSchedulerManagerStartJobUpdateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "startJobUpdate", &_args198, &_result199) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result148.GetSuccess(), nil + return _result199.GetSuccess(), nil } // Pauses the specified job update. Can be resumed by resumeUpdate call. @@ -20422,14 +23046,17 @@ func (p *AuroraSchedulerManagerClient) StartJobUpdate(ctx context.Context, reque // - Key: The update to pause. // - Message: A user-specified message to include with the induced job update state change. func (p *AuroraSchedulerManagerClient) PauseJobUpdate(ctx context.Context, key *JobUpdateKey, message string) (r *Response, err error) { - var _args149 AuroraSchedulerManagerPauseJobUpdateArgs - _args149.Key = key - _args149.Message = message - var _result150 AuroraSchedulerManagerPauseJobUpdateResult - if err = p.Client_().Call(ctx, "pauseJobUpdate", &_args149, &_result150); err != nil { + var _args200 AuroraSchedulerManagerPauseJobUpdateArgs + _args200.Key = key + _args200.Message = message + var _result201 AuroraSchedulerManagerPauseJobUpdateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "pauseJobUpdate", &_args200, &_result201) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result150.GetSuccess(), nil + return _result201.GetSuccess(), nil } // Resumes progress of a previously paused job update. @@ -20438,14 +23065,17 @@ func (p *AuroraSchedulerManagerClient) PauseJobUpdate(ctx context.Context, key * // - Key: The update to resume. // - Message: A user-specified message to include with the induced job update state change. func (p *AuroraSchedulerManagerClient) ResumeJobUpdate(ctx context.Context, key *JobUpdateKey, message string) (r *Response, err error) { - var _args151 AuroraSchedulerManagerResumeJobUpdateArgs - _args151.Key = key - _args151.Message = message - var _result152 AuroraSchedulerManagerResumeJobUpdateResult - if err = p.Client_().Call(ctx, "resumeJobUpdate", &_args151, &_result152); err != nil { + var _args202 AuroraSchedulerManagerResumeJobUpdateArgs + _args202.Key = key + _args202.Message = message + var _result203 AuroraSchedulerManagerResumeJobUpdateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "resumeJobUpdate", &_args202, &_result203) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result152.GetSuccess(), nil + return _result203.GetSuccess(), nil } // Permanently aborts the job update. Does not remove the update history. @@ -20454,14 +23084,17 @@ func (p *AuroraSchedulerManagerClient) ResumeJobUpdate(ctx context.Context, key // - Key: The update to abort. // - Message: A user-specified message to include with the induced job update state change. func (p *AuroraSchedulerManagerClient) AbortJobUpdate(ctx context.Context, key *JobUpdateKey, message string) (r *Response, err error) { - var _args153 AuroraSchedulerManagerAbortJobUpdateArgs - _args153.Key = key - _args153.Message = message - var _result154 AuroraSchedulerManagerAbortJobUpdateResult - if err = p.Client_().Call(ctx, "abortJobUpdate", &_args153, &_result154); err != nil { + var _args204 AuroraSchedulerManagerAbortJobUpdateArgs + _args204.Key = key + _args204.Message = message + var _result205 AuroraSchedulerManagerAbortJobUpdateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "abortJobUpdate", &_args204, &_result205) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result154.GetSuccess(), nil + return _result205.GetSuccess(), nil } // Rollbacks the specified active job update to the initial state. @@ -20470,14 +23103,17 @@ func (p *AuroraSchedulerManagerClient) AbortJobUpdate(ctx context.Context, key * // - Key: The update to rollback. // - Message: A user-specified message to include with the induced job update state change. func (p *AuroraSchedulerManagerClient) RollbackJobUpdate(ctx context.Context, key *JobUpdateKey, message string) (r *Response, err error) { - var _args155 AuroraSchedulerManagerRollbackJobUpdateArgs - _args155.Key = key - _args155.Message = message - var _result156 AuroraSchedulerManagerRollbackJobUpdateResult - if err = p.Client_().Call(ctx, "rollbackJobUpdate", &_args155, &_result156); err != nil { + var _args206 AuroraSchedulerManagerRollbackJobUpdateArgs + _args206.Key = key + _args206.Message = message + var _result207 AuroraSchedulerManagerRollbackJobUpdateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "rollbackJobUpdate", &_args206, &_result207) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result156.GetSuccess(), nil + return _result207.GetSuccess(), nil } // Allows progress of the job update in case blockIfNoPulsesAfterMs is specified in @@ -20487,13 +23123,16 @@ func (p *AuroraSchedulerManagerClient) RollbackJobUpdate(ctx context.Context, ke // Parameters: // - Key func (p *AuroraSchedulerManagerClient) PulseJobUpdate(ctx context.Context, key *JobUpdateKey) (r *Response, err error) { - var _args157 AuroraSchedulerManagerPulseJobUpdateArgs - _args157.Key = key - var _result158 AuroraSchedulerManagerPulseJobUpdateResult - if err = p.Client_().Call(ctx, "pulseJobUpdate", &_args157, &_result158); err != nil { + var _args208 AuroraSchedulerManagerPulseJobUpdateArgs + _args208.Key = key + var _result209 AuroraSchedulerManagerPulseJobUpdateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "pulseJobUpdate", &_args208, &_result209) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result158.GetSuccess(), nil + return _result209.GetSuccess(), nil } type AuroraSchedulerManagerProcessor struct { @@ -20501,22 +23140,22 @@ type AuroraSchedulerManagerProcessor struct { } func NewAuroraSchedulerManagerProcessor(handler AuroraSchedulerManager) *AuroraSchedulerManagerProcessor { - self159 := &AuroraSchedulerManagerProcessor{NewReadOnlySchedulerProcessor(handler)} - self159.AddToProcessorMap("createJob", &auroraSchedulerManagerProcessorCreateJob{handler:handler}) - self159.AddToProcessorMap("scheduleCronJob", &auroraSchedulerManagerProcessorScheduleCronJob{handler:handler}) - self159.AddToProcessorMap("descheduleCronJob", &auroraSchedulerManagerProcessorDescheduleCronJob{handler:handler}) - self159.AddToProcessorMap("startCronJob", &auroraSchedulerManagerProcessorStartCronJob{handler:handler}) - self159.AddToProcessorMap("restartShards", &auroraSchedulerManagerProcessorRestartShards{handler:handler}) - self159.AddToProcessorMap("killTasks", &auroraSchedulerManagerProcessorKillTasks{handler:handler}) - self159.AddToProcessorMap("addInstances", &auroraSchedulerManagerProcessorAddInstances{handler:handler}) - self159.AddToProcessorMap("replaceCronTemplate", &auroraSchedulerManagerProcessorReplaceCronTemplate{handler:handler}) - self159.AddToProcessorMap("startJobUpdate", &auroraSchedulerManagerProcessorStartJobUpdate{handler:handler}) - self159.AddToProcessorMap("pauseJobUpdate", &auroraSchedulerManagerProcessorPauseJobUpdate{handler:handler}) - self159.AddToProcessorMap("resumeJobUpdate", &auroraSchedulerManagerProcessorResumeJobUpdate{handler:handler}) - self159.AddToProcessorMap("abortJobUpdate", &auroraSchedulerManagerProcessorAbortJobUpdate{handler:handler}) - self159.AddToProcessorMap("rollbackJobUpdate", &auroraSchedulerManagerProcessorRollbackJobUpdate{handler:handler}) - self159.AddToProcessorMap("pulseJobUpdate", &auroraSchedulerManagerProcessorPulseJobUpdate{handler:handler}) - return self159 + self210 := &AuroraSchedulerManagerProcessor{NewReadOnlySchedulerProcessor(handler)} + self210.AddToProcessorMap("createJob", &auroraSchedulerManagerProcessorCreateJob{handler:handler}) + self210.AddToProcessorMap("scheduleCronJob", &auroraSchedulerManagerProcessorScheduleCronJob{handler:handler}) + self210.AddToProcessorMap("descheduleCronJob", &auroraSchedulerManagerProcessorDescheduleCronJob{handler:handler}) + self210.AddToProcessorMap("startCronJob", &auroraSchedulerManagerProcessorStartCronJob{handler:handler}) + self210.AddToProcessorMap("restartShards", &auroraSchedulerManagerProcessorRestartShards{handler:handler}) + self210.AddToProcessorMap("killTasks", &auroraSchedulerManagerProcessorKillTasks{handler:handler}) + self210.AddToProcessorMap("addInstances", &auroraSchedulerManagerProcessorAddInstances{handler:handler}) + self210.AddToProcessorMap("replaceCronTemplate", &auroraSchedulerManagerProcessorReplaceCronTemplate{handler:handler}) + self210.AddToProcessorMap("startJobUpdate", &auroraSchedulerManagerProcessorStartJobUpdate{handler:handler}) + self210.AddToProcessorMap("pauseJobUpdate", &auroraSchedulerManagerProcessorPauseJobUpdate{handler:handler}) + self210.AddToProcessorMap("resumeJobUpdate", &auroraSchedulerManagerProcessorResumeJobUpdate{handler:handler}) + self210.AddToProcessorMap("abortJobUpdate", &auroraSchedulerManagerProcessorAbortJobUpdate{handler:handler}) + self210.AddToProcessorMap("rollbackJobUpdate", &auroraSchedulerManagerProcessorRollbackJobUpdate{handler:handler}) + self210.AddToProcessorMap("pulseJobUpdate", &auroraSchedulerManagerProcessorPulseJobUpdate{handler:handler}) + return self210 } type auroraSchedulerManagerProcessorCreateJob struct { @@ -20525,41 +23164,72 @@ type auroraSchedulerManagerProcessorCreateJob struct { func (p *auroraSchedulerManagerProcessorCreateJob) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerCreateJobArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("createJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "createJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerCreateJobResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.CreateJob(ctx, args.Description); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createJob: " + err2.Error()) - oprot.WriteMessageBegin("createJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "createJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("createJob", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "createJob", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20573,41 +23243,72 @@ type auroraSchedulerManagerProcessorScheduleCronJob struct { func (p *auroraSchedulerManagerProcessorScheduleCronJob) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerScheduleCronJobArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("scheduleCronJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "scheduleCronJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerScheduleCronJobResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.ScheduleCronJob(ctx, args.Description); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing scheduleCronJob: " + err2.Error()) - oprot.WriteMessageBegin("scheduleCronJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "scheduleCronJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("scheduleCronJob", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "scheduleCronJob", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20621,41 +23322,72 @@ type auroraSchedulerManagerProcessorDescheduleCronJob struct { func (p *auroraSchedulerManagerProcessorDescheduleCronJob) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerDescheduleCronJobArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("descheduleCronJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "descheduleCronJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerDescheduleCronJobResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.DescheduleCronJob(ctx, args.Job); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing descheduleCronJob: " + err2.Error()) - oprot.WriteMessageBegin("descheduleCronJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "descheduleCronJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("descheduleCronJob", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "descheduleCronJob", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20669,41 +23401,72 @@ type auroraSchedulerManagerProcessorStartCronJob struct { func (p *auroraSchedulerManagerProcessorStartCronJob) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerStartCronJobArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("startCronJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "startCronJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerStartCronJobResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.StartCronJob(ctx, args.Job); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing startCronJob: " + err2.Error()) - oprot.WriteMessageBegin("startCronJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "startCronJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("startCronJob", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "startCronJob", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20717,41 +23480,72 @@ type auroraSchedulerManagerProcessorRestartShards struct { func (p *auroraSchedulerManagerProcessorRestartShards) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerRestartShardsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("restartShards", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "restartShards", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerRestartShardsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.RestartShards(ctx, args.Job, args.ShardIds); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing restartShards: " + err2.Error()) - oprot.WriteMessageBegin("restartShards", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "restartShards", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("restartShards", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "restartShards", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20765,41 +23559,72 @@ type auroraSchedulerManagerProcessorKillTasks struct { func (p *auroraSchedulerManagerProcessorKillTasks) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerKillTasksArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("killTasks", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "killTasks", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerKillTasksResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.KillTasks(ctx, args.Job, args.Instances, args.Message); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing killTasks: " + err2.Error()) - oprot.WriteMessageBegin("killTasks", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "killTasks", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("killTasks", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "killTasks", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20813,41 +23638,72 @@ type auroraSchedulerManagerProcessorAddInstances struct { func (p *auroraSchedulerManagerProcessorAddInstances) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerAddInstancesArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("addInstances", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "addInstances", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerAddInstancesResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.AddInstances(ctx, args.Key, args.Count); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing addInstances: " + err2.Error()) - oprot.WriteMessageBegin("addInstances", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "addInstances", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("addInstances", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "addInstances", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20861,41 +23717,72 @@ type auroraSchedulerManagerProcessorReplaceCronTemplate struct { func (p *auroraSchedulerManagerProcessorReplaceCronTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerReplaceCronTemplateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("replaceCronTemplate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "replaceCronTemplate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerReplaceCronTemplateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.ReplaceCronTemplate(ctx, args.Config); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing replaceCronTemplate: " + err2.Error()) - oprot.WriteMessageBegin("replaceCronTemplate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "replaceCronTemplate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("replaceCronTemplate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "replaceCronTemplate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20909,41 +23796,72 @@ type auroraSchedulerManagerProcessorStartJobUpdate struct { func (p *auroraSchedulerManagerProcessorStartJobUpdate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerStartJobUpdateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("startJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "startJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerStartJobUpdateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.StartJobUpdate(ctx, args.Request, args.Message); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing startJobUpdate: " + err2.Error()) - oprot.WriteMessageBegin("startJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "startJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("startJobUpdate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "startJobUpdate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20957,41 +23875,72 @@ type auroraSchedulerManagerProcessorPauseJobUpdate struct { func (p *auroraSchedulerManagerProcessorPauseJobUpdate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerPauseJobUpdateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("pauseJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "pauseJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerPauseJobUpdateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.PauseJobUpdate(ctx, args.Key, args.Message); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pauseJobUpdate: " + err2.Error()) - oprot.WriteMessageBegin("pauseJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "pauseJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("pauseJobUpdate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "pauseJobUpdate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -21005,41 +23954,72 @@ type auroraSchedulerManagerProcessorResumeJobUpdate struct { func (p *auroraSchedulerManagerProcessorResumeJobUpdate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerResumeJobUpdateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("resumeJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "resumeJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerResumeJobUpdateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.ResumeJobUpdate(ctx, args.Key, args.Message); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing resumeJobUpdate: " + err2.Error()) - oprot.WriteMessageBegin("resumeJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "resumeJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("resumeJobUpdate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "resumeJobUpdate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -21053,41 +24033,72 @@ type auroraSchedulerManagerProcessorAbortJobUpdate struct { func (p *auroraSchedulerManagerProcessorAbortJobUpdate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerAbortJobUpdateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("abortJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "abortJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerAbortJobUpdateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.AbortJobUpdate(ctx, args.Key, args.Message); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing abortJobUpdate: " + err2.Error()) - oprot.WriteMessageBegin("abortJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "abortJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("abortJobUpdate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "abortJobUpdate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -21101,41 +24112,72 @@ type auroraSchedulerManagerProcessorRollbackJobUpdate struct { func (p *auroraSchedulerManagerProcessorRollbackJobUpdate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerRollbackJobUpdateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("rollbackJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "rollbackJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerRollbackJobUpdateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.RollbackJobUpdate(ctx, args.Key, args.Message); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing rollbackJobUpdate: " + err2.Error()) - oprot.WriteMessageBegin("rollbackJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "rollbackJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("rollbackJobUpdate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "rollbackJobUpdate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -21149,41 +24191,72 @@ type auroraSchedulerManagerProcessorPulseJobUpdate struct { func (p *auroraSchedulerManagerProcessorPulseJobUpdate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerPulseJobUpdateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("pulseJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "pulseJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerPulseJobUpdateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.PulseJobUpdate(ctx, args.Key); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pulseJobUpdate: " + err2.Error()) - oprot.WriteMessageBegin("pulseJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "pulseJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("pulseJobUpdate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "pulseJobUpdate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -21215,14 +24288,14 @@ func (p *AuroraSchedulerManagerCreateJobArgs) IsSetDescription() bool { return p.Description != nil } -func (p *AuroraSchedulerManagerCreateJobArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerCreateJobArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21230,57 +24303,57 @@ func (p *AuroraSchedulerManagerCreateJobArgs) Read(iprot thrift.TProtocol) error switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerCreateJobArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerCreateJobArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Description = &JobConfiguration{} - if err := p.Description.Read(iprot); err != nil { + if err := p.Description.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Description), err) } return nil } -func (p *AuroraSchedulerManagerCreateJobArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("createJob_args"); err != nil { +func (p *AuroraSchedulerManagerCreateJobArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "createJob_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerCreateJobArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("description", thrift.STRUCT, 1); err != nil { +func (p *AuroraSchedulerManagerCreateJobArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "description", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:description: ", p), err) } - if err := p.Description.Write(oprot); err != nil { + if err := p.Description.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Description), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:description: ", p), err) } return err } @@ -21313,14 +24386,14 @@ func (p *AuroraSchedulerManagerCreateJobResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraSchedulerManagerCreateJobResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerCreateJobResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21328,58 +24401,58 @@ func (p *AuroraSchedulerManagerCreateJobResult) Read(iprot thrift.TProtocol) err switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerCreateJobResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerCreateJobResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraSchedulerManagerCreateJobResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("createJob_result"); err != nil { +func (p *AuroraSchedulerManagerCreateJobResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "createJob_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerCreateJobResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraSchedulerManagerCreateJobResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -21413,14 +24486,14 @@ func (p *AuroraSchedulerManagerScheduleCronJobArgs) IsSetDescription() bool { return p.Description != nil } -func (p *AuroraSchedulerManagerScheduleCronJobArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerScheduleCronJobArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21428,57 +24501,57 @@ func (p *AuroraSchedulerManagerScheduleCronJobArgs) Read(iprot thrift.TProtocol) switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerScheduleCronJobArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerScheduleCronJobArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Description = &JobConfiguration{} - if err := p.Description.Read(iprot); err != nil { + if err := p.Description.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Description), err) } return nil } -func (p *AuroraSchedulerManagerScheduleCronJobArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("scheduleCronJob_args"); err != nil { +func (p *AuroraSchedulerManagerScheduleCronJobArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "scheduleCronJob_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerScheduleCronJobArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("description", thrift.STRUCT, 1); err != nil { +func (p *AuroraSchedulerManagerScheduleCronJobArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "description", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:description: ", p), err) } - if err := p.Description.Write(oprot); err != nil { + if err := p.Description.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Description), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:description: ", p), err) } return err } @@ -21511,14 +24584,14 @@ func (p *AuroraSchedulerManagerScheduleCronJobResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraSchedulerManagerScheduleCronJobResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerScheduleCronJobResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21526,58 +24599,58 @@ func (p *AuroraSchedulerManagerScheduleCronJobResult) Read(iprot thrift.TProtoco switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerScheduleCronJobResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerScheduleCronJobResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraSchedulerManagerScheduleCronJobResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("scheduleCronJob_result"); err != nil { +func (p *AuroraSchedulerManagerScheduleCronJobResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "scheduleCronJob_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerScheduleCronJobResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraSchedulerManagerScheduleCronJobResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -21612,14 +24685,14 @@ func (p *AuroraSchedulerManagerDescheduleCronJobArgs) IsSetJob() bool { return p.Job != nil } -func (p *AuroraSchedulerManagerDescheduleCronJobArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21627,57 +24700,57 @@ func (p *AuroraSchedulerManagerDescheduleCronJobArgs) Read(iprot thrift.TProtoco switch fieldId { case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerDescheduleCronJobArgs) ReadField4(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *AuroraSchedulerManagerDescheduleCronJobArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("descheduleCronJob_args"); err != nil { +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "descheduleCronJob_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerDescheduleCronJobArgs) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 4); err != nil { +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "job", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:job: ", p), err) } - if err := p.Job.Write(oprot); err != nil { + if err := p.Job.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:job: ", p), err) } return err } @@ -21710,14 +24783,14 @@ func (p *AuroraSchedulerManagerDescheduleCronJobResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraSchedulerManagerDescheduleCronJobResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerDescheduleCronJobResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21725,58 +24798,58 @@ func (p *AuroraSchedulerManagerDescheduleCronJobResult) Read(iprot thrift.TProto switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerDescheduleCronJobResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerDescheduleCronJobResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraSchedulerManagerDescheduleCronJobResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("descheduleCronJob_result"); err != nil { +func (p *AuroraSchedulerManagerDescheduleCronJobResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "descheduleCronJob_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerDescheduleCronJobResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraSchedulerManagerDescheduleCronJobResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -21811,14 +24884,14 @@ func (p *AuroraSchedulerManagerStartCronJobArgs) IsSetJob() bool { return p.Job != nil } -func (p *AuroraSchedulerManagerStartCronJobArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerStartCronJobArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21826,57 +24899,57 @@ func (p *AuroraSchedulerManagerStartCronJobArgs) Read(iprot thrift.TProtocol) er switch fieldId { case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerStartCronJobArgs) ReadField4(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerStartCronJobArgs) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *AuroraSchedulerManagerStartCronJobArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("startCronJob_args"); err != nil { +func (p *AuroraSchedulerManagerStartCronJobArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "startCronJob_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerStartCronJobArgs) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 4); err != nil { +func (p *AuroraSchedulerManagerStartCronJobArgs) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "job", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:job: ", p), err) } - if err := p.Job.Write(oprot); err != nil { + if err := p.Job.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:job: ", p), err) } return err } @@ -21909,14 +24982,14 @@ func (p *AuroraSchedulerManagerStartCronJobResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraSchedulerManagerStartCronJobResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerStartCronJobResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21924,58 +24997,58 @@ func (p *AuroraSchedulerManagerStartCronJobResult) Read(iprot thrift.TProtocol) switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerStartCronJobResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerStartCronJobResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraSchedulerManagerStartCronJobResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("startCronJob_result"); err != nil { +func (p *AuroraSchedulerManagerStartCronJobResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "startCronJob_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerStartCronJobResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraSchedulerManagerStartCronJobResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -22017,14 +25090,14 @@ func (p *AuroraSchedulerManagerRestartShardsArgs) IsSetJob() bool { return p.Job != nil } -func (p *AuroraSchedulerManagerRestartShardsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerRestartShardsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -22032,115 +25105,118 @@ func (p *AuroraSchedulerManagerRestartShardsArgs) Read(iprot thrift.TProtocol) e switch fieldId { case 5: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.SET { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerRestartShardsArgs) ReadField5(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerRestartShardsArgs) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *AuroraSchedulerManagerRestartShardsArgs) ReadField3(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *AuroraSchedulerManagerRestartShardsArgs) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]int32, 0, size) p.ShardIds = tSet for i := 0; i < size; i ++ { -var _elem160 int32 - if v, err := iprot.ReadI32(); err != nil { +var _elem211 int32 + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem160 = v + _elem211 = v } - p.ShardIds = append(p.ShardIds, _elem160) + p.ShardIds = append(p.ShardIds, _elem211) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *AuroraSchedulerManagerRestartShardsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("restartShards_args"); err != nil { +func (p *AuroraSchedulerManagerRestartShardsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "restartShards_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerRestartShardsArgs) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("shardIds", thrift.SET, 3); err != nil { +func (p *AuroraSchedulerManagerRestartShardsArgs) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "shardIds", thrift.SET, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:shardIds: ", p), err) } - if err := oprot.WriteSetBegin(thrift.I32, len(p.ShardIds)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.I32, len(p.ShardIds)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminSetQuotaResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.SetQuota(ctx, args.OwnerRole, args.Quota); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing setQuota: " + err2.Error()) - oprot.WriteMessageBegin("setQuota", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "setQuota", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("setQuota", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "setQuota", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -24784,41 +27948,72 @@ type auroraAdminProcessorForceTaskState struct { func (p *auroraAdminProcessorForceTaskState) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminForceTaskStateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("forceTaskState", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "forceTaskState", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminForceTaskStateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.ForceTaskState(ctx, args.TaskId, args.Status); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing forceTaskState: " + err2.Error()) - oprot.WriteMessageBegin("forceTaskState", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "forceTaskState", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("forceTaskState", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "forceTaskState", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -24832,41 +28027,72 @@ type auroraAdminProcessorPerformBackup struct { func (p *auroraAdminProcessorPerformBackup) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminPerformBackupArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("performBackup", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "performBackup", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminPerformBackupResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.PerformBackup(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing performBackup: " + err2.Error()) - oprot.WriteMessageBegin("performBackup", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "performBackup", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("performBackup", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "performBackup", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -24880,41 +28106,72 @@ type auroraAdminProcessorListBackups struct { func (p *auroraAdminProcessorListBackups) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminListBackupsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("listBackups", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "listBackups", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminListBackupsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.ListBackups(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing listBackups: " + err2.Error()) - oprot.WriteMessageBegin("listBackups", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "listBackups", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("listBackups", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "listBackups", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -24928,41 +28185,72 @@ type auroraAdminProcessorStageRecovery struct { func (p *auroraAdminProcessorStageRecovery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminStageRecoveryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("stageRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "stageRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminStageRecoveryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.StageRecovery(ctx, args.BackupId); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing stageRecovery: " + err2.Error()) - oprot.WriteMessageBegin("stageRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "stageRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("stageRecovery", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "stageRecovery", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -24976,41 +28264,72 @@ type auroraAdminProcessorQueryRecovery struct { func (p *auroraAdminProcessorQueryRecovery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminQueryRecoveryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("queryRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "queryRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminQueryRecoveryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.QueryRecovery(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing queryRecovery: " + err2.Error()) - oprot.WriteMessageBegin("queryRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "queryRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("queryRecovery", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "queryRecovery", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25024,41 +28343,72 @@ type auroraAdminProcessorDeleteRecoveryTasks struct { func (p *auroraAdminProcessorDeleteRecoveryTasks) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminDeleteRecoveryTasksArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("deleteRecoveryTasks", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "deleteRecoveryTasks", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminDeleteRecoveryTasksResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.DeleteRecoveryTasks(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deleteRecoveryTasks: " + err2.Error()) - oprot.WriteMessageBegin("deleteRecoveryTasks", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "deleteRecoveryTasks", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("deleteRecoveryTasks", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "deleteRecoveryTasks", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25072,41 +28422,72 @@ type auroraAdminProcessorCommitRecovery struct { func (p *auroraAdminProcessorCommitRecovery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminCommitRecoveryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("commitRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "commitRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminCommitRecoveryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.CommitRecovery(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing commitRecovery: " + err2.Error()) - oprot.WriteMessageBegin("commitRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "commitRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("commitRecovery", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "commitRecovery", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25120,41 +28501,72 @@ type auroraAdminProcessorUnloadRecovery struct { func (p *auroraAdminProcessorUnloadRecovery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminUnloadRecoveryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("unloadRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "unloadRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminUnloadRecoveryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.UnloadRecovery(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing unloadRecovery: " + err2.Error()) - oprot.WriteMessageBegin("unloadRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "unloadRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("unloadRecovery", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "unloadRecovery", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25168,41 +28580,72 @@ type auroraAdminProcessorStartMaintenance struct { func (p *auroraAdminProcessorStartMaintenance) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminStartMaintenanceArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("startMaintenance", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "startMaintenance", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminStartMaintenanceResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.StartMaintenance(ctx, args.Hosts); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing startMaintenance: " + err2.Error()) - oprot.WriteMessageBegin("startMaintenance", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "startMaintenance", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("startMaintenance", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "startMaintenance", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25216,41 +28659,72 @@ type auroraAdminProcessorDrainHosts struct { func (p *auroraAdminProcessorDrainHosts) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminDrainHostsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("drainHosts", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "drainHosts", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminDrainHostsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.DrainHosts(ctx, args.Hosts); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing drainHosts: " + err2.Error()) - oprot.WriteMessageBegin("drainHosts", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "drainHosts", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("drainHosts", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "drainHosts", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25264,41 +28738,72 @@ type auroraAdminProcessorMaintenanceStatus struct { func (p *auroraAdminProcessorMaintenanceStatus) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminMaintenanceStatusArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("maintenanceStatus", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "maintenanceStatus", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminMaintenanceStatusResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.MaintenanceStatus(ctx, args.Hosts); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing maintenanceStatus: " + err2.Error()) - oprot.WriteMessageBegin("maintenanceStatus", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "maintenanceStatus", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("maintenanceStatus", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "maintenanceStatus", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25312,41 +28817,72 @@ type auroraAdminProcessorEndMaintenance struct { func (p *auroraAdminProcessorEndMaintenance) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminEndMaintenanceArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("endMaintenance", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "endMaintenance", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminEndMaintenanceResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.EndMaintenance(ctx, args.Hosts); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing endMaintenance: " + err2.Error()) - oprot.WriteMessageBegin("endMaintenance", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "endMaintenance", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("endMaintenance", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "endMaintenance", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25360,41 +28896,72 @@ type auroraAdminProcessorSlaDrainHosts struct { func (p *auroraAdminProcessorSlaDrainHosts) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminSlaDrainHostsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("slaDrainHosts", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "slaDrainHosts", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminSlaDrainHostsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.SlaDrainHosts(ctx, args.Hosts, args.DefaultSlaPolicy, args.TimeoutSecs); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing slaDrainHosts: " + err2.Error()) - oprot.WriteMessageBegin("slaDrainHosts", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "slaDrainHosts", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("slaDrainHosts", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "slaDrainHosts", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25408,41 +28975,72 @@ type auroraAdminProcessorSnapshot struct { func (p *auroraAdminProcessorSnapshot) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminSnapshotArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("snapshot", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "snapshot", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminSnapshotResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.Snapshot(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing snapshot: " + err2.Error()) - oprot.WriteMessageBegin("snapshot", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "snapshot", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("snapshot", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "snapshot", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25456,41 +29054,72 @@ type auroraAdminProcessorTriggerExplicitTaskReconciliation struct { func (p *auroraAdminProcessorTriggerExplicitTaskReconciliation) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminTriggerExplicitTaskReconciliationArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("triggerExplicitTaskReconciliation", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "triggerExplicitTaskReconciliation", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminTriggerExplicitTaskReconciliationResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.TriggerExplicitTaskReconciliation(ctx, args.Settings); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing triggerExplicitTaskReconciliation: " + err2.Error()) - oprot.WriteMessageBegin("triggerExplicitTaskReconciliation", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "triggerExplicitTaskReconciliation", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("triggerExplicitTaskReconciliation", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "triggerExplicitTaskReconciliation", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25504,41 +29133,72 @@ type auroraAdminProcessorTriggerImplicitTaskReconciliation struct { func (p *auroraAdminProcessorTriggerImplicitTaskReconciliation) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminTriggerImplicitTaskReconciliationArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("triggerImplicitTaskReconciliation", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "triggerImplicitTaskReconciliation", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminTriggerImplicitTaskReconciliationResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.TriggerImplicitTaskReconciliation(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing triggerImplicitTaskReconciliation: " + err2.Error()) - oprot.WriteMessageBegin("triggerImplicitTaskReconciliation", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "triggerImplicitTaskReconciliation", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("triggerImplicitTaskReconciliation", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "triggerImplicitTaskReconciliation", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25552,41 +29212,72 @@ type auroraAdminProcessorPruneTasks struct { func (p *auroraAdminProcessorPruneTasks) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminPruneTasksArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("pruneTasks", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "pruneTasks", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminPruneTasksResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.PruneTasks(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pruneTasks: " + err2.Error()) - oprot.WriteMessageBegin("pruneTasks", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "pruneTasks", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("pruneTasks", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "pruneTasks", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25624,14 +29315,14 @@ func (p *AuroraAdminSetQuotaArgs) IsSetQuota() bool { return p.Quota != nil } -func (p *AuroraAdminSetQuotaArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminSetQuotaArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -25639,41 +29330,41 @@ func (p *AuroraAdminSetQuotaArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminSetQuotaArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AuroraAdminSetQuotaArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.OwnerRole = v @@ -25681,45 +29372,45 @@ func (p *AuroraAdminSetQuotaArgs) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *AuroraAdminSetQuotaArgs) ReadField2(iprot thrift.TProtocol) error { +func (p *AuroraAdminSetQuotaArgs) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Quota = &ResourceAggregate{} - if err := p.Quota.Read(iprot); err != nil { + if err := p.Quota.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Quota), err) } return nil } -func (p *AuroraAdminSetQuotaArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("setQuota_args"); err != nil { +func (p *AuroraAdminSetQuotaArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "setQuota_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminSetQuotaArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ownerRole", thrift.STRING, 1); err != nil { +func (p *AuroraAdminSetQuotaArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "ownerRole", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ownerRole: ", p), err) } - if err := oprot.WriteString(string(p.OwnerRole)); err != nil { + if err := oprot.WriteString(ctx, string(p.OwnerRole)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ownerRole (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ownerRole: ", p), err) } return err } -func (p *AuroraAdminSetQuotaArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("quota", thrift.STRUCT, 2); err != nil { +func (p *AuroraAdminSetQuotaArgs) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "quota", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:quota: ", p), err) } - if err := p.Quota.Write(oprot); err != nil { + if err := p.Quota.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Quota), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:quota: ", p), err) } return err } @@ -25752,14 +29443,14 @@ func (p *AuroraAdminSetQuotaResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminSetQuotaResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminSetQuotaResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -25767,58 +29458,58 @@ func (p *AuroraAdminSetQuotaResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminSetQuotaResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminSetQuotaResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminSetQuotaResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("setQuota_result"); err != nil { +func (p *AuroraAdminSetQuotaResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "setQuota_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminSetQuotaResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminSetQuotaResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -25851,14 +29542,14 @@ func (p *AuroraAdminForceTaskStateArgs) GetTaskId() string { func (p *AuroraAdminForceTaskStateArgs) GetStatus() ScheduleStatus { return p.Status } -func (p *AuroraAdminForceTaskStateArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminForceTaskStateArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -25866,41 +29557,41 @@ func (p *AuroraAdminForceTaskStateArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminForceTaskStateArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AuroraAdminForceTaskStateArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.TaskId = v @@ -25908,8 +29599,8 @@ func (p *AuroraAdminForceTaskStateArgs) ReadField1(iprot thrift.TProtocol) erro return nil } -func (p *AuroraAdminForceTaskStateArgs) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *AuroraAdminForceTaskStateArgs) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { temp := ScheduleStatus(v) @@ -25918,36 +29609,36 @@ func (p *AuroraAdminForceTaskStateArgs) ReadField2(iprot thrift.TProtocol) erro return nil } -func (p *AuroraAdminForceTaskStateArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("forceTaskState_args"); err != nil { +func (p *AuroraAdminForceTaskStateArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "forceTaskState_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminForceTaskStateArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskId", thrift.STRING, 1); err != nil { +func (p *AuroraAdminForceTaskStateArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskId", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:taskId: ", p), err) } - if err := oprot.WriteString(string(p.TaskId)); err != nil { + if err := oprot.WriteString(ctx, string(p.TaskId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.taskId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:taskId: ", p), err) } return err } -func (p *AuroraAdminForceTaskStateArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.I32, 2); err != nil { +func (p *AuroraAdminForceTaskStateArgs) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:status: ", p), err) } - if err := oprot.WriteI32(int32(p.Status)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Status)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.status (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:status: ", p), err) } return err } @@ -25980,14 +29671,14 @@ func (p *AuroraAdminForceTaskStateResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminForceTaskStateResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminForceTaskStateResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -25995,58 +29686,58 @@ func (p *AuroraAdminForceTaskStateResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminForceTaskStateResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminForceTaskStateResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminForceTaskStateResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("forceTaskState_result"); err != nil { +func (p *AuroraAdminForceTaskStateResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "forceTaskState_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminForceTaskStateResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminForceTaskStateResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -26066,39 +29757,39 @@ func NewAuroraAdminPerformBackupArgs() *AuroraAdminPerformBackupArgs { return &AuroraAdminPerformBackupArgs{} } -func (p *AuroraAdminPerformBackupArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminPerformBackupArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminPerformBackupArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("performBackup_args"); err != nil { +func (p *AuroraAdminPerformBackupArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "performBackup_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -26131,14 +29822,14 @@ func (p *AuroraAdminPerformBackupResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminPerformBackupResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminPerformBackupResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26146,58 +29837,58 @@ func (p *AuroraAdminPerformBackupResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminPerformBackupResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminPerformBackupResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminPerformBackupResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("performBackup_result"); err != nil { +func (p *AuroraAdminPerformBackupResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "performBackup_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminPerformBackupResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminPerformBackupResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -26217,39 +29908,39 @@ func NewAuroraAdminListBackupsArgs() *AuroraAdminListBackupsArgs { return &AuroraAdminListBackupsArgs{} } -func (p *AuroraAdminListBackupsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminListBackupsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminListBackupsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("listBackups_args"); err != nil { +func (p *AuroraAdminListBackupsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "listBackups_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -26282,14 +29973,14 @@ func (p *AuroraAdminListBackupsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminListBackupsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminListBackupsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26297,58 +29988,58 @@ func (p *AuroraAdminListBackupsResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminListBackupsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminListBackupsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminListBackupsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("listBackups_result"); err != nil { +func (p *AuroraAdminListBackupsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "listBackups_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminListBackupsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminListBackupsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -26375,14 +30066,14 @@ func NewAuroraAdminStageRecoveryArgs() *AuroraAdminStageRecoveryArgs { func (p *AuroraAdminStageRecoveryArgs) GetBackupId() string { return p.BackupId } -func (p *AuroraAdminStageRecoveryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminStageRecoveryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26390,31 +30081,31 @@ func (p *AuroraAdminStageRecoveryArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminStageRecoveryArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AuroraAdminStageRecoveryArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.BackupId = v @@ -26422,25 +30113,25 @@ func (p *AuroraAdminStageRecoveryArgs) ReadField1(iprot thrift.TProtocol) error return nil } -func (p *AuroraAdminStageRecoveryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("stageRecovery_args"); err != nil { +func (p *AuroraAdminStageRecoveryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "stageRecovery_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminStageRecoveryArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("backupId", thrift.STRING, 1); err != nil { +func (p *AuroraAdminStageRecoveryArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "backupId", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:backupId: ", p), err) } - if err := oprot.WriteString(string(p.BackupId)); err != nil { + if err := oprot.WriteString(ctx, string(p.BackupId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.backupId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:backupId: ", p), err) } return err } @@ -26473,14 +30164,14 @@ func (p *AuroraAdminStageRecoveryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminStageRecoveryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminStageRecoveryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26488,58 +30179,58 @@ func (p *AuroraAdminStageRecoveryResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminStageRecoveryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminStageRecoveryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminStageRecoveryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("stageRecovery_result"); err != nil { +func (p *AuroraAdminStageRecoveryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "stageRecovery_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminStageRecoveryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminStageRecoveryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -26573,14 +30264,14 @@ func (p *AuroraAdminQueryRecoveryArgs) IsSetQuery() bool { return p.Query != nil } -func (p *AuroraAdminQueryRecoveryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminQueryRecoveryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26588,57 +30279,57 @@ func (p *AuroraAdminQueryRecoveryArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminQueryRecoveryArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminQueryRecoveryArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &TaskQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *AuroraAdminQueryRecoveryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("queryRecovery_args"); err != nil { +func (p *AuroraAdminQueryRecoveryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "queryRecovery_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminQueryRecoveryArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminQueryRecoveryArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) } return err } @@ -26671,14 +30362,14 @@ func (p *AuroraAdminQueryRecoveryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminQueryRecoveryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminQueryRecoveryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26686,58 +30377,58 @@ func (p *AuroraAdminQueryRecoveryResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminQueryRecoveryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminQueryRecoveryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminQueryRecoveryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("queryRecovery_result"); err != nil { +func (p *AuroraAdminQueryRecoveryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "queryRecovery_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminQueryRecoveryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminQueryRecoveryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -26771,14 +30462,14 @@ func (p *AuroraAdminDeleteRecoveryTasksArgs) IsSetQuery() bool { return p.Query != nil } -func (p *AuroraAdminDeleteRecoveryTasksArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminDeleteRecoveryTasksArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26786,57 +30477,57 @@ func (p *AuroraAdminDeleteRecoveryTasksArgs) Read(iprot thrift.TProtocol) error switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminDeleteRecoveryTasksArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminDeleteRecoveryTasksArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &TaskQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *AuroraAdminDeleteRecoveryTasksArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("deleteRecoveryTasks_args"); err != nil { +func (p *AuroraAdminDeleteRecoveryTasksArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "deleteRecoveryTasks_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminDeleteRecoveryTasksArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminDeleteRecoveryTasksArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) } return err } @@ -26869,14 +30560,14 @@ func (p *AuroraAdminDeleteRecoveryTasksResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminDeleteRecoveryTasksResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminDeleteRecoveryTasksResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26884,58 +30575,58 @@ func (p *AuroraAdminDeleteRecoveryTasksResult) Read(iprot thrift.TProtocol) erro switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminDeleteRecoveryTasksResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminDeleteRecoveryTasksResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminDeleteRecoveryTasksResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("deleteRecoveryTasks_result"); err != nil { +func (p *AuroraAdminDeleteRecoveryTasksResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "deleteRecoveryTasks_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminDeleteRecoveryTasksResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminDeleteRecoveryTasksResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -26955,39 +30646,39 @@ func NewAuroraAdminCommitRecoveryArgs() *AuroraAdminCommitRecoveryArgs { return &AuroraAdminCommitRecoveryArgs{} } -func (p *AuroraAdminCommitRecoveryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminCommitRecoveryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminCommitRecoveryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("commitRecovery_args"); err != nil { +func (p *AuroraAdminCommitRecoveryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "commitRecovery_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -27020,14 +30711,14 @@ func (p *AuroraAdminCommitRecoveryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminCommitRecoveryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminCommitRecoveryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27035,58 +30726,58 @@ func (p *AuroraAdminCommitRecoveryResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminCommitRecoveryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminCommitRecoveryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminCommitRecoveryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("commitRecovery_result"); err != nil { +func (p *AuroraAdminCommitRecoveryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "commitRecovery_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminCommitRecoveryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminCommitRecoveryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -27106,39 +30797,39 @@ func NewAuroraAdminUnloadRecoveryArgs() *AuroraAdminUnloadRecoveryArgs { return &AuroraAdminUnloadRecoveryArgs{} } -func (p *AuroraAdminUnloadRecoveryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminUnloadRecoveryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminUnloadRecoveryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("unloadRecovery_args"); err != nil { +func (p *AuroraAdminUnloadRecoveryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "unloadRecovery_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -27171,14 +30862,14 @@ func (p *AuroraAdminUnloadRecoveryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminUnloadRecoveryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminUnloadRecoveryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27186,58 +30877,58 @@ func (p *AuroraAdminUnloadRecoveryResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminUnloadRecoveryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminUnloadRecoveryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminUnloadRecoveryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("unloadRecovery_result"); err != nil { +func (p *AuroraAdminUnloadRecoveryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "unloadRecovery_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminUnloadRecoveryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminUnloadRecoveryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -27271,14 +30962,14 @@ func (p *AuroraAdminStartMaintenanceArgs) IsSetHosts() bool { return p.Hosts != nil } -func (p *AuroraAdminStartMaintenanceArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminStartMaintenanceArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27286,57 +30977,57 @@ func (p *AuroraAdminStartMaintenanceArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminStartMaintenanceArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminStartMaintenanceArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Hosts = &Hosts{} - if err := p.Hosts.Read(iprot); err != nil { + if err := p.Hosts.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hosts), err) } return nil } -func (p *AuroraAdminStartMaintenanceArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("startMaintenance_args"); err != nil { +func (p *AuroraAdminStartMaintenanceArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "startMaintenance_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminStartMaintenanceArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hosts", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminStartMaintenanceArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hosts", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) } - if err := p.Hosts.Write(oprot); err != nil { + if err := p.Hosts.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) } return err } @@ -27369,14 +31060,14 @@ func (p *AuroraAdminStartMaintenanceResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminStartMaintenanceResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminStartMaintenanceResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27384,58 +31075,58 @@ func (p *AuroraAdminStartMaintenanceResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminStartMaintenanceResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminStartMaintenanceResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminStartMaintenanceResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("startMaintenance_result"); err != nil { +func (p *AuroraAdminStartMaintenanceResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "startMaintenance_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminStartMaintenanceResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminStartMaintenanceResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -27469,14 +31160,14 @@ func (p *AuroraAdminDrainHostsArgs) IsSetHosts() bool { return p.Hosts != nil } -func (p *AuroraAdminDrainHostsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminDrainHostsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27484,57 +31175,57 @@ func (p *AuroraAdminDrainHostsArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminDrainHostsArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminDrainHostsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Hosts = &Hosts{} - if err := p.Hosts.Read(iprot); err != nil { + if err := p.Hosts.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hosts), err) } return nil } -func (p *AuroraAdminDrainHostsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("drainHosts_args"); err != nil { +func (p *AuroraAdminDrainHostsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "drainHosts_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminDrainHostsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hosts", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminDrainHostsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hosts", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) } - if err := p.Hosts.Write(oprot); err != nil { + if err := p.Hosts.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) } return err } @@ -27567,14 +31258,14 @@ func (p *AuroraAdminDrainHostsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminDrainHostsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminDrainHostsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27582,58 +31273,58 @@ func (p *AuroraAdminDrainHostsResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminDrainHostsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminDrainHostsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminDrainHostsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("drainHosts_result"); err != nil { +func (p *AuroraAdminDrainHostsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "drainHosts_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminDrainHostsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminDrainHostsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -27667,14 +31358,14 @@ func (p *AuroraAdminMaintenanceStatusArgs) IsSetHosts() bool { return p.Hosts != nil } -func (p *AuroraAdminMaintenanceStatusArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminMaintenanceStatusArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27682,57 +31373,57 @@ func (p *AuroraAdminMaintenanceStatusArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminMaintenanceStatusArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminMaintenanceStatusArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Hosts = &Hosts{} - if err := p.Hosts.Read(iprot); err != nil { + if err := p.Hosts.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hosts), err) } return nil } -func (p *AuroraAdminMaintenanceStatusArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("maintenanceStatus_args"); err != nil { +func (p *AuroraAdminMaintenanceStatusArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "maintenanceStatus_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminMaintenanceStatusArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hosts", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminMaintenanceStatusArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hosts", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) } - if err := p.Hosts.Write(oprot); err != nil { + if err := p.Hosts.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) } return err } @@ -27765,14 +31456,14 @@ func (p *AuroraAdminMaintenanceStatusResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminMaintenanceStatusResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminMaintenanceStatusResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27780,58 +31471,58 @@ func (p *AuroraAdminMaintenanceStatusResult) Read(iprot thrift.TProtocol) error switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminMaintenanceStatusResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminMaintenanceStatusResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminMaintenanceStatusResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("maintenanceStatus_result"); err != nil { +func (p *AuroraAdminMaintenanceStatusResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "maintenanceStatus_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminMaintenanceStatusResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminMaintenanceStatusResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -27865,14 +31556,14 @@ func (p *AuroraAdminEndMaintenanceArgs) IsSetHosts() bool { return p.Hosts != nil } -func (p *AuroraAdminEndMaintenanceArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminEndMaintenanceArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27880,57 +31571,57 @@ func (p *AuroraAdminEndMaintenanceArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminEndMaintenanceArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminEndMaintenanceArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Hosts = &Hosts{} - if err := p.Hosts.Read(iprot); err != nil { + if err := p.Hosts.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hosts), err) } return nil } -func (p *AuroraAdminEndMaintenanceArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("endMaintenance_args"); err != nil { +func (p *AuroraAdminEndMaintenanceArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "endMaintenance_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminEndMaintenanceArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hosts", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminEndMaintenanceArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hosts", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) } - if err := p.Hosts.Write(oprot); err != nil { + if err := p.Hosts.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) } return err } @@ -27963,14 +31654,14 @@ func (p *AuroraAdminEndMaintenanceResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminEndMaintenanceResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminEndMaintenanceResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27978,58 +31669,58 @@ func (p *AuroraAdminEndMaintenanceResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminEndMaintenanceResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminEndMaintenanceResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminEndMaintenanceResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("endMaintenance_result"); err != nil { +func (p *AuroraAdminEndMaintenanceResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "endMaintenance_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminEndMaintenanceResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminEndMaintenanceResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -28082,14 +31773,14 @@ func (p *AuroraAdminSlaDrainHostsArgs) IsSetDefaultSlaPolicy() bool { return p.DefaultSlaPolicy != nil } -func (p *AuroraAdminSlaDrainHostsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminSlaDrainHostsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28097,67 +31788,67 @@ func (p *AuroraAdminSlaDrainHostsArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminSlaDrainHostsArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminSlaDrainHostsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Hosts = &Hosts{} - if err := p.Hosts.Read(iprot); err != nil { + if err := p.Hosts.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hosts), err) } return nil } -func (p *AuroraAdminSlaDrainHostsArgs) ReadField2(iprot thrift.TProtocol) error { +func (p *AuroraAdminSlaDrainHostsArgs) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.DefaultSlaPolicy = &SlaPolicy{} - if err := p.DefaultSlaPolicy.Read(iprot); err != nil { + if err := p.DefaultSlaPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DefaultSlaPolicy), err) } return nil } -func (p *AuroraAdminSlaDrainHostsArgs) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *AuroraAdminSlaDrainHostsArgs) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.TimeoutSecs = v @@ -28165,49 +31856,49 @@ func (p *AuroraAdminSlaDrainHostsArgs) ReadField3(iprot thrift.TProtocol) error return nil } -func (p *AuroraAdminSlaDrainHostsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("slaDrainHosts_args"); err != nil { +func (p *AuroraAdminSlaDrainHostsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "slaDrainHosts_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminSlaDrainHostsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hosts", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminSlaDrainHostsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hosts", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) } - if err := p.Hosts.Write(oprot); err != nil { + if err := p.Hosts.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) } return err } -func (p *AuroraAdminSlaDrainHostsArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("defaultSlaPolicy", thrift.STRUCT, 2); err != nil { +func (p *AuroraAdminSlaDrainHostsArgs) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "defaultSlaPolicy", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:defaultSlaPolicy: ", p), err) } - if err := p.DefaultSlaPolicy.Write(oprot); err != nil { + if err := p.DefaultSlaPolicy.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DefaultSlaPolicy), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:defaultSlaPolicy: ", p), err) } return err } -func (p *AuroraAdminSlaDrainHostsArgs) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timeoutSecs", thrift.I64, 3); err != nil { +func (p *AuroraAdminSlaDrainHostsArgs) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timeoutSecs", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:timeoutSecs: ", p), err) } - if err := oprot.WriteI64(int64(p.TimeoutSecs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TimeoutSecs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timeoutSecs (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:timeoutSecs: ", p), err) } return err } @@ -28240,14 +31931,14 @@ func (p *AuroraAdminSlaDrainHostsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminSlaDrainHostsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminSlaDrainHostsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28255,58 +31946,58 @@ func (p *AuroraAdminSlaDrainHostsResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminSlaDrainHostsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminSlaDrainHostsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminSlaDrainHostsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("slaDrainHosts_result"); err != nil { +func (p *AuroraAdminSlaDrainHostsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "slaDrainHosts_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminSlaDrainHostsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminSlaDrainHostsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -28326,39 +32017,39 @@ func NewAuroraAdminSnapshotArgs() *AuroraAdminSnapshotArgs { return &AuroraAdminSnapshotArgs{} } -func (p *AuroraAdminSnapshotArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminSnapshotArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminSnapshotArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("snapshot_args"); err != nil { +func (p *AuroraAdminSnapshotArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "snapshot_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -28391,14 +32082,14 @@ func (p *AuroraAdminSnapshotResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminSnapshotResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminSnapshotResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28406,58 +32097,58 @@ func (p *AuroraAdminSnapshotResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminSnapshotResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminSnapshotResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminSnapshotResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("snapshot_result"); err != nil { +func (p *AuroraAdminSnapshotResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "snapshot_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminSnapshotResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminSnapshotResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -28491,14 +32182,14 @@ func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) IsSetSettings() bool return p.Settings != nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28506,57 +32197,57 @@ func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) Read(iprot thrift.TPr switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Settings = &ExplicitReconciliationSettings{} - if err := p.Settings.Read(iprot); err != nil { + if err := p.Settings.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Settings), err) } return nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("triggerExplicitTaskReconciliation_args"); err != nil { +func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "triggerExplicitTaskReconciliation_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("settings", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "settings", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:settings: ", p), err) } - if err := p.Settings.Write(oprot); err != nil { + if err := p.Settings.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Settings), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:settings: ", p), err) } return err } @@ -28589,14 +32280,14 @@ func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) IsSetSuccess() bool return p.Success != nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28604,58 +32295,58 @@ func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) Read(iprot thrift.T switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("triggerExplicitTaskReconciliation_result"); err != nil { +func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "triggerExplicitTaskReconciliation_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -28675,39 +32366,39 @@ func NewAuroraAdminTriggerImplicitTaskReconciliationArgs() *AuroraAdminTriggerIm return &AuroraAdminTriggerImplicitTaskReconciliationArgs{} } -func (p *AuroraAdminTriggerImplicitTaskReconciliationArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminTriggerImplicitTaskReconciliationArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminTriggerImplicitTaskReconciliationArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("triggerImplicitTaskReconciliation_args"); err != nil { +func (p *AuroraAdminTriggerImplicitTaskReconciliationArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "triggerImplicitTaskReconciliation_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -28740,14 +32431,14 @@ func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) IsSetSuccess() bool return p.Success != nil } -func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28755,58 +32446,58 @@ func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) Read(iprot thrift.T switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("triggerImplicitTaskReconciliation_result"); err != nil { +func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "triggerImplicitTaskReconciliation_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -28840,14 +32531,14 @@ func (p *AuroraAdminPruneTasksArgs) IsSetQuery() bool { return p.Query != nil } -func (p *AuroraAdminPruneTasksArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminPruneTasksArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28855,57 +32546,57 @@ func (p *AuroraAdminPruneTasksArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminPruneTasksArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminPruneTasksArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &TaskQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *AuroraAdminPruneTasksArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("pruneTasks_args"); err != nil { +func (p *AuroraAdminPruneTasksArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "pruneTasks_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminPruneTasksArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminPruneTasksArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) } return err } @@ -28938,14 +32629,14 @@ func (p *AuroraAdminPruneTasksResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminPruneTasksResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminPruneTasksResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28953,58 +32644,58 @@ func (p *AuroraAdminPruneTasksResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminPruneTasksResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminPruneTasksResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminPruneTasksResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("pruneTasks_result"); err != nil { +func (p *AuroraAdminPruneTasksResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "pruneTasks_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminPruneTasksResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminPruneTasksResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err diff --git a/gen-go/apache/aurora/aurora_admin-remote/aurora_admin-remote.go b/gen-go/apache/aurora/aurora_admin-remote/aurora_admin-remote.go index b600061..d2d4441 100755 --- a/gen-go/apache/aurora/aurora_admin-remote/aurora_admin-remote.go +++ b/gen-go/apache/aurora/aurora_admin-remote/aurora_admin-remote.go @@ -1,22 +1,22 @@ -// Autogenerated by Thrift Compiler (0.12.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. package main import ( - "context" - "flag" - "fmt" - "math" - "net" - "net/url" - "os" - "strconv" - "strings" - "github.com/apache/thrift/lib/go/thrift" - "apache/aurora" + "context" + "flag" + "fmt" + "math" + "net" + "net/url" + "os" + "strconv" + "strings" + "github.com/apache/thrift/lib/go/thrift" + "apache/aurora" ) +var _ = aurora.GoUnusedProtection__ func Usage() { fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") @@ -195,19 +195,19 @@ func main() { } argvalue0 := flag.Arg(1) value0 := argvalue0 - arg354 := flag.Arg(2) - mbTrans355 := thrift.NewTMemoryBufferLen(len(arg354)) - defer mbTrans355.Close() - _, err356 := mbTrans355.WriteString(arg354) - if err356 != nil { + arg405 := flag.Arg(2) + mbTrans406 := thrift.NewTMemoryBufferLen(len(arg405)) + defer mbTrans406.Close() + _, err407 := mbTrans406.WriteString(arg405) + if err407 != nil { Usage() return } - factory357 := thrift.NewTJSONProtocolFactory() - jsProt358 := factory357.GetProtocol(mbTrans355) + factory408 := thrift.NewTJSONProtocolFactory() + jsProt409 := factory408.GetProtocol(mbTrans406) argvalue1 := aurora.NewResourceAggregate() - err359 := argvalue1.Read(jsProt358) - if err359 != nil { + err410 := argvalue1.Read(context.Background(), jsProt409) + if err410 != nil { Usage() return } @@ -263,19 +263,19 @@ func main() { fmt.Fprintln(os.Stderr, "QueryRecovery requires 1 args") flag.Usage() } - arg362 := flag.Arg(1) - mbTrans363 := thrift.NewTMemoryBufferLen(len(arg362)) - defer mbTrans363.Close() - _, err364 := mbTrans363.WriteString(arg362) - if err364 != nil { + arg413 := flag.Arg(1) + mbTrans414 := thrift.NewTMemoryBufferLen(len(arg413)) + defer mbTrans414.Close() + _, err415 := mbTrans414.WriteString(arg413) + if err415 != nil { Usage() return } - factory365 := thrift.NewTJSONProtocolFactory() - jsProt366 := factory365.GetProtocol(mbTrans363) + factory416 := thrift.NewTJSONProtocolFactory() + jsProt417 := factory416.GetProtocol(mbTrans414) argvalue0 := aurora.NewTaskQuery() - err367 := argvalue0.Read(jsProt366) - if err367 != nil { + err418 := argvalue0.Read(context.Background(), jsProt417) + if err418 != nil { Usage() return } @@ -288,19 +288,19 @@ func main() { fmt.Fprintln(os.Stderr, "DeleteRecoveryTasks requires 1 args") flag.Usage() } - arg368 := flag.Arg(1) - mbTrans369 := thrift.NewTMemoryBufferLen(len(arg368)) - defer mbTrans369.Close() - _, err370 := mbTrans369.WriteString(arg368) - if err370 != nil { + arg419 := flag.Arg(1) + mbTrans420 := thrift.NewTMemoryBufferLen(len(arg419)) + defer mbTrans420.Close() + _, err421 := mbTrans420.WriteString(arg419) + if err421 != nil { Usage() return } - factory371 := thrift.NewTJSONProtocolFactory() - jsProt372 := factory371.GetProtocol(mbTrans369) + factory422 := thrift.NewTJSONProtocolFactory() + jsProt423 := factory422.GetProtocol(mbTrans420) argvalue0 := aurora.NewTaskQuery() - err373 := argvalue0.Read(jsProt372) - if err373 != nil { + err424 := argvalue0.Read(context.Background(), jsProt423) + if err424 != nil { Usage() return } @@ -329,19 +329,19 @@ func main() { fmt.Fprintln(os.Stderr, "StartMaintenance requires 1 args") flag.Usage() } - arg374 := flag.Arg(1) - mbTrans375 := thrift.NewTMemoryBufferLen(len(arg374)) - defer mbTrans375.Close() - _, err376 := mbTrans375.WriteString(arg374) - if err376 != nil { + arg425 := flag.Arg(1) + mbTrans426 := thrift.NewTMemoryBufferLen(len(arg425)) + defer mbTrans426.Close() + _, err427 := mbTrans426.WriteString(arg425) + if err427 != nil { Usage() return } - factory377 := thrift.NewTJSONProtocolFactory() - jsProt378 := factory377.GetProtocol(mbTrans375) + factory428 := thrift.NewTJSONProtocolFactory() + jsProt429 := factory428.GetProtocol(mbTrans426) argvalue0 := aurora.NewHosts() - err379 := argvalue0.Read(jsProt378) - if err379 != nil { + err430 := argvalue0.Read(context.Background(), jsProt429) + if err430 != nil { Usage() return } @@ -354,19 +354,19 @@ func main() { fmt.Fprintln(os.Stderr, "DrainHosts requires 1 args") flag.Usage() } - arg380 := flag.Arg(1) - mbTrans381 := thrift.NewTMemoryBufferLen(len(arg380)) - defer mbTrans381.Close() - _, err382 := mbTrans381.WriteString(arg380) - if err382 != nil { + arg431 := flag.Arg(1) + mbTrans432 := thrift.NewTMemoryBufferLen(len(arg431)) + defer mbTrans432.Close() + _, err433 := mbTrans432.WriteString(arg431) + if err433 != nil { Usage() return } - factory383 := thrift.NewTJSONProtocolFactory() - jsProt384 := factory383.GetProtocol(mbTrans381) + factory434 := thrift.NewTJSONProtocolFactory() + jsProt435 := factory434.GetProtocol(mbTrans432) argvalue0 := aurora.NewHosts() - err385 := argvalue0.Read(jsProt384) - if err385 != nil { + err436 := argvalue0.Read(context.Background(), jsProt435) + if err436 != nil { Usage() return } @@ -379,19 +379,19 @@ func main() { fmt.Fprintln(os.Stderr, "MaintenanceStatus requires 1 args") flag.Usage() } - arg386 := flag.Arg(1) - mbTrans387 := thrift.NewTMemoryBufferLen(len(arg386)) - defer mbTrans387.Close() - _, err388 := mbTrans387.WriteString(arg386) - if err388 != nil { + arg437 := flag.Arg(1) + mbTrans438 := thrift.NewTMemoryBufferLen(len(arg437)) + defer mbTrans438.Close() + _, err439 := mbTrans438.WriteString(arg437) + if err439 != nil { Usage() return } - factory389 := thrift.NewTJSONProtocolFactory() - jsProt390 := factory389.GetProtocol(mbTrans387) + factory440 := thrift.NewTJSONProtocolFactory() + jsProt441 := factory440.GetProtocol(mbTrans438) argvalue0 := aurora.NewHosts() - err391 := argvalue0.Read(jsProt390) - if err391 != nil { + err442 := argvalue0.Read(context.Background(), jsProt441) + if err442 != nil { Usage() return } @@ -404,19 +404,19 @@ func main() { fmt.Fprintln(os.Stderr, "EndMaintenance requires 1 args") flag.Usage() } - arg392 := flag.Arg(1) - mbTrans393 := thrift.NewTMemoryBufferLen(len(arg392)) - defer mbTrans393.Close() - _, err394 := mbTrans393.WriteString(arg392) - if err394 != nil { + arg443 := flag.Arg(1) + mbTrans444 := thrift.NewTMemoryBufferLen(len(arg443)) + defer mbTrans444.Close() + _, err445 := mbTrans444.WriteString(arg443) + if err445 != nil { Usage() return } - factory395 := thrift.NewTJSONProtocolFactory() - jsProt396 := factory395.GetProtocol(mbTrans393) + factory446 := thrift.NewTJSONProtocolFactory() + jsProt447 := factory446.GetProtocol(mbTrans444) argvalue0 := aurora.NewHosts() - err397 := argvalue0.Read(jsProt396) - if err397 != nil { + err448 := argvalue0.Read(context.Background(), jsProt447) + if err448 != nil { Usage() return } @@ -429,42 +429,42 @@ func main() { fmt.Fprintln(os.Stderr, "SlaDrainHosts requires 3 args") flag.Usage() } - arg398 := flag.Arg(1) - mbTrans399 := thrift.NewTMemoryBufferLen(len(arg398)) - defer mbTrans399.Close() - _, err400 := mbTrans399.WriteString(arg398) - if err400 != nil { + arg449 := flag.Arg(1) + mbTrans450 := thrift.NewTMemoryBufferLen(len(arg449)) + defer mbTrans450.Close() + _, err451 := mbTrans450.WriteString(arg449) + if err451 != nil { Usage() return } - factory401 := thrift.NewTJSONProtocolFactory() - jsProt402 := factory401.GetProtocol(mbTrans399) + factory452 := thrift.NewTJSONProtocolFactory() + jsProt453 := factory452.GetProtocol(mbTrans450) argvalue0 := aurora.NewHosts() - err403 := argvalue0.Read(jsProt402) - if err403 != nil { + err454 := argvalue0.Read(context.Background(), jsProt453) + if err454 != nil { Usage() return } value0 := argvalue0 - arg404 := flag.Arg(2) - mbTrans405 := thrift.NewTMemoryBufferLen(len(arg404)) - defer mbTrans405.Close() - _, err406 := mbTrans405.WriteString(arg404) - if err406 != nil { + arg455 := flag.Arg(2) + mbTrans456 := thrift.NewTMemoryBufferLen(len(arg455)) + defer mbTrans456.Close() + _, err457 := mbTrans456.WriteString(arg455) + if err457 != nil { Usage() return } - factory407 := thrift.NewTJSONProtocolFactory() - jsProt408 := factory407.GetProtocol(mbTrans405) + factory458 := thrift.NewTJSONProtocolFactory() + jsProt459 := factory458.GetProtocol(mbTrans456) argvalue1 := aurora.NewSlaPolicy() - err409 := argvalue1.Read(jsProt408) - if err409 != nil { + err460 := argvalue1.Read(context.Background(), jsProt459) + if err460 != nil { Usage() return } value1 := argvalue1 - argvalue2, err410 := (strconv.ParseInt(flag.Arg(3), 10, 64)) - if err410 != nil { + argvalue2, err461 := (strconv.ParseInt(flag.Arg(3), 10, 64)) + if err461 != nil { Usage() return } @@ -485,19 +485,19 @@ func main() { fmt.Fprintln(os.Stderr, "TriggerExplicitTaskReconciliation requires 1 args") flag.Usage() } - arg411 := flag.Arg(1) - mbTrans412 := thrift.NewTMemoryBufferLen(len(arg411)) - defer mbTrans412.Close() - _, err413 := mbTrans412.WriteString(arg411) - if err413 != nil { + arg462 := flag.Arg(1) + mbTrans463 := thrift.NewTMemoryBufferLen(len(arg462)) + defer mbTrans463.Close() + _, err464 := mbTrans463.WriteString(arg462) + if err464 != nil { Usage() return } - factory414 := thrift.NewTJSONProtocolFactory() - jsProt415 := factory414.GetProtocol(mbTrans412) + factory465 := thrift.NewTJSONProtocolFactory() + jsProt466 := factory465.GetProtocol(mbTrans463) argvalue0 := aurora.NewExplicitReconciliationSettings() - err416 := argvalue0.Read(jsProt415) - if err416 != nil { + err467 := argvalue0.Read(context.Background(), jsProt466) + if err467 != nil { Usage() return } @@ -518,19 +518,19 @@ func main() { fmt.Fprintln(os.Stderr, "PruneTasks requires 1 args") flag.Usage() } - arg417 := flag.Arg(1) - mbTrans418 := thrift.NewTMemoryBufferLen(len(arg417)) - defer mbTrans418.Close() - _, err419 := mbTrans418.WriteString(arg417) - if err419 != nil { + arg468 := flag.Arg(1) + mbTrans469 := thrift.NewTMemoryBufferLen(len(arg468)) + defer mbTrans469.Close() + _, err470 := mbTrans469.WriteString(arg468) + if err470 != nil { Usage() return } - factory420 := thrift.NewTJSONProtocolFactory() - jsProt421 := factory420.GetProtocol(mbTrans418) + factory471 := thrift.NewTJSONProtocolFactory() + jsProt472 := factory471.GetProtocol(mbTrans469) argvalue0 := aurora.NewTaskQuery() - err422 := argvalue0.Read(jsProt421) - if err422 != nil { + err473 := argvalue0.Read(context.Background(), jsProt472) + if err473 != nil { Usage() return } @@ -543,19 +543,19 @@ func main() { fmt.Fprintln(os.Stderr, "CreateJob requires 1 args") flag.Usage() } - arg423 := flag.Arg(1) - mbTrans424 := thrift.NewTMemoryBufferLen(len(arg423)) - defer mbTrans424.Close() - _, err425 := mbTrans424.WriteString(arg423) - if err425 != nil { + arg474 := flag.Arg(1) + mbTrans475 := thrift.NewTMemoryBufferLen(len(arg474)) + defer mbTrans475.Close() + _, err476 := mbTrans475.WriteString(arg474) + if err476 != nil { Usage() return } - factory426 := thrift.NewTJSONProtocolFactory() - jsProt427 := factory426.GetProtocol(mbTrans424) + factory477 := thrift.NewTJSONProtocolFactory() + jsProt478 := factory477.GetProtocol(mbTrans475) argvalue0 := aurora.NewJobConfiguration() - err428 := argvalue0.Read(jsProt427) - if err428 != nil { + err479 := argvalue0.Read(context.Background(), jsProt478) + if err479 != nil { Usage() return } @@ -568,19 +568,19 @@ func main() { fmt.Fprintln(os.Stderr, "ScheduleCronJob requires 1 args") flag.Usage() } - arg429 := flag.Arg(1) - mbTrans430 := thrift.NewTMemoryBufferLen(len(arg429)) - defer mbTrans430.Close() - _, err431 := mbTrans430.WriteString(arg429) - if err431 != nil { + arg480 := flag.Arg(1) + mbTrans481 := thrift.NewTMemoryBufferLen(len(arg480)) + defer mbTrans481.Close() + _, err482 := mbTrans481.WriteString(arg480) + if err482 != nil { Usage() return } - factory432 := thrift.NewTJSONProtocolFactory() - jsProt433 := factory432.GetProtocol(mbTrans430) + factory483 := thrift.NewTJSONProtocolFactory() + jsProt484 := factory483.GetProtocol(mbTrans481) argvalue0 := aurora.NewJobConfiguration() - err434 := argvalue0.Read(jsProt433) - if err434 != nil { + err485 := argvalue0.Read(context.Background(), jsProt484) + if err485 != nil { Usage() return } @@ -593,19 +593,19 @@ func main() { fmt.Fprintln(os.Stderr, "DescheduleCronJob requires 1 args") flag.Usage() } - arg435 := flag.Arg(1) - mbTrans436 := thrift.NewTMemoryBufferLen(len(arg435)) - defer mbTrans436.Close() - _, err437 := mbTrans436.WriteString(arg435) - if err437 != nil { + arg486 := flag.Arg(1) + mbTrans487 := thrift.NewTMemoryBufferLen(len(arg486)) + defer mbTrans487.Close() + _, err488 := mbTrans487.WriteString(arg486) + if err488 != nil { Usage() return } - factory438 := thrift.NewTJSONProtocolFactory() - jsProt439 := factory438.GetProtocol(mbTrans436) + factory489 := thrift.NewTJSONProtocolFactory() + jsProt490 := factory489.GetProtocol(mbTrans487) argvalue0 := aurora.NewJobKey() - err440 := argvalue0.Read(jsProt439) - if err440 != nil { + err491 := argvalue0.Read(context.Background(), jsProt490) + if err491 != nil { Usage() return } @@ -618,19 +618,19 @@ func main() { fmt.Fprintln(os.Stderr, "StartCronJob requires 1 args") flag.Usage() } - arg441 := flag.Arg(1) - mbTrans442 := thrift.NewTMemoryBufferLen(len(arg441)) - defer mbTrans442.Close() - _, err443 := mbTrans442.WriteString(arg441) - if err443 != nil { + arg492 := flag.Arg(1) + mbTrans493 := thrift.NewTMemoryBufferLen(len(arg492)) + defer mbTrans493.Close() + _, err494 := mbTrans493.WriteString(arg492) + if err494 != nil { Usage() return } - factory444 := thrift.NewTJSONProtocolFactory() - jsProt445 := factory444.GetProtocol(mbTrans442) + factory495 := thrift.NewTJSONProtocolFactory() + jsProt496 := factory495.GetProtocol(mbTrans493) argvalue0 := aurora.NewJobKey() - err446 := argvalue0.Read(jsProt445) - if err446 != nil { + err497 := argvalue0.Read(context.Background(), jsProt496) + if err497 != nil { Usage() return } @@ -643,36 +643,36 @@ func main() { fmt.Fprintln(os.Stderr, "RestartShards requires 2 args") flag.Usage() } - arg447 := flag.Arg(1) - mbTrans448 := thrift.NewTMemoryBufferLen(len(arg447)) - defer mbTrans448.Close() - _, err449 := mbTrans448.WriteString(arg447) - if err449 != nil { + arg498 := flag.Arg(1) + mbTrans499 := thrift.NewTMemoryBufferLen(len(arg498)) + defer mbTrans499.Close() + _, err500 := mbTrans499.WriteString(arg498) + if err500 != nil { Usage() return } - factory450 := thrift.NewTJSONProtocolFactory() - jsProt451 := factory450.GetProtocol(mbTrans448) + factory501 := thrift.NewTJSONProtocolFactory() + jsProt502 := factory501.GetProtocol(mbTrans499) argvalue0 := aurora.NewJobKey() - err452 := argvalue0.Read(jsProt451) - if err452 != nil { + err503 := argvalue0.Read(context.Background(), jsProt502) + if err503 != nil { Usage() return } value0 := argvalue0 - arg453 := flag.Arg(2) - mbTrans454 := thrift.NewTMemoryBufferLen(len(arg453)) - defer mbTrans454.Close() - _, err455 := mbTrans454.WriteString(arg453) - if err455 != nil { + arg504 := flag.Arg(2) + mbTrans505 := thrift.NewTMemoryBufferLen(len(arg504)) + defer mbTrans505.Close() + _, err506 := mbTrans505.WriteString(arg504) + if err506 != nil { Usage() return } - factory456 := thrift.NewTJSONProtocolFactory() - jsProt457 := factory456.GetProtocol(mbTrans454) - containerStruct1 := aurora.NewAuroraAdminRestartShardsArgs() - err458 := containerStruct1.ReadField2(jsProt457) - if err458 != nil { + factory507 := thrift.NewTJSONProtocolFactory() + jsProt508 := factory507.GetProtocol(mbTrans505) + containerStruct1 := aurora.NewAuroraSchedulerManagerRestartShardsArgs() + err509 := containerStruct1.ReadField2(context.Background(), jsProt508) + if err509 != nil { Usage() return } @@ -686,36 +686,36 @@ func main() { fmt.Fprintln(os.Stderr, "KillTasks requires 3 args") flag.Usage() } - arg459 := flag.Arg(1) - mbTrans460 := thrift.NewTMemoryBufferLen(len(arg459)) - defer mbTrans460.Close() - _, err461 := mbTrans460.WriteString(arg459) - if err461 != nil { + arg510 := flag.Arg(1) + mbTrans511 := thrift.NewTMemoryBufferLen(len(arg510)) + defer mbTrans511.Close() + _, err512 := mbTrans511.WriteString(arg510) + if err512 != nil { Usage() return } - factory462 := thrift.NewTJSONProtocolFactory() - jsProt463 := factory462.GetProtocol(mbTrans460) + factory513 := thrift.NewTJSONProtocolFactory() + jsProt514 := factory513.GetProtocol(mbTrans511) argvalue0 := aurora.NewJobKey() - err464 := argvalue0.Read(jsProt463) - if err464 != nil { + err515 := argvalue0.Read(context.Background(), jsProt514) + if err515 != nil { Usage() return } value0 := argvalue0 - arg465 := flag.Arg(2) - mbTrans466 := thrift.NewTMemoryBufferLen(len(arg465)) - defer mbTrans466.Close() - _, err467 := mbTrans466.WriteString(arg465) - if err467 != nil { + arg516 := flag.Arg(2) + mbTrans517 := thrift.NewTMemoryBufferLen(len(arg516)) + defer mbTrans517.Close() + _, err518 := mbTrans517.WriteString(arg516) + if err518 != nil { Usage() return } - factory468 := thrift.NewTJSONProtocolFactory() - jsProt469 := factory468.GetProtocol(mbTrans466) - containerStruct1 := aurora.NewAuroraAdminKillTasksArgs() - err470 := containerStruct1.ReadField2(jsProt469) - if err470 != nil { + factory519 := thrift.NewTJSONProtocolFactory() + jsProt520 := factory519.GetProtocol(mbTrans517) + containerStruct1 := aurora.NewAuroraSchedulerManagerKillTasksArgs() + err521 := containerStruct1.ReadField2(context.Background(), jsProt520) + if err521 != nil { Usage() return } @@ -731,25 +731,25 @@ func main() { fmt.Fprintln(os.Stderr, "AddInstances requires 2 args") flag.Usage() } - arg472 := flag.Arg(1) - mbTrans473 := thrift.NewTMemoryBufferLen(len(arg472)) - defer mbTrans473.Close() - _, err474 := mbTrans473.WriteString(arg472) - if err474 != nil { + arg523 := flag.Arg(1) + mbTrans524 := thrift.NewTMemoryBufferLen(len(arg523)) + defer mbTrans524.Close() + _, err525 := mbTrans524.WriteString(arg523) + if err525 != nil { Usage() return } - factory475 := thrift.NewTJSONProtocolFactory() - jsProt476 := factory475.GetProtocol(mbTrans473) + factory526 := thrift.NewTJSONProtocolFactory() + jsProt527 := factory526.GetProtocol(mbTrans524) argvalue0 := aurora.NewInstanceKey() - err477 := argvalue0.Read(jsProt476) - if err477 != nil { + err528 := argvalue0.Read(context.Background(), jsProt527) + if err528 != nil { Usage() return } value0 := argvalue0 - tmp1, err478 := (strconv.Atoi(flag.Arg(2))) - if err478 != nil { + tmp1, err529 := (strconv.Atoi(flag.Arg(2))) + if err529 != nil { Usage() return } @@ -763,19 +763,19 @@ func main() { fmt.Fprintln(os.Stderr, "ReplaceCronTemplate requires 1 args") flag.Usage() } - arg479 := flag.Arg(1) - mbTrans480 := thrift.NewTMemoryBufferLen(len(arg479)) - defer mbTrans480.Close() - _, err481 := mbTrans480.WriteString(arg479) - if err481 != nil { + arg530 := flag.Arg(1) + mbTrans531 := thrift.NewTMemoryBufferLen(len(arg530)) + defer mbTrans531.Close() + _, err532 := mbTrans531.WriteString(arg530) + if err532 != nil { Usage() return } - factory482 := thrift.NewTJSONProtocolFactory() - jsProt483 := factory482.GetProtocol(mbTrans480) + factory533 := thrift.NewTJSONProtocolFactory() + jsProt534 := factory533.GetProtocol(mbTrans531) argvalue0 := aurora.NewJobConfiguration() - err484 := argvalue0.Read(jsProt483) - if err484 != nil { + err535 := argvalue0.Read(context.Background(), jsProt534) + if err535 != nil { Usage() return } @@ -788,19 +788,19 @@ func main() { fmt.Fprintln(os.Stderr, "StartJobUpdate requires 2 args") flag.Usage() } - arg485 := flag.Arg(1) - mbTrans486 := thrift.NewTMemoryBufferLen(len(arg485)) - defer mbTrans486.Close() - _, err487 := mbTrans486.WriteString(arg485) - if err487 != nil { + arg536 := flag.Arg(1) + mbTrans537 := thrift.NewTMemoryBufferLen(len(arg536)) + defer mbTrans537.Close() + _, err538 := mbTrans537.WriteString(arg536) + if err538 != nil { Usage() return } - factory488 := thrift.NewTJSONProtocolFactory() - jsProt489 := factory488.GetProtocol(mbTrans486) + factory539 := thrift.NewTJSONProtocolFactory() + jsProt540 := factory539.GetProtocol(mbTrans537) argvalue0 := aurora.NewJobUpdateRequest() - err490 := argvalue0.Read(jsProt489) - if err490 != nil { + err541 := argvalue0.Read(context.Background(), jsProt540) + if err541 != nil { Usage() return } @@ -815,19 +815,19 @@ func main() { fmt.Fprintln(os.Stderr, "PauseJobUpdate requires 2 args") flag.Usage() } - arg492 := flag.Arg(1) - mbTrans493 := thrift.NewTMemoryBufferLen(len(arg492)) - defer mbTrans493.Close() - _, err494 := mbTrans493.WriteString(arg492) - if err494 != nil { + arg543 := flag.Arg(1) + mbTrans544 := thrift.NewTMemoryBufferLen(len(arg543)) + defer mbTrans544.Close() + _, err545 := mbTrans544.WriteString(arg543) + if err545 != nil { Usage() return } - factory495 := thrift.NewTJSONProtocolFactory() - jsProt496 := factory495.GetProtocol(mbTrans493) + factory546 := thrift.NewTJSONProtocolFactory() + jsProt547 := factory546.GetProtocol(mbTrans544) argvalue0 := aurora.NewJobUpdateKey() - err497 := argvalue0.Read(jsProt496) - if err497 != nil { + err548 := argvalue0.Read(context.Background(), jsProt547) + if err548 != nil { Usage() return } @@ -842,19 +842,19 @@ func main() { fmt.Fprintln(os.Stderr, "ResumeJobUpdate requires 2 args") flag.Usage() } - arg499 := flag.Arg(1) - mbTrans500 := thrift.NewTMemoryBufferLen(len(arg499)) - defer mbTrans500.Close() - _, err501 := mbTrans500.WriteString(arg499) - if err501 != nil { + arg550 := flag.Arg(1) + mbTrans551 := thrift.NewTMemoryBufferLen(len(arg550)) + defer mbTrans551.Close() + _, err552 := mbTrans551.WriteString(arg550) + if err552 != nil { Usage() return } - factory502 := thrift.NewTJSONProtocolFactory() - jsProt503 := factory502.GetProtocol(mbTrans500) + factory553 := thrift.NewTJSONProtocolFactory() + jsProt554 := factory553.GetProtocol(mbTrans551) argvalue0 := aurora.NewJobUpdateKey() - err504 := argvalue0.Read(jsProt503) - if err504 != nil { + err555 := argvalue0.Read(context.Background(), jsProt554) + if err555 != nil { Usage() return } @@ -869,19 +869,19 @@ func main() { fmt.Fprintln(os.Stderr, "AbortJobUpdate requires 2 args") flag.Usage() } - arg506 := flag.Arg(1) - mbTrans507 := thrift.NewTMemoryBufferLen(len(arg506)) - defer mbTrans507.Close() - _, err508 := mbTrans507.WriteString(arg506) - if err508 != nil { + arg557 := flag.Arg(1) + mbTrans558 := thrift.NewTMemoryBufferLen(len(arg557)) + defer mbTrans558.Close() + _, err559 := mbTrans558.WriteString(arg557) + if err559 != nil { Usage() return } - factory509 := thrift.NewTJSONProtocolFactory() - jsProt510 := factory509.GetProtocol(mbTrans507) + factory560 := thrift.NewTJSONProtocolFactory() + jsProt561 := factory560.GetProtocol(mbTrans558) argvalue0 := aurora.NewJobUpdateKey() - err511 := argvalue0.Read(jsProt510) - if err511 != nil { + err562 := argvalue0.Read(context.Background(), jsProt561) + if err562 != nil { Usage() return } @@ -896,19 +896,19 @@ func main() { fmt.Fprintln(os.Stderr, "RollbackJobUpdate requires 2 args") flag.Usage() } - arg513 := flag.Arg(1) - mbTrans514 := thrift.NewTMemoryBufferLen(len(arg513)) - defer mbTrans514.Close() - _, err515 := mbTrans514.WriteString(arg513) - if err515 != nil { + arg564 := flag.Arg(1) + mbTrans565 := thrift.NewTMemoryBufferLen(len(arg564)) + defer mbTrans565.Close() + _, err566 := mbTrans565.WriteString(arg564) + if err566 != nil { Usage() return } - factory516 := thrift.NewTJSONProtocolFactory() - jsProt517 := factory516.GetProtocol(mbTrans514) + factory567 := thrift.NewTJSONProtocolFactory() + jsProt568 := factory567.GetProtocol(mbTrans565) argvalue0 := aurora.NewJobUpdateKey() - err518 := argvalue0.Read(jsProt517) - if err518 != nil { + err569 := argvalue0.Read(context.Background(), jsProt568) + if err569 != nil { Usage() return } @@ -923,19 +923,19 @@ func main() { fmt.Fprintln(os.Stderr, "PulseJobUpdate requires 1 args") flag.Usage() } - arg520 := flag.Arg(1) - mbTrans521 := thrift.NewTMemoryBufferLen(len(arg520)) - defer mbTrans521.Close() - _, err522 := mbTrans521.WriteString(arg520) - if err522 != nil { + arg571 := flag.Arg(1) + mbTrans572 := thrift.NewTMemoryBufferLen(len(arg571)) + defer mbTrans572.Close() + _, err573 := mbTrans572.WriteString(arg571) + if err573 != nil { Usage() return } - factory523 := thrift.NewTJSONProtocolFactory() - jsProt524 := factory523.GetProtocol(mbTrans521) + factory574 := thrift.NewTJSONProtocolFactory() + jsProt575 := factory574.GetProtocol(mbTrans572) argvalue0 := aurora.NewJobUpdateKey() - err525 := argvalue0.Read(jsProt524) - if err525 != nil { + err576 := argvalue0.Read(context.Background(), jsProt575) + if err576 != nil { Usage() return } @@ -966,19 +966,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTasksStatus requires 1 args") flag.Usage() } - arg527 := flag.Arg(1) - mbTrans528 := thrift.NewTMemoryBufferLen(len(arg527)) - defer mbTrans528.Close() - _, err529 := mbTrans528.WriteString(arg527) - if err529 != nil { + arg578 := flag.Arg(1) + mbTrans579 := thrift.NewTMemoryBufferLen(len(arg578)) + defer mbTrans579.Close() + _, err580 := mbTrans579.WriteString(arg578) + if err580 != nil { Usage() return } - factory530 := thrift.NewTJSONProtocolFactory() - jsProt531 := factory530.GetProtocol(mbTrans528) + factory581 := thrift.NewTJSONProtocolFactory() + jsProt582 := factory581.GetProtocol(mbTrans579) argvalue0 := aurora.NewTaskQuery() - err532 := argvalue0.Read(jsProt531) - if err532 != nil { + err583 := argvalue0.Read(context.Background(), jsProt582) + if err583 != nil { Usage() return } @@ -991,19 +991,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTasksWithoutConfigs requires 1 args") flag.Usage() } - arg533 := flag.Arg(1) - mbTrans534 := thrift.NewTMemoryBufferLen(len(arg533)) - defer mbTrans534.Close() - _, err535 := mbTrans534.WriteString(arg533) - if err535 != nil { + arg584 := flag.Arg(1) + mbTrans585 := thrift.NewTMemoryBufferLen(len(arg584)) + defer mbTrans585.Close() + _, err586 := mbTrans585.WriteString(arg584) + if err586 != nil { Usage() return } - factory536 := thrift.NewTJSONProtocolFactory() - jsProt537 := factory536.GetProtocol(mbTrans534) + factory587 := thrift.NewTJSONProtocolFactory() + jsProt588 := factory587.GetProtocol(mbTrans585) argvalue0 := aurora.NewTaskQuery() - err538 := argvalue0.Read(jsProt537) - if err538 != nil { + err589 := argvalue0.Read(context.Background(), jsProt588) + if err589 != nil { Usage() return } @@ -1016,19 +1016,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetPendingReason requires 1 args") flag.Usage() } - arg539 := flag.Arg(1) - mbTrans540 := thrift.NewTMemoryBufferLen(len(arg539)) - defer mbTrans540.Close() - _, err541 := mbTrans540.WriteString(arg539) - if err541 != nil { + arg590 := flag.Arg(1) + mbTrans591 := thrift.NewTMemoryBufferLen(len(arg590)) + defer mbTrans591.Close() + _, err592 := mbTrans591.WriteString(arg590) + if err592 != nil { Usage() return } - factory542 := thrift.NewTJSONProtocolFactory() - jsProt543 := factory542.GetProtocol(mbTrans540) + factory593 := thrift.NewTJSONProtocolFactory() + jsProt594 := factory593.GetProtocol(mbTrans591) argvalue0 := aurora.NewTaskQuery() - err544 := argvalue0.Read(jsProt543) - if err544 != nil { + err595 := argvalue0.Read(context.Background(), jsProt594) + if err595 != nil { Usage() return } @@ -1041,19 +1041,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetConfigSummary requires 1 args") flag.Usage() } - arg545 := flag.Arg(1) - mbTrans546 := thrift.NewTMemoryBufferLen(len(arg545)) - defer mbTrans546.Close() - _, err547 := mbTrans546.WriteString(arg545) - if err547 != nil { + arg596 := flag.Arg(1) + mbTrans597 := thrift.NewTMemoryBufferLen(len(arg596)) + defer mbTrans597.Close() + _, err598 := mbTrans597.WriteString(arg596) + if err598 != nil { Usage() return } - factory548 := thrift.NewTJSONProtocolFactory() - jsProt549 := factory548.GetProtocol(mbTrans546) + factory599 := thrift.NewTJSONProtocolFactory() + jsProt600 := factory599.GetProtocol(mbTrans597) argvalue0 := aurora.NewJobKey() - err550 := argvalue0.Read(jsProt549) - if err550 != nil { + err601 := argvalue0.Read(context.Background(), jsProt600) + if err601 != nil { Usage() return } @@ -1086,19 +1086,19 @@ func main() { fmt.Fprintln(os.Stderr, "PopulateJobConfig requires 1 args") flag.Usage() } - arg553 := flag.Arg(1) - mbTrans554 := thrift.NewTMemoryBufferLen(len(arg553)) - defer mbTrans554.Close() - _, err555 := mbTrans554.WriteString(arg553) - if err555 != nil { + arg604 := flag.Arg(1) + mbTrans605 := thrift.NewTMemoryBufferLen(len(arg604)) + defer mbTrans605.Close() + _, err606 := mbTrans605.WriteString(arg604) + if err606 != nil { Usage() return } - factory556 := thrift.NewTJSONProtocolFactory() - jsProt557 := factory556.GetProtocol(mbTrans554) + factory607 := thrift.NewTJSONProtocolFactory() + jsProt608 := factory607.GetProtocol(mbTrans605) argvalue0 := aurora.NewJobConfiguration() - err558 := argvalue0.Read(jsProt557) - if err558 != nil { + err609 := argvalue0.Read(context.Background(), jsProt608) + if err609 != nil { Usage() return } @@ -1111,19 +1111,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateSummaries requires 1 args") flag.Usage() } - arg559 := flag.Arg(1) - mbTrans560 := thrift.NewTMemoryBufferLen(len(arg559)) - defer mbTrans560.Close() - _, err561 := mbTrans560.WriteString(arg559) - if err561 != nil { + arg610 := flag.Arg(1) + mbTrans611 := thrift.NewTMemoryBufferLen(len(arg610)) + defer mbTrans611.Close() + _, err612 := mbTrans611.WriteString(arg610) + if err612 != nil { Usage() return } - factory562 := thrift.NewTJSONProtocolFactory() - jsProt563 := factory562.GetProtocol(mbTrans560) + factory613 := thrift.NewTJSONProtocolFactory() + jsProt614 := factory613.GetProtocol(mbTrans611) argvalue0 := aurora.NewJobUpdateQuery() - err564 := argvalue0.Read(jsProt563) - if err564 != nil { + err615 := argvalue0.Read(context.Background(), jsProt614) + if err615 != nil { Usage() return } @@ -1136,19 +1136,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateDetails requires 1 args") flag.Usage() } - arg565 := flag.Arg(1) - mbTrans566 := thrift.NewTMemoryBufferLen(len(arg565)) - defer mbTrans566.Close() - _, err567 := mbTrans566.WriteString(arg565) - if err567 != nil { + arg616 := flag.Arg(1) + mbTrans617 := thrift.NewTMemoryBufferLen(len(arg616)) + defer mbTrans617.Close() + _, err618 := mbTrans617.WriteString(arg616) + if err618 != nil { Usage() return } - factory568 := thrift.NewTJSONProtocolFactory() - jsProt569 := factory568.GetProtocol(mbTrans566) + factory619 := thrift.NewTJSONProtocolFactory() + jsProt620 := factory619.GetProtocol(mbTrans617) argvalue0 := aurora.NewJobUpdateQuery() - err570 := argvalue0.Read(jsProt569) - if err570 != nil { + err621 := argvalue0.Read(context.Background(), jsProt620) + if err621 != nil { Usage() return } @@ -1161,19 +1161,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateDiff requires 1 args") flag.Usage() } - arg571 := flag.Arg(1) - mbTrans572 := thrift.NewTMemoryBufferLen(len(arg571)) - defer mbTrans572.Close() - _, err573 := mbTrans572.WriteString(arg571) - if err573 != nil { + arg622 := flag.Arg(1) + mbTrans623 := thrift.NewTMemoryBufferLen(len(arg622)) + defer mbTrans623.Close() + _, err624 := mbTrans623.WriteString(arg622) + if err624 != nil { Usage() return } - factory574 := thrift.NewTJSONProtocolFactory() - jsProt575 := factory574.GetProtocol(mbTrans572) + factory625 := thrift.NewTJSONProtocolFactory() + jsProt626 := factory625.GetProtocol(mbTrans623) argvalue0 := aurora.NewJobUpdateRequest() - err576 := argvalue0.Read(jsProt575) - if err576 != nil { + err627 := argvalue0.Read(context.Background(), jsProt626) + if err627 != nil { Usage() return } diff --git a/gen-go/apache/aurora/aurora_scheduler_manager-remote/aurora_scheduler_manager-remote.go b/gen-go/apache/aurora/aurora_scheduler_manager-remote/aurora_scheduler_manager-remote.go index bc3abe9..b4715d5 100755 --- a/gen-go/apache/aurora/aurora_scheduler_manager-remote/aurora_scheduler_manager-remote.go +++ b/gen-go/apache/aurora/aurora_scheduler_manager-remote/aurora_scheduler_manager-remote.go @@ -1,22 +1,22 @@ -// Autogenerated by Thrift Compiler (0.12.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. package main import ( - "context" - "flag" - "fmt" - "math" - "net" - "net/url" - "os" - "strconv" - "strings" - "github.com/apache/thrift/lib/go/thrift" - "apache/aurora" + "context" + "flag" + "fmt" + "math" + "net" + "net/url" + "os" + "strconv" + "strings" + "github.com/apache/thrift/lib/go/thrift" + "apache/aurora" ) +var _ = aurora.GoUnusedProtection__ func Usage() { fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") @@ -175,19 +175,19 @@ func main() { fmt.Fprintln(os.Stderr, "CreateJob requires 1 args") flag.Usage() } - arg162 := flag.Arg(1) - mbTrans163 := thrift.NewTMemoryBufferLen(len(arg162)) - defer mbTrans163.Close() - _, err164 := mbTrans163.WriteString(arg162) - if err164 != nil { + arg213 := flag.Arg(1) + mbTrans214 := thrift.NewTMemoryBufferLen(len(arg213)) + defer mbTrans214.Close() + _, err215 := mbTrans214.WriteString(arg213) + if err215 != nil { Usage() return } - factory165 := thrift.NewTJSONProtocolFactory() - jsProt166 := factory165.GetProtocol(mbTrans163) + factory216 := thrift.NewTJSONProtocolFactory() + jsProt217 := factory216.GetProtocol(mbTrans214) argvalue0 := aurora.NewJobConfiguration() - err167 := argvalue0.Read(jsProt166) - if err167 != nil { + err218 := argvalue0.Read(context.Background(), jsProt217) + if err218 != nil { Usage() return } @@ -200,19 +200,19 @@ func main() { fmt.Fprintln(os.Stderr, "ScheduleCronJob requires 1 args") flag.Usage() } - arg168 := flag.Arg(1) - mbTrans169 := thrift.NewTMemoryBufferLen(len(arg168)) - defer mbTrans169.Close() - _, err170 := mbTrans169.WriteString(arg168) - if err170 != nil { + arg219 := flag.Arg(1) + mbTrans220 := thrift.NewTMemoryBufferLen(len(arg219)) + defer mbTrans220.Close() + _, err221 := mbTrans220.WriteString(arg219) + if err221 != nil { Usage() return } - factory171 := thrift.NewTJSONProtocolFactory() - jsProt172 := factory171.GetProtocol(mbTrans169) + factory222 := thrift.NewTJSONProtocolFactory() + jsProt223 := factory222.GetProtocol(mbTrans220) argvalue0 := aurora.NewJobConfiguration() - err173 := argvalue0.Read(jsProt172) - if err173 != nil { + err224 := argvalue0.Read(context.Background(), jsProt223) + if err224 != nil { Usage() return } @@ -225,19 +225,19 @@ func main() { fmt.Fprintln(os.Stderr, "DescheduleCronJob requires 1 args") flag.Usage() } - arg174 := flag.Arg(1) - mbTrans175 := thrift.NewTMemoryBufferLen(len(arg174)) - defer mbTrans175.Close() - _, err176 := mbTrans175.WriteString(arg174) - if err176 != nil { + arg225 := flag.Arg(1) + mbTrans226 := thrift.NewTMemoryBufferLen(len(arg225)) + defer mbTrans226.Close() + _, err227 := mbTrans226.WriteString(arg225) + if err227 != nil { Usage() return } - factory177 := thrift.NewTJSONProtocolFactory() - jsProt178 := factory177.GetProtocol(mbTrans175) + factory228 := thrift.NewTJSONProtocolFactory() + jsProt229 := factory228.GetProtocol(mbTrans226) argvalue0 := aurora.NewJobKey() - err179 := argvalue0.Read(jsProt178) - if err179 != nil { + err230 := argvalue0.Read(context.Background(), jsProt229) + if err230 != nil { Usage() return } @@ -250,19 +250,19 @@ func main() { fmt.Fprintln(os.Stderr, "StartCronJob requires 1 args") flag.Usage() } - arg180 := flag.Arg(1) - mbTrans181 := thrift.NewTMemoryBufferLen(len(arg180)) - defer mbTrans181.Close() - _, err182 := mbTrans181.WriteString(arg180) - if err182 != nil { + arg231 := flag.Arg(1) + mbTrans232 := thrift.NewTMemoryBufferLen(len(arg231)) + defer mbTrans232.Close() + _, err233 := mbTrans232.WriteString(arg231) + if err233 != nil { Usage() return } - factory183 := thrift.NewTJSONProtocolFactory() - jsProt184 := factory183.GetProtocol(mbTrans181) + factory234 := thrift.NewTJSONProtocolFactory() + jsProt235 := factory234.GetProtocol(mbTrans232) argvalue0 := aurora.NewJobKey() - err185 := argvalue0.Read(jsProt184) - if err185 != nil { + err236 := argvalue0.Read(context.Background(), jsProt235) + if err236 != nil { Usage() return } @@ -275,36 +275,36 @@ func main() { fmt.Fprintln(os.Stderr, "RestartShards requires 2 args") flag.Usage() } - arg186 := flag.Arg(1) - mbTrans187 := thrift.NewTMemoryBufferLen(len(arg186)) - defer mbTrans187.Close() - _, err188 := mbTrans187.WriteString(arg186) - if err188 != nil { + arg237 := flag.Arg(1) + mbTrans238 := thrift.NewTMemoryBufferLen(len(arg237)) + defer mbTrans238.Close() + _, err239 := mbTrans238.WriteString(arg237) + if err239 != nil { Usage() return } - factory189 := thrift.NewTJSONProtocolFactory() - jsProt190 := factory189.GetProtocol(mbTrans187) + factory240 := thrift.NewTJSONProtocolFactory() + jsProt241 := factory240.GetProtocol(mbTrans238) argvalue0 := aurora.NewJobKey() - err191 := argvalue0.Read(jsProt190) - if err191 != nil { + err242 := argvalue0.Read(context.Background(), jsProt241) + if err242 != nil { Usage() return } value0 := argvalue0 - arg192 := flag.Arg(2) - mbTrans193 := thrift.NewTMemoryBufferLen(len(arg192)) - defer mbTrans193.Close() - _, err194 := mbTrans193.WriteString(arg192) - if err194 != nil { + arg243 := flag.Arg(2) + mbTrans244 := thrift.NewTMemoryBufferLen(len(arg243)) + defer mbTrans244.Close() + _, err245 := mbTrans244.WriteString(arg243) + if err245 != nil { Usage() return } - factory195 := thrift.NewTJSONProtocolFactory() - jsProt196 := factory195.GetProtocol(mbTrans193) + factory246 := thrift.NewTJSONProtocolFactory() + jsProt247 := factory246.GetProtocol(mbTrans244) containerStruct1 := aurora.NewAuroraSchedulerManagerRestartShardsArgs() - err197 := containerStruct1.ReadField2(jsProt196) - if err197 != nil { + err248 := containerStruct1.ReadField2(context.Background(), jsProt247) + if err248 != nil { Usage() return } @@ -318,36 +318,36 @@ func main() { fmt.Fprintln(os.Stderr, "KillTasks requires 3 args") flag.Usage() } - arg198 := flag.Arg(1) - mbTrans199 := thrift.NewTMemoryBufferLen(len(arg198)) - defer mbTrans199.Close() - _, err200 := mbTrans199.WriteString(arg198) - if err200 != nil { + arg249 := flag.Arg(1) + mbTrans250 := thrift.NewTMemoryBufferLen(len(arg249)) + defer mbTrans250.Close() + _, err251 := mbTrans250.WriteString(arg249) + if err251 != nil { Usage() return } - factory201 := thrift.NewTJSONProtocolFactory() - jsProt202 := factory201.GetProtocol(mbTrans199) + factory252 := thrift.NewTJSONProtocolFactory() + jsProt253 := factory252.GetProtocol(mbTrans250) argvalue0 := aurora.NewJobKey() - err203 := argvalue0.Read(jsProt202) - if err203 != nil { + err254 := argvalue0.Read(context.Background(), jsProt253) + if err254 != nil { Usage() return } value0 := argvalue0 - arg204 := flag.Arg(2) - mbTrans205 := thrift.NewTMemoryBufferLen(len(arg204)) - defer mbTrans205.Close() - _, err206 := mbTrans205.WriteString(arg204) - if err206 != nil { + arg255 := flag.Arg(2) + mbTrans256 := thrift.NewTMemoryBufferLen(len(arg255)) + defer mbTrans256.Close() + _, err257 := mbTrans256.WriteString(arg255) + if err257 != nil { Usage() return } - factory207 := thrift.NewTJSONProtocolFactory() - jsProt208 := factory207.GetProtocol(mbTrans205) + factory258 := thrift.NewTJSONProtocolFactory() + jsProt259 := factory258.GetProtocol(mbTrans256) containerStruct1 := aurora.NewAuroraSchedulerManagerKillTasksArgs() - err209 := containerStruct1.ReadField2(jsProt208) - if err209 != nil { + err260 := containerStruct1.ReadField2(context.Background(), jsProt259) + if err260 != nil { Usage() return } @@ -363,25 +363,25 @@ func main() { fmt.Fprintln(os.Stderr, "AddInstances requires 2 args") flag.Usage() } - arg211 := flag.Arg(1) - mbTrans212 := thrift.NewTMemoryBufferLen(len(arg211)) - defer mbTrans212.Close() - _, err213 := mbTrans212.WriteString(arg211) - if err213 != nil { + arg262 := flag.Arg(1) + mbTrans263 := thrift.NewTMemoryBufferLen(len(arg262)) + defer mbTrans263.Close() + _, err264 := mbTrans263.WriteString(arg262) + if err264 != nil { Usage() return } - factory214 := thrift.NewTJSONProtocolFactory() - jsProt215 := factory214.GetProtocol(mbTrans212) + factory265 := thrift.NewTJSONProtocolFactory() + jsProt266 := factory265.GetProtocol(mbTrans263) argvalue0 := aurora.NewInstanceKey() - err216 := argvalue0.Read(jsProt215) - if err216 != nil { + err267 := argvalue0.Read(context.Background(), jsProt266) + if err267 != nil { Usage() return } value0 := argvalue0 - tmp1, err217 := (strconv.Atoi(flag.Arg(2))) - if err217 != nil { + tmp1, err268 := (strconv.Atoi(flag.Arg(2))) + if err268 != nil { Usage() return } @@ -395,19 +395,19 @@ func main() { fmt.Fprintln(os.Stderr, "ReplaceCronTemplate requires 1 args") flag.Usage() } - arg218 := flag.Arg(1) - mbTrans219 := thrift.NewTMemoryBufferLen(len(arg218)) - defer mbTrans219.Close() - _, err220 := mbTrans219.WriteString(arg218) - if err220 != nil { + arg269 := flag.Arg(1) + mbTrans270 := thrift.NewTMemoryBufferLen(len(arg269)) + defer mbTrans270.Close() + _, err271 := mbTrans270.WriteString(arg269) + if err271 != nil { Usage() return } - factory221 := thrift.NewTJSONProtocolFactory() - jsProt222 := factory221.GetProtocol(mbTrans219) + factory272 := thrift.NewTJSONProtocolFactory() + jsProt273 := factory272.GetProtocol(mbTrans270) argvalue0 := aurora.NewJobConfiguration() - err223 := argvalue0.Read(jsProt222) - if err223 != nil { + err274 := argvalue0.Read(context.Background(), jsProt273) + if err274 != nil { Usage() return } @@ -420,19 +420,19 @@ func main() { fmt.Fprintln(os.Stderr, "StartJobUpdate requires 2 args") flag.Usage() } - arg224 := flag.Arg(1) - mbTrans225 := thrift.NewTMemoryBufferLen(len(arg224)) - defer mbTrans225.Close() - _, err226 := mbTrans225.WriteString(arg224) - if err226 != nil { + arg275 := flag.Arg(1) + mbTrans276 := thrift.NewTMemoryBufferLen(len(arg275)) + defer mbTrans276.Close() + _, err277 := mbTrans276.WriteString(arg275) + if err277 != nil { Usage() return } - factory227 := thrift.NewTJSONProtocolFactory() - jsProt228 := factory227.GetProtocol(mbTrans225) + factory278 := thrift.NewTJSONProtocolFactory() + jsProt279 := factory278.GetProtocol(mbTrans276) argvalue0 := aurora.NewJobUpdateRequest() - err229 := argvalue0.Read(jsProt228) - if err229 != nil { + err280 := argvalue0.Read(context.Background(), jsProt279) + if err280 != nil { Usage() return } @@ -447,19 +447,19 @@ func main() { fmt.Fprintln(os.Stderr, "PauseJobUpdate requires 2 args") flag.Usage() } - arg231 := flag.Arg(1) - mbTrans232 := thrift.NewTMemoryBufferLen(len(arg231)) - defer mbTrans232.Close() - _, err233 := mbTrans232.WriteString(arg231) - if err233 != nil { + arg282 := flag.Arg(1) + mbTrans283 := thrift.NewTMemoryBufferLen(len(arg282)) + defer mbTrans283.Close() + _, err284 := mbTrans283.WriteString(arg282) + if err284 != nil { Usage() return } - factory234 := thrift.NewTJSONProtocolFactory() - jsProt235 := factory234.GetProtocol(mbTrans232) + factory285 := thrift.NewTJSONProtocolFactory() + jsProt286 := factory285.GetProtocol(mbTrans283) argvalue0 := aurora.NewJobUpdateKey() - err236 := argvalue0.Read(jsProt235) - if err236 != nil { + err287 := argvalue0.Read(context.Background(), jsProt286) + if err287 != nil { Usage() return } @@ -474,19 +474,19 @@ func main() { fmt.Fprintln(os.Stderr, "ResumeJobUpdate requires 2 args") flag.Usage() } - arg238 := flag.Arg(1) - mbTrans239 := thrift.NewTMemoryBufferLen(len(arg238)) - defer mbTrans239.Close() - _, err240 := mbTrans239.WriteString(arg238) - if err240 != nil { + arg289 := flag.Arg(1) + mbTrans290 := thrift.NewTMemoryBufferLen(len(arg289)) + defer mbTrans290.Close() + _, err291 := mbTrans290.WriteString(arg289) + if err291 != nil { Usage() return } - factory241 := thrift.NewTJSONProtocolFactory() - jsProt242 := factory241.GetProtocol(mbTrans239) + factory292 := thrift.NewTJSONProtocolFactory() + jsProt293 := factory292.GetProtocol(mbTrans290) argvalue0 := aurora.NewJobUpdateKey() - err243 := argvalue0.Read(jsProt242) - if err243 != nil { + err294 := argvalue0.Read(context.Background(), jsProt293) + if err294 != nil { Usage() return } @@ -501,19 +501,19 @@ func main() { fmt.Fprintln(os.Stderr, "AbortJobUpdate requires 2 args") flag.Usage() } - arg245 := flag.Arg(1) - mbTrans246 := thrift.NewTMemoryBufferLen(len(arg245)) - defer mbTrans246.Close() - _, err247 := mbTrans246.WriteString(arg245) - if err247 != nil { + arg296 := flag.Arg(1) + mbTrans297 := thrift.NewTMemoryBufferLen(len(arg296)) + defer mbTrans297.Close() + _, err298 := mbTrans297.WriteString(arg296) + if err298 != nil { Usage() return } - factory248 := thrift.NewTJSONProtocolFactory() - jsProt249 := factory248.GetProtocol(mbTrans246) + factory299 := thrift.NewTJSONProtocolFactory() + jsProt300 := factory299.GetProtocol(mbTrans297) argvalue0 := aurora.NewJobUpdateKey() - err250 := argvalue0.Read(jsProt249) - if err250 != nil { + err301 := argvalue0.Read(context.Background(), jsProt300) + if err301 != nil { Usage() return } @@ -528,19 +528,19 @@ func main() { fmt.Fprintln(os.Stderr, "RollbackJobUpdate requires 2 args") flag.Usage() } - arg252 := flag.Arg(1) - mbTrans253 := thrift.NewTMemoryBufferLen(len(arg252)) - defer mbTrans253.Close() - _, err254 := mbTrans253.WriteString(arg252) - if err254 != nil { + arg303 := flag.Arg(1) + mbTrans304 := thrift.NewTMemoryBufferLen(len(arg303)) + defer mbTrans304.Close() + _, err305 := mbTrans304.WriteString(arg303) + if err305 != nil { Usage() return } - factory255 := thrift.NewTJSONProtocolFactory() - jsProt256 := factory255.GetProtocol(mbTrans253) + factory306 := thrift.NewTJSONProtocolFactory() + jsProt307 := factory306.GetProtocol(mbTrans304) argvalue0 := aurora.NewJobUpdateKey() - err257 := argvalue0.Read(jsProt256) - if err257 != nil { + err308 := argvalue0.Read(context.Background(), jsProt307) + if err308 != nil { Usage() return } @@ -555,19 +555,19 @@ func main() { fmt.Fprintln(os.Stderr, "PulseJobUpdate requires 1 args") flag.Usage() } - arg259 := flag.Arg(1) - mbTrans260 := thrift.NewTMemoryBufferLen(len(arg259)) - defer mbTrans260.Close() - _, err261 := mbTrans260.WriteString(arg259) - if err261 != nil { + arg310 := flag.Arg(1) + mbTrans311 := thrift.NewTMemoryBufferLen(len(arg310)) + defer mbTrans311.Close() + _, err312 := mbTrans311.WriteString(arg310) + if err312 != nil { Usage() return } - factory262 := thrift.NewTJSONProtocolFactory() - jsProt263 := factory262.GetProtocol(mbTrans260) + factory313 := thrift.NewTJSONProtocolFactory() + jsProt314 := factory313.GetProtocol(mbTrans311) argvalue0 := aurora.NewJobUpdateKey() - err264 := argvalue0.Read(jsProt263) - if err264 != nil { + err315 := argvalue0.Read(context.Background(), jsProt314) + if err315 != nil { Usage() return } @@ -598,19 +598,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTasksStatus requires 1 args") flag.Usage() } - arg266 := flag.Arg(1) - mbTrans267 := thrift.NewTMemoryBufferLen(len(arg266)) - defer mbTrans267.Close() - _, err268 := mbTrans267.WriteString(arg266) - if err268 != nil { + arg317 := flag.Arg(1) + mbTrans318 := thrift.NewTMemoryBufferLen(len(arg317)) + defer mbTrans318.Close() + _, err319 := mbTrans318.WriteString(arg317) + if err319 != nil { Usage() return } - factory269 := thrift.NewTJSONProtocolFactory() - jsProt270 := factory269.GetProtocol(mbTrans267) + factory320 := thrift.NewTJSONProtocolFactory() + jsProt321 := factory320.GetProtocol(mbTrans318) argvalue0 := aurora.NewTaskQuery() - err271 := argvalue0.Read(jsProt270) - if err271 != nil { + err322 := argvalue0.Read(context.Background(), jsProt321) + if err322 != nil { Usage() return } @@ -623,19 +623,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTasksWithoutConfigs requires 1 args") flag.Usage() } - arg272 := flag.Arg(1) - mbTrans273 := thrift.NewTMemoryBufferLen(len(arg272)) - defer mbTrans273.Close() - _, err274 := mbTrans273.WriteString(arg272) - if err274 != nil { + arg323 := flag.Arg(1) + mbTrans324 := thrift.NewTMemoryBufferLen(len(arg323)) + defer mbTrans324.Close() + _, err325 := mbTrans324.WriteString(arg323) + if err325 != nil { Usage() return } - factory275 := thrift.NewTJSONProtocolFactory() - jsProt276 := factory275.GetProtocol(mbTrans273) + factory326 := thrift.NewTJSONProtocolFactory() + jsProt327 := factory326.GetProtocol(mbTrans324) argvalue0 := aurora.NewTaskQuery() - err277 := argvalue0.Read(jsProt276) - if err277 != nil { + err328 := argvalue0.Read(context.Background(), jsProt327) + if err328 != nil { Usage() return } @@ -648,19 +648,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetPendingReason requires 1 args") flag.Usage() } - arg278 := flag.Arg(1) - mbTrans279 := thrift.NewTMemoryBufferLen(len(arg278)) - defer mbTrans279.Close() - _, err280 := mbTrans279.WriteString(arg278) - if err280 != nil { + arg329 := flag.Arg(1) + mbTrans330 := thrift.NewTMemoryBufferLen(len(arg329)) + defer mbTrans330.Close() + _, err331 := mbTrans330.WriteString(arg329) + if err331 != nil { Usage() return } - factory281 := thrift.NewTJSONProtocolFactory() - jsProt282 := factory281.GetProtocol(mbTrans279) + factory332 := thrift.NewTJSONProtocolFactory() + jsProt333 := factory332.GetProtocol(mbTrans330) argvalue0 := aurora.NewTaskQuery() - err283 := argvalue0.Read(jsProt282) - if err283 != nil { + err334 := argvalue0.Read(context.Background(), jsProt333) + if err334 != nil { Usage() return } @@ -673,19 +673,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetConfigSummary requires 1 args") flag.Usage() } - arg284 := flag.Arg(1) - mbTrans285 := thrift.NewTMemoryBufferLen(len(arg284)) - defer mbTrans285.Close() - _, err286 := mbTrans285.WriteString(arg284) - if err286 != nil { + arg335 := flag.Arg(1) + mbTrans336 := thrift.NewTMemoryBufferLen(len(arg335)) + defer mbTrans336.Close() + _, err337 := mbTrans336.WriteString(arg335) + if err337 != nil { Usage() return } - factory287 := thrift.NewTJSONProtocolFactory() - jsProt288 := factory287.GetProtocol(mbTrans285) + factory338 := thrift.NewTJSONProtocolFactory() + jsProt339 := factory338.GetProtocol(mbTrans336) argvalue0 := aurora.NewJobKey() - err289 := argvalue0.Read(jsProt288) - if err289 != nil { + err340 := argvalue0.Read(context.Background(), jsProt339) + if err340 != nil { Usage() return } @@ -718,19 +718,19 @@ func main() { fmt.Fprintln(os.Stderr, "PopulateJobConfig requires 1 args") flag.Usage() } - arg292 := flag.Arg(1) - mbTrans293 := thrift.NewTMemoryBufferLen(len(arg292)) - defer mbTrans293.Close() - _, err294 := mbTrans293.WriteString(arg292) - if err294 != nil { + arg343 := flag.Arg(1) + mbTrans344 := thrift.NewTMemoryBufferLen(len(arg343)) + defer mbTrans344.Close() + _, err345 := mbTrans344.WriteString(arg343) + if err345 != nil { Usage() return } - factory295 := thrift.NewTJSONProtocolFactory() - jsProt296 := factory295.GetProtocol(mbTrans293) + factory346 := thrift.NewTJSONProtocolFactory() + jsProt347 := factory346.GetProtocol(mbTrans344) argvalue0 := aurora.NewJobConfiguration() - err297 := argvalue0.Read(jsProt296) - if err297 != nil { + err348 := argvalue0.Read(context.Background(), jsProt347) + if err348 != nil { Usage() return } @@ -743,19 +743,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateSummaries requires 1 args") flag.Usage() } - arg298 := flag.Arg(1) - mbTrans299 := thrift.NewTMemoryBufferLen(len(arg298)) - defer mbTrans299.Close() - _, err300 := mbTrans299.WriteString(arg298) - if err300 != nil { + arg349 := flag.Arg(1) + mbTrans350 := thrift.NewTMemoryBufferLen(len(arg349)) + defer mbTrans350.Close() + _, err351 := mbTrans350.WriteString(arg349) + if err351 != nil { Usage() return } - factory301 := thrift.NewTJSONProtocolFactory() - jsProt302 := factory301.GetProtocol(mbTrans299) + factory352 := thrift.NewTJSONProtocolFactory() + jsProt353 := factory352.GetProtocol(mbTrans350) argvalue0 := aurora.NewJobUpdateQuery() - err303 := argvalue0.Read(jsProt302) - if err303 != nil { + err354 := argvalue0.Read(context.Background(), jsProt353) + if err354 != nil { Usage() return } @@ -768,19 +768,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateDetails requires 1 args") flag.Usage() } - arg304 := flag.Arg(1) - mbTrans305 := thrift.NewTMemoryBufferLen(len(arg304)) - defer mbTrans305.Close() - _, err306 := mbTrans305.WriteString(arg304) - if err306 != nil { + arg355 := flag.Arg(1) + mbTrans356 := thrift.NewTMemoryBufferLen(len(arg355)) + defer mbTrans356.Close() + _, err357 := mbTrans356.WriteString(arg355) + if err357 != nil { Usage() return } - factory307 := thrift.NewTJSONProtocolFactory() - jsProt308 := factory307.GetProtocol(mbTrans305) + factory358 := thrift.NewTJSONProtocolFactory() + jsProt359 := factory358.GetProtocol(mbTrans356) argvalue0 := aurora.NewJobUpdateQuery() - err309 := argvalue0.Read(jsProt308) - if err309 != nil { + err360 := argvalue0.Read(context.Background(), jsProt359) + if err360 != nil { Usage() return } @@ -793,19 +793,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateDiff requires 1 args") flag.Usage() } - arg310 := flag.Arg(1) - mbTrans311 := thrift.NewTMemoryBufferLen(len(arg310)) - defer mbTrans311.Close() - _, err312 := mbTrans311.WriteString(arg310) - if err312 != nil { + arg361 := flag.Arg(1) + mbTrans362 := thrift.NewTMemoryBufferLen(len(arg361)) + defer mbTrans362.Close() + _, err363 := mbTrans362.WriteString(arg361) + if err363 != nil { Usage() return } - factory313 := thrift.NewTJSONProtocolFactory() - jsProt314 := factory313.GetProtocol(mbTrans311) + factory364 := thrift.NewTJSONProtocolFactory() + jsProt365 := factory364.GetProtocol(mbTrans362) argvalue0 := aurora.NewJobUpdateRequest() - err315 := argvalue0.Read(jsProt314) - if err315 != nil { + err366 := argvalue0.Read(context.Background(), jsProt365) + if err366 != nil { Usage() return } diff --git a/gen-go/apache/aurora/read_only_scheduler-remote/read_only_scheduler-remote.go b/gen-go/apache/aurora/read_only_scheduler-remote/read_only_scheduler-remote.go index 282c92a..e802328 100755 --- a/gen-go/apache/aurora/read_only_scheduler-remote/read_only_scheduler-remote.go +++ b/gen-go/apache/aurora/read_only_scheduler-remote/read_only_scheduler-remote.go @@ -1,22 +1,22 @@ -// Autogenerated by Thrift Compiler (0.12.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. package main import ( - "context" - "flag" - "fmt" - "math" - "net" - "net/url" - "os" - "strconv" - "strings" - "github.com/apache/thrift/lib/go/thrift" - "apache/aurora" + "context" + "flag" + "fmt" + "math" + "net" + "net/url" + "os" + "strconv" + "strings" + "github.com/apache/thrift/lib/go/thrift" + "apache/aurora" ) +var _ = aurora.GoUnusedProtection__ func Usage() { fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") @@ -179,19 +179,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTasksStatus requires 1 args") flag.Usage() } - arg81 := flag.Arg(1) - mbTrans82 := thrift.NewTMemoryBufferLen(len(arg81)) - defer mbTrans82.Close() - _, err83 := mbTrans82.WriteString(arg81) - if err83 != nil { + arg132 := flag.Arg(1) + mbTrans133 := thrift.NewTMemoryBufferLen(len(arg132)) + defer mbTrans133.Close() + _, err134 := mbTrans133.WriteString(arg132) + if err134 != nil { Usage() return } - factory84 := thrift.NewTJSONProtocolFactory() - jsProt85 := factory84.GetProtocol(mbTrans82) + factory135 := thrift.NewTJSONProtocolFactory() + jsProt136 := factory135.GetProtocol(mbTrans133) argvalue0 := aurora.NewTaskQuery() - err86 := argvalue0.Read(jsProt85) - if err86 != nil { + err137 := argvalue0.Read(context.Background(), jsProt136) + if err137 != nil { Usage() return } @@ -204,19 +204,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTasksWithoutConfigs requires 1 args") flag.Usage() } - arg87 := flag.Arg(1) - mbTrans88 := thrift.NewTMemoryBufferLen(len(arg87)) - defer mbTrans88.Close() - _, err89 := mbTrans88.WriteString(arg87) - if err89 != nil { + arg138 := flag.Arg(1) + mbTrans139 := thrift.NewTMemoryBufferLen(len(arg138)) + defer mbTrans139.Close() + _, err140 := mbTrans139.WriteString(arg138) + if err140 != nil { Usage() return } - factory90 := thrift.NewTJSONProtocolFactory() - jsProt91 := factory90.GetProtocol(mbTrans88) + factory141 := thrift.NewTJSONProtocolFactory() + jsProt142 := factory141.GetProtocol(mbTrans139) argvalue0 := aurora.NewTaskQuery() - err92 := argvalue0.Read(jsProt91) - if err92 != nil { + err143 := argvalue0.Read(context.Background(), jsProt142) + if err143 != nil { Usage() return } @@ -229,19 +229,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetPendingReason requires 1 args") flag.Usage() } - arg93 := flag.Arg(1) - mbTrans94 := thrift.NewTMemoryBufferLen(len(arg93)) - defer mbTrans94.Close() - _, err95 := mbTrans94.WriteString(arg93) - if err95 != nil { + arg144 := flag.Arg(1) + mbTrans145 := thrift.NewTMemoryBufferLen(len(arg144)) + defer mbTrans145.Close() + _, err146 := mbTrans145.WriteString(arg144) + if err146 != nil { Usage() return } - factory96 := thrift.NewTJSONProtocolFactory() - jsProt97 := factory96.GetProtocol(mbTrans94) + factory147 := thrift.NewTJSONProtocolFactory() + jsProt148 := factory147.GetProtocol(mbTrans145) argvalue0 := aurora.NewTaskQuery() - err98 := argvalue0.Read(jsProt97) - if err98 != nil { + err149 := argvalue0.Read(context.Background(), jsProt148) + if err149 != nil { Usage() return } @@ -254,19 +254,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetConfigSummary requires 1 args") flag.Usage() } - arg99 := flag.Arg(1) - mbTrans100 := thrift.NewTMemoryBufferLen(len(arg99)) - defer mbTrans100.Close() - _, err101 := mbTrans100.WriteString(arg99) - if err101 != nil { + arg150 := flag.Arg(1) + mbTrans151 := thrift.NewTMemoryBufferLen(len(arg150)) + defer mbTrans151.Close() + _, err152 := mbTrans151.WriteString(arg150) + if err152 != nil { Usage() return } - factory102 := thrift.NewTJSONProtocolFactory() - jsProt103 := factory102.GetProtocol(mbTrans100) + factory153 := thrift.NewTJSONProtocolFactory() + jsProt154 := factory153.GetProtocol(mbTrans151) argvalue0 := aurora.NewJobKey() - err104 := argvalue0.Read(jsProt103) - if err104 != nil { + err155 := argvalue0.Read(context.Background(), jsProt154) + if err155 != nil { Usage() return } @@ -299,19 +299,19 @@ func main() { fmt.Fprintln(os.Stderr, "PopulateJobConfig requires 1 args") flag.Usage() } - arg107 := flag.Arg(1) - mbTrans108 := thrift.NewTMemoryBufferLen(len(arg107)) - defer mbTrans108.Close() - _, err109 := mbTrans108.WriteString(arg107) - if err109 != nil { + arg158 := flag.Arg(1) + mbTrans159 := thrift.NewTMemoryBufferLen(len(arg158)) + defer mbTrans159.Close() + _, err160 := mbTrans159.WriteString(arg158) + if err160 != nil { Usage() return } - factory110 := thrift.NewTJSONProtocolFactory() - jsProt111 := factory110.GetProtocol(mbTrans108) + factory161 := thrift.NewTJSONProtocolFactory() + jsProt162 := factory161.GetProtocol(mbTrans159) argvalue0 := aurora.NewJobConfiguration() - err112 := argvalue0.Read(jsProt111) - if err112 != nil { + err163 := argvalue0.Read(context.Background(), jsProt162) + if err163 != nil { Usage() return } @@ -324,19 +324,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateSummaries requires 1 args") flag.Usage() } - arg113 := flag.Arg(1) - mbTrans114 := thrift.NewTMemoryBufferLen(len(arg113)) - defer mbTrans114.Close() - _, err115 := mbTrans114.WriteString(arg113) - if err115 != nil { + arg164 := flag.Arg(1) + mbTrans165 := thrift.NewTMemoryBufferLen(len(arg164)) + defer mbTrans165.Close() + _, err166 := mbTrans165.WriteString(arg164) + if err166 != nil { Usage() return } - factory116 := thrift.NewTJSONProtocolFactory() - jsProt117 := factory116.GetProtocol(mbTrans114) + factory167 := thrift.NewTJSONProtocolFactory() + jsProt168 := factory167.GetProtocol(mbTrans165) argvalue0 := aurora.NewJobUpdateQuery() - err118 := argvalue0.Read(jsProt117) - if err118 != nil { + err169 := argvalue0.Read(context.Background(), jsProt168) + if err169 != nil { Usage() return } @@ -349,19 +349,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateDetails requires 1 args") flag.Usage() } - arg119 := flag.Arg(1) - mbTrans120 := thrift.NewTMemoryBufferLen(len(arg119)) - defer mbTrans120.Close() - _, err121 := mbTrans120.WriteString(arg119) - if err121 != nil { + arg170 := flag.Arg(1) + mbTrans171 := thrift.NewTMemoryBufferLen(len(arg170)) + defer mbTrans171.Close() + _, err172 := mbTrans171.WriteString(arg170) + if err172 != nil { Usage() return } - factory122 := thrift.NewTJSONProtocolFactory() - jsProt123 := factory122.GetProtocol(mbTrans120) + factory173 := thrift.NewTJSONProtocolFactory() + jsProt174 := factory173.GetProtocol(mbTrans171) argvalue0 := aurora.NewJobUpdateQuery() - err124 := argvalue0.Read(jsProt123) - if err124 != nil { + err175 := argvalue0.Read(context.Background(), jsProt174) + if err175 != nil { Usage() return } @@ -374,19 +374,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateDiff requires 1 args") flag.Usage() } - arg125 := flag.Arg(1) - mbTrans126 := thrift.NewTMemoryBufferLen(len(arg125)) - defer mbTrans126.Close() - _, err127 := mbTrans126.WriteString(arg125) - if err127 != nil { + arg176 := flag.Arg(1) + mbTrans177 := thrift.NewTMemoryBufferLen(len(arg176)) + defer mbTrans177.Close() + _, err178 := mbTrans177.WriteString(arg176) + if err178 != nil { Usage() return } - factory128 := thrift.NewTJSONProtocolFactory() - jsProt129 := factory128.GetProtocol(mbTrans126) + factory179 := thrift.NewTJSONProtocolFactory() + jsProt180 := factory179.GetProtocol(mbTrans177) argvalue0 := aurora.NewJobUpdateRequest() - err130 := argvalue0.Read(jsProt129) - if err130 != nil { + err181 := argvalue0.Read(context.Background(), jsProt180) + if err181 != nil { Usage() return } diff --git a/generateBindings.sh b/generateBindings.sh index 9ff0205..8cb5b9d 100755 --- a/generateBindings.sh +++ b/generateBindings.sh @@ -1,6 +1,6 @@ #! /bin/bash -THRIFT_VER=0.12.0 +THRIFT_VER=0.14.0 if [[ $(thrift -version | grep -e $THRIFT_VER -c) -ne 1 ]]; then echo "Warning: This wrapper has only been tested with version" $THRIFT_VER; diff --git a/go.mod b/go.mod index cbf5aaf..9497185 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,12 @@ -module github.com/paypal/gorealis/v2 +module github.com/paypal/gorealis + +go 1.13 require ( - github.com/apache/thrift v0.12.0 + github.com/apache/thrift v0.14.0 github.com/davecgh/go-spew v1.1.0 // indirect - github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e + github.com/pkg/errors v0.9.1 github.com/pmezard/go-difflib v1.0.0 // indirect github.com/samuel/go-zookeeper v0.0.0-20171117190445-471cd4e61d7a - github.com/stretchr/testify v1.2.0 + github.com/stretchr/testify v1.7.0 ) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..f3f5eb6 --- /dev/null +++ b/go.sum @@ -0,0 +1,30 @@ +github.com/apache/thrift v0.13.0 h1:5hryIiq9gtn+MiLVn0wP37kb/uTeRZgN08WoCsAhIhI= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.14.0 h1:vqZ2DP42i8th2OsgCcYZkirtbzvpZEFx53LiWDJXIAs= +github.com/apache/thrift v0.14.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e h1:+RHxT/gm0O3UF7nLJbdNzAmULvCFt4XfXHWzh3XI/zs= +github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/ridv/thrift v0.12.1 h1:b80V1Oa2Mbd++jrlJZbJsIybO5/MCfbXKzd1A5v4aSo= +github.com/ridv/thrift v0.12.1/go.mod h1:yTMRF94RCZjO1fY1xt69yncvMbQCPdRL8BhbwIrjPx8= +github.com/ridv/thrift v0.13.1 h1:/8XnTRUqJJeiuqoL7mfnJQmXQa4GJn9tUCiP7+i6Y9o= +github.com/ridv/thrift v0.13.1/go.mod h1:yTMRF94RCZjO1fY1xt69yncvMbQCPdRL8BhbwIrjPx8= +github.com/ridv/thrift v0.13.2 h1:Q3Smr8poXd7VkWZPHvdJZzlQCJO+b5W37ECfoUL4qHc= +github.com/ridv/thrift v0.13.2/go.mod h1:yTMRF94RCZjO1fY1xt69yncvMbQCPdRL8BhbwIrjPx8= +github.com/samuel/go-zookeeper v0.0.0-20171117190445-471cd4e61d7a h1:EYL2xz/Zdo0hyqdZMXR4lmT2O11jDLTPCEqIe/FR6W4= +github.com/samuel/go-zookeeper v0.0.0-20171117190445-471cd4e61d7a/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.0 h1:LThGCOvhuJic9Gyd1VBCkhyUXmO8vKaBFvBsJ2k03rg= +github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/helpers.go b/helpers.go new file mode 100644 index 0000000..56821c1 --- /dev/null +++ b/helpers.go @@ -0,0 +1,21 @@ +package realis + +import ( + "context" + + "github.com/paypal/gorealis/gen-go/apache/aurora" +) + +func (r *realisClient) jobExists(key aurora.JobKey) (bool, error) { + resp, err := r.client.GetConfigSummary(context.TODO(), &key) + if err != nil { + return false, err + } + + return resp == nil || + resp.GetResult_() == nil || + resp.GetResult_().GetConfigSummaryResult_() == nil || + resp.GetResult_().GetConfigSummaryResult_().GetSummary() == nil || + resp.GetResponseCode() != aurora.ResponseCode_OK, + nil +} diff --git a/job.go b/job.go index 9dd99f6..8470546 100644 --- a/job.go +++ b/job.go @@ -15,203 +15,377 @@ package realis import ( - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" + "strconv" + + "github.com/paypal/gorealis/gen-go/apache/aurora" ) -// Structure to collect all information pertaining to an Aurora job. -type AuroraJob struct { - jobConfig *aurora.JobConfiguration - task *AuroraTask +// Job inteface is used to define a set of functions an Aurora Job object +// must implemement. +// TODO(rdelvalle): Consider getting rid of the Job interface +type Job interface { + // Set Job Key environment. + Environment(env string) Job + Role(role string) Job + Name(name string) Job + CronSchedule(cron string) Job + CronCollisionPolicy(policy aurora.CronCollisionPolicy) Job + CPU(cpus float64) Job + Disk(disk int64) Job + RAM(ram int64) Job + GPU(gpu int64) Job + ExecutorName(name string) Job + ExecutorData(data string) Job + AddPorts(num int) Job + AddLabel(key string, value string) Job + AddNamedPorts(names ...string) Job + AddLimitConstraint(name string, limit int32) Job + AddValueConstraint(name string, negated bool, values ...string) Job + + // From Aurora Docs: + // dedicated attribute. Aurora treats this specially, and only allows matching jobs + // to run on these machines, and will only schedule matching jobs on these machines. + // When a job is created, the scheduler requires that the $role component matches + // the role field in the job configuration, and will reject the job creation otherwise. + // A wildcard (*) may be used for the role portion of the dedicated attribute, which + // will allow any owner to elect for a job to run on the host(s) + AddDedicatedConstraint(role, name string) Job + AddURIs(extract bool, cache bool, values ...string) Job + JobKey() *aurora.JobKey + JobConfig() *aurora.JobConfiguration + TaskConfig() *aurora.TaskConfig + IsService(isService bool) Job + InstanceCount(instCount int32) Job + GetInstanceCount() int32 + MaxFailure(maxFail int32) Job + Container(container Container) Job + PartitionPolicy(policy *aurora.PartitionPolicy) Job + Tier(tier string) Job + SlaPolicy(policy *aurora.SlaPolicy) Job + Priority(priority int32) Job } -// Create a AuroraJob object with everything initialized. -func NewJob() *AuroraJob { +type resourceType int - jobKey := &aurora.JobKey{} +const ( + CPU resourceType = iota + RAM + DISK + GPU +) - // AuroraTask clientConfig - task := NewTask() - task.task.Job = jobKey +const portNamePrefix = "org.apache.aurora.port." - // AuroraJob clientConfig - jobConfig := &aurora.JobConfiguration{ - Key: jobKey, - TaskConfig: task.TaskConfig(), - } +// AuroraJob is a structure to collect all information pertaining to an Aurora job. +type AuroraJob struct { + jobConfig *aurora.JobConfiguration + resources map[resourceType]*aurora.Resource + metadata map[string]*aurora.Metadata + constraints map[string]*aurora.Constraint + portCount int +} + +// NewJob is used to create a Job object with everything initialized. +func NewJob() Job { + jobConfig := aurora.NewJobConfiguration() + taskConfig := aurora.NewTaskConfig() + jobKey := aurora.NewJobKey() + + // Job Config + jobConfig.Key = jobKey + jobConfig.TaskConfig = taskConfig + + // Task Config + taskConfig.Job = jobKey + taskConfig.Container = aurora.NewContainer() + taskConfig.Container.Mesos = aurora.NewMesosContainer() + + // Resources + numCpus := aurora.NewResource() + ramMb := aurora.NewResource() + diskMb := aurora.NewResource() + + resources := map[resourceType]*aurora.Resource{CPU: numCpus, RAM: ramMb, DISK: diskMb} + taskConfig.Resources = []*aurora.Resource{numCpus, ramMb, diskMb} + + numCpus.NumCpus = new(float64) + ramMb.RamMb = new(int64) + diskMb.DiskMb = new(int64) return &AuroraJob{ - jobConfig: jobConfig, - task: task, + jobConfig: jobConfig, + resources: resources, + metadata: make(map[string]*aurora.Metadata), + constraints: make(map[string]*aurora.Constraint), + portCount: 0, } } -// Set AuroraJob Key environment. Explicit changes to AuroraTask's job key are not needed -// because they share a pointer to the same JobKey. -func (j *AuroraJob) Environment(env string) *AuroraJob { +// Environment sets the Job Key environment. +func (j *AuroraJob) Environment(env string) Job { j.jobConfig.Key.Environment = env return j } -// Set AuroraJob Key Role. -func (j *AuroraJob) Role(role string) *AuroraJob { +// Role sets the Job Key role. +func (j *AuroraJob) Role(role string) Job { j.jobConfig.Key.Role = role // Will be deprecated identity := &aurora.Identity{User: role} j.jobConfig.Owner = identity j.jobConfig.TaskConfig.Owner = identity - return j } -// Set AuroraJob Key Name. -func (j *AuroraJob) Name(name string) *AuroraJob { +// Name sets the Job Key Name. +func (j *AuroraJob) Name(name string) Job { j.jobConfig.Key.Name = name return j } -// How many instances of the job to run -func (j *AuroraJob) InstanceCount(instCount int32) *AuroraJob { +// ExecutorName sets the name of the executor that will the task will be configured to. +func (j *AuroraJob) ExecutorName(name string) Job { + + if j.jobConfig.TaskConfig.ExecutorConfig == nil { + j.jobConfig.TaskConfig.ExecutorConfig = aurora.NewExecutorConfig() + } + + j.jobConfig.TaskConfig.ExecutorConfig.Name = name + return j +} + +// ExecutorData sets the data blob that will be passed to the Mesos executor. +func (j *AuroraJob) ExecutorData(data string) Job { + + if j.jobConfig.TaskConfig.ExecutorConfig == nil { + j.jobConfig.TaskConfig.ExecutorConfig = aurora.NewExecutorConfig() + } + + j.jobConfig.TaskConfig.ExecutorConfig.Data = data + return j +} + +// CPU sets the amount of CPU each task will use in an Aurora Job. +func (j *AuroraJob) CPU(cpus float64) Job { + *j.resources[CPU].NumCpus = cpus + return j +} + +// RAM sets the amount of RAM each task will use in an Aurora Job. +func (j *AuroraJob) RAM(ram int64) Job { + *j.resources[RAM].RamMb = ram + return j +} + +// Disk sets the amount of Disk each task will use in an Aurora Job. +func (j *AuroraJob) Disk(disk int64) Job { + *j.resources[DISK].DiskMb = disk + return j +} + +// GPU sets the amount of GPU each task will use in an Aurora Job. +func (j *AuroraJob) GPU(gpu int64) Job { + // GPU resource must be set explicitly since the scheduler by default + // rejects jobs with GPU resources attached to it. + if _, ok := j.resources[GPU]; !ok { + j.resources[GPU] = &aurora.Resource{} + j.JobConfig().GetTaskConfig().Resources = append( + j.JobConfig().GetTaskConfig().Resources, + j.resources[GPU]) + } + + j.resources[GPU].NumGpus = &gpu + return j +} + +// MaxFailure sets how many failures to tolerate before giving up per Job. +func (j *AuroraJob) MaxFailure(maxFail int32) Job { + j.jobConfig.TaskConfig.MaxTaskFailures = maxFail + return j +} + +// InstanceCount sets how many instances of the task to run for this Job. +func (j *AuroraJob) InstanceCount(instCount int32) Job { j.jobConfig.InstanceCount = instCount return j } -func (j *AuroraJob) CronSchedule(cron string) *AuroraJob { +// CronSchedule allows the user to configure a cron schedule for this job to run in. +func (j *AuroraJob) CronSchedule(cron string) Job { j.jobConfig.CronSchedule = &cron return j } -func (j *AuroraJob) CronCollisionPolicy(policy aurora.CronCollisionPolicy) *AuroraJob { +// CronCollisionPolicy allows the user to decide what happens if two or more instances +// of the same Cron job need to run. +func (j *AuroraJob) CronCollisionPolicy(policy aurora.CronCollisionPolicy) Job { j.jobConfig.CronCollisionPolicy = policy return j } -// How many instances of the job to run +// GetInstanceCount returns how many tasks this Job contains. func (j *AuroraJob) GetInstanceCount() int32 { return j.jobConfig.InstanceCount } -// Get the current job configurations key to use for some realis calls. -func (j *AuroraJob) JobKey() aurora.JobKey { - return *j.jobConfig.Key +// IsService returns true if the job is a long term running job or false if it is an ad-hoc job. +func (j *AuroraJob) IsService(isService bool) Job { + j.jobConfig.TaskConfig.IsService = isService + return j } -// Get the current job configurations key to use for some realis calls. +// JobKey returns the job's configuration key. +func (j *AuroraJob) JobKey() *aurora.JobKey { + return j.jobConfig.Key +} + +// JobConfig returns the job's configuration. func (j *AuroraJob) JobConfig() *aurora.JobConfiguration { return j.jobConfig } -// Get the current job configurations key to use for some realis calls. -func (j *AuroraJob) AuroraTask() *AuroraTask { - return j.task -} - -/* - AuroraTask specific API, see task.go for further documentation. - These functions are provided for the convenience of chaining API calls. -*/ - -func (j *AuroraJob) ExecutorName(name string) *AuroraJob { - j.task.ExecutorName(name) - return j -} - -func (j *AuroraJob) ExecutorData(data string) *AuroraJob { - j.task.ExecutorData(data) - return j -} - -func (j *AuroraJob) CPU(cpus float64) *AuroraJob { - j.task.CPU(cpus) - return j -} - -func (j *AuroraJob) RAM(ram int64) *AuroraJob { - j.task.RAM(ram) - return j -} - -func (j *AuroraJob) Disk(disk int64) *AuroraJob { - j.task.Disk(disk) - return j -} - -func (j *AuroraJob) GPU(gpu int64) *AuroraJob { - j.task.GPU(gpu) - return j -} - -func (j *AuroraJob) Tier(tier string) *AuroraJob { - j.task.Tier(tier) - return j -} - -func (j *AuroraJob) MaxFailure(maxFail int32) *AuroraJob { - j.task.MaxFailure(maxFail) - return j -} - -func (j *AuroraJob) IsService(isService bool) *AuroraJob { - j.task.IsService(isService) - return j -} - +// TaskConfig returns the job's task(shard) configuration. func (j *AuroraJob) TaskConfig() *aurora.TaskConfig { - return j.task.TaskConfig() + return j.jobConfig.TaskConfig } -func (j *AuroraJob) AddURIs(extract bool, cache bool, values ...string) *AuroraJob { - j.task.AddURIs(extract, cache, values...) +// AddURIs adds a list of URIs with the same extract and cache configuration. Scheduler must have +// --enable_mesos_fetcher flag enabled. Currently there is no duplicate detection. +func (j *AuroraJob) AddURIs(extract bool, cache bool, values ...string) Job { + for _, value := range values { + j.jobConfig.TaskConfig.MesosFetcherUris = append(j.jobConfig.TaskConfig.MesosFetcherUris, + &aurora.MesosFetcherURI{Value: value, Extract: &extract, Cache: &cache}) + } return j } -func (j *AuroraJob) AddLabel(key string, value string) *AuroraJob { - j.task.AddLabel(key, value) +// AddLabel adds a Mesos label to the job. Note that Aurora will add the +// prefix "org.apache.aurora.metadata." to the beginning of each key. +func (j *AuroraJob) AddLabel(key string, value string) Job { + if _, ok := j.metadata[key]; !ok { + j.metadata[key] = &aurora.Metadata{Key: key} + j.jobConfig.TaskConfig.Metadata = append(j.jobConfig.TaskConfig.Metadata, j.metadata[key]) + } + + j.metadata[key].Value = value return j } -func (j *AuroraJob) AddNamedPorts(names ...string) *AuroraJob { - j.task.AddNamedPorts(names...) +// AddNamedPorts adds a named port to the job configuration These are random ports as it's +// not currently possible to request specific ports using Aurora. +func (j *AuroraJob) AddNamedPorts(names ...string) Job { + j.portCount += len(names) + for _, name := range names { + j.jobConfig.TaskConfig.Resources = append( + j.jobConfig.TaskConfig.Resources, + &aurora.Resource{NamedPort: &name}) + } + return j } -func (j *AuroraJob) AddPorts(num int) *AuroraJob { - j.task.AddPorts(num) - return j -} -func (j *AuroraJob) AddValueConstraint(name string, negated bool, values ...string) *AuroraJob { - j.task.AddValueConstraint(name, negated, values...) +// AddPorts adds a request for a number of ports to the job configuration. The names chosen for these ports +// will be org.apache.aurora.port.X, where X is the current port count for the job configuration +// starting at 0. These are random ports as it's not currently possible to request +// specific ports using Aurora. +func (j *AuroraJob) AddPorts(num int) Job { + start := j.portCount + j.portCount += num + for i := start; i < j.portCount; i++ { + portName := portNamePrefix + strconv.Itoa(i) + j.jobConfig.TaskConfig.Resources = append( + j.jobConfig.TaskConfig.Resources, + &aurora.Resource{NamedPort: &portName}) + } + return j } -func (j *AuroraJob) AddLimitConstraint(name string, limit int32) *AuroraJob { - j.task.AddLimitConstraint(name, limit) +// AddValueConstraint allows the user to add a value constrain to the job to limit which agents the job's +// tasks can be run on. If the name matches a constraint that was previously set, the previous value will be +// overwritten. In case the previous constraint attached to the name was of type limit, the constraint will be clobbered +// by this new Value constraint. +// From Aurora Docs: +// Add a Value constraint +// name - Mesos slave attribute that the constraint is matched against. +// If negated = true , treat this as a 'not' - to avoid specific values. +// Values - list of values we look for in attribute name +func (j *AuroraJob) AddValueConstraint(name string, negated bool, values ...string) Job { + if _, ok := j.constraints[name]; !ok { + j.constraints[name] = &aurora.Constraint{Name: name} + j.jobConfig.TaskConfig.Constraints = append(j.jobConfig.TaskConfig.Constraints, j.constraints[name]) + } + + j.constraints[name].Constraint = &aurora.TaskConstraint{ + Value: &aurora.ValueConstraint{ + Negated: negated, + Values: values, + }, + Limit: nil, + } + return j } -func (j *AuroraJob) AddDedicatedConstraint(role, name string) *AuroraJob { - j.task.AddDedicatedConstraint(role, name) +// AddLimitConstraint allows the user to limit how many tasks form the same Job are run on a single host. +// If the name matches a constraint that was previously set, the previous value will be +// overwritten. In case the previous constraint attached to the name was of type Value, the constraint will be clobbered +// by this new Limit constraint. +// From Aurora Docs: +// A constraint that specifies the maximum number of active tasks on a host with +// a matching attribute that may be scheduled simultaneously. +func (j *AuroraJob) AddLimitConstraint(name string, limit int32) Job { + if _, ok := j.constraints[name]; !ok { + j.constraints[name] = &aurora.Constraint{Name: name} + j.jobConfig.TaskConfig.Constraints = append(j.jobConfig.TaskConfig.Constraints, j.constraints[name]) + } + + j.constraints[name].Constraint = &aurora.TaskConstraint{ + Value: nil, + Limit: &aurora.LimitConstraint{Limit: limit}, + } + return j } -func (j *AuroraJob) Container(container Container) *AuroraJob { - j.task.Container(container) +// AddDedicatedConstraint is a convenience function that allows the user to +// add a dedicated constraint to a Job configuration. +// In case a previous dedicated constraint was set, it will be clobbered by this new value. +func (j *AuroraJob) AddDedicatedConstraint(role, name string) Job { + j.AddValueConstraint("dedicated", false, role+"/"+name) + return j } -func (j *AuroraJob) ThermosExecutor(thermos ThermosExecutor) *AuroraJob { - j.task.ThermosExecutor(thermos) +// Container sets a container to run for the job configuration to run. +func (j *AuroraJob) Container(container Container) Job { + j.jobConfig.TaskConfig.Container = container.Build() + return j } -func (j *AuroraJob) BuildThermosPayload() error { - return j.task.BuildThermosPayload() -} - -func (j *AuroraJob) PartitionPolicy(reschedule bool, delay int64) *AuroraJob { - j.task.PartitionPolicy(aurora.PartitionPolicy{ - Reschedule: reschedule, - DelaySecs: &delay, - }) +// PartitionPolicy sets a partition policy for the job configuration to implement. +func (j *AuroraJob) PartitionPolicy(policy *aurora.PartitionPolicy) Job { + j.jobConfig.TaskConfig.PartitionPolicy = policy + return j +} + +// Tier sets the Tier for the Job. +func (j *AuroraJob) Tier(tier string) Job { + j.jobConfig.TaskConfig.Tier = &tier + + return j +} + +// SlaPolicy sets an SlaPolicy for the Job. +func (j *AuroraJob) SlaPolicy(policy *aurora.SlaPolicy) Job { + j.jobConfig.TaskConfig.SlaPolicy = policy + + return j +} + +func (j *AuroraJob) Priority(priority int32) Job { + j.jobConfig.TaskConfig.Priority = priority return j } diff --git a/jobUpdate.go b/jobUpdate.go deleted file mode 100644 index 8176da1..0000000 --- a/jobUpdate.go +++ /dev/null @@ -1,249 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package realis - -import ( - "time" - - "github.com/apache/thrift/lib/go/thrift" - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" -) - -// Structure to collect all information required to create job update -type JobUpdate struct { - task *AuroraTask - request *aurora.JobUpdateRequest -} - -// Create a default JobUpdate object with an empty task and no fields filled in. -func NewJobUpdate() *JobUpdate { - newTask := NewTask() - - req := aurora.JobUpdateRequest{} - req.TaskConfig = newTask.TaskConfig() - req.Settings = newUpdateSettings() - - return &JobUpdate{task: newTask, request: &req} -} - -func JobUpdateFromAuroraTask(task *AuroraTask) *JobUpdate { - newTask := task.Clone() - - req := aurora.JobUpdateRequest{} - req.TaskConfig = newTask.TaskConfig() - req.Settings = newUpdateSettings() - - return &JobUpdate{task: newTask, request: &req} -} - -func JobUpdateFromConfig(task *aurora.TaskConfig) *JobUpdate { - // Perform a deep copy to avoid unexpected behavior - newTask := TaskFromThrift(task) - - req := aurora.JobUpdateRequest{} - req.TaskConfig = newTask.TaskConfig() - req.Settings = newUpdateSettings() - - return &JobUpdate{task: newTask, request: &req} -} - -// Set instance count the job will have after the update. -func (j *JobUpdate) InstanceCount(inst int32) *JobUpdate { - j.request.InstanceCount = inst - return j -} - -// Max number of instances being updated at any given moment. -func (j *JobUpdate) BatchSize(size int32) *JobUpdate { - j.request.Settings.UpdateGroupSize = size - return j -} - -// Minimum number of seconds a shard must remain in RUNNING state before considered a success. -func (j *JobUpdate) WatchTime(timeout time.Duration) *JobUpdate { - j.request.Settings.MinWaitInInstanceRunningMs = int32(timeout.Seconds() * 1000) - return j -} - -// Wait for all instances in a group to be done before moving on. -func (j *JobUpdate) WaitForBatchCompletion(batchWait bool) *JobUpdate { - j.request.Settings.WaitForBatchCompletion = batchWait - return j -} - -// Max number of instance failures to tolerate before marking instance as FAILED. -func (j *JobUpdate) MaxPerInstanceFailures(inst int32) *JobUpdate { - j.request.Settings.MaxPerInstanceFailures = inst - return j -} - -// Max number of FAILED instances to tolerate before terminating the update. -func (j *JobUpdate) MaxFailedInstances(inst int32) *JobUpdate { - j.request.Settings.MaxFailedInstances = inst - return j -} - -// When False, prevents auto rollback of a failed update. -func (j *JobUpdate) RollbackOnFail(rollback bool) *JobUpdate { - j.request.Settings.RollbackOnFailure = rollback - return j -} - -// Sets the interval at which pulses should be received by the job update before timing out. -func (j *JobUpdate) PulseIntervalTimeout(timeout time.Duration) *JobUpdate { - j.request.Settings.BlockIfNoPulsesAfterMs = thrift.Int32Ptr(int32(timeout.Seconds() * 1000)) - return j -} - -func newUpdateSettings() *aurora.JobUpdateSettings { - - us := aurora.JobUpdateSettings{} - // Mirrors defaults set by Pystachio - us.UpdateOnlyTheseInstances = []*aurora.Range{} - us.UpdateGroupSize = 1 - us.WaitForBatchCompletion = false - us.MinWaitInInstanceRunningMs = 45000 - us.MaxPerInstanceFailures = 0 - us.MaxFailedInstances = 0 - us.RollbackOnFailure = true - - return &us -} - -/* - These methods are provided for user convenience in order to chain - calls for configuration. - API below here are wrappers around modifying an AuroraTask instance. - See task.go for further documentation. -*/ - -func (j *JobUpdate) Environment(env string) *JobUpdate { - j.task.Environment(env) - return j -} - -func (j *JobUpdate) Role(role string) *JobUpdate { - j.task.Role(role) - return j -} - -func (j *JobUpdate) Name(name string) *JobUpdate { - j.task.Name(name) - return j -} - -func (j *JobUpdate) ExecutorName(name string) *JobUpdate { - j.task.ExecutorName(name) - return j -} - -func (j *JobUpdate) ExecutorData(data string) *JobUpdate { - j.task.ExecutorData(data) - return j -} - -func (j *JobUpdate) CPU(cpus float64) *JobUpdate { - j.task.CPU(cpus) - return j -} - -func (j *JobUpdate) RAM(ram int64) *JobUpdate { - j.task.RAM(ram) - return j -} - -func (j *JobUpdate) Disk(disk int64) *JobUpdate { - j.task.Disk(disk) - return j -} - -func (j *JobUpdate) Tier(tier string) *JobUpdate { - j.task.Tier(tier) - return j -} - -func (j *JobUpdate) MaxFailure(maxFail int32) *JobUpdate { - j.task.MaxFailure(maxFail) - return j -} - -func (j *JobUpdate) IsService(isService bool) *JobUpdate { - j.task.IsService(isService) - return j -} - -func (j *JobUpdate) TaskConfig() *aurora.TaskConfig { - return j.task.TaskConfig() -} - -func (j *JobUpdate) AddURIs(extract bool, cache bool, values ...string) *JobUpdate { - j.task.AddURIs(extract, cache, values...) - return j -} - -func (j *JobUpdate) AddLabel(key string, value string) *JobUpdate { - j.task.AddLabel(key, value) - return j -} - -func (j *JobUpdate) AddNamedPorts(names ...string) *JobUpdate { - j.task.AddNamedPorts(names...) - return j -} - -func (j *JobUpdate) AddPorts(num int) *JobUpdate { - j.task.AddPorts(num) - return j -} -func (j *JobUpdate) AddValueConstraint(name string, negated bool, values ...string) *JobUpdate { - j.task.AddValueConstraint(name, negated, values...) - return j -} - -func (j *JobUpdate) AddLimitConstraint(name string, limit int32) *JobUpdate { - j.task.AddLimitConstraint(name, limit) - return j -} - -func (j *JobUpdate) AddDedicatedConstraint(role, name string) *JobUpdate { - j.task.AddDedicatedConstraint(role, name) - return j -} - -func (j *JobUpdate) Container(container Container) *JobUpdate { - j.task.Container(container) - return j -} - -func (j *JobUpdate) JobKey() aurora.JobKey { - return j.task.JobKey() -} - -func (j *JobUpdate) ThermosExecutor(thermos ThermosExecutor) *JobUpdate { - j.task.ThermosExecutor(thermos) - return j -} - -func (j *JobUpdate) BuildThermosPayload() error { - return j.task.BuildThermosPayload() -} - -func (j *JobUpdate) PartitionPolicy(reschedule bool, delay int64) *JobUpdate { - j.task.PartitionPolicy(aurora.PartitionPolicy{ - Reschedule: reschedule, - DelaySecs: &delay, - }) - return j -} diff --git a/logger.go b/logger.go index 34e62ee..340171f 100644 --- a/logger.go +++ b/logger.go @@ -14,65 +14,73 @@ package realis -type Logger interface { +type logger interface { Println(v ...interface{}) Printf(format string, v ...interface{}) Print(v ...interface{}) } +// NoopLogger is a logger that can be attached to the client which will not print anything. type NoopLogger struct{} +// Printf is a NOOP function here. func (NoopLogger) Printf(format string, a ...interface{}) {} +// Print is a NOOP function here. func (NoopLogger) Print(a ...interface{}) {} +// Println is a NOOP function here. func (NoopLogger) Println(a ...interface{}) {} +// LevelLogger is a logger that can be configured to output different levels of information: Debug and Trace. +// Trace should only be enabled when very in depth information about the sequence of events a function took is needed. type LevelLogger struct { - Logger + logger debug bool trace bool } +// EnableDebug enables debug level logging for the LevelLogger func (l *LevelLogger) EnableDebug(enable bool) { l.debug = enable } +// EnableTrace enables trace level logging for the LevelLogger func (l *LevelLogger) EnableTrace(enable bool) { l.trace = enable } -func (l LevelLogger) DebugPrintf(format string, a ...interface{}) { +func (l LevelLogger) debugPrintf(format string, a ...interface{}) { if l.debug { l.Printf("[DEBUG] "+format, a...) } } -func (l LevelLogger) DebugPrint(a ...interface{}) { +func (l LevelLogger) debugPrint(a ...interface{}) { if l.debug { l.Print(append([]interface{}{"[DEBUG] "}, a...)...) } } -func (l LevelLogger) DebugPrintln(a ...interface{}) { +func (l LevelLogger) debugPrintln(a ...interface{}) { if l.debug { l.Println(append([]interface{}{"[DEBUG] "}, a...)...) } } -func (l LevelLogger) TracePrintf(format string, a ...interface{}) { +func (l LevelLogger) tracePrintf(format string, a ...interface{}) { if l.trace { l.Printf("[TRACE] "+format, a...) } } -func (l LevelLogger) TracePrint(a ...interface{}) { +func (l LevelLogger) tracePrint(a ...interface{}) { if l.trace { l.Print(append([]interface{}{"[TRACE] "}, a...)...) } } -func (l LevelLogger) TracePrintln(a ...interface{}) { +func (l LevelLogger) tracePrintln(a ...interface{}) { if l.trace { l.Println(append([]interface{}{"[TRACE] "}, a...)...) } diff --git a/monitors.go b/monitors.go index 79ed0f7..edbe4e4 100644 --- a/monitors.go +++ b/monitors.go @@ -12,48 +12,46 @@ * limitations under the License. */ -// Collection of monitors to create synchronicity package realis import ( "time" - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" + "github.com/paypal/gorealis/gen-go/apache/aurora" "github.com/pkg/errors" ) -// MonitorJobUpdate polls the scheduler every certain amount of time to see if the update has succeeded. -// If the update entered a terminal update state but it is not ROLLED_FORWARD, this function will return an error. -func (c *Client) MonitorJobUpdate(updateKey aurora.JobUpdateKey, interval, timeout time.Duration) (bool, error) { - if interval < 1*time.Second { - interval = interval * time.Second - } +// Monitor is a wrapper for the Realis client which allows us to have functions +// with the same name for Monitoring purposes. +// TODO(rdelvalle): Deprecate monitors and instead add prefix Monitor to +// all functions in this file like it is done in V2. +type Monitor struct { + Client Realis +} - if timeout < 1*time.Second { - timeout = timeout * time.Second +// JobUpdate polls the scheduler every certain amount of time to see if the update has entered a terminal state. +func (m *Monitor) JobUpdate( + updateKey aurora.JobUpdateKey, + interval int, + timeout int) (bool, error) { + + updateQ := aurora.JobUpdateQuery{ + Key: &updateKey, + Limit: 1, + UpdateStatuses: TerminalUpdateStates(), } - updateSummaries, err := c.MonitorJobUpdateQuery( - aurora.JobUpdateQuery{ - Key: &updateKey, - Limit: 1, - UpdateStatuses: []aurora.JobUpdateStatus{ - aurora.JobUpdateStatus_ROLLED_FORWARD, - aurora.JobUpdateStatus_ROLLED_BACK, - aurora.JobUpdateStatus_ABORTED, - aurora.JobUpdateStatus_ERROR, - aurora.JobUpdateStatus_FAILED, - }, - }, - interval, - timeout) + updateSummaries, err := m.JobUpdateQuery( + updateQ, + time.Duration(interval)*time.Second, + time.Duration(timeout)*time.Second) + + status := updateSummaries[0].State.Status if err != nil { return false, err } - status := updateSummaries[0].State.Status - - c.RealisConfig().logger.Printf("job update status: %v\n", status) + m.Client.RealisConfig().logger.Printf("job update status: %v\n", status) // Rolled forward is the only state in which an update has been successfully updated // if we encounter an inactive state and it is not at rolled forward, update failed @@ -70,41 +68,25 @@ func (c *Client) MonitorJobUpdate(updateKey aurora.JobUpdateKey, interval, timeo } } -// MonitorJobUpdateStatus polls the scheduler for information about an update until the update enters one of the -// desired states or until the function times out. -func (c *Client) MonitorJobUpdateStatus(updateKey aurora.JobUpdateKey, +// JobUpdateStatus polls the scheduler every certain amount of time to see if the update has entered a specified state. +func (m *Monitor) JobUpdateStatus(updateKey aurora.JobUpdateKey, desiredStatuses []aurora.JobUpdateStatus, interval, timeout time.Duration) (aurora.JobUpdateStatus, error) { - - if len(desiredStatuses) == 0 { - return aurora.JobUpdateStatus(-1), errors.New("no desired statuses provided") - } - - // Make deep local copy to avoid side effects from job key being manipulated externally. - updateKeyLocal := &aurora.JobUpdateKey{ - Job: &aurora.JobKey{ - Role: updateKey.Job.GetRole(), - Environment: updateKey.Job.GetEnvironment(), - Name: updateKey.Job.GetName(), - }, - ID: updateKey.GetID(), - } - updateQ := aurora.JobUpdateQuery{ - Key: updateKeyLocal, + Key: &updateKey, Limit: 1, UpdateStatuses: desiredStatuses, } - - summary, err := c.MonitorJobUpdateQuery(updateQ, interval, timeout) - if len(summary) > 0 { - return summary[0].State.Status, err + summary, err := m.JobUpdateQuery(updateQ, interval, timeout) + if err != nil { + return 0, err } - return aurora.JobUpdateStatus(-1), err + return summary[0].State.Status, nil } -func (c *Client) MonitorJobUpdateQuery( +// JobUpdateQuery polls the scheduler every certain amount of time to see if the query call returns any results. +func (m *Monitor) JobUpdateQuery( updateQuery aurora.JobUpdateQuery, interval time.Duration, timeout time.Duration) ([]*aurora.JobUpdateSummary, error) { @@ -113,16 +95,20 @@ func (c *Client) MonitorJobUpdateQuery( defer ticker.Stop() timer := time.NewTimer(timeout) defer timer.Stop() + + var cliErr error + var respDetail *aurora.Response for { select { case <-ticker.C: - updateSummaryResults, cliErr := c.GetJobUpdateSummaries(&updateQuery) + respDetail, cliErr = m.Client.GetJobUpdateSummaries(&updateQuery) if cliErr != nil { return nil, cliErr } - if len(updateSummaryResults.GetUpdateSummaries()) >= 1 { - return updateSummaryResults.GetUpdateSummaries(), nil + updateSummaries := respDetail.Result_.GetJobUpdateSummariesResult_.UpdateSummaries + if len(updateSummaries) >= 1 { + return updateSummaries, nil } case <-timer.C: @@ -131,37 +117,105 @@ func (c *Client) MonitorJobUpdateQuery( } } -// Monitor a AuroraJob until all instances enter one of the LiveStates -func (c *Client) MonitorInstances(key aurora.JobKey, instances int32, interval, timeout time.Duration) (bool, error) { - return c.MonitorScheduleStatus(key, instances, aurora.LIVE_STATES, interval, timeout) +// AutoPausedUpdateMonitor is a special monitor for auto pause enabled batch updates. This monitor ensures that the update +// being monitored is capable of auto pausing and has auto pausing enabled. After verifying this information, +// the monitor watches for the job to enter the ROLL_FORWARD_PAUSED state and calculates the current batch +// the update is in using information from the update configuration. +func (m *Monitor) AutoPausedUpdateMonitor(key aurora.JobUpdateKey, interval, timeout time.Duration) (int, error) { + key.Job = &aurora.JobKey{ + Role: key.Job.Role, + Environment: key.Job.Environment, + Name: key.Job.Name, + } + query := aurora.JobUpdateQuery{ + UpdateStatuses: aurora.ACTIVE_JOB_UPDATE_STATES, + Limit: 1, + Key: &key, + } + + response, err := m.Client.JobUpdateDetails(query) + if err != nil { + return -1, errors.Wrap(err, "unable to get information about update") + } + + // TODO (rdelvalle): check for possible nil values when going down the list of structs + updateDetails := response.Result_.GetJobUpdateDetailsResult_.DetailsList + if len(updateDetails) == 0 { + return -1, errors.Errorf("details for update could not be found") + } + + updateStrategy := updateDetails[0].Update.Instructions.Settings.UpdateStrategy + + var batchSizes []int32 + switch { + case updateStrategy.IsSetVarBatchStrategy(): + batchSizes = updateStrategy.VarBatchStrategy.GroupSizes + if !updateStrategy.VarBatchStrategy.AutopauseAfterBatch { + return -1, errors.Errorf("update does not have auto pause enabled") + } + case updateStrategy.IsSetBatchStrategy(): + batchSizes = []int32{updateStrategy.BatchStrategy.GroupSize} + if !updateStrategy.BatchStrategy.AutopauseAfterBatch { + return -1, errors.Errorf("update does not have auto pause enabled") + } + default: + return -1, errors.Errorf("update is not using a batch update strategy") + } + + query.UpdateStatuses = append(TerminalUpdateStates(), aurora.JobUpdateStatus_ROLL_FORWARD_PAUSED) + summary, err := m.JobUpdateQuery(query, interval, timeout) + if err != nil { + return -1, err + } + + if !(summary[0].State.Status == aurora.JobUpdateStatus_ROLL_FORWARD_PAUSED || + summary[0].State.Status == aurora.JobUpdateStatus_ROLLED_FORWARD) { + return -1, errors.Errorf("update is in a terminal state %v", summary[0].State.Status) + } + + updatingInstances := make(map[int32]struct{}) + for _, e := range updateDetails[0].InstanceEvents { + // We only care about INSTANCE_UPDATING actions because we only care that they've been attempted + if e != nil && e.GetAction() == aurora.JobUpdateAction_INSTANCE_UPDATING { + updatingInstances[e.GetInstanceId()] = struct{}{} + } + } + + return calculateCurrentBatch(int32(len(updatingInstances)), batchSizes), nil } -// Monitor a AuroraJob until all instances enter a desired status. +// Instances will monitor a Job until all instances enter one of the LIVE_STATES +func (m *Monitor) Instances(key *aurora.JobKey, instances int32, interval, timeout int) (bool, error) { + return m.ScheduleStatus(key, instances, LiveStates, interval, timeout) +} + +// ScheduleStatus will monitor a Job until all instances enter a desired status. // Defaults sets of desired statuses provided by the thrift API include: -// ActiveStates, SlaveAssignedStates, LiveStates, and TerminalStates -func (c *Client) MonitorScheduleStatus(key aurora.JobKey, +// ACTIVE_STATES, SLAVE_ASSIGNED_STATES, LIVE_STATES, and TERMINAL_STATES +func (m *Monitor) ScheduleStatus( + key *aurora.JobKey, instanceCount int32, - desiredStatuses []aurora.ScheduleStatus, - interval, timeout time.Duration) (bool, error) { - if interval < 1*time.Second { - interval = interval * time.Second - } + desiredStatuses map[aurora.ScheduleStatus]bool, + interval int, + timeout int) (bool, error) { - if timeout < 1*time.Second { - timeout = timeout * time.Second - } - - ticker := time.NewTicker(interval) + ticker := time.NewTicker(time.Second * time.Duration(interval)) defer ticker.Stop() - timer := time.NewTimer(timeout) + timer := time.NewTimer(time.Second * time.Duration(timeout)) defer timer.Stop() + wantedStatuses := make([]aurora.ScheduleStatus, 0) + + for status := range desiredStatuses { + wantedStatuses = append(wantedStatuses, status) + } + for { select { case <-ticker.C: // Query Aurora for the state of the job key ever interval - instCount, cliErr := c.GetInstanceIds(key, desiredStatuses) + instCount, cliErr := m.Client.GetInstanceIds(key, wantedStatuses) if cliErr != nil { return false, errors.Wrap(cliErr, "Unable to communicate with Aurora") } @@ -171,23 +225,18 @@ func (c *Client) MonitorScheduleStatus(key aurora.JobKey, case <-timer.C: // If the timer runs out, return a timeout error to user - return false, newTimedoutError(errors.New("schedule status monitor timedout")) + return false, newTimedoutError(errors.New("schedule status monitor timed out")) } } } -// Monitor host status until all hosts match the status provided. Returns a map where the value is true if the host +// HostMaintenance will monitor host status until all hosts match the status provided. +// Returns a map where the value is true if the host // is in one of the desired mode(s) or false if it is not as of the time when the monitor exited. -func (c *Client) MonitorHostMaintenance(hosts []string, +func (m *Monitor) HostMaintenance( + hosts []string, modes []aurora.MaintenanceMode, - interval, timeout time.Duration) (map[string]bool, error) { - if interval < 1*time.Second { - interval = interval * time.Second - } - - if timeout < 1*time.Second { - timeout = timeout * time.Second - } + interval, timeout int) (map[string]bool, error) { // Transform modes to monitor for into a set for easy lookup desiredMode := make(map[aurora.MaintenanceMode]struct{}) @@ -196,7 +245,8 @@ func (c *Client) MonitorHostMaintenance(hosts []string, } // Turn slice into a host set to eliminate duplicates. - // We also can't use a simple count because multiple modes means we can have multiple matches for a single host. + // We also can't use a simple count because multiple modes means + // we can have multiple matches for a single host. // I.e. host A transitions from ACTIVE to DRAINING to DRAINED while monitored remainingHosts := make(map[string]struct{}) for _, host := range hosts { @@ -205,16 +255,16 @@ func (c *Client) MonitorHostMaintenance(hosts []string, hostResult := make(map[string]bool) - ticker := time.NewTicker(interval) + ticker := time.NewTicker(time.Second * time.Duration(interval)) defer ticker.Stop() - timer := time.NewTimer(timeout) + timer := time.NewTimer(time.Second * time.Duration(timeout)) defer timer.Stop() for { select { case <-ticker.C: // Client call has multiple retries internally - result, err := c.MaintenanceStatus(hosts...) + _, result, err := m.Client.MaintenanceStatus(hosts...) if err != nil { // Error is either a payload error or a severe connection error for host := range remainingHosts { @@ -240,7 +290,7 @@ func (c *Client) MonitorHostMaintenance(hosts []string, hostResult[host] = false } - return hostResult, newTimedoutError(errors.New("host maintenance monitor timedout")) + return hostResult, newTimedoutError(errors.New("host maintenance monitor timed out")) } } } diff --git a/realis.go b/realis.go index 8b17bf7..0464908 100644 --- a/realis.go +++ b/realis.go @@ -18,28 +18,80 @@ package realis import ( "context" "crypto/tls" - "crypto/x509" "encoding/base64" "fmt" - "io/ioutil" "log" "net/http" "os" - "path/filepath" "sort" + "strings" "sync" "time" "github.com/apache/thrift/lib/go/thrift" - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" - "github.com/paypal/gorealis/v2/response" "github.com/pkg/errors" + + "github.com/paypal/gorealis/gen-go/apache/aurora" + "github.com/paypal/gorealis/response" ) -const VERSION = "2.0.1" +const version = "1.24.1" -type Client struct { - config *clientConfig +// Realis is an interface that defines the various APIs that may be used to communicate with +// the Apache Aurora scheduler. +// TODO(rdelvalle): Move documentation to interface in order to make godoc look better accessible +// Or get rid of the interface +type Realis interface { + AbortJobUpdate(updateKey aurora.JobUpdateKey, message string) (*aurora.Response, error) + AddInstances(instKey aurora.InstanceKey, count int32) (*aurora.Response, error) + CreateJob(auroraJob Job) (*aurora.Response, error) + CreateService( + auroraJob Job, + settings *aurora.JobUpdateSettings) (*aurora.Response, *aurora.StartJobUpdateResult_, error) + DescheduleCronJob(key *aurora.JobKey) (*aurora.Response, error) + FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.TaskConfig, error) + GetInstanceIds(key *aurora.JobKey, states []aurora.ScheduleStatus) ([]int32, error) + GetJobUpdateSummaries(jobUpdateQuery *aurora.JobUpdateQuery) (*aurora.Response, error) + GetTaskStatus(query *aurora.TaskQuery) ([]*aurora.ScheduledTask, error) + GetTasksWithoutConfigs(query *aurora.TaskQuery) ([]*aurora.ScheduledTask, error) + GetJobs(role string) (*aurora.Response, *aurora.GetJobsResult_, error) + GetPendingReason(query *aurora.TaskQuery) (pendingReasons []*aurora.PendingReason, e error) + JobUpdateDetails(updateQuery aurora.JobUpdateQuery) (*aurora.Response, error) + KillJob(key *aurora.JobKey) (*aurora.Response, error) + KillInstances(key *aurora.JobKey, instances ...int32) (*aurora.Response, error) + RemoveInstances(key *aurora.JobKey, count int32) (*aurora.Response, error) + RestartInstances(key *aurora.JobKey, instances ...int32) (*aurora.Response, error) + RestartJob(key *aurora.JobKey) (*aurora.Response, error) + RollbackJobUpdate(key aurora.JobUpdateKey, message string) (*aurora.Response, error) + ScheduleCronJob(auroraJob Job) (*aurora.Response, error) + StartJobUpdate(updateJob *UpdateJob, message string) (*aurora.Response, error) + PauseJobUpdate(key *aurora.JobUpdateKey, message string) (*aurora.Response, error) + ResumeJobUpdate(key *aurora.JobUpdateKey, message string) (*aurora.Response, error) + PulseJobUpdate(key *aurora.JobUpdateKey) (*aurora.Response, error) + StartCronJob(key *aurora.JobKey) (*aurora.Response, error) + // TODO: Remove this method and make it private to avoid race conditions + ReestablishConn() error + RealisConfig() *config + Close() + + // Admin functions + DrainHosts(hosts ...string) (*aurora.Response, *aurora.DrainHostsResult_, error) + SLADrainHosts(policy *aurora.SlaPolicy, timeout int64, hosts ...string) (*aurora.DrainHostsResult_, error) + StartMaintenance(hosts ...string) (*aurora.Response, *aurora.StartMaintenanceResult_, error) + EndMaintenance(hosts ...string) (*aurora.Response, *aurora.EndMaintenanceResult_, error) + MaintenanceStatus(hosts ...string) (*aurora.Response, *aurora.MaintenanceStatusResult_, error) + SetQuota(role string, cpu *float64, ram *int64, disk *int64) (*aurora.Response, error) + GetQuota(role string) (*aurora.Response, error) + Snapshot() error + PerformBackup() error + // Force an Implicit reconciliation between Mesos and Aurora + ForceImplicitTaskReconciliation() error + // Force an Explicit reconciliation between Mesos and Aurora + ForceExplicitTaskReconciliation(batchSize *int32) error +} + +type realisClient struct { + config *config client *aurora.AuroraSchedulerManagerClient readonlyClient *aurora.ReadOnlySchedulerClient adminClient *aurora.AuroraAdminClient @@ -49,28 +101,210 @@ type Client struct { transport thrift.TTransport } -func newTJSONTransport(url string, timeout time.Duration, config *clientConfig) (thrift.TTransport, error) { +type config struct { + username, password string + url string + timeoutms int + binTransport, jsonTransport bool + cluster *Cluster + backoff Backoff + transport thrift.TTransport + protoFactory thrift.TProtocolFactory + logger *LevelLogger + insecureSkipVerify bool + certspath string + certExtensions map[string]struct{} + clientKey, clientCert string + options []ClientOption + debug bool + trace bool + zkOptions []ZKOpt + failOnPermanentErrors bool +} + +var defaultBackoff = Backoff{ + Steps: 3, + Duration: 10 * time.Second, + Factor: 5.0, + Jitter: 0.1, +} + +var defaultSlaPolicy = aurora.SlaPolicy{ + PercentageSlaPolicy: &aurora.PercentageSlaPolicy{ + Percentage: 66, + DurationSecs: 300, + }, +} + +const defaultSlaDrainTimeoutSecs = 900 + +// ClientOption is an alias for a function that modifies the realis config object +type ClientOption func(*config) + +// BasicAuth sets authentication used against Apache Shiro in the Aurora scheduler +func BasicAuth(username, password string) ClientOption { + return func(config *config) { + config.username = username + config.password = password + } +} + +// SchedulerUrl sets the immediate location of the current Aurora scheduler leader +func SchedulerUrl(url string) ClientOption { + return func(config *config) { + config.url = url + } +} + +// TimeoutMS sets the connection timeout for an HTTP post request in Miliseconds +func TimeoutMS(timeout int) ClientOption { + return func(config *config) { + config.timeoutms = timeout + } +} + +// ZKCluster sets a clusters.json provided cluster configuration to the client +func ZKCluster(cluster *Cluster) ClientOption { + return func(config *config) { + config.cluster = cluster + } +} + +// ZKUrl sets the direct location of a Zookeeper node on which the Aurora leader registers itself +func ZKUrl(url string) ClientOption { + opts := []ZKOpt{ZKEndpoints(strings.Split(url, ",")...), ZKPath("/aurora/scheduler")} + + return func(config *config) { + if config.zkOptions == nil { + config.zkOptions = opts + } else { + config.zkOptions = append(config.zkOptions, opts...) + } + } +} + +// Retries configures the retry mechanism for the client +func Retries(backoff Backoff) ClientOption { + return func(config *config) { + config.backoff = backoff + } +} + +// ThriftJSON configures the client to use the Thrift JSON protocol. +func ThriftJSON() ClientOption { + return func(config *config) { + config.jsonTransport = true + } +} + +// ThriftBinary configures the client to use the Thrift Binary protocol. +func ThriftBinary() ClientOption { + return func(config *config) { + config.binTransport = true + } +} + +// BackOff is an alternative name for the Retry mechanism configuration. +func BackOff(b Backoff) ClientOption { + return func(config *config) { + config.backoff = b + } +} + +// InsecureSkipVerify configures the client to not check for matching hosts names on certificates +// when using an SSL enabled Aurora scheduler. +func InsecureSkipVerify(insecureSkipVerify bool) ClientOption { + return func(config *config) { + config.insecureSkipVerify = insecureSkipVerify + } +} + +// Certspath sets the directory where the server certificates to be used when connecting to an SSL enabled +// Aurora scheduler are stored. +func Certspath(certspath string) ClientOption { + return func(config *config) { + config.certspath = certspath + } +} + +// ClientCerts allows users to set client key and certificate when connecting to an SSL enabled +// Aurora scheduler. +func ClientCerts(clientKey, clientCert string) ClientOption { + return func(config *config) { + config.clientKey, config.clientCert = clientKey, clientCert + } +} + +// CertExtensions configures gorealis to consider files with the given extensions when +// loading certificates from the cert path. +func CertExtensions(extensions ...string) ClientOption { + extensionsLookup := make(map[string]struct{}) + for _, ext := range extensions { + extensionsLookup[ext] = struct{}{} + } + return func(config *config) { + config.certExtensions = extensionsLookup + } +} + +// ZookeeperOptions allows users to override default settings for connecting to Zookeeper. +// See zk.go for what is possible to set as an option. +func ZookeeperOptions(opts ...ZKOpt) ClientOption { + return func(config *config) { + config.zkOptions = opts + } +} + +// SetLogger allows the user to attach a logger that implements the logger interface in logger.go +// to the client. +func SetLogger(l logger) ClientOption { + return func(config *config) { + config.logger = &LevelLogger{logger: l} + } +} + +// Debug enables debug statements in the client. +func Debug() ClientOption { + return func(config *config) { + config.debug = true + } +} + +// Trace enables debug statements in the client. +func Trace() ClientOption { + return func(config *config) { + config.trace = true + } +} + +// FailOnPermanentErrors allows the client to stop upon encountering a connection error the standard library +// considers permanent and return an error to the user. +func FailOnPermanentErrors() ClientOption { + return func(config *config) { + config.failOnPermanentErrors = true + } +} + +func newTJSONTransport(url string, timeout int, config *config) (thrift.TTransport, error) { trans, err := defaultTTransport(url, timeout, config) if err != nil { - return nil, errors.Wrap(err, "error creating realis") + return nil, errors.Wrap(err, "unable to create transport") } - httpTrans, ok := (trans).(*thrift.THttpClient) if !ok { return nil, errors.Wrap(err, "transport does not contain a thrift client") } httpTrans.SetHeader("Content-Type", "application/x-thrift") - httpTrans.SetHeader("User-Agent", "gorealis v"+VERSION) + httpTrans.SetHeader("User-Agent", "gorealis v"+version) return trans, err } -func newTBinTransport(url string, timeout time.Duration, config *clientConfig) (thrift.TTransport, error) { +func newTBinTransport(url string, timeout int, config *config) (thrift.TTransport, error) { trans, err := defaultTTransport(url, timeout, config) if err != nil { - return nil, errors.Wrap(err, "error creating realis") + return nil, errors.Wrap(err, "unable to create transport") } - httpTrans, ok := (trans).(*thrift.THttpClient) if !ok { return nil, errors.Wrap(err, "transport does not contain a thrift client") @@ -79,22 +313,23 @@ func newTBinTransport(url string, timeout time.Duration, config *clientConfig) ( httpTrans.DelHeader("Content-Type") // Workaround for using thrift HttpPostClient httpTrans.SetHeader("Accept", "application/vnd.apache.thrift.binary") httpTrans.SetHeader("Content-Type", "application/vnd.apache.thrift.binary") - httpTrans.SetHeader("User-Agent", "gorealis v"+VERSION) + httpTrans.SetHeader("User-Agent", "gorealis v"+version) return trans, err } -// This client implementation uses a retry mechanism for all Thrift Calls. +// NewRealisClient is a client implementation of the realis interface uses a retry mechanism for all Thrift Calls. // It will retry all calls which result in a temporary failure as well as calls that fail due to an EOF // being returned by the http client. Most permanent failures are now being caught by the thriftCallWithRetries // function and not being retried but there may be corner cases not yet handled. -func NewClient(options ...ClientOption) (*Client, error) { - config := &clientConfig{} +func NewRealisClient(options ...ClientOption) (Realis, error) { + config := &config{} // Default configs - config.timeout = 10 * time.Second + config.timeoutms = 10000 config.backoff = defaultBackoff - config.logger = &LevelLogger{Logger: log.New(os.Stdout, "realis: ", log.Ltime|log.Ldate|log.LUTC)} + config.logger = &LevelLogger{logger: log.New(os.Stdout, "realis: ", log.Ltime|log.Ldate|log.LUTC)} + config.certExtensions = map[string]struct{}{".crt": {}, ".pem": {}, ".key": {}} // Save options to recreate client if a connection error happens config.options = options @@ -106,20 +341,32 @@ func NewClient(options ...ClientOption) (*Client, error) { // TODO(rdelvalle): Move this logic to it's own function to make initialization code easier to read. - // Set a sane logger based upon configuration passed by the user + // Turn off all logging (including debug) if config.logger == nil { - if config.debug || config.trace { - config.logger = &LevelLogger{Logger: log.New(os.Stdout, "realis: ", log.Ltime|log.Ldate|log.LUTC)} - } else { - config.logger = &LevelLogger{Logger: NoopLogger{}} + config.logger = &LevelLogger{logger: NoopLogger{}} + } + + // Set a logger if debug has been set to true but no logger has been set + if config.logger == nil && config.debug { + config.logger = &LevelLogger{ + logger: log.New(os.Stdout, "realis: ", log.Ltime|log.Ldate|log.LUTC), + debug: true, } } + config.logger.debug = config.debug + config.logger.trace = config.trace + // Note, by this point, a LevelLogger should have been created. config.logger.EnableDebug(config.debug) config.logger.EnableTrace(config.trace) - config.logger.DebugPrintln("Number of options applied to clientConfig: ", len(options)) + config.logger.debugPrintln("Number of options applied to config: ", len(options)) + + // Set default Transport to JSON if needed. + if !config.jsonTransport && !config.binTransport { + config.jsonTransport = true + } var url string var err error @@ -128,7 +375,7 @@ func NewClient(options ...ClientOption) (*Client, error) { if config.zkOptions != nil { url, err = LeaderFromZKOpts(config.zkOptions...) if err != nil { - return nil, NewTemporaryError(errors.Wrap(err, "unable to determine leader from zookeeper")) + return nil, NewTemporaryError(errors.Wrap(err, "unable to use zk to get leader")) } config.logger.Println("Scheduler URL from ZK: ", url) } else if config.cluster != nil { @@ -137,7 +384,7 @@ func NewClient(options ...ClientOption) (*Client, error) { url, err = LeaderFromZK(*config.cluster) // If ZK is configured, throw an error if the leader is unable to be determined if err != nil { - return nil, NewTemporaryError(errors.Wrap(err, "unable to determine leader from zookeeper")) + return nil, NewTemporaryError(errors.Wrap(err, "unable to use zk to get leader")) } config.logger.Println("Scheduler URL from ZK: ", url) } else if config.url != "" { @@ -147,31 +394,31 @@ func NewClient(options ...ClientOption) (*Client, error) { return nil, errors.New("incomplete Options -- url, cluster.json, or Zookeeper address required") } - url, err = validateAuroraAddress(url) + config.logger.Println("Address obtained: ", url) + url, err = validateAuroraURL(url) if err != nil { - return nil, errors.Wrap(err, "unable to create realis object, invalid url") + return nil, errors.Wrap(err, "invalid Aurora url") } + config.logger.Println("Corrected address: ", url) - switch config.transportProtocol { - case binaryProtocol: - trans, err := newTBinTransport(url, config.timeout, config) + if config.jsonTransport { + trans, err := newTJSONTransport(url, config.timeoutms, config) if err != nil { - return nil, NewTemporaryError(errors.Wrap(err, "error creating realis")) - } - config.transport = trans - config.protoFactory = thrift.NewTBinaryProtocolFactoryDefault() - case jsonProtocol: - fallthrough - default: - trans, err := newTJSONTransport(url, config.timeout, config) - if err != nil { - return nil, NewTemporaryError(errors.Wrap(err, "error creating realis")) + return nil, NewTemporaryError(err) } config.transport = trans config.protoFactory = thrift.NewTJSONProtocolFactory() + + } else if config.binTransport { + trans, err := newTBinTransport(url, config.timeoutms, config) + if err != nil { + return nil, NewTemporaryError(err) + } + config.transport = trans + config.protoFactory = thrift.NewTBinaryProtocolFactoryDefault() } - config.logger.Printf("gorealis clientConfig url: %+v\n", url) + config.logger.Printf("gorealis config url: %+v\n", url) // Adding Basic Authentication. if config.username != "" && config.password != "" { @@ -182,46 +429,38 @@ func NewClient(options ...ClientOption) (*Client, error) { httpTrans.SetHeader("Authorization", "Basic "+basicAuth(config.username, config.password)) } - return &Client{ + return &realisClient{ config: config, client: aurora.NewAuroraSchedulerManagerClientFactory(config.transport, config.protoFactory), readonlyClient: aurora.NewReadOnlySchedulerClientFactory(config.transport, config.protoFactory), adminClient: aurora.NewAuroraAdminClientFactory(config.transport, config.protoFactory), - // We initialize logger this way to allow any logger which satisfies the Logger interface - logger: LevelLogger{Logger: config.logger, debug: config.debug, trace: config.trace}, - lock: &sync.Mutex{}, - transport: config.transport, + logger: LevelLogger{logger: config.logger, debug: config.debug, trace: config.trace}, + lock: &sync.Mutex{}, + transport: config.transport, }, nil } -func GetCerts(certPath string) (*x509.CertPool, error) { - globalRootCAs := x509.NewCertPool() - caFiles, err := ioutil.ReadDir(certPath) - if err != nil { - return nil, err +// GetDefaultClusterFromZKUrl creates a cluster object from a Zoookeper url. This is deprecated in favor of using +// Zookeeper options. +func GetDefaultClusterFromZKUrl(zkurl string) *Cluster { + return &Cluster{ + Name: "defaultCluster", + AuthMechanism: "UNAUTHENTICATED", + ZK: zkurl, + SchedZKPath: "/aurora/scheduler", + AgentRunDir: "latest", + AgentRoot: "/var/lib/mesos", } - for _, cert := range caFiles { - caPathFile := filepath.Join(certPath, cert.Name()) - caCert, err := ioutil.ReadFile(caPathFile) - if err != nil { - return nil, err - } - globalRootCAs.AppendCertsFromPEM(caCert) - } - return globalRootCAs, nil } // Creates a default Thrift Transport object for communications in gorealis using an HTTP Post Client -func defaultTTransport(url string, timeout time.Duration, config *clientConfig) (thrift.TTransport, error) { +func defaultTTransport(url string, timeoutMs int, config *config) (thrift.TTransport, error) { var transport http.Transport - if config != nil { - tlsConfig := &tls.Config{} - if config.insecureSkipVerify { - tlsConfig.InsecureSkipVerify = true - } - if config.certsPath != "" { - rootCAs, err := GetCerts(config.certsPath) + tlsConfig := &tls.Config{InsecureSkipVerify: config.insecureSkipVerify} + + if config.certspath != "" { + rootCAs, err := createCertPool(config.certspath, config.certExtensions) if err != nil { config.logger.Println("error occurred couldn't fetch certs") return nil, err @@ -229,10 +468,10 @@ func defaultTTransport(url string, timeout time.Duration, config *clientConfig) tlsConfig.RootCAs = rootCAs } if config.clientKey != "" && config.clientCert == "" { - return nil, fmt.Errorf("have to provide both client key,cert. Only client key provided ") + return nil, fmt.Errorf("have to provide both client key, cert. Only client key provided ") } if config.clientKey == "" && config.clientCert != "" { - return nil, fmt.Errorf("have to provide both client key,cert. Only client cert provided ") + return nil, fmt.Errorf("have to provide both client key, cert. Only client cert provided ") } if config.clientKey != "" && config.clientCert != "" { cert, err := tls.LoadX509KeyPair(config.clientCert, config.clientKey) @@ -245,10 +484,11 @@ func defaultTTransport(url string, timeout time.Duration, config *clientConfig) transport.TLSClientConfig = tlsConfig } - trans, err := thrift.NewTHttpClientWithOptions(url, + trans, err := thrift.NewTHttpClientWithOptions( + url, thrift.THttpClientOptions{ Client: &http.Client{ - Timeout: timeout, + Timeout: time.Millisecond * time.Duration(timeoutMs), Transport: &transport, }, }) @@ -269,16 +509,20 @@ func basicAuth(username, password string) string { return base64.StdEncoding.EncodeToString([]byte(auth)) } -func (c *Client) ReestablishConn() error { +func (r *realisClient) ReestablishConn() error { // Close existing connection - c.logger.Println("Re-establishing Connection to Aurora") - c.Close() + r.logger.Println("Re-establishing Connection to Aurora") - c.lock.Lock() - defer c.lock.Unlock() + // This call must happen before we lock as it also uses + // the same lock from the client since close can be called + // by anyone from anywhere. + r.Close() + + r.lock.Lock() + defer r.lock.Unlock() // Recreate connection from scratch using original options - newRealis, err := NewClient(c.config.options...) + newRealis, err := NewRealisClient(r.config.options...) if err != nil { // This could be a temporary network hiccup return NewTemporaryError(err) @@ -286,38 +530,43 @@ func (c *Client) ReestablishConn() error { // If we are able to successfully re-connect, make receiver // point to newly established connections. - c.config = newRealis.config - c.client = newRealis.client - c.readonlyClient = newRealis.readonlyClient - c.adminClient = newRealis.adminClient - c.logger = newRealis.logger + if newClient, ok := newRealis.(*realisClient); ok { + r.config = newClient.config + r.client = newClient.client + r.readonlyClient = newClient.readonlyClient + r.adminClient = newClient.adminClient + r.logger = newClient.logger + } return nil } -// Releases resources associated with the realis client. -func (c *Client) Close() { +// Close releases resources associated with the realis client. +func (r *realisClient) Close() { - c.lock.Lock() - defer c.lock.Unlock() + r.lock.Lock() + defer r.lock.Unlock() - c.transport.Close() + // The return value of Close here is ignored on purpose because there's nothing that can be done if it fails. + _ = r.transport.Close() } -// Uses predefined set of states to retrieve a set of active jobs in Apache Aurora. -func (c *Client) GetInstanceIds(key aurora.JobKey, states []aurora.ScheduleStatus) ([]int32, error) { +// GetInstanceIds uses a predefined set of states to retrieve a set of active jobs in the Aurora Scheduler. +func (r *realisClient) GetInstanceIds(key *aurora.JobKey, states []aurora.ScheduleStatus) ([]int32, error) { taskQ := &aurora.TaskQuery{ - Role: &key.Role, - Environment: &key.Environment, - JobName: &key.Name, - Statuses: states, + JobKeys: []*aurora.JobKey{{Environment: key.Environment, Role: key.Role, Name: key.Name}}, + Statuses: states, } - c.logger.DebugPrintf("GetTasksWithoutConfigs Thrift Payload: %+v\n", taskQ) + r.logger.debugPrintf("GetTasksWithoutConfigs Thrift Payload: %+v\n", taskQ) - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.GetTasksWithoutConfigs(context.TODO(), taskQ) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.GetTasksWithoutConfigs(context.TODO(), taskQ) + }, + nil, + ) // If we encountered an error we couldn't recover from by retrying, return an error to the user if retryErr != nil { @@ -334,384 +583,455 @@ func (c *Client) GetInstanceIds(key aurora.JobKey, states []aurora.ScheduleStatu } -func (c *Client) GetJobUpdateSummaries(jobUpdateQuery *aurora.JobUpdateQuery) (*aurora.GetJobUpdateSummariesResult_, error) { - c.logger.DebugPrintf("GetJobUpdateSummaries Thrift Payload: %+v\n", jobUpdateQuery) +func (r *realisClient) GetJobUpdateSummaries(jobUpdateQuery *aurora.JobUpdateQuery) (*aurora.Response, error) { - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.readonlyClient.GetJobUpdateSummaries(context.TODO(), jobUpdateQuery) - }) + r.logger.debugPrintf("GetJobUpdateSummaries Thrift Payload: %+v\n", jobUpdateQuery) + + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.readonlyClient.GetJobUpdateSummaries(context.TODO(), jobUpdateQuery) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "error getting job update summaries from Aurora Scheduler") + return resp, errors.Wrap(retryErr, "error getting job update summaries from Aurora Scheduler") } - return resp.GetResult_().GetGetJobUpdateSummariesResult_(), nil + if resp.GetResult_() == nil || resp.GetResult_().GetGetJobUpdateSummariesResult_() == nil { + return nil, errors.New("unexpected response from scheduler") + } + + return resp, nil } -func (c *Client) GetJobs(role string) (*aurora.GetJobsResult_, error) { +func (r *realisClient) GetJobs(role string) (*aurora.Response, *aurora.GetJobsResult_, error) { var result *aurora.GetJobsResult_ - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.readonlyClient.GetJobs(context.TODO(), role) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.readonlyClient.GetJobs(context.TODO(), role) + }, + nil, + ) if retryErr != nil { - return result, errors.Wrap(retryErr, "error getting Jobs from Aurora Scheduler") + return nil, result, errors.Wrap(retryErr, "error getting Jobs from Aurora Scheduler") } if resp.GetResult_() != nil { result = resp.GetResult_().GetJobsResult_ } - return result, nil + return resp, result, nil } -// Kill specific instances of a job. Returns true, nil if a task was actually killed as a result of this API call. -// Returns false, nil if no tasks were killed as a result of this call but there was no error making the call. -func (c *Client) KillInstances(key aurora.JobKey, instances ...int32) (bool, error) { - c.logger.DebugPrintf("KillTasks Thrift Payload: %+v %v\n", key, instances) +// KillInstances kills specific instances of a job. +func (r *realisClient) KillInstances(key *aurora.JobKey, instances ...int32) (*aurora.Response, error) { + r.logger.debugPrintf("KillTasks Thrift Payload: %+v %v\n", key, instances) - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.KillTasks(context.TODO(), &key, instances, "") - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.KillTasks(context.TODO(), key, instances, "") + }, + nil, + ) if retryErr != nil { - return false, errors.Wrap(retryErr, "error sending Kill command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Kill command to Aurora Scheduler") } - - if len(resp.GetDetails()) > 0 { - c.logger.Println("KillTasks was called but no tasks killed as a result.") - return false, nil - } else { - return true, nil - } - + return resp, nil } -func (c *Client) RealisConfig() *clientConfig { - return c.config +func (r *realisClient) RealisConfig() *config { + return r.config } -// Sends a kill message to the scheduler for all active tasks under a job. -func (c *Client) KillJob(key aurora.JobKey) error { +// KillJob kills all instances of a job. +func (r *realisClient) KillJob(key *aurora.JobKey) (*aurora.Response, error) { - c.logger.DebugPrintf("KillTasks Thrift Payload: %+v\n", key) + r.logger.debugPrintf("KillTasks Thrift Payload: %+v\n", key) - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - // Giving the KillTasks thrift call an empty set tells the Aurora scheduler to kill all active shards - return c.client.KillTasks(context.TODO(), &key, nil, "") - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + // Giving the KillTasks thrift call an empty set tells the Aurora scheduler to kill all active shards + return r.client.KillTasks(context.TODO(), key, nil, "") + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "error sending Kill command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Kill command to Aurora Scheduler") } - return nil + return resp, nil } -// Sends a create job message to the scheduler with a specific job configuration. +// CreateJob sends a create job message to the scheduler with a specific job configuration. // Although this API is able to create service jobs, it is better to use CreateService instead // as that API uses the update thrift call which has a few extra features available. // Use this API to create ad-hoc jobs. -func (c *Client) CreateJob(auroraJob *AuroraJob) error { - // If no thermos configuration has been set this will result in a NOOP - err := auroraJob.BuildThermosPayload() +func (r *realisClient) CreateJob(auroraJob Job) (*aurora.Response, error) { - c.logger.DebugPrintf("CreateJob Thrift Payload: %+v\n", auroraJob.JobConfig()) + r.logger.debugPrintf("CreateJob Thrift Payload: %+v\n", auroraJob.JobConfig()) + // Response is checked by the thrift retry code + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.CreateJob(context.TODO(), auroraJob.JobConfig()) + }, + // On a client timeout, attempt to verify that payload made to the Scheduler by + // trying to get the config summary for the job key + func() (*aurora.Response, bool) { + exists, err := r.jobExists(*auroraJob.JobKey()) + if err != nil { + r.logger.Print("verification failed ", err) + } + + if exists { + return &aurora.Response{ResponseCode: aurora.ResponseCode_OK}, true + } + + return nil, false + }, + ) + + if retryErr != nil { + return resp, errors.Wrap(retryErr, "error sending Create command to Aurora Scheduler") + } + + return resp, nil +} + +// CreateService uses the scheduler's updating mechanism to create a job. +func (r *realisClient) CreateService( + auroraJob Job, + settings *aurora.JobUpdateSettings) (*aurora.Response, *aurora.StartJobUpdateResult_, error) { + // Create a new job update object and ship it to the StartJobUpdate api + update := NewUpdateJob(auroraJob.TaskConfig(), settings) + update.InstanceCount(auroraJob.GetInstanceCount()) + + resp, err := r.StartJobUpdate(update, "") if err != nil { - return errors.Wrap(err, "unable to create Thermos payload") + if IsTimeout(err) { + return nil, nil, err + } + return resp, nil, errors.Wrap(err, "unable to create service") } - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.CreateJob(context.TODO(), auroraJob.JobConfig()) - }) + return resp, resp.GetResult_().StartJobUpdateResult_, nil +} + +func (r *realisClient) ScheduleCronJob(auroraJob Job) (*aurora.Response, error) { + r.logger.debugPrintf("ScheduleCronJob Thrift Payload: %+v\n", auroraJob.JobConfig()) + + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.ScheduleCronJob(context.TODO(), auroraJob.JobConfig()) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "error sending Create command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Cron Job Schedule message to Aurora Scheduler") } - - return nil + return resp, nil } -// This API uses an update thrift call to create the services giving a few more robust features. -func (c *Client) CreateService(update *JobUpdate) (*aurora.StartJobUpdateResult_, error) { - updateResult, err := c.StartJobUpdate(update, "") - if err != nil { - return nil, errors.Wrap(err, "unable to create service") - } +func (r *realisClient) DescheduleCronJob(key *aurora.JobKey) (*aurora.Response, error) { - return updateResult, err -} + r.logger.debugPrintf("DescheduleCronJob Thrift Payload: %+v\n", key) -func (c *Client) ScheduleCronJob(auroraJob *AuroraJob) error { - // If no thermos configuration has been set this will result in a NOOP - err := auroraJob.BuildThermosPayload() - - c.logger.DebugPrintf("ScheduleCronJob Thrift Payload: %+v\n", auroraJob.JobConfig()) - - if err != nil { - return errors.Wrap(err, "Unable to create Thermos payload") - } - - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.ScheduleCronJob(context.TODO(), auroraJob.JobConfig()) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.DescheduleCronJob(context.TODO(), key) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "error sending Cron AuroraJob Schedule message to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Cron Job De-schedule message to Aurora Scheduler") + } - return nil + return resp, nil + } -func (c *Client) DescheduleCronJob(key aurora.JobKey) error { +func (r *realisClient) StartCronJob(key *aurora.JobKey) (*aurora.Response, error) { - c.logger.DebugPrintf("DescheduleCronJob Thrift Payload: %+v\n", key) + r.logger.debugPrintf("StartCronJob Thrift Payload: %+v\n", key) - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.DescheduleCronJob(context.TODO(), &key) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.StartCronJob(context.TODO(), key) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "error sending Cron AuroraJob De-schedule message to Aurora Scheduler") - + return nil, errors.Wrap(retryErr, "error sending Start Cron Job message to Aurora Scheduler") } - return nil + return resp, nil } -func (c *Client) StartCronJob(key aurora.JobKey) error { +// RestartInstances restarts the specified instances of a Job. +func (r *realisClient) RestartInstances(key *aurora.JobKey, instances ...int32) (*aurora.Response, error) { + r.logger.debugPrintf("RestartShards Thrift Payload: %+v %v\n", key, instances) - c.logger.DebugPrintf("StartCronJob Thrift Payload: %+v\n", key) - - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.StartCronJob(context.TODO(), &key) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.RestartShards(context.TODO(), key, instances) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "error sending Start Cron AuroraJob message to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Restart command to Aurora Scheduler") } - return nil - + return resp, nil } -// Restarts specific instances specified -func (c *Client) RestartInstances(key aurora.JobKey, instances ...int32) error { - c.logger.DebugPrintf("RestartShards Thrift Payload: %+v %v\n", key, instances) +// RestartJob restarts all active instances of a Job. +func (r *realisClient) RestartJob(key *aurora.JobKey) (*aurora.Response, error) { - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.RestartShards(context.TODO(), &key, instances) - }) - - if retryErr != nil { - return errors.Wrap(retryErr, "error sending Restart command to Aurora Scheduler") - } - return nil -} - -// Restarts all active tasks under a job configuration. -func (c *Client) RestartJob(key aurora.JobKey) error { - - instanceIds, err1 := c.GetInstanceIds(key, aurora.ACTIVE_STATES) + instanceIds, err1 := r.GetInstanceIds(key, aurora.ACTIVE_STATES) if err1 != nil { - return errors.Wrap(err1, "could not retrieve relevant task instance IDs") + return nil, errors.Wrap(err1, "could not retrieve relevant task instance IDs") } - c.logger.DebugPrintf("RestartShards Thrift Payload: %+v %v\n", key, instanceIds) + r.logger.debugPrintf("RestartShards Thrift Payload: %+v %v\n", key, instanceIds) if len(instanceIds) > 0 { - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.RestartShards(context.TODO(), &key, instanceIds) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.RestartShards(context.TODO(), key, instanceIds) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "error sending Restart command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Restart command to Aurora Scheduler") } - return nil - } else { - return errors.New("no tasks in the Active state") + return resp, nil } + + return nil, errors.New("No tasks in the Active state") } -// Update all tasks under a job configuration. Currently gorealis doesn't support for canary deployments. -func (c *Client) StartJobUpdate(updateJob *JobUpdate, message string) (*aurora.StartJobUpdateResult_, error) { +// StartJobUpdate updates all instances under a job configuration. +func (r *realisClient) StartJobUpdate(updateJob *UpdateJob, message string) (*aurora.Response, error) { - if err := updateJob.BuildThermosPayload(); err != nil { - return nil, errors.New("unable to generate the proper Thermos executor payload") - } + r.logger.debugPrintf("StartJobUpdate Thrift Payload: %+v %v\n", updateJob, message) - c.logger.DebugPrintf("StartJobUpdate Thrift Payload: %+v %v\n", updateJob, message) - - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.StartJobUpdate(nil, updateJob.request, message) - }) - - if retryErr != nil { - return nil, errors.Wrap(retryErr, "error sending StartJobUpdate command to Aurora Scheduler") - } - - if resp.GetResult_() != nil && resp.GetResult_().GetStartJobUpdateResult_() != nil { - return resp.GetResult_().GetStartJobUpdateResult_(), nil - } - - return nil, errors.New("thrift error: Field in response is nil unexpectedly.") -} - -// Abort AuroraJob Update on Aurora. Requires the updateId which can be obtained on the Aurora web UI. -func (c *Client) AbortJobUpdate(updateKey aurora.JobUpdateKey, message string) error { - - c.logger.DebugPrintf("AbortJobUpdate Thrift Payload: %+v %v\n", updateKey, message) - - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.AbortJobUpdate(context.TODO(), &updateKey, message) - }) - - if retryErr != nil { - return errors.Wrap(retryErr, "error sending AbortJobUpdate command to Aurora Scheduler") - } - return nil -} - -// Pause AuroraJob Update. UpdateID is returned from StartJobUpdate or the Aurora web UI. -func (c *Client) PauseJobUpdate(updateKey *aurora.JobUpdateKey, message string) error { - - c.logger.DebugPrintf("PauseJobUpdate Thrift Payload: %+v %v\n", updateKey, message) - // Thrift uses pointers for optional fields when generating Go code. To guarantee - // immutability of the JobUpdateKey, perform a deep copy and store it locally. - updateKeyLocal := &aurora.JobUpdateKey{ - Job: &aurora.JobKey{ - Role: updateKey.Job.GetRole(), - Environment: updateKey.Job.GetEnvironment(), - Name: updateKey.Job.GetName(), + resp, retryErr := r.thriftCallWithRetries( + true, + func() (*aurora.Response, error) { + return r.client.StartJobUpdate(context.TODO(), updateJob.req, message) }, - ID: updateKey.GetID(), - } + func() (*aurora.Response, bool) { + summariesResp, err := r.readonlyClient.GetJobUpdateSummaries( + context.TODO(), + &aurora.JobUpdateQuery{ + JobKey: updateJob.JobKey(), + UpdateStatuses: aurora.ACTIVE_JOB_UPDATE_STATES, + Limit: 1, + }) - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.PauseJobUpdate(nil, updateKeyLocal, message) - }) + if err != nil { + r.logger.Print("verification failed ", err) + return nil, false + } + + summaries := response.JobUpdateSummaries(summariesResp) + if len(summaries) == 0 { + return nil, false + } + + return &aurora.Response{ + ResponseCode: aurora.ResponseCode_OK, + Result_: &aurora.Result_{ + StartJobUpdateResult_: &aurora.StartJobUpdateResult_{ + UpdateSummary: summaries[0], + Key: summaries[0].Key, + }, + }, + }, true + }, + ) if retryErr != nil { - return errors.Wrap(retryErr, "error sending PauseJobUpdate command to Aurora Scheduler") + // A timeout took place when attempting this call, attempt to recover + if IsTimeout(retryErr) { + return nil, retryErr + } + + return resp, errors.Wrap(retryErr, "error sending StartJobUpdate command to Aurora Scheduler") + } + + if resp.GetResult_() == nil { + return resp, errors.New("no result in response") + } + + return resp, nil +} + +// AbortJobUpdate terminates a job update in the scheduler. +// It requires the updateId which can be obtained on the Aurora web UI. +// This API is meant to be synchronous. It will attempt to wait until the update transitions to the aborted state. +// However, if the job update does not transition to the ABORT state an error will be returned. +func (r *realisClient) AbortJobUpdate(updateKey aurora.JobUpdateKey, message string) (*aurora.Response, error) { + + r.logger.debugPrintf("AbortJobUpdate Thrift Payload: %+v %v\n", updateKey, message) + + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.AbortJobUpdate(context.TODO(), &updateKey, message) + }, + nil, + ) + + if retryErr != nil { + return nil, errors.Wrap(retryErr, "error sending AbortJobUpdate command to Aurora Scheduler") } // Make this call synchronous by blocking until it job has successfully transitioned to aborted - _, err := c.MonitorJobUpdateStatus(*updateKeyLocal, + m := Monitor{Client: r} + _, err := m.JobUpdateStatus( + updateKey, []aurora.JobUpdateStatus{aurora.JobUpdateStatus_ABORTED}, time.Second*5, time.Minute) - return err + return resp, err } -// Resume Paused AuroraJob Update. UpdateID is returned from StartJobUpdate or the Aurora web UI. -func (c *Client) ResumeJobUpdate(updateKey aurora.JobUpdateKey, message string) error { +// PauseJobUpdate pauses the progress of an ongoing update. +// The UpdateID value needed for this function is returned from StartJobUpdate or can be obtained from the Aurora web UI. +func (r *realisClient) PauseJobUpdate(updateKey *aurora.JobUpdateKey, message string) (*aurora.Response, error) { - c.logger.DebugPrintf("ResumeJobUpdate Thrift Payload: %+v %v\n", updateKey, message) - updateKey.Job = &aurora.JobKey{ - Role: updateKey.Job.Role, - Environment: updateKey.Job.Environment, - Name: updateKey.Job.Name, - } + r.logger.debugPrintf("PauseJobUpdate Thrift Payload: %+v %v\n", updateKey, message) - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.ResumeJobUpdate(context.TODO(), &updateKey, message) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.PauseJobUpdate(context.TODO(), updateKey, message) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "error sending ResumeJobUpdate command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending PauseJobUpdate command to Aurora Scheduler") } - return nil + return resp, nil } -// Pulse AuroraJob Update on Aurora. UpdateID is returned from StartJobUpdate or the Aurora web UI. -func (c *Client) PulseJobUpdate(updateKey aurora.JobUpdateKey) (aurora.JobUpdatePulseStatus, error) { +// ResumeJobUpdate resumes a previously Paused Job update. +func (r *realisClient) ResumeJobUpdate(updateKey *aurora.JobUpdateKey, message string) (*aurora.Response, error) { - c.logger.DebugPrintf("PulseJobUpdate Thrift Payload: %+v\n", updateKey) - updateKey.Job = &aurora.JobKey{ - Role: updateKey.Job.Role, - Environment: updateKey.Job.Environment, - Name: updateKey.Job.Name, - } + r.logger.debugPrintf("ResumeJobUpdate Thrift Payload: %+v %v\n", updateKey, message) - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.PulseJobUpdate(context.TODO(), &updateKey) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.ResumeJobUpdate(context.TODO(), updateKey, message) + }, + nil, + ) if retryErr != nil { - return aurora.JobUpdatePulseStatus(0), errors.Wrap(retryErr, "error sending PulseJobUpdate command to Aurora Scheduler") - } - - if resp.GetResult_() != nil && resp.GetResult_().GetPulseJobUpdateResult_() != nil { - return resp.GetResult_().GetPulseJobUpdateResult_().GetStatus(), nil - } else { - return aurora.JobUpdatePulseStatus(0), errors.New("thrift error, field was nil unexpectedly") + return nil, errors.Wrap(retryErr, "error sending ResumeJobUpdate command to Aurora Scheduler") } + return resp, nil } -// Scale up the number of instances under a job configuration using the configuration for specific -// instance to scale up. -func (c *Client) AddInstances(instKey aurora.InstanceKey, count int32) error { +// PulseJobUpdate sends a pulse to an ongoing Job update. +func (r *realisClient) PulseJobUpdate(updateKey *aurora.JobUpdateKey) (*aurora.Response, error) { - c.logger.DebugPrintf("AddInstances Thrift Payload: %+v %v\n", instKey, count) + r.logger.debugPrintf("PulseJobUpdate Thrift Payload: %+v\n", updateKey) - instKey.JobKey = &aurora.JobKey{ - Role: instKey.JobKey.Name, - Environment: instKey.JobKey.Environment, - Name: instKey.JobKey.Name, - } - - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.AddInstances(context.TODO(), &instKey, count) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.PulseJobUpdate(context.TODO(), updateKey) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "error sending AddInstances command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending PulseJobUpdate command to Aurora Scheduler") } - return nil + + return resp, nil +} + +// AddInstances scales up the number of instances for a Job. +func (r *realisClient) AddInstances(instKey aurora.InstanceKey, count int32) (*aurora.Response, error) { + + r.logger.debugPrintf("AddInstances Thrift Payload: %+v %v\n", instKey, count) + + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.AddInstances(context.TODO(), &instKey, count) + }, + nil, + ) + + if retryErr != nil { + return nil, errors.Wrap(retryErr, "error sending AddInstances command to Aurora Scheduler") + } + return resp, nil } -// Scale down the number of instances under a job configuration using the configuration of a specific instance -// Instances with a higher instance ID will be removed first. For example, if our instance ID list is [0,1,2,3] -// and we want to remove 2 instances, 2 and 3 will always be picked. -func (c *Client) RemoveInstances(key aurora.JobKey, count int) error { - instanceIds, err := c.GetInstanceIds(key, aurora.ACTIVE_STATES) +// RemoveInstances scales down the number of instances for a Job. +func (r *realisClient) RemoveInstances(key *aurora.JobKey, count int32) (*aurora.Response, error) { + instanceIds, err := r.GetInstanceIds(key, aurora.ACTIVE_STATES) if err != nil { - return errors.Wrap(err, "removeInstances: Could not retrieve relevant instance IDs") + return nil, errors.Wrap(err, "could not retrieve relevant instance IDs") } - if len(instanceIds) < count { - return errors.Errorf("insufficient active instances available for killing: "+ + + if len(instanceIds) < int(count) { + return nil, errors.Errorf("insufficient active instances available for killing: "+ " Instances to be killed %d Active instances %d", count, len(instanceIds)) } - // Sort instanceIds in decreasing order + // Sort instanceIds in ** decreasing ** order sort.Slice(instanceIds, func(i, j int) bool { return instanceIds[i] > instanceIds[j] }) - // Get the last count instance ids to kill - instanceIds = instanceIds[:count] - killed, err := c.KillInstances(key, instanceIds...) - - if !killed { - return errors.New("flex down was not able to reduce the number of instances running.") - } - - return nil + // Kill the instances with the highest ID number first + return r.KillInstances(key, instanceIds[:count]...) } -// Get information about task including a fully hydrated task configuration object -func (c *Client) GetTaskStatus(query *aurora.TaskQuery) ([]*aurora.ScheduledTask, error) { +// GetTaskStatus gets information about task including a fully hydrated task configuration object. +func (r *realisClient) GetTaskStatus(query *aurora.TaskQuery) ([]*aurora.ScheduledTask, error) { - c.logger.DebugPrintf("GetTasksStatus Thrift Payload: %+v\n", query) + r.logger.debugPrintf("GetTasksStatus Thrift Payload: %+v\n", query) - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.GetTasksStatus(context.TODO(), query) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.GetTasksStatus(context.TODO(), query) + }, + nil, + ) if retryErr != nil { return nil, errors.Wrap(retryErr, "error querying Aurora Scheduler for task status") @@ -720,36 +1040,45 @@ func (c *Client) GetTaskStatus(query *aurora.TaskQuery) ([]*aurora.ScheduledTask return response.ScheduleStatusResult(resp).GetTasks(), nil } -// Get pending reason -func (c *Client) GetPendingReason(query *aurora.TaskQuery) ([]*aurora.PendingReason, error) { +// GetPendingReason returns the reason why the an instance of a Job has not been scheduled. +func (r *realisClient) GetPendingReason(query *aurora.TaskQuery) ([]*aurora.PendingReason, error) { - c.logger.DebugPrintf("GetPendingReason Thrift Payload: %+v\n", query) + r.logger.debugPrintf("GetPendingReason Thrift Payload: %+v\n", query) - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.GetPendingReason(context.TODO(), query) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.GetPendingReason(context.TODO(), query) + }, + nil, + ) if retryErr != nil { return nil, errors.Wrap(retryErr, "error querying Aurora Scheduler for pending Reasons") } - var result []*aurora.PendingReason + var pendingReasons []*aurora.PendingReason if resp.GetResult_() != nil { - result = resp.GetResult_().GetGetPendingReasonResult_().GetReasons() + pendingReasons = resp.GetResult_().GetGetPendingReasonResult_().GetReasons() } - return result, nil + return pendingReasons, nil } -// Get information about task including without a task configuration object -func (c *Client) GetTasksWithoutConfigs(query *aurora.TaskQuery) ([]*aurora.ScheduledTask, error) { +// GetTasksWithoutConfigs gets information about task including without a task configuration object. +// This is a more lightweight version of GetTaskStatus but contains less information as a result. +func (r *realisClient) GetTasksWithoutConfigs(query *aurora.TaskQuery) ([]*aurora.ScheduledTask, error) { - c.logger.DebugPrintf("GetTasksWithoutConfigs Thrift Payload: %+v\n", query) + r.logger.debugPrintf("GetTasksWithoutConfigs Thrift Payload: %+v\n", query) - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.GetTasksWithoutConfigs(context.TODO(), query) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.GetTasksWithoutConfigs(context.TODO(), query) + }, + nil, + ) if retryErr != nil { return nil, errors.Wrap(retryErr, "error querying Aurora Scheduler for task status without configs") @@ -759,24 +1088,25 @@ func (c *Client) GetTasksWithoutConfigs(query *aurora.TaskQuery) ([]*aurora.Sche } -// Get the task configuration from the aurora scheduler for a job -func (c *Client) FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.TaskConfig, error) { - - ids := []int32{instKey.GetInstanceId()} - +// FetchTaskConfig gets the task configuration from the aurora scheduler for a job. +func (r *realisClient) FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.TaskConfig, error) { taskQ := &aurora.TaskQuery{ Role: &instKey.JobKey.Role, Environment: &instKey.JobKey.Environment, JobName: &instKey.JobKey.Name, - InstanceIds: ids, + InstanceIds: []int32{instKey.InstanceId}, Statuses: aurora.ACTIVE_STATES, } - c.logger.DebugPrintf("GetTasksStatus Thrift Payload: %+v\n", taskQ) + r.logger.debugPrintf("GetTasksStatus Thrift Payload: %+v\n", taskQ) - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.GetTasksStatus(context.TODO(), taskQ) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.GetTasksStatus(context.TODO(), taskQ) + }, + nil, + ) if retryErr != nil { return nil, errors.Wrap(retryErr, "error querying Aurora Scheduler for task configuration") @@ -796,35 +1126,39 @@ func (c *Client) FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.TaskConfig return tasks[0].AssignedTask.Task, nil } -func (c *Client) JobUpdateDetails(updateQuery aurora.JobUpdateQuery) ([]*aurora.JobUpdateDetails, error) { +func (r *realisClient) JobUpdateDetails(updateQuery aurora.JobUpdateQuery) (*aurora.Response, error) { - c.logger.DebugPrintf("GetJobUpdateDetails Thrift Payload: %+v\n", updateQuery) + r.logger.debugPrintf("GetJobUpdateDetails Thrift Payload: %+v\n", updateQuery) - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.GetJobUpdateDetails(context.TODO(), &updateQuery) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.GetJobUpdateDetails(context.TODO(), &updateQuery) + }, + nil, + ) if retryErr != nil { return nil, errors.Wrap(retryErr, "unable to get job update details") } + return resp, nil - if resp.GetResult_() != nil && resp.GetResult_().GetGetJobUpdateDetailsResult_() != nil { - return resp.GetResult_().GetGetJobUpdateDetailsResult_().GetDetailsList(), nil - } else { - return nil, errors.New("unknown Thrift error, field is nil.") - } } -func (c *Client) RollbackJobUpdate(key aurora.JobUpdateKey, message string) error { +func (r *realisClient) RollbackJobUpdate(key aurora.JobUpdateKey, message string) (*aurora.Response, error) { - c.logger.DebugPrintf("RollbackJobUpdate Thrift Payload: %+v %v\n", key, message) + r.logger.debugPrintf("RollbackJobUpdate Thrift Payload: %+v %v\n", key, message) - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.client.RollbackJobUpdate(context.TODO(), &key, message) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.RollbackJobUpdate(context.TODO(), &key, message) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "unable to roll back job update") + return nil, errors.Wrap(retryErr, "unable to roll back job update") } - return nil + return resp, nil } diff --git a/realis_admin.go b/realis_admin.go index 25dfb56..9c58081 100644 --- a/realis_admin.go +++ b/realis_admin.go @@ -1,267 +1,308 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package realis import ( "context" - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" + "github.com/paypal/gorealis/gen-go/apache/aurora" "github.com/pkg/errors" ) +// TODO(rdelvalle): Consider moving these functions to another interface. It would be a backwards incompatible change, +// but would add safety. + // Set a list of nodes to DRAINING. This means nothing will be able to be scheduled on them and any existing // tasks will be killed and re-scheduled elsewhere in the cluster. Tasks from DRAINING nodes are not guaranteed // to return to running unless there is enough capacity in the cluster to run them. -func (c *Client) DrainHosts(hosts ...string) ([]*aurora.HostStatus, error) { +func (r *realisClient) DrainHosts(hosts ...string) (*aurora.Response, *aurora.DrainHostsResult_, error) { + + var result *aurora.DrainHostsResult_ if len(hosts) == 0 { - return nil, errors.New("no hosts provided to drain") + return nil, nil, errors.New("no hosts provided to drain") } drainList := aurora.NewHosts() drainList.HostNames = hosts - c.logger.DebugPrintf("DrainHosts Thrift Payload: %v\n", drainList) + r.logger.debugPrintf("DrainHosts Thrift Payload: %v\n", drainList) - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.adminClient.DrainHosts(context.TODO(), drainList) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.DrainHosts(context.TODO(), drainList) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "unable to recover connection") + return resp, result, errors.Wrap(retryErr, "Unable to recover connection") } - if resp.GetResult_() != nil && resp.GetResult_().GetDrainHostsResult_() != nil { - return resp.GetResult_().GetDrainHostsResult_().GetStatuses(), nil - } else { - return nil, errors.New("thrift error: Field in response is nil unexpectedly.") + if resp.GetResult_() != nil { + result = resp.GetResult_().GetDrainHostsResult_() } + + return resp, result, nil } // Start SLA Aware Drain. // defaultSlaPolicy is the fallback SlaPolicy to use if a task does not have an SlaPolicy. // After timeoutSecs, tasks will be forcefully drained without checking SLA. -func (c *Client) SLADrainHosts(policy *aurora.SlaPolicy, timeout int64, hosts ...string) ([]*aurora.HostStatus, error) { +func (r *realisClient) SLADrainHosts( + policy *aurora.SlaPolicy, + timeout int64, + hosts ...string) (*aurora.DrainHostsResult_, error) { + var result *aurora.DrainHostsResult_ if len(hosts) == 0 { return nil, errors.New("no hosts provided to drain") } + if policy == nil || policy.CountSetFieldsSlaPolicy() == 0 { + policy = &defaultSlaPolicy + r.logger.Printf("Warning: start draining with default sla policy %v", policy) + } + + if timeout < 0 { + r.logger.Printf("Warning: timeout %d secs is invalid, draining with default timeout %d secs", + timeout, + defaultSlaDrainTimeoutSecs) + timeout = defaultSlaDrainTimeoutSecs + } + drainList := aurora.NewHosts() drainList.HostNames = hosts - c.logger.DebugPrintf("SLADrainHosts Thrift Payload: %v\n", drainList) + r.logger.debugPrintf("SLADrainHosts Thrift Payload: %v\n", drainList) - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.adminClient.SlaDrainHosts(context.TODO(), drainList, policy, timeout) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.SlaDrainHosts(context.TODO(), drainList, policy, timeout) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "unable to recover connection") + return result, errors.Wrap(retryErr, "Unable to recover connection") } - if resp.GetResult_() != nil && resp.GetResult_().GetDrainHostsResult_() != nil { - return resp.GetResult_().GetDrainHostsResult_().GetStatuses(), nil - } else { - return nil, errors.New("thrift error: Field in response is nil unexpectedly.") + if resp.GetResult_() != nil { + result = resp.GetResult_().GetDrainHostsResult_() } + + return result, nil } -func (c *Client) StartMaintenance(hosts ...string) ([]*aurora.HostStatus, error) { +func (r *realisClient) StartMaintenance(hosts ...string) (*aurora.Response, *aurora.StartMaintenanceResult_, error) { + + var result *aurora.StartMaintenanceResult_ if len(hosts) == 0 { - return nil, errors.New("no hosts provided to start maintenance on") + return nil, nil, errors.New("no hosts provided to start maintenance on") } hostList := aurora.NewHosts() hostList.HostNames = hosts - c.logger.DebugPrintf("StartMaintenance Thrift Payload: %v\n", hostList) + r.logger.debugPrintf("StartMaintenance Thrift Payload: %v\n", hostList) - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.adminClient.StartMaintenance(context.TODO(), hostList) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.StartMaintenance(context.TODO(), hostList) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "unable to recover connection") + return resp, result, errors.Wrap(retryErr, "Unable to recover connection") } - if resp.GetResult_() != nil && resp.GetResult_().GetStartMaintenanceResult_() != nil { - return resp.GetResult_().GetStartMaintenanceResult_().GetStatuses(), nil - } else { - return nil, errors.New("thrift error: Field in response is nil unexpectedly.") + if resp.GetResult_() != nil { + result = resp.GetResult_().GetStartMaintenanceResult_() } + + return resp, result, nil } -func (c *Client) EndMaintenance(hosts ...string) ([]*aurora.HostStatus, error) { +func (r *realisClient) EndMaintenance(hosts ...string) (*aurora.Response, *aurora.EndMaintenanceResult_, error) { + + var result *aurora.EndMaintenanceResult_ if len(hosts) == 0 { - return nil, errors.New("no hosts provided to end maintenance on") + return nil, nil, errors.New("no hosts provided to end maintenance on") } hostList := aurora.NewHosts() hostList.HostNames = hosts - c.logger.DebugPrintf("EndMaintenance Thrift Payload: %v\n", hostList) + r.logger.debugPrintf("EndMaintenance Thrift Payload: %v\n", hostList) - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.adminClient.EndMaintenance(context.TODO(), hostList) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.EndMaintenance(context.TODO(), hostList) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "unable to recover connection") + return resp, result, errors.Wrap(retryErr, "Unable to recover connection") } - if resp.GetResult_() != nil && resp.GetResult_().GetEndMaintenanceResult_() != nil { - return resp.GetResult_().GetEndMaintenanceResult_().GetStatuses(), nil - } else { - return nil, errors.New("thrift error: Field in response is nil unexpectedly.") + if resp.GetResult_() != nil { + result = resp.GetResult_().GetEndMaintenanceResult_() } + return resp, result, nil } -func (c *Client) MaintenanceStatus(hosts ...string) (*aurora.MaintenanceStatusResult_, error) { +func (r *realisClient) MaintenanceStatus(hosts ...string) (*aurora.Response, *aurora.MaintenanceStatusResult_, error) { var result *aurora.MaintenanceStatusResult_ if len(hosts) == 0 { - return nil, errors.New("no hosts provided to get maintenance status from") + return nil, nil, errors.New("no hosts provided to get maintenance status from") } hostList := aurora.NewHosts() hostList.HostNames = hosts - c.logger.DebugPrintf("MaintenanceStatus Thrift Payload: %v\n", hostList) + r.logger.debugPrintf("MaintenanceStatus Thrift Payload: %v\n", hostList) // Make thrift call. If we encounter an error sending the call, attempt to reconnect // and continue trying to resend command until we run out of retries. - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.adminClient.MaintenanceStatus(context.TODO(), hostList) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.MaintenanceStatus(context.TODO(), hostList) + }, + nil, + ) if retryErr != nil { - return result, errors.Wrap(retryErr, "unable to recover connection") + return resp, result, errors.Wrap(retryErr, "Unable to recover connection") } if resp.GetResult_() != nil { result = resp.GetResult_().GetMaintenanceStatusResult_() } - return result, nil + return resp, result, nil } // SetQuota sets a quota aggregate for the given role -// TODO(zircote) Currently investigating an error that is returned from thrift calls that include resources for `NamedPort` and `NumGpu` -func (c *Client) SetQuota(role string, cpu *float64, ramMb *int64, diskMb *int64) error { - ramResource := aurora.NewResource() - ramResource.RamMb = ramMb - cpuResource := aurora.NewResource() - cpuResource.NumCpus = cpu - diskResource := aurora.NewResource() - diskResource.DiskMb = diskMb +// TODO(zircote) Currently investigating an error that is returned +// from thrift calls that include resources for `NamedPort` and `NumGpu` +func (r *realisClient) SetQuota(role string, cpu *float64, ramMb *int64, diskMb *int64) (*aurora.Response, error) { + quota := &aurora.ResourceAggregate{ + Resources: []*aurora.Resource{{NumCpus: cpu}, {RamMb: ramMb}, {DiskMb: diskMb}}, + } - quota := aurora.NewResourceAggregate() - quota.Resources = []*aurora.Resource{ramResource, cpuResource, diskResource} - - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.adminClient.SetQuota(context.TODO(), role, quota) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.SetQuota(context.TODO(), role, quota) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "unable to set role quota") + return resp, errors.Wrap(retryErr, "Unable to set role quota") } - return retryErr + return resp, retryErr } // GetQuota returns the resource aggregate for the given role -func (c *Client) GetQuota(role string) (*aurora.GetQuotaResult_, error) { +func (r *realisClient) GetQuota(role string) (*aurora.Response, error) { - resp, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.adminClient.GetQuota(context.TODO(), role) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.GetQuota(context.TODO(), role) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "unable to get role quota") - } - - if resp.GetResult_() != nil { - return resp.GetResult_().GetGetQuotaResult_(), nil - } else { - return nil, errors.New("thrift error: Field in response is nil unexpectedly.") + return resp, errors.Wrap(retryErr, "Unable to get role quota") } + return resp, retryErr } // Force Aurora Scheduler to perform a snapshot and write to Mesos log -func (c *Client) Snapshot() error { +func (r *realisClient) Snapshot() error { - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.adminClient.Snapshot(context.TODO()) - }) + _, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.Snapshot(context.TODO()) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "unable to recover connection") + return errors.Wrap(retryErr, "Unable to recover connection") } return nil } // Force Aurora Scheduler to write backup file to a file in the backup directory -func (c *Client) PerformBackup() error { +func (r *realisClient) PerformBackup() error { - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.adminClient.PerformBackup(context.TODO()) - }) + _, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.PerformBackup(context.TODO()) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "unable to recover connection") + return errors.Wrap(retryErr, "Unable to recover connection") } return nil } -// Force an Implicit reconciliation between Mesos and Aurora -func (c *Client) ForceImplicitTaskReconciliation() error { +func (r *realisClient) ForceImplicitTaskReconciliation() error { - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.adminClient.TriggerImplicitTaskReconciliation(context.TODO()) - }) + _, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.TriggerImplicitTaskReconciliation(context.TODO()) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "unable to recover connection") + return errors.Wrap(retryErr, "Unable to recover connection") } return nil } -// Force an Explicit reconciliation between Mesos and Aurora -func (c *Client) ForceExplicitTaskReconciliation(batchSize *int32) error { +func (r *realisClient) ForceExplicitTaskReconciliation(batchSize *int32) error { if batchSize != nil && *batchSize < 1 { - return errors.New("invalid batch size.") + return errors.New("invalid batch size") } settings := aurora.NewExplicitReconciliationSettings() settings.BatchSize = batchSize - _, retryErr := c.thriftCallWithRetries(false, func() (*aurora.Response, error) { - return c.adminClient.TriggerExplicitTaskReconciliation(context.TODO(), settings) - }) + _, retryErr := r.thriftCallWithRetries(false, + func() (*aurora.Response, error) { + return r.adminClient.TriggerExplicitTaskReconciliation(context.TODO(), settings) + }, + nil, + ) if retryErr != nil { - return errors.Wrap(retryErr, "unable to recover connection") + return errors.Wrap(retryErr, "Unable to recover connection") } return nil diff --git a/realis_config.go b/realis_config.go deleted file mode 100644 index 7bb09fc..0000000 --- a/realis_config.go +++ /dev/null @@ -1,171 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package realis - -import ( - "strings" - "time" - - "github.com/apache/thrift/lib/go/thrift" -) - -type clientConfig struct { - username, password string - url string - timeout time.Duration - transportProtocol TransportProtocol - cluster *Cluster - backoff Backoff - transport thrift.TTransport - protoFactory thrift.TProtocolFactory - logger *LevelLogger - insecureSkipVerify bool - certsPath string - clientKey, clientCert string - options []ClientOption - debug bool - trace bool - zkOptions []ZKOpt - failOnPermanentErrors bool -} - -var defaultBackoff = Backoff{ - Steps: 3, - Duration: 10 * time.Second, - Factor: 5.0, - Jitter: 0.1, -} - -type TransportProtocol int - -const ( - unsetProtocol TransportProtocol = iota - jsonProtocol - binaryProtocol -) - -type ClientOption func(*clientConfig) - -// clientConfig sets for options in clientConfig. -func BasicAuth(username, password string) ClientOption { - return func(config *clientConfig) { - config.username = username - config.password = password - } -} - -func SchedulerUrl(url string) ClientOption { - return func(config *clientConfig) { - config.url = url - } -} - -func Timeout(timeout time.Duration) ClientOption { - return func(config *clientConfig) { - config.timeout = timeout - } -} - -func ZKCluster(cluster *Cluster) ClientOption { - return func(config *clientConfig) { - config.cluster = cluster - } -} - -func ZKUrl(url string) ClientOption { - - opts := []ZKOpt{ZKEndpoints(strings.Split(url, ",")...), ZKPath("/aurora/scheduler")} - - return func(config *clientConfig) { - if config.zkOptions == nil { - config.zkOptions = opts - } else { - config.zkOptions = append(config.zkOptions, opts...) - } - } -} - -func ThriftJSON() ClientOption { - return func(config *clientConfig) { - config.transportProtocol = jsonProtocol - } -} - -func ThriftBinary() ClientOption { - return func(config *clientConfig) { - config.transportProtocol = binaryProtocol - } -} - -func BackOff(b Backoff) ClientOption { - return func(config *clientConfig) { - config.backoff = b - } -} - -func InsecureSkipVerify(InsecureSkipVerify bool) ClientOption { - return func(config *clientConfig) { - config.insecureSkipVerify = InsecureSkipVerify - } -} - -func CertsPath(certspath string) ClientOption { - return func(config *clientConfig) { - config.certsPath = certspath - } -} - -func ClientCerts(clientKey, clientCert string) ClientOption { - return func(config *clientConfig) { - config.clientKey, config.clientCert = clientKey, clientCert - } -} - -// Use this option if you'd like to override default settings for connecting to Zookeeper. -// See zk.go for what is possible to set as an option. -func ZookeeperOptions(opts ...ZKOpt) ClientOption { - return func(config *clientConfig) { - config.zkOptions = opts - } -} - -// Using the word set to avoid name collision with Interface. -func SetLogger(l Logger) ClientOption { - return func(config *clientConfig) { - config.logger = &LevelLogger{Logger: l} - } -} - -// Enable debug statements. -func Debug() ClientOption { - return func(config *clientConfig) { - config.debug = true - } -} - -// Enable trace statements. -func Trace() ClientOption { - return func(config *clientConfig) { - config.trace = true - } -} - -// FailOnPermanentErrors - If the client encounters a connection error the standard library -// considers permanent, stop retrying and return an error to the user. -func FailOnPermanentErrors() ClientOption { - return func(config *clientConfig) { - config.failOnPermanentErrors = true - } -} diff --git a/realis_e2e_test.go b/realis_e2e_test.go index d5d48f9..78d8f0e 100644 --- a/realis_e2e_test.go +++ b/realis_e2e_test.go @@ -22,22 +22,28 @@ import ( "testing" "time" - realis "github.com/paypal/gorealis/v2" - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" + "github.com/apache/thrift/lib/go/thrift" + realis "github.com/paypal/gorealis" + "github.com/paypal/gorealis/gen-go/apache/aurora" + "github.com/paypal/gorealis/response" "github.com/pkg/errors" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) -var r *realis.Client -var thermosExec realis.ThermosExecutor +var r realis.Realis +var monitor *realis.Monitor +var thermosPayload []byte + +const auroraURL = "http://192.168.33.7:8081" func TestMain(m *testing.M) { var err error // New configuration to connect to docker container - r, err = realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"), + r, err = realis.NewRealisClient(realis.SchedulerUrl(auroraURL), realis.BasicAuth("aurora", "secret"), - realis.Timeout(20*time.Second)) + realis.TimeoutMS(20000)) if err != nil { fmt.Println("Please run docker-compose up -d before running test suite") @@ -46,72 +52,100 @@ func TestMain(m *testing.M) { defer r.Close() - thermosExec.AddProcess(realis.NewThermosProcess("boostrap", "echo bootsrapping")). - AddProcess(realis.NewThermosProcess("hello_gorealis", "while true; do echo hello world from gorealis; sleep 10; done")) + // Create monitor + monitor = &realis.Monitor{Client: r} + + thermosPayload, err = ioutil.ReadFile("examples/thermos_payload.json") + if err != nil { + fmt.Println("Error reading thermos payload file: ", err) + os.Exit(1) + } os.Exit(m.Run()) } func TestNonExistentEndpoint(t *testing.T) { - backoff := realis.Backoff{ // Reduce penalties for this test to make it quick - Steps: 5, - Duration: 1 * time.Second, + // Reduce penalties for this test to make it quick + backoff := realis.Backoff{ + Steps: 3, + Duration: 200 * time.Millisecond, Factor: 1.0, Jitter: 0.1} - // Attempt to connect to a bad endpoint - r, err := realis.NewClient(realis.SchedulerUrl("http://doesntexist.com:8081/api"), - realis.Timeout(200*time.Millisecond), - realis.BackOff(backoff), - ) - defer r.Close() - taskQ := &aurora.TaskQuery{} + badEndpoint := "http://idontexist.local:8081/api" - _, err = r.GetTasksWithoutConfigs(taskQ) + t.Run("WithRetries", func(t *testing.T) { + // Attempt to connect to a bad endpoint + badClient, err := realis.NewRealisClient( + realis.SchedulerUrl(badEndpoint), + realis.TimeoutMS(200000), + realis.BackOff(backoff), + ) - // Check that we do error out of retrying - assert.Error(t, err) + require.NoError(t, err) + require.NotNil(t, badClient) + defer badClient.Close() - // Check that the error before this one was a a retry error - // TODO: Consider bubbling up timeout behaving error all the way up to the user. - retryErr := realis.ToRetryCount(errors.Cause(err)) - assert.NotNil(t, retryErr, "error passed in is not a retry error") + _, err = badClient.GetTasksWithoutConfigs(taskQ) - assert.Equal(t, backoff.Steps, retryErr.RetryCount(), "retry count is incorrect") + // Check that we do error out of retrying + require.Error(t, err) + // Check that the error before this one was a a retry error + // TODO: Consider bubbling up timeout behaving error all the way up to the user. + retryErr := realis.ToRetryCount(errors.Cause(err)) + require.NotNil(t, retryErr, "error passed in is not a retry error") -} + assert.Equal(t, backoff.Steps, retryErr.RetryCount(), "retry count is incorrect") + }) -func TestBadCredentials(t *testing.T) { - r, err := realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"), - realis.BasicAuth("incorrect", "password"), - realis.Debug()) - defer r.Close() + t.Run("FailOnLookup", func(t *testing.T) { + // Attempt to connect to a bad endpoint + badClient, err := realis.NewRealisClient( + realis.SchedulerUrl(badEndpoint), + realis.TimeoutMS(200000), + realis.BackOff(backoff), + realis.FailOnPermanentErrors(), + ) - assert.NoError(t, err) + require.NoError(t, err) + require.NotNil(t, badClient) + defer badClient.Close() - job := realis.NewJob(). - Environment("prod"). - Role("vagrant"). - Name("create_thermos_job_test"). - ThermosExecutor(thermosExec). - CPU(.5). - RAM(64). - Disk(100). - IsService(true). - InstanceCount(2). - AddPorts(1) + _, err = badClient.GetTasksWithoutConfigs(taskQ) + + // Check that we do error out of retrying + require.Error(t, err) + }) - assert.Error(t, r.CreateJob(job)) } func TestThriftBinary(t *testing.T) { - r, err := realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"), + r, err := realis.NewRealisClient(realis.SchedulerUrl(auroraURL), realis.BasicAuth("aurora", "secret"), - realis.Timeout(20*time.Second), + realis.TimeoutMS(20000), realis.ThriftBinary()) + require.NoError(t, err) + defer r.Close() + + role := "all" + taskQ := &aurora.TaskQuery{ + Role: &role, + } + + // Perform a simple API call to test Thrift Binary + _, err = r.GetTasksWithoutConfigs(taskQ) assert.NoError(t, err) +} + +func TestThriftJSON(t *testing.T) { + r, err := realis.NewRealisClient(realis.SchedulerUrl(auroraURL), + realis.BasicAuth("aurora", "secret"), + realis.TimeoutMS(20000), + realis.ThriftJSON()) + + require.NoError(t, err) defer r.Close() role := "all" @@ -126,34 +160,13 @@ func TestThriftBinary(t *testing.T) { } -func TestThriftJSON(t *testing.T) { - r, err := realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"), - realis.BasicAuth("aurora", "secret"), - realis.Timeout(20*time.Second), - realis.ThriftJSON()) - - assert.NoError(t, err) - - role := "all" - taskQ := &aurora.TaskQuery{ - Role: &role, - } - - // Perform a simple API call to test Thrift Binary - _, err = r.GetTasksWithoutConfigs(taskQ) - - assert.NoError(t, err) - - r.Close() - -} - func TestNoopLogger(t *testing.T) { - r, err := realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"), + r, err := realis.NewRealisClient(realis.SchedulerUrl(auroraURL), realis.BasicAuth("aurora", "secret"), realis.SetLogger(realis.NoopLogger{})) - assert.NoError(t, err) + require.NoError(t, err) + defer r.Close() role := "all" taskQ := &aurora.TaskQuery{ @@ -162,63 +175,26 @@ func TestNoopLogger(t *testing.T) { // Perform a simple API call to test Thrift Binary _, err = r.GetTasksWithoutConfigs(taskQ) - assert.NoError(t, err) - - r.Close() } func TestLeaderFromZK(t *testing.T) { cluster := realis.GetDefaultClusterFromZKUrl("192.168.33.2:2181") url, err := realis.LeaderFromZK(*cluster) - assert.NoError(t, err) + require.NoError(t, err) + + // Address stored inside of ZK might be different than the one we connect to in our tests. assert.Equal(t, "http://192.168.33.7:8081", url) - -} -func TestInvalidAuroraURL(t *testing.T) { - for _, url := range []string{ - "http://doesntexist.com:8081/apitest", - "test://doesntexist.com:8081", - "https://doesntexist.com:8081/testing/api", - } { - r, err := realis.NewClient(realis.SchedulerUrl(url)) - assert.Error(t, err) - assert.Nil(t, r) - } -} - -func TestValidAuroraURL(t *testing.T) { - for _, url := range []string{ - "http://domain.com:8081/api", - "https://domain.com:8081/api", - "domain.com:8081", - "domain.com", - "192.168.33.7", - "192.168.33.7:8081", - "192.168.33.7:8081/api", - } { - r, err := realis.NewClient(realis.SchedulerUrl(url)) - assert.NoError(t, err) - assert.NotNil(t, r) - } } func TestRealisClient_ReestablishConn(t *testing.T) { - // Test that we're able to tear down the old connection and create a new one. err := r.ReestablishConn() assert.NoError(t, err) } -func TestGetCACerts(t *testing.T) { - certs, err := realis.GetCerts("./examples/certs") - assert.NoError(t, err) - assert.Equal(t, len(certs.Subjects()), 2) - -} - func TestRealisClient_CreateJob_Thermos(t *testing.T) { role := "vagrant" @@ -226,54 +202,148 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) { Environment("prod"). Role(role). Name("create_thermos_job_test"). - ThermosExecutor(thermosExec). - CPU(.5). - RAM(64). - Disk(100). + ExecutorName(aurora.AURORA_EXECUTOR_NAME). + ExecutorData(string(thermosPayload)). + CPU(.1). + RAM(16). + Disk(50). IsService(true). InstanceCount(2). AddPorts(1) - err := r.CreateJob(job) - assert.NoError(t, err) + _, err := r.CreateJob(job) + require.NoError(t, err) // Test Instances Monitor - success, err := r.MonitorInstances(job.JobKey(), job.GetInstanceCount(), 1*time.Second, 50*time.Second) + success, err := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 1, 50) assert.True(t, success) assert.NoError(t, err) // Fetch all Jobs - result, err := r.GetJobs(role) - fmt.Printf("GetJobs length: %+v \n", len(result.Configs)) + _, result, err := r.GetJobs(role) assert.Len(t, result.Configs, 1) assert.NoError(t, err) - // Test asking the scheduler to perform a Snapshot - t.Run("TestRealisClient_Snapshot", func(t *testing.T) { + // Test asking the scheduler to perform a Snpshot + t.Run("Snapshot", func(t *testing.T) { err := r.Snapshot() assert.NoError(t, err) }) // Test asking the scheduler to backup a Snapshot - t.Run("TestRealisClient_PerformBackup", func(t *testing.T) { + t.Run("PerformBackup", func(t *testing.T) { err := r.PerformBackup() assert.NoError(t, err) }) + t.Run("GetTaskStatus", func(t *testing.T) { + status, err := r.GetTaskStatus(&aurora.TaskQuery{ + JobKeys: []*aurora.JobKey{job.JobKey()}, + Statuses: []aurora.ScheduleStatus{aurora.ScheduleStatus_RUNNING}}) + require.NoError(t, err) + assert.NotNil(t, status) + assert.Len(t, status, 2) + + // TODO: Assert that assigned task matches the configuration of the task scheduled + }) + + t.Run("AddInstances", func(t *testing.T) { + _, err := r.AddInstances(aurora.InstanceKey{JobKey: job.JobKey(), InstanceId: 0}, 2) + require.NoError(t, err) + success, err := monitor.Instances(job.JobKey(), 4, 1, 50) + assert.True(t, success) + assert.NoError(t, err) + }) + + t.Run("KillInstances", func(t *testing.T) { + _, err := r.KillInstances(job.JobKey(), 2, 3) + require.NoError(t, err) + success, err := monitor.Instances(job.JobKey(), 2, 1, 50) + assert.True(t, success) + assert.NoError(t, err) + }) + + t.Run("RestartInstances", func(t *testing.T) { + _, err := r.RestartInstances(job.JobKey(), 0) + require.NoError(t, err) + success, err := monitor.Instances(job.JobKey(), 2, 1, 50) + assert.True(t, success) + assert.NoError(t, err) + }) + + t.Run("RestartJobs", func(t *testing.T) { + _, err := r.RestartJob(job.JobKey()) + require.NoError(t, err) + success, err := monitor.Instances(job.JobKey(), 2, 1, 50) + assert.True(t, success) + assert.NoError(t, err) + }) + // Tasks must exist for it to, be killed - t.Run("TestRealisClient_KillJob_Thermos", func(t *testing.T) { - err := r.KillJob(job.JobKey()) + t.Run("KillJob", func(t *testing.T) { + _, err := r.KillJob(job.JobKey()) + require.NoError(t, err) + success, err := monitor.Instances(job.JobKey(), 0, 1, 50) + assert.True(t, success) + assert.NoError(t, err) + }) + + t.Run("Duplicate_Metadata", func(t *testing.T) { + job.Name("thermos_duplicate_metadata"). + AddLabel("hostname", "cookie"). + AddLabel("hostname", "candy"). + AddLabel("hostname", "popcorn"). + AddLabel("hostname", "chips"). + AddLabel("chips", "chips") + + _, err := r.CreateJob(job) + require.NoError(t, err) + + success, err := monitor.Instances(job.JobKey(), 2, 1, 50) + assert.True(t, success) assert.NoError(t, err) - success, err := r.MonitorInstances(job.JobKey(), 0, 1*time.Second, 60*time.Second) + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err) + }) + + t.Run("Duplicate_constraints", func(t *testing.T) { + job.Name("thermos_duplicate_constraints"). + AddValueConstraint("zone", false, "east", "west"). + AddValueConstraint("zone", false, "east"). + AddValueConstraint("zone", true, "west") + + _, err := r.CreateJob(job) + require.NoError(t, err) + + success, err := monitor.Instances(job.JobKey(), 2, 1, 50) assert.True(t, success) assert.NoError(t, err) + + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err) + }) + + t.Run("Overwrite_constraints", func(t *testing.T) { + job.Name("thermos_overwrite_constraints"). + AddLimitConstraint("zone", 1). + AddValueConstraint("zone", true, "west", "east"). + AddLimitConstraint("zone", 2) + + _, err := r.CreateJob(job) + require.NoError(t, err) + + success, err := monitor.Instances(job.JobKey(), 2, 1, 50) + assert.True(t, success) + assert.NoError(t, err) + + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err) }) } // Test configuring an executor that doesn't exist for CreateJob API func TestRealisClient_CreateJob_ExecutorDoesNotExist(t *testing.T) { - // Create a single job job := realis.NewJob(). Environment("prod"). @@ -286,8 +356,9 @@ func TestRealisClient_CreateJob_ExecutorDoesNotExist(t *testing.T) { Disk(10). InstanceCount(1) - err := r.CreateJob(job) + resp, err := r.CreateJob(job) assert.Error(t, err) + assert.Equal(t, aurora.ResponseCode_INVALID_REQUEST, resp.GetResponseCode()) } // Test configuring an executor that doesn't exist for CreateJob API @@ -302,14 +373,16 @@ func TestRealisClient_GetPendingReason(t *testing.T) { Environment(env). Role(role). Name(name). - ThermosExecutor(thermosExec). + ExecutorName(aurora.AURORA_EXECUTOR_NAME). + ExecutorData(string(thermosPayload)). CPU(1000). RAM(64). Disk(100). InstanceCount(1) - err := r.CreateJob(job) - assert.NoError(t, err) + resp, err := r.CreateJob(job) + require.NoError(t, err) + assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode) taskQ := &aurora.TaskQuery{ Role: &role, @@ -321,7 +394,7 @@ func TestRealisClient_GetPendingReason(t *testing.T) { assert.NoError(t, err) assert.Len(t, reasons, 1) - err = r.KillJob(job.JobKey()) + _, err = r.KillJob(job.JobKey()) assert.NoError(t, err) } @@ -329,25 +402,29 @@ func TestRealisClient_CreateService_WithPulse_Thermos(t *testing.T) { fmt.Println("Creating service") role := "vagrant" - job := realis.NewJobUpdate(). + job := realis.NewJob(). Environment("prod"). Role(role). - Name("create_thermos_job_pulse_test"). + Name("create_thermos_job_test"). + ExecutorName(aurora.AURORA_EXECUTOR_NAME). + ExecutorData(string(thermosPayload)). CPU(.5). RAM(64). Disk(100). - ThermosExecutor(thermosExec). IsService(true). - InstanceCount(2). + InstanceCount(1). AddPorts(1). - AddLabel("currentTime", time.Now().String()). - PulseIntervalTimeout(30 * time.Millisecond). - BatchSize(1).WaitForBatchCompletion(true) + AddLabel("currentTime", time.Now().String()) - result, err := r.CreateService(job) - fmt.Println(result.String()) + settings := realis.NewUpdateSettings() + settings.BlockIfNoPulsesAfterMs = thrift.Int32Ptr(500) + settings.UpdateGroupSize = 1 + settings.MinWaitInInstanceRunningMs = 5000 + settings.WaitForBatchCompletion = true + job.InstanceCount(2) - assert.NoError(t, err) + _, result, err := r.CreateService(job, settings) + require.NoError(t, err) updateQ := aurora.JobUpdateQuery{ Key: result.GetKey(), @@ -356,7 +433,7 @@ func TestRealisClient_CreateService_WithPulse_Thermos(t *testing.T) { var updateDetails []*aurora.JobUpdateDetails - ticker := time.NewTicker(time.Second * 3) + ticker := time.NewTicker(time.Second * 1) timer := time.NewTimer(time.Minute * 6) defer ticker.Stop() defer timer.Stop() @@ -365,46 +442,39 @@ pulseLoop: for { select { case <-ticker.C: - if result.GetKey() == nil { - continue - } - pulseStatus, err := r.PulseJobUpdate(*result.GetKey()) + _, err = r.PulseJobUpdate(result.GetKey()) + assert.NoError(t, err, "unable to pulse job update") - assert.Nil(t, err) - if pulseStatus != aurora.JobUpdatePulseStatus_OK && pulseStatus != aurora.JobUpdatePulseStatus_FINISHED { - assert.FailNow(t, "pulse update status received doesn't exist") - } + respDetail, err := r.JobUpdateDetails(updateQ) + assert.NoError(t, err) - updateDetails, err = r.JobUpdateDetails(updateQ) - assert.Nil(t, err) + updateDetails = response.JobUpdateDetails(respDetail) + require.Len(t, updateDetails, 1, "No update found") - assert.Equal(t, len(updateDetails), 1, "no update matching query found") status := updateDetails[0].Update.Summary.State.Status - if _, ok := realis.ActiveJobUpdateStates[status]; !ok { // Rolled forward is the only state in which an update has been successfully updated // if we encounter an inactive state and it is not at rolled forward, update failed if status == aurora.JobUpdateStatus_ROLLED_FORWARD { - fmt.Println("Update succeeded") + fmt.Println("update succeed") break pulseLoop } else { - fmt.Println("Update failed") + fmt.Println("update failed") break pulseLoop } } - case <-timer.C: - err := r.AbortJobUpdate(*updateDetails[0].GetUpdate().GetSummary().GetKey(), "") + _, err := r.AbortJobUpdate(*updateDetails[0].GetUpdate().GetSummary().GetKey(), "") assert.NoError(t, err) - err = r.KillJob(job.JobKey()) - assert.NoError(t, err) - assert.FailNow(t, "timed out during pulse update test") + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err, "timed out during pulse update test") + t.FailNow() } } - err = r.KillJob(job.JobKey()) + _, err = r.KillJob(job.JobKey()) assert.NoError(t, err) } @@ -412,50 +482,122 @@ pulseLoop: func TestRealisClient_CreateService(t *testing.T) { // Create a single job - job := realis.NewJobUpdate(). + job := realis.NewJob(). Environment("prod"). Role("vagrant"). Name("create_service_test"). - ThermosExecutor(thermosExec). + ExecutorName(aurora.AURORA_EXECUTOR_NAME). + ExecutorData(string(thermosPayload)). CPU(.25). RAM(4). Disk(10). InstanceCount(3). - WatchTime(20 * time.Second). - IsService(true). - BatchSize(2) + IsService(true) - result, err := r.CreateService(job) + settings := realis.NewUpdateSettings() + settings.UpdateGroupSize = 2 + settings.MinWaitInInstanceRunningMs = 5000 + job.InstanceCount(3) - assert.NoError(t, err) + _, result, err := r.CreateService(job, settings) + require.NoError(t, err) assert.NotNil(t, result) + // Test asking the scheduler to backup a Snapshot + t.Run("PauseJobUpdate", func(t *testing.T) { + _, err = r.PauseJobUpdate(result.GetKey(), "") + assert.NoError(t, err) + }) + + t.Run("ResumeJobUpdate", func(t *testing.T) { + _, err = r.ResumeJobUpdate(result.GetKey(), "") + assert.NoError(t, err) + }) + var ok bool var mErr error - if ok, mErr = r.MonitorJobUpdate(*result.GetKey(), 5*time.Second, 4*time.Minute); !ok || mErr != nil { + if ok, mErr = monitor.JobUpdate(*result.GetKey(), 5, 240); !ok || mErr != nil { // Update may already be in a terminal state so don't check for error - err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out.") - - err = r.KillJob(job.JobKey()) - + _, err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out.") + _, err = r.KillJob(job.JobKey()) assert.NoError(t, err) } + require.NoError(t, mErr) assert.True(t, ok) - assert.NoError(t, mErr) // Kill task test task after confirming it came up fine - err = r.KillJob(job.JobKey()) - + _, err = r.KillJob(job.JobKey()) assert.NoError(t, err) + + success, err := monitor.Instances(job.JobKey(), 0, 1, 50) + require.NoError(t, mErr) + assert.True(t, success) + + // Create a client which will timeout and close the connection before receiving an answer + timeoutClient, err := realis.NewRealisClient( + realis.SchedulerUrl(auroraURL), + realis.BasicAuth("aurora", "secret"), + realis.TimeoutMS(5), + ) + require.NoError(t, err) + defer timeoutClient.Close() + + // Test case where http connection timeouts out. + t.Run("TimeoutError", func(t *testing.T) { + job.Name("createService_timeout") + + // Make sure a timedout error was returned + _, _, err = timeoutClient.CreateService(job, settings) + require.Error(t, err) + assert.True(t, realis.IsTimeout(err)) + + updateReceivedQuery := aurora.JobUpdateQuery{ + Role: &job.JobKey().Role, + JobKey: job.JobKey(), + UpdateStatuses: aurora.ACTIVE_JOB_UPDATE_STATES, + Limit: 1} + + updateSummaries, err := monitor.JobUpdateQuery(updateReceivedQuery, time.Second*1, time.Second*50) + require.NoError(t, err) + + require.Len(t, updateSummaries, 1) + + r.AbortJobUpdate(*updateSummaries[0].Key, "Cleaning up") + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err) + + }) + + // Test case where http connection timeouts out. + t.Run("TimeoutError_BadPayload", func(t *testing.T) { + // Illegal payload + job.InstanceCount(-1) + job.Name("createService_timeout_bad_payload") + + // Make sure a timedout error was returned + _, _, err = timeoutClient.CreateService(job, settings) + require.Error(t, err) + assert.True(t, realis.IsTimeout(err)) + + summary, err := r.GetJobUpdateSummaries( + &aurora.JobUpdateQuery{ + Role: &job.JobKey().Role, + JobKey: job.JobKey(), + UpdateStatuses: aurora.ACTIVE_JOB_UPDATE_STATES}) + assert.NoError(t, err) + + // Payload should have been rejected, no update should exist + require.Len(t, summary.GetResult_().GetGetJobUpdateSummariesResult_().GetUpdateSummaries(), 0) + }) } // Test configuring an executor that doesn't exist for CreateJob API func TestRealisClient_CreateService_ExecutorDoesNotExist(t *testing.T) { // Create a single job - jobUpdate := realis.NewJobUpdate(). + job := realis.NewJob(). Environment("prod"). Role("vagrant"). Name("executordoesntexist"). @@ -464,12 +606,15 @@ func TestRealisClient_CreateService_ExecutorDoesNotExist(t *testing.T) { CPU(.25). RAM(4). Disk(10). - InstanceCount(3) + InstanceCount(1) - result, err := r.CreateService(jobUpdate) + settings := realis.NewUpdateSettings() + job.InstanceCount(3) - assert.Error(t, err) + resp, result, err := r.CreateService(job, settings) + require.Error(t, err) assert.Nil(t, result) + require.Equal(t, aurora.ResponseCode_INVALID_REQUEST, resp.GetResponseCode()) } func TestRealisClient_ScheduleCronJob_Thermos(t *testing.T) { @@ -492,82 +637,88 @@ func TestRealisClient_ScheduleCronJob_Thermos(t *testing.T) { CronSchedule("* * * * *"). IsService(false) - err = r.ScheduleCronJob(job) - assert.NoError(t, err) + _, err = r.ScheduleCronJob(job) + require.NoError(t, err) - t.Run("TestRealisClient_StartCronJob_Thermos", func(t *testing.T) { - err := r.StartCronJob(job.JobKey()) - assert.NoError(t, err) + t.Run("Start", func(t *testing.T) { + _, err := r.StartCronJob(job.JobKey()) + require.NoError(t, err) }) - t.Run("TestRealisClient_DeschedulerCronJob_Thermos", func(t *testing.T) { - err := r.DescheduleCronJob(job.JobKey()) - assert.NoError(t, err) + t.Run("Deschedule", func(t *testing.T) { + _, err := r.DescheduleCronJob(job.JobKey()) + require.NoError(t, err) }) } func TestRealisClient_StartMaintenance(t *testing.T) { hosts := []string{"localhost"} - _, err := r.StartMaintenance(hosts...) - assert.NoError(t, err) + + _, _, err := r.StartMaintenance(hosts...) + require.NoError(t, err, "unable to start maintenance") // Monitor change to DRAINING and DRAINED mode - hostResults, err := r.MonitorHostMaintenance( + hostResults, err := monitor.HostMaintenance( hosts, []aurora.MaintenanceMode{aurora.MaintenanceMode_SCHEDULED}, - 1*time.Second, - 50*time.Second) + 1, + 50) + assert.NoError(t, err) assert.Equal(t, map[string]bool{"localhost": true}, hostResults) - assert.NoError(t, err) - _, err = r.EndMaintenance(hosts...) - assert.NoError(t, err) + _, _, err = r.EndMaintenance(hosts...) + require.NoError(t, err) // Monitor change to DRAINING and DRAINED mode - _, err = r.MonitorHostMaintenance( + _, err = monitor.HostMaintenance( hosts, []aurora.MaintenanceMode{aurora.MaintenanceMode_NONE}, - 5*time.Second, - 10*time.Second) + 5, + 10) assert.NoError(t, err) } func TestRealisClient_DrainHosts(t *testing.T) { hosts := []string{"localhost"} - _, err := r.DrainHosts(hosts...) - assert.NoError(t, err) - // Monitor change to DRAINING and DRAINED mode - hostResults, err := r.MonitorHostMaintenance( - hosts, - []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING}, - 1*time.Second, - 50*time.Second) - assert.Equal(t, map[string]bool{"localhost": true}, hostResults) - assert.NoError(t, err) + t.Run("DrainHosts", func(t *testing.T) { + _, _, err := r.DrainHosts(hosts...) + assert.NoError(t, err, "unable to drain host") + }) - t.Run("TestRealisClient_MonitorNontransitioned", func(t *testing.T) { + t.Run("MonitorTransitionToDrained", func(t *testing.T) { // Monitor change to DRAINING and DRAINED mode - hostResults, err := r.MonitorHostMaintenance( + hostResults, err := monitor.HostMaintenance( + hosts, + []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING}, + 1, + 50) + require.NoError(t, err) + assert.Equal(t, map[string]bool{"localhost": true}, hostResults) + }) + + t.Run("MonitorNonExistentHost", func(t *testing.T) { + // Monitor change to DRAINING and DRAINED mode + hostResults, err := monitor.HostMaintenance( append(hosts, "IMAGINARY_HOST"), []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING}, - 1*time.Second, - 1*time.Second) + 1, + 1) // Assert monitor returned an error that was not nil, and also a list of the non-transitioned hosts - assert.Error(t, err) + require.Error(t, err) assert.Equal(t, map[string]bool{"localhost": true, "IMAGINARY_HOST": false}, hostResults) }) - t.Run("TestRealisClient_EndMaintenance", func(t *testing.T) { - _, err := r.EndMaintenance(hosts...) - assert.NoError(t, err) + t.Run("EndMaintenance", func(t *testing.T) { + _, _, err := r.EndMaintenance(hosts...) + require.NoError(t, err) // Monitor change to DRAINING and DRAINED mode - _, err = r.MonitorHostMaintenance( + _, err = monitor.HostMaintenance( hosts, []aurora.MaintenanceMode{aurora.MaintenanceMode_NONE}, - 5*time.Second, - 10*time.Second) + 5, + 10) assert.NoError(t, err) }) @@ -578,29 +729,73 @@ func TestRealisClient_SLADrainHosts(t *testing.T) { policy := aurora.SlaPolicy{PercentageSlaPolicy: &aurora.PercentageSlaPolicy{Percentage: 50.0}} _, err := r.SLADrainHosts(&policy, 30, hosts...) - if err != nil { - fmt.Printf("error: %+v\n", err.Error()) - os.Exit(1) - } + require.NoError(t, err, "unable to drain host with SLA policy") // Monitor change to DRAINING and DRAINED mode - hostResults, err := r.MonitorHostMaintenance( + hostResults, err := monitor.HostMaintenance( hosts, []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING}, - 1*time.Second, - 50*time.Second) + 1, + 50) + assert.NoError(t, err) assert.Equal(t, map[string]bool{"localhost": true}, hostResults) - assert.NoError(t, err) - _, err = r.EndMaintenance(hosts...) - assert.NoError(t, err) + _, _, err = r.EndMaintenance(hosts...) + require.NoError(t, err) // Monitor change to DRAINING and DRAINED mode - _, err = r.MonitorHostMaintenance( + _, err = monitor.HostMaintenance( hosts, []aurora.MaintenanceMode{aurora.MaintenanceMode_NONE}, - 5*time.Second, - 10*time.Second) + 5, + 10) + assert.NoError(t, err) + + // slaDrainHosts goes with default policy if no policy is specified + _, err = r.SLADrainHosts(nil, 30, hosts...) + require.NoError(t, err, "unable to drain host with SLA policy") + + // Monitor change to DRAINING and DRAINED mode + hostResults, err = monitor.HostMaintenance( + hosts, + []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING}, + 1, + 50) + assert.NoError(t, err) + assert.Equal(t, map[string]bool{"localhost": true}, hostResults) + + _, _, err = r.EndMaintenance(hosts...) + require.NoError(t, err) + + // Monitor change to DRAINING and DRAINED mode + _, err = monitor.HostMaintenance( + hosts, + []aurora.MaintenanceMode{aurora.MaintenanceMode_NONE}, + 5, + 10) + assert.NoError(t, err) + + _, err = r.SLADrainHosts(&aurora.SlaPolicy{}, 30, hosts...) + require.NoError(t, err, "unable to drain host with SLA policy") + + // Monitor change to DRAINING and DRAINED mode + hostResults, err = monitor.HostMaintenance( + hosts, + []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING}, + 1, + 50) + assert.NoError(t, err) + assert.Equal(t, map[string]bool{"localhost": true}, hostResults) + + _, _, err = r.EndMaintenance(hosts...) + require.NoError(t, err) + + // Monitor change to DRAINING and DRAINED mode + _, err = monitor.HostMaintenance( + hosts, + []aurora.MaintenanceMode{aurora.MaintenanceMode_NONE}, + 5, + 10) assert.NoError(t, err) } @@ -612,32 +807,32 @@ func TestRealisClient_SessionThreadSafety(t *testing.T) { Environment("prod"). Role("vagrant"). Name("create_thermos_job_test_multi"). - ThermosExecutor(thermosExec). + ExecutorName(aurora.AURORA_EXECUTOR_NAME). + ExecutorData(string(thermosPayload)). CPU(.25). RAM(4). Disk(10). InstanceCount(1000) // Impossible amount to go live in any sane machine - err := r.CreateJob(job) + _, err := r.CreateJob(job) assert.NoError(t, err) wg := sync.WaitGroup{} - for i := 0; i < 20; i++ { - - wg.Add(1) + threadCount := 20 + wg.Add(threadCount) + for i := 0; i < threadCount; i++ { // Launch multiple monitors that will poll every second go func() { defer wg.Done() // Test Schedule status monitor for terminal state and timing out after 30 seconds - success, err := r.MonitorScheduleStatus(job.JobKey(), job.GetInstanceCount(), aurora.LIVE_STATES, 1, 30) + success, err := monitor.ScheduleStatus(job.JobKey(), job.GetInstanceCount(), realis.LiveStates, 1, 30) assert.False(t, success) assert.Error(t, err) - err = r.KillJob(job.JobKey()) + _, err = r.KillJob(job.JobKey()) assert.NoError(t, err) - }() } @@ -645,32 +840,38 @@ func TestRealisClient_SessionThreadSafety(t *testing.T) { } // Test setting and getting the quota -func TestRealisClient_SetQuota(t *testing.T) { - var cpu = 3.5 - var ram int64 = 20480 - var disk int64 = 10240 - err := r.SetQuota("vagrant", &cpu, &ram, &disk) - assert.NoError(t, err) - t.Run("TestRealisClient_GetQuota", func(t *testing.T) { +func TestRealisClient_Quota(t *testing.T) { + var resp *aurora.Response + var err error + + cpu := 3.5 + ram := int64(20480) + disk := int64(10240) + + t.Run("Set", func(t *testing.T) { + resp, err = r.SetQuota("vagrant", &cpu, &ram, &disk) + assert.NoError(t, err) + }) + + t.Run("Get", func(t *testing.T) { // Test GetQuota based on previously set values var result *aurora.GetQuotaResult_ - quotaResult, err := r.GetQuota("vagrant") - + resp, err = r.GetQuota("vagrant") + if resp.GetResult_() != nil { + result = resp.GetResult_().GetQuotaResult_ + } assert.NoError(t, err) - for _, res := range quotaResult.GetQuota().GetResources() { + + for _, res := range result.Quota.GetResources() { switch true { case res.DiskMb != nil: assert.Equal(t, disk, *res.DiskMb) - break case res.NumCpus != nil: assert.Equal(t, cpu, *res.NumCpus) - break case res.RamMb != nil: assert.Equal(t, ram, *res.RamMb) - break } } - fmt.Print("GetQuota Result", result.String()) }) } @@ -685,41 +886,232 @@ func TestRealisClient_ForceExplicitTaskReconciliation(t *testing.T) { assert.NoError(t, err) // Custom batch value - var batchSize int32 = 32 - err = r.ForceExplicitTaskReconciliation(&batchSize) + err = r.ForceExplicitTaskReconciliation(thrift.Int32Ptr(32)) assert.NoError(t, err) } func TestRealisClient_PartitionPolicy(t *testing.T) { role := "vagrant" - var partitionDelay int64 = 30 - job := realis.NewJobUpdate(). + job := realis.NewJob(). Environment("prod"). Role(role). Name("create_thermos_job_partition_policy_test"). ExecutorName(aurora.AURORA_EXECUTOR_NAME). - ThermosExecutor(thermosExec). + ExecutorData(string(thermosPayload)). CPU(.5). RAM(64). Disk(100). IsService(true). InstanceCount(2). - BatchSize(2). - PartitionPolicy(true, partitionDelay) + PartitionPolicy(&aurora.PartitionPolicy{Reschedule: true, DelaySecs: thrift.Int64Ptr(30)}) - result, err := r.CreateService(job) + settings := realis.NewUpdateSettings() + settings.UpdateGroupSize = 2 + + _, result, err := r.CreateService(job, settings) assert.NoError(t, err) var ok bool var mErr error - if ok, mErr = r.MonitorJobUpdate(*result.GetKey(), 5*time.Second, 4*time.Minute); !ok || mErr != nil { + if ok, mErr = monitor.JobUpdate(*result.GetKey(), 5, 180); !ok || mErr != nil { // Update may already be in a terminal state so don't check for error - err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out.") - err = r.KillJob(job.JobKey()) - + _, err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out.") assert.NoError(t, err) } + // Clean up after finishing test + r.KillJob(job.JobKey()) +} + +func TestAuroraJob_UpdateSlaPolicy(t *testing.T) { + + tests := []struct { + name string + args aurora.SlaPolicy + }{ + { + "create_service_with_sla_count_policy_test", + aurora.SlaPolicy{CountSlaPolicy: &aurora.CountSlaPolicy{Count: 1, DurationSecs: 15}}, + }, + { + "create_service_with_sla_percentage_policy_test", + aurora.SlaPolicy{PercentageSlaPolicy: &aurora.PercentageSlaPolicy{Percentage: 0.25, DurationSecs: 15}}, + }, + { + "create_service_with_sla_coordinator_policy_test", + aurora.SlaPolicy{CoordinatorSlaPolicy: &aurora.CoordinatorSlaPolicy{ + CoordinatorUrl: "http://localhost/endpoint", StatusKey: "aurora_test"}}, + }, + } + role := "vagrant" + + _, err := r.SetQuota(role, thrift.Float64Ptr(6.0), thrift.Int64Ptr(1024), thrift.Int64Ptr(1024)) + assert.NoError(t, err) + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + + // Create a single job + job := realis.NewJob(). + Environment("prod"). + Role(role). + Name(tt.name). + ExecutorName(aurora.AURORA_EXECUTOR_NAME). + ExecutorData(string(thermosPayload)). + CPU(.01). + RAM(2). + Disk(5). + InstanceCount(4). + IsService(true). + SlaPolicy(&tt.args). + Tier("preferred") + + settings := realis.NewUpdateSettings() + settings.UpdateGroupSize = 2 + settings.MinWaitInInstanceRunningMs = 5 * 1000 + + _, result, err := r.CreateService(job, settings) + require.NoError(t, err) + assert.NotNil(t, result) + + var ok bool + var mErr error + + if ok, mErr = monitor.JobUpdate(*result.GetKey(), 5, 240); !ok || mErr != nil { + // Update may already be in a terminal state so don't check for error + _, err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out.") + + _, err = r.KillJob(job.JobKey()) + + assert.NoError(t, err) + } + assert.NoError(t, mErr) + assert.True(t, ok) + + // Kill task test task after confirming it came up fine + _, err = r.KillJob(job.JobKey()) + + assert.NoError(t, err) + }) + } +} + +func TestRealisClient_UpdateStrategies(t *testing.T) { + + // Create a single job + job := realis.NewJob(). + Environment("prod"). + Role("vagrant"). + ExecutorName(aurora.AURORA_EXECUTOR_NAME). + ExecutorData(string(thermosPayload)). + CPU(.01). + RAM(4). + Disk(10). + InstanceCount(6). + IsService(true) + + strategies := []struct { + UpdateJob *realis.UpdateJob + Name string + }{ + { + UpdateJob: realis.NewDefaultUpdateJob(job.TaskConfig()). + QueueUpdateStrategy(aurora.QueueJobUpdateStrategy{GroupSize: 2}). + InstanceCount(6). + WatchTime(1000), + Name: "Queue", + }, + { + UpdateJob: realis.NewDefaultUpdateJob(job.TaskConfig()). + BatchUpdateStrategy(aurora.BatchJobUpdateStrategy{GroupSize: 2}). + InstanceCount(6). + WatchTime(1000), + Name: "Batch", + }, + { + UpdateJob: realis.NewDefaultUpdateJob(job.TaskConfig()). + VariableBatchStrategy(aurora.VariableBatchJobUpdateStrategy{GroupSizes: []int32{1, 2, 3}}). + InstanceCount(6). + WatchTime(1000), + Name: "VarBatch", + }, + } + + for _, strategy := range strategies { + t.Run("TestRealisClient_UpdateStrategies_"+strategy.Name, func(t *testing.T) { + job.Name("update_strategies_" + strategy.Name) + resp, err := r.StartJobUpdate(strategy.UpdateJob, "") + + assert.NoError(t, err) + assert.NotNil(t, resp) + assert.NotNil(t, resp.GetResult_()) + assert.NotNil(t, resp.GetResult_().GetStartJobUpdateResult_()) + assert.NotNil(t, resp.GetResult_().GetStartJobUpdateResult_().GetKey()) + + var ok bool + var mErr error + key := *resp.GetResult_().GetStartJobUpdateResult_().GetKey() + + if ok, mErr = monitor.JobUpdate(key, 5, 240); !ok || mErr != nil { + // Update may already be in a terminal state so don't check for error + _, err := r.AbortJobUpdate(key, "Monitor timed out.") + assert.NoError(t, err) + } + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err) + }) + } +} + +func TestRealisClient_BatchAwareAutoPause(t *testing.T) { + // Create a single job + job := realis.NewJob(). + Environment("prod"). + Role("vagrant"). + Name("BatchAwareAutoPauseTest"). + ExecutorName(aurora.AURORA_EXECUTOR_NAME). + ExecutorData(string(thermosPayload)). + CPU(.01). + RAM(4). + Disk(10). + InstanceCount(6). + IsService(true) + updateGroups := []int32{1, 2, 3} + strategy := realis.NewDefaultUpdateJob(job.TaskConfig()). + VariableBatchStrategy(aurora.VariableBatchJobUpdateStrategy{ + GroupSizes: updateGroups, + AutopauseAfterBatch: true, + }). + InstanceCount(6). + WatchTime(1000) + + resp, err := r.StartJobUpdate(strategy, "") + require.NoError(t, err) + require.NotNil(t, resp) + require.NotNil(t, resp.GetResult_()) + require.NotNil(t, resp.GetResult_().GetStartJobUpdateResult_()) + require.NotNil(t, resp.GetResult_().GetStartJobUpdateResult_().GetKey()) + + key := *resp.GetResult_().GetStartJobUpdateResult_().GetKey() + + for i := range updateGroups { + curStep, mErr := monitor.AutoPausedUpdateMonitor(key, time.Second*5, time.Second*240) + if mErr != nil { + // Update may already be in a terminal state so don't check for error + _, err := r.AbortJobUpdate(key, "Monitor timed out.") + assert.NoError(t, err) + } + + assert.Equal(t, i, curStep) + + if i != len(updateGroups)-1 { + _, err = r.ResumeJobUpdate(&key, "auto resuming test") + require.NoError(t, err) + } + } + + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err) } diff --git a/realis_test.go b/realis_test.go deleted file mode 100644 index b48e88f..0000000 --- a/realis_test.go +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package realis - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestGetCACerts(t *testing.T) { - certs, err := GetCerts("./examples/certs") - require.NoError(t, err) - assert.Equal(t, len(certs.Subjects()), 2) -} - -func TestAuroraURLValidator(t *testing.T) { - t.Run("badURL", func(t *testing.T) { - url, err := validateAuroraAddress("http://badurl.com/badpath") - assert.Empty(t, url) - assert.Error(t, err) - }) - - t.Run("URLHttp", func(t *testing.T) { - url, err := validateAuroraAddress("http://goodurl.com:8081/api") - assert.Equal(t, "http://goodurl.com:8081/api", url) - assert.NoError(t, err) - }) - - t.Run("URLHttps", func(t *testing.T) { - url, err := validateAuroraAddress("https://goodurl.com:8081/api") - assert.Equal(t, "https://goodurl.com:8081/api", url) - assert.NoError(t, err) - }) - - t.Run("URLNoPath", func(t *testing.T) { - url, err := validateAuroraAddress("http://goodurl.com:8081") - assert.Equal(t, "http://goodurl.com:8081/api", url) - assert.NoError(t, err) - }) - - t.Run("ipAddrNoPath", func(t *testing.T) { - url, err := validateAuroraAddress("http://192.168.1.33:8081") - assert.Equal(t, "http://192.168.1.33:8081/api", url) - assert.NoError(t, err) - }) - - t.Run("URLNoProtocol", func(t *testing.T) { - url, err := validateAuroraAddress("goodurl.com:8081/api") - assert.Equal(t, "http://goodurl.com:8081/api", url) - assert.NoError(t, err) - }) - - t.Run("URLNoProtocolNoPathNoPort", func(t *testing.T) { - url, err := validateAuroraAddress("goodurl.com") - assert.Equal(t, "http://goodurl.com:8081/api", url) - assert.NoError(t, err) - }) -} diff --git a/response/response.go b/response/response.go index 2b2ffe0..4a67ca0 100644 --- a/response/response.go +++ b/response/response.go @@ -17,8 +17,9 @@ package response import ( "bytes" + "errors" - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" + "github.com/paypal/gorealis/gen-go/apache/aurora" ) // Get key from a response created by a StartJobUpdate call @@ -35,9 +36,25 @@ func ScheduleStatusResult(resp *aurora.Response) *aurora.ScheduleStatusResult_ { } func JobUpdateSummaries(resp *aurora.Response) []*aurora.JobUpdateSummary { + if resp.GetResult_() == nil || resp.GetResult_().GetGetJobUpdateSummariesResult_() == nil { + return nil + } + return resp.GetResult_().GetGetJobUpdateSummariesResult_().GetUpdateSummaries() } +// Deprecated: Replaced by checks done inside of thriftCallHelper +func ResponseCodeCheck(resp *aurora.Response) (*aurora.Response, error) { + if resp == nil { + return resp, errors.New("Response is nil") + } + if resp.GetResponseCode() != aurora.ResponseCode_OK { + return resp, errors.New(CombineMessage(resp)) + } + + return resp, nil +} + // Based on aurora client: src/main/python/apache/aurora/client/base.py func CombineMessage(resp *aurora.Response) string { var buffer bytes.Buffer diff --git a/retry.go b/retry.go index 4a82431..eefcf2a 100644 --- a/retry.go +++ b/retry.go @@ -17,21 +17,20 @@ package realis import ( "io" "math/rand" - "net/http" "net/url" - "strconv" - "strings" "time" "github.com/apache/thrift/lib/go/thrift" - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" - "github.com/paypal/gorealis/v2/response" + "github.com/paypal/gorealis/gen-go/apache/aurora" + "github.com/paypal/gorealis/response" "github.com/pkg/errors" ) +// Backoff determines how the retry mechanism should react after each failure and how many failures it should +// tolerate. type Backoff struct { Duration time.Duration // the base duration - Factor float64 // Duration is multipled by factor each iteration + Factor float64 // Duration is multiplied by a factor each iteration Jitter float64 // The amount of jitter applied each iteration Steps int // Exit with error after this many steps } @@ -53,23 +52,19 @@ func Jitter(duration time.Duration, maxFactor float64) time.Duration { // if the loop should be aborted. type ConditionFunc func() (done bool, err error) -// Modified version of the Kubernetes exponential-backoff code. -// ExponentialBackoff repeats a condition check with exponential backoff. -// -// It checks the condition up to Steps times, increasing the wait by multiplying -// the previous duration by Factor. +// ExponentialBackoff is a modified version of the Kubernetes exponential-backoff code. +// It repeats a condition check with exponential backoff and checks the condition up to +// Steps times, increasing the wait by multiplying the previous duration by Factor. // // If Jitter is greater than zero, a random amount of each duration is added // (between duration and duration*(1+jitter)). // // If the condition never returns true, ErrWaitTimeout is returned. Errors // do not cause the function to return. - -func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc) error { +func ExponentialBackoff(backoff Backoff, logger logger, condition ConditionFunc) error { var err error var ok bool var curStep int - duration := backoff.Duration for curStep = 0; curStep < backoff.Steps; curStep++ { @@ -81,7 +76,8 @@ func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc) adjusted = Jitter(duration, backoff.Jitter) } - logger.Printf("A retryable error occurred during function call, backing off for %v before retrying\n", adjusted) + logger.Printf( + "A retryable error occurred during function call, backing off for %v before retrying\n", adjusted) time.Sleep(adjusted) duration = time.Duration(float64(duration) * backoff.Factor) } @@ -98,10 +94,9 @@ func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc) // If the error is temporary, continue retrying. if !IsTemporary(err) { return err - } else { - // Print out the temporary error we experienced. - logger.Println(err) } + // Print out the temporary error we experienced. + logger.Println(err) } } @@ -112,21 +107,33 @@ func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc) // Provide more information to the user wherever possible if err != nil { return newRetryError(errors.Wrap(err, "ran out of retries"), curStep) - } else { - return newRetryError(errors.New("ran out of retries"), curStep) } + + return newRetryError(errors.New("ran out of retries"), curStep) } type auroraThriftCall func() (resp *aurora.Response, err error) +// verifyOntimeout defines the type of function that will be used to verify whether a Thirft call to the Scheduler +// made it to the scheduler or not. In general, these types of functions will have to interact with the scheduler +// through the very same Thrift API which previously encountered a time out from the client. +// This means that the functions themselves should be kept to a minimum number of Thrift calls. +// It should also be noted that this is a best effort mechanism and +// is likely to fail for the same reasons that the original call failed. +type verifyOnTimeout func() (*aurora.Response, bool) + // Duplicates the functionality of ExponentialBackoff but is specifically targeted towards ThriftCalls. -func (c *Client) thriftCallWithRetries(returnOnTimeout bool, thriftCall auroraThriftCall) (*aurora.Response, error) { +func (r *realisClient) thriftCallWithRetries( + returnOnTimeout bool, + thriftCall auroraThriftCall, + verifyOnTimeout verifyOnTimeout) (*aurora.Response, error) { + var resp *aurora.Response var clientErr error var curStep int - var timeouts int + timeouts := 0 - backoff := c.config.backoff + backoff := r.config.backoff duration := backoff.Duration for curStep = 0; curStep < backoff.Steps; curStep++ { @@ -138,7 +145,10 @@ func (c *Client) thriftCallWithRetries(returnOnTimeout bool, thriftCall auroraTh adjusted = Jitter(duration, backoff.Jitter) } - c.logger.Printf("A retryable error occurred during thrift call, backing off for %v before retry %v\n", adjusted, curStep) + r.logger.Printf( + "A retryable error occurred during thrift call, backing off for %v before retry %v", + adjusted, + curStep) time.Sleep(adjusted) duration = time.Duration(float64(duration) * backoff.Factor) @@ -148,110 +158,137 @@ func (c *Client) thriftCallWithRetries(returnOnTimeout bool, thriftCall auroraTh // Placing this in an anonymous function in order to create a new, short-lived stack allowing unlock // to be run in case of a panic inside of thriftCall. func() { - c.lock.Lock() - defer c.lock.Unlock() + r.lock.Lock() + defer r.lock.Unlock() resp, clientErr = thriftCall() - c.logger.TracePrintf("Aurora Thrift Call ended resp: %v clientErr: %v\n", resp, clientErr) + r.logger.tracePrintf("Aurora Thrift Call ended resp: %v clientErr: %v", resp, clientErr) }() - // Check if our thrift call is returning an error. This is a retryable event as we don't know - // if it was caused by network issues. + // Check if our thrift call is returning an error. if clientErr != nil { - // Print out the error to the user - c.logger.Printf("Client Error: %v\n", clientErr) + r.logger.Printf("Client Error: %v", clientErr) - // Determine if error is a temporary URL error by going up the stack - e, ok := clientErr.(thrift.TTransportException) - if ok { - c.logger.DebugPrint("Encountered a transport exception") + temporary, timedout := isConnectionError(clientErr) + if !temporary && r.RealisConfig().failOnPermanentErrors { + return nil, errors.Wrap(clientErr, "permanent connection error") + } - // TODO(rdelvalle): Figure out a better way to obtain the error code as this is a very brittle solution - // 401 Unauthorized means the wrong username and password were provided - if strings.Contains(e.Error(), strconv.Itoa(http.StatusUnauthorized)) { - return nil, errors.Wrap(clientErr, "wrong username or password provided") - } - - e, ok := e.Err().(*url.Error) - if ok { - // EOF error occurs when the server closes the read buffer of the client. This is common - // when the server is overloaded and should be retried. All other errors that are permanent - // will not be retried. - if e.Err != io.EOF && !e.Temporary() && c.RealisConfig().failOnPermanentErrors { - return nil, errors.Wrap(clientErr, "permanent connection error") - } - // Corner case where thrift payload was received by Aurora but connection timedout before Aurora was - // able to reply. In this case we will return whatever response was received and a TimedOut behaving - // error. Users can take special action on a timeout by using IsTimedout and reacting accordingly. - if e.Timeout() { - timeouts++ - c.logger.DebugPrintf( - "Client closed connection (timedout) %d times before server responded,"+ - " consider increasing connection timeout", - timeouts) - if returnOnTimeout { - return resp, - newTimedoutError(errors.New("client connection closed before server answer")) - } - } - } + // There exists a corner case where thrift payload was received by Aurora but + // connection timed out before Aurora was able to reply. + // Users can take special action on a timeout by using IsTimedout and reacting accordingly + // if they have configured the client to return on a timeout. + if timedout && returnOnTimeout { + return resp, newTimedoutError(errors.New("client connection closed before server answer")) } // In the future, reestablish connection should be able to check if it is actually possible // to make a thrift call to Aurora. For now, a reconnect should always lead to a retry. // Ignoring error due to the fact that an error should be retried regardless - _ = c.ReestablishConn() - - } else { - - // If there was no client error, but the response is nil, something went wrong. - // Ideally, we'll never encounter this but we're placing a safeguard here. - if resp == nil { - return nil, errors.New("response from aurora is nil") + reestablishErr := r.ReestablishConn() + if reestablishErr != nil { + r.logger.debugPrintf("error re-establishing connection ", reestablishErr) } - // Check Response Code from thrift and make a decision to continue retrying or not. - switch responseCode := resp.GetResponseCode(); responseCode { + // If users did not opt for a return on timeout in order to react to a timedout error, + // attempt to verify that the call made it to the scheduler after the connection was re-established. + if timedout { + timeouts++ + r.logger.debugPrintf( + "Client closed connection %d times before server responded, "+ + "consider increasing connection timeout", + timeouts) - // If the thrift call succeeded, stop retrying - case aurora.ResponseCode_OK: - return resp, nil - - // If the response code is transient, continue retrying - case aurora.ResponseCode_ERROR_TRANSIENT: - c.logger.Println("Aurora replied with Transient error code, retrying") - continue - - // Failure scenarios, these indicate a bad payload or a bad clientConfig. Stop retrying. - case aurora.ResponseCode_INVALID_REQUEST, - aurora.ResponseCode_ERROR, - aurora.ResponseCode_AUTH_FAILED, - aurora.ResponseCode_JOB_UPDATING_ERROR: - c.logger.Printf("Terminal Response Code %v from Aurora, won't retry\n", resp.GetResponseCode().String()) - return resp, errors.New(response.CombineMessage(resp)) - - // The only case that should fall down to here is a WARNING response code. - // It is currently not used as a response in the scheduler so it is unknown how to handle it. - default: - c.logger.DebugPrintf("unhandled response code %v received from Aurora\n", responseCode) - return nil, errors.Errorf("unhandled response code from Aurora %v", responseCode.String()) + // Allow caller to provide a function which checks if the original call was successful before + // it timed out. + if verifyOnTimeout != nil { + if verifyResp, ok := verifyOnTimeout(); ok { + r.logger.Print("verified that the call went through successfully after a client timeout") + // Response here might be different than the original as it is no longer constructed + // by the scheduler but mimicked. + // This is OK since the scheduler is very unlikely to change responses at this point in its + // development cycle but we must be careful to not return an incorrectly constructed response. + return verifyResp, nil + } + } } + + // Retry the thrift payload + continue + } + + // If there was no client error, but the response is nil, something went wrong. + // Ideally, we'll never encounter this but we're placing a safeguard here. + if resp == nil { + return nil, errors.New("response from aurora is nil") + } + + // Check Response Code from thrift and make a decision to continue retrying or not. + switch responseCode := resp.GetResponseCode(); responseCode { + + // If the thrift call succeeded, stop retrying + case aurora.ResponseCode_OK: + return resp, nil + + // If the response code is transient, continue retrying + case aurora.ResponseCode_ERROR_TRANSIENT: + r.logger.Println("Aurora replied with Transient error code, retrying") + continue + + // Failure scenarios, these indicate a bad payload or a bad config. Stop retrying. + case aurora.ResponseCode_INVALID_REQUEST, + aurora.ResponseCode_ERROR, + aurora.ResponseCode_AUTH_FAILED, + aurora.ResponseCode_JOB_UPDATING_ERROR: + r.logger.Printf("Terminal Response Code %v from Aurora, won't retry\n", resp.GetResponseCode().String()) + return resp, errors.New(response.CombineMessage(resp)) + + // The only case that should fall down to here is a WARNING response code. + // It is currently not used as a response in the scheduler so it is unknown how to handle it. + default: + r.logger.debugPrintf("unhandled response code %v received from Aurora\n", responseCode) + return nil, errors.Errorf("unhandled response code from Aurora %v", responseCode.String()) } } - c.logger.DebugPrintf("it took %v retries to complete this operation\n", curStep) - if curStep > 1 { - c.config.logger.Printf("retried this thrift call %d time(s)", curStep) + r.config.logger.Printf("this thrift call was retried %d time(s)", curStep) } // Provide more information to the user wherever possible. if clientErr != nil { return nil, newRetryError(errors.Wrap(clientErr, "ran out of retries, including latest error"), curStep) - } else { - return nil, newRetryError(errors.New("ran out of retries"), curStep) } + + return nil, newRetryError(errors.New("ran out of retries"), curStep) +} + +// isConnectionError processes the error received by the client. +// The return values indicate weather this was determined to be a temporary error +// and weather it was determined to be a timeout error +func isConnectionError(err error) (bool, bool) { + + // Determine if error is a temporary URL error by going up the stack + transportException, ok := err.(thrift.TTransportException) + if !ok { + return false, false + } + + urlError, ok := transportException.Err().(*url.Error) + if !ok { + return false, false + } + + // EOF error occurs when the server closes the read buffer of the client. This is common + // when the server is overloaded and we consider it temporary. + // All other which are not temporary as per the member function Temporary(), + // are considered not temporary (permanent). + if urlError.Err != io.EOF && !urlError.Temporary() { + return false, false + } + + return true, urlError.Timeout() } diff --git a/runTests.sh b/runTests.sh new file mode 100755 index 0000000..e213972 --- /dev/null +++ b/runTests.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +docker-compose up -d + +# If running docker-compose up gives any error, don't do anything. +if [ $? -ne 0 ]; then + exit +fi + +# Since we run our docker compose setup in bridge mode to be able to run on MacOS, we have to launch a Docker container within the bridge network in order to avoid any routing issues. +docker run --rm -t -v $(pwd):/go/src/github.com/paypal/gorealis --network gorealis_aurora_cluster golang:1.10-stretch go test -v github.com/paypal/gorealis $@ + +docker-compose down diff --git a/runTestsMac.sh b/runTestsMac.sh index d60d85f..6a09931 100644 --- a/runTestsMac.sh +++ b/runTestsMac.sh @@ -1,4 +1,4 @@ #!/bin/bash # Since we run our docker compose setup in bridge mode to be able to run on MacOS, we have to launch a Docker container within the bridge network in order to avoid any routing issues. -docker run --rm -t -v $(pwd):/go/src/github.com/paypal/gorealis --network gorealis_aurora_cluster golang:1.10-stretch go test -v github.com/paypal/gorealis $@ +docker run --rm -t -w /gorealis -v $GOPATH/pkg:/go/pkg -v $(pwd):/gorealis --network gorealis_aurora_cluster golang:1.16-buster go test -v github.com/paypal/gorealis $@ diff --git a/task.go b/task.go deleted file mode 100644 index d4c2b7b..0000000 --- a/task.go +++ /dev/null @@ -1,449 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package realis - -import ( - "encoding/json" - "strconv" - - "github.com/apache/thrift/lib/go/thrift" - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" -) - -type ResourceType int - -const ( - CPU ResourceType = iota - RAM - DISK - GPU -) - -const ( - dedicated = "dedicated" - portPrefix = "org.apache.aurora.port." -) - -type AuroraTask struct { - task *aurora.TaskConfig - resources map[ResourceType]*aurora.Resource - portCount int - thermos *ThermosExecutor -} - -func NewTask() *AuroraTask { - numCpus := &aurora.Resource{} - ramMb := &aurora.Resource{} - diskMb := &aurora.Resource{} - - numCpus.NumCpus = new(float64) - ramMb.RamMb = new(int64) - diskMb.DiskMb = new(int64) - - resources := map[ResourceType]*aurora.Resource{CPU: numCpus, RAM: ramMb, DISK: diskMb} - - return &AuroraTask{task: &aurora.TaskConfig{ - Job: &aurora.JobKey{}, - MesosFetcherUris: make([]*aurora.MesosFetcherURI, 0), - Metadata: make([]*aurora.Metadata, 0), - Constraints: make([]*aurora.Constraint, 0), - // Container is a Union so one container field must be set. Set Mesos by default. - Container: NewMesosContainer().Build(), - Resources: []*aurora.Resource{numCpus, ramMb, diskMb}, - }, - resources: resources, - portCount: 0} -} - -// Helper method to convert aurora.TaskConfig to gorealis AuroraTask type -func TaskFromThrift(config *aurora.TaskConfig) *AuroraTask { - - newTask := NewTask() - - // Pass values using receivers as much as possible - newTask. - Environment(config.Job.Environment). - Role(config.Job.Role). - Name(config.Job.Name). - MaxFailure(config.MaxTaskFailures). - IsService(config.IsService) - - if config.Tier != nil { - newTask.Tier(*config.Tier) - } - - if config.ExecutorConfig != nil { - newTask. - ExecutorName(config.ExecutorConfig.Name). - ExecutorData(config.ExecutorConfig.Data) - } - - if config.PartitionPolicy != nil { - newTask.PartitionPolicy( - aurora.PartitionPolicy{ - Reschedule: config.PartitionPolicy.Reschedule, - DelaySecs: thrift.Int64Ptr(*config.PartitionPolicy.DelaySecs), - }) - } - - // Make a deep copy of the task's container - if config.Container != nil { - if config.Container.Mesos != nil { - mesosContainer := NewMesosContainer() - - if config.Container.Mesos.Image != nil { - if config.Container.Mesos.Image.Appc != nil { - mesosContainer.AppcImage(config.Container.Mesos.Image.Appc.Name, config.Container.Mesos.Image.Appc.ImageId) - } else if config.Container.Mesos.Image.Docker != nil { - mesosContainer.DockerImage(config.Container.Mesos.Image.Docker.Name, config.Container.Mesos.Image.Docker.Tag) - } - } - - for _, vol := range config.Container.Mesos.Volumes { - mesosContainer.AddVolume(vol.ContainerPath, vol.HostPath, vol.Mode) - } - - newTask.Container(mesosContainer) - } else if config.Container.Docker != nil { - dockerContainer := NewDockerContainer() - dockerContainer.Image(config.Container.Docker.Image) - - for _, param := range config.Container.Docker.Parameters { - dockerContainer.AddParameter(param.Name, param.Value) - } - - newTask.Container(dockerContainer) - } - } - - // Copy all ports - for _, resource := range config.Resources { - // Copy only ports. Set CPU, RAM, DISK, and GPU - if resource != nil { - if resource.NamedPort != nil { - newTask.task.Resources = append( - newTask.task.Resources, - &aurora.Resource{NamedPort: thrift.StringPtr(*resource.NamedPort)}, - ) - newTask.portCount++ - } - - if resource.RamMb != nil { - newTask.RAM(*resource.RamMb) - } - - if resource.NumCpus != nil { - newTask.CPU(*resource.NumCpus) - } - - if resource.DiskMb != nil { - newTask.Disk(*resource.DiskMb) - } - - if resource.NumGpus != nil { - newTask.GPU(*resource.NumGpus) - } - } - } - - // Copy constraints - for _, constraint := range config.Constraints { - if constraint != nil && constraint.Constraint != nil { - - newConstraint := aurora.Constraint{Name: constraint.Name} - - taskConstraint := constraint.Constraint - if taskConstraint.Limit != nil { - newConstraint.Constraint = &aurora.TaskConstraint{ - Limit: &aurora.LimitConstraint{Limit: taskConstraint.Limit.Limit}, - } - newTask.task.Constraints = append(newTask.task.Constraints, &newConstraint) - - } else if taskConstraint.Value != nil { - - values := make([]string, 0) - for _, val := range taskConstraint.Value.Values { - values = append(values, val) - } - - newConstraint.Constraint = &aurora.TaskConstraint{ - Value: &aurora.ValueConstraint{Negated: taskConstraint.Value.Negated, Values: values}} - - newTask.task.Constraints = append(newTask.task.Constraints, &newConstraint) - } - } - } - - // Copy labels - for _, label := range config.Metadata { - newTask.task.Metadata = append(newTask.task.Metadata, &aurora.Metadata{Key: label.Key, Value: label.Value}) - } - - // Copy Mesos fetcher URIs - for _, uri := range config.MesosFetcherUris { - newTask.task.MesosFetcherUris = append( - newTask.task.MesosFetcherUris, - &aurora.MesosFetcherURI{ - Value: uri.Value, - Extract: thrift.BoolPtr(*uri.Extract), - Cache: thrift.BoolPtr(*uri.Cache), - }) - } - - return newTask -} - -// Set AuroraTask Key environment. -func (t *AuroraTask) Environment(env string) *AuroraTask { - t.task.Job.Environment = env - return t -} - -// Set AuroraTask Key Role. -func (t *AuroraTask) Role(role string) *AuroraTask { - t.task.Job.Role = role - return t -} - -// Set AuroraTask Key Name. -func (t *AuroraTask) Name(name string) *AuroraTask { - t.task.Job.Name = name - return t -} - -// Set name of the executor that will the task will be configured to. -func (t *AuroraTask) ExecutorName(name string) *AuroraTask { - if t.task.ExecutorConfig == nil { - t.task.ExecutorConfig = aurora.NewExecutorConfig() - } - - t.task.ExecutorConfig.Name = name - return t -} - -// Will be included as part of entire task inside the scheduler that will be serialized. -func (t *AuroraTask) ExecutorData(data string) *AuroraTask { - if t.task.ExecutorConfig == nil { - t.task.ExecutorConfig = aurora.NewExecutorConfig() - } - - t.task.ExecutorConfig.Data = data - return t -} - -func (t *AuroraTask) CPU(cpus float64) *AuroraTask { - *t.resources[CPU].NumCpus = cpus - return t -} - -func (t *AuroraTask) RAM(ram int64) *AuroraTask { - *t.resources[RAM].RamMb = ram - return t -} - -func (t *AuroraTask) Disk(disk int64) *AuroraTask { - *t.resources[DISK].DiskMb = disk - return t -} - -func (t *AuroraTask) GPU(gpu int64) *AuroraTask { - // GPU resource must be set explicitly since the scheduler by default - // rejects jobs with GPU resources attached to it. - if _, ok := t.resources[GPU]; !ok { - t.resources[GPU] = &aurora.Resource{} - t.task.Resources = append(t.task.Resources, t.resources[GPU]) - } - - t.resources[GPU].NumGpus = &gpu - return t -} - -func (t *AuroraTask) Tier(tier string) *AuroraTask { - t.task.Tier = &tier - return t -} - -// How many failures to tolerate before giving up. -func (t *AuroraTask) MaxFailure(maxFail int32) *AuroraTask { - t.task.MaxTaskFailures = maxFail - return t -} - -// Restart the job's tasks if they fail -func (t *AuroraTask) IsService(isService bool) *AuroraTask { - t.task.IsService = isService - return t -} - -// Add a list of URIs with the same extract and cache configuration. Scheduler must have -// --enable_mesos_fetcher flag enabled. Currently there is no duplicate detection. -func (t *AuroraTask) AddURIs(extract bool, cache bool, values ...string) *AuroraTask { - for _, value := range values { - t.task.MesosFetcherUris = append( - t.task.MesosFetcherUris, - &aurora.MesosFetcherURI{Value: value, Extract: &extract, Cache: &cache}) - } - return t -} - -// Adds a Mesos label to the job. Note that Aurora will add the -// prefix "org.apache.aurora.metadata." to the beginning of each key. -func (t *AuroraTask) AddLabel(key string, value string) *AuroraTask { - t.task.Metadata = append(t.task.Metadata, &aurora.Metadata{Key: key, Value: value}) - return t -} - -// Add a named port to the job configuration These are random ports as it's -// not currently possible to request specific ports using Aurora. -func (t *AuroraTask) AddNamedPorts(names ...string) *AuroraTask { - t.portCount += len(names) - for _, name := range names { - t.task.Resources = append(t.task.Resources, &aurora.Resource{NamedPort: &name}) - } - - return t -} - -// Adds a request for a number of ports to the job configuration. The names chosen for these ports -// will be org.apache.aurora.port.X, where X is the current port count for the job configuration -// starting at 0. These are random ports as it's not currently possible to request -// specific ports using Aurora. -func (t *AuroraTask) AddPorts(num int) *AuroraTask { - start := t.portCount - t.portCount += num - for i := start; i < t.portCount; i++ { - portName := portPrefix + strconv.Itoa(i) - t.task.Resources = append(t.task.Resources, &aurora.Resource{NamedPort: &portName}) - } - - return t -} - -// From Aurora Docs: -// Add a Value constraint -// name - Mesos slave attribute that the constraint is matched against. -// If negated = true , treat this as a 'not' - to avoid specific values. -// Values - list of values we look for in attribute name -func (t *AuroraTask) AddValueConstraint(name string, negated bool, values ...string) *AuroraTask { - t.task.Constraints = append(t.task.Constraints, - &aurora.Constraint{ - Name: name, - Constraint: &aurora.TaskConstraint{ - Value: &aurora.ValueConstraint{ - Negated: negated, - Values: values, - }, - Limit: nil, - }, - }) - - return t -} - -// From Aurora Docs: -// A constraint that specifies the maximum number of active tasks on a host with -// a matching attribute that may be scheduled simultaneously. -func (t *AuroraTask) AddLimitConstraint(name string, limit int32) *AuroraTask { - t.task.Constraints = append(t.task.Constraints, - &aurora.Constraint{ - Name: name, - Constraint: &aurora.TaskConstraint{ - Value: nil, - Limit: &aurora.LimitConstraint{Limit: limit}, - }, - }) - - return t -} - -// From Aurora Docs: -// dedicated attribute. Aurora treats this specially, and only allows matching jobs -// to run on these machines, and will only schedule matching jobs on these machines. -// When a job is created, the scheduler requires that the $role component matches -// the role field in the job configuration, and will reject the job creation otherwise. -// A wildcard (*) may be used for the role portion of the dedicated attribute, which -// will allow any owner to elect for a job to run on the host(s) -func (t *AuroraTask) AddDedicatedConstraint(role, name string) *AuroraTask { - t.AddValueConstraint(dedicated, false, role+"/"+name) - return t -} - -// Set a container to run for the job configuration to run. -func (t *AuroraTask) Container(container Container) *AuroraTask { - t.task.Container = container.Build() - return t -} - -func (t *AuroraTask) TaskConfig() *aurora.TaskConfig { - return t.task -} - -func (t *AuroraTask) JobKey() aurora.JobKey { - return *t.task.Job -} - -func (t *AuroraTask) Clone() *AuroraTask { - newTask := TaskFromThrift(t.task) - - if t.thermos != nil { - newTask.ThermosExecutor(*t.thermos.Clone()) - } - - return newTask -} - -func (t *AuroraTask) ThermosExecutor(thermos ThermosExecutor) *AuroraTask { - t.thermos = &thermos - - return t -} - -func (t *AuroraTask) BuildThermosPayload() error { - if t.thermos != nil { - - // Set the correct resources - if t.resources[CPU].NumCpus != nil { - t.thermos.cpu(*t.resources[CPU].NumCpus) - } - - if t.resources[RAM].RamMb != nil { - t.thermos.ram(*t.resources[RAM].RamMb) - } - - if t.resources[DISK].DiskMb != nil { - t.thermos.disk(*t.resources[DISK].DiskMb) - } - - if t.resources[GPU] != nil && t.resources[GPU].NumGpus != nil { - t.thermos.gpu(*t.resources[GPU].NumGpus) - } - - payload, err := json.Marshal(t.thermos) - if err != nil { - return err - } - - t.ExecutorName(aurora.AURORA_EXECUTOR_NAME) - t.ExecutorData(string(payload)) - } - return nil -} - -// Set a partition policy for the job configuration to implement. -func (t *AuroraTask) PartitionPolicy(policy aurora.PartitionPolicy) *AuroraTask { - t.task.PartitionPolicy = &policy - - return t -} diff --git a/task_test.go b/task_test.go deleted file mode 100644 index 4f5d67b..0000000 --- a/task_test.go +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package realis_test - -import ( - "testing" - - realis "github.com/paypal/gorealis/v2" - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" - "github.com/stretchr/testify/assert" -) - -func TestAuroraTask_Clone(t *testing.T) { - - task0 := realis.NewTask(). - Environment("development"). - Role("ubuntu"). - Name("this_is_a_test"). - ExecutorName(aurora.AURORA_EXECUTOR_NAME). - ExecutorData("{fake:payload}"). - CPU(10). - RAM(643). - Disk(1000). - IsService(true). - AddPorts(10). - Tier("preferred"). - MaxFailure(23). - AddURIs(true, true, "testURI"). - AddLabel("Test", "Value"). - AddNamedPorts("test"). - AddValueConstraint("test", false, "testing"). - AddLimitConstraint("test_limit", 1). - AddDedicatedConstraint("ubuntu", "name"). - Container(realis.NewDockerContainer().AddParameter("hello", "world").Image("testImg")) - - task1 := task0.Clone() - - assert.EqualValues(t, task0, task1, "Clone does not return the correct deep copy of AuroraTask") - - task0.Container(realis.NewMesosContainer(). - AppcImage("test", "testing"). - AddVolume("test", "test", aurora.Mode_RW)) - task2 := task0.Clone() - assert.EqualValues(t, task0, task2, "Clone does not return the correct deep copy of AuroraTask") -} diff --git a/thermos.go b/thermos.go deleted file mode 100644 index e579f85..0000000 --- a/thermos.go +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package realis - -import "encoding/json" - -type ThermosExecutor struct { - Task ThermosTask `json:"task""` - order *ThermosConstraint `json:"-"` -} - -type ThermosTask struct { - Processes map[string]*ThermosProcess `json:"processes"` - Constraints []*ThermosConstraint `json:"constraints"` - Resources thermosResources `json:"resources"` -} - -type ThermosConstraint struct { - Order []string `json:"order,omitempty"` -} - -// This struct should always be controlled by the Aurora job struct. -// Therefore it is private. -type thermosResources struct { - CPU *float64 `json:"cpu,omitempty"` - Disk *int64 `json:"disk,omitempty"` - RAM *int64 `json:"ram,omitempty"` - GPU *int64 `json:"gpu,omitempty"` -} - -type ThermosProcess struct { - Name string `json:"name"` - Cmdline string `json:"cmdline"` - Daemon bool `json:"daemon"` - Ephemeral bool `json:"ephemeral"` - MaxFailures int `json:"max_failures"` - MinDuration int `json:"min_duration"` - Final bool `json:"final"` -} - -func NewThermosProcess(name, command string) ThermosProcess { - return ThermosProcess{ - Name: name, - Cmdline: command, - MaxFailures: 1, - Daemon: false, - Ephemeral: false, - MinDuration: 5, - Final: false} -} - -// Processes must have unique names. Adding a process whose name already exists will -// result in overwriting the previous version of the process. -func (t *ThermosExecutor) AddProcess(process ThermosProcess) *ThermosExecutor { - if len(t.Task.Processes) == 0 { - t.Task.Processes = make(map[string]*ThermosProcess, 0) - } - - t.Task.Processes[process.Name] = &process - - // Add Process to order - t.addToOrder(process.Name) - return t -} - -// Only constraint that should be added for now is the order of execution, therefore this -// receiver is private. -func (t *ThermosExecutor) addConstraint(constraint *ThermosConstraint) *ThermosExecutor { - if len(t.Task.Constraints) == 0 { - t.Task.Constraints = make([]*ThermosConstraint, 0) - } - - t.Task.Constraints = append(t.Task.Constraints, constraint) - return t -} - -// Order in which the Processes should be executed. Index 0 will be executed first, index N will be executed last. -func (t *ThermosExecutor) ProcessOrder(order ...string) *ThermosExecutor { - if t.order == nil { - t.order = &ThermosConstraint{} - t.addConstraint(t.order) - } - - t.order.Order = order - return t -} - -// Add Process to execution order. By default this is a FIFO setup. Custom order can be given by overriding -// with ProcessOrder -func (t *ThermosExecutor) addToOrder(name string) { - if t.order == nil { - t.order = &ThermosConstraint{Order: make([]string, 0)} - t.addConstraint(t.order) - } - - t.order.Order = append(t.order.Order, name) -} - -// Ram is determined by the job object. -func (t *ThermosExecutor) ram(ram int64) { - // Convert from bytes to MiB - ram *= 1024 ^ 2 - t.Task.Resources.RAM = &ram -} - -// Disk is determined by the job object. -func (t *ThermosExecutor) disk(disk int64) { - // Convert from bytes to MiB - disk *= 1024 ^ 2 - t.Task.Resources.Disk = &disk -} - -// CPU is determined by the job object. -func (t *ThermosExecutor) cpu(cpu float64) { - t.Task.Resources.CPU = &cpu -} - -// GPU is determined by the job object. -func (t *ThermosExecutor) gpu(gpu int64) { - t.Task.Resources.GPU = &gpu -} - -// Deep copy of Thermos executor -func (t *ThermosExecutor) Clone() *ThermosExecutor { - tNew := ThermosExecutor{} - - if t.order != nil { - tNew.order = &ThermosConstraint{Order: t.order.Order} - - tNew.addConstraint(tNew.order) - } - - tNew.Task.Processes = make(map[string]*ThermosProcess) - - for name, process := range t.Task.Processes { - newProcess := *process - tNew.Task.Processes[name] = &newProcess - } - - tNew.Task.Resources = t.Task.Resources - - return &tNew -} - -type thermosTaskJSON struct { - Processes []*ThermosProcess `json:"processes"` - Constraints []*ThermosConstraint `json:"constraints"` - Resources thermosResources `json:"resources"` -} - -// Custom Marshaling for Thermos Task to match what Thermos expects -func (t *ThermosTask) MarshalJSON() ([]byte, error) { - - // Convert map to array to match what Thermos expects - processes := make([]*ThermosProcess, 0) - for _, process := range t.Processes { - processes = append(processes, process) - } - - return json.Marshal(&thermosTaskJSON{ - Processes: processes, - Constraints: t.Constraints, - Resources: t.Resources, - }) -} - -// Custom Unmarshaling to match what Thermos would contain -func (t *ThermosTask) UnmarshalJSON(data []byte) error { - - // Thermos format - aux := &thermosTaskJSON{} - - if err := json.Unmarshal(data, &aux); err != nil { - return err - } - - processes := make(map[string]*ThermosProcess) - for _, process := range aux.Processes { - processes[process.Name] = process - } - - return nil -} diff --git a/thermos_test.go b/thermos_test.go deleted file mode 100644 index 6dce78f..0000000 --- a/thermos_test.go +++ /dev/null @@ -1,71 +0,0 @@ -package realis - -import ( - "encoding/json" - "testing" - - "github.com/apache/thrift/lib/go/thrift" - "github.com/stretchr/testify/assert" -) - -func TestThermosTask(t *testing.T) { - - // Test that we can successfully deserialize a minimum subset of an Aurora generated thermos payload - thermosJSON := []byte( - `{ - "task": { - "processes": [ - { - "daemon": false, - "name": "hello", - "ephemeral": false, - "max_failures": 1, - "min_duration": 5, - "cmdline": "\n while true; do\n echo hello world from gorealis\n sleep 10\n done\n ", - "final": false - } - ], - "resources": { - "gpu": 0, - "disk": 134217728, - "ram": 134217728, - "cpu": 1.1 - }, - "constraints": [ - { - "order": [ - "hello" - ] - } - ] - } -}`) - thermos := ThermosExecutor{} - - err := json.Unmarshal(thermosJSON, &thermos) - - assert.NoError(t, err) - - process := &ThermosProcess{ - Daemon: false, - Name: "hello", - Ephemeral: false, - MaxFailures: 1, - MinDuration: 5, - Cmdline: "\n while true; do\n echo hello world from gorealis\n sleep 10\n done\n ", - Final: false, - } - - constraint := &ThermosConstraint{Order: []string{process.Name}} - - thermosExpected := ThermosExecutor{ - Task: ThermosTask{ - Processes: map[string]*ThermosProcess{process.Name: process}, - Constraints: []*ThermosConstraint{constraint}, - Resources: thermosResources{CPU: thrift.Float64Ptr(1.1), - Disk: thrift.Int64Ptr(134217728), - RAM: thrift.Int64Ptr(134217728), - GPU: thrift.Int64Ptr(0)}}} - - assert.ObjectsAreEqualValues(thermosExpected, thermos) -} diff --git a/updatejob.go b/updatejob.go new file mode 100644 index 0000000..09e69c9 --- /dev/null +++ b/updatejob.go @@ -0,0 +1,188 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package realis + +import ( + "github.com/paypal/gorealis/gen-go/apache/aurora" +) + +// UpdateJob is a structure to collect all information required to create job update. +type UpdateJob struct { + Job // SetInstanceCount for job is hidden, access via full qualifier + req *aurora.JobUpdateRequest +} + +// NewDefaultUpdateJob creates an UpdateJob object with opinionated default settings. +func NewDefaultUpdateJob(config *aurora.TaskConfig) *UpdateJob { + + req := aurora.NewJobUpdateRequest() + req.TaskConfig = config + req.Settings = NewUpdateSettings() + + job, ok := NewJob().(*AuroraJob) + if !ok { + // This should never happen but it is here as a safeguard + return nil + } + + job.jobConfig.TaskConfig = config + + // Rebuild resource map from TaskConfig + for _, ptr := range config.Resources { + if ptr.NumCpus != nil { + job.resources[CPU].NumCpus = ptr.NumCpus + continue // Guard against Union violations that Go won't enforce + } + + if ptr.RamMb != nil { + job.resources[RAM].RamMb = ptr.RamMb + continue + } + + if ptr.DiskMb != nil { + job.resources[DISK].DiskMb = ptr.DiskMb + continue + } + + if ptr.NumGpus != nil { + job.resources[GPU] = &aurora.Resource{NumGpus: ptr.NumGpus} + continue + } + } + + // Mirrors defaults set by Pystachio + req.Settings.UpdateGroupSize = 1 + req.Settings.WaitForBatchCompletion = false + req.Settings.MinWaitInInstanceRunningMs = 45000 + req.Settings.MaxPerInstanceFailures = 0 + req.Settings.MaxFailedInstances = 0 + req.Settings.RollbackOnFailure = true + + //TODO(rdelvalle): Deep copy job struct to avoid unexpected behavior + return &UpdateJob{Job: job, req: req} +} + +// NewUpdateJob creates an UpdateJob object wihtout default settings. +func NewUpdateJob(config *aurora.TaskConfig, settings *aurora.JobUpdateSettings) *UpdateJob { + + req := aurora.NewJobUpdateRequest() + req.TaskConfig = config + req.Settings = settings + + job, ok := NewJob().(*AuroraJob) + if !ok { + // This should never happen but it is here as a safeguard + return nil + } + job.jobConfig.TaskConfig = config + + // Rebuild resource map from TaskConfig + for _, ptr := range config.Resources { + if ptr.NumCpus != nil { + job.resources[CPU].NumCpus = ptr.NumCpus + continue // Guard against Union violations that Go won't enforce + } + + if ptr.RamMb != nil { + job.resources[RAM].RamMb = ptr.RamMb + continue + } + + if ptr.DiskMb != nil { + job.resources[DISK].DiskMb = ptr.DiskMb + continue + } + + if ptr.NumGpus != nil { + job.resources[GPU] = &aurora.Resource{} + job.resources[GPU].NumGpus = ptr.NumGpus + continue // Guard against Union violations that Go won't enforce + } + } + + //TODO(rdelvalle): Deep copy job struct to avoid unexpected behavior + return &UpdateJob{Job: job, req: req} +} + +// InstanceCount sets instance count the job will have after the update. +func (u *UpdateJob) InstanceCount(inst int32) *UpdateJob { + u.req.InstanceCount = inst + return u +} + +// BatchSize sets the max number of instances being updated at any given moment. +func (u *UpdateJob) BatchSize(size int32) *UpdateJob { + u.req.Settings.UpdateGroupSize = size + return u +} + +// WatchTime sets the minimum number of seconds a shard must remain in RUNNING state before considered a success. +func (u *UpdateJob) WatchTime(ms int32) *UpdateJob { + u.req.Settings.MinWaitInInstanceRunningMs = ms + return u +} + +// WaitForBatchCompletion configures the job update to wait for all instances in a group to be done before moving on. +func (u *UpdateJob) WaitForBatchCompletion(batchWait bool) *UpdateJob { + u.req.Settings.WaitForBatchCompletion = batchWait + return u +} + +// MaxPerInstanceFailures sets the max number of instance failures to tolerate before marking instance as FAILED. +func (u *UpdateJob) MaxPerInstanceFailures(inst int32) *UpdateJob { + u.req.Settings.MaxPerInstanceFailures = inst + return u +} + +// MaxFailedInstances sets the max number of FAILED instances to tolerate before terminating the update. +func (u *UpdateJob) MaxFailedInstances(inst int32) *UpdateJob { + u.req.Settings.MaxFailedInstances = inst + return u +} + +// RollbackOnFail configure the job to rollback automatically after a job update fails. +func (u *UpdateJob) RollbackOnFail(rollback bool) *UpdateJob { + u.req.Settings.RollbackOnFailure = rollback + return u +} + +// NewUpdateSettings return an opinionated set of job update settings. +func (u *UpdateJob) BatchUpdateStrategy(strategy aurora.BatchJobUpdateStrategy) *UpdateJob { + u.req.Settings.UpdateStrategy = &aurora.JobUpdateStrategy{BatchStrategy: &strategy} + return u +} + +func (u *UpdateJob) QueueUpdateStrategy(strategy aurora.QueueJobUpdateStrategy) *UpdateJob { + u.req.Settings.UpdateStrategy = &aurora.JobUpdateStrategy{QueueStrategy: &strategy} + return u +} + +func (u *UpdateJob) VariableBatchStrategy(strategy aurora.VariableBatchJobUpdateStrategy) *UpdateJob { + u.req.Settings.UpdateStrategy = &aurora.JobUpdateStrategy{VarBatchStrategy: &strategy} + return u +} + +func NewUpdateSettings() *aurora.JobUpdateSettings { + us := new(aurora.JobUpdateSettings) + // Mirrors defaults set by Pystachio + us.UpdateGroupSize = 1 + us.WaitForBatchCompletion = false + us.MinWaitInInstanceRunningMs = 45000 + us.MaxPerInstanceFailures = 0 + us.MaxFailedInstances = 0 + us.RollbackOnFailure = true + + return us +} diff --git a/util.go b/util.go index c1bba48..4307d1c 100644 --- a/util.go +++ b/util.go @@ -1,18 +1,47 @@ package realis import ( + "crypto/x509" + "io/ioutil" "net/url" + "os" + "path/filepath" "strings" - "github.com/paypal/gorealis/v2/gen-go/apache/aurora" + "github.com/paypal/gorealis/gen-go/apache/aurora" "github.com/pkg/errors" ) +const apiPath = "/api" + +// ActiveStates - States a task may be in when active. var ActiveStates = make(map[aurora.ScheduleStatus]bool) + +// SlaveAssignedStates - States a task may be in when it has already been assigned to a Mesos agent. var SlaveAssignedStates = make(map[aurora.ScheduleStatus]bool) + +// LiveStates - States a task may be in when it is live (e.g. able to take traffic) var LiveStates = make(map[aurora.ScheduleStatus]bool) + +// TerminalStates - Set of states a task may not transition away from. var TerminalStates = make(map[aurora.ScheduleStatus]bool) + +// ActiveJobUpdateStates - States a Job Update may be in where it is considered active. var ActiveJobUpdateStates = make(map[aurora.JobUpdateStatus]bool) + +// TerminalUpdateStates returns a slice containing all the terminal states an update may be in. +// This is a function in order to avoid having a slice that can be accidentally mutated. +func TerminalUpdateStates() []aurora.JobUpdateStatus { + return []aurora.JobUpdateStatus{ + aurora.JobUpdateStatus_ROLLED_FORWARD, + aurora.JobUpdateStatus_ROLLED_BACK, + aurora.JobUpdateStatus_ABORTED, + aurora.JobUpdateStatus_ERROR, + aurora.JobUpdateStatus_FAILED, + } +} + +// AwaitingPulseJobUpdateStates - States a job update may be in where it is waiting for a pulse. var AwaitingPulseJobUpdateStates = make(map[aurora.JobUpdateStatus]bool) func init() { @@ -40,14 +69,57 @@ func init() { } } -func validateAuroraAddress(address string) (string, error) { - - // If no protocol defined, assume http - if !strings.Contains(address, "://") { - address = "http://" + address +// createCertPool will attempt to load certificates into a certificate pool from a given directory. +// Only files with an extension contained in the extension map are considered. +// This function ignores any files that cannot be read successfully or cannot be added to the certPool +// successfully. +func createCertPool(path string, extensions map[string]struct{}) (*x509.CertPool, error) { + _, err := os.Stat(path) + if err != nil { + return nil, errors.Wrap(err, "unable to load certificates") } - u, err := url.Parse(address) + caFiles, err := ioutil.ReadDir(path) + if err != nil { + return nil, err + } + + certPool := x509.NewCertPool() + loadedCerts := 0 + for _, cert := range caFiles { + // Skip directories + if cert.IsDir() { + continue + } + + // Skip any files that do not contain the right extension + if _, ok := extensions[filepath.Ext(cert.Name())]; !ok { + continue + } + + pem, err := ioutil.ReadFile(filepath.Join(path, cert.Name())) + if err != nil { + continue + } + + if certPool.AppendCertsFromPEM(pem) { + loadedCerts++ + } + } + if loadedCerts == 0 { + return nil, errors.New("no certificates were able to be successfully loaded") + } + return certPool, nil +} + +func validateAuroraURL(location string) (string, error) { + + // If no protocol defined, assume http + if !strings.Contains(location, "://") { + location = "http://" + location + } + + u, err := url.Parse(location) if err != nil { return "", errors.Wrap(err, "error parsing url") @@ -67,9 +139,29 @@ func validateAuroraAddress(address string) (string, error) { return "", errors.Errorf("only protocols http and https are supported %v\n", u.Scheme) } - if u.Path != "/api" { + // This could theoretically be elsewhere but we'll be strict for the sake of simplicity + if u.Path != apiPath { return "", errors.Errorf("expected /api path %v\n", u.Path) } return u.String(), nil } + +func calculateCurrentBatch(updatingInstances int32, batchSizes []int32) int { + for i, size := range batchSizes { + updatingInstances -= size + if updatingInstances <= 0 { + return i + } + } + + // Overflow batches + batchCount := len(batchSizes) - 1 + lastBatchIndex := len(batchSizes) - 1 + batchCount += int(updatingInstances / batchSizes[lastBatchIndex]) + + if updatingInstances%batchSizes[lastBatchIndex] != 0 { + batchCount++ + } + return batchCount +} diff --git a/util_test.go b/util_test.go new file mode 100644 index 0000000..2906c42 --- /dev/null +++ b/util_test.go @@ -0,0 +1,114 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package realis + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestAuroraURLValidator(t *testing.T) { + t.Run("badURL", func(t *testing.T) { + url, err := validateAuroraURL("http://badurl.com/badpath") + assert.Empty(t, url) + assert.Error(t, err) + }) + + t.Run("URLHttp", func(t *testing.T) { + url, err := validateAuroraURL("http://goodurl.com:8081/api") + assert.Equal(t, "http://goodurl.com:8081/api", url) + assert.NoError(t, err) + }) + + t.Run("URLHttps", func(t *testing.T) { + url, err := validateAuroraURL("https://goodurl.com:8081/api") + assert.Equal(t, "https://goodurl.com:8081/api", url) + assert.NoError(t, err) + }) + + t.Run("URLNoPath", func(t *testing.T) { + url, err := validateAuroraURL("http://goodurl.com:8081") + assert.Equal(t, "http://goodurl.com:8081/api", url) + assert.NoError(t, err) + }) + + t.Run("ipAddrNoPath", func(t *testing.T) { + url, err := validateAuroraURL("http://192.168.1.33:8081") + assert.Equal(t, "http://192.168.1.33:8081/api", url) + assert.NoError(t, err) + }) + + t.Run("URLNoProtocol", func(t *testing.T) { + url, err := validateAuroraURL("goodurl.com:8081/api") + assert.Equal(t, "http://goodurl.com:8081/api", url) + assert.NoError(t, err) + }) + + t.Run("URLNoProtocolNoPathNoPort", func(t *testing.T) { + url, err := validateAuroraURL("goodurl.com") + assert.Equal(t, "http://goodurl.com:8081/api", url) + assert.NoError(t, err) + }) +} + +func TestCurrentBatchCalculator(t *testing.T) { + t.Run("singleBatchOverflow", func(t *testing.T) { + curBatch := calculateCurrentBatch(10, []int32{2}) + assert.Equal(t, 4, curBatch) + }) + + t.Run("noInstancesUpdating", func(t *testing.T) { + curBatch := calculateCurrentBatch(0, []int32{2}) + assert.Equal(t, 0, curBatch) + }) + + t.Run("evenMatchSingleBatch", func(t *testing.T) { + curBatch := calculateCurrentBatch(2, []int32{2}) + assert.Equal(t, 0, curBatch) + }) + + t.Run("moreInstancesThanBatches", func(t *testing.T) { + curBatch := calculateCurrentBatch(5, []int32{1, 2}) + assert.Equal(t, 2, curBatch) + }) + + t.Run("moreInstancesThanBatchesDecreasing", func(t *testing.T) { + curBatch := calculateCurrentBatch(5, []int32{2, 1}) + assert.Equal(t, 3, curBatch) + }) + + t.Run("unevenFit", func(t *testing.T) { + curBatch := calculateCurrentBatch(2, []int32{1, 2}) + assert.Equal(t, 1, curBatch) + }) + + t.Run("halfWay", func(t *testing.T) { + curBatch := calculateCurrentBatch(1, []int32{1, 2}) + assert.Equal(t, 0, curBatch) + }) +} + +func TestCertPoolCreator(t *testing.T) { + extensions := map[string]struct{}{".crt": {}} + + _, err := createCertPool("examples/certs", extensions) + assert.NoError(t, err) + + t.Run("badDir", func(t *testing.T) { + _, err := createCertPool("idontexist", extensions) + assert.Error(t, err) + }) +} diff --git a/vendor/github.com/davecgh/go-spew/.travis.yml b/vendor/github.com/davecgh/go-spew/.travis.yml index 1f4cbf5..984e073 100644 --- a/vendor/github.com/davecgh/go-spew/.travis.yml +++ b/vendor/github.com/davecgh/go-spew/.travis.yml @@ -1,28 +1,14 @@ language: go -go_import_path: github.com/davecgh/go-spew go: - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - - 1.10.x - - tip -sudo: false + - 1.5.4 + - 1.6.3 + - 1.7 install: - - go get -v github.com/alecthomas/gometalinter - - gometalinter --install + - go get -v golang.org/x/tools/cmd/cover script: - - export PATH=$PATH:$HOME/gopath/bin - - export GORACE="halt_on_error=1" - - test -z "$(gometalinter --disable-all - --enable=gofmt - --enable=golint - --enable=vet - --enable=gosimple - --enable=unconvert - --deadline=4m ./spew | tee /dev/stderr)" - - go test -v -race -tags safe ./spew - - go test -v -race -tags testcgo ./spew -covermode=atomic -coverprofile=profile.cov + - go test -v -tags=safe ./spew + - go test -v -tags=testcgo ./spew -covermode=count -coverprofile=profile.cov after_success: - go get -v github.com/mattn/goveralls + - export PATH=$PATH:$HOME/gopath/bin - goveralls -coverprofile=profile.cov -service=travis-ci diff --git a/vendor/github.com/davecgh/go-spew/LICENSE b/vendor/github.com/davecgh/go-spew/LICENSE index bc52e96..c836416 100644 --- a/vendor/github.com/davecgh/go-spew/LICENSE +++ b/vendor/github.com/davecgh/go-spew/LICENSE @@ -2,7 +2,7 @@ ISC License Copyright (c) 2012-2016 Dave Collins -Permission to use, copy, modify, and/or distribute this software for any +Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. diff --git a/vendor/github.com/davecgh/go-spew/README.md b/vendor/github.com/davecgh/go-spew/README.md index f6ed02c..2624304 100644 --- a/vendor/github.com/davecgh/go-spew/README.md +++ b/vendor/github.com/davecgh/go-spew/README.md @@ -1,9 +1,12 @@ go-spew ======= -[![Build Status](https://img.shields.io/travis/davecgh/go-spew.svg)](https://travis-ci.org/davecgh/go-spew) -[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) -[![Coverage Status](https://img.shields.io/coveralls/davecgh/go-spew.svg)](https://coveralls.io/r/davecgh/go-spew?branch=master) +[![Build Status](https://img.shields.io/travis/davecgh/go-spew.svg)] +(https://travis-ci.org/davecgh/go-spew) [![ISC License] +(http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) [![Coverage Status] +(https://img.shields.io/coveralls/davecgh/go-spew.svg)] +(https://coveralls.io/r/davecgh/go-spew?branch=master) + Go-spew implements a deep pretty printer for Go data structures to aid in debugging. A comprehensive suite of tests with 100% test coverage is provided @@ -18,7 +21,8 @@ post about it ## Documentation -[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/davecgh/go-spew/spew) +[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)] +(http://godoc.org/github.com/davecgh/go-spew/spew) Full `go doc` style documentation for the project can be viewed online without installing this package by using the excellent GoDoc site here: diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go index 7929947..8a4a658 100644 --- a/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ b/vendor/github.com/davecgh/go-spew/spew/bypass.go @@ -16,9 +16,7 @@ // when the code is not running on Google App Engine, compiled by GopherJS, and // "-tags safe" is not added to the go build command line. The "disableunsafe" // tag is deprecated and thus should not be used. -// Go versions prior to 1.4 are disabled because they use a different layout -// for interfaces which make the implementation of unsafeReflectValue more complex. -// +build !js,!appengine,!safe,!disableunsafe,go1.4 +// +build !js,!appengine,!safe,!disableunsafe package spew @@ -36,49 +34,80 @@ const ( ptrSize = unsafe.Sizeof((*byte)(nil)) ) -type flag uintptr - var ( - // flagRO indicates whether the value field of a reflect.Value - // is read-only. - flagRO flag + // offsetPtr, offsetScalar, and offsetFlag are the offsets for the + // internal reflect.Value fields. These values are valid before golang + // commit ecccf07e7f9d which changed the format. The are also valid + // after commit 82f48826c6c7 which changed the format again to mirror + // the original format. Code in the init function updates these offsets + // as necessary. + offsetPtr = uintptr(ptrSize) + offsetScalar = uintptr(0) + offsetFlag = uintptr(ptrSize * 2) - // flagAddr indicates whether the address of the reflect.Value's - // value may be taken. - flagAddr flag + // flagKindWidth and flagKindShift indicate various bits that the + // reflect package uses internally to track kind information. + // + // flagRO indicates whether or not the value field of a reflect.Value is + // read-only. + // + // flagIndir indicates whether the value field of a reflect.Value is + // the actual data or a pointer to the data. + // + // These values are valid before golang commit 90a7c3c86944 which + // changed their positions. Code in the init function updates these + // flags as necessary. + flagKindWidth = uintptr(5) + flagKindShift = uintptr(flagKindWidth - 1) + flagRO = uintptr(1 << 0) + flagIndir = uintptr(1 << 1) ) -// flagKindMask holds the bits that make up the kind -// part of the flags field. In all the supported versions, -// it is in the lower 5 bits. -const flagKindMask = flag(0x1f) - -// Different versions of Go have used different -// bit layouts for the flags type. This table -// records the known combinations. -var okFlags = []struct { - ro, addr flag -}{{ - // From Go 1.4 to 1.5 - ro: 1 << 5, - addr: 1 << 7, -}, { - // Up to Go tip. - ro: 1<<5 | 1<<6, - addr: 1 << 8, -}} - -var flagValOffset = func() uintptr { - field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") - if !ok { - panic("reflect.Value has no flag field") +func init() { + // Older versions of reflect.Value stored small integers directly in the + // ptr field (which is named val in the older versions). Versions + // between commits ecccf07e7f9d and 82f48826c6c7 added a new field named + // scalar for this purpose which unfortunately came before the flag + // field, so the offset of the flag field is different for those + // versions. + // + // This code constructs a new reflect.Value from a known small integer + // and checks if the size of the reflect.Value struct indicates it has + // the scalar field. When it does, the offsets are updated accordingly. + vv := reflect.ValueOf(0xf00) + if unsafe.Sizeof(vv) == (ptrSize * 4) { + offsetScalar = ptrSize * 2 + offsetFlag = ptrSize * 3 } - return field.Offset -}() -// flagField returns a pointer to the flag field of a reflect.Value. -func flagField(v *reflect.Value) *flag { - return (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset)) + // Commit 90a7c3c86944 changed the flag positions such that the low + // order bits are the kind. This code extracts the kind from the flags + // field and ensures it's the correct type. When it's not, the flag + // order has been changed to the newer format, so the flags are updated + // accordingly. + upf := unsafe.Pointer(uintptr(unsafe.Pointer(&vv)) + offsetFlag) + upfv := *(*uintptr)(upf) + flagKindMask := uintptr((1<>flagKindShift != uintptr(reflect.Int) { + flagKindShift = 0 + flagRO = 1 << 5 + flagIndir = 1 << 6 + + // Commit adf9b30e5594 modified the flags to separate the + // flagRO flag into two bits which specifies whether or not the + // field is embedded. This causes flagIndir to move over a bit + // and means that flagRO is the combination of either of the + // original flagRO bit and the new bit. + // + // This code detects the change by extracting what used to be + // the indirect bit to ensure it's set. When it's not, the flag + // order has been changed to the newer format, so the flags are + // updated accordingly. + if upfv&flagIndir == 0 { + flagRO = 3 << 5 + flagIndir = 1 << 7 + } + } } // unsafeReflectValue converts the passed reflect.Value into a one that bypasses @@ -90,56 +119,34 @@ func flagField(v *reflect.Value) *flag { // This allows us to check for implementations of the Stringer and error // interfaces to be used for pretty printing ordinarily unaddressable and // inaccessible values such as unexported struct fields. -func unsafeReflectValue(v reflect.Value) reflect.Value { - if !v.IsValid() || (v.CanInterface() && v.CanAddr()) { - return v - } - flagFieldPtr := flagField(&v) - *flagFieldPtr &^= flagRO - *flagFieldPtr |= flagAddr - return v -} - -// Sanity checks against future reflect package changes -// to the type or semantics of the Value.flag field. -func init() { - field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") - if !ok { - panic("reflect.Value has no flag field") - } - if field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() { - panic("reflect.Value flag field has changed kind") - } - type t0 int - var t struct { - A t0 - // t0 will have flagEmbedRO set. - t0 - // a will have flagStickyRO set - a t0 - } - vA := reflect.ValueOf(t).FieldByName("A") - va := reflect.ValueOf(t).FieldByName("a") - vt0 := reflect.ValueOf(t).FieldByName("t0") - - // Infer flagRO from the difference between the flags - // for the (otherwise identical) fields in t. - flagPublic := *flagField(&vA) - flagWithRO := *flagField(&va) | *flagField(&vt0) - flagRO = flagPublic ^ flagWithRO - - // Infer flagAddr from the difference between a value - // taken from a pointer and not. - vPtrA := reflect.ValueOf(&t).Elem().FieldByName("A") - flagNoPtr := *flagField(&vA) - flagPtr := *flagField(&vPtrA) - flagAddr = flagNoPtr ^ flagPtr - - // Check that the inferred flags tally with one of the known versions. - for _, f := range okFlags { - if flagRO == f.ro && flagAddr == f.addr { - return +func unsafeReflectValue(v reflect.Value) (rv reflect.Value) { + indirects := 1 + vt := v.Type() + upv := unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetPtr) + rvf := *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetFlag)) + if rvf&flagIndir != 0 { + vt = reflect.PtrTo(v.Type()) + indirects++ + } else if offsetScalar != 0 { + // The value is in the scalar field when it's not one of the + // reference types. + switch vt.Kind() { + case reflect.Uintptr: + case reflect.Chan: + case reflect.Func: + case reflect.Map: + case reflect.Ptr: + case reflect.UnsafePointer: + default: + upv = unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + + offsetScalar) } } - panic("reflect.Value read-only flag has changed semantics") + + pv := reflect.NewAt(vt, upv) + rv = pv + for i := 0; i < indirects; i++ { + rv = rv.Elem() + } + return rv } diff --git a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go index 205c28d..1fe3cf3 100644 --- a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go +++ b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go @@ -16,7 +16,7 @@ // when the code is running on Google App Engine, compiled by GopherJS, or // "-tags safe" is added to the go build command line. The "disableunsafe" // tag is deprecated and thus should not be used. -// +build js appengine safe disableunsafe !go1.4 +// +build js appengine safe disableunsafe package spew diff --git a/vendor/github.com/davecgh/go-spew/spew/common.go b/vendor/github.com/davecgh/go-spew/spew/common.go index 1be8ce9..7c519ff 100644 --- a/vendor/github.com/davecgh/go-spew/spew/common.go +++ b/vendor/github.com/davecgh/go-spew/spew/common.go @@ -180,7 +180,7 @@ func printComplex(w io.Writer, c complex128, floatPrecision int) { w.Write(closeParenBytes) } -// printHexPtr outputs a uintptr formatted as hexadecimal with a leading '0x' +// printHexPtr outputs a uintptr formatted as hexidecimal with a leading '0x' // prefix to Writer w. func printHexPtr(w io.Writer, p uintptr) { // Null pointer. diff --git a/vendor/github.com/davecgh/go-spew/spew/dump.go b/vendor/github.com/davecgh/go-spew/spew/dump.go index f78d89f..df1d582 100644 --- a/vendor/github.com/davecgh/go-spew/spew/dump.go +++ b/vendor/github.com/davecgh/go-spew/spew/dump.go @@ -35,16 +35,16 @@ var ( // cCharRE is a regular expression that matches a cgo char. // It is used to detect character arrays to hexdump them. - cCharRE = regexp.MustCompile(`^.*\._Ctype_char$`) + cCharRE = regexp.MustCompile("^.*\\._Ctype_char$") // cUnsignedCharRE is a regular expression that matches a cgo unsigned // char. It is used to detect unsigned character arrays to hexdump // them. - cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`) + cUnsignedCharRE = regexp.MustCompile("^.*\\._Ctype_unsignedchar$") // cUint8tCharRE is a regular expression that matches a cgo uint8_t. // It is used to detect uint8_t arrays to hexdump them. - cUint8tCharRE = regexp.MustCompile(`^.*\._Ctype_uint8_t$`) + cUint8tCharRE = regexp.MustCompile("^.*\\._Ctype_uint8_t$") ) // dumpState contains information about the state of a dump operation. @@ -143,10 +143,10 @@ func (d *dumpState) dumpPtr(v reflect.Value) { // Display dereferenced value. d.w.Write(openParenBytes) switch { - case nilFound: + case nilFound == true: d.w.Write(nilAngleBytes) - case cycleFound: + case cycleFound == true: d.w.Write(circularBytes) default: diff --git a/vendor/github.com/davecgh/go-spew/spew/dump_test.go b/vendor/github.com/davecgh/go-spew/spew/dump_test.go index 4a31a2e..5aad9c7 100644 --- a/vendor/github.com/davecgh/go-spew/spew/dump_test.go +++ b/vendor/github.com/davecgh/go-spew/spew/dump_test.go @@ -768,7 +768,7 @@ func addUintptrDumpTests() { func addUnsafePointerDumpTests() { // Null pointer. - v := unsafe.Pointer(nil) + v := unsafe.Pointer(uintptr(0)) nv := (*unsafe.Pointer)(nil) pv := &v vAddr := fmt.Sprintf("%p", pv) diff --git a/vendor/github.com/davecgh/go-spew/spew/dumpcgo_test.go b/vendor/github.com/davecgh/go-spew/spew/dumpcgo_test.go index 108baa5..6ab1808 100644 --- a/vendor/github.com/davecgh/go-spew/spew/dumpcgo_test.go +++ b/vendor/github.com/davecgh/go-spew/spew/dumpcgo_test.go @@ -82,20 +82,18 @@ func addCgoDumpTests() { v5Len := fmt.Sprintf("%d", v5l) v5Cap := fmt.Sprintf("%d", v5c) v5t := "[6]testdata._Ctype_uint8_t" - v5t2 := "[6]testdata._Ctype_uchar" v5s := "(len=" + v5Len + " cap=" + v5Cap + ") " + "{\n 00000000 74 65 73 74 35 00 " + " |test5.|\n}" - addDumpTest(v5, "("+v5t+") "+v5s+"\n", "("+v5t2+") "+v5s+"\n") + addDumpTest(v5, "("+v5t+") "+v5s+"\n") // C typedefed unsigned char array. v6, v6l, v6c := testdata.GetCgoTypdefedUnsignedCharArray() v6Len := fmt.Sprintf("%d", v6l) v6Cap := fmt.Sprintf("%d", v6c) v6t := "[6]testdata._Ctype_custom_uchar_t" - v6t2 := "[6]testdata._Ctype_uchar" v6s := "(len=" + v6Len + " cap=" + v6Cap + ") " + "{\n 00000000 74 65 73 74 36 00 " + " |test6.|\n}" - addDumpTest(v6, "("+v6t+") "+v6s+"\n", "("+v6t2+") "+v6s+"\n") + addDumpTest(v6, "("+v6t+") "+v6s+"\n") } diff --git a/vendor/github.com/davecgh/go-spew/spew/format.go b/vendor/github.com/davecgh/go-spew/spew/format.go index b04edb7..c49875b 100644 --- a/vendor/github.com/davecgh/go-spew/spew/format.go +++ b/vendor/github.com/davecgh/go-spew/spew/format.go @@ -182,10 +182,10 @@ func (f *formatState) formatPtr(v reflect.Value) { // Display dereferenced value. switch { - case nilFound: + case nilFound == true: f.fs.Write(nilAngleBytes) - case cycleFound: + case cycleFound == true: f.fs.Write(circularShortBytes) default: diff --git a/vendor/github.com/davecgh/go-spew/spew/format_test.go b/vendor/github.com/davecgh/go-spew/spew/format_test.go index 87ee965..f9b93ab 100644 --- a/vendor/github.com/davecgh/go-spew/spew/format_test.go +++ b/vendor/github.com/davecgh/go-spew/spew/format_test.go @@ -1083,7 +1083,7 @@ func addUintptrFormatterTests() { func addUnsafePointerFormatterTests() { // Null pointer. - v := unsafe.Pointer(nil) + v := unsafe.Pointer(uintptr(0)) nv := (*unsafe.Pointer)(nil) pv := &v vAddr := fmt.Sprintf("%p", pv) @@ -1536,14 +1536,14 @@ func TestPrintSortedKeys(t *testing.T) { t.Errorf("Sorted keys mismatch 3:\n %v %v", s, expected) } - s = cfg.Sprint(map[testStruct]int{{1}: 1, {3}: 3, {2}: 2}) + s = cfg.Sprint(map[testStruct]int{testStruct{1}: 1, testStruct{3}: 3, testStruct{2}: 2}) expected = "map[ts.1:1 ts.2:2 ts.3:3]" if s != expected { t.Errorf("Sorted keys mismatch 4:\n %v %v", s, expected) } if !spew.UnsafeDisabled { - s = cfg.Sprint(map[testStructP]int{{1}: 1, {3}: 3, {2}: 2}) + s = cfg.Sprint(map[testStructP]int{testStructP{1}: 1, testStructP{3}: 3, testStructP{2}: 2}) expected = "map[ts.1:1 ts.2:2 ts.3:3]" if s != expected { t.Errorf("Sorted keys mismatch 5:\n %v %v", s, expected) diff --git a/vendor/github.com/davecgh/go-spew/spew/internal_test.go b/vendor/github.com/davecgh/go-spew/spew/internal_test.go index e312b4f..20a9cfe 100644 --- a/vendor/github.com/davecgh/go-spew/spew/internal_test.go +++ b/vendor/github.com/davecgh/go-spew/spew/internal_test.go @@ -36,7 +36,10 @@ type dummyFmtState struct { } func (dfs *dummyFmtState) Flag(f int) bool { - return f == int('+') + if f == int('+') { + return true + } + return false } func (dfs *dummyFmtState) Precision() (int, bool) { diff --git a/vendor/github.com/davecgh/go-spew/spew/internalunsafe_test.go b/vendor/github.com/davecgh/go-spew/spew/internalunsafe_test.go index 80dc221..a0c612e 100644 --- a/vendor/github.com/davecgh/go-spew/spew/internalunsafe_test.go +++ b/vendor/github.com/davecgh/go-spew/spew/internalunsafe_test.go @@ -16,7 +16,7 @@ // when the code is not running on Google App Engine, compiled by GopherJS, and // "-tags safe" is not added to the go build command line. The "disableunsafe" // tag is deprecated and thus should not be used. -// +build !js,!appengine,!safe,!disableunsafe,go1.4 +// +build !js,!appengine,!safe,!disableunsafe /* This test file is part of the spew package rather than than the spew_test @@ -30,6 +30,7 @@ import ( "bytes" "reflect" "testing" + "unsafe" ) // changeKind uses unsafe to intentionally change the kind of a reflect.Value to @@ -37,13 +38,13 @@ import ( // fallback code which punts to the standard fmt library for new types that // might get added to the language. func changeKind(v *reflect.Value, readOnly bool) { - flags := flagField(v) + rvf := (*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + offsetFlag)) + *rvf = *rvf | ((1< 1 { return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...) @@ -415,6 +419,17 @@ func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { return Fail(t, "Expected value not to be nil.", msgAndArgs...) } +// containsKind checks if a specified kind in the slice of kinds. +func containsKind(kinds []reflect.Kind, kind reflect.Kind) bool { + for i := 0; i < len(kinds); i++ { + if kind == kinds[i] { + return true + } + } + + return false +} + // isNil checks if a specified object is nil or not, without Failing. func isNil(object interface{}) bool { if object == nil { @@ -423,7 +438,14 @@ func isNil(object interface{}) bool { value := reflect.ValueOf(object) kind := value.Kind() - if kind >= reflect.Chan && kind <= reflect.Slice && value.IsNil() { + isNilableKind := containsKind( + []reflect.Kind{ + reflect.Chan, reflect.Func, + reflect.Interface, reflect.Map, + reflect.Ptr, reflect.Slice}, + kind) + + if isNilableKind && value.IsNil() { return true } @@ -1327,7 +1349,7 @@ func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) { } // diff returns a diff of both values as long as both are of the same type and -// are a struct, map, slice or array. Otherwise it returns an empty string. +// are a struct, map, slice, array or string. Otherwise it returns an empty string. func diff(expected interface{}, actual interface{}) string { if expected == nil || actual == nil { return "" @@ -1345,7 +1367,7 @@ func diff(expected interface{}, actual interface{}) string { } var e, a string - if ek != reflect.String { + if et != reflect.TypeOf("") { e = spewConfig.Sdump(expected) a = spewConfig.Sdump(actual) } else { diff --git a/vendor/github.com/stretchr/testify/assert/assertions_test.go b/vendor/github.com/stretchr/testify/assert/assertions_test.go index 91b5ee9..00e2d21 100644 --- a/vendor/github.com/stretchr/testify/assert/assertions_test.go +++ b/vendor/github.com/stretchr/testify/assert/assertions_test.go @@ -175,6 +175,8 @@ func TestIsType(t *testing.T) { } +type myType string + func TestEqual(t *testing.T) { mockT := new(testing.T) @@ -200,6 +202,9 @@ func TestEqual(t *testing.T) { if !Equal(mockT, uint64(123), uint64(123)) { t.Error("Equal should return true") } + if !Equal(mockT, myType("1"), myType("1")) { + t.Error("Equal should return true") + } if !Equal(mockT, &struct{}{}, &struct{}{}) { t.Error("Equal should return true (pointer equality is based on equality of underlying value)") } @@ -207,6 +212,9 @@ func TestEqual(t *testing.T) { if Equal(mockT, m["bar"], "something") { t.Error("Equal should return false") } + if Equal(mockT, myType("1"), myType("2")) { + t.Error("Equal should return false") + } } // bufferT implements TestingT. Its implementation of Errorf writes the output that would be produced by @@ -275,6 +283,8 @@ func TestEqualFormatting(t *testing.T) { }{ {equalWant: "want", equalGot: "got", want: "\tassertions.go:\\d+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"want\"\n\\s+actual\\s+: \"got\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1 \\+1 @@\n\\s+-want\n\\s+\\+got\n"}, {equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{"hello, %v!", "world"}, want: "\tassertions.go:[0-9]+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"want\"\n\\s+actual\\s+: \"got\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1 \\+1 @@\n\\s+-want\n\\s+\\+got\n\\s+Messages:\\s+hello, world!\n"}, + {equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{123}, want: "\tassertions.go:[0-9]+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"want\"\n\\s+actual\\s+: \"got\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1 \\+1 @@\n\\s+-want\n\\s+\\+got\n\\s+Messages:\\s+123\n"}, + {equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{struct{ a string }{"hello"}}, want: "\tassertions.go:[0-9]+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"want\"\n\\s+actual\\s+: \"got\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1 \\+1 @@\n\\s+-want\n\\s+\\+got\n\\s+Messages:\\s+{a:hello}\n"}, } { mockT := &bufferT{} Equal(mockT, currCase.equalWant, currCase.equalGot, currCase.msgAndArgs...) diff --git a/vendor/github.com/stretchr/testify/go.mod b/vendor/github.com/stretchr/testify/go.mod new file mode 100644 index 0000000..90e5dbe --- /dev/null +++ b/vendor/github.com/stretchr/testify/go.mod @@ -0,0 +1,7 @@ +module github.com/stretchr/testify + +require ( + github.com/davecgh/go-spew v1.1.0 + github.com/pmezard/go-difflib v1.0.0 + github.com/stretchr/objx v0.1.0 +) diff --git a/vendor/github.com/stretchr/testify/go.sum b/vendor/github.com/stretchr/testify/go.sum new file mode 100644 index 0000000..5b98bf3 --- /dev/null +++ b/vendor/github.com/stretchr/testify/go.sum @@ -0,0 +1,6 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/vendor/github.com/stretchr/testify/mock/mock.go b/vendor/github.com/stretchr/testify/mock/mock.go index cc4f642..d6694ed 100644 --- a/vendor/github.com/stretchr/testify/mock/mock.go +++ b/vendor/github.com/stretchr/testify/mock/mock.go @@ -176,6 +176,7 @@ func (c *Call) Maybe() *Call { // Mock. // On("MyMethod", 1).Return(nil). // On("MyOtherMethod", 'a', 'b', 'c').Return(errors.New("Some Error")) +//go:noinline func (c *Call) On(methodName string, arguments ...interface{}) *Call { return c.Parent.On(methodName, arguments...) } @@ -691,7 +692,7 @@ func (args Arguments) Diff(objects []interface{}) (string, int) { output = fmt.Sprintf("%s\t%d: PASS: %s matched by %s\n", output, i, actualFmt, matcher) } else { differences++ - output = fmt.Sprintf("%s\t%d: PASS: %s not matched by %s\n", output, i, actualFmt, matcher) + output = fmt.Sprintf("%s\t%d: FAIL: %s not matched by %s\n", output, i, actualFmt, matcher) } } else if reflect.TypeOf(expected) == reflect.TypeOf((*AnythingOfTypeArgument)(nil)).Elem() { diff --git a/vendor/github.com/stretchr/testify/mock/mock_test.go b/vendor/github.com/stretchr/testify/mock/mock_test.go index 978eae2..2608f5a 100644 --- a/vendor/github.com/stretchr/testify/mock/mock_test.go +++ b/vendor/github.com/stretchr/testify/mock/mock_test.go @@ -32,6 +32,7 @@ func (i *TestExampleImplementation) TheExampleMethod(a, b, c int) (int, error) { return args.Int(0), errors.New("Whoops") } +//go:noinline func (i *TestExampleImplementation) TheExampleMethod2(yesorno bool) { i.Called(yesorno) } @@ -1492,6 +1493,7 @@ func unexpectedCallRegex(method, calledArg, expectedArg, diff string) string { rMethod, calledArg, rMethod, expectedArg, diff) } +//go:noinline func ConcurrencyTestMethod(m *Mock) { m.Called() } diff --git a/vendor/github.com/stretchr/testify/require/requirements.go b/vendor/github.com/stretchr/testify/require/requirements.go index 690583a..6b85c5e 100644 --- a/vendor/github.com/stretchr/testify/require/requirements.go +++ b/vendor/github.com/stretchr/testify/require/requirements.go @@ -22,7 +22,7 @@ type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) // for table driven tests. type BoolAssertionFunc func(TestingT, bool, ...interface{}) -// ValuesAssertionFunc is a common function prototype when validating an error value. Can be useful +// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful // for table driven tests. type ErrorAssertionFunc func(TestingT, error, ...interface{}) diff --git a/vendor/github.com/stretchr/testify/suite/suite.go b/vendor/github.com/stretchr/testify/suite/suite.go index e20afbc..5cea8f8 100644 --- a/vendor/github.com/stretchr/testify/suite/suite.go +++ b/vendor/github.com/stretchr/testify/suite/suite.go @@ -55,10 +55,32 @@ func (suite *Suite) Assert() *assert.Assertions { return suite.Assertions } +func failOnPanic(t *testing.T) { + r := recover() + if r != nil { + t.Errorf("test panicked: %v", r) + t.FailNow() + } +} + +// Run provides suite functionality around golang subtests. It should be +// called in place of t.Run(name, func(t *testing.T)) in test suite code. +// The passed-in func will be executed as a subtest with a fresh instance of t. +// Provides compatibility with go test pkg -run TestSuite/TestName/SubTestName. +func (suite *Suite) Run(name string, subtest func()) bool { + oldT := suite.T() + defer suite.SetT(oldT) + return oldT.Run(name, func(t *testing.T) { + suite.SetT(t) + subtest() + }) +} + // Run takes a testing suite and runs all of the tests attached // to it. func Run(t *testing.T, suite TestingSuite) { suite.SetT(t) + defer failOnPanic(t) if setupAllSuite, ok := suite.(SetupAllSuite); ok { setupAllSuite.SetupSuite() @@ -84,6 +106,8 @@ func Run(t *testing.T, suite TestingSuite) { F: func(t *testing.T) { parentT := suite.T() suite.SetT(t) + defer failOnPanic(t) + if setupTestSuite, ok := suite.(SetupTestSuite); ok { setupTestSuite.SetupTest() } diff --git a/vendor/github.com/stretchr/testify/suite/suite_test.go b/vendor/github.com/stretchr/testify/suite/suite_test.go index b75fa4a..6dfba08 100644 --- a/vendor/github.com/stretchr/testify/suite/suite_test.go +++ b/vendor/github.com/stretchr/testify/suite/suite_test.go @@ -42,6 +42,99 @@ func (s *SuiteRequireTwice) TestRequireTwo() { r.Equal(1, 2) } +type panickingSuite struct { + Suite + panicInSetupSuite bool + panicInSetupTest bool + panicInBeforeTest bool + panicInTest bool + panicInAfterTest bool + panicInTearDownTest bool + panicInTearDownSuite bool +} + +func (s *panickingSuite) SetupSuite() { + if s.panicInSetupSuite { + panic("oops in setup suite") + } +} + +func (s *panickingSuite) SetupTest() { + if s.panicInSetupTest { + panic("oops in setup test") + } +} + +func (s *panickingSuite) BeforeTest(_, _ string) { + if s.panicInBeforeTest { + panic("oops in before test") + } +} + +func (s *panickingSuite) Test() { + if s.panicInTest { + panic("oops in test") + } +} + +func (s *panickingSuite) AfterTest(_, _ string) { + if s.panicInAfterTest { + panic("oops in after test") + } +} + +func (s *panickingSuite) TearDownTest() { + if s.panicInTearDownTest { + panic("oops in tear down test") + } +} + +func (s *panickingSuite) TearDownSuite() { + if s.panicInTearDownSuite { + panic("oops in tear down suite") + } +} + +func TestSuiteRecoverPanic(t *testing.T) { + ok := true + panickingTests := []testing.InternalTest{ + { + Name: "TestPanicInSetupSuite", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInSetupSuite: true}) }, + }, + { + Name: "TestPanicInSetupTest", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInSetupTest: true}) }, + }, + { + Name: "TestPanicInBeforeTest", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInBeforeTest: true}) }, + }, + { + Name: "TestPanicInTest", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInTest: true}) }, + }, + { + Name: "TestPanicInAfterTest", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInAfterTest: true}) }, + }, + { + Name: "TestPanicInTearDownTest", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInTearDownTest: true}) }, + }, + { + Name: "TestPanicInTearDownSuite", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInTearDownSuite: true}) }, + }, + } + + require.NotPanics(t, func() { + ok = testing.RunTests(allTestsFilter, panickingTests) + }) + + assert.False(t, ok) +} + // This suite is intended to store values to make sure that only // testing-suite-related methods are run. It's also a fully // functional example of a testing suite, using setup/teardown methods @@ -59,6 +152,7 @@ type SuiteTester struct { TearDownTestRunCount int TestOneRunCount int TestTwoRunCount int + TestSubtestRunCount int NonTestMethodRunCount int SuiteNameBefore []string @@ -153,6 +247,27 @@ func (suite *SuiteTester) NonTestMethod() { suite.NonTestMethodRunCount++ } +func (suite *SuiteTester) TestSubtest() { + suite.TestSubtestRunCount++ + + for _, t := range []struct { + testName string + }{ + {"first"}, + {"second"}, + } { + suiteT := suite.T() + suite.Run(t.testName, func() { + // We should get a different *testing.T for subtests, so that + // go test recognizes them as proper subtests for output formatting + // and running individual subtests + subTestT := suite.T() + suite.NotEqual(subTestT, suiteT) + }) + suite.Equal(suiteT, suite.T()) + } +} + // TestRunSuite will be run by the 'go test' command, so within it, we // can run our suite using the Run(*testing.T, TestingSuite) function. func TestRunSuite(t *testing.T) { @@ -168,18 +283,20 @@ func TestRunSuite(t *testing.T) { assert.Equal(t, suiteTester.SetupSuiteRunCount, 1) assert.Equal(t, suiteTester.TearDownSuiteRunCount, 1) - assert.Equal(t, len(suiteTester.SuiteNameAfter), 3) - assert.Equal(t, len(suiteTester.SuiteNameBefore), 3) - assert.Equal(t, len(suiteTester.TestNameAfter), 3) - assert.Equal(t, len(suiteTester.TestNameBefore), 3) + assert.Equal(t, len(suiteTester.SuiteNameAfter), 4) + assert.Equal(t, len(suiteTester.SuiteNameBefore), 4) + assert.Equal(t, len(suiteTester.TestNameAfter), 4) + assert.Equal(t, len(suiteTester.TestNameBefore), 4) assert.Contains(t, suiteTester.TestNameAfter, "TestOne") assert.Contains(t, suiteTester.TestNameAfter, "TestTwo") assert.Contains(t, suiteTester.TestNameAfter, "TestSkip") + assert.Contains(t, suiteTester.TestNameAfter, "TestSubtest") assert.Contains(t, suiteTester.TestNameBefore, "TestOne") assert.Contains(t, suiteTester.TestNameBefore, "TestTwo") assert.Contains(t, suiteTester.TestNameBefore, "TestSkip") + assert.Contains(t, suiteTester.TestNameBefore, "TestSubtest") for _, suiteName := range suiteTester.SuiteNameAfter { assert.Equal(t, "SuiteTester", suiteName) @@ -197,15 +314,16 @@ func TestRunSuite(t *testing.T) { assert.False(t, when.IsZero()) } - // There are three test methods (TestOne, TestTwo, and TestSkip), so + // There are four test methods (TestOne, TestTwo, TestSkip, and TestSubtest), so // the SetupTest and TearDownTest methods (which should be run once for - // each test) should have been run three times. - assert.Equal(t, suiteTester.SetupTestRunCount, 3) - assert.Equal(t, suiteTester.TearDownTestRunCount, 3) + // each test) should have been run four times. + assert.Equal(t, suiteTester.SetupTestRunCount, 4) + assert.Equal(t, suiteTester.TearDownTestRunCount, 4) // Each test should have been run once. assert.Equal(t, suiteTester.TestOneRunCount, 1) assert.Equal(t, suiteTester.TestTwoRunCount, 1) + assert.Equal(t, suiteTester.TestSubtestRunCount, 1) // Methods that don't match the test method identifier shouldn't // have been run at all. diff --git a/zk.go b/zk.go index bc60a97..4bc9ede 100644 --- a/zk.go +++ b/zk.go @@ -24,14 +24,14 @@ import ( "github.com/samuel/go-zookeeper/zk" ) -type Endpoint struct { +type endpoint struct { Host string `json:"host"` Port int `json:"port"` } -type ServiceInstance struct { - Service Endpoint `json:"serviceEndpoint"` - AdditionalEndpoints map[string]Endpoint `json:"additionalEndpoints"` +type serviceInstance struct { + Service endpoint `json:"serviceEndpoint"` + AdditionalEndpoints map[string]endpoint `json:"additionalEndpoints"` Status string `json:"status"` } @@ -40,47 +40,54 @@ type zkConfig struct { path string backoff Backoff timeout time.Duration - logger Logger + logger logger } +// ZKOpt - Configuration option for the Zookeeper client used. type ZKOpt func(z *zkConfig) +// ZKEndpoints - Endpoints on which a Zookeeper instance is running to be used by the client. func ZKEndpoints(endpoints ...string) ZKOpt { return func(z *zkConfig) { z.endpoints = endpoints } } +// ZKPath - Path to look for information in when connected to Zookeeper. func ZKPath(path string) ZKOpt { return func(z *zkConfig) { z.path = path } } +// ZKBackoff - Configuration for Retry mechanism used when connecting to Zookeeper. +// TODO(rdelvalle): Determine if this is really necessary as the ZK library already has a retry built in. func ZKBackoff(b Backoff) ZKOpt { return func(z *zkConfig) { z.backoff = b } } +// ZKTimeout - How long to wait on a response from the Zookeeper instance before considering it dead. func ZKTimeout(d time.Duration) ZKOpt { return func(z *zkConfig) { z.timeout = d } } -func ZKLogger(l Logger) ZKOpt { +// ZKLogger - Attach a logger to the Zookeeper client in order to debug issues. +func ZKLogger(l logger) ZKOpt { return func(z *zkConfig) { z.logger = l } } -// Retrieves current Aurora leader from ZK. +// LeaderFromZK - Retrieves current Aurora leader from ZK. func LeaderFromZK(cluster Cluster) (string, error) { return LeaderFromZKOpts(ZKEndpoints(strings.Split(cluster.ZK, ",")...), ZKPath(cluster.SchedZKPath)) } -// Retrieves current Aurora leader from ZK with a custom configuration. +// LeaderFromZKOpts - Retrieves current Aurora leader from ZK with a custom configuration. func LeaderFromZKOpts(options ...ZKOpt) (string, error) { var leaderURL string @@ -103,7 +110,7 @@ func LeaderFromZKOpts(options ...ZKOpt) (string, error) { c, _, err := zk.Connect(config.endpoints, config.timeout, func(c *zk.Conn) { c.SetLogger(config.logger) }) if err != nil { - return false, NewTemporaryError(errors.Wrap(err, "Failed to connect to Zookeeper")) + return false, NewTemporaryError(errors.Wrap(err, "failed to connect to Zookeeper")) } defer c.Close() @@ -117,12 +124,10 @@ func LeaderFromZKOpts(options ...ZKOpt) (string, error) { return false, errors.Wrapf(err, "path %s is an invalid Zookeeper path", config.path) } - return false, - NewTemporaryError(errors.Wrapf(err, "path %s doesn't exist on Zookeeper ", config.path)) + return false, NewTemporaryError(errors.Wrapf(err, "path %s doesn't exist on Zookeeper ", config.path)) } // Search for the leader through all the children in the given path - serviceInst := new(ServiceInstance) for _, child := range children { // Only the leader will start with member_ @@ -135,13 +140,13 @@ func LeaderFromZKOpts(options ...ZKOpt) (string, error) { return false, errors.Wrapf(err, "path %s is an invalid Zookeeper path", childPath) } - return false, NewTemporaryError(errors.Wrap(err, "error fetching contents of leader")) + return false, NewTemporaryError(errors.Wrap(err, "unable to fetch contents of leader")) } - err = json.Unmarshal([]byte(data), serviceInst) + var serviceInst serviceInstance + err = json.Unmarshal([]byte(data), &serviceInst) if err != nil { - return false, - NewTemporaryError(errors.Wrap(err, "unable to unmarshal contents of leader")) + return false, NewTemporaryError(errors.Wrap(err, "unable to unmarshal contents of leader")) } // Should only be one endpoint. @@ -149,8 +154,7 @@ func LeaderFromZKOpts(options ...ZKOpt) (string, error) { // writing bad info into Zookeeper but is kept here as a safety net. if len(serviceInst.AdditionalEndpoints) > 1 { return false, - NewTemporaryError( - errors.New("ambiguous endpoints in json blob, Aurora wrote bad info to ZK")) + NewTemporaryError(errors.New("ambiguous endpoints in json blob, Aurora wrote bad info to ZK")) } var scheme, host, port string @@ -170,7 +174,7 @@ func LeaderFromZKOpts(options ...ZKOpt) (string, error) { }) if retryErr != nil { - config.logger.Printf("Failed to determine leader after %v attempts", config.backoff.Steps) + config.logger.Printf("failed to determine leader after %v attempts", config.backoff.Steps) return "", retryErr } diff --git a/zk_test.go b/zk_test.go index c929e03..b4e5d22 100644 --- a/zk_test.go +++ b/zk_test.go @@ -20,15 +20,16 @@ import ( "testing" "time" - realis "github.com/paypal/gorealis/v2" + realis "github.com/paypal/gorealis" "github.com/stretchr/testify/assert" ) -var backoff realis.Backoff = realis.Backoff{ // Reduce penalties for this test to make it quick +var backoff = realis.Backoff{ // Reduce penalties for this test to make it quick Steps: 5, Duration: 1 * time.Second, Factor: 1.0, - Jitter: 0.1} + Jitter: 0.1, +} // Test for behavior when no endpoints are given to the ZK leader finding function. func TestZKNoEndpoints(t *testing.T) {