mesos-go-0.0.1/000077500000000000000000000000001257601144100132425ustar00rootroot00000000000000mesos-go-0.0.1/.gitignore000066400000000000000000000021011257601144100152240ustar00rootroot00000000000000## generic files to ignore *~ *.lock *.DS_Store *.swp *.out # rails specific *.sqlite3 config/database.yml log/* tmp/* # java specific *.class # python specific *.pyc # xcode/iphone specific build/* *.pbxuser *.mode2v3 *.mode1v3 *.perspective *.perspectivev3 *~.nib # akka specific logs/* # sbt specific project/boot lib_managed/* project/build/target project/build/lib_managed project/build/src_managed project/plugins/lib_managed project/plugins/target project/plugins/src_managed project/plugins/project # eclipse specific .metadata jrebel.lic .idea/workspace.xml .idea/bashsupport_project.xml *.iml *.ipr *.iws target .idea .settings .classpath .project .ensime* *.sublime-* .cache .lib data .tags .tags_sorted_by_file atlassian-ide-plugin.xml node_modules # Compiled Object files, Static and Dynamic libs (Shared Objects) *.o *.a *.so # Folders _obj _test # Architecture specific extensions/prefixes *.[568vq] [568vq].out *.cgo1.go *.cgo2.c _cgo_defun.c _cgo_gotypes.go _cgo_export.* _testmain.go *.exe *.test junit_* # mesos-go specific /examples/_output #webide .c9 mesos-go-0.0.1/.travis.yml000066400000000000000000000011401257601144100153470ustar00rootroot00000000000000sudo: false language: go go: - 1.3 - 1.4.2 - 1.5.1 - tip before_install: - go get golang.org/x/tools/cmd/vet #these two lines help users who fork mesos-go. It's a noop when running from the mesos organization - RepoName=`basename $PWD`; SrcDir=`dirname $PWD`; DestDir="`dirname $SrcDir`/mesos" - if [[ "$SrcDir" != "$DestDir" ]]; then mv "$SrcDir" "$DestDir"; cd ../../mesos/$RepoName; export TRAVIS_BUILD_DIR=`dirname $TRAVIS_BUILD_DIR`/$RepoName; fi install: - go get -t -d -v ./... script: - ! gofmt -s -d . 2>&1 | read diff - go build -v ./... - go test -timeout 60s -race ./... mesos-go-0.0.1/CHANGELOG000066400000000000000000000001311257601144100144470ustar00rootroot000000000000002015-09-15: v0.0.1 First tagged release ever! Mesos 0.24.0 and 0.23.0 compatibility. mesos-go-0.0.1/LICENSE000066400000000000000000000260731257601144100142570ustar00rootroot00000000000000Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} 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.mesos-go-0.0.1/NOTICE000066400000000000000000000010631257601144100141460ustar00rootroot00000000000000Copyright 2013-2015, Mesosphere, Inc. 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. mesos-go-0.0.1/README.md000066400000000000000000000022661257601144100145270ustar00rootroot00000000000000Go bindings for Apache Mesos ======== Very early version of a pure Go language bindings for Apache Mesos. As with other pure implementation, mesos-go uses the HTTP wire protocol to communicate directly with a running Mesos master and its slave instances. One of the objectives of this project is to provide an idiomatic Go API that makes it super easy to create Mesos frameworks using Go. [![Build Status](https://travis-ci.org/mesos/mesos-go.svg)](https://travis-ci.org/mesos/mesos-go) [![GoDoc] (https://godoc.org/github.com/mesos/mesos-go?status.png)](https://godoc.org/github.com/mesos/mesos-go) ## Current Status This is a very early version of the project. Howerver, here is a list of things that works so far: - The SchedulerDriver API implemented - The ExecutorDriver API implemented - Stable API (based on the core Mesos code) - Plenty of unit and integrative of tests - Modular design for easy readability/extensibility - Example programs on how to use the API - Leading master detection - Authentication via SASL/CRAM-MD5 ## Pre-Requisites - Go 1.3 or higher - A standard and working Go workspace setup - Apache Mesos 0.19 or newer ## Install ``` $ go get github.com/mesos/mesos-go ``` mesos-go-0.0.1/auth/000077500000000000000000000000001257601144100142035ustar00rootroot00000000000000mesos-go-0.0.1/auth/callback/000077500000000000000000000000001257601144100157375ustar00rootroot00000000000000mesos-go-0.0.1/auth/callback/interface.go000066400000000000000000000007771257601144100202410ustar00rootroot00000000000000package callback import ( "fmt" ) type Unsupported struct { Callback Interface } func (uc *Unsupported) Error() string { return fmt.Sprintf("Unsupported callback <%T>: %v", uc.Callback, uc.Callback) } type Interface interface { // marker interface } type Handler interface { // may return an Unsupported error on failure Handle(callbacks ...Interface) error } type HandlerFunc func(callbacks ...Interface) error func (f HandlerFunc) Handle(callbacks ...Interface) error { return f(callbacks...) } mesos-go-0.0.1/auth/callback/interprocess.go000066400000000000000000000006521257601144100210110ustar00rootroot00000000000000package callback import ( "github.com/mesos/mesos-go/upid" ) type Interprocess struct { client upid.UPID server upid.UPID } func NewInterprocess() *Interprocess { return &Interprocess{} } func (cb *Interprocess) Client() upid.UPID { return cb.client } func (cb *Interprocess) Server() upid.UPID { return cb.server } func (cb *Interprocess) Set(server, client upid.UPID) { cb.server = server cb.client = client } mesos-go-0.0.1/auth/callback/name.go000066400000000000000000000003061257601144100172050ustar00rootroot00000000000000package callback type Name struct { name string } func NewName() *Name { return &Name{} } func (cb *Name) Get() string { return cb.name } func (cb *Name) Set(name string) { cb.name = name } mesos-go-0.0.1/auth/callback/password.go000066400000000000000000000005371257601144100201350ustar00rootroot00000000000000package callback type Password struct { password []byte } func NewPassword() *Password { return &Password{} } func (cb *Password) Get() []byte { clone := make([]byte, len(cb.password)) copy(clone, cb.password) return clone } func (cb *Password) Set(password []byte) { cb.password = make([]byte, len(password)) copy(cb.password, password) } mesos-go-0.0.1/auth/interface.go000066400000000000000000000040721257601144100164750ustar00rootroot00000000000000package auth import ( "errors" "fmt" "sync" log "github.com/golang/glog" "github.com/mesos/mesos-go/auth/callback" "golang.org/x/net/context" ) // SPI interface: login provider implementations support this interface, clients // do not authenticate against this directly, instead they should use Login() type Authenticatee interface { // Returns no errors if successfully authenticated, otherwise a single // error. Authenticate(ctx context.Context, handler callback.Handler) error } // Func adapter for interface: allow func's to implement the Authenticatee interface // as long as the func signature matches type AuthenticateeFunc func(ctx context.Context, handler callback.Handler) error func (f AuthenticateeFunc) Authenticate(ctx context.Context, handler callback.Handler) error { return f(ctx, handler) } var ( // Authentication was attempted and failed (likely due to incorrect credentials, too // many retries within a time window, etc). Distinctly different from authentication // errors (e.g. network errors, configuration errors, etc). AuthenticationFailed = errors.New("authentication failed") authenticateeProviders = make(map[string]Authenticatee) // authentication providers dict providerLock sync.Mutex ) // Register an authentication provider (aka "login provider"). packages that // provide Authenticatee implementations should invoke this func in their // init() to register. func RegisterAuthenticateeProvider(name string, auth Authenticatee) (err error) { providerLock.Lock() defer providerLock.Unlock() if _, found := authenticateeProviders[name]; found { err = fmt.Errorf("authentication provider already registered: %v", name) } else { authenticateeProviders[name] = auth log.V(1).Infof("registered authentication provider: %v", name) } return } // Look up an authentication provider by name, returns non-nil and true if such // a provider is found. func getAuthenticateeProvider(name string) (provider Authenticatee, ok bool) { providerLock.Lock() defer providerLock.Unlock() provider, ok = authenticateeProviders[name] return } mesos-go-0.0.1/auth/login.go000066400000000000000000000050071257601144100156440ustar00rootroot00000000000000package auth import ( "errors" "fmt" "github.com/mesos/mesos-go/auth/callback" "github.com/mesos/mesos-go/upid" "golang.org/x/net/context" ) var ( // No login provider name has been specified in a context.Context NoLoginProviderName = errors.New("missing login provider name in context") ) // Main client entrypoint into the authentication APIs: clients are expected to // invoke this func with a context containing a login provider name value. // This may be written as: // providerName := ... // the user has probably configured this via some flag // handler := ... // handlers provide data like usernames and passwords // ctx := ... // obtain some initial or timed context // err := auth.Login(auth.WithLoginProvider(ctx, providerName), handler) func Login(ctx context.Context, handler callback.Handler) error { name, ok := LoginProviderFrom(ctx) if !ok { return NoLoginProviderName } provider, ok := getAuthenticateeProvider(name) if !ok { return fmt.Errorf("unrecognized login provider name in context: %s", name) } return provider.Authenticate(ctx, handler) } // Unexported key type, avoids conflicts with other context-using packages. All // context items registered from this package should use keys of this type. type loginKeyType int const ( loginProviderNameKey loginKeyType = iota // name of login provider to use parentUpidKey // upid.UPID of some parent process ) // Return a context that inherits all values from the parent ctx and specifies // the login provider name given here. Intended to be invoked before calls to // Login(). func WithLoginProvider(ctx context.Context, providerName string) context.Context { return context.WithValue(ctx, loginProviderNameKey, providerName) } // Return the name of the login provider specified in this context. func LoginProviderFrom(ctx context.Context) (name string, ok bool) { name, ok = ctx.Value(loginProviderNameKey).(string) return } // Return the name of the login provider specified in this context, or empty // string if none. func LoginProvider(ctx context.Context) string { name, _ := LoginProviderFrom(ctx) return name } func WithParentUPID(ctx context.Context, pid upid.UPID) context.Context { return context.WithValue(ctx, parentUpidKey, pid) } func ParentUPIDFrom(ctx context.Context) (pid upid.UPID, ok bool) { pid, ok = ctx.Value(parentUpidKey).(upid.UPID) return } func ParentUPID(ctx context.Context) (upid *upid.UPID) { if upid, ok := ParentUPIDFrom(ctx); ok { return &upid } else { return nil } } mesos-go-0.0.1/auth/sasl/000077500000000000000000000000001257601144100151455ustar00rootroot00000000000000mesos-go-0.0.1/auth/sasl/authenticatee.go000066400000000000000000000241301257601144100203170ustar00rootroot00000000000000package sasl import ( "errors" "fmt" "sync/atomic" "github.com/gogo/protobuf/proto" log "github.com/golang/glog" "github.com/mesos/mesos-go/auth" "github.com/mesos/mesos-go/auth/callback" "github.com/mesos/mesos-go/auth/sasl/mech" mesos "github.com/mesos/mesos-go/mesosproto" "github.com/mesos/mesos-go/mesosutil/process" "github.com/mesos/mesos-go/messenger" "github.com/mesos/mesos-go/upid" "golang.org/x/net/context" ) var ( UnexpectedAuthenticationMechanisms = errors.New("Unexpected authentication 'mechanisms' received") UnexpectedAuthenticationStep = errors.New("Unexpected authentication 'step' received") UnexpectedAuthenticationCompleted = errors.New("Unexpected authentication 'completed' received") UnexpectedAuthenticatorPid = errors.New("Unexpected authentator pid") // authenticator pid changed mid-process UnsupportedMechanism = errors.New("failed to identify a compatible mechanism") ) type statusType int32 const ( statusReady statusType = iota statusStarting statusStepping _statusTerminal // meta status, should never be assigned: all status types following are "terminal" statusCompleted statusFailed statusError statusDiscarded // this login provider name is automatically registered with the auth package; see init() ProviderName = "SASL" ) type authenticateeProcess struct { transport messenger.Messenger client upid.UPID status statusType done chan struct{} err error mech mech.Interface stepFn mech.StepFunc from *upid.UPID handler callback.Handler } type authenticateeConfig struct { client upid.UPID // pid of the client we're attempting to authenticate handler callback.Handler transport messenger.Messenger // mesos communications transport } type transportFactory interface { makeTransport() messenger.Messenger } type transportFactoryFunc func() messenger.Messenger func (f transportFactoryFunc) makeTransport() messenger.Messenger { return f() } func init() { factory := func(ctx context.Context) transportFactoryFunc { return transportFactoryFunc(func() messenger.Messenger { parent := auth.ParentUPID(ctx) if parent == nil { log.Fatal("expected to have a parent UPID in context") } process := process.New("sasl_authenticatee") tpid := &upid.UPID{ ID: process.Label(), Host: parent.Host, } return messenger.NewHttpWithBindingAddress(tpid, BindingAddressFrom(ctx)) }) } delegate := auth.AuthenticateeFunc(func(ctx context.Context, handler callback.Handler) error { if impl, err := makeAuthenticatee(handler, factory(ctx)); err != nil { return err } else { return impl.Authenticate(ctx, handler) } }) if err := auth.RegisterAuthenticateeProvider(ProviderName, delegate); err != nil { log.Error(err) } } func (s *statusType) get() statusType { return statusType(atomic.LoadInt32((*int32)(s))) } func (s *statusType) swap(old, new statusType) bool { return old != new && atomic.CompareAndSwapInt32((*int32)(s), int32(old), int32(new)) } // build a new authenticatee implementation using the given callbacks and a new transport instance func makeAuthenticatee(handler callback.Handler, factory transportFactory) (auth.Authenticatee, error) { ip := callback.NewInterprocess() if err := handler.Handle(ip); err != nil { return nil, err } config := &authenticateeConfig{ client: ip.Client(), handler: handler, transport: factory.makeTransport(), } return auth.AuthenticateeFunc(func(ctx context.Context, handler callback.Handler) error { ctx, auth := newAuthenticatee(ctx, config) auth.authenticate(ctx, ip.Server()) select { case <-ctx.Done(): return auth.discard(ctx) case <-auth.done: return auth.err } }), nil } // Terminate the authentication process upon context cancellation; // only to be called if/when ctx.Done() has been signalled. func (self *authenticateeProcess) discard(ctx context.Context) error { err := ctx.Err() status := statusFrom(ctx) for ; status < _statusTerminal; status = (&self.status).get() { if self.terminate(status, statusDiscarded, err) { break } } return err } func newAuthenticatee(ctx context.Context, config *authenticateeConfig) (context.Context, *authenticateeProcess) { initialStatus := statusReady proc := &authenticateeProcess{ transport: config.transport, client: config.client, handler: config.handler, status: initialStatus, done: make(chan struct{}), } ctx = withStatus(ctx, initialStatus) err := proc.installHandlers(ctx) if err == nil { err = proc.startTransport() } if err != nil { proc.terminate(initialStatus, statusError, err) } return ctx, proc } func (self *authenticateeProcess) startTransport() error { if err := self.transport.Start(); err != nil { return err } else { go func() { // stop the authentication transport upon termination of the // authenticator process select { case <-self.done: log.V(2).Infof("stopping authenticator transport: %v", self.transport.UPID()) self.transport.Stop() } }() } return nil } // returns true when handlers are installed without error, otherwise terminates the // authentication process. func (self *authenticateeProcess) installHandlers(ctx context.Context) error { type handlerFn func(ctx context.Context, from *upid.UPID, pbMsg proto.Message) withContext := func(f handlerFn) messenger.MessageHandler { return func(from *upid.UPID, m proto.Message) { status := (&self.status).get() if self.from != nil && !self.from.Equal(from) { self.terminate(status, statusError, UnexpectedAuthenticatorPid) } else { f(withStatus(ctx, status), from, m) } } } // Anticipate mechanisms and steps from the server handlers := []struct { f handlerFn m proto.Message }{ {self.mechanisms, &mesos.AuthenticationMechanismsMessage{}}, {self.step, &mesos.AuthenticationStepMessage{}}, {self.completed, &mesos.AuthenticationCompletedMessage{}}, {self.failed, &mesos.AuthenticationFailedMessage{}}, {self.errored, &mesos.AuthenticationErrorMessage{}}, } for _, h := range handlers { if err := self.transport.Install(withContext(h.f), h.m); err != nil { return err } } return nil } // return true if the authentication status was updated (if true, self.done will have been closed) func (self *authenticateeProcess) terminate(old, new statusType, err error) bool { if (&self.status).swap(old, new) { self.err = err if self.mech != nil { self.mech.Discard() } close(self.done) return true } return false } func (self *authenticateeProcess) authenticate(ctx context.Context, pid upid.UPID) { status := statusFrom(ctx) if status != statusReady { return } message := &mesos.AuthenticateMessage{ Pid: proto.String(self.client.String()), } if err := self.transport.Send(ctx, &pid, message); err != nil { self.terminate(status, statusError, err) } else { (&self.status).swap(status, statusStarting) } } func (self *authenticateeProcess) mechanisms(ctx context.Context, from *upid.UPID, pbMsg proto.Message) { status := statusFrom(ctx) if status != statusStarting { self.terminate(status, statusError, UnexpectedAuthenticationMechanisms) return } msg, ok := pbMsg.(*mesos.AuthenticationMechanismsMessage) if !ok { self.terminate(status, statusError, fmt.Errorf("Expected AuthenticationMechanismsMessage, not %T", pbMsg)) return } mechanisms := msg.GetMechanisms() log.Infof("Received SASL authentication mechanisms: %v", mechanisms) selectedMech, factory := mech.SelectSupported(mechanisms) if selectedMech == "" { self.terminate(status, statusError, UnsupportedMechanism) return } if m, f, err := factory(self.handler); err != nil { self.terminate(status, statusError, err) return } else { self.mech = m self.stepFn = f self.from = from } // execute initialization step... nextf, data, err := self.stepFn(self.mech, nil) if err != nil { self.terminate(status, statusError, err) return } else { self.stepFn = nextf } message := &mesos.AuthenticationStartMessage{ Mechanism: proto.String(selectedMech), Data: data, // may be nil, depends on init step } if err := self.transport.Send(ctx, from, message); err != nil { self.terminate(status, statusError, err) } else { (&self.status).swap(status, statusStepping) } } func (self *authenticateeProcess) step(ctx context.Context, from *upid.UPID, pbMsg proto.Message) { status := statusFrom(ctx) if status != statusStepping { self.terminate(status, statusError, UnexpectedAuthenticationStep) return } log.Info("Received SASL authentication step") msg, ok := pbMsg.(*mesos.AuthenticationStepMessage) if !ok { self.terminate(status, statusError, fmt.Errorf("Expected AuthenticationStepMessage, not %T", pbMsg)) return } input := msg.GetData() fn, output, err := self.stepFn(self.mech, input) if err != nil { self.terminate(status, statusError, fmt.Errorf("failed to perform authentication step: %v", err)) return } self.stepFn = fn // We don't start the client with SASL_SUCCESS_DATA so we may // need to send one more "empty" message to the server. message := &mesos.AuthenticationStepMessage{} if len(output) > 0 { message.Data = output } if err := self.transport.Send(ctx, from, message); err != nil { self.terminate(status, statusError, err) } } func (self *authenticateeProcess) completed(ctx context.Context, from *upid.UPID, pbMsg proto.Message) { status := statusFrom(ctx) if status != statusStepping { self.terminate(status, statusError, UnexpectedAuthenticationCompleted) return } log.Info("Authentication success") self.terminate(status, statusCompleted, nil) } func (self *authenticateeProcess) failed(ctx context.Context, from *upid.UPID, pbMsg proto.Message) { status := statusFrom(ctx) self.terminate(status, statusFailed, auth.AuthenticationFailed) } func (self *authenticateeProcess) errored(ctx context.Context, from *upid.UPID, pbMsg proto.Message) { var err error if msg, ok := pbMsg.(*mesos.AuthenticationErrorMessage); !ok { err = fmt.Errorf("Expected AuthenticationErrorMessage, not %T", pbMsg) } else { err = fmt.Errorf("Authentication error: %s", msg.GetError()) } status := statusFrom(ctx) self.terminate(status, statusError, err) } mesos-go-0.0.1/auth/sasl/authenticatee_test.go000066400000000000000000000054611257601144100213640ustar00rootroot00000000000000package sasl import ( "testing" "time" "github.com/gogo/protobuf/proto" "github.com/mesos/mesos-go/auth/callback" "github.com/mesos/mesos-go/auth/sasl/mech/crammd5" mesos "github.com/mesos/mesos-go/mesosproto" "github.com/mesos/mesos-go/messenger" "github.com/mesos/mesos-go/upid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "golang.org/x/net/context" ) type MockTransport struct { *messenger.MockedMessenger } func (m *MockTransport) Send(ctx context.Context, upid *upid.UPID, msg proto.Message) error { return m.Called(mock.Anything, upid, msg).Error(0) } func TestAuthticatee_validLogin(t *testing.T) { assert := assert.New(t) ctx := context.TODO() client := upid.UPID{ ID: "someFramework", Host: "b.net", Port: "789", } server := upid.UPID{ ID: "serv", Host: "a.com", Port: "123", } tpid := upid.UPID{ ID: "sasl_transport", Host: "g.org", Port: "456", } handler := callback.HandlerFunc(func(cb ...callback.Interface) error { for _, c := range cb { switch c := c.(type) { case *callback.Name: c.Set("foo") case *callback.Password: c.Set([]byte("bar")) case *callback.Interprocess: c.Set(server, client) default: return &callback.Unsupported{Callback: c} } } return nil }) var transport *MockTransport factory := transportFactoryFunc(func() messenger.Messenger { transport = &MockTransport{messenger.NewMockedMessenger()} transport.On("Install").Return(nil) transport.On("UPID").Return(&tpid) transport.On("Start").Return(nil) transport.On("Stop").Return(nil) mechMsg := make(chan struct{}) stepMsg := make(chan struct{}) transport.On("Send", mock.Anything, &server, &mesos.AuthenticateMessage{ Pid: proto.String(client.String()), }).Return(nil).Run(func(_ mock.Arguments) { defer close(mechMsg) transport.Recv(&server, &mesos.AuthenticationMechanismsMessage{ Mechanisms: []string{crammd5.Name}, }) }).Once() transport.On("Send", mock.Anything, &server, &mesos.AuthenticationStartMessage{ Mechanism: proto.String(crammd5.Name), }).Return(nil).Run(func(_ mock.Arguments) { defer close(stepMsg) <-mechMsg transport.Recv(&server, &mesos.AuthenticationStepMessage{ Data: []byte(`lsd;lfkgjs;dlfkgjs;dfklg`), }) }).Once() transport.On("Send", mock.Anything, &server, &mesos.AuthenticationStepMessage{ Data: []byte(`foo cc7fd96cd80123ea844a7dba29a594ed`), }).Return(nil).Run(func(_ mock.Arguments) { <-stepMsg transport.Recv(&server, &mesos.AuthenticationCompletedMessage{}) }).Once() return transport }) login, err := makeAuthenticatee(handler, factory) assert.Nil(err) err = login.Authenticate(ctx, handler) assert.Nil(err) assert.NotNil(transport) time.Sleep(1 * time.Second) // wait for the authenticator to shut down transport.AssertExpectations(t) } mesos-go-0.0.1/auth/sasl/context.go000066400000000000000000000016641257601144100171670ustar00rootroot00000000000000package sasl import ( "net" "golang.org/x/net/context" ) // unexported to prevent collisions with context keys defined in // other packages. type _key int // If this package defined other context keys, they would have // different integer values. const ( statusKey _key = iota bindingAddressKey // bind address for login-related network ops ) func withStatus(ctx context.Context, s statusType) context.Context { return context.WithValue(ctx, statusKey, s) } func statusFrom(ctx context.Context) statusType { s, ok := ctx.Value(statusKey).(statusType) if !ok { panic("missing status in context") } return s } func WithBindingAddress(ctx context.Context, address net.IP) context.Context { return context.WithValue(ctx, bindingAddressKey, address) } func BindingAddressFrom(ctx context.Context) net.IP { obj := ctx.Value(bindingAddressKey) if addr, ok := obj.(net.IP); ok { return addr } else { return nil } } mesos-go-0.0.1/auth/sasl/mech/000077500000000000000000000000001257601144100160615ustar00rootroot00000000000000mesos-go-0.0.1/auth/sasl/mech/crammd5/000077500000000000000000000000001257601144100174115ustar00rootroot00000000000000mesos-go-0.0.1/auth/sasl/mech/crammd5/mechanism.go000066400000000000000000000033541257601144100217110ustar00rootroot00000000000000package crammd5 import ( "crypto/hmac" "crypto/md5" "encoding/hex" "errors" "io" log "github.com/golang/glog" "github.com/mesos/mesos-go/auth/callback" "github.com/mesos/mesos-go/auth/sasl/mech" ) var ( Name = "CRAM-MD5" // name this mechanism is registered with //TODO(jdef) is this a generic SASL error? if so, move it up to mech challengeDataRequired = errors.New("challenge data may not be empty") ) func init() { mech.Register(Name, newInstance) } type mechanism struct { handler callback.Handler } func (m *mechanism) Handler() callback.Handler { return m.handler } func (m *mechanism) Discard() { // noop } func newInstance(h callback.Handler) (mech.Interface, mech.StepFunc, error) { m := &mechanism{ handler: h, } fn := func(m mech.Interface, data []byte) (mech.StepFunc, []byte, error) { // noop: no initialization needed return challengeResponse, nil, nil } return m, fn, nil } // algorithm lifted from wikipedia: http://en.wikipedia.org/wiki/CRAM-MD5 // except that the SASL mechanism used by Mesos doesn't leverage base64 encoding func challengeResponse(m mech.Interface, data []byte) (mech.StepFunc, []byte, error) { if len(data) == 0 { return mech.IllegalState, nil, challengeDataRequired } decoded := string(data) log.V(4).Infof("challenge(decoded): %s", decoded) // for deep debugging only username := callback.NewName() secret := callback.NewPassword() if err := m.Handler().Handle(username, secret); err != nil { return mech.IllegalState, nil, err } hash := hmac.New(md5.New, secret.Get()) if _, err := io.WriteString(hash, decoded); err != nil { return mech.IllegalState, nil, err } codes := hex.EncodeToString(hash.Sum(nil)) msg := username.Get() + " " + codes return nil, []byte(msg), nil } mesos-go-0.0.1/auth/sasl/mech/interface.go000066400000000000000000000022231257601144100203470ustar00rootroot00000000000000package mech import ( "errors" "github.com/mesos/mesos-go/auth/callback" ) var ( IllegalStateErr = errors.New("illegal mechanism state") ) type Interface interface { Handler() callback.Handler Discard() // clean up resources or sensitive information; idempotent } // return a mechanism and it's initialization step (may be a noop that returns // a nil data blob and handle to the first "real" challenge step). type Factory func(h callback.Handler) (Interface, StepFunc, error) // StepFunc implementations should never return a nil StepFunc result. This // helps keep the logic in the SASL authticatee simpler: step functions are // never nil. Mechanisms that end up an error state (for example, some decoding // logic fails...) should return a StepFunc that represents an error state. // Some mechanisms may be able to recover from such. type StepFunc func(m Interface, data []byte) (StepFunc, []byte, error) // reflects an unrecoverable, illegal mechanism state; always returns IllegalState // as the next step along with an IllegalStateErr func IllegalState(m Interface, data []byte) (StepFunc, []byte, error) { return IllegalState, nil, IllegalStateErr } mesos-go-0.0.1/auth/sasl/mech/plugins.go000066400000000000000000000015451257601144100200760ustar00rootroot00000000000000package mech import ( "fmt" "sync" log "github.com/golang/glog" ) var ( mechLock sync.Mutex supportedMechs = make(map[string]Factory) ) func Register(name string, f Factory) error { mechLock.Lock() defer mechLock.Unlock() if _, found := supportedMechs[name]; found { return fmt.Errorf("Mechanism registered twice: %s", name) } supportedMechs[name] = f log.V(1).Infof("Registered mechanism %s", name) return nil } func ListSupported() (list []string) { mechLock.Lock() defer mechLock.Unlock() for mechname := range supportedMechs { list = append(list, mechname) } return list } func SelectSupported(mechanisms []string) (selectedMech string, factory Factory) { mechLock.Lock() defer mechLock.Unlock() for _, m := range mechanisms { if f, ok := supportedMechs[m]; ok { selectedMech = m factory = f break } } return } mesos-go-0.0.1/detector/000077500000000000000000000000001257601144100150535ustar00rootroot00000000000000mesos-go-0.0.1/detector/doc.go000066400000000000000000000020071257601144100161460ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ /* The detector package houses implementation of master detectors. The default implementation is the zookeeper master detector. It uses zookeeper to detect the lead Mesos master during startup/failover. */ package detector mesos-go-0.0.1/detector/factory.go000066400000000000000000000104701257601144100170530ustar00rootroot00000000000000package detector import ( "encoding/binary" "errors" "fmt" "io/ioutil" "net" "strconv" "strings" "sync" "github.com/gogo/protobuf/proto" log "github.com/golang/glog" mesos "github.com/mesos/mesos-go/mesosproto" util "github.com/mesos/mesos-go/mesosutil" "github.com/mesos/mesos-go/upid" ) var ( pluginLock sync.Mutex plugins = map[string]PluginFactory{} EmptySpecError = errors.New("empty master specification") defaultFactory = PluginFactory(func(spec string) (Master, error) { if len(spec) == 0 { return nil, EmptySpecError } if strings.Index(spec, "@") < 0 { spec = "master@" + spec } if pid, err := upid.Parse(spec); err == nil { return NewStandalone(CreateMasterInfo(pid)), nil } else { return nil, err } }) ) type PluginFactory func(string) (Master, error) // associates a plugin implementation with a Master specification prefix. // packages that provide plugins are expected to invoke this func within // their init() implementation. schedulers that wish to support plugins may // anonymously import ("_") a package the auto-registers said plugins. func Register(prefix string, f PluginFactory) error { if prefix == "" { return fmt.Errorf("illegal prefix: '%v'", prefix) } if f == nil { return fmt.Errorf("nil plugin factories are not allowed") } pluginLock.Lock() defer pluginLock.Unlock() if _, found := plugins[prefix]; found { return fmt.Errorf("detection plugin already registered for prefix '%s'", prefix) } plugins[prefix] = f return nil } // Create a new detector given the provided specification. Examples are: // // - file://{path_to_local_file} // - {ipaddress}:{port} // - master@{ip_address}:{port} // - master({id})@{ip_address}:{port} // // Support for the file:// prefix is intentionally hardcoded so that it may // not be inadvertently overridden by a custom plugin implementation. Custom // plugins are supported via the Register and MatchingPlugin funcs. // // Furthermore it is expected that master detectors returned from this func // are not yet running and will only begin to spawn requisite background // processing upon, or some time after, the first invocation of their Detect. // func New(spec string) (m Master, err error) { if strings.HasPrefix(spec, "file://") { var body []byte path := spec[7:] body, err = ioutil.ReadFile(path) if err != nil { log.V(1).Infof("failed to read from file at '%s'", path) } else { m, err = New(string(body)) } } else if f, ok := MatchingPlugin(spec); ok { m, err = f(spec) } else { m, err = defaultFactory(spec) } return } func MatchingPlugin(spec string) (PluginFactory, bool) { pluginLock.Lock() defer pluginLock.Unlock() for prefix, f := range plugins { if strings.HasPrefix(spec, prefix) { return f, true } } return nil, false } // Super-useful utility func that attempts to build a mesos.MasterInfo from a // upid.UPID specification. An attempt is made to determine the IP address of // the UPID's Host and any errors during such resolution will result in a nil // returned result. A nil result is also returned upon errors parsing the Port // specification of the UPID. // // TODO(jdef) make this a func of upid.UPID so that callers can invoke somePid.MasterInfo()? // func CreateMasterInfo(pid *upid.UPID) *mesos.MasterInfo { if pid == nil { return nil } port, err := strconv.Atoi(pid.Port) if err != nil { log.Errorf("failed to parse port: %v", err) return nil } //TODO(jdef) what about (future) ipv6 support? var ipv4 net.IP if ipv4 = net.ParseIP(pid.Host); ipv4 != nil { // This is needed for the people cross-compiling from macos to linux. // The cross-compiled version of net.LookupIP() fails to handle plain IPs. // See https://github.com/mesos/mesos-go/pull/117 } else if addrs, err := net.LookupIP(pid.Host); err == nil { for _, ip := range addrs { if ip = ip.To4(); ip != nil { ipv4 = ip break } } if ipv4 == nil { log.Errorf("host does not resolve to an IPv4 address: %v", pid.Host) return nil } } else { log.Errorf("failed to lookup IPs for host '%v': %v", pid.Host, err) return nil } packedip := binary.BigEndian.Uint32(ipv4) // network byte order is big-endian mi := util.NewMasterInfo(pid.ID, packedip, uint32(port)) mi.Pid = proto.String(pid.String()) if pid.Host != "" { mi.Hostname = proto.String(pid.Host) } return mi } mesos-go-0.0.1/detector/factory_test.go000066400000000000000000000025641257601144100201170ustar00rootroot00000000000000package detector import ( "testing" "github.com/stretchr/testify/assert" ) type testDetector string func (d testDetector) Start() error { return nil } func (d testDetector) Detect(f MasterChanged) error { return nil } func (d testDetector) Done() <-chan struct{} { return make(<-chan struct{}) } func (d testDetector) Cancel() {} // unregister a factory plugin according to its prefix. // this is part of the testing module on purpose: during normal execution there // should be no need to dynamically unregister plugins. func Unregister(prefix string) { pluginLock.Lock() defer pluginLock.Unlock() delete(plugins, prefix) } func TestDetectorFactoryRegister(t *testing.T) { prefix := "bbm:" Register(prefix, func(spec string) (Master, error) { return testDetector("Hello!"), nil }) defer Unregister(prefix) f, ok := MatchingPlugin(prefix) assert.True(t, ok) assert.NotNil(t, f) } func TestDectorFactoryNew_EmptySpec(t *testing.T) { assert := assert.New(t) m, err := New("") assert.NotNil(err) assert.Nil(m) } func TestDectorFactoryNew_InvalidSpec(t *testing.T) { assert := assert.New(t) m, err := New("localhost") assert.NotNil(err) assert.Nil(m) } func TestDectorFactoryNew_TrivialSpec(t *testing.T) { assert := assert.New(t) m, err := New("localhost:1") assert.NoError(err) assert.NotNil(m) assert.IsType(&Standalone{}, m) } mesos-go-0.0.1/detector/interface.go000066400000000000000000000050201257601144100173370ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 detector import ( mesos "github.com/mesos/mesos-go/mesosproto" ) type MasterChanged interface { // Invoked when the master changes OnMasterChanged(*mesos.MasterInfo) } // AllMasters defines an optional interface that, if implemented by the same // struct as implements MasterChanged, will receive an additional callbacks // independently of leadership changes. it's possible that, as a result of a // leadership change, both the OnMasterChanged and UpdatedMasters callbacks // would be invoked. // // **NOTE:** Detector implementations are not required to support this optional // interface. Please RTFM of the detector implementation that you want to use. type AllMasters interface { // UpdatedMasters is invoked upon a change in the membership of mesos // masters, and is useful to clients that wish to know the entire set // of Mesos masters currently running. UpdatedMasters([]*mesos.MasterInfo) } // func/interface adapter type OnMasterChanged func(*mesos.MasterInfo) func (f OnMasterChanged) OnMasterChanged(mi *mesos.MasterInfo) { f(mi) } // An abstraction of a Master detector which can be used to // detect the leading master from a group. type Master interface { // Detect new master election. Every time a new master is elected, the // detector will alert the observer. The first call to Detect is expected // to kickstart any background detection processing (and not before then). // If detection startup fails, or the listener cannot be added, then an // error is returned. Detect(MasterChanged) error // returns a chan that, when closed, indicates the detector has terminated Done() <-chan struct{} // cancel the detector. it's ok to call this multiple times, or even if // Detect() hasn't been invoked yet. Cancel() } mesos-go-0.0.1/detector/standalone.go000066400000000000000000000147141257601144100175410ustar00rootroot00000000000000package detector import ( "encoding/binary" "encoding/json" "fmt" "io/ioutil" "net" "net/http" "strconv" "sync" "time" log "github.com/golang/glog" mesos "github.com/mesos/mesos-go/mesosproto" "github.com/mesos/mesos-go/upid" "golang.org/x/net/context" ) const ( defaultMesosHttpClientTimeout = 10 * time.Second //TODO(jdef) configurable via fiag? defaultMesosLeaderSyncInterval = 30 * time.Second //TODO(jdef) configurable via fiag? defaultMesosMasterPort = 5050 ) // enables easier unit testing type fetcherFunc func(ctx context.Context, address string) (*upid.UPID, error) type Standalone struct { ch chan *mesos.MasterInfo client *http.Client tr *http.Transport pollOnce sync.Once initial *mesos.MasterInfo done chan struct{} cancelOnce sync.Once leaderSyncInterval time.Duration httpClientTimeout time.Duration assumedMasterPort int poller func(pf fetcherFunc) fetchPid fetcherFunc } // Create a new stand alone master detector. func NewStandalone(mi *mesos.MasterInfo) *Standalone { log.V(2).Infof("creating new standalone detector for %+v", mi) stand := &Standalone{ ch: make(chan *mesos.MasterInfo), tr: &http.Transport{}, initial: mi, done: make(chan struct{}), leaderSyncInterval: defaultMesosLeaderSyncInterval, httpClientTimeout: defaultMesosHttpClientTimeout, assumedMasterPort: defaultMesosMasterPort, } stand.poller = stand._poller stand.fetchPid = stand._fetchPid return stand } func (s *Standalone) String() string { return fmt.Sprintf("{initial: %+v}", s.initial) } // Detecting the new master. func (s *Standalone) Detect(o MasterChanged) error { log.V(2).Info("Detect()") s.pollOnce.Do(func() { log.V(1).Info("spinning up asyc master detector poller") // delayed initialization allows unit tests to modify timeouts before detection starts s.client = &http.Client{ Transport: s.tr, Timeout: s.httpClientTimeout, } go s.poller(s.fetchPid) }) if o != nil { log.V(1).Info("spawning asyc master detector listener") go func() { log.V(2).Infof("waiting for polled to send updates") pollWaiter: for { select { case mi, ok := <-s.ch: if !ok { break pollWaiter } log.V(1).Infof("detected master change: %+v", mi) o.OnMasterChanged(mi) case <-s.done: return } } o.OnMasterChanged(nil) }() } else { log.Warningf("detect called with a nil master change listener") } return nil } func (s *Standalone) Done() <-chan struct{} { return s.done } func (s *Standalone) Cancel() { s.cancelOnce.Do(func() { close(s.done) }) } // poll for changes to master leadership via current leader's /state.json endpoint. // we poll the `initial` leader, aborting if none was specified. // // TODO(jdef) follow the leader: change who we poll based on the prior leader // TODO(jdef) somehow determine all masters in cluster from the state.json? // func (s *Standalone) _poller(pf fetcherFunc) { defer func() { defer s.Cancel() log.Warning("shutting down standalone master detection") }() if s.initial == nil { log.Errorf("aborting master poller since initial master info is nil") return } addr := s.initial.GetHostname() if len(addr) == 0 { if s.initial.GetIp() == 0 { log.Warningf("aborted mater poller since initial master info has no host") return } ip := make([]byte, 4) binary.BigEndian.PutUint32(ip, s.initial.GetIp()) addr = net.IP(ip).To4().String() } port := uint32(s.assumedMasterPort) if s.initial.Port != nil && *s.initial.Port != 0 { port = *s.initial.Port } addr = net.JoinHostPort(addr, strconv.Itoa(int(port))) log.V(1).Infof("polling for master leadership at '%v'", addr) var lastpid *upid.UPID for { startedAt := time.Now() ctx, cancel := context.WithTimeout(context.Background(), s.leaderSyncInterval) if pid, err := pf(ctx, addr); err == nil { if !pid.Equal(lastpid) { log.V(2).Infof("detected leadership change from '%v' to '%v'", lastpid, pid) lastpid = pid elapsed := time.Now().Sub(startedAt) mi := CreateMasterInfo(pid) select { case s.ch <- mi: // noop case <-time.After(s.leaderSyncInterval - elapsed): // no one heard the master change, oh well - poll again goto continuePolling case <-s.done: cancel() return } } else { log.V(2).Infof("no change to master leadership: '%v'", lastpid) } } else if err == context.DeadlineExceeded { if lastpid != nil { lastpid = nil select { case s.ch <- nil: // lost master case <-s.done: // no need to cancel ctx return } } goto continuePolling } else { select { case <-s.done: cancel() return default: if err != context.Canceled { log.Error(err) } } } if remaining := s.leaderSyncInterval - time.Now().Sub(startedAt); remaining > 0 { log.V(3).Infof("master leader poller sleeping for %v", remaining) time.Sleep(remaining) } continuePolling: cancel() } } // assumes that address is in host:port format func (s *Standalone) _fetchPid(ctx context.Context, address string) (*upid.UPID, error) { //TODO(jdef) need SSL support uri := fmt.Sprintf("http://%s/state.json", address) req, err := http.NewRequest("GET", uri, nil) if err != nil { return nil, err } var pid *upid.UPID err = s.httpDo(ctx, req, func(res *http.Response, err error) error { if err != nil { return err } defer res.Body.Close() if res.StatusCode != 200 { return fmt.Errorf("HTTP request failed with code %d: %v", res.StatusCode, res.Status) } blob, err1 := ioutil.ReadAll(res.Body) if err1 != nil { return err1 } log.V(3).Infof("Got mesos state, content length %v", len(blob)) type State struct { Leader string `json:"leader"` // ex: master(1)@10.22.211.18:5050 } state := &State{} err = json.Unmarshal(blob, state) if err != nil { return err } pid, err = upid.Parse(state.Leader) return err }) return pid, err } type responseHandler func(*http.Response, error) error // hacked from https://blog.golang.org/context func (s *Standalone) httpDo(ctx context.Context, req *http.Request, f responseHandler) error { // Run the HTTP request in a goroutine and pass the response to f. ch := make(chan error, 1) go func() { ch <- f(s.client.Do(req)) }() select { case <-ctx.Done(): s.tr.CancelRequest(req) <-ch // Wait for f to return. return ctx.Err() case err := <-ch: return err } } mesos-go-0.0.1/detector/standalone_test.go000066400000000000000000000101311257601144100205650ustar00rootroot00000000000000package detector import ( "sync" "testing" "time" "github.com/gogo/protobuf/proto" mesos "github.com/mesos/mesos-go/mesosproto" "github.com/mesos/mesos-go/upid" "github.com/stretchr/testify/assert" "golang.org/x/net/context" ) const ( localhost = uint32(2130706433) // packed uint32 for 127.0.0.1 IPv4 ) func TestStandalone_nil(t *testing.T) { d := NewStandalone(nil) select { case <-d.Done(): // expected t.Fatalf("expected detector to stay alive since we haven't done anything with it") case <-time.After(500 * time.Millisecond): } d.Detect(nil) select { case <-d.Done(): // expected case <-time.After(1 * time.Second): t.Fatalf("expected detector to shutdown since it has no master") } } func TestStandalone_pollerIncompleteInfo(t *testing.T) { d := NewStandalone(&mesos.MasterInfo{}) f := fetcherFunc(func(context.Context, string) (*upid.UPID, error) { return nil, nil }) ch := make(chan struct{}) go func() { defer close(ch) d.poller(f) }() select { case <-ch: // expected case <-time.After(1 * time.Second): t.Fatalf("expected poller to shutdown since master info is incomplete") } select { case <-d.Done(): // expected case <-time.After(1 * time.Second): t.Fatalf("expected detector to shutdown since it has no master") } } func TestStandalone_pollerFetched(t *testing.T) { assert := assert.New(t) // presence of IP address allows fecher to be called d := NewStandalone(&mesos.MasterInfo{Ip: proto.Uint32(localhost)}) defer d.Cancel() fetched := make(chan struct{}) pid := &upid.UPID{ ID: "foo@127.0.0.1:5050", Host: "127.0.0.1", Port: "5050", } f := fetcherFunc(func(ctx context.Context, addr string) (*upid.UPID, error) { defer close(fetched) assert.Equal("127.0.0.1:5050", addr) return pid, nil }) go d.poller(f) // fetch called select { case <-fetched: // expected case <-time.After(1 * time.Second): t.Fatalf("expected fetch") } // read MasterInfo select { case mi := <-d.ch: assert.Equal(mi, CreateMasterInfo(pid)) case <-time.After(1 * time.Second): t.Fatalf("expected poller to send master info") } } func TestStandalone_pollerFetchedMulti(t *testing.T) { assert := assert.New(t) // presence of IP address allows fecher to be called d := NewStandalone(&mesos.MasterInfo{Ip: proto.Uint32(localhost)}) defer d.Cancel() d.leaderSyncInterval = 500 * time.Millisecond i := 0 var wg sync.WaitGroup wg.Add(4) f := fetcherFunc(func(ctx context.Context, addr string) (*upid.UPID, error) { defer func() { i++ }() switch i { case 0: wg.Done() assert.Equal("127.0.0.1:5050", addr) return &upid.UPID{ID: "foo@127.0.0.1:5050", Host: "127.0.0.1", Port: "5050"}, nil case 1: wg.Done() assert.Equal("127.0.0.1:5050", addr) return &upid.UPID{ID: "foo@127.0.0.2:5050", Host: "127.0.0.2", Port: "5050"}, nil case 2: wg.Done() return nil, context.DeadlineExceeded case 3: wg.Done() assert.Equal("127.0.0.1:5050", addr) return &upid.UPID{ID: "foo@127.0.0.3:5050", Host: "127.0.0.3", Port: "5050"}, nil default: d.Cancel() return nil, context.Canceled } }) go d.poller(f) // fetches complete ch := make(chan struct{}) go func() { defer close(ch) wg.Wait() }() changed := make(chan struct{}) go func() { defer close(changed) for i := 0; i < 4; i++ { if mi, ok := <-d.ch; !ok { t.Fatalf("failed to read master info on cycle %v", i) break } else { switch i { case 0: assert.Equal(CreateMasterInfo(&upid.UPID{ID: "foo@127.0.0.1:5050", Host: "127.0.0.1", Port: "5050"}), mi) case 1: assert.Equal(CreateMasterInfo(&upid.UPID{ID: "foo@127.0.0.2:5050", Host: "127.0.0.2", Port: "5050"}), mi) case 2: assert.Nil(mi) case 3: assert.Equal(CreateMasterInfo(&upid.UPID{ID: "foo@127.0.0.3:5050", Host: "127.0.0.3", Port: "5050"}), mi) } } } }() started := time.Now() select { case <-ch: // expected case <-time.After(3 * time.Second): t.Fatalf("expected fetches all complete") } select { case <-changed: // expected case <-time.After((3 * time.Second) - time.Now().Sub(started)): t.Fatalf("expected to have received all master info changes") } } mesos-go-0.0.1/detector/zoo/000077500000000000000000000000001257601144100156625ustar00rootroot00000000000000mesos-go-0.0.1/detector/zoo/client2.go000066400000000000000000000031421257601144100175510ustar00rootroot00000000000000package zoo import ( "sync" "time" "github.com/samuel/go-zookeeper/zk" ) const ( defaultSessionTimeout = 60 * time.Second currentPath = "." ) var zkSessionTimeout = defaultSessionTimeout type client2 struct { *zk.Conn path string done chan struct{} // signal chan, closes when the underlying connection terminates stopOnce sync.Once } func connect2(hosts []string, path string) (*client2, error) { c, ev, err := zk.Connect(hosts, zkSessionTimeout) if err != nil { return nil, err } done := make(chan struct{}) go func() { // close the 'done' chan when the zk event chan closes (signals termination of zk connection) defer close(done) for { if _, ok := <-ev; !ok { return } } }() return &client2{ Conn: c, path: path, done: done, }, nil } func (c *client2) stopped() <-chan struct{} { return c.done } func (c *client2) stop() { c.stopOnce.Do(c.Close) } func (c *client2) data(path string) (data []byte, err error) { data, _, err = c.Get(path) return } func (c *client2) watchChildren(path string) (string, <-chan []string, <-chan error) { errCh := make(chan error, 1) snap := make(chan []string) watchPath := c.path if path != "" && path != currentPath { watchPath = watchPath + path } go func() { defer close(errCh) for { children, _, ev, err := c.ChildrenW(watchPath) if err != nil { errCh <- err return } select { case snap <- children: case <-c.done: return } e := <-ev // wait for the next watch-related event if e.Err != nil { errCh <- err return } } }() return watchPath, snap, errCh } mesos-go-0.0.1/detector/zoo/detect.go000066400000000000000000000252611257601144100174670ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 zoo import ( "encoding/json" "fmt" "math" "net/url" "strconv" "strings" "sync" "sync/atomic" "time" "github.com/gogo/protobuf/proto" log "github.com/golang/glog" "github.com/mesos/mesos-go/detector" mesos "github.com/mesos/mesos-go/mesosproto" ) const ( // prefix for nodes listed at the ZK URL path nodePrefix = "info_" nodeJSONPrefix = "json.info_" defaultMinDetectorCyclePeriod = 1 * time.Second ) // reasonable default for a noop change listener var ignoreChanged = detector.OnMasterChanged(func(*mesos.MasterInfo) {}) type zkInterface interface { stopped() <-chan struct{} stop() data(string) ([]byte, error) watchChildren(string) (string, <-chan []string, <-chan error) } type infoCodec func(path, node string) (*mesos.MasterInfo, error) // Detector uses ZooKeeper to detect new leading master. type MasterDetector struct { client zkInterface leaderNode string bootstrapLock sync.RWMutex // guard against concurrent invocations of bootstrapFunc bootstrapFunc func() error // for one-time zk client initiation // latch: only install, at most, one ignoreChanged listener; see MasterDetector.Detect ignoreInstalled int32 // detection should not signal master change listeners more frequently than this minDetectorCyclePeriod time.Duration done chan struct{} cancel func() } // Internal constructor function func NewMasterDetector(zkurls string) (*MasterDetector, error) { zkHosts, zkPath, err := parseZk(zkurls) if err != nil { log.Fatalln("Failed to parse url", err) return nil, err } detector := &MasterDetector{ minDetectorCyclePeriod: defaultMinDetectorCyclePeriod, done: make(chan struct{}), cancel: func() {}, } detector.bootstrapFunc = func() (err error) { if detector.client == nil { detector.client, err = connect2(zkHosts, zkPath) } return } log.V(2).Infoln("Created new detector to watch", zkHosts, zkPath) return detector, nil } func parseZk(zkurls string) ([]string, string, error) { u, err := url.Parse(zkurls) if err != nil { log.V(1).Infof("failed to parse url: %v", err) return nil, "", err } if u.Scheme != "zk" { return nil, "", fmt.Errorf("invalid url scheme for zk url: '%v'", u.Scheme) } return strings.Split(u.Host, ","), u.Path, nil } // returns a chan that, when closed, indicates termination of the detector func (md *MasterDetector) Done() <-chan struct{} { return md.done } func (md *MasterDetector) Cancel() { md.bootstrapLock.RLock() defer md.bootstrapLock.RUnlock() md.cancel() } func (md *MasterDetector) childrenChanged(path string, list []string, obs detector.MasterChanged) { md.notifyMasterChanged(path, list, obs) md.notifyAllMasters(path, list, obs) } func (md *MasterDetector) notifyMasterChanged(path string, list []string, obs detector.MasterChanged) { // mesos v0.24 writes JSON only, v0.23 writes json and protobuf, v0.22 and prior only write protobuf topNode, codec := md.selectTopNode(list) if md.leaderNode == topNode { log.V(2).Infof("ignoring children-changed event, leader has not changed: %v", path) return } log.V(2).Infof("changing leader node from %q -> %q", md.leaderNode, topNode) md.leaderNode = topNode var masterInfo *mesos.MasterInfo if md.leaderNode != "" { var err error if masterInfo, err = codec(path, topNode); err != nil { log.Errorln(err.Error()) } } log.V(2).Infof("detected master info: %+v", masterInfo) logPanic(func() { obs.OnMasterChanged(masterInfo) }) } // logPanic safely executes the given func, recovering from and logging a panic if one occurs. func logPanic(f func()) { defer func() { if r := recover(); r != nil { log.Errorf("recovered from client panic: %v", r) } }() f() } func (md *MasterDetector) pullMasterInfo(path, node string) (*mesos.MasterInfo, error) { data, err := md.client.data(fmt.Sprintf("%s/%s", path, node)) if err != nil { return nil, fmt.Errorf("failed to retrieve leader data: %v", err) } masterInfo := &mesos.MasterInfo{} err = proto.Unmarshal(data, masterInfo) if err != nil { return nil, fmt.Errorf("failed to unmarshal protobuf MasterInfo data from zookeeper: %v", err) } return masterInfo, nil } func (md *MasterDetector) pullMasterJsonInfo(path, node string) (*mesos.MasterInfo, error) { data, err := md.client.data(fmt.Sprintf("%s/%s", path, node)) if err != nil { return nil, fmt.Errorf("failed to retrieve leader data: %v", err) } masterInfo := &mesos.MasterInfo{} err = json.Unmarshal(data, masterInfo) if err != nil { return nil, fmt.Errorf("failed to unmarshal json MasterInfo data from zookeeper: %v", err) } return masterInfo, nil } func (md *MasterDetector) notifyAllMasters(path string, list []string, obs detector.MasterChanged) { all, ok := obs.(detector.AllMasters) if !ok { // not interested in entire master list return } // mesos v0.24 writes JSON only, v0.23 writes json and protobuf, v0.22 and prior only write protobuf masters := map[string]*mesos.MasterInfo{} tryStore := func(node string, codec infoCodec) { info, err := codec(path, node) if err != nil { log.Errorln(err.Error()) } else { masters[info.GetId()] = info } } for _, node := range list { // compare https://github.com/apache/mesos/blob/0.23.0/src/master/detector.cpp#L437 if strings.HasPrefix(node, nodePrefix) { tryStore(node, md.pullMasterInfo) } else if strings.HasPrefix(node, nodeJSONPrefix) { tryStore(node, md.pullMasterJsonInfo) } else { continue } } masterList := make([]*mesos.MasterInfo, 0, len(masters)) for _, v := range masters { masterList = append(masterList, v) } log.V(2).Infof("notifying of master membership change: %+v", masterList) logPanic(func() { all.UpdatedMasters(masterList) }) } func (md *MasterDetector) callBootstrap() (e error) { log.V(2).Infoln("invoking detector boostrap") md.bootstrapLock.Lock() defer md.bootstrapLock.Unlock() clientConfigured := md.client != nil if e = md.bootstrapFunc(); e == nil && !clientConfigured && md.client != nil { // chain the lifetime of this detector to that of the newly created client impl client := md.client md.cancel = client.stop go func() { defer close(md.done) <-client.stopped() }() } return } // the first call to Detect will kickstart a connection to zookeeper. a nil change listener may // be spec'd, result of which is a detector that will still listen for master changes and record // leaderhip changes internally but no listener would be notified. Detect may be called more than // once, and each time the spec'd listener will be added to the list of those receiving notifications. func (md *MasterDetector) Detect(f detector.MasterChanged) (err error) { // kickstart zk client connectivity if err := md.callBootstrap(); err != nil { log.V(3).Infoln("failed to execute bootstrap function", err.Error()) return err } if f == nil { // only ever install, at most, one ignoreChanged listener. multiple instances of it // just consume resources and generate misleading log messages. if !atomic.CompareAndSwapInt32(&md.ignoreInstalled, 0, 1) { log.V(3).Infoln("ignoreChanged listener already installed") return } f = ignoreChanged } log.V(3).Infoln("spawning detect()") go md.detect(f) return nil } func (md *MasterDetector) detect(f detector.MasterChanged) { log.V(3).Infoln("detecting children at", currentPath) detectLoop: for { select { case <-md.Done(): return default: } log.V(3).Infoln("watching children at", currentPath) path, childrenCh, errCh := md.client.watchChildren(currentPath) rewatch := false for { started := time.Now() select { case children := <-childrenCh: md.childrenChanged(path, children, f) case err, ok := <-errCh: // check for a tie first (required for predictability (tests)); the downside of // doing this is that a listener might get two callbacks back-to-back ("new leader", // followed by "no leader"). select { case children := <-childrenCh: md.childrenChanged(path, children, f) default: } if ok { log.V(1).Infoln("child watch ended with error, master lost; error was:", err.Error()) } else { // detector shutdown likely... log.V(1).Infoln("child watch ended, master lost") } select { case <-md.Done(): return default: if md.leaderNode != "" { log.V(2).Infof("changing leader node from %q -> \"\"", md.leaderNode) md.leaderNode = "" f.OnMasterChanged(nil) } } rewatch = true } // rate-limit master changes if elapsed := time.Now().Sub(started); elapsed > 0 { log.V(2).Infoln("resting before next detection cycle") select { case <-md.Done(): return case <-time.After(md.minDetectorCyclePeriod - elapsed): // noop } } if rewatch { continue detectLoop } } } } func (md *MasterDetector) selectTopNode(list []string) (topNode string, codec infoCodec) { // mesos v0.24 writes JSON only, v0.23 writes json and protobuf, v0.22 and prior only write protobuf topNode = selectTopNodePrefix(list, nodeJSONPrefix) codec = md.pullMasterJsonInfo if topNode == "" { topNode = selectTopNodePrefix(list, nodePrefix) codec = md.pullMasterInfo if topNode != "" { log.Warningf("Leading master is using a Protobuf binary format when registering "+ "with Zookeeper (%s): this will be deprecated as of Mesos 0.24 (see MESOS-2340).", topNode) } } return } func selectTopNodePrefix(list []string, pre string) (node string) { var leaderSeq uint64 = math.MaxUint64 for _, v := range list { if !strings.HasPrefix(v, pre) { continue // only care about participants } seqStr := strings.TrimPrefix(v, pre) seq, err := strconv.ParseUint(seqStr, 10, 64) if err != nil { log.Warningf("unexpected zk node format '%s': %v", seqStr, err) continue } if seq < leaderSeq { leaderSeq = seq node = v } } if node == "" { log.V(3).Infoln("No top node found.") } else { log.V(3).Infof("Top node selected: '%s'", node) } return node } mesos-go-0.0.1/detector/zoo/detect_test.go000066400000000000000000000364711257601144100205330ustar00rootroot00000000000000package zoo import ( "fmt" "sync" "testing" "time" "github.com/gogo/protobuf/proto" log "github.com/golang/glog" "github.com/mesos/mesos-go/detector" mesos "github.com/mesos/mesos-go/mesosproto" util "github.com/mesos/mesos-go/mesosutil" "github.com/samuel/go-zookeeper/zk" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) const ( zkurl = "zk://127.0.0.1:2181/mesos" zkurl_bad = "zk://127.0.0.1:2181" test_zk_path = "/test" ) func TestParseZk_single(t *testing.T) { hosts, path, err := parseZk(zkurl) assert.NoError(t, err) assert.Equal(t, 1, len(hosts)) assert.Equal(t, "/mesos", path) } func TestParseZk_multi(t *testing.T) { hosts, path, err := parseZk("zk://abc:1,def:2/foo") assert.NoError(t, err) assert.Equal(t, []string{"abc:1", "def:2"}, hosts) assert.Equal(t, "/foo", path) } func TestParseZk_multiIP(t *testing.T) { hosts, path, err := parseZk("zk://10.186.175.156:2181,10.47.50.94:2181,10.0.92.171:2181/mesos") assert.NoError(t, err) assert.Equal(t, []string{"10.186.175.156:2181", "10.47.50.94:2181", "10.0.92.171:2181"}, hosts) assert.Equal(t, "/mesos", path) } type mockZkClient struct { mock.Mock } func (m *mockZkClient) stopped() (a <-chan struct{}) { args := m.Called() if x := args.Get(0); x != nil { a = x.(<-chan struct{}) } return } func (m *mockZkClient) stop() { m.Called() } func (m *mockZkClient) data(path string) (a []byte, b error) { args := m.Called(path) if x := args.Get(0); x != nil { a = x.([]byte) } b = args.Error(1) return } func (m *mockZkClient) watchChildren(path string) (a string, b <-chan []string, c <-chan error) { args := m.Called(path) a = args.String(0) if x := args.Get(1); x != nil { b = x.(<-chan []string) } if x := args.Get(2); x != nil { c = x.(<-chan error) } return } // newMockZkClient returns a mocked implementation of zkInterface that implements expectations // for stop() and stopped(); multiple calls to stop() are safe. func newMockZkClient(initialChildren ...string) (mocked *mockZkClient, snaps chan []string, errs chan error) { var doneOnce sync.Once done := make(chan struct{}) mocked = &mockZkClient{} mocked.On("stop").Return().Run(func(_ mock.Arguments) { doneOnce.Do(func() { close(done) }) }) mocked.On("stopped").Return((<-chan struct{})(done)) if initialChildren != nil { errs = make(chan error) // this is purposefully unbuffered (some tests depend on this) snaps = make(chan []string, 1) snaps <- initialChildren[:] mocked.On("watchChildren", currentPath).Return( test_zk_path, (<-chan []string)(snaps), (<-chan error)(errs)).Run( func(_ mock.Arguments) { log.V(1).Infoln("watchChildren invoked") }) } return } func newTestMasterInfo(id int) []byte { miPb := util.NewMasterInfo(fmt.Sprintf("master(%d)@localhost:5050", id), 123456789, 400) data, err := proto.Marshal(miPb) if err != nil { panic(err) } return data } func TestMasterDetectorChildrenChanged(t *testing.T) { md, err := NewMasterDetector(zkurl) defer md.Cancel() assert.NoError(t, err) path := test_zk_path snapDetected := make(chan struct{}) md.bootstrapFunc = func() error { if md.client != nil { return nil } log.V(1).Infoln("bootstrapping detector") defer log.V(1).Infoln("bootstrapping detector ..finished") mocked, _, errs := newMockZkClient("info_0", "info_5", "info_10") md.client = mocked md.minDetectorCyclePeriod = 10 * time.Millisecond // we don't have all day! mocked.On("data", fmt.Sprintf("%s/info_0", path)).Return(newTestMasterInfo(0), nil) // wait for the first child snapshot to be processed before signaling end-of-watch // (which is signalled by closing errs). go func() { defer close(errs) select { case <-snapDetected: case <-md.Done(): t.Errorf("detector died before child snapshot") } }() return nil } called := 0 lostMaster := make(chan struct{}) const expectedLeader = "master(0)@localhost:5050" err = md.Detect(detector.OnMasterChanged(func(master *mesos.MasterInfo) { //expect 2 calls in sequence: the first setting a master //and the second clearing it switch called++; called { case 1: defer close(snapDetected) assert.NotNil(t, master) assert.Equal(t, expectedLeader, master.GetId()) case 2: md.Cancel() defer close(lostMaster) assert.Nil(t, master) default: t.Errorf("unexpected notification call attempt %d", called) } })) assert.NoError(t, err) fatalOn(t, 10*time.Second, lostMaster, "Waited too long for lost master") select { case <-md.Done(): assert.Equal(t, 2, called, "expected 2 detection callbacks instead of %d", called) case <-time.After(time.Second * 10): panic("Waited too long for detector shutdown...") } } // single connector instance, it's internal connection to zk is flappy func TestMasterDetectorFlappyConnectionState(t *testing.T) { md, err := NewMasterDetector(zkurl) defer md.Cancel() assert.NoError(t, err) const ITERATIONS = 3 var wg sync.WaitGroup wg.Add(1 + ITERATIONS) // +1 for the initial snapshot that's sent for the first watch path := test_zk_path md.bootstrapFunc = func() error { if md.client != nil { return nil } log.V(1).Infoln("bootstrapping detector") defer log.V(1).Infoln("bootstrapping detector ..finished") children := []string{"info_0", "info_5", "info_10"} mocked, snaps, errs := newMockZkClient(children...) md.client = mocked md.minDetectorCyclePeriod = 10 * time.Millisecond // we don't have all day! mocked.On("data", fmt.Sprintf("%s/info_0", path)).Return(newTestMasterInfo(0), nil) // the first snapshot will be sent immediately and the detector will be awaiting en event. // cycle through some connected/disconnected events but maintain the same snapshot go func() { defer close(errs) for attempt := 0; attempt < ITERATIONS; attempt++ { // send an error, should cause the detector to re-issue a watch errs <- zk.ErrSessionExpired // the detection loop issues another watch, so send it a snapshot.. // send another snapshot snaps <- children } }() return nil } called := 0 lostMaster := make(chan struct{}) const EXPECTED_CALLS = (ITERATIONS * 2) + 2 // +1 for initial snapshot, +1 for final lost-leader (close(errs)) err = md.Detect(detector.OnMasterChanged(func(master *mesos.MasterInfo) { called++ log.V(3).Infof("detector invoked: called %d", called) switch { case called < EXPECTED_CALLS: if master != nil { wg.Done() assert.Equal(t, master.GetId(), "master(0)@localhost:5050") } case called == EXPECTED_CALLS: md.Cancel() defer close(lostMaster) assert.Nil(t, master) default: t.Errorf("unexpected notification call attempt %d", called) } })) assert.NoError(t, err) fatalAfter(t, 10*time.Second, wg.Wait, "Waited too long for new-master alerts") fatalOn(t, 3*time.Second, lostMaster, "Waited too long for lost master") select { case <-md.Done(): assert.Equal(t, EXPECTED_CALLS, called, "expected %d detection callbacks instead of %d", EXPECTED_CALLS, called) case <-time.After(time.Second * 10): panic("Waited too long for detector shutdown...") } } func TestMasterDetector_multipleLeadershipChanges(t *testing.T) { md, err := NewMasterDetector(zkurl) defer md.Cancel() assert.NoError(t, err) leadershipChanges := [][]string{ {"info_014", "info_010", "info_005"}, {"info_005", "info_004", "info_022"}, {}, // indicates no master {"info_017", "info_099", "info_200"}, } ITERATIONS := len(leadershipChanges) // +1 for initial snapshot, +1 for final lost-leader (close(errs)) EXPECTED_CALLS := (ITERATIONS + 2) var wg sync.WaitGroup wg.Add(ITERATIONS) // +1 for the initial snapshot that's sent for the first watch, -1 because set 3 is empty path := test_zk_path md.bootstrapFunc = func() error { if md.client != nil { return nil } log.V(1).Infoln("bootstrapping detector") defer log.V(1).Infoln("bootstrapping detector ..finished") children := []string{"info_0", "info_5", "info_10"} mocked, snaps, errs := newMockZkClient(children...) md.client = mocked md.minDetectorCyclePeriod = 10 * time.Millisecond // we don't have all day! mocked.On("data", fmt.Sprintf("%s/info_0", path)).Return(newTestMasterInfo(0), nil) mocked.On("data", fmt.Sprintf("%s/info_005", path)).Return(newTestMasterInfo(5), nil) mocked.On("data", fmt.Sprintf("%s/info_004", path)).Return(newTestMasterInfo(4), nil) mocked.On("data", fmt.Sprintf("%s/info_017", path)).Return(newTestMasterInfo(17), nil) // the first snapshot will be sent immediately and the detector will be awaiting en event. // cycle through some connected/disconnected events but maintain the same snapshot go func() { defer close(errs) for attempt := 0; attempt < ITERATIONS; attempt++ { snaps <- leadershipChanges[attempt] } }() return nil } called := 0 lostMaster := make(chan struct{}) expectedLeaders := []int{0, 5, 4, 17} leaderIdx := 0 err = md.Detect(detector.OnMasterChanged(func(master *mesos.MasterInfo) { called++ log.V(3).Infof("detector invoked: called %d", called) switch { case called < EXPECTED_CALLS: if master != nil { expectedLeader := fmt.Sprintf("master(%d)@localhost:5050", expectedLeaders[leaderIdx]) assert.Equal(t, expectedLeader, master.GetId()) leaderIdx++ wg.Done() } case called == EXPECTED_CALLS: md.Cancel() defer close(lostMaster) assert.Nil(t, master) default: t.Errorf("unexpected notification call attempt %d", called) } })) assert.NoError(t, err) fatalAfter(t, 10*time.Second, wg.Wait, "Waited too long for new-master alerts") fatalOn(t, 3*time.Second, lostMaster, "Waited too long for lost master") select { case <-md.Done(): assert.Equal(t, EXPECTED_CALLS, called, "expected %d detection callbacks instead of %d", EXPECTED_CALLS, called) case <-time.After(time.Second * 10): panic("Waited too long for detector shutdown...") } } func TestMasterDetect_selectTopNode_none(t *testing.T) { assert := assert.New(t) nodeList := []string{} node := selectTopNodePrefix(nodeList, "foo") assert.Equal("", node) } func TestMasterDetect_selectTopNode_0000x(t *testing.T) { assert := assert.New(t) nodeList := []string{ "info_0000000046", "info_0000000032", "info_0000000058", "info_0000000061", "info_0000000008", } node := selectTopNodePrefix(nodeList, nodePrefix) assert.Equal("info_0000000008", node) } func TestMasterDetect_selectTopNode_mixJson(t *testing.T) { assert := assert.New(t) nodeList := []string{ nodePrefix + "0000000046", nodePrefix + "0000000032", nodeJSONPrefix + "0000000046", nodeJSONPrefix + "0000000032", } node := selectTopNodePrefix(nodeList, nodeJSONPrefix) assert.Equal(nodeJSONPrefix+"0000000032", node) node = selectTopNodePrefix(nodeList, nodePrefix) assert.Equal(nodePrefix+"0000000032", node) } func TestMasterDetect_selectTopNode_mixedEntries(t *testing.T) { assert := assert.New(t) nodeList := []string{ "info_0000000046", "info_0000000032", "foo_lskdjfglsdkfsdfgdfg", "info_0000000061", "log_replicas_fdgwsdfgsdf", "bar", } node := selectTopNodePrefix(nodeList, nodePrefix) assert.Equal("info_0000000032", node) } // implements MasterChanged and AllMasters extension type allMastersListener struct { mock.Mock } func (a *allMastersListener) OnMasterChanged(mi *mesos.MasterInfo) { a.Called(mi) } func (a *allMastersListener) UpdatedMasters(mi []*mesos.MasterInfo) { a.Called(mi) } func afterFunc(f func()) <-chan struct{} { ch := make(chan struct{}) go func() { defer close(ch) f() }() return ch } func fatalAfter(t *testing.T, d time.Duration, f func(), msg string, args ...interface{}) { fatalOn(t, d, afterFunc(f), msg, args...) } func fatalOn(t *testing.T, d time.Duration, ch <-chan struct{}, msg string, args ...interface{}) { select { case <-ch: return case <-time.After(d): // check for a tie select { case <-ch: return default: t.Fatalf(msg, args...) } } } /* TODO(jdef) refactor this to work with the new zkInterface func TestNotifyAllMasters(t *testing.T) { c, err := newClient(test_zk_hosts, test_zk_path) assert.NoError(t, err) childEvents := make(chan zk.Event, 5) connector := NewMockConnector() c.setFactory(asFactory(func() (Connector, <-chan zk.Event, error) { sessionEvents := make(chan zk.Event, 1) sessionEvents <- zk.Event{ Type: zk.EventSession, State: zk.StateConnected, } return connector, sessionEvents, nil })) md, err := NewMasterDetector(zkurl) defer md.Cancel() assert.NoError(t, err) c.errorHandler = ErrorHandler(func(c *Client, e error) { t.Errorf("unexpected error: %v", e) }) md.client = c listener := &allMastersListener{} //-- expect primer var primer sync.WaitGroup ignoreArgs := func(f func()) func(mock.Arguments) { primer.Add(1) return func(_ mock.Arguments) { f() } } connector.On("Children", test_zk_path).Return([]string{}, &zk.Stat{}, nil).Run(ignoreArgs(primer.Done)).Once() listener.On("UpdatedMasters", []*mesos.MasterInfo{}).Return().Run(ignoreArgs(primer.Done)).Once() connector.On("ChildrenW", test_zk_path).Return([]string{test_zk_path}, &zk.Stat{}, (<-chan zk.Event)(childEvents), nil).Run(ignoreArgs(primer.Done)).Once() md.Detect(listener) fatalAfter(t, 3*time.Second, primer.Wait, "timed out waiting for detection primer") listener.AssertExpectations(t) connector.AssertExpectations(t) //-- test membership changes type expectedGets struct { info []byte err error } tt := []struct { zkEntry []string gets []expectedGets leaderIdx int }{ {[]string{"info_004"}, []expectedGets{{newTestMasterInfo(1), nil}}, 0}, {[]string{"info_007", "info_005", "info_006"}, []expectedGets{{newTestMasterInfo(2), nil}, {newTestMasterInfo(3), nil}, {newTestMasterInfo(4), nil}}, 1}, {nil, nil, -1}, } for j, tc := range tt { // expectations var tcwait sync.WaitGroup ignoreArgs = func(f func()) func(mock.Arguments) { tcwait.Add(1) return func(_ mock.Arguments) { f() } } expectedInfos := []*mesos.MasterInfo{} for i, zke := range tc.zkEntry { connector.On("Get", fmt.Sprintf("%s/%s", test_zk_path, zke)).Return(tc.gets[i].info, &zk.Stat{}, tc.gets[i].err).Run(ignoreArgs(tcwait.Done)).Once() masterInfo := &mesos.MasterInfo{} err = proto.Unmarshal(tc.gets[i].info, masterInfo) if err != nil { t.Fatalf("failed to unmarshall MasterInfo data: %v", err) } expectedInfos = append(expectedInfos, masterInfo) } if len(tc.zkEntry) > 0 { connector.On("Get", fmt.Sprintf("%s/%s", test_zk_path, tc.zkEntry[tc.leaderIdx])).Return( tc.gets[tc.leaderIdx].info, &zk.Stat{}, tc.gets[tc.leaderIdx].err).Run(ignoreArgs(tcwait.Done)).Once() } connector.On("Children", test_zk_path).Return(tc.zkEntry, &zk.Stat{}, nil).Run(ignoreArgs(tcwait.Done)).Once() listener.On("OnMasterChanged", mock.AnythingOfType("*mesosproto.MasterInfo")).Return().Run(ignoreArgs(tcwait.Done)).Once() listener.On("UpdatedMasters", expectedInfos).Return().Run(ignoreArgs(tcwait.Done)).Once() connector.On("ChildrenW", test_zk_path).Return([]string{test_zk_path}, &zk.Stat{}, (<-chan zk.Event)(childEvents), nil).Run(ignoreArgs(tcwait.Done)).Once() // fire the event that triggers the test case childEvents <- zk.Event{ Type: zk.EventNodeChildrenChanged, Path: test_zk_path, } // allow plenty of time for all the async processing to happen fatalAfter(t, 5*time.Second, tcwait.Wait, "timed out waiting for all-masters test case %d", j+1) listener.AssertExpectations(t) connector.AssertExpectations(t) } connector.On("Close").Return(nil) } */ mesos-go-0.0.1/detector/zoo/doc.go000066400000000000000000000002031257601144100167510ustar00rootroot00000000000000// Zookeeper-based mesos-master leaderhip detection. // Implements support for optional detector.AllMasters interface. package zoo mesos-go-0.0.1/detector/zoo/mocked_conn.go000066400000000000000000000035771257601144100205040ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 zoo import ( "github.com/samuel/go-zookeeper/zk" "github.com/stretchr/testify/mock" ) // Impersontates a zk.Connection // It implements interface Connector type MockConnector struct { mock.Mock } func NewMockConnector() *MockConnector { return new(MockConnector) } func (conn *MockConnector) Close() { conn.Called() } func (conn *MockConnector) ChildrenW(path string) ([]string, *zk.Stat, <-chan zk.Event, error) { args := conn.Called(path) var ( arg0 []string arg1 *zk.Stat arg2 <-chan zk.Event ) if args.Get(0) != nil { arg0 = args.Get(0).([]string) } if args.Get(1) != nil { arg1 = args.Get(1).(*zk.Stat) } if args.Get(2) != nil { arg2 = args.Get(2).(<-chan zk.Event) } return arg0, arg1, arg2, args.Error(3) } func (conn *MockConnector) Children(path string) ([]string, *zk.Stat, error) { args := conn.Called(path) return args.Get(0).([]string), args.Get(1).(*zk.Stat), args.Error(2) } func (conn *MockConnector) Get(path string) ([]byte, *zk.Stat, error) { args := conn.Called(path) return args.Get(0).([]byte), args.Get(1).(*zk.Stat), args.Error(2) } mesos-go-0.0.1/detector/zoo/plugin.go000066400000000000000000000003251257601144100175070ustar00rootroot00000000000000package zoo import ( "github.com/mesos/mesos-go/detector" ) func init() { detector.Register("zk://", detector.PluginFactory(func(spec string) (detector.Master, error) { return NewMasterDetector(spec) })) } mesos-go-0.0.1/detector/zoo/plugin_test.go000066400000000000000000000006601257601144100205500ustar00rootroot00000000000000package zoo import ( "testing" "github.com/mesos/mesos-go/detector" "github.com/stretchr/testify/assert" ) // validate plugin registration for zk:// prefix is working func TestDectorFactoryNew_ZkPrefix(t *testing.T) { assert := assert.New(t) m, err := detector.New("zk://127.0.0.1:5050/mesos") assert.NoError(err) assert.IsType(&MasterDetector{}, m) md := m.(*MasterDetector) t.Logf("canceling detector") md.Cancel() } mesos-go-0.0.1/detector/zoo/types.go000066400000000000000000000014251257601144100173570ustar00rootroot00000000000000package zoo import ( "github.com/samuel/go-zookeeper/zk" ) // Connector Interface to facade zk.Conn type // since github.com/samuel/go-zookeeper/zk does not provide an interface // for the zk.Conn object, this allows for mocking and easier testing. type Connector interface { Close() Children(string) ([]string, *zk.Stat, error) ChildrenW(string) ([]string, *zk.Stat, <-chan zk.Event, error) Get(string) ([]byte, *zk.Stat, error) } //Factory is an adapter to trap the creation of zk.Conn instances //since the official zk API does not expose an interface for zk.Conn. type Factory interface { create() (Connector, <-chan zk.Event, error) } type asFactory func() (Connector, <-chan zk.Event, error) func (f asFactory) create() (Connector, <-chan zk.Event, error) { return f() } mesos-go-0.0.1/examples/000077500000000000000000000000001257601144100150605ustar00rootroot00000000000000mesos-go-0.0.1/examples/Godeps/000077500000000000000000000000001257601144100163015ustar00rootroot00000000000000mesos-go-0.0.1/examples/Godeps/Godeps.json000066400000000000000000000025331257601144100204200ustar00rootroot00000000000000{ "ImportPath": "github.com/mesos/mesos-go", "GoVersion": "go1.4.2", "Packages": [ "./..." ], "Deps": [ { "ImportPath": "github.com/gogo/protobuf/proto", "Rev": "8edb24c179ed858a38f18920d9005c2dde05ec17" }, { "ImportPath": "github.com/golang/glog", "Rev": "d1c4472bf2efd3826f2b5bdcc02d8416798d678c" }, { "ImportPath": "github.com/pborman/uuid", "Rev": "ca53cad383cad2479bbba7f7a1a05797ec1386e4" }, { "ImportPath": "github.com/samuel/go-zookeeper/zk", "Rev": "177002e16a0061912f02377e2dd8951a8b3551bc" }, { "ImportPath": "github.com/stretchr/objx", "Rev": "cbeaeb16a013161a98496fad62933b1d21786672" }, { "ImportPath": "github.com/stretchr/testify/assert", "Comment": "v1.0-21-gf552045", "Rev": "f5520455607c0233cb6d7b056f71b22c1d265ef1" }, { "ImportPath": "github.com/stretchr/testify/mock", "Comment": "v1.0-21-gf552045", "Rev": "f5520455607c0233cb6d7b056f71b22c1d265ef1" }, { "ImportPath": "github.com/stretchr/testify/require", "Comment": "v1.0-21-gf552045", "Rev": "f5520455607c0233cb6d7b056f71b22c1d265ef1" }, { "ImportPath": "github.com/stretchr/testify/suite", "Comment": "v1.0-21-gf552045", "Rev": "f5520455607c0233cb6d7b056f71b22c1d265ef1" }, { "ImportPath": "golang.org/x/net/context", "Rev": "cbcac7bb8415db9b6cb4d1ebab1dc9afbd688b97" } ] } mesos-go-0.0.1/examples/Godeps/Readme000066400000000000000000000002101257601144100174120ustar00rootroot00000000000000This directory tree is generated automatically by godep. Please do not edit. See https://github.com/tools/godep for more information. mesos-go-0.0.1/examples/Godeps/_workspace/000077500000000000000000000000001257601144100204365ustar00rootroot00000000000000mesos-go-0.0.1/examples/Godeps/_workspace/.gitignore000066400000000000000000000000121257601144100224170ustar00rootroot00000000000000/pkg /bin mesos-go-0.0.1/examples/Godeps/_workspace/src/000077500000000000000000000000001257601144100212255ustar00rootroot00000000000000mesos-go-0.0.1/examples/Godeps/_workspace/src/github.com/000077500000000000000000000000001257601144100232645ustar00rootroot00000000000000mesos-go-0.0.1/examples/Godeps/_workspace/src/github.com/gogo/000077500000000000000000000000001257601144100242175ustar00rootroot00000000000000mesos-go-0.0.1/examples/Godeps/_workspace/src/github.com/golang/000077500000000000000000000000001257601144100245335ustar00rootroot00000000000000mesos-go-0.0.1/examples/Godeps/_workspace/src/github.com/pborman/000077500000000000000000000000001257601144100247225ustar00rootroot00000000000000mesos-go-0.0.1/examples/Godeps/_workspace/src/github.com/stretchr/000077500000000000000000000000001257601144100251225ustar00rootroot00000000000000mesos-go-0.0.1/examples/Godeps/_workspace/src/golang.org/000077500000000000000000000000001257601144100232625ustar00rootroot00000000000000mesos-go-0.0.1/examples/Godeps/_workspace/src/golang.org/x/000077500000000000000000000000001257601144100235315ustar00rootroot00000000000000mesos-go-0.0.1/examples/Makefile000066400000000000000000000002111257601144100165120ustar00rootroot00000000000000BIN := scheduler executor zkdetect .PHONY: .PHONY: all $(BIN) all: $(BIN) $(BIN): mkdir -p _output godep go build -o _output/$@ ./$@ mesos-go-0.0.1/examples/README.md000066400000000000000000000024321257601144100163400ustar00rootroot00000000000000# Examples ## Building ``` $ go get github.com/tools/godep $ make ``` ## Running ### Start Mesos You will need a running Mesos master and slaves to run the examples. For instance, start a local Mesos: ``` $ /bin/mesos-local --ip=127.0.0.1 --port=5050 ``` See http://mesos.apache.org/gettingstarted/ for getting started with Apache Mesos. ### Start the Go scheduler/executor examples ``` $ export EXECUTOR_BIN=$(pwd)/_output/executor $ ./_output/scheduler --master=127.0.0.1:5050 --executor="$EXECUTOR_BIN" --logtostderr=true ``` If all goes well, you should see output about task completion. You can also point your browser to the Mesos GUI http://127.0.0.1:5050/ to validate the framework activities. ### Start the Go scheduler with other executors You can also use the Go `example-scheduler` with executors written in other languages such as `Python` or `Java` for further validation (note: to use these executors requires a build of the mesos source code with `make check`): ``` $ ./_output/scheduler --master=127.0.0.1:5050 --executor="/src/examples/python/test-executor" --logtostderr=true ``` Similarly for the Java version: ``` $ ./_output/scheduler --master=127.0.0.1:5050 --executor="/src/examples/java/test-executor" --logtostderr=true ``` mesos-go-0.0.1/examples/executor/000077500000000000000000000000001257601144100167165ustar00rootroot00000000000000mesos-go-0.0.1/examples/executor/main.go000066400000000000000000000066251257601144100202020ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 main import ( "flag" "fmt" exec "github.com/mesos/mesos-go/executor" mesos "github.com/mesos/mesos-go/mesosproto" ) type exampleExecutor struct { tasksLaunched int } func newExampleExecutor() *exampleExecutor { return &exampleExecutor{tasksLaunched: 0} } func (exec *exampleExecutor) Registered(driver exec.ExecutorDriver, execInfo *mesos.ExecutorInfo, fwinfo *mesos.FrameworkInfo, slaveInfo *mesos.SlaveInfo) { fmt.Println("Registered Executor on slave ", slaveInfo.GetHostname()) } func (exec *exampleExecutor) Reregistered(driver exec.ExecutorDriver, slaveInfo *mesos.SlaveInfo) { fmt.Println("Re-registered Executor on slave ", slaveInfo.GetHostname()) } func (exec *exampleExecutor) Disconnected(exec.ExecutorDriver) { fmt.Println("Executor disconnected.") } func (exec *exampleExecutor) LaunchTask(driver exec.ExecutorDriver, taskInfo *mesos.TaskInfo) { fmt.Println("Launching task", taskInfo.GetName(), "with command", taskInfo.Command.GetValue()) runStatus := &mesos.TaskStatus{ TaskId: taskInfo.GetTaskId(), State: mesos.TaskState_TASK_RUNNING.Enum(), } _, err := driver.SendStatusUpdate(runStatus) if err != nil { fmt.Println("Got error", err) } exec.tasksLaunched++ fmt.Println("Total tasks launched ", exec.tasksLaunched) // // this is where one would perform the requested task // // finish task fmt.Println("Finishing task", taskInfo.GetName()) finStatus := &mesos.TaskStatus{ TaskId: taskInfo.GetTaskId(), State: mesos.TaskState_TASK_FINISHED.Enum(), } _, err = driver.SendStatusUpdate(finStatus) if err != nil { fmt.Println("Got error", err) } fmt.Println("Task finished", taskInfo.GetName()) } func (exec *exampleExecutor) KillTask(exec.ExecutorDriver, *mesos.TaskID) { fmt.Println("Kill task") } func (exec *exampleExecutor) FrameworkMessage(driver exec.ExecutorDriver, msg string) { fmt.Println("Got framework message: ", msg) } func (exec *exampleExecutor) Shutdown(exec.ExecutorDriver) { fmt.Println("Shutting down the executor") } func (exec *exampleExecutor) Error(driver exec.ExecutorDriver, err string) { fmt.Println("Got error message:", err) } // -------------------------- func inits () ----------------- // func init() { flag.Parse() } func main() { fmt.Println("Starting Example Executor (Go)") dconfig := exec.DriverConfig{ Executor: newExampleExecutor(), } driver, err := exec.NewMesosExecutorDriver(dconfig) if err != nil { fmt.Println("Unable to create a ExecutorDriver ", err.Error()) } _, err = driver.Start() if err != nil { fmt.Println("Got error:", err) return } fmt.Println("Executor process has started and running.") driver.Join() } mesos-go-0.0.1/examples/scheduler/000077500000000000000000000000001257601144100170365ustar00rootroot00000000000000mesos-go-0.0.1/examples/scheduler/main.go000066400000000000000000000236331257601144100203200ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 main import ( "flag" "fmt" "io/ioutil" "net" "net/http" "strconv" "strings" "github.com/gogo/protobuf/proto" log "github.com/golang/glog" "github.com/mesos/mesos-go/auth" "github.com/mesos/mesos-go/auth/sasl" "github.com/mesos/mesos-go/auth/sasl/mech" mesos "github.com/mesos/mesos-go/mesosproto" util "github.com/mesos/mesos-go/mesosutil" sched "github.com/mesos/mesos-go/scheduler" "golang.org/x/net/context" ) const ( CPUS_PER_TASK = 1 MEM_PER_TASK = 128 defaultArtifactPort = 12345 ) var ( address = flag.String("address", "127.0.0.1", "Binding address for artifact server") artifactPort = flag.Int("artifactPort", defaultArtifactPort, "Binding port for artifact server") authProvider = flag.String("mesos_authentication_provider", sasl.ProviderName, fmt.Sprintf("Authentication provider to use, default is SASL that supports mechanisms: %+v", mech.ListSupported())) master = flag.String("master", "127.0.0.1:5050", "Master address ") executorPath = flag.String("executor", "./example_executor", "Path to test executor") taskCount = flag.String("task-count", "5", "Total task count to run.") mesosAuthPrincipal = flag.String("mesos_authentication_principal", "", "Mesos authentication principal.") mesosAuthSecretFile = flag.String("mesos_authentication_secret_file", "", "Mesos authentication secret file.") ) type ExampleScheduler struct { executor *mesos.ExecutorInfo tasksLaunched int tasksFinished int totalTasks int } func newExampleScheduler(exec *mesos.ExecutorInfo) *ExampleScheduler { total, err := strconv.Atoi(*taskCount) if err != nil { total = 5 } return &ExampleScheduler{ executor: exec, tasksLaunched: 0, tasksFinished: 0, totalTasks: total, } } func (sched *ExampleScheduler) Registered(driver sched.SchedulerDriver, frameworkId *mesos.FrameworkID, masterInfo *mesos.MasterInfo) { log.Infoln("Framework Registered with Master ", masterInfo) } func (sched *ExampleScheduler) Reregistered(driver sched.SchedulerDriver, masterInfo *mesos.MasterInfo) { log.Infoln("Framework Re-Registered with Master ", masterInfo) } func (sched *ExampleScheduler) Disconnected(sched.SchedulerDriver) { log.Fatalf("disconnected from master, aborting") } func (sched *ExampleScheduler) ResourceOffers(driver sched.SchedulerDriver, offers []*mesos.Offer) { if sched.tasksLaunched >= sched.totalTasks { log.Info("decline all of the offers since all of our tasks are already launched") ids := make([]*mesos.OfferID, len(offers)) for i, offer := range offers { ids[i] = offer.Id } driver.LaunchTasks(ids, []*mesos.TaskInfo{}, &mesos.Filters{RefuseSeconds: proto.Float64(120)}) return } for _, offer := range offers { cpuResources := util.FilterResources(offer.Resources, func(res *mesos.Resource) bool { return res.GetName() == "cpus" }) cpus := 0.0 for _, res := range cpuResources { cpus += res.GetScalar().GetValue() } memResources := util.FilterResources(offer.Resources, func(res *mesos.Resource) bool { return res.GetName() == "mem" }) mems := 0.0 for _, res := range memResources { mems += res.GetScalar().GetValue() } log.Infoln("Received Offer <", offer.Id.GetValue(), "> with cpus=", cpus, " mem=", mems) remainingCpus := cpus remainingMems := mems var tasks []*mesos.TaskInfo for sched.tasksLaunched < sched.totalTasks && CPUS_PER_TASK <= remainingCpus && MEM_PER_TASK <= remainingMems { sched.tasksLaunched++ taskId := &mesos.TaskID{ Value: proto.String(strconv.Itoa(sched.tasksLaunched)), } task := &mesos.TaskInfo{ Name: proto.String("go-task-" + taskId.GetValue()), TaskId: taskId, SlaveId: offer.SlaveId, Executor: sched.executor, Resources: []*mesos.Resource{ util.NewScalarResource("cpus", CPUS_PER_TASK), util.NewScalarResource("mem", MEM_PER_TASK), }, } log.Infof("Prepared task: %s with offer %s for launch\n", task.GetName(), offer.Id.GetValue()) tasks = append(tasks, task) remainingCpus -= CPUS_PER_TASK remainingMems -= MEM_PER_TASK } log.Infoln("Launching ", len(tasks), "tasks for offer", offer.Id.GetValue()) driver.LaunchTasks([]*mesos.OfferID{offer.Id}, tasks, &mesos.Filters{RefuseSeconds: proto.Float64(5)}) } } func (sched *ExampleScheduler) StatusUpdate(driver sched.SchedulerDriver, status *mesos.TaskStatus) { log.Infoln("Status update: task", status.TaskId.GetValue(), " is in state ", status.State.Enum().String()) if status.GetState() == mesos.TaskState_TASK_FINISHED { sched.tasksFinished++ } if sched.tasksFinished >= sched.totalTasks { log.Infoln("Total tasks completed, stopping framework.") driver.Stop(false) } if status.GetState() == mesos.TaskState_TASK_LOST || status.GetState() == mesos.TaskState_TASK_KILLED || status.GetState() == mesos.TaskState_TASK_FAILED || status.GetState() == mesos.TaskState_TASK_ERROR { log.Infoln( "Aborting because task", status.TaskId.GetValue(), "is in unexpected state", status.State.String(), "with message", status.GetMessage(), ) driver.Abort() } } func (sched *ExampleScheduler) OfferRescinded(_ sched.SchedulerDriver, oid *mesos.OfferID) { log.Errorf("offer rescinded: %v", oid) } func (sched *ExampleScheduler) FrameworkMessage(_ sched.SchedulerDriver, eid *mesos.ExecutorID, sid *mesos.SlaveID, msg string) { log.Errorf("framework message from executor %q slave %q: %q", eid, sid, msg) } func (sched *ExampleScheduler) SlaveLost(_ sched.SchedulerDriver, sid *mesos.SlaveID) { log.Errorf("slave lost: %v", sid) } func (sched *ExampleScheduler) ExecutorLost(_ sched.SchedulerDriver, eid *mesos.ExecutorID, sid *mesos.SlaveID, code int) { log.Errorf("executor %q lost on slave %q code %d", eid, sid, code) } func (sched *ExampleScheduler) Error(_ sched.SchedulerDriver, err string) { log.Errorf("Scheduler received error:", err) } // ----------------------- func init() ------------------------- // func init() { flag.Parse() log.Infoln("Initializing the Example Scheduler...") } // returns (downloadURI, basename(path)) func serveExecutorArtifact(path string) (*string, string) { serveFile := func(pattern string, filename string) { http.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, filename) }) } // Create base path (http://foobar:5000/) pathSplit := strings.Split(path, "/") var base string if len(pathSplit) > 0 { base = pathSplit[len(pathSplit)-1] } else { base = path } serveFile("/"+base, path) hostURI := fmt.Sprintf("http://%s:%d/%s", *address, *artifactPort, base) log.V(2).Infof("Hosting artifact '%s' at '%s'", path, hostURI) return &hostURI, base } func prepareExecutorInfo() *mesos.ExecutorInfo { executorUris := []*mesos.CommandInfo_URI{} uri, executorCmd := serveExecutorArtifact(*executorPath) executorUris = append(executorUris, &mesos.CommandInfo_URI{Value: uri, Executable: proto.Bool(true)}) // forward the value of the scheduler's -v flag to the executor v := 0 if f := flag.Lookup("v"); f != nil && f.Value != nil { if vstr := f.Value.String(); vstr != "" { if vi, err := strconv.ParseInt(vstr, 10, 32); err == nil { v = int(vi) } } } executorCommand := fmt.Sprintf("./%s -logtostderr=true -v=%d", executorCmd, v) go http.ListenAndServe(fmt.Sprintf("%s:%d", *address, *artifactPort), nil) log.V(2).Info("Serving executor artifacts...") // Create mesos scheduler driver. return &mesos.ExecutorInfo{ ExecutorId: util.NewExecutorID("default"), Name: proto.String("Test Executor (Go)"), Source: proto.String("go_test"), Command: &mesos.CommandInfo{ Value: proto.String(executorCommand), Uris: executorUris, }, } } func parseIP(address string) net.IP { addr, err := net.LookupIP(address) if err != nil { log.Fatal(err) } if len(addr) < 1 { log.Fatalf("failed to parse IP from address '%v'", address) } return addr[0] } // ----------------------- func main() ------------------------- // func main() { // build command executor exec := prepareExecutorInfo() // the framework fwinfo := &mesos.FrameworkInfo{ User: proto.String(""), // Mesos-go will fill in user. Name: proto.String("Test Framework (Go)"), } cred := (*mesos.Credential)(nil) if *mesosAuthPrincipal != "" { fwinfo.Principal = proto.String(*mesosAuthPrincipal) secret, err := ioutil.ReadFile(*mesosAuthSecretFile) if err != nil { log.Fatal(err) } cred = &mesos.Credential{ Principal: proto.String(*mesosAuthPrincipal), Secret: secret, } } bindingAddress := parseIP(*address) config := sched.DriverConfig{ Scheduler: newExampleScheduler(exec), Framework: fwinfo, Master: *master, Credential: cred, BindingAddress: bindingAddress, WithAuthContext: func(ctx context.Context) context.Context { ctx = auth.WithLoginProvider(ctx, *authProvider) ctx = sasl.WithBindingAddress(ctx, bindingAddress) return ctx }, } driver, err := sched.NewMesosSchedulerDriver(config) if err != nil { log.Errorln("Unable to create a SchedulerDriver ", err.Error()) } if stat, err := driver.Run(); err != nil { log.Infof("Framework stopped with status %s and error: %s\n", stat.String(), err.Error()) } } mesos-go-0.0.1/examples/zkdetect/000077500000000000000000000000001257601144100166755ustar00rootroot00000000000000mesos-go-0.0.1/examples/zkdetect/main.go000066400000000000000000000024041257601144100201500ustar00rootroot00000000000000package main import ( "flag" "fmt" log "github.com/golang/glog" "github.com/mesos/mesos-go/detector" _ "github.com/mesos/mesos-go/detector/zoo" mesos "github.com/mesos/mesos-go/mesosproto" ) type zkListener struct{} func (l *zkListener) OnMasterChanged(info *mesos.MasterInfo) { if info == nil { log.Infoln("master lost") } else { log.Infof("master changed: %s", masterString(info)) } } func (l *zkListener) UpdatedMasters(all []*mesos.MasterInfo) { for i, info := range all { log.Infof("master (%d): %s", i, masterString(info)) } } func masterString(info *mesos.MasterInfo) string { return fmt.Sprintf("Id %v Ip %v Hostname %v Port %v Version %v Pid %v", info.GetId(), info.GetIp(), info.GetHostname(), info.GetPort(), info.GetVersion(), info.GetPid()) } func main() { masters := flag.String("masters", "zk://localhost:2181/mesos", "ZK Mesos masters URI") flag.Parse() log.Infof("creating ZK detector for %q", *masters) m, err := detector.New(*masters) if err != nil { log.Fatalf("failed to create ZK listener for Mesos masters: %v", err) } log.Info("created ZK detector") err = m.Detect(&zkListener{}) if err != nil { log.Fatalf("failed to register ZK listener: %v", err) } log.Info("registered ZK listener") select {} // never stop } mesos-go-0.0.1/executor/000077500000000000000000000000001257601144100151005ustar00rootroot00000000000000mesos-go-0.0.1/executor/doc.go000066400000000000000000000002411257601144100161710ustar00rootroot00000000000000/* Package executor includes the interfaces of the mesos executor and the mesos executor driver, as well as an implementation of the driver. */ package executor mesos-go-0.0.1/executor/exectype.go000066400000000000000000000120401257601144100172520ustar00rootroot00000000000000package executor import ( "github.com/mesos/mesos-go/mesosproto" ) /** * Executor callback interface to be implemented by frameworks' executors. Note * that only one callback will be invoked at a time, so it is not * recommended that you block within a callback because it may cause a * deadlock. * * Each callback includes an instance to the executor driver that was * used to run this executor. The driver will not change for the * duration of an executor (i.e., from the point you do * ExecutorDriver.Start() to the point that ExecutorDriver.Join() * returns). This is intended for convenience so that an executor * doesn't need to store a pointer to the driver itself. */ type Executor interface { /** * Invoked once the executor driver has been able to successfully * connect with Mesos. In particular, a scheduler can pass some * data to its executors through the FrameworkInfo.ExecutorInfo's * data field. */ Registered(ExecutorDriver, *mesosproto.ExecutorInfo, *mesosproto.FrameworkInfo, *mesosproto.SlaveInfo) /** * Invoked when the executor re-registers with a restarted slave. */ Reregistered(ExecutorDriver, *mesosproto.SlaveInfo) /** * Invoked when the executor becomes "disconnected" from the slave * (e.g., the slave is being restarted due to an upgrade). */ Disconnected(ExecutorDriver) /** * Invoked when a task has been launched on this executor (initiated * via SchedulerDriver.LaunchTasks). Note that this task can be realized * with a goroutine, an external process, or some simple computation, however, * no other callbacks will be invoked on this executor until this * callback has returned. */ LaunchTask(ExecutorDriver, *mesosproto.TaskInfo) /** * Invoked when a task running within this executor has been killed * (via SchedulerDriver.KillTask). Note that no status update will * be sent on behalf of the executor, the executor is responsible * for creating a new TaskStatus (i.e., with TASK_KILLED) and * invoking ExecutorDriver.SendStatusUpdate. */ KillTask(ExecutorDriver, *mesosproto.TaskID) /** * Invoked when a framework message has arrived for this * executor. These messages are best effort; do not expect a * framework message to be retransmitted in any reliable fashion. */ FrameworkMessage(ExecutorDriver, string) /** * Invoked when the executor should terminate all of its currently * running tasks. Note that after Mesos has determined that an * executor has terminated, any tasks that the executor did not send * terminal status updates for (e.g., TASK_KILLED, TASK_FINISHED, * TASK_FAILED, etc) a TASK_LOST status update will be created. */ Shutdown(ExecutorDriver) /** * Invoked when a fatal error has occured with the executor and/or * executor driver. The driver will be aborted BEFORE invoking this * callback. */ Error(ExecutorDriver, string) } /** * ExecutorDriver interface for connecting an executor to Mesos. This * interface is used both to manage the executor's lifecycle (start * it, stop it, or wait for it to finish) and to interact with Mesos * (e.g., send status updates, send framework messages, etc.). * A driver method is expected to fail-fast and return an error when possible. * Other internal errors (or remote error) that occur asynchronously are handled * using the the Executor.Error() callback. */ type ExecutorDriver interface { /** * Starts the executor driver. This needs to be called before any * other driver calls are made. */ Start() (mesosproto.Status, error) /** * Stops the executor driver. */ Stop() (mesosproto.Status, error) /** * Aborts the driver so that no more callbacks can be made to the * executor. The semantics of abort and stop have deliberately been * separated so that code can detect an aborted driver (i.e., via * the return status of ExecutorDriver.Join, see below), and * instantiate and start another driver if desired (from within the * same process ... although this functionality is currently not * supported for executors). */ Abort() (mesosproto.Status, error) /** * Waits for the driver to be stopped or aborted, possibly * blocking the calling goroutine indefinitely. The return status of * this function can be used to determine if the driver was aborted * (see package mesosproto for a description of Status). */ Join() (mesosproto.Status, error) /** * Starts and immediately joins (i.e., blocks on) the driver. */ Run() (mesosproto.Status, error) /** * Sends a status update to the framework scheduler, retrying as * necessary until an acknowledgement has been received or the * executor is terminated (in which case, a TASK_LOST status update * will be sent). See Scheduler.StatusUpdate for more information * about status update acknowledgements. */ SendStatusUpdate(*mesosproto.TaskStatus) (mesosproto.Status, error) /** * Sends a message to the framework scheduler. These messages are * best effort; do not expect a framework message to be * retransmitted in any reliable fashion. */ SendFrameworkMessage(string) (mesosproto.Status, error) } mesos-go-0.0.1/executor/executor.go000066400000000000000000000504531257601144100172740ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 executor import ( "fmt" "net" "os" "sync" "time" "github.com/gogo/protobuf/proto" log "github.com/golang/glog" "github.com/mesos/mesos-go/mesosproto" "github.com/mesos/mesos-go/mesosutil" "github.com/mesos/mesos-go/mesosutil/process" "github.com/mesos/mesos-go/messenger" "github.com/mesos/mesos-go/upid" "github.com/pborman/uuid" "golang.org/x/net/context" ) type DriverConfig struct { Executor Executor HostnameOverride string // optional BindingAddress net.IP // optional BindingPort uint16 // optional PublishedAddress net.IP // optional NewMessenger func() (messenger.Messenger, error) // optional } // MesosExecutorDriver is a implementation of the ExecutorDriver. type MesosExecutorDriver struct { lock sync.RWMutex cond *sync.Cond self *upid.UPID stopCh chan struct{} status mesosproto.Status messenger messenger.Messenger slaveUPID *upid.UPID slaveID *mesosproto.SlaveID frameworkID *mesosproto.FrameworkID executorID *mesosproto.ExecutorID workDir string connected bool connection uuid.UUID local bool // TODO(yifan): Not used yet. directory string // TODO(yifan): Not used yet. checkpoint bool recoveryTimeout time.Duration updates map[string]*mesosproto.StatusUpdate // Key is a UUID string. TODO(yifan): Not used yet. tasks map[string]*mesosproto.TaskInfo // Key is a UUID string. TODO(yifan): Not used yet. withExecutor func(f func(e Executor)) started chan struct{} // signal chan that closes once start has been invoked } // NewMesosExecutorDriver creates a new mesos executor driver. func NewMesosExecutorDriver(config DriverConfig) (*MesosExecutorDriver, error) { if config.Executor == nil { msg := "Executor callback interface cannot be nil." log.Errorln(msg) return nil, fmt.Errorf(msg) } hostname := mesosutil.GetHostname(config.HostnameOverride) newMessenger := config.NewMessenger if newMessenger == nil { newMessenger = func() (messenger.Messenger, error) { process := process.New("executor") return messenger.ForHostname(process, hostname, config.BindingAddress, config.BindingPort, config.PublishedAddress) } } driver := &MesosExecutorDriver{ status: mesosproto.Status_DRIVER_NOT_STARTED, stopCh: make(chan struct{}), updates: make(map[string]*mesosproto.StatusUpdate), tasks: make(map[string]*mesosproto.TaskInfo), workDir: ".", started: make(chan struct{}), } driver.cond = sync.NewCond(&driver.lock) // decouple serialized executor callback execution from goroutines of this driver var execLock sync.Mutex driver.withExecutor = func(f func(e Executor)) { go func() { execLock.Lock() defer execLock.Unlock() f(config.Executor) }() } var err error if driver.messenger, err = newMessenger(); err != nil { return nil, err } if err = driver.init(); err != nil { log.Errorf("failed to initialize the driver: %v", err) return nil, err } return driver, nil } // init initializes the driver. func (driver *MesosExecutorDriver) init() error { log.Infof("Init mesos executor driver\n") log.Infof("Protocol Version: %v\n", mesosutil.MesosVersion) // Parse environments. if err := driver.parseEnviroments(); err != nil { log.Errorf("Failed to parse environments: %v\n", err) return err } guard := func(h messenger.MessageHandler) messenger.MessageHandler { return messenger.MessageHandler(func(from *upid.UPID, pbMsg proto.Message) { driver.lock.Lock() defer driver.lock.Unlock() h(from, pbMsg) }) } // Install handlers. driver.messenger.Install(guard(driver.registered), &mesosproto.ExecutorRegisteredMessage{}) driver.messenger.Install(guard(driver.reregistered), &mesosproto.ExecutorReregisteredMessage{}) driver.messenger.Install(guard(driver.reconnect), &mesosproto.ReconnectExecutorMessage{}) driver.messenger.Install(guard(driver.runTask), &mesosproto.RunTaskMessage{}) driver.messenger.Install(guard(driver.killTask), &mesosproto.KillTaskMessage{}) driver.messenger.Install(guard(driver.statusUpdateAcknowledgement), &mesosproto.StatusUpdateAcknowledgementMessage{}) driver.messenger.Install(guard(driver.frameworkMessage), &mesosproto.FrameworkToExecutorMessage{}) driver.messenger.Install(guard(driver.shutdown), &mesosproto.ShutdownExecutorMessage{}) driver.messenger.Install(guard(driver.frameworkError), &mesosproto.FrameworkErrorMessage{}) return nil } func (driver *MesosExecutorDriver) parseEnviroments() error { var value string value = os.Getenv("MESOS_LOCAL") if len(value) > 0 { driver.local = true } value = os.Getenv("MESOS_SLAVE_PID") if len(value) == 0 { return fmt.Errorf("Cannot find MESOS_SLAVE_PID in the environment") } upid, err := upid.Parse(value) if err != nil { log.Errorf("Cannot parse UPID %v\n", err) return err } driver.slaveUPID = upid value = os.Getenv("MESOS_SLAVE_ID") driver.slaveID = &mesosproto.SlaveID{Value: proto.String(value)} value = os.Getenv("MESOS_FRAMEWORK_ID") driver.frameworkID = &mesosproto.FrameworkID{Value: proto.String(value)} value = os.Getenv("MESOS_EXECUTOR_ID") driver.executorID = &mesosproto.ExecutorID{Value: proto.String(value)} value = os.Getenv("MESOS_DIRECTORY") if len(value) > 0 { driver.workDir = value } value = os.Getenv("MESOS_CHECKPOINT") if value == "1" { driver.checkpoint = true } // TODO(yifan): Parse the duration. For now just use default. return nil } // ------------------------- Accessors ----------------------- // func (driver *MesosExecutorDriver) Status() mesosproto.Status { driver.lock.RLock() defer driver.lock.RUnlock() return driver.status } func (driver *MesosExecutorDriver) Running() bool { driver.lock.RLock() defer driver.lock.RUnlock() return driver.status == mesosproto.Status_DRIVER_RUNNING } func (driver *MesosExecutorDriver) stopped() bool { return driver.status != mesosproto.Status_DRIVER_RUNNING } func (driver *MesosExecutorDriver) Connected() bool { driver.lock.RLock() defer driver.lock.RUnlock() return driver.connected } // --------------------- Message Handlers --------------------- // func (driver *MesosExecutorDriver) registered(from *upid.UPID, pbMsg proto.Message) { log.Infoln("Executor driver registered") msg := pbMsg.(*mesosproto.ExecutorRegisteredMessage) slaveID := msg.GetSlaveId() executorInfo := msg.GetExecutorInfo() frameworkInfo := msg.GetFrameworkInfo() slaveInfo := msg.GetSlaveInfo() if driver.stopped() { log.Infof("Ignoring registered message from slave %v, because the driver is stopped!\n", slaveID) return } log.Infof("Registered on slave %v\n", slaveID) driver.connected = true driver.connection = uuid.NewUUID() driver.cond.Broadcast() // useful for testing driver.withExecutor(func(e Executor) { e.Registered(driver, executorInfo, frameworkInfo, slaveInfo) }) } func (driver *MesosExecutorDriver) reregistered(from *upid.UPID, pbMsg proto.Message) { log.Infoln("Executor driver reregistered") msg := pbMsg.(*mesosproto.ExecutorReregisteredMessage) slaveID := msg.GetSlaveId() slaveInfo := msg.GetSlaveInfo() if driver.stopped() { log.Infof("Ignoring re-registered message from slave %v, because the driver is stopped!\n", slaveID) return } log.Infof("Re-registered on slave %v\n", slaveID) driver.connected = true driver.connection = uuid.NewUUID() driver.cond.Broadcast() // useful for testing driver.withExecutor(func(e Executor) { e.Reregistered(driver, slaveInfo) }) } func (driver *MesosExecutorDriver) send(upid *upid.UPID, msg proto.Message) error { //TODO(jdef) should implement timeout here ctx, cancel := context.WithCancel(context.TODO()) defer cancel() c := make(chan error, 1) go func() { c <- driver.messenger.Send(ctx, upid, msg) }() select { case <-ctx.Done(): <-c // wait for Send(...) return ctx.Err() case err := <-c: return err } } func (driver *MesosExecutorDriver) reconnect(from *upid.UPID, pbMsg proto.Message) { log.Infoln("Executor driver reconnect") msg := pbMsg.(*mesosproto.ReconnectExecutorMessage) slaveID := msg.GetSlaveId() if driver.stopped() { log.Infof("Ignoring reconnect message from slave %v, because the driver is stopped!\n", slaveID) return } log.Infof("Received reconnect request from slave %v\n", slaveID) driver.slaveUPID = from message := &mesosproto.ReregisterExecutorMessage{ ExecutorId: driver.executorID, FrameworkId: driver.frameworkID, } // Send all unacknowledged updates. for _, u := range driver.updates { message.Updates = append(message.Updates, u) } // Send all unacknowledged tasks. for _, t := range driver.tasks { message.Tasks = append(message.Tasks, t) } // Send the message. if err := driver.send(driver.slaveUPID, message); err != nil { log.Errorf("Failed to send %v: %v\n", message, err) } } func (driver *MesosExecutorDriver) runTask(from *upid.UPID, pbMsg proto.Message) { log.Infoln("Executor driver runTask") msg := pbMsg.(*mesosproto.RunTaskMessage) task := msg.GetTask() taskID := task.GetTaskId() if driver.stopped() { log.Infof("Ignoring run task message for task %v because the driver is stopped!\n", taskID) return } if _, ok := driver.tasks[taskID.String()]; ok { log.Fatalf("Unexpected duplicate task %v\n", taskID) } log.Infof("Executor asked to run task '%v'\n", taskID) driver.tasks[taskID.String()] = task driver.withExecutor(func(e Executor) { e.LaunchTask(driver, task) }) } func (driver *MesosExecutorDriver) killTask(from *upid.UPID, pbMsg proto.Message) { log.Infoln("Executor driver killTask") msg := pbMsg.(*mesosproto.KillTaskMessage) taskID := msg.GetTaskId() if driver.stopped() { log.Infof("Ignoring kill task message for task %v, because the driver is stopped!\n", taskID) return } log.Infof("Executor driver is asked to kill task '%v'\n", taskID) driver.withExecutor(func(e Executor) { e.KillTask(driver, taskID) }) } func (driver *MesosExecutorDriver) statusUpdateAcknowledgement(from *upid.UPID, pbMsg proto.Message) { log.Infoln("Executor statusUpdateAcknowledgement") msg := pbMsg.(*mesosproto.StatusUpdateAcknowledgementMessage) log.Infof("Receiving status update acknowledgement %v", msg) frameworkID := msg.GetFrameworkId() taskID := msg.GetTaskId() uuid := uuid.UUID(msg.GetUuid()) if driver.stopped() { log.Infof("Ignoring status update acknowledgement %v for task %v of framework %v because the driver is stopped!\n", uuid, taskID, frameworkID) } // Remove the corresponding update. delete(driver.updates, uuid.String()) // Remove the corresponding task. delete(driver.tasks, taskID.String()) } func (driver *MesosExecutorDriver) frameworkMessage(from *upid.UPID, pbMsg proto.Message) { log.Infoln("Executor driver received frameworkMessage") msg := pbMsg.(*mesosproto.FrameworkToExecutorMessage) data := msg.GetData() if driver.stopped() { log.Infof("Ignoring framework message because the driver is stopped!\n") return } log.Infof("Executor driver receives framework message\n") driver.withExecutor(func(e Executor) { e.FrameworkMessage(driver, string(data)) }) } func (driver *MesosExecutorDriver) shutdown(from *upid.UPID, pbMsg proto.Message) { log.Infoln("Executor driver received shutdown") _, ok := pbMsg.(*mesosproto.ShutdownExecutorMessage) if !ok { panic("Not a ShutdownExecutorMessage! This should not happen") } if driver.stopped() { log.Infof("Ignoring shutdown message because the driver is stopped!\n") return } log.Infof("Executor driver is asked to shutdown\n") driver.withExecutor(func(e Executor) { e.Shutdown(driver) }) // driver.stop() will cause process to eventually stop. driver.stop() } func (driver *MesosExecutorDriver) frameworkError(from *upid.UPID, pbMsg proto.Message) { log.Infoln("Executor driver received error") msg := pbMsg.(*mesosproto.FrameworkErrorMessage) driver.withExecutor(func(e Executor) { e.Error(driver, msg.GetMessage()) }) } // ------------------------ Driver Implementation ----------------- // // Start starts the executor driver func (driver *MesosExecutorDriver) Start() (mesosproto.Status, error) { driver.lock.Lock() defer driver.lock.Unlock() return driver.start() } func (driver *MesosExecutorDriver) start() (mesosproto.Status, error) { log.Infoln("Starting the executor driver") if driver.status != mesosproto.Status_DRIVER_NOT_STARTED { return driver.status, fmt.Errorf("Unable to Start, expecting status %s, but got %s", mesosproto.Status_DRIVER_NOT_STARTED, driver.status) } // Start the messenger. if err := driver.messenger.Start(); err != nil { log.Errorf("Failed to start executor: %v\n", err) return driver.status, err } driver.self = driver.messenger.UPID() // Register with slave. log.V(3).Infoln("Sending Executor registration") message := &mesosproto.RegisterExecutorMessage{ FrameworkId: driver.frameworkID, ExecutorId: driver.executorID, } if err := driver.send(driver.slaveUPID, message); err != nil { log.Errorf("Stopping the executor, failed to send %v: %v\n", message, err) err0 := driver._stop(driver.status) if err0 != nil { log.Errorf("Failed to stop executor: %v\n", err) return driver.status, err0 } return driver.status, err } driver.status = mesosproto.Status_DRIVER_RUNNING close(driver.started) log.Infoln("Mesos executor is started with PID=", driver.self.String()) return driver.status, nil } // Stop stops the driver by sending a 'stopEvent' to the event loop, and // receives the result from the response channel. func (driver *MesosExecutorDriver) Stop() (mesosproto.Status, error) { driver.lock.Lock() defer driver.lock.Unlock() return driver.stop() } func (driver *MesosExecutorDriver) stop() (mesosproto.Status, error) { log.Infoln("Stopping the executor driver") if driver.status != mesosproto.Status_DRIVER_RUNNING { return driver.status, fmt.Errorf("Unable to Stop, expecting status %s, but got %s", mesosproto.Status_DRIVER_RUNNING, driver.status) } return mesosproto.Status_DRIVER_STOPPED, driver._stop(mesosproto.Status_DRIVER_STOPPED) } // internal function for stopping the driver and set reason for stopping // Note that messages inflight or queued will not be processed. func (driver *MesosExecutorDriver) _stop(stopStatus mesosproto.Status) error { err := driver.messenger.Stop() defer func() { select { case <-driver.stopCh: // already closed default: close(driver.stopCh) } driver.cond.Broadcast() }() driver.status = stopStatus if err != nil { return err } return nil } // Abort aborts the driver by sending an 'abortEvent' to the event loop, and // receives the result from the response channel. func (driver *MesosExecutorDriver) Abort() (mesosproto.Status, error) { driver.lock.Lock() defer driver.lock.Unlock() return driver.abort() } func (driver *MesosExecutorDriver) abort() (mesosproto.Status, error) { if driver.status != mesosproto.Status_DRIVER_RUNNING { return driver.status, fmt.Errorf("Unable to Stop, expecting status %s, but got %s", mesosproto.Status_DRIVER_RUNNING, driver.status) } log.Infoln("Aborting the executor driver") return mesosproto.Status_DRIVER_ABORTED, driver._stop(mesosproto.Status_DRIVER_ABORTED) } // Join waits for the driver by sending a 'joinEvent' to the event loop, and wait // on a channel for the notification of driver termination. func (driver *MesosExecutorDriver) Join() (mesosproto.Status, error) { driver.lock.Lock() defer driver.lock.Unlock() return driver.join() } func (driver *MesosExecutorDriver) join() (mesosproto.Status, error) { log.Infoln("Waiting for the executor driver to stop") if driver.status != mesosproto.Status_DRIVER_RUNNING { return driver.status, fmt.Errorf("Unable to Join, expecting status %s, but got %s", mesosproto.Status_DRIVER_RUNNING, driver.status) } for { select { case <-driver.stopCh: // wait for stop signal return driver.status, nil default: driver.cond.Wait() } } } // Run starts the driver and calls Join() to wait for stop request. func (driver *MesosExecutorDriver) Run() (mesosproto.Status, error) { driver.lock.Lock() defer driver.lock.Unlock() return driver.run() } func (driver *MesosExecutorDriver) run() (mesosproto.Status, error) { stat, err := driver.start() if err != nil { return driver.stop() } if stat != mesosproto.Status_DRIVER_RUNNING { return stat, fmt.Errorf("Unable to continue to Run, expecting status %s, but got %s", mesosproto.Status_DRIVER_RUNNING, driver.status) } return driver.join() } // SendStatusUpdate sends status updates to the slave. func (driver *MesosExecutorDriver) SendStatusUpdate(taskStatus *mesosproto.TaskStatus) (mesosproto.Status, error) { driver.lock.Lock() defer driver.lock.Unlock() return driver.sendStatusUpdate(taskStatus) } func (driver *MesosExecutorDriver) sendStatusUpdate(taskStatus *mesosproto.TaskStatus) (mesosproto.Status, error) { log.V(3).Infoln("Sending task status update: ", taskStatus.String()) if driver.status != mesosproto.Status_DRIVER_RUNNING { return driver.status, fmt.Errorf("Unable to SendStatusUpdate, expecting driver.status %s, but got %s", mesosproto.Status_DRIVER_RUNNING, driver.status) } if taskStatus.GetState() == mesosproto.TaskState_TASK_STAGING { err := fmt.Errorf("Executor is not allowed to send TASK_STAGING status update. Aborting!") log.Errorln(err) if err0 := driver._stop(mesosproto.Status_DRIVER_ABORTED); err0 != nil { log.Errorln("Error while stopping the driver", err0) } return driver.status, err } // Set up status update. update := driver.makeStatusUpdate(taskStatus) log.Infof("Executor sending status update %v\n", update.String()) // Capture the status update. driver.updates[uuid.UUID(update.GetUuid()).String()] = update // Put the status update in the message. message := &mesosproto.StatusUpdateMessage{ Update: update, Pid: proto.String(driver.self.String()), } // Send the message. if err := driver.send(driver.slaveUPID, message); err != nil { log.Errorf("Failed to send %v: %v\n", message, err) return driver.status, err } return driver.status, nil } func (driver *MesosExecutorDriver) makeStatusUpdate(taskStatus *mesosproto.TaskStatus) *mesosproto.StatusUpdate { now := float64(time.Now().Unix()) // Fill in all the fields. taskStatus.Timestamp = proto.Float64(now) taskStatus.SlaveId = driver.slaveID update := &mesosproto.StatusUpdate{ FrameworkId: driver.frameworkID, ExecutorId: driver.executorID, SlaveId: driver.slaveID, Status: taskStatus, Timestamp: proto.Float64(now), Uuid: uuid.NewUUID(), } return update } // SendFrameworkMessage sends the framework message by sending a 'sendFrameworkMessageEvent' // to the event loop, and receives the result from the response channel. func (driver *MesosExecutorDriver) SendFrameworkMessage(data string) (mesosproto.Status, error) { driver.lock.Lock() defer driver.lock.Unlock() return driver.sendFrameworkMessage(data) } func (driver *MesosExecutorDriver) sendFrameworkMessage(data string) (mesosproto.Status, error) { log.V(3).Infoln("Sending framework message", string(data)) if driver.status != mesosproto.Status_DRIVER_RUNNING { return driver.status, fmt.Errorf("Unable to SendFrameworkMessage, expecting status %s, but got %s", mesosproto.Status_DRIVER_RUNNING, driver.status) } message := &mesosproto.ExecutorToFrameworkMessage{ SlaveId: driver.slaveID, FrameworkId: driver.frameworkID, ExecutorId: driver.executorID, Data: []byte(data), } // Send the message. if err := driver.send(driver.slaveUPID, message); err != nil { log.Errorln("Failed to send message %v: %v", message, err) return driver.status, err } return driver.status, nil } mesos-go-0.0.1/executor/executor_intgr_test.go000066400000000000000000000363711257601144100215410ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 executor import ( "io/ioutil" "net/http" "net/url" "os" "strings" "sync" "testing" "time" "github.com/gogo/protobuf/proto" log "github.com/golang/glog" mesos "github.com/mesos/mesos-go/mesosproto" util "github.com/mesos/mesos-go/mesosutil" "github.com/mesos/mesos-go/testutil" "github.com/pborman/uuid" "github.com/stretchr/testify/assert" ) // testScuduler is used for testing Schduler callbacks. type testExecutor struct { ch chan bool wg *sync.WaitGroup t *testing.T } func newTestExecutor(t *testing.T) *testExecutor { return &testExecutor{ch: make(chan bool), t: t} } func (exec *testExecutor) Registered(driver ExecutorDriver, execinfo *mesos.ExecutorInfo, fwinfo *mesos.FrameworkInfo, slaveinfo *mesos.SlaveInfo) { log.Infoln("Exec.Registered() called.") assert.NotNil(exec.t, execinfo) assert.NotNil(exec.t, fwinfo) assert.NotNil(exec.t, slaveinfo) exec.ch <- true } func (exec *testExecutor) Reregistered(driver ExecutorDriver, slaveinfo *mesos.SlaveInfo) { log.Infoln("Exec.Re-registered() called.") assert.NotNil(exec.t, slaveinfo) exec.ch <- true } func (e *testExecutor) Disconnected(ExecutorDriver) {} func (exec *testExecutor) LaunchTask(driver ExecutorDriver, taskinfo *mesos.TaskInfo) { log.Infoln("Exec.LaunchTask() called.") assert.NotNil(exec.t, taskinfo) assert.True(exec.t, util.NewTaskID("test-task-001").Equal(taskinfo.TaskId)) exec.ch <- true } func (exec *testExecutor) KillTask(driver ExecutorDriver, taskid *mesos.TaskID) { log.Infoln("Exec.KillTask() called.") assert.NotNil(exec.t, taskid) assert.True(exec.t, util.NewTaskID("test-task-001").Equal(taskid)) exec.ch <- true } func (exec *testExecutor) FrameworkMessage(driver ExecutorDriver, message string) { log.Infoln("Exec.FrameworkMessage() called.") assert.NotNil(exec.t, message) assert.Equal(exec.t, "Hello-Test", message) exec.ch <- true } func (exec *testExecutor) Shutdown(ExecutorDriver) { log.Infoln("Exec.Shutdown() called.") exec.ch <- true } func (exec *testExecutor) Error(driver ExecutorDriver, err string) { log.Infoln("Exec.Error() called.") log.Infoln("Got error ", err) driver.Stop() exec.ch <- true } // ------------------------ Test Functions -------------------- // func setTestEnv(t *testing.T) { assert.NoError(t, os.Setenv("MESOS_FRAMEWORK_ID", frameworkID)) assert.NoError(t, os.Setenv("MESOS_EXECUTOR_ID", executorID)) } type integrationTestDriver struct { *MesosExecutorDriver } func (i *integrationTestDriver) setConnected(b bool) { i.lock.Lock() defer i.lock.Unlock() i.connected = b } // connectionListener returns a signal chan that closes once driver.connected == true. func (i *integrationTestDriver) connectionListener() chan struct{} { connected := make(chan struct{}) go func() { i.lock.Lock() defer i.lock.Unlock() for !i.connected { select { case <-i.stopCh: return default: i.cond.Wait() } } close(connected) }() return connected } func newIntegrationTestDriver(t *testing.T, exec Executor) *integrationTestDriver { dconfig := DriverConfig{ Executor: exec, } driver, err := NewMesosExecutorDriver(dconfig) if err != nil { t.Fatal(err) } return &integrationTestDriver{driver} } func TestExecutorDriverRegisterExecutorMessage(t *testing.T) { setTestEnv(t) ch := make(chan bool, 2) server := testutil.NewMockSlaveHttpServer(t, func(rsp http.ResponseWriter, req *http.Request) { reqPath, err := url.QueryUnescape(req.URL.String()) assert.NoError(t, err) log.Infoln("RCVD request", reqPath) data, err := ioutil.ReadAll(req.Body) if err != nil { t.Fatalf("Missing RegisteredExecutor data from scheduler.") } defer req.Body.Close() message := new(mesos.RegisterExecutorMessage) err = proto.Unmarshal(data, message) assert.NoError(t, err) assert.Equal(t, frameworkID, message.GetFrameworkId().GetValue()) assert.Equal(t, executorID, message.GetExecutorId().GetValue()) ch <- true rsp.WriteHeader(http.StatusAccepted) }) defer server.Close() exec := newTestExecutor(t) exec.ch = ch driver := newIntegrationTestDriver(t, exec) assert.False(t, driver.Running()) stat, err := driver.Start() assert.NoError(t, err) assert.True(t, driver.Running()) assert.Equal(t, mesos.Status_DRIVER_RUNNING, stat) select { case <-ch: case <-time.After(time.Second * 1): log.Errorf("Tired of waiting...") } } func TestExecutorDriverExecutorRegisteredEvent(t *testing.T) { setTestEnv(t) ch := make(chan bool, 2) // Mock Slave process to respond to registration event. server := testutil.NewMockSlaveHttpServer(t, func(rsp http.ResponseWriter, req *http.Request) { reqPath, err := url.QueryUnescape(req.URL.String()) assert.NoError(t, err) log.Infoln("RCVD request", reqPath) rsp.WriteHeader(http.StatusAccepted) }) defer server.Close() exec := newTestExecutor(t) exec.ch = ch exec.t = t // start driver := newIntegrationTestDriver(t, exec) stat, err := driver.Start() assert.NoError(t, err) assert.Equal(t, mesos.Status_DRIVER_RUNNING, stat) defer driver.Stop() //simulate sending ExecutorRegisteredMessage from server to exec pid. pbMsg := &mesos.ExecutorRegisteredMessage{ ExecutorInfo: util.NewExecutorInfo(util.NewExecutorID(executorID), util.NewCommandInfo("ls -l")), FrameworkId: util.NewFrameworkID(frameworkID), FrameworkInfo: util.NewFrameworkInfo("test", "test-framework", util.NewFrameworkID(frameworkID)), SlaveId: util.NewSlaveID(slaveID), SlaveInfo: &mesos.SlaveInfo{Hostname: proto.String("localhost")}, } c := testutil.NewMockMesosClient(t, server.PID) connected := driver.connectionListener() c.SendMessage(driver.self, pbMsg) select { case <-connected: case <-time.After(time.Second * 1): log.Errorf("Tired of waiting...") } } func TestExecutorDriverExecutorReregisteredEvent(t *testing.T) { setTestEnv(t) ch := make(chan bool, 2) // Mock Slave process to respond to registration event. server := testutil.NewMockSlaveHttpServer(t, func(rsp http.ResponseWriter, req *http.Request) { reqPath, err := url.QueryUnescape(req.URL.String()) assert.NoError(t, err) log.Infoln("RCVD request", reqPath) rsp.WriteHeader(http.StatusAccepted) }) defer server.Close() exec := newTestExecutor(t) exec.ch = ch exec.t = t // start driver := newIntegrationTestDriver(t, exec) stat, err := driver.Start() assert.NoError(t, err) assert.Equal(t, mesos.Status_DRIVER_RUNNING, stat) defer driver.Stop() //simulate sending ExecutorRegisteredMessage from server to exec pid. pbMsg := &mesos.ExecutorReregisteredMessage{ SlaveId: util.NewSlaveID(slaveID), SlaveInfo: &mesos.SlaveInfo{Hostname: proto.String("localhost")}, } c := testutil.NewMockMesosClient(t, server.PID) connected := driver.connectionListener() c.SendMessage(driver.self, pbMsg) select { case <-connected: case <-time.After(time.Second * 1): log.Errorf("Tired of waiting...") } } func TestExecutorDriverReconnectEvent(t *testing.T) { setTestEnv(t) ch := make(chan bool, 2) // Mock Slave process to respond to registration event. server := testutil.NewMockSlaveHttpServer(t, func(rsp http.ResponseWriter, req *http.Request) { reqPath, err := url.QueryUnescape(req.URL.String()) assert.NoError(t, err) log.Infoln("RCVD request", reqPath) // exec registration request if strings.Contains(reqPath, "RegisterExecutorMessage") { log.Infoln("Got Executor registration request") } if strings.Contains(reqPath, "ReregisterExecutorMessage") { log.Infoln("Got Executor Re-registration request") ch <- true } rsp.WriteHeader(http.StatusAccepted) }) defer server.Close() exec := newTestExecutor(t) exec.t = t // start driver := newIntegrationTestDriver(t, exec) stat, err := driver.Start() assert.NoError(t, err) assert.Equal(t, mesos.Status_DRIVER_RUNNING, stat) driver.setConnected(true) defer driver.Stop() // send "reconnect" event to driver pbMsg := &mesos.ReconnectExecutorMessage{ SlaveId: util.NewSlaveID(slaveID), } c := testutil.NewMockMesosClient(t, server.PID) c.SendMessage(driver.self, pbMsg) select { case <-ch: case <-time.After(time.Second * 2): log.Errorf("Tired of waiting...") } } func TestExecutorDriverRunTaskEvent(t *testing.T) { setTestEnv(t) ch := make(chan bool, 2) // Mock Slave process to respond to registration event. server := testutil.NewMockSlaveHttpServer(t, func(rsp http.ResponseWriter, req *http.Request) { reqPath, err := url.QueryUnescape(req.URL.String()) assert.NoError(t, err) log.Infoln("RCVD request", reqPath) rsp.WriteHeader(http.StatusAccepted) }) defer server.Close() exec := newTestExecutor(t) exec.ch = ch exec.t = t // start driver := newIntegrationTestDriver(t, exec) stat, err := driver.Start() assert.NoError(t, err) assert.Equal(t, mesos.Status_DRIVER_RUNNING, stat) driver.setConnected(true) defer driver.Stop() // send runtask event to driver pbMsg := &mesos.RunTaskMessage{ FrameworkId: util.NewFrameworkID(frameworkID), Framework: util.NewFrameworkInfo( "test", "test-framework-001", util.NewFrameworkID(frameworkID), ), Pid: proto.String(server.PID.String()), Task: util.NewTaskInfo( "test-task", util.NewTaskID("test-task-001"), util.NewSlaveID(slaveID), []*mesos.Resource{ util.NewScalarResource("mem", 112), util.NewScalarResource("cpus", 2), }, ), } c := testutil.NewMockMesosClient(t, server.PID) c.SendMessage(driver.self, pbMsg) select { case <-ch: case <-time.After(time.Second * 2): log.Errorf("Tired of waiting...") } } func TestExecutorDriverKillTaskEvent(t *testing.T) { setTestEnv(t) ch := make(chan bool, 2) // Mock Slave process to respond to registration event. server := testutil.NewMockSlaveHttpServer(t, func(rsp http.ResponseWriter, req *http.Request) { reqPath, err := url.QueryUnescape(req.URL.String()) assert.NoError(t, err) log.Infoln("RCVD request", reqPath) rsp.WriteHeader(http.StatusAccepted) }) defer server.Close() exec := newTestExecutor(t) exec.ch = ch exec.t = t // start driver := newIntegrationTestDriver(t, exec) stat, err := driver.Start() assert.NoError(t, err) assert.Equal(t, mesos.Status_DRIVER_RUNNING, stat) driver.setConnected(true) defer driver.Stop() // send runtask event to driver pbMsg := &mesos.KillTaskMessage{ FrameworkId: util.NewFrameworkID(frameworkID), TaskId: util.NewTaskID("test-task-001"), } c := testutil.NewMockMesosClient(t, server.PID) c.SendMessage(driver.self, pbMsg) select { case <-ch: case <-time.After(time.Second * 2): log.Errorf("Tired of waiting...") } } func TestExecutorDriverStatusUpdateAcknowledgement(t *testing.T) { setTestEnv(t) ch := make(chan bool, 2) // Mock Slave process to respond to registration event. server := testutil.NewMockSlaveHttpServer(t, func(rsp http.ResponseWriter, req *http.Request) { reqPath, err := url.QueryUnescape(req.URL.String()) assert.NoError(t, err) log.Infoln("RCVD request", reqPath) rsp.WriteHeader(http.StatusAccepted) }) defer server.Close() exec := newTestExecutor(t) exec.ch = ch exec.t = t // start driver := newIntegrationTestDriver(t, exec) stat, err := driver.Start() assert.NoError(t, err) assert.Equal(t, mesos.Status_DRIVER_RUNNING, stat) driver.setConnected(true) defer driver.Stop() // send ACK from server pbMsg := &mesos.StatusUpdateAcknowledgementMessage{ SlaveId: util.NewSlaveID(slaveID), FrameworkId: util.NewFrameworkID(frameworkID), TaskId: util.NewTaskID("test-task-001"), Uuid: []byte(uuid.NewRandom().String()), } c := testutil.NewMockMesosClient(t, server.PID) c.SendMessage(driver.self, pbMsg) <-time.After(time.Second * 1) } func TestExecutorDriverFrameworkToExecutorMessageEvent(t *testing.T) { setTestEnv(t) ch := make(chan bool, 2) // Mock Slave process to respond to registration event. server := testutil.NewMockSlaveHttpServer(t, func(rsp http.ResponseWriter, req *http.Request) { reqPath, err := url.QueryUnescape(req.URL.String()) assert.NoError(t, err) log.Infoln("RCVD request", reqPath) rsp.WriteHeader(http.StatusAccepted) }) defer server.Close() exec := newTestExecutor(t) exec.ch = ch exec.t = t // start driver := newIntegrationTestDriver(t, exec) stat, err := driver.Start() assert.NoError(t, err) assert.Equal(t, mesos.Status_DRIVER_RUNNING, stat) driver.setConnected(true) defer driver.Stop() // send runtask event to driver pbMsg := &mesos.FrameworkToExecutorMessage{ SlaveId: util.NewSlaveID(slaveID), ExecutorId: util.NewExecutorID(executorID), FrameworkId: util.NewFrameworkID(frameworkID), Data: []byte("Hello-Test"), } c := testutil.NewMockMesosClient(t, server.PID) c.SendMessage(driver.self, pbMsg) select { case <-ch: case <-time.After(time.Second * 1): log.Errorf("Tired of waiting...") } } func TestExecutorDriverShutdownEvent(t *testing.T) { setTestEnv(t) ch := make(chan bool, 2) // Mock Slave process to respond to registration event. server := testutil.NewMockSlaveHttpServer(t, func(rsp http.ResponseWriter, req *http.Request) { reqPath, err := url.QueryUnescape(req.URL.String()) assert.NoError(t, err) log.Infoln("RCVD request", reqPath) rsp.WriteHeader(http.StatusAccepted) }) defer server.Close() exec := newTestExecutor(t) exec.ch = ch exec.t = t // start driver := newIntegrationTestDriver(t, exec) stat, err := driver.Start() assert.NoError(t, err) assert.Equal(t, mesos.Status_DRIVER_RUNNING, stat) driver.setConnected(true) // send runtask event to driver pbMsg := &mesos.ShutdownExecutorMessage{} c := testutil.NewMockMesosClient(t, server.PID) c.SendMessage(driver.self, pbMsg) select { case <-ch: case <-time.After(time.Second * 5): log.Errorf("Tired of waiting...") } <-time.After(time.Second * 1) // wait for shutdown to finish. assert.Equal(t, mesos.Status_DRIVER_STOPPED, driver.Status()) } func TestExecutorDriverError(t *testing.T) { setTestEnv(t) ch := make(chan bool, 2) // Mock Slave process to respond to registration event. server := testutil.NewMockSlaveHttpServer(t, func(rsp http.ResponseWriter, req *http.Request) { reqPath, err := url.QueryUnescape(req.URL.String()) assert.NoError(t, err) log.Infoln("RCVD request", reqPath) rsp.WriteHeader(http.StatusAccepted) }) exec := newTestExecutor(t) exec.ch = ch exec.t = t driver := newIntegrationTestDriver(t, exec) server.Close() // will cause error // Run() cause async message processing to start // Therefore, error-handling will be done via Executor.Error callaback. stat, err := driver.Run() assert.NoError(t, err) assert.Equal(t, mesos.Status_DRIVER_STOPPED, stat) select { case <-ch: case <-time.After(time.Second * 1): log.Errorf("Tired of waiting...") } } mesos-go-0.0.1/executor/executor_test.go000066400000000000000000000271021257601144100203260ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 executor import ( "fmt" "os" "testing" "github.com/mesos/mesos-go/healthchecker" "github.com/mesos/mesos-go/mesosproto" util "github.com/mesos/mesos-go/mesosutil" "github.com/mesos/mesos-go/messenger" "github.com/mesos/mesos-go/upid" "github.com/stretchr/testify/assert" ) var ( slavePID = "slave(1)@127.0.0.1:8080" slaveID = "some-slave-id-uuid" frameworkID = "some-framework-id-uuid" executorID = "some-executor-id-uuid" ) func setEnvironments(t *testing.T, workDir string, checkpoint bool) { assert.NoError(t, os.Setenv("MESOS_SLAVE_PID", slavePID)) assert.NoError(t, os.Setenv("MESOS_SLAVE_ID", slaveID)) assert.NoError(t, os.Setenv("MESOS_FRAMEWORK_ID", frameworkID)) assert.NoError(t, os.Setenv("MESOS_EXECUTOR_ID", executorID)) if len(workDir) > 0 { assert.NoError(t, os.Setenv("MESOS_DIRECTORY", workDir)) } if checkpoint { assert.NoError(t, os.Setenv("MESOS_CHECKPOINT", "1")) } } func clearEnvironments(t *testing.T) { assert.NoError(t, os.Setenv("MESOS_SLAVE_PID", "")) assert.NoError(t, os.Setenv("MESOS_SLAVE_ID", "")) assert.NoError(t, os.Setenv("MESOS_FRAMEWORK_ID", "")) assert.NoError(t, os.Setenv("MESOS_EXECUTOR_ID", "")) } func newTestExecutorDriver(t *testing.T, exec Executor) *MesosExecutorDriver { dconfig := DriverConfig{ Executor: exec, } driver, err := NewMesosExecutorDriver(dconfig) if err != nil { t.Fatal(err) } return driver } type testExecutorDriver struct { *MesosExecutorDriver } func (e *testExecutorDriver) setConnected(b bool) { e.lock.Lock() defer e.lock.Unlock() e.connected = b } func createTestExecutorDriver(t *testing.T) ( *testExecutorDriver, *messenger.MockedMessenger, *healthchecker.MockedHealthChecker) { exec := NewMockedExecutor() exec.On("Error").Return(nil) setEnvironments(t, "", false) driver := newTestExecutorDriver(t, exec) messenger := messenger.NewMockedMessenger() messenger.On("Start").Return(nil) messenger.On("UPID").Return(&upid.UPID{}) messenger.On("Send").Return(nil) messenger.On("Stop").Return(nil) checker := healthchecker.NewMockedHealthChecker() checker.On("Start").Return() checker.On("Stop").Return() driver.messenger = messenger return &testExecutorDriver{driver}, messenger, checker } func TestExecutorDriverStartFailedToParseEnvironment(t *testing.T) { clearEnvironments(t) exec := NewMockedExecutor() exec.On("Error").Return(nil) dconfig := DriverConfig{Executor: exec} driver, err := NewMesosExecutorDriver(dconfig) assert.Nil(t, driver) assert.Error(t, err) } func TestExecutorDriverStartFailedToStartMessenger(t *testing.T) { exec := NewMockedExecutor() setEnvironments(t, "", false) driver := newTestExecutorDriver(t, exec) assert.NotNil(t, driver) messenger := messenger.NewMockedMessenger() driver.messenger = messenger // Set expections and return values. messenger.On("Start").Return(fmt.Errorf("messenger failed to start")) messenger.On("Stop").Return(nil) status, err := driver.Start() assert.Error(t, err) assert.Equal(t, mesosproto.Status_DRIVER_NOT_STARTED, status) messenger.Stop() messenger.AssertNumberOfCalls(t, "Start", 1) messenger.AssertNumberOfCalls(t, "Stop", 1) } func TestExecutorDriverStartFailedToSendRegisterMessage(t *testing.T) { exec := NewMockedExecutor() setEnvironments(t, "", false) driver := newTestExecutorDriver(t, exec) messenger := messenger.NewMockedMessenger() driver.messenger = messenger // Set expections and return values. messenger.On("Start").Return(nil) messenger.On("UPID").Return(&upid.UPID{}) messenger.On("Send").Return(fmt.Errorf("messenger failed to send")) messenger.On("Stop").Return(nil) status, err := driver.Start() assert.Error(t, err) assert.Equal(t, mesosproto.Status_DRIVER_NOT_STARTED, status) messenger.AssertNumberOfCalls(t, "Start", 1) messenger.AssertNumberOfCalls(t, "UPID", 1) messenger.AssertNumberOfCalls(t, "Send", 1) messenger.AssertNumberOfCalls(t, "Stop", 1) } func TestExecutorDriverStartSucceed(t *testing.T) { setEnvironments(t, "", false) exec := NewMockedExecutor() exec.On("Error").Return(nil) driver := newTestExecutorDriver(t, exec) messenger := messenger.NewMockedMessenger() driver.messenger = messenger messenger.On("Start").Return(nil) messenger.On("UPID").Return(&upid.UPID{}) messenger.On("Send").Return(nil) messenger.On("Stop").Return(nil) checker := healthchecker.NewMockedHealthChecker() checker.On("Start").Return() checker.On("Stop").Return() assert.False(t, driver.Running()) status, err := driver.Start() assert.True(t, driver.Running()) assert.NoError(t, err) assert.Equal(t, mesosproto.Status_DRIVER_RUNNING, status) messenger.AssertNumberOfCalls(t, "Start", 1) messenger.AssertNumberOfCalls(t, "UPID", 1) messenger.AssertNumberOfCalls(t, "Send", 1) } func TestExecutorDriverRun(t *testing.T) { setEnvironments(t, "", false) // Set expections and return values. messenger := messenger.NewMockedMessenger() messenger.On("Start").Return(nil) messenger.On("UPID").Return(&upid.UPID{}) messenger.On("Send").Return(nil) messenger.On("Stop").Return(nil) exec := NewMockedExecutor() exec.On("Error").Return(nil) driver := newTestExecutorDriver(t, exec) driver.messenger = messenger assert.False(t, driver.Running()) checker := healthchecker.NewMockedHealthChecker() checker.On("Start").Return() checker.On("Stop").Return() ch := make(chan struct{}) go func() { defer close(ch) stat, err := driver.Run() assert.NoError(t, err) assert.Equal(t, mesosproto.Status_DRIVER_STOPPED, stat) }() <-driver.started assert.True(t, driver.Running()) driver.Stop() <-ch } func TestExecutorDriverJoin(t *testing.T) { setEnvironments(t, "", false) // Set expections and return values. messenger := messenger.NewMockedMessenger() messenger.On("Start").Return(nil) messenger.On("UPID").Return(&upid.UPID{}) messenger.On("Send").Return(nil) messenger.On("Stop").Return(nil) exec := NewMockedExecutor() exec.On("Error").Return(nil) driver := newTestExecutorDriver(t, exec) driver.messenger = messenger assert.False(t, driver.Running()) checker := healthchecker.NewMockedHealthChecker() checker.On("Start").Return() checker.On("Stop").Return() stat, err := driver.Start() assert.NoError(t, err) assert.True(t, driver.Running()) assert.Equal(t, mesosproto.Status_DRIVER_RUNNING, stat) testCh := make(chan mesosproto.Status) go func() { stat, _ := driver.Join() testCh <- stat }() driver.Stop() stat = <-testCh // when Stop() is called, stat will be DRIVER_STOPPED. assert.Equal(t, mesosproto.Status_DRIVER_STOPPED, stat) } func TestExecutorDriverAbort(t *testing.T) { statusChan := make(chan mesosproto.Status) driver, messenger, _ := createTestExecutorDriver(t) assert.False(t, driver.Running()) stat, err := driver.Start() assert.True(t, driver.Running()) assert.NoError(t, err) assert.Equal(t, mesosproto.Status_DRIVER_RUNNING, stat) go func() { st, _ := driver.Join() statusChan <- st }() stat, err = driver.Abort() assert.NoError(t, err) assert.Equal(t, mesosproto.Status_DRIVER_ABORTED, stat) assert.Equal(t, mesosproto.Status_DRIVER_ABORTED, <-statusChan) assert.False(t, driver.Running()) // Abort for the second time, should return directly. stat, err = driver.Abort() assert.Error(t, err) assert.Equal(t, mesosproto.Status_DRIVER_ABORTED, stat) stat, err = driver.Stop() assert.Error(t, err) assert.Equal(t, mesosproto.Status_DRIVER_ABORTED, stat) assert.False(t, driver.Running()) // Restart should not start. stat, err = driver.Start() assert.False(t, driver.Running()) assert.Error(t, err) assert.Equal(t, mesosproto.Status_DRIVER_ABORTED, stat) messenger.AssertNumberOfCalls(t, "Start", 1) messenger.AssertNumberOfCalls(t, "UPID", 1) messenger.AssertNumberOfCalls(t, "Send", 1) messenger.AssertNumberOfCalls(t, "Stop", 1) } func TestExecutorDriverStop(t *testing.T) { statusChan := make(chan mesosproto.Status) driver, messenger, _ := createTestExecutorDriver(t) assert.False(t, driver.Running()) stat, err := driver.Start() assert.True(t, driver.Running()) assert.NoError(t, err) assert.Equal(t, mesosproto.Status_DRIVER_RUNNING, stat) go func() { stat, _ := driver.Join() statusChan <- stat }() stat, err = driver.Stop() assert.NoError(t, err) assert.Equal(t, mesosproto.Status_DRIVER_STOPPED, stat) assert.Equal(t, mesosproto.Status_DRIVER_STOPPED, <-statusChan) assert.False(t, driver.Running()) // Stop for the second time, should return directly. stat, err = driver.Stop() assert.Error(t, err) assert.Equal(t, mesosproto.Status_DRIVER_STOPPED, stat) stat, err = driver.Abort() assert.Error(t, err) assert.Equal(t, mesosproto.Status_DRIVER_STOPPED, stat) assert.False(t, driver.Running()) // Restart should not start. stat, err = driver.Start() assert.False(t, driver.Running()) assert.Error(t, err) assert.Equal(t, mesosproto.Status_DRIVER_STOPPED, stat) messenger.AssertNumberOfCalls(t, "Start", 1) messenger.AssertNumberOfCalls(t, "UPID", 1) messenger.AssertNumberOfCalls(t, "Send", 1) messenger.AssertNumberOfCalls(t, "Stop", 1) } func TestExecutorDriverSendStatusUpdate(t *testing.T) { driver, _, _ := createTestExecutorDriver(t) stat, err := driver.Start() assert.NoError(t, err) assert.Equal(t, mesosproto.Status_DRIVER_RUNNING, stat) driver.setConnected(true) taskStatus := util.NewTaskStatus( util.NewTaskID("test-task-001"), mesosproto.TaskState_TASK_RUNNING, ) stat, err = driver.SendStatusUpdate(taskStatus) assert.NoError(t, err) assert.Equal(t, mesosproto.Status_DRIVER_RUNNING, stat) } func TestExecutorDriverSendStatusUpdateStaging(t *testing.T) { driver, _, _ := createTestExecutorDriver(t) stat, err := driver.Start() assert.NoError(t, err) assert.Equal(t, mesosproto.Status_DRIVER_RUNNING, stat) driver.setConnected(true) taskStatus := util.NewTaskStatus( util.NewTaskID("test-task-001"), mesosproto.TaskState_TASK_STAGING, ) stat, err = driver.SendStatusUpdate(taskStatus) assert.Error(t, err) assert.Equal(t, mesosproto.Status_DRIVER_ABORTED, stat) } func TestExecutorDriverSendFrameworkMessage(t *testing.T) { driver, _, _ := createTestExecutorDriver(t) stat, err := driver.SendFrameworkMessage("failed") assert.Error(t, err) stat, err = driver.Start() assert.NoError(t, err) assert.Equal(t, mesosproto.Status_DRIVER_RUNNING, stat) driver.setConnected(true) stat, err = driver.SendFrameworkMessage("Testing Mesos") assert.NoError(t, err) assert.Equal(t, mesosproto.Status_DRIVER_RUNNING, stat) } func TestStatusUpdateAckRace_Issue103(t *testing.T) { driver, _, _ := createTestExecutorDriver(t) _, err := driver.Start() assert.NoError(t, err) msg := &mesosproto.StatusUpdateAcknowledgementMessage{} go func() { driver.lock.Lock() defer driver.lock.Unlock() driver.statusUpdateAcknowledgement(nil, msg) }() taskStatus := util.NewTaskStatus( util.NewTaskID("test-task-001"), mesosproto.TaskState_TASK_STAGING, ) driver.SendStatusUpdate(taskStatus) } mesos-go-0.0.1/executor/mocked_executor.go000066400000000000000000000042771257601144100206210ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 executor import ( "github.com/mesos/mesos-go/mesosproto" "github.com/stretchr/testify/mock" ) // MockedExecutor is used for testing the executor driver. type MockedExecutor struct { mock.Mock } // NewMockedExecutor returns a mocked executor. func NewMockedExecutor() *MockedExecutor { return &MockedExecutor{} } // Registered implements the Registered handler. func (e *MockedExecutor) Registered(ExecutorDriver, *mesosproto.ExecutorInfo, *mesosproto.FrameworkInfo, *mesosproto.SlaveInfo) { e.Called() } // Reregistered implements the Reregistered handler. func (e *MockedExecutor) Reregistered(ExecutorDriver, *mesosproto.SlaveInfo) { e.Called() } // Disconnected implements the Disconnected handler. func (e *MockedExecutor) Disconnected(ExecutorDriver) { e.Called() } // LaunchTask implements the LaunchTask handler. func (e *MockedExecutor) LaunchTask(ExecutorDriver, *mesosproto.TaskInfo) { e.Called() } // KillTask implements the KillTask handler. func (e *MockedExecutor) KillTask(ExecutorDriver, *mesosproto.TaskID) { e.Called() } // FrameworkMessage implements the FrameworkMessage handler. func (e *MockedExecutor) FrameworkMessage(ExecutorDriver, string) { e.Called() } // Shutdown implements the Shutdown handler. func (e *MockedExecutor) Shutdown(ExecutorDriver) { e.Called() } // Error implements the Error handler. func (e *MockedExecutor) Error(ExecutorDriver, string) { e.Called() } mesos-go-0.0.1/healthchecker/000077500000000000000000000000001257601144100160345ustar00rootroot00000000000000mesos-go-0.0.1/healthchecker/health_checker.go000066400000000000000000000026651257601144100213250ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 healthchecker import ( "time" "github.com/mesos/mesos-go/upid" ) // HealthChecker defines the interface of a health checker. type HealthChecker interface { // Start will start the health checker, and returns a notification channel. // if the checker thinks the slave is unhealthy, it will send the timestamp // via the channel. Start() <-chan time.Time // Pause will pause the slave health checker. Pause() // Continue will continue the slave health checker with a new slave upid. Continue(slaveUPID *upid.UPID) // Stop will stop the health checker. it should be called only once during // the life span of the checker. Stop() } mesos-go-0.0.1/healthchecker/mocked_slave_health_checker.go000066400000000000000000000033111257601144100240260ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 healthchecker import ( "time" "github.com/mesos/mesos-go/upid" "github.com/stretchr/testify/mock" ) type MockedHealthChecker struct { mock.Mock ch chan time.Time } // NewMockedHealthChecker returns a new mocked health checker. func NewMockedHealthChecker() *MockedHealthChecker { return &MockedHealthChecker{ch: make(chan time.Time, 1)} } // Start will start the checker and returns the notification channel. func (m *MockedHealthChecker) Start() <-chan time.Time { m.Called() return m.ch } // Pause will pause the slave health checker. func (m *MockedHealthChecker) Pause() { m.Called() } // Continue will continue the slave health checker with a new slave upid. func (m *MockedHealthChecker) Continue(slaveUPID *upid.UPID) { m.Called() } // Stop will stop the checker. func (m *MockedHealthChecker) Stop() { m.Called() } func (m *MockedHealthChecker) TriggerUnhealthyEvent() { m.ch <- time.Now() } mesos-go-0.0.1/healthchecker/slave_health_checker.go000066400000000000000000000115211257601144100225060ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 healthchecker import ( "errors" "fmt" "net/http" "sync" "sync/atomic" "time" log "github.com/golang/glog" "github.com/mesos/mesos-go/upid" ) const ( defaultTimeout = time.Second defaultCheckDuration = time.Second defaultThreshold = 5 ) var errCheckerStopped = errors.New("aborted HTTP request because checker was asked to stop") // SlaveHealthChecker is for checking the slave's health. type SlaveHealthChecker struct { sync.RWMutex slaveUPID *upid.UPID tr *http.Transport client *http.Client threshold int32 checkDuration time.Duration continuousUnhealthyCount int32 stop chan struct{} ch chan time.Time paused bool } // NewSlaveHealthChecker creates a slave health checker and return a notification channel. // Each time the checker thinks the slave is unhealthy, it will send a notification through the channel. func NewSlaveHealthChecker(slaveUPID *upid.UPID, threshold int, checkDuration time.Duration, timeout time.Duration) *SlaveHealthChecker { tr := &http.Transport{} checker := &SlaveHealthChecker{ slaveUPID: slaveUPID, client: &http.Client{Timeout: timeout, Transport: tr}, threshold: int32(threshold), checkDuration: checkDuration, stop: make(chan struct{}), ch: make(chan time.Time, 1), tr: tr, } if timeout == 0 { checker.client.Timeout = defaultTimeout } if checkDuration == 0 { checker.checkDuration = defaultCheckDuration } if threshold <= 0 { checker.threshold = defaultThreshold } return checker } // Start will start the health checker and returns the notification channel. func (s *SlaveHealthChecker) Start() <-chan time.Time { go func() { t := time.NewTicker(s.checkDuration) defer t.Stop() for { select { case <-t.C: select { case <-s.stop: return default: // continue } if paused, slavepid := func() (x bool, y upid.UPID) { s.RLock() defer s.RUnlock() x = s.paused if s.slaveUPID != nil { y = *s.slaveUPID } return }(); !paused { s.doCheck(slavepid) } case <-s.stop: return } } }() return s.ch } // Pause will pause the slave health checker. func (s *SlaveHealthChecker) Pause() { s.Lock() defer s.Unlock() s.paused = true } // Continue will continue the slave health checker with a new slave upid. func (s *SlaveHealthChecker) Continue(slaveUPID *upid.UPID) { s.Lock() defer s.Unlock() s.paused = false s.slaveUPID = slaveUPID } // Stop will stop the slave health checker. // It should be called only once during the life span of the checker. func (s *SlaveHealthChecker) Stop() { close(s.stop) } func (s *SlaveHealthChecker) doCheck(pid upid.UPID) { unhealthy := false path := fmt.Sprintf("http://%s:%s/%s/health", pid.Host, pid.Port, pid.ID) req, err := http.NewRequest("HEAD", path, nil) req.Close = true err = s.httpDo(req, func(resp *http.Response, err error) error { if err != nil { return err } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return fmt.Errorf("http status error: %v\n", resp.StatusCode) } return nil }) select { case <-s.stop: return default: } if err != nil { log.Errorf("Failed to request the health path: %v\n", err) unhealthy = true } if unhealthy { x := atomic.AddInt32(&s.continuousUnhealthyCount, 1) if x >= s.threshold { select { case s.ch <- time.Now(): // If no one is receiving the channel, then just skip it. default: } atomic.StoreInt32(&s.continuousUnhealthyCount, 0) } return } atomic.StoreInt32(&s.continuousUnhealthyCount, 0) } func (s *SlaveHealthChecker) httpDo(req *http.Request, f func(*http.Response, error) error) error { // Run the HTTP request in a goroutine and pass the response to f. c := make(chan error, 1) go func() { c <- f(s.client.Do(req)) }() select { case <-s.stop: s.tr.CancelRequest(req) <-c // Wait for f to return. return errCheckerStopped case err := <-c: return err } } mesos-go-0.0.1/healthchecker/slave_health_checker_test.go000066400000000000000000000154611257601144100235540ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 healthchecker import ( "fmt" "net/http" "net/http/httptest" "sync" "sync/atomic" "testing" "time" "github.com/mesos/mesos-go/upid" "github.com/stretchr/testify/assert" ) type thresholdMonitor struct { cnt int32 threshold int32 } func newThresholdMonitor(threshold int) *thresholdMonitor { return &thresholdMonitor{threshold: int32(threshold)} } // incAndTest returns true if the threshold is reached. func (t *thresholdMonitor) incAndTest() bool { if atomic.AddInt32(&t.cnt, 1) >= t.threshold { return false } return true } // blockedServer replies only threshold times, after that // it will block. type blockedServer struct { th *thresholdMonitor ch chan struct{} } func newBlockedServer(threshold int) *blockedServer { return &blockedServer{ th: newThresholdMonitor(threshold), ch: make(chan struct{}), } } func (s *blockedServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { if s.th.incAndTest() { return } <-s.ch } func (s *blockedServer) stop() { close(s.ch) } // eofServer will close the connection after it replies for threshold times. // Thus the health checker will get an EOF error. type eofServer struct { th *thresholdMonitor } func newEOFServer(threshold int) *eofServer { return &eofServer{newThresholdMonitor(threshold)} } func (s *eofServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { if s.th.incAndTest() { return } hj := w.(http.Hijacker) conn, _, err := hj.Hijack() if err != nil { panic("Cannot hijack") } conn.Close() } // errorStatusCodeServer will reply error status code (e.g. 503) after the // it replies for threhold time. type errorStatusCodeServer struct { th *thresholdMonitor } func newErrorStatusServer(threshold int) *errorStatusCodeServer { return &errorStatusCodeServer{newThresholdMonitor(threshold)} } func (s *errorStatusCodeServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { if s.th.incAndTest() { return } w.WriteHeader(http.StatusServiceUnavailable) } // goodServer always returns status ok. type goodServer bool func (s *goodServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {} // partitionedServer returns status ok at some first requests. // Then it will block for a while, and then reply again. type partitionedServer struct { healthyCnt int32 partitionCnt int32 cnt int32 mutex *sync.Mutex cond *sync.Cond } func newPartitionedServer(healthyCnt, partitionCnt int) *partitionedServer { mutex := new(sync.Mutex) cond := sync.NewCond(mutex) return &partitionedServer{ healthyCnt: int32(healthyCnt), partitionCnt: int32(partitionCnt), mutex: mutex, cond: cond, } } func (s *partitionedServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { cnt := atomic.AddInt32(&s.cnt, 1) if cnt < s.healthyCnt { return } if cnt < s.healthyCnt+s.partitionCnt { s.mutex.Lock() defer s.mutex.Unlock() s.cond.Wait() return } s.mutex.Lock() defer s.mutex.Unlock() s.cond.Broadcast() } func TestSlaveHealthCheckerFailedOnBlockedSlave(t *testing.T) { s := newBlockedServer(5) ts := httptest.NewUnstartedServer(s) ts.Start() defer ts.Close() upid, err := upid.Parse(fmt.Sprintf("slave@%s", ts.Listener.Addr().String())) assert.NoError(t, err) checker := NewSlaveHealthChecker(upid, 10, time.Millisecond*10, time.Millisecond*10) ch := checker.Start() defer checker.Stop() select { case <-time.After(time.Second): s.stop() t.Fatal("timeout") case <-ch: s.stop() assert.True(t, atomic.LoadInt32(&s.th.cnt) > 10) } // TODO(jdef) hack: this sucks, but there's a data race in httptest's handler when Close() // and ServeHTTP() are invoked (WaitGroup DATA RACE). Sleeping here to attempt to avoid that. time.Sleep(5 * time.Second) } func TestSlaveHealthCheckerFailedOnEOFSlave(t *testing.T) { s := newEOFServer(5) ts := httptest.NewUnstartedServer(s) ts.Start() defer ts.Close() upid, err := upid.Parse(fmt.Sprintf("slave@%s", ts.Listener.Addr().String())) assert.NoError(t, err) checker := NewSlaveHealthChecker(upid, 10, time.Millisecond*10, time.Millisecond*10) ch := checker.Start() defer checker.Stop() select { case <-time.After(time.Second): t.Fatal("timeout") case <-ch: assert.True(t, atomic.LoadInt32(&s.th.cnt) > 10) } } func TestSlaveHealthCheckerFailedOnErrorStatusSlave(t *testing.T) { s := newErrorStatusServer(5) ts := httptest.NewUnstartedServer(s) ts.Start() defer ts.Close() upid, err := upid.Parse(fmt.Sprintf("slave@%s", ts.Listener.Addr().String())) assert.NoError(t, err) checker := NewSlaveHealthChecker(upid, 10, time.Millisecond*10, time.Millisecond*10) ch := checker.Start() defer checker.Stop() select { case <-time.After(time.Second): t.Fatal("timeout") case <-ch: assert.True(t, atomic.LoadInt32(&s.th.cnt) > 10) } } func TestSlaveHealthCheckerSucceed(t *testing.T) { s := new(goodServer) ts := httptest.NewUnstartedServer(s) ts.Start() defer ts.Close() upid, err := upid.Parse(fmt.Sprintf("slave@%s", ts.Listener.Addr().String())) assert.NoError(t, err) checker := NewSlaveHealthChecker(upid, 10, time.Millisecond*10, time.Millisecond*10) ch := checker.Start() defer checker.Stop() select { case <-time.After(time.Second): assert.EqualValues(t, 0, atomic.LoadInt32(&checker.continuousUnhealthyCount)) case <-ch: t.Fatal("Shouldn't get unhealthy notification") } } func TestSlaveHealthCheckerPartitonedSlave(t *testing.T) { s := newPartitionedServer(5, 9) ts := httptest.NewUnstartedServer(s) ts.Start() defer ts.Close() t.Log("test server listening on", ts.Listener.Addr()) upid, err := upid.Parse(fmt.Sprintf("slave@%s", ts.Listener.Addr().String())) assert.NoError(t, err) checker := NewSlaveHealthChecker(upid, 10, time.Millisecond*10, time.Millisecond*10) ch := checker.Start() defer func() { checker.Stop() <-checker.stop }() select { case <-time.After(2 * time.Second): actual := atomic.LoadInt32(&checker.continuousUnhealthyCount) assert.EqualValues(t, 0, actual, "expected 0 unhealthy counts instead of %d", actual) case <-ch: t.Fatal("Shouldn't get unhealthy notification") } } mesos-go-0.0.1/mesos/000077500000000000000000000000001257601144100143705ustar00rootroot00000000000000mesos-go-0.0.1/mesos/doc.go000066400000000000000000000002401257601144100154600ustar00rootroot00000000000000// This package was previously the home of the native bindings. Please use the // native branch if you need to build against the native bindings. package mesos mesos-go-0.0.1/mesosproto/000077500000000000000000000000001257601144100154545ustar00rootroot00000000000000mesos-go-0.0.1/mesosproto/Makefile000066400000000000000000000001671257601144100171200ustar00rootroot00000000000000all: *.proto protoc --proto_path=${GOPATH}/src:${GOPATH}/src/github.com/gogo/protobuf/protobuf:. --gogo_out=. *.proto mesos-go-0.0.1/mesosproto/authentication.pb.go000066400000000000000000000142321257601144100214240ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: authentication.proto // DO NOT EDIT! /* Package mesosproto is a generated protocol buffer package. It is generated from these files: authentication.proto containerizer.proto internal.proto log.proto mesos.proto messages.proto registry.proto scheduler.proto state.proto It has these top-level messages: AuthenticateMessage AuthenticationMechanismsMessage AuthenticationStartMessage AuthenticationStepMessage AuthenticationCompletedMessage AuthenticationFailedMessage AuthenticationErrorMessage Launch Update Wait Destroy Usage Termination Containers InternalMasterChangeDetected InternalTryAuthentication InternalAuthenticationResult Promise Action Metadata Record PromiseRequest PromiseResponse WriteRequest WriteResponse LearnedMessage RecoverRequest RecoverResponse FrameworkID OfferID SlaveID TaskID ExecutorID ContainerID FrameworkInfo HealthCheck CommandInfo ExecutorInfo MasterInfo SlaveInfo Value Attribute Resource TrafficControlStatistics ResourceStatistics ResourceUsage PerfStatistics Request Offer TaskInfo TaskStatus Filters Environment Parameter Parameters Credential Credentials ACL ACLs RateLimit RateLimits Volume ContainerInfo Labels Label Port Ports DiscoveryInfo Task StatusUpdate StatusUpdateRecord SubmitSchedulerRequest SubmitSchedulerResponse ExecutorToFrameworkMessage FrameworkToExecutorMessage RegisterFrameworkMessage ReregisterFrameworkMessage FrameworkRegisteredMessage FrameworkReregisteredMessage UnregisterFrameworkMessage DeactivateFrameworkMessage ResourceRequestMessage ResourceOffersMessage LaunchTasksMessage RescindResourceOfferMessage ReviveOffersMessage RunTaskMessage KillTaskMessage StatusUpdateMessage StatusUpdateAcknowledgementMessage LostSlaveMessage ReconcileTasksMessage FrameworkErrorMessage RegisterSlaveMessage ReregisterSlaveMessage SlaveRegisteredMessage SlaveReregisteredMessage UnregisterSlaveMessage MasterSlaveConnection PingSlaveMessage PongSlaveMessage ShutdownFrameworkMessage ShutdownExecutorMessage UpdateFrameworkMessage CheckpointResourcesMessage UpdateSlaveMessage RegisterExecutorMessage ExecutorRegisteredMessage ExecutorReregisteredMessage ExitedExecutorMessage ReconnectExecutorMessage ReregisterExecutorMessage ShutdownMessage Archive TaskHealthStatus HookExecuted Registry Event Call Entry Operation */ package mesosproto import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf type AuthenticateMessage struct { Pid *string `protobuf:"bytes,1,req,name=pid" json:"pid,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *AuthenticateMessage) Reset() { *m = AuthenticateMessage{} } func (m *AuthenticateMessage) String() string { return proto.CompactTextString(m) } func (*AuthenticateMessage) ProtoMessage() {} func (m *AuthenticateMessage) GetPid() string { if m != nil && m.Pid != nil { return *m.Pid } return "" } type AuthenticationMechanismsMessage struct { Mechanisms []string `protobuf:"bytes,1,rep,name=mechanisms" json:"mechanisms,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *AuthenticationMechanismsMessage) Reset() { *m = AuthenticationMechanismsMessage{} } func (m *AuthenticationMechanismsMessage) String() string { return proto.CompactTextString(m) } func (*AuthenticationMechanismsMessage) ProtoMessage() {} func (m *AuthenticationMechanismsMessage) GetMechanisms() []string { if m != nil { return m.Mechanisms } return nil } type AuthenticationStartMessage struct { Mechanism *string `protobuf:"bytes,1,req,name=mechanism" json:"mechanism,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *AuthenticationStartMessage) Reset() { *m = AuthenticationStartMessage{} } func (m *AuthenticationStartMessage) String() string { return proto.CompactTextString(m) } func (*AuthenticationStartMessage) ProtoMessage() {} func (m *AuthenticationStartMessage) GetMechanism() string { if m != nil && m.Mechanism != nil { return *m.Mechanism } return "" } func (m *AuthenticationStartMessage) GetData() []byte { if m != nil { return m.Data } return nil } type AuthenticationStepMessage struct { Data []byte `protobuf:"bytes,1,req,name=data" json:"data,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *AuthenticationStepMessage) Reset() { *m = AuthenticationStepMessage{} } func (m *AuthenticationStepMessage) String() string { return proto.CompactTextString(m) } func (*AuthenticationStepMessage) ProtoMessage() {} func (m *AuthenticationStepMessage) GetData() []byte { if m != nil { return m.Data } return nil } type AuthenticationCompletedMessage struct { XXX_unrecognized []byte `json:"-"` } func (m *AuthenticationCompletedMessage) Reset() { *m = AuthenticationCompletedMessage{} } func (m *AuthenticationCompletedMessage) String() string { return proto.CompactTextString(m) } func (*AuthenticationCompletedMessage) ProtoMessage() {} type AuthenticationFailedMessage struct { XXX_unrecognized []byte `json:"-"` } func (m *AuthenticationFailedMessage) Reset() { *m = AuthenticationFailedMessage{} } func (m *AuthenticationFailedMessage) String() string { return proto.CompactTextString(m) } func (*AuthenticationFailedMessage) ProtoMessage() {} type AuthenticationErrorMessage struct { Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *AuthenticationErrorMessage) Reset() { *m = AuthenticationErrorMessage{} } func (m *AuthenticationErrorMessage) String() string { return proto.CompactTextString(m) } func (*AuthenticationErrorMessage) ProtoMessage() {} func (m *AuthenticationErrorMessage) GetError() string { if m != nil && m.Error != nil { return *m.Error } return "" } mesos-go-0.0.1/mesosproto/authentication.proto000066400000000000000000000025601257601144100215630ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 mesosproto; import "mesos.proto"; message AuthenticateMessage { required string pid = 1; // PID that needs to be authenticated. } message AuthenticationMechanismsMessage { repeated string mechanisms = 1; // List of available SASL mechanisms. } message AuthenticationStartMessage { required string mechanism = 1; optional bytes data = 2; } message AuthenticationStepMessage { required bytes data = 1; } message AuthenticationCompletedMessage {} message AuthenticationFailedMessage {} message AuthenticationErrorMessage { optional string error = 1; } mesos-go-0.0.1/mesosproto/containerizer.pb.go000066400000000000000000000143341257601144100212640ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: containerizer.proto // DO NOT EDIT! package mesosproto import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // * // Encodes the launch command sent to the external containerizer // program. type Launch struct { ContainerId *ContainerID `protobuf:"bytes,1,req,name=container_id" json:"container_id,omitempty"` TaskInfo *TaskInfo `protobuf:"bytes,2,opt,name=task_info" json:"task_info,omitempty"` ExecutorInfo *ExecutorInfo `protobuf:"bytes,3,opt,name=executor_info" json:"executor_info,omitempty"` Directory *string `protobuf:"bytes,4,opt,name=directory" json:"directory,omitempty"` User *string `protobuf:"bytes,5,opt,name=user" json:"user,omitempty"` SlaveId *SlaveID `protobuf:"bytes,6,opt,name=slave_id" json:"slave_id,omitempty"` SlavePid *string `protobuf:"bytes,7,opt,name=slave_pid" json:"slave_pid,omitempty"` Checkpoint *bool `protobuf:"varint,8,opt,name=checkpoint" json:"checkpoint,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Launch) Reset() { *m = Launch{} } func (m *Launch) String() string { return proto.CompactTextString(m) } func (*Launch) ProtoMessage() {} func (m *Launch) GetContainerId() *ContainerID { if m != nil { return m.ContainerId } return nil } func (m *Launch) GetTaskInfo() *TaskInfo { if m != nil { return m.TaskInfo } return nil } func (m *Launch) GetExecutorInfo() *ExecutorInfo { if m != nil { return m.ExecutorInfo } return nil } func (m *Launch) GetDirectory() string { if m != nil && m.Directory != nil { return *m.Directory } return "" } func (m *Launch) GetUser() string { if m != nil && m.User != nil { return *m.User } return "" } func (m *Launch) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *Launch) GetSlavePid() string { if m != nil && m.SlavePid != nil { return *m.SlavePid } return "" } func (m *Launch) GetCheckpoint() bool { if m != nil && m.Checkpoint != nil { return *m.Checkpoint } return false } // * // Encodes the update command sent to the external containerizer // program. type Update struct { ContainerId *ContainerID `protobuf:"bytes,1,req,name=container_id" json:"container_id,omitempty"` Resources []*Resource `protobuf:"bytes,2,rep,name=resources" json:"resources,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Update) Reset() { *m = Update{} } func (m *Update) String() string { return proto.CompactTextString(m) } func (*Update) ProtoMessage() {} func (m *Update) GetContainerId() *ContainerID { if m != nil { return m.ContainerId } return nil } func (m *Update) GetResources() []*Resource { if m != nil { return m.Resources } return nil } // * // Encodes the wait command sent to the external containerizer // program. type Wait struct { ContainerId *ContainerID `protobuf:"bytes,1,req,name=container_id" json:"container_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Wait) Reset() { *m = Wait{} } func (m *Wait) String() string { return proto.CompactTextString(m) } func (*Wait) ProtoMessage() {} func (m *Wait) GetContainerId() *ContainerID { if m != nil { return m.ContainerId } return nil } // * // Encodes the destroy command sent to the external containerizer // program. type Destroy struct { ContainerId *ContainerID `protobuf:"bytes,1,req,name=container_id" json:"container_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Destroy) Reset() { *m = Destroy{} } func (m *Destroy) String() string { return proto.CompactTextString(m) } func (*Destroy) ProtoMessage() {} func (m *Destroy) GetContainerId() *ContainerID { if m != nil { return m.ContainerId } return nil } // * // Encodes the usage command sent to the external containerizer // program. type Usage struct { ContainerId *ContainerID `protobuf:"bytes,1,req,name=container_id" json:"container_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Usage) Reset() { *m = Usage{} } func (m *Usage) String() string { return proto.CompactTextString(m) } func (*Usage) ProtoMessage() {} func (m *Usage) GetContainerId() *ContainerID { if m != nil { return m.ContainerId } return nil } // * // Information about a container termination, returned by the // containerizer to the slave. type Termination struct { // A container may be killed if it exceeds its resources; this will // be indicated by killed=true and described by the message string. // TODO(jaybuff): As part of MESOS-2035 we should remove killed and // replace it with a TaskStatus::Reason. Killed *bool `protobuf:"varint,1,req,name=killed" json:"killed,omitempty"` Message *string `protobuf:"bytes,2,req,name=message" json:"message,omitempty"` // Exit status of the process. Status *int32 `protobuf:"varint,3,opt,name=status" json:"status,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Termination) Reset() { *m = Termination{} } func (m *Termination) String() string { return proto.CompactTextString(m) } func (*Termination) ProtoMessage() {} func (m *Termination) GetKilled() bool { if m != nil && m.Killed != nil { return *m.Killed } return false } func (m *Termination) GetMessage() string { if m != nil && m.Message != nil { return *m.Message } return "" } func (m *Termination) GetStatus() int32 { if m != nil && m.Status != nil { return *m.Status } return 0 } // * // Information on all active containers returned by the containerizer // to the slave. type Containers struct { Containers []*ContainerID `protobuf:"bytes,1,rep,name=containers" json:"containers,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Containers) Reset() { *m = Containers{} } func (m *Containers) String() string { return proto.CompactTextString(m) } func (*Containers) ProtoMessage() {} func (m *Containers) GetContainers() []*ContainerID { if m != nil { return m.Containers } return nil } mesos-go-0.0.1/mesosproto/containerizer.proto000066400000000000000000000050131257601144100214140ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 mesosproto; import "mesos.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; /** * Encodes the launch command sent to the external containerizer * program. */ message Launch { required ContainerID container_id = 1; optional TaskInfo task_info = 2; optional ExecutorInfo executor_info = 3; optional string directory = 4; optional string user = 5; optional SlaveID slave_id = 6; optional string slave_pid = 7; optional bool checkpoint = 8; } /** * Encodes the update command sent to the external containerizer * program. */ message Update { required ContainerID container_id = 1; repeated Resource resources = 2; } /** * Encodes the wait command sent to the external containerizer * program. */ message Wait { required ContainerID container_id = 1; } /** * Encodes the destroy command sent to the external containerizer * program. */ message Destroy { required ContainerID container_id = 1; } /** * Encodes the usage command sent to the external containerizer * program. */ message Usage { required ContainerID container_id = 1; } /** * Information about a container termination, returned by the * containerizer to the slave. */ message Termination { // A container may be killed if it exceeds its resources; this will // be indicated by killed=true and described by the message string. // TODO(jaybuff): As part of MESOS-2035 we should remove killed and // replace it with a TaskStatus::Reason. required bool killed = 1; required string message = 2; // Exit status of the process. optional int32 status = 3; } /** * Information on all active containers returned by the containerizer * to the slave. */ message Containers { repeated ContainerID containers = 1; } mesos-go-0.0.1/mesosproto/internal.pb.go000066400000000000000000000047061257601144100202260ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: internal.proto // DO NOT EDIT! package mesosproto import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // For use with detector callbacks type InternalMasterChangeDetected struct { // will be present if there's a new master, otherwise nil Master *MasterInfo `protobuf:"bytes,1,opt,name=master" json:"master,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *InternalMasterChangeDetected) Reset() { *m = InternalMasterChangeDetected{} } func (m *InternalMasterChangeDetected) String() string { return proto.CompactTextString(m) } func (*InternalMasterChangeDetected) ProtoMessage() {} func (m *InternalMasterChangeDetected) GetMaster() *MasterInfo { if m != nil { return m.Master } return nil } type InternalTryAuthentication struct { XXX_unrecognized []byte `json:"-"` } func (m *InternalTryAuthentication) Reset() { *m = InternalTryAuthentication{} } func (m *InternalTryAuthentication) String() string { return proto.CompactTextString(m) } func (*InternalTryAuthentication) ProtoMessage() {} type InternalAuthenticationResult struct { // true only if the authentication process completed and login was successful Success *bool `protobuf:"varint,1,req,name=success" json:"success,omitempty"` // true if the authentication process completed, successfully or not Completed *bool `protobuf:"varint,2,req,name=completed" json:"completed,omitempty"` // master pid that this result pertains to Pid *string `protobuf:"bytes,3,req,name=pid" json:"pid,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *InternalAuthenticationResult) Reset() { *m = InternalAuthenticationResult{} } func (m *InternalAuthenticationResult) String() string { return proto.CompactTextString(m) } func (*InternalAuthenticationResult) ProtoMessage() {} func (m *InternalAuthenticationResult) GetSuccess() bool { if m != nil && m.Success != nil { return *m.Success } return false } func (m *InternalAuthenticationResult) GetCompleted() bool { if m != nil && m.Completed != nil { return *m.Completed } return false } func (m *InternalAuthenticationResult) GetPid() string { if m != nil && m.Pid != nil { return *m.Pid } return "" } mesos-go-0.0.1/mesosproto/internal.proto000066400000000000000000000012621257601144100203560ustar00rootroot00000000000000package mesosproto; import "mesos.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; // For use with detector callbacks message InternalMasterChangeDetected { // will be present if there's a new master, otherwise nil optional MasterInfo master = 1; } message InternalTryAuthentication { // empty message, serves as a signal to the scheduler bindings } message InternalAuthenticationResult { // true only if the authentication process completed and login was successful required bool success = 1; // true if the authentication process completed, successfully or not required bool completed = 2; // master pid that this result pertains to required string pid = 3; } mesos-go-0.0.1/mesosproto/log.pb.go000066400000000000000000003635561257601144100172060ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: log.proto // DO NOT EDIT! package mesosproto import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto" import bytes "bytes" import strings "strings" import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" import sort "sort" import strconv "strconv" import reflect "reflect" import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf type Action_Type int32 const ( Action_NOP Action_Type = 1 Action_APPEND Action_Type = 2 Action_TRUNCATE Action_Type = 3 ) var Action_Type_name = map[int32]string{ 1: "NOP", 2: "APPEND", 3: "TRUNCATE", } var Action_Type_value = map[string]int32{ "NOP": 1, "APPEND": 2, "TRUNCATE": 3, } func (x Action_Type) Enum() *Action_Type { p := new(Action_Type) *p = x return p } func (x Action_Type) String() string { return proto.EnumName(Action_Type_name, int32(x)) } func (x *Action_Type) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(Action_Type_value, data, "Action_Type") if err != nil { return err } *x = Action_Type(value) return nil } type Metadata_Status int32 const ( Metadata_VOTING Metadata_Status = 1 Metadata_RECOVERING Metadata_Status = 2 Metadata_STARTING Metadata_Status = 3 Metadata_EMPTY Metadata_Status = 4 ) var Metadata_Status_name = map[int32]string{ 1: "VOTING", 2: "RECOVERING", 3: "STARTING", 4: "EMPTY", } var Metadata_Status_value = map[string]int32{ "VOTING": 1, "RECOVERING": 2, "STARTING": 3, "EMPTY": 4, } func (x Metadata_Status) Enum() *Metadata_Status { p := new(Metadata_Status) *p = x return p } func (x Metadata_Status) String() string { return proto.EnumName(Metadata_Status_name, int32(x)) } func (x *Metadata_Status) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(Metadata_Status_value, data, "Metadata_Status") if err != nil { return err } *x = Metadata_Status(value) return nil } type Record_Type int32 const ( Record_PROMISE Record_Type = 1 Record_ACTION Record_Type = 2 Record_METADATA Record_Type = 3 ) var Record_Type_name = map[int32]string{ 1: "PROMISE", 2: "ACTION", 3: "METADATA", } var Record_Type_value = map[string]int32{ "PROMISE": 1, "ACTION": 2, "METADATA": 3, } func (x Record_Type) Enum() *Record_Type { p := new(Record_Type) *p = x return p } func (x Record_Type) String() string { return proto.EnumName(Record_Type_name, int32(x)) } func (x *Record_Type) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(Record_Type_value, data, "Record_Type") if err != nil { return err } *x = Record_Type(value) return nil } // Represents a "promise" that a replica has made. A promise is // *implicitly* valid for _all_ future actions that get performed on // the replicated log (provided the action comes from the same // proposer), until a new promise is made to a proposer with a higher // proposal number. Each replica writes every promise it makes as a // log record so that it can recover this information after a failure. // TODO(benh): Does the promise actually need to be written to stable // storage? Can we get away with looking at the last written action // and using it's promised value? In this case, what happens if we // make a promise but don't receive an action from that coordinator? type Promise struct { Proposal *uint64 `protobuf:"varint,1,req,name=proposal" json:"proposal,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Promise) Reset() { *m = Promise{} } func (*Promise) ProtoMessage() {} func (m *Promise) GetProposal() uint64 { if m != nil && m.Proposal != nil { return *m.Proposal } return 0 } // Represents an "action" performed on the log. Each action has an // associated position in the log. In addition, each action (i.e., // position) will have been "promised" to a specific proposer // (implicitly or explicitly) and may have been "performed" from a // specific proposer. An action may also be "learned" to have reached // consensus. There are three types of possible actions that can be // performed on the log: nop (no action), append, and truncate. type Action struct { Position *uint64 `protobuf:"varint,1,req,name=position" json:"position,omitempty"` Promised *uint64 `protobuf:"varint,2,req,name=promised" json:"promised,omitempty"` Performed *uint64 `protobuf:"varint,3,opt,name=performed" json:"performed,omitempty"` Learned *bool `protobuf:"varint,4,opt,name=learned" json:"learned,omitempty"` Type *Action_Type `protobuf:"varint,5,opt,name=type,enum=mesosproto.Action_Type" json:"type,omitempty"` Nop *Action_Nop `protobuf:"bytes,6,opt,name=nop" json:"nop,omitempty"` Append *Action_Append `protobuf:"bytes,7,opt,name=append" json:"append,omitempty"` Truncate *Action_Truncate `protobuf:"bytes,8,opt,name=truncate" json:"truncate,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Action) Reset() { *m = Action{} } func (*Action) ProtoMessage() {} func (m *Action) GetPosition() uint64 { if m != nil && m.Position != nil { return *m.Position } return 0 } func (m *Action) GetPromised() uint64 { if m != nil && m.Promised != nil { return *m.Promised } return 0 } func (m *Action) GetPerformed() uint64 { if m != nil && m.Performed != nil { return *m.Performed } return 0 } func (m *Action) GetLearned() bool { if m != nil && m.Learned != nil { return *m.Learned } return false } func (m *Action) GetType() Action_Type { if m != nil && m.Type != nil { return *m.Type } return Action_NOP } func (m *Action) GetNop() *Action_Nop { if m != nil { return m.Nop } return nil } func (m *Action) GetAppend() *Action_Append { if m != nil { return m.Append } return nil } func (m *Action) GetTruncate() *Action_Truncate { if m != nil { return m.Truncate } return nil } type Action_Nop struct { XXX_unrecognized []byte `json:"-"` } func (m *Action_Nop) Reset() { *m = Action_Nop{} } func (*Action_Nop) ProtoMessage() {} type Action_Append struct { Bytes []byte `protobuf:"bytes,1,req,name=bytes" json:"bytes,omitempty"` Cksum []byte `protobuf:"bytes,2,opt,name=cksum" json:"cksum,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Action_Append) Reset() { *m = Action_Append{} } func (*Action_Append) ProtoMessage() {} func (m *Action_Append) GetBytes() []byte { if m != nil { return m.Bytes } return nil } func (m *Action_Append) GetCksum() []byte { if m != nil { return m.Cksum } return nil } type Action_Truncate struct { To *uint64 `protobuf:"varint,1,req,name=to" json:"to,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Action_Truncate) Reset() { *m = Action_Truncate{} } func (*Action_Truncate) ProtoMessage() {} func (m *Action_Truncate) GetTo() uint64 { if m != nil && m.To != nil { return *m.To } return 0 } // The metadata of a replica. It has to be persisted on the disk. We // store the current status of the replica as well as the implicit // promise that a replica has made. This message is intended to // replace the old Promise message to support catch-up. type Metadata struct { Status *Metadata_Status `protobuf:"varint,1,req,name=status,enum=mesosproto.Metadata_Status,def=4" json:"status,omitempty"` Promised *uint64 `protobuf:"varint,2,req,name=promised,def=0" json:"promised,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Metadata) Reset() { *m = Metadata{} } func (*Metadata) ProtoMessage() {} const Default_Metadata_Status Metadata_Status = Metadata_EMPTY const Default_Metadata_Promised uint64 = 0 func (m *Metadata) GetStatus() Metadata_Status { if m != nil && m.Status != nil { return *m.Status } return Default_Metadata_Status } func (m *Metadata) GetPromised() uint64 { if m != nil && m.Promised != nil { return *m.Promised } return Default_Metadata_Promised } // Represents a log record written to the local filesystem by a // replica. A log record may store a promise (DEPRECATED), an action // or metadata (defined above). type Record struct { Type *Record_Type `protobuf:"varint,1,req,name=type,enum=mesosproto.Record_Type" json:"type,omitempty"` Promise *Promise `protobuf:"bytes,2,opt,name=promise" json:"promise,omitempty"` Action *Action `protobuf:"bytes,3,opt,name=action" json:"action,omitempty"` Metadata *Metadata `protobuf:"bytes,4,opt,name=metadata" json:"metadata,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Record) Reset() { *m = Record{} } func (*Record) ProtoMessage() {} func (m *Record) GetType() Record_Type { if m != nil && m.Type != nil { return *m.Type } return Record_PROMISE } func (m *Record) GetPromise() *Promise { if m != nil { return m.Promise } return nil } func (m *Record) GetAction() *Action { if m != nil { return m.Action } return nil } func (m *Record) GetMetadata() *Metadata { if m != nil { return m.Metadata } return nil } // Represents a "promise" request from a proposer with the specified // 'proposal' to a replica. If the proposer is a coordinator, most // such requests will occur after a coordinator has failed and a new // coordinator is elected. In such a case, the position that the // coordinator is asking the replica to promise is implicitly *all* // positions that the replica has made no promises (thus the position // field is not be used). In other instances, however, a proposer // might be explicitly trying to request that a replica promise a // specific position in the log (such as when trying to fill holes // discovered during a client read), and then the 'position' field // will be present. type PromiseRequest struct { Proposal *uint64 `protobuf:"varint,1,req,name=proposal" json:"proposal,omitempty"` Position *uint64 `protobuf:"varint,2,opt,name=position" json:"position,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *PromiseRequest) Reset() { *m = PromiseRequest{} } func (*PromiseRequest) ProtoMessage() {} func (m *PromiseRequest) GetProposal() uint64 { if m != nil && m.Proposal != nil { return *m.Proposal } return 0 } func (m *PromiseRequest) GetPosition() uint64 { if m != nil && m.Position != nil { return *m.Position } return 0 } // Represents a "promise" response from a replica back to a proposer. // A replica represents a NACK (because it has promised a proposer // with a higher proposal number) by setting the okay field to false. // The 'proposal' is either the aforementioned higher proposal number // when the response is a NACK, or the corresponding request's // proposal number if it is an ACK. The replica either sends back the // highest position it has recorded in the log (using the 'position' // field) or the specific action (if any) it has at the position // requested in PromiseRequest (using the 'action' field). type PromiseResponse struct { Okay *bool `protobuf:"varint,1,req,name=okay" json:"okay,omitempty"` Proposal *uint64 `protobuf:"varint,2,req,name=proposal" json:"proposal,omitempty"` Position *uint64 `protobuf:"varint,4,opt,name=position" json:"position,omitempty"` Action *Action `protobuf:"bytes,3,opt,name=action" json:"action,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *PromiseResponse) Reset() { *m = PromiseResponse{} } func (*PromiseResponse) ProtoMessage() {} func (m *PromiseResponse) GetOkay() bool { if m != nil && m.Okay != nil { return *m.Okay } return false } func (m *PromiseResponse) GetProposal() uint64 { if m != nil && m.Proposal != nil { return *m.Proposal } return 0 } func (m *PromiseResponse) GetPosition() uint64 { if m != nil && m.Position != nil { return *m.Position } return 0 } func (m *PromiseResponse) GetAction() *Action { if m != nil { return m.Action } return nil } // Represents a write request for a specific type of action. Note that // we deliberately do not include the entire Action as it contains // fields that are not relevant to a write request (e.g., promised, // performed) and rather than ignore them we exclude them for safety. type WriteRequest struct { Proposal *uint64 `protobuf:"varint,1,req,name=proposal" json:"proposal,omitempty"` Position *uint64 `protobuf:"varint,2,req,name=position" json:"position,omitempty"` Learned *bool `protobuf:"varint,3,opt,name=learned" json:"learned,omitempty"` Type *Action_Type `protobuf:"varint,4,req,name=type,enum=mesosproto.Action_Type" json:"type,omitempty"` Nop *Action_Nop `protobuf:"bytes,5,opt,name=nop" json:"nop,omitempty"` Append *Action_Append `protobuf:"bytes,6,opt,name=append" json:"append,omitempty"` Truncate *Action_Truncate `protobuf:"bytes,7,opt,name=truncate" json:"truncate,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *WriteRequest) Reset() { *m = WriteRequest{} } func (*WriteRequest) ProtoMessage() {} func (m *WriteRequest) GetProposal() uint64 { if m != nil && m.Proposal != nil { return *m.Proposal } return 0 } func (m *WriteRequest) GetPosition() uint64 { if m != nil && m.Position != nil { return *m.Position } return 0 } func (m *WriteRequest) GetLearned() bool { if m != nil && m.Learned != nil { return *m.Learned } return false } func (m *WriteRequest) GetType() Action_Type { if m != nil && m.Type != nil { return *m.Type } return Action_NOP } func (m *WriteRequest) GetNop() *Action_Nop { if m != nil { return m.Nop } return nil } func (m *WriteRequest) GetAppend() *Action_Append { if m != nil { return m.Append } return nil } func (m *WriteRequest) GetTruncate() *Action_Truncate { if m != nil { return m.Truncate } return nil } // Represents a write response corresponding to a write request. A // replica represents a NACK (because it has promised a proposer with // a higher proposal number) by setting the okay field to false. If // the proposer is a coordinator, then it has been demoted. The // 'position' should always correspond to the position set in the // request. The 'proposal' is either the same proposal number set in // the request in the case of an ACK, or the higher proposal number // this position has been promised to in the case of a NACK. type WriteResponse struct { Okay *bool `protobuf:"varint,1,req,name=okay" json:"okay,omitempty"` Proposal *uint64 `protobuf:"varint,2,req,name=proposal" json:"proposal,omitempty"` Position *uint64 `protobuf:"varint,3,req,name=position" json:"position,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *WriteResponse) Reset() { *m = WriteResponse{} } func (*WriteResponse) ProtoMessage() {} func (m *WriteResponse) GetOkay() bool { if m != nil && m.Okay != nil { return *m.Okay } return false } func (m *WriteResponse) GetProposal() uint64 { if m != nil && m.Proposal != nil { return *m.Proposal } return 0 } func (m *WriteResponse) GetPosition() uint64 { if m != nil && m.Position != nil { return *m.Position } return 0 } // Represents a "learned" event, that is, when a particular action has // been agreed upon (reached consensus). type LearnedMessage struct { Action *Action `protobuf:"bytes,1,req,name=action" json:"action,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *LearnedMessage) Reset() { *m = LearnedMessage{} } func (*LearnedMessage) ProtoMessage() {} func (m *LearnedMessage) GetAction() *Action { if m != nil { return m.Action } return nil } // Represents a recover request. A recover request is used to initiate // the recovery (by broadcasting it). type RecoverRequest struct { XXX_unrecognized []byte `json:"-"` } func (m *RecoverRequest) Reset() { *m = RecoverRequest{} } func (*RecoverRequest) ProtoMessage() {} // When a replica receives a RecoverRequest, it will reply with its // current status, and the begin and the end of its current log. type RecoverResponse struct { Status *Metadata_Status `protobuf:"varint,1,req,name=status,enum=mesosproto.Metadata_Status" json:"status,omitempty"` Begin *uint64 `protobuf:"varint,2,opt,name=begin" json:"begin,omitempty"` End *uint64 `protobuf:"varint,3,opt,name=end" json:"end,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *RecoverResponse) Reset() { *m = RecoverResponse{} } func (*RecoverResponse) ProtoMessage() {} func (m *RecoverResponse) GetStatus() Metadata_Status { if m != nil && m.Status != nil { return *m.Status } return Metadata_VOTING } func (m *RecoverResponse) GetBegin() uint64 { if m != nil && m.Begin != nil { return *m.Begin } return 0 } func (m *RecoverResponse) GetEnd() uint64 { if m != nil && m.End != nil { return *m.End } return 0 } func init() { proto.RegisterEnum("mesosproto.Action_Type", Action_Type_name, Action_Type_value) proto.RegisterEnum("mesosproto.Metadata_Status", Metadata_Status_name, Metadata_Status_value) proto.RegisterEnum("mesosproto.Record_Type", Record_Type_name, Record_Type_value) } func (this *Promise) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Promise) if !ok { return fmt.Errorf("that is not of type *Promise") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Promise but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Promisebut is not nil && this == nil") } if this.Proposal != nil && that1.Proposal != nil { if *this.Proposal != *that1.Proposal { return fmt.Errorf("Proposal this(%v) Not Equal that(%v)", *this.Proposal, *that1.Proposal) } } else if this.Proposal != nil { return fmt.Errorf("this.Proposal == nil && that.Proposal != nil") } else if that1.Proposal != nil { return fmt.Errorf("Proposal this(%v) Not Equal that(%v)", this.Proposal, that1.Proposal) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Promise) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Promise) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Proposal != nil && that1.Proposal != nil { if *this.Proposal != *that1.Proposal { return false } } else if this.Proposal != nil { return false } else if that1.Proposal != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Action) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Action) if !ok { return fmt.Errorf("that is not of type *Action") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Action but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Actionbut is not nil && this == nil") } if this.Position != nil && that1.Position != nil { if *this.Position != *that1.Position { return fmt.Errorf("Position this(%v) Not Equal that(%v)", *this.Position, *that1.Position) } } else if this.Position != nil { return fmt.Errorf("this.Position == nil && that.Position != nil") } else if that1.Position != nil { return fmt.Errorf("Position this(%v) Not Equal that(%v)", this.Position, that1.Position) } if this.Promised != nil && that1.Promised != nil { if *this.Promised != *that1.Promised { return fmt.Errorf("Promised this(%v) Not Equal that(%v)", *this.Promised, *that1.Promised) } } else if this.Promised != nil { return fmt.Errorf("this.Promised == nil && that.Promised != nil") } else if that1.Promised != nil { return fmt.Errorf("Promised this(%v) Not Equal that(%v)", this.Promised, that1.Promised) } if this.Performed != nil && that1.Performed != nil { if *this.Performed != *that1.Performed { return fmt.Errorf("Performed this(%v) Not Equal that(%v)", *this.Performed, *that1.Performed) } } else if this.Performed != nil { return fmt.Errorf("this.Performed == nil && that.Performed != nil") } else if that1.Performed != nil { return fmt.Errorf("Performed this(%v) Not Equal that(%v)", this.Performed, that1.Performed) } if this.Learned != nil && that1.Learned != nil { if *this.Learned != *that1.Learned { return fmt.Errorf("Learned this(%v) Not Equal that(%v)", *this.Learned, *that1.Learned) } } else if this.Learned != nil { return fmt.Errorf("this.Learned == nil && that.Learned != nil") } else if that1.Learned != nil { return fmt.Errorf("Learned this(%v) Not Equal that(%v)", this.Learned, that1.Learned) } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return fmt.Errorf("Type this(%v) Not Equal that(%v)", *this.Type, *that1.Type) } } else if this.Type != nil { return fmt.Errorf("this.Type == nil && that.Type != nil") } else if that1.Type != nil { return fmt.Errorf("Type this(%v) Not Equal that(%v)", this.Type, that1.Type) } if !this.Nop.Equal(that1.Nop) { return fmt.Errorf("Nop this(%v) Not Equal that(%v)", this.Nop, that1.Nop) } if !this.Append.Equal(that1.Append) { return fmt.Errorf("Append this(%v) Not Equal that(%v)", this.Append, that1.Append) } if !this.Truncate.Equal(that1.Truncate) { return fmt.Errorf("Truncate this(%v) Not Equal that(%v)", this.Truncate, that1.Truncate) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Action) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Action) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Position != nil && that1.Position != nil { if *this.Position != *that1.Position { return false } } else if this.Position != nil { return false } else if that1.Position != nil { return false } if this.Promised != nil && that1.Promised != nil { if *this.Promised != *that1.Promised { return false } } else if this.Promised != nil { return false } else if that1.Promised != nil { return false } if this.Performed != nil && that1.Performed != nil { if *this.Performed != *that1.Performed { return false } } else if this.Performed != nil { return false } else if that1.Performed != nil { return false } if this.Learned != nil && that1.Learned != nil { if *this.Learned != *that1.Learned { return false } } else if this.Learned != nil { return false } else if that1.Learned != nil { return false } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return false } } else if this.Type != nil { return false } else if that1.Type != nil { return false } if !this.Nop.Equal(that1.Nop) { return false } if !this.Append.Equal(that1.Append) { return false } if !this.Truncate.Equal(that1.Truncate) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Action_Nop) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Action_Nop) if !ok { return fmt.Errorf("that is not of type *Action_Nop") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Action_Nop but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Action_Nopbut is not nil && this == nil") } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Action_Nop) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Action_Nop) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Action_Append) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Action_Append) if !ok { return fmt.Errorf("that is not of type *Action_Append") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Action_Append but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Action_Appendbut is not nil && this == nil") } if !bytes.Equal(this.Bytes, that1.Bytes) { return fmt.Errorf("Bytes this(%v) Not Equal that(%v)", this.Bytes, that1.Bytes) } if !bytes.Equal(this.Cksum, that1.Cksum) { return fmt.Errorf("Cksum this(%v) Not Equal that(%v)", this.Cksum, that1.Cksum) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Action_Append) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Action_Append) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !bytes.Equal(this.Bytes, that1.Bytes) { return false } if !bytes.Equal(this.Cksum, that1.Cksum) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Action_Truncate) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Action_Truncate) if !ok { return fmt.Errorf("that is not of type *Action_Truncate") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Action_Truncate but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Action_Truncatebut is not nil && this == nil") } if this.To != nil && that1.To != nil { if *this.To != *that1.To { return fmt.Errorf("To this(%v) Not Equal that(%v)", *this.To, *that1.To) } } else if this.To != nil { return fmt.Errorf("this.To == nil && that.To != nil") } else if that1.To != nil { return fmt.Errorf("To this(%v) Not Equal that(%v)", this.To, that1.To) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Action_Truncate) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Action_Truncate) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.To != nil && that1.To != nil { if *this.To != *that1.To { return false } } else if this.To != nil { return false } else if that1.To != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Metadata) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Metadata) if !ok { return fmt.Errorf("that is not of type *Metadata") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Metadata but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Metadatabut is not nil && this == nil") } if this.Status != nil && that1.Status != nil { if *this.Status != *that1.Status { return fmt.Errorf("Status this(%v) Not Equal that(%v)", *this.Status, *that1.Status) } } else if this.Status != nil { return fmt.Errorf("this.Status == nil && that.Status != nil") } else if that1.Status != nil { return fmt.Errorf("Status this(%v) Not Equal that(%v)", this.Status, that1.Status) } if this.Promised != nil && that1.Promised != nil { if *this.Promised != *that1.Promised { return fmt.Errorf("Promised this(%v) Not Equal that(%v)", *this.Promised, *that1.Promised) } } else if this.Promised != nil { return fmt.Errorf("this.Promised == nil && that.Promised != nil") } else if that1.Promised != nil { return fmt.Errorf("Promised this(%v) Not Equal that(%v)", this.Promised, that1.Promised) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Metadata) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Metadata) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Status != nil && that1.Status != nil { if *this.Status != *that1.Status { return false } } else if this.Status != nil { return false } else if that1.Status != nil { return false } if this.Promised != nil && that1.Promised != nil { if *this.Promised != *that1.Promised { return false } } else if this.Promised != nil { return false } else if that1.Promised != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Record) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Record) if !ok { return fmt.Errorf("that is not of type *Record") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Record but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Recordbut is not nil && this == nil") } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return fmt.Errorf("Type this(%v) Not Equal that(%v)", *this.Type, *that1.Type) } } else if this.Type != nil { return fmt.Errorf("this.Type == nil && that.Type != nil") } else if that1.Type != nil { return fmt.Errorf("Type this(%v) Not Equal that(%v)", this.Type, that1.Type) } if !this.Promise.Equal(that1.Promise) { return fmt.Errorf("Promise this(%v) Not Equal that(%v)", this.Promise, that1.Promise) } if !this.Action.Equal(that1.Action) { return fmt.Errorf("Action this(%v) Not Equal that(%v)", this.Action, that1.Action) } if !this.Metadata.Equal(that1.Metadata) { return fmt.Errorf("Metadata this(%v) Not Equal that(%v)", this.Metadata, that1.Metadata) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Record) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Record) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return false } } else if this.Type != nil { return false } else if that1.Type != nil { return false } if !this.Promise.Equal(that1.Promise) { return false } if !this.Action.Equal(that1.Action) { return false } if !this.Metadata.Equal(that1.Metadata) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *PromiseRequest) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*PromiseRequest) if !ok { return fmt.Errorf("that is not of type *PromiseRequest") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *PromiseRequest but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *PromiseRequestbut is not nil && this == nil") } if this.Proposal != nil && that1.Proposal != nil { if *this.Proposal != *that1.Proposal { return fmt.Errorf("Proposal this(%v) Not Equal that(%v)", *this.Proposal, *that1.Proposal) } } else if this.Proposal != nil { return fmt.Errorf("this.Proposal == nil && that.Proposal != nil") } else if that1.Proposal != nil { return fmt.Errorf("Proposal this(%v) Not Equal that(%v)", this.Proposal, that1.Proposal) } if this.Position != nil && that1.Position != nil { if *this.Position != *that1.Position { return fmt.Errorf("Position this(%v) Not Equal that(%v)", *this.Position, *that1.Position) } } else if this.Position != nil { return fmt.Errorf("this.Position == nil && that.Position != nil") } else if that1.Position != nil { return fmt.Errorf("Position this(%v) Not Equal that(%v)", this.Position, that1.Position) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *PromiseRequest) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*PromiseRequest) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Proposal != nil && that1.Proposal != nil { if *this.Proposal != *that1.Proposal { return false } } else if this.Proposal != nil { return false } else if that1.Proposal != nil { return false } if this.Position != nil && that1.Position != nil { if *this.Position != *that1.Position { return false } } else if this.Position != nil { return false } else if that1.Position != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *PromiseResponse) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*PromiseResponse) if !ok { return fmt.Errorf("that is not of type *PromiseResponse") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *PromiseResponse but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *PromiseResponsebut is not nil && this == nil") } if this.Okay != nil && that1.Okay != nil { if *this.Okay != *that1.Okay { return fmt.Errorf("Okay this(%v) Not Equal that(%v)", *this.Okay, *that1.Okay) } } else if this.Okay != nil { return fmt.Errorf("this.Okay == nil && that.Okay != nil") } else if that1.Okay != nil { return fmt.Errorf("Okay this(%v) Not Equal that(%v)", this.Okay, that1.Okay) } if this.Proposal != nil && that1.Proposal != nil { if *this.Proposal != *that1.Proposal { return fmt.Errorf("Proposal this(%v) Not Equal that(%v)", *this.Proposal, *that1.Proposal) } } else if this.Proposal != nil { return fmt.Errorf("this.Proposal == nil && that.Proposal != nil") } else if that1.Proposal != nil { return fmt.Errorf("Proposal this(%v) Not Equal that(%v)", this.Proposal, that1.Proposal) } if this.Position != nil && that1.Position != nil { if *this.Position != *that1.Position { return fmt.Errorf("Position this(%v) Not Equal that(%v)", *this.Position, *that1.Position) } } else if this.Position != nil { return fmt.Errorf("this.Position == nil && that.Position != nil") } else if that1.Position != nil { return fmt.Errorf("Position this(%v) Not Equal that(%v)", this.Position, that1.Position) } if !this.Action.Equal(that1.Action) { return fmt.Errorf("Action this(%v) Not Equal that(%v)", this.Action, that1.Action) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *PromiseResponse) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*PromiseResponse) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Okay != nil && that1.Okay != nil { if *this.Okay != *that1.Okay { return false } } else if this.Okay != nil { return false } else if that1.Okay != nil { return false } if this.Proposal != nil && that1.Proposal != nil { if *this.Proposal != *that1.Proposal { return false } } else if this.Proposal != nil { return false } else if that1.Proposal != nil { return false } if this.Position != nil && that1.Position != nil { if *this.Position != *that1.Position { return false } } else if this.Position != nil { return false } else if that1.Position != nil { return false } if !this.Action.Equal(that1.Action) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *WriteRequest) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*WriteRequest) if !ok { return fmt.Errorf("that is not of type *WriteRequest") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *WriteRequest but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *WriteRequestbut is not nil && this == nil") } if this.Proposal != nil && that1.Proposal != nil { if *this.Proposal != *that1.Proposal { return fmt.Errorf("Proposal this(%v) Not Equal that(%v)", *this.Proposal, *that1.Proposal) } } else if this.Proposal != nil { return fmt.Errorf("this.Proposal == nil && that.Proposal != nil") } else if that1.Proposal != nil { return fmt.Errorf("Proposal this(%v) Not Equal that(%v)", this.Proposal, that1.Proposal) } if this.Position != nil && that1.Position != nil { if *this.Position != *that1.Position { return fmt.Errorf("Position this(%v) Not Equal that(%v)", *this.Position, *that1.Position) } } else if this.Position != nil { return fmt.Errorf("this.Position == nil && that.Position != nil") } else if that1.Position != nil { return fmt.Errorf("Position this(%v) Not Equal that(%v)", this.Position, that1.Position) } if this.Learned != nil && that1.Learned != nil { if *this.Learned != *that1.Learned { return fmt.Errorf("Learned this(%v) Not Equal that(%v)", *this.Learned, *that1.Learned) } } else if this.Learned != nil { return fmt.Errorf("this.Learned == nil && that.Learned != nil") } else if that1.Learned != nil { return fmt.Errorf("Learned this(%v) Not Equal that(%v)", this.Learned, that1.Learned) } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return fmt.Errorf("Type this(%v) Not Equal that(%v)", *this.Type, *that1.Type) } } else if this.Type != nil { return fmt.Errorf("this.Type == nil && that.Type != nil") } else if that1.Type != nil { return fmt.Errorf("Type this(%v) Not Equal that(%v)", this.Type, that1.Type) } if !this.Nop.Equal(that1.Nop) { return fmt.Errorf("Nop this(%v) Not Equal that(%v)", this.Nop, that1.Nop) } if !this.Append.Equal(that1.Append) { return fmt.Errorf("Append this(%v) Not Equal that(%v)", this.Append, that1.Append) } if !this.Truncate.Equal(that1.Truncate) { return fmt.Errorf("Truncate this(%v) Not Equal that(%v)", this.Truncate, that1.Truncate) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *WriteRequest) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*WriteRequest) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Proposal != nil && that1.Proposal != nil { if *this.Proposal != *that1.Proposal { return false } } else if this.Proposal != nil { return false } else if that1.Proposal != nil { return false } if this.Position != nil && that1.Position != nil { if *this.Position != *that1.Position { return false } } else if this.Position != nil { return false } else if that1.Position != nil { return false } if this.Learned != nil && that1.Learned != nil { if *this.Learned != *that1.Learned { return false } } else if this.Learned != nil { return false } else if that1.Learned != nil { return false } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return false } } else if this.Type != nil { return false } else if that1.Type != nil { return false } if !this.Nop.Equal(that1.Nop) { return false } if !this.Append.Equal(that1.Append) { return false } if !this.Truncate.Equal(that1.Truncate) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *WriteResponse) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*WriteResponse) if !ok { return fmt.Errorf("that is not of type *WriteResponse") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *WriteResponse but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *WriteResponsebut is not nil && this == nil") } if this.Okay != nil && that1.Okay != nil { if *this.Okay != *that1.Okay { return fmt.Errorf("Okay this(%v) Not Equal that(%v)", *this.Okay, *that1.Okay) } } else if this.Okay != nil { return fmt.Errorf("this.Okay == nil && that.Okay != nil") } else if that1.Okay != nil { return fmt.Errorf("Okay this(%v) Not Equal that(%v)", this.Okay, that1.Okay) } if this.Proposal != nil && that1.Proposal != nil { if *this.Proposal != *that1.Proposal { return fmt.Errorf("Proposal this(%v) Not Equal that(%v)", *this.Proposal, *that1.Proposal) } } else if this.Proposal != nil { return fmt.Errorf("this.Proposal == nil && that.Proposal != nil") } else if that1.Proposal != nil { return fmt.Errorf("Proposal this(%v) Not Equal that(%v)", this.Proposal, that1.Proposal) } if this.Position != nil && that1.Position != nil { if *this.Position != *that1.Position { return fmt.Errorf("Position this(%v) Not Equal that(%v)", *this.Position, *that1.Position) } } else if this.Position != nil { return fmt.Errorf("this.Position == nil && that.Position != nil") } else if that1.Position != nil { return fmt.Errorf("Position this(%v) Not Equal that(%v)", this.Position, that1.Position) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *WriteResponse) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*WriteResponse) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Okay != nil && that1.Okay != nil { if *this.Okay != *that1.Okay { return false } } else if this.Okay != nil { return false } else if that1.Okay != nil { return false } if this.Proposal != nil && that1.Proposal != nil { if *this.Proposal != *that1.Proposal { return false } } else if this.Proposal != nil { return false } else if that1.Proposal != nil { return false } if this.Position != nil && that1.Position != nil { if *this.Position != *that1.Position { return false } } else if this.Position != nil { return false } else if that1.Position != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *LearnedMessage) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*LearnedMessage) if !ok { return fmt.Errorf("that is not of type *LearnedMessage") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *LearnedMessage but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *LearnedMessagebut is not nil && this == nil") } if !this.Action.Equal(that1.Action) { return fmt.Errorf("Action this(%v) Not Equal that(%v)", this.Action, that1.Action) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *LearnedMessage) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*LearnedMessage) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.Action.Equal(that1.Action) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *RecoverRequest) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*RecoverRequest) if !ok { return fmt.Errorf("that is not of type *RecoverRequest") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *RecoverRequest but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *RecoverRequestbut is not nil && this == nil") } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *RecoverRequest) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*RecoverRequest) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *RecoverResponse) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*RecoverResponse) if !ok { return fmt.Errorf("that is not of type *RecoverResponse") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *RecoverResponse but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *RecoverResponsebut is not nil && this == nil") } if this.Status != nil && that1.Status != nil { if *this.Status != *that1.Status { return fmt.Errorf("Status this(%v) Not Equal that(%v)", *this.Status, *that1.Status) } } else if this.Status != nil { return fmt.Errorf("this.Status == nil && that.Status != nil") } else if that1.Status != nil { return fmt.Errorf("Status this(%v) Not Equal that(%v)", this.Status, that1.Status) } if this.Begin != nil && that1.Begin != nil { if *this.Begin != *that1.Begin { return fmt.Errorf("Begin this(%v) Not Equal that(%v)", *this.Begin, *that1.Begin) } } else if this.Begin != nil { return fmt.Errorf("this.Begin == nil && that.Begin != nil") } else if that1.Begin != nil { return fmt.Errorf("Begin this(%v) Not Equal that(%v)", this.Begin, that1.Begin) } if this.End != nil && that1.End != nil { if *this.End != *that1.End { return fmt.Errorf("End this(%v) Not Equal that(%v)", *this.End, *that1.End) } } else if this.End != nil { return fmt.Errorf("this.End == nil && that.End != nil") } else if that1.End != nil { return fmt.Errorf("End this(%v) Not Equal that(%v)", this.End, that1.End) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *RecoverResponse) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*RecoverResponse) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Status != nil && that1.Status != nil { if *this.Status != *that1.Status { return false } } else if this.Status != nil { return false } else if that1.Status != nil { return false } if this.Begin != nil && that1.Begin != nil { if *this.Begin != *that1.Begin { return false } } else if this.Begin != nil { return false } else if that1.Begin != nil { return false } if this.End != nil && that1.End != nil { if *this.End != *that1.End { return false } } else if this.End != nil { return false } else if that1.End != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Promise) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Promise{") if this.Proposal != nil { s = append(s, "Proposal: "+valueToGoStringLog(this.Proposal, "uint64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Action) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 12) s = append(s, "&mesosproto.Action{") if this.Position != nil { s = append(s, "Position: "+valueToGoStringLog(this.Position, "uint64")+",\n") } if this.Promised != nil { s = append(s, "Promised: "+valueToGoStringLog(this.Promised, "uint64")+",\n") } if this.Performed != nil { s = append(s, "Performed: "+valueToGoStringLog(this.Performed, "uint64")+",\n") } if this.Learned != nil { s = append(s, "Learned: "+valueToGoStringLog(this.Learned, "bool")+",\n") } if this.Type != nil { s = append(s, "Type: "+valueToGoStringLog(this.Type, "mesosproto.Action_Type")+",\n") } if this.Nop != nil { s = append(s, "Nop: "+fmt.Sprintf("%#v", this.Nop)+",\n") } if this.Append != nil { s = append(s, "Append: "+fmt.Sprintf("%#v", this.Append)+",\n") } if this.Truncate != nil { s = append(s, "Truncate: "+fmt.Sprintf("%#v", this.Truncate)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Action_Nop) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 4) s = append(s, "&mesosproto.Action_Nop{") if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Action_Append) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.Action_Append{") if this.Bytes != nil { s = append(s, "Bytes: "+valueToGoStringLog(this.Bytes, "byte")+",\n") } if this.Cksum != nil { s = append(s, "Cksum: "+valueToGoStringLog(this.Cksum, "byte")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Action_Truncate) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Action_Truncate{") if this.To != nil { s = append(s, "To: "+valueToGoStringLog(this.To, "uint64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Metadata) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.Metadata{") if this.Status != nil { s = append(s, "Status: "+valueToGoStringLog(this.Status, "mesosproto.Metadata_Status")+",\n") } if this.Promised != nil { s = append(s, "Promised: "+valueToGoStringLog(this.Promised, "uint64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Record) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 8) s = append(s, "&mesosproto.Record{") if this.Type != nil { s = append(s, "Type: "+valueToGoStringLog(this.Type, "mesosproto.Record_Type")+",\n") } if this.Promise != nil { s = append(s, "Promise: "+fmt.Sprintf("%#v", this.Promise)+",\n") } if this.Action != nil { s = append(s, "Action: "+fmt.Sprintf("%#v", this.Action)+",\n") } if this.Metadata != nil { s = append(s, "Metadata: "+fmt.Sprintf("%#v", this.Metadata)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *PromiseRequest) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.PromiseRequest{") if this.Proposal != nil { s = append(s, "Proposal: "+valueToGoStringLog(this.Proposal, "uint64")+",\n") } if this.Position != nil { s = append(s, "Position: "+valueToGoStringLog(this.Position, "uint64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *PromiseResponse) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 8) s = append(s, "&mesosproto.PromiseResponse{") if this.Okay != nil { s = append(s, "Okay: "+valueToGoStringLog(this.Okay, "bool")+",\n") } if this.Proposal != nil { s = append(s, "Proposal: "+valueToGoStringLog(this.Proposal, "uint64")+",\n") } if this.Position != nil { s = append(s, "Position: "+valueToGoStringLog(this.Position, "uint64")+",\n") } if this.Action != nil { s = append(s, "Action: "+fmt.Sprintf("%#v", this.Action)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *WriteRequest) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 11) s = append(s, "&mesosproto.WriteRequest{") if this.Proposal != nil { s = append(s, "Proposal: "+valueToGoStringLog(this.Proposal, "uint64")+",\n") } if this.Position != nil { s = append(s, "Position: "+valueToGoStringLog(this.Position, "uint64")+",\n") } if this.Learned != nil { s = append(s, "Learned: "+valueToGoStringLog(this.Learned, "bool")+",\n") } if this.Type != nil { s = append(s, "Type: "+valueToGoStringLog(this.Type, "mesosproto.Action_Type")+",\n") } if this.Nop != nil { s = append(s, "Nop: "+fmt.Sprintf("%#v", this.Nop)+",\n") } if this.Append != nil { s = append(s, "Append: "+fmt.Sprintf("%#v", this.Append)+",\n") } if this.Truncate != nil { s = append(s, "Truncate: "+fmt.Sprintf("%#v", this.Truncate)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *WriteResponse) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 7) s = append(s, "&mesosproto.WriteResponse{") if this.Okay != nil { s = append(s, "Okay: "+valueToGoStringLog(this.Okay, "bool")+",\n") } if this.Proposal != nil { s = append(s, "Proposal: "+valueToGoStringLog(this.Proposal, "uint64")+",\n") } if this.Position != nil { s = append(s, "Position: "+valueToGoStringLog(this.Position, "uint64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *LearnedMessage) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.LearnedMessage{") if this.Action != nil { s = append(s, "Action: "+fmt.Sprintf("%#v", this.Action)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *RecoverRequest) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 4) s = append(s, "&mesosproto.RecoverRequest{") if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *RecoverResponse) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 7) s = append(s, "&mesosproto.RecoverResponse{") if this.Status != nil { s = append(s, "Status: "+valueToGoStringLog(this.Status, "mesosproto.Metadata_Status")+",\n") } if this.Begin != nil { s = append(s, "Begin: "+valueToGoStringLog(this.Begin, "uint64")+",\n") } if this.End != nil { s = append(s, "End: "+valueToGoStringLog(this.End, "uint64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func valueToGoStringLog(v interface{}, typ string) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) } func extensionToGoStringLog(e map[int32]github_com_gogo_protobuf_proto.Extension) string { if e == nil { return "nil" } s := "map[int32]proto.Extension{" keys := make([]int, 0, len(e)) for k := range e { keys = append(keys, int(k)) } sort.Ints(keys) ss := []string{} for _, k := range keys { ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) } s += strings.Join(ss, ",") + "}" return s } func (m *Promise) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Promise) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Proposal == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("proposal") } else { data[i] = 0x8 i++ i = encodeVarintLog(data, i, uint64(*m.Proposal)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Action) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Action) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Position == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("position") } else { data[i] = 0x8 i++ i = encodeVarintLog(data, i, uint64(*m.Position)) } if m.Promised == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("promised") } else { data[i] = 0x10 i++ i = encodeVarintLog(data, i, uint64(*m.Promised)) } if m.Performed != nil { data[i] = 0x18 i++ i = encodeVarintLog(data, i, uint64(*m.Performed)) } if m.Learned != nil { data[i] = 0x20 i++ if *m.Learned { data[i] = 1 } else { data[i] = 0 } i++ } if m.Type != nil { data[i] = 0x28 i++ i = encodeVarintLog(data, i, uint64(*m.Type)) } if m.Nop != nil { data[i] = 0x32 i++ i = encodeVarintLog(data, i, uint64(m.Nop.Size())) n1, err := m.Nop.MarshalTo(data[i:]) if err != nil { return 0, err } i += n1 } if m.Append != nil { data[i] = 0x3a i++ i = encodeVarintLog(data, i, uint64(m.Append.Size())) n2, err := m.Append.MarshalTo(data[i:]) if err != nil { return 0, err } i += n2 } if m.Truncate != nil { data[i] = 0x42 i++ i = encodeVarintLog(data, i, uint64(m.Truncate.Size())) n3, err := m.Truncate.MarshalTo(data[i:]) if err != nil { return 0, err } i += n3 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Action_Nop) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Action_Nop) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Action_Append) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Action_Append) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Bytes == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("bytes") } else { data[i] = 0xa i++ i = encodeVarintLog(data, i, uint64(len(m.Bytes))) i += copy(data[i:], m.Bytes) } if m.Cksum != nil { data[i] = 0x12 i++ i = encodeVarintLog(data, i, uint64(len(m.Cksum))) i += copy(data[i:], m.Cksum) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Action_Truncate) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Action_Truncate) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.To == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("to") } else { data[i] = 0x8 i++ i = encodeVarintLog(data, i, uint64(*m.To)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Metadata) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Metadata) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Status == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("status") } else { data[i] = 0x8 i++ i = encodeVarintLog(data, i, uint64(*m.Status)) } if m.Promised == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("promised") } else { data[i] = 0x10 i++ i = encodeVarintLog(data, i, uint64(*m.Promised)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Record) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Record) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Type == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } else { data[i] = 0x8 i++ i = encodeVarintLog(data, i, uint64(*m.Type)) } if m.Promise != nil { data[i] = 0x12 i++ i = encodeVarintLog(data, i, uint64(m.Promise.Size())) n4, err := m.Promise.MarshalTo(data[i:]) if err != nil { return 0, err } i += n4 } if m.Action != nil { data[i] = 0x1a i++ i = encodeVarintLog(data, i, uint64(m.Action.Size())) n5, err := m.Action.MarshalTo(data[i:]) if err != nil { return 0, err } i += n5 } if m.Metadata != nil { data[i] = 0x22 i++ i = encodeVarintLog(data, i, uint64(m.Metadata.Size())) n6, err := m.Metadata.MarshalTo(data[i:]) if err != nil { return 0, err } i += n6 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *PromiseRequest) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *PromiseRequest) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Proposal == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("proposal") } else { data[i] = 0x8 i++ i = encodeVarintLog(data, i, uint64(*m.Proposal)) } if m.Position != nil { data[i] = 0x10 i++ i = encodeVarintLog(data, i, uint64(*m.Position)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *PromiseResponse) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *PromiseResponse) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Okay == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("okay") } else { data[i] = 0x8 i++ if *m.Okay { data[i] = 1 } else { data[i] = 0 } i++ } if m.Proposal == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("proposal") } else { data[i] = 0x10 i++ i = encodeVarintLog(data, i, uint64(*m.Proposal)) } if m.Action != nil { data[i] = 0x1a i++ i = encodeVarintLog(data, i, uint64(m.Action.Size())) n7, err := m.Action.MarshalTo(data[i:]) if err != nil { return 0, err } i += n7 } if m.Position != nil { data[i] = 0x20 i++ i = encodeVarintLog(data, i, uint64(*m.Position)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *WriteRequest) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *WriteRequest) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Proposal == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("proposal") } else { data[i] = 0x8 i++ i = encodeVarintLog(data, i, uint64(*m.Proposal)) } if m.Position == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("position") } else { data[i] = 0x10 i++ i = encodeVarintLog(data, i, uint64(*m.Position)) } if m.Learned != nil { data[i] = 0x18 i++ if *m.Learned { data[i] = 1 } else { data[i] = 0 } i++ } if m.Type == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } else { data[i] = 0x20 i++ i = encodeVarintLog(data, i, uint64(*m.Type)) } if m.Nop != nil { data[i] = 0x2a i++ i = encodeVarintLog(data, i, uint64(m.Nop.Size())) n8, err := m.Nop.MarshalTo(data[i:]) if err != nil { return 0, err } i += n8 } if m.Append != nil { data[i] = 0x32 i++ i = encodeVarintLog(data, i, uint64(m.Append.Size())) n9, err := m.Append.MarshalTo(data[i:]) if err != nil { return 0, err } i += n9 } if m.Truncate != nil { data[i] = 0x3a i++ i = encodeVarintLog(data, i, uint64(m.Truncate.Size())) n10, err := m.Truncate.MarshalTo(data[i:]) if err != nil { return 0, err } i += n10 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *WriteResponse) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *WriteResponse) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Okay == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("okay") } else { data[i] = 0x8 i++ if *m.Okay { data[i] = 1 } else { data[i] = 0 } i++ } if m.Proposal == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("proposal") } else { data[i] = 0x10 i++ i = encodeVarintLog(data, i, uint64(*m.Proposal)) } if m.Position == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("position") } else { data[i] = 0x18 i++ i = encodeVarintLog(data, i, uint64(*m.Position)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *LearnedMessage) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *LearnedMessage) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Action == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("action") } else { data[i] = 0xa i++ i = encodeVarintLog(data, i, uint64(m.Action.Size())) n11, err := m.Action.MarshalTo(data[i:]) if err != nil { return 0, err } i += n11 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *RecoverRequest) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *RecoverRequest) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *RecoverResponse) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *RecoverResponse) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Status == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("status") } else { data[i] = 0x8 i++ i = encodeVarintLog(data, i, uint64(*m.Status)) } if m.Begin != nil { data[i] = 0x10 i++ i = encodeVarintLog(data, i, uint64(*m.Begin)) } if m.End != nil { data[i] = 0x18 i++ i = encodeVarintLog(data, i, uint64(*m.End)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func encodeFixed64Log(data []byte, offset int, v uint64) int { data[offset] = uint8(v) data[offset+1] = uint8(v >> 8) data[offset+2] = uint8(v >> 16) data[offset+3] = uint8(v >> 24) data[offset+4] = uint8(v >> 32) data[offset+5] = uint8(v >> 40) data[offset+6] = uint8(v >> 48) data[offset+7] = uint8(v >> 56) return offset + 8 } func encodeFixed32Log(data []byte, offset int, v uint32) int { data[offset] = uint8(v) data[offset+1] = uint8(v >> 8) data[offset+2] = uint8(v >> 16) data[offset+3] = uint8(v >> 24) return offset + 4 } func encodeVarintLog(data []byte, offset int, v uint64) int { for v >= 1<<7 { data[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } data[offset] = uint8(v) return offset + 1 } func NewPopulatedPromise(r randyLog, easy bool) *Promise { this := &Promise{} v1 := uint64(uint64(r.Uint32())) this.Proposal = &v1 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 2) } return this } func NewPopulatedAction(r randyLog, easy bool) *Action { this := &Action{} v2 := uint64(uint64(r.Uint32())) this.Position = &v2 v3 := uint64(uint64(r.Uint32())) this.Promised = &v3 if r.Intn(10) != 0 { v4 := uint64(uint64(r.Uint32())) this.Performed = &v4 } if r.Intn(10) != 0 { v5 := bool(bool(r.Intn(2) == 0)) this.Learned = &v5 } if r.Intn(10) != 0 { v6 := Action_Type([]int32{1, 2, 3}[r.Intn(3)]) this.Type = &v6 } if r.Intn(10) != 0 { this.Nop = NewPopulatedAction_Nop(r, easy) } if r.Intn(10) != 0 { this.Append = NewPopulatedAction_Append(r, easy) } if r.Intn(10) != 0 { this.Truncate = NewPopulatedAction_Truncate(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 9) } return this } func NewPopulatedAction_Nop(r randyLog, easy bool) *Action_Nop { this := &Action_Nop{} if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 1) } return this } func NewPopulatedAction_Append(r randyLog, easy bool) *Action_Append { this := &Action_Append{} v7 := r.Intn(100) this.Bytes = make([]byte, v7) for i := 0; i < v7; i++ { this.Bytes[i] = byte(r.Intn(256)) } if r.Intn(10) != 0 { v8 := r.Intn(100) this.Cksum = make([]byte, v8) for i := 0; i < v8; i++ { this.Cksum[i] = byte(r.Intn(256)) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 3) } return this } func NewPopulatedAction_Truncate(r randyLog, easy bool) *Action_Truncate { this := &Action_Truncate{} v9 := uint64(uint64(r.Uint32())) this.To = &v9 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 2) } return this } func NewPopulatedMetadata(r randyLog, easy bool) *Metadata { this := &Metadata{} v10 := Metadata_Status([]int32{1, 2, 3, 4}[r.Intn(4)]) this.Status = &v10 v11 := uint64(uint64(r.Uint32())) this.Promised = &v11 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 3) } return this } func NewPopulatedRecord(r randyLog, easy bool) *Record { this := &Record{} v12 := Record_Type([]int32{1, 2, 3}[r.Intn(3)]) this.Type = &v12 if r.Intn(10) != 0 { this.Promise = NewPopulatedPromise(r, easy) } if r.Intn(10) != 0 { this.Action = NewPopulatedAction(r, easy) } if r.Intn(10) != 0 { this.Metadata = NewPopulatedMetadata(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 5) } return this } func NewPopulatedPromiseRequest(r randyLog, easy bool) *PromiseRequest { this := &PromiseRequest{} v13 := uint64(uint64(r.Uint32())) this.Proposal = &v13 if r.Intn(10) != 0 { v14 := uint64(uint64(r.Uint32())) this.Position = &v14 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 3) } return this } func NewPopulatedPromiseResponse(r randyLog, easy bool) *PromiseResponse { this := &PromiseResponse{} v15 := bool(bool(r.Intn(2) == 0)) this.Okay = &v15 v16 := uint64(uint64(r.Uint32())) this.Proposal = &v16 if r.Intn(10) != 0 { this.Action = NewPopulatedAction(r, easy) } if r.Intn(10) != 0 { v17 := uint64(uint64(r.Uint32())) this.Position = &v17 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 5) } return this } func NewPopulatedWriteRequest(r randyLog, easy bool) *WriteRequest { this := &WriteRequest{} v18 := uint64(uint64(r.Uint32())) this.Proposal = &v18 v19 := uint64(uint64(r.Uint32())) this.Position = &v19 if r.Intn(10) != 0 { v20 := bool(bool(r.Intn(2) == 0)) this.Learned = &v20 } v21 := Action_Type([]int32{1, 2, 3}[r.Intn(3)]) this.Type = &v21 if r.Intn(10) != 0 { this.Nop = NewPopulatedAction_Nop(r, easy) } if r.Intn(10) != 0 { this.Append = NewPopulatedAction_Append(r, easy) } if r.Intn(10) != 0 { this.Truncate = NewPopulatedAction_Truncate(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 8) } return this } func NewPopulatedWriteResponse(r randyLog, easy bool) *WriteResponse { this := &WriteResponse{} v22 := bool(bool(r.Intn(2) == 0)) this.Okay = &v22 v23 := uint64(uint64(r.Uint32())) this.Proposal = &v23 v24 := uint64(uint64(r.Uint32())) this.Position = &v24 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 4) } return this } func NewPopulatedLearnedMessage(r randyLog, easy bool) *LearnedMessage { this := &LearnedMessage{} this.Action = NewPopulatedAction(r, easy) if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 2) } return this } func NewPopulatedRecoverRequest(r randyLog, easy bool) *RecoverRequest { this := &RecoverRequest{} if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 1) } return this } func NewPopulatedRecoverResponse(r randyLog, easy bool) *RecoverResponse { this := &RecoverResponse{} v25 := Metadata_Status([]int32{1, 2, 3, 4}[r.Intn(4)]) this.Status = &v25 if r.Intn(10) != 0 { v26 := uint64(uint64(r.Uint32())) this.Begin = &v26 } if r.Intn(10) != 0 { v27 := uint64(uint64(r.Uint32())) this.End = &v27 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedLog(r, 4) } return this } type randyLog interface { Float32() float32 Float64() float64 Int63() int64 Int31() int32 Uint32() uint32 Intn(n int) int } func randUTF8RuneLog(r randyLog) rune { ru := r.Intn(62) if ru < 10 { return rune(ru + 48) } else if ru < 36 { return rune(ru + 55) } return rune(ru + 61) } func randStringLog(r randyLog) string { v28 := r.Intn(100) tmps := make([]rune, v28) for i := 0; i < v28; i++ { tmps[i] = randUTF8RuneLog(r) } return string(tmps) } func randUnrecognizedLog(r randyLog, maxFieldNumber int) (data []byte) { l := r.Intn(5) for i := 0; i < l; i++ { wire := r.Intn(4) if wire == 3 { wire = 5 } fieldNumber := maxFieldNumber + r.Intn(100) data = randFieldLog(data, r, fieldNumber, wire) } return data } func randFieldLog(data []byte, r randyLog, fieldNumber int, wire int) []byte { key := uint32(fieldNumber)<<3 | uint32(wire) switch wire { case 0: data = encodeVarintPopulateLog(data, uint64(key)) v29 := r.Int63() if r.Intn(2) == 0 { v29 *= -1 } data = encodeVarintPopulateLog(data, uint64(v29)) case 1: data = encodeVarintPopulateLog(data, uint64(key)) data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) case 2: data = encodeVarintPopulateLog(data, uint64(key)) ll := r.Intn(100) data = encodeVarintPopulateLog(data, uint64(ll)) for j := 0; j < ll; j++ { data = append(data, byte(r.Intn(256))) } default: data = encodeVarintPopulateLog(data, uint64(key)) data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) } return data } func encodeVarintPopulateLog(data []byte, v uint64) []byte { for v >= 1<<7 { data = append(data, uint8(uint64(v)&0x7f|0x80)) v >>= 7 } data = append(data, uint8(v)) return data } func (m *Promise) Size() (n int) { var l int _ = l if m.Proposal != nil { n += 1 + sovLog(uint64(*m.Proposal)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Action) Size() (n int) { var l int _ = l if m.Position != nil { n += 1 + sovLog(uint64(*m.Position)) } if m.Promised != nil { n += 1 + sovLog(uint64(*m.Promised)) } if m.Performed != nil { n += 1 + sovLog(uint64(*m.Performed)) } if m.Learned != nil { n += 2 } if m.Type != nil { n += 1 + sovLog(uint64(*m.Type)) } if m.Nop != nil { l = m.Nop.Size() n += 1 + l + sovLog(uint64(l)) } if m.Append != nil { l = m.Append.Size() n += 1 + l + sovLog(uint64(l)) } if m.Truncate != nil { l = m.Truncate.Size() n += 1 + l + sovLog(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Action_Nop) Size() (n int) { var l int _ = l if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Action_Append) Size() (n int) { var l int _ = l if m.Bytes != nil { l = len(m.Bytes) n += 1 + l + sovLog(uint64(l)) } if m.Cksum != nil { l = len(m.Cksum) n += 1 + l + sovLog(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Action_Truncate) Size() (n int) { var l int _ = l if m.To != nil { n += 1 + sovLog(uint64(*m.To)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Metadata) Size() (n int) { var l int _ = l if m.Status != nil { n += 1 + sovLog(uint64(*m.Status)) } if m.Promised != nil { n += 1 + sovLog(uint64(*m.Promised)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Record) Size() (n int) { var l int _ = l if m.Type != nil { n += 1 + sovLog(uint64(*m.Type)) } if m.Promise != nil { l = m.Promise.Size() n += 1 + l + sovLog(uint64(l)) } if m.Action != nil { l = m.Action.Size() n += 1 + l + sovLog(uint64(l)) } if m.Metadata != nil { l = m.Metadata.Size() n += 1 + l + sovLog(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *PromiseRequest) Size() (n int) { var l int _ = l if m.Proposal != nil { n += 1 + sovLog(uint64(*m.Proposal)) } if m.Position != nil { n += 1 + sovLog(uint64(*m.Position)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *PromiseResponse) Size() (n int) { var l int _ = l if m.Okay != nil { n += 2 } if m.Proposal != nil { n += 1 + sovLog(uint64(*m.Proposal)) } if m.Action != nil { l = m.Action.Size() n += 1 + l + sovLog(uint64(l)) } if m.Position != nil { n += 1 + sovLog(uint64(*m.Position)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *WriteRequest) Size() (n int) { var l int _ = l if m.Proposal != nil { n += 1 + sovLog(uint64(*m.Proposal)) } if m.Position != nil { n += 1 + sovLog(uint64(*m.Position)) } if m.Learned != nil { n += 2 } if m.Type != nil { n += 1 + sovLog(uint64(*m.Type)) } if m.Nop != nil { l = m.Nop.Size() n += 1 + l + sovLog(uint64(l)) } if m.Append != nil { l = m.Append.Size() n += 1 + l + sovLog(uint64(l)) } if m.Truncate != nil { l = m.Truncate.Size() n += 1 + l + sovLog(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *WriteResponse) Size() (n int) { var l int _ = l if m.Okay != nil { n += 2 } if m.Proposal != nil { n += 1 + sovLog(uint64(*m.Proposal)) } if m.Position != nil { n += 1 + sovLog(uint64(*m.Position)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *LearnedMessage) Size() (n int) { var l int _ = l if m.Action != nil { l = m.Action.Size() n += 1 + l + sovLog(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *RecoverRequest) Size() (n int) { var l int _ = l if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *RecoverResponse) Size() (n int) { var l int _ = l if m.Status != nil { n += 1 + sovLog(uint64(*m.Status)) } if m.Begin != nil { n += 1 + sovLog(uint64(*m.Begin)) } if m.End != nil { n += 1 + sovLog(uint64(*m.End)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func sovLog(x uint64) (n int) { for { n++ x >>= 7 if x == 0 { break } } return n } func sozLog(x uint64) (n int) { return sovLog(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (this *Promise) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Promise{`, `Proposal:` + valueToStringLog(this.Proposal) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Action) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Action{`, `Position:` + valueToStringLog(this.Position) + `,`, `Promised:` + valueToStringLog(this.Promised) + `,`, `Performed:` + valueToStringLog(this.Performed) + `,`, `Learned:` + valueToStringLog(this.Learned) + `,`, `Type:` + valueToStringLog(this.Type) + `,`, `Nop:` + strings.Replace(fmt.Sprintf("%v", this.Nop), "Action_Nop", "Action_Nop", 1) + `,`, `Append:` + strings.Replace(fmt.Sprintf("%v", this.Append), "Action_Append", "Action_Append", 1) + `,`, `Truncate:` + strings.Replace(fmt.Sprintf("%v", this.Truncate), "Action_Truncate", "Action_Truncate", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Action_Nop) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Action_Nop{`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Action_Append) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Action_Append{`, `Bytes:` + valueToStringLog(this.Bytes) + `,`, `Cksum:` + valueToStringLog(this.Cksum) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Action_Truncate) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Action_Truncate{`, `To:` + valueToStringLog(this.To) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Metadata) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Metadata{`, `Status:` + valueToStringLog(this.Status) + `,`, `Promised:` + valueToStringLog(this.Promised) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Record) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Record{`, `Type:` + valueToStringLog(this.Type) + `,`, `Promise:` + strings.Replace(fmt.Sprintf("%v", this.Promise), "Promise", "Promise", 1) + `,`, `Action:` + strings.Replace(fmt.Sprintf("%v", this.Action), "Action", "Action", 1) + `,`, `Metadata:` + strings.Replace(fmt.Sprintf("%v", this.Metadata), "Metadata", "Metadata", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *PromiseRequest) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&PromiseRequest{`, `Proposal:` + valueToStringLog(this.Proposal) + `,`, `Position:` + valueToStringLog(this.Position) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *PromiseResponse) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&PromiseResponse{`, `Okay:` + valueToStringLog(this.Okay) + `,`, `Proposal:` + valueToStringLog(this.Proposal) + `,`, `Action:` + strings.Replace(fmt.Sprintf("%v", this.Action), "Action", "Action", 1) + `,`, `Position:` + valueToStringLog(this.Position) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *WriteRequest) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&WriteRequest{`, `Proposal:` + valueToStringLog(this.Proposal) + `,`, `Position:` + valueToStringLog(this.Position) + `,`, `Learned:` + valueToStringLog(this.Learned) + `,`, `Type:` + valueToStringLog(this.Type) + `,`, `Nop:` + strings.Replace(fmt.Sprintf("%v", this.Nop), "Action_Nop", "Action_Nop", 1) + `,`, `Append:` + strings.Replace(fmt.Sprintf("%v", this.Append), "Action_Append", "Action_Append", 1) + `,`, `Truncate:` + strings.Replace(fmt.Sprintf("%v", this.Truncate), "Action_Truncate", "Action_Truncate", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *WriteResponse) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&WriteResponse{`, `Okay:` + valueToStringLog(this.Okay) + `,`, `Proposal:` + valueToStringLog(this.Proposal) + `,`, `Position:` + valueToStringLog(this.Position) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *LearnedMessage) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&LearnedMessage{`, `Action:` + strings.Replace(fmt.Sprintf("%v", this.Action), "Action", "Action", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *RecoverRequest) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&RecoverRequest{`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *RecoverResponse) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&RecoverResponse{`, `Status:` + valueToStringLog(this.Status) + `,`, `Begin:` + valueToStringLog(this.Begin) + `,`, `End:` + valueToStringLog(this.End) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func valueToStringLog(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } func (m *Promise) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Proposal = &v hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("proposal") } return nil } func (m *Action) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Position", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Position = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Promised", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Promised = &v hasFields[0] |= uint64(0x00000002) case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Performed", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Performed = &v case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Learned", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Learned = &b case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var v Action_Type for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (Action_Type(b) & 0x7F) << shift if b < 0x80 { break } } m.Type = &v case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Nop", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Nop == nil { m.Nop = &Action_Nop{} } if err := m.Nop.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Append", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Append == nil { m.Append = &Action_Append{} } if err := m.Append.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Truncate", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Truncate == nil { m.Truncate = &Action_Truncate{} } if err := m.Truncate.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("position") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("promised") } return nil } func (m *Action_Nop) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) switch fieldNum { default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Action_Append) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Bytes", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ byteLen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + byteLen if postIndex > l { return io.ErrUnexpectedEOF } m.Bytes = append([]byte{}, data[iNdEx:postIndex]...) iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Cksum", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ byteLen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + byteLen if postIndex > l { return io.ErrUnexpectedEOF } m.Cksum = append([]byte{}, data[iNdEx:postIndex]...) iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("bytes") } return nil } func (m *Action_Truncate) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.To = &v hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("to") } return nil } func (m *Metadata) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } var v Metadata_Status for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (Metadata_Status(b) & 0x7F) << shift if b < 0x80 { break } } m.Status = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Promised", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Promised = &v hasFields[0] |= uint64(0x00000002) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("status") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("promised") } return nil } func (m *Record) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var v Record_Type for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (Record_Type(b) & 0x7F) << shift if b < 0x80 { break } } m.Type = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Promise", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Promise == nil { m.Promise = &Promise{} } if err := m.Promise.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Action == nil { m.Action = &Action{} } if err := m.Action.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Metadata == nil { m.Metadata = &Metadata{} } if err := m.Metadata.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } return nil } func (m *PromiseRequest) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Proposal = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Position", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Position = &v default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("proposal") } return nil } func (m *PromiseResponse) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Okay", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Okay = &b hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Proposal = &v hasFields[0] |= uint64(0x00000002) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Action == nil { m.Action = &Action{} } if err := m.Action.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Position", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Position = &v default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("okay") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("proposal") } return nil } func (m *WriteRequest) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Proposal = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Position", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Position = &v hasFields[0] |= uint64(0x00000002) case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Learned", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Learned = &b case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var v Action_Type for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (Action_Type(b) & 0x7F) << shift if b < 0x80 { break } } m.Type = &v hasFields[0] |= uint64(0x00000004) case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Nop", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Nop == nil { m.Nop = &Action_Nop{} } if err := m.Nop.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Append", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Append == nil { m.Append = &Action_Append{} } if err := m.Append.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Truncate", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Truncate == nil { m.Truncate = &Action_Truncate{} } if err := m.Truncate.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("proposal") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("position") } if hasFields[0]&uint64(0x00000004) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } return nil } func (m *WriteResponse) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Okay", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Okay = &b hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Proposal = &v hasFields[0] |= uint64(0x00000002) case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Position", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Position = &v hasFields[0] |= uint64(0x00000004) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("okay") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("proposal") } if hasFields[0]&uint64(0x00000004) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("position") } return nil } func (m *LearnedMessage) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthLog } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Action == nil { m.Action = &Action{} } if err := m.Action.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("action") } return nil } func (m *RecoverRequest) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) switch fieldNum { default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *RecoverResponse) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } var v Metadata_Status for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (Metadata_Status(b) & 0x7F) << shift if b < 0x80 { break } } m.Status = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Begin", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Begin = &v case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field End", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.End = &v default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipLog(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthLog } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("status") } return nil } func skipLog(data []byte) (n int, err error) { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if data[iNdEx-1] < 0x80 { break } } return iNdEx, nil case 1: iNdEx += 8 return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } iNdEx += length if length < 0 { return 0, ErrInvalidLengthLog } return iNdEx, nil case 3: for { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ innerWire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } innerWireType := int(innerWire & 0x7) if innerWireType == 4 { break } next, err := skipLog(data[start:]) if err != nil { return 0, err } iNdEx = start + next } return iNdEx, nil case 4: return iNdEx, nil case 5: iNdEx += 4 return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } } panic("unreachable") } var ( ErrInvalidLengthLog = fmt.Errorf("proto: negative length found during unmarshaling") ) mesos-go-0.0.1/mesosproto/log.proto000066400000000000000000000166501257601144100173320ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 mesosproto; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.gostring_all) = true; option (gogoproto.equal_all) = true; option (gogoproto.verbose_equal_all) = true; option (gogoproto.goproto_stringer_all) = false; option (gogoproto.stringer_all) = true; option (gogoproto.populate_all) = true; option (gogoproto.testgen_all) = true; option (gogoproto.benchgen_all) = true; option (gogoproto.marshaler_all) = true; option (gogoproto.sizer_all) = true; option (gogoproto.unmarshaler_all) = true; // Represents a "promise" that a replica has made. A promise is // *implicitly* valid for _all_ future actions that get performed on // the replicated log (provided the action comes from the same // proposer), until a new promise is made to a proposer with a higher // proposal number. Each replica writes every promise it makes as a // log record so that it can recover this information after a failure. // TODO(benh): Does the promise actually need to be written to stable // storage? Can we get away with looking at the last written action // and using it's promised value? In this case, what happens if we // make a promise but don't receive an action from that coordinator? message Promise { required uint64 proposal = 1; } // Represents an "action" performed on the log. Each action has an // associated position in the log. In addition, each action (i.e., // position) will have been "promised" to a specific proposer // (implicitly or explicitly) and may have been "performed" from a // specific proposer. An action may also be "learned" to have reached // consensus. There are three types of possible actions that can be // performed on the log: nop (no action), append, and truncate. message Action { required uint64 position = 1; required uint64 promised = 2; optional uint64 performed = 3; optional bool learned = 4; enum Type { NOP = 1; APPEND = 2; TRUNCATE = 3; } message Nop {} message Append { required bytes bytes = 1; optional bytes cksum = 2; } message Truncate { required uint64 to = 1; // All positions before and exclusive of 'to'. } optional Type type = 5; // Set iff performed is set. optional Nop nop = 6; optional Append append = 7; optional Truncate truncate = 8; } // The metadata of a replica. It has to be persisted on the disk. We // store the current status of the replica as well as the implicit // promise that a replica has made. This message is intended to // replace the old Promise message to support catch-up. message Metadata { enum Status { VOTING = 1; // Normal voting member in Paxos group. RECOVERING = 2; // In the process of catching up. STARTING = 3; // The log has been initialized. EMPTY = 4; // The log is empty and is not initialized. } required Status status = 1 [default = EMPTY]; required uint64 promised = 2 [default = 0]; } // Represents a log record written to the local filesystem by a // replica. A log record may store a promise (DEPRECATED), an action // or metadata (defined above). message Record { enum Type { PROMISE = 1; // DEPRECATED! ACTION = 2; METADATA = 3; } required Type type = 1; optional Promise promise = 2; // DEPRECATED! optional Action action = 3; optional Metadata metadata = 4; } //////////////////////////////////////////////////// // Replicated log request/responses and messages. // //////////////////////////////////////////////////// // Represents a "promise" request from a proposer with the specified // 'proposal' to a replica. If the proposer is a coordinator, most // such requests will occur after a coordinator has failed and a new // coordinator is elected. In such a case, the position that the // coordinator is asking the replica to promise is implicitly *all* // positions that the replica has made no promises (thus the position // field is not be used). In other instances, however, a proposer // might be explicitly trying to request that a replica promise a // specific position in the log (such as when trying to fill holes // discovered during a client read), and then the 'position' field // will be present. message PromiseRequest { required uint64 proposal = 1; optional uint64 position = 2; } // Represents a "promise" response from a replica back to a proposer. // A replica represents a NACK (because it has promised a proposer // with a higher proposal number) by setting the okay field to false. // The 'proposal' is either the aforementioned higher proposal number // when the response is a NACK, or the corresponding request's // proposal number if it is an ACK. The replica either sends back the // highest position it has recorded in the log (using the 'position' // field) or the specific action (if any) it has at the position // requested in PromiseRequest (using the 'action' field). message PromiseResponse { required bool okay = 1; required uint64 proposal = 2; optional uint64 position = 4; optional Action action = 3; } // Represents a write request for a specific type of action. Note that // we deliberately do not include the entire Action as it contains // fields that are not relevant to a write request (e.g., promised, // performed) and rather than ignore them we exclude them for safety. message WriteRequest { required uint64 proposal = 1; required uint64 position = 2; optional bool learned = 3; required Action.Type type = 4; optional Action.Nop nop = 5; optional Action.Append append = 6; optional Action.Truncate truncate = 7; } // Represents a write response corresponding to a write request. A // replica represents a NACK (because it has promised a proposer with // a higher proposal number) by setting the okay field to false. If // the proposer is a coordinator, then it has been demoted. The // 'position' should always correspond to the position set in the // request. The 'proposal' is either the same proposal number set in // the request in the case of an ACK, or the higher proposal number // this position has been promised to in the case of a NACK. message WriteResponse { required bool okay = 1; required uint64 proposal = 2; required uint64 position = 3; } // Represents a "learned" event, that is, when a particular action has // been agreed upon (reached consensus). message LearnedMessage { required Action action = 1; } // Represents a recover request. A recover request is used to initiate // the recovery (by broadcasting it). message RecoverRequest {} // When a replica receives a RecoverRequest, it will reply with its // current status, and the begin and the end of its current log. message RecoverResponse { required Metadata.Status status = 1; optional uint64 begin = 2; optional uint64 end = 3; } mesos-go-0.0.1/mesosproto/logpb_test.go000066400000000000000000002754321257601144100201620ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: log.proto // DO NOT EDIT! package mesosproto import testing "testing" import math_rand "math/rand" import time "time" import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" import fmt "fmt" import go_parser "go/parser" import proto "github.com/gogo/protobuf/proto" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf func TestPromiseProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromise(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Promise{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestPromiseMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromise(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Promise{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkPromiseProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Promise, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedPromise(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkPromiseProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedPromise(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Promise{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestActionProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Action{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestActionMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Action{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkActionProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Action, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedAction(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkActionProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedAction(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Action{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestAction_NopProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Nop(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Action_Nop{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestAction_NopMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Nop(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Action_Nop{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkAction_NopProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Action_Nop, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedAction_Nop(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkAction_NopProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedAction_Nop(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Action_Nop{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestAction_AppendProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Append(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Action_Append{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestAction_AppendMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Append(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Action_Append{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkAction_AppendProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Action_Append, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedAction_Append(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkAction_AppendProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedAction_Append(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Action_Append{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestAction_TruncateProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Truncate(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Action_Truncate{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestAction_TruncateMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Truncate(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Action_Truncate{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkAction_TruncateProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Action_Truncate, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedAction_Truncate(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkAction_TruncateProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedAction_Truncate(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Action_Truncate{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestMetadataProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedMetadata(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Metadata{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestMetadataMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedMetadata(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Metadata{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkMetadataProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Metadata, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedMetadata(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkMetadataProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedMetadata(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Metadata{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestRecordProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecord(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Record{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestRecordMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecord(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Record{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkRecordProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Record, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedRecord(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkRecordProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedRecord(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Record{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestPromiseRequestProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromiseRequest(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &PromiseRequest{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestPromiseRequestMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromiseRequest(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &PromiseRequest{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkPromiseRequestProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*PromiseRequest, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedPromiseRequest(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkPromiseRequestProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedPromiseRequest(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &PromiseRequest{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestPromiseResponseProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromiseResponse(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &PromiseResponse{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestPromiseResponseMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromiseResponse(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &PromiseResponse{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkPromiseResponseProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*PromiseResponse, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedPromiseResponse(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkPromiseResponseProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedPromiseResponse(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &PromiseResponse{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestWriteRequestProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedWriteRequest(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &WriteRequest{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestWriteRequestMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedWriteRequest(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &WriteRequest{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkWriteRequestProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*WriteRequest, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedWriteRequest(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkWriteRequestProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedWriteRequest(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &WriteRequest{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestWriteResponseProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedWriteResponse(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &WriteResponse{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestWriteResponseMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedWriteResponse(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &WriteResponse{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkWriteResponseProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*WriteResponse, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedWriteResponse(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkWriteResponseProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedWriteResponse(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &WriteResponse{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestLearnedMessageProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLearnedMessage(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &LearnedMessage{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestLearnedMessageMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLearnedMessage(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &LearnedMessage{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkLearnedMessageProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*LearnedMessage, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedLearnedMessage(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkLearnedMessageProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedLearnedMessage(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &LearnedMessage{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestRecoverRequestProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecoverRequest(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &RecoverRequest{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestRecoverRequestMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecoverRequest(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &RecoverRequest{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkRecoverRequestProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*RecoverRequest, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedRecoverRequest(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkRecoverRequestProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedRecoverRequest(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &RecoverRequest{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestRecoverResponseProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecoverResponse(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &RecoverResponse{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestRecoverResponseMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecoverResponse(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &RecoverResponse{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkRecoverResponseProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*RecoverResponse, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedRecoverResponse(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkRecoverResponseProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedRecoverResponse(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &RecoverResponse{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestPromiseJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromise(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Promise{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestActionJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Action{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestAction_NopJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Nop(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Action_Nop{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestAction_AppendJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Append(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Action_Append{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestAction_TruncateJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Truncate(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Action_Truncate{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestMetadataJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedMetadata(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Metadata{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestRecordJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecord(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Record{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestPromiseRequestJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromiseRequest(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &PromiseRequest{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestPromiseResponseJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromiseResponse(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &PromiseResponse{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestWriteRequestJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedWriteRequest(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &WriteRequest{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestWriteResponseJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedWriteResponse(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &WriteResponse{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestLearnedMessageJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLearnedMessage(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &LearnedMessage{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestRecoverRequestJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecoverRequest(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &RecoverRequest{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestRecoverResponseJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecoverResponse(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &RecoverResponse{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestPromiseProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromise(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Promise{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestPromiseProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromise(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Promise{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestActionProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Action{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestActionProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Action{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestAction_NopProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Nop(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Action_Nop{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestAction_NopProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Nop(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Action_Nop{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestAction_AppendProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Append(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Action_Append{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestAction_AppendProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Append(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Action_Append{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestAction_TruncateProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Truncate(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Action_Truncate{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestAction_TruncateProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Truncate(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Action_Truncate{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestMetadataProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedMetadata(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Metadata{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestMetadataProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedMetadata(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Metadata{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestRecordProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecord(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Record{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestRecordProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecord(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Record{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestPromiseRequestProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromiseRequest(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &PromiseRequest{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestPromiseRequestProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromiseRequest(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &PromiseRequest{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestPromiseResponseProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromiseResponse(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &PromiseResponse{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestPromiseResponseProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromiseResponse(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &PromiseResponse{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestWriteRequestProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedWriteRequest(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &WriteRequest{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestWriteRequestProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedWriteRequest(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &WriteRequest{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestWriteResponseProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedWriteResponse(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &WriteResponse{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestWriteResponseProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedWriteResponse(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &WriteResponse{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestLearnedMessageProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLearnedMessage(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &LearnedMessage{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestLearnedMessageProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLearnedMessage(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &LearnedMessage{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestRecoverRequestProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecoverRequest(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &RecoverRequest{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestRecoverRequestProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecoverRequest(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &RecoverRequest{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestRecoverResponseProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecoverResponse(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &RecoverResponse{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestRecoverResponseProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecoverResponse(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &RecoverResponse{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestPromiseVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPromise(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Promise{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestActionVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAction(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Action{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestAction_NopVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAction_Nop(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Action_Nop{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestAction_AppendVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAction_Append(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Action_Append{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestAction_TruncateVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAction_Truncate(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Action_Truncate{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestMetadataVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedMetadata(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Metadata{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestRecordVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRecord(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Record{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestPromiseRequestVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPromiseRequest(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &PromiseRequest{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestPromiseResponseVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPromiseResponse(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &PromiseResponse{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestWriteRequestVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedWriteRequest(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &WriteRequest{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestWriteResponseVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedWriteResponse(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &WriteResponse{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestLearnedMessageVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedLearnedMessage(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &LearnedMessage{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestRecoverRequestVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRecoverRequest(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &RecoverRequest{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestRecoverResponseVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRecoverResponse(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &RecoverResponse{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestPromiseGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPromise(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestActionGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAction(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestAction_NopGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAction_Nop(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestAction_AppendGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAction_Append(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestAction_TruncateGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAction_Truncate(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestMetadataGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedMetadata(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestRecordGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRecord(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestPromiseRequestGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPromiseRequest(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestPromiseResponseGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPromiseResponse(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestWriteRequestGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedWriteRequest(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestWriteResponseGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedWriteResponse(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestLearnedMessageGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedLearnedMessage(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestRecoverRequestGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRecoverRequest(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestRecoverResponseGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRecoverResponse(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestPromiseSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromise(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkPromiseSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Promise, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedPromise(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestActionSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkActionSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Action, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedAction(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestAction_NopSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Nop(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkAction_NopSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Action_Nop, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedAction_Nop(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestAction_AppendSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Append(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkAction_AppendSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Action_Append, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedAction_Append(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestAction_TruncateSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAction_Truncate(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkAction_TruncateSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Action_Truncate, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedAction_Truncate(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestMetadataSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedMetadata(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkMetadataSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Metadata, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedMetadata(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestRecordSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecord(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkRecordSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Record, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedRecord(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestPromiseRequestSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromiseRequest(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkPromiseRequestSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*PromiseRequest, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedPromiseRequest(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestPromiseResponseSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPromiseResponse(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkPromiseResponseSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*PromiseResponse, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedPromiseResponse(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestWriteRequestSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedWriteRequest(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkWriteRequestSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*WriteRequest, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedWriteRequest(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestWriteResponseSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedWriteResponse(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkWriteResponseSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*WriteResponse, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedWriteResponse(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestLearnedMessageSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLearnedMessage(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkLearnedMessageSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*LearnedMessage, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedLearnedMessage(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestRecoverRequestSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecoverRequest(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkRecoverRequestSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*RecoverRequest, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedRecoverRequest(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestRecoverResponseSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRecoverResponse(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkRecoverResponseSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*RecoverResponse, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedRecoverResponse(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestPromiseStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPromise(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestActionStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAction(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestAction_NopStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAction_Nop(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestAction_AppendStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAction_Append(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestAction_TruncateStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAction_Truncate(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestMetadataStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedMetadata(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestRecordStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRecord(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestPromiseRequestStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPromiseRequest(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestPromiseResponseStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPromiseResponse(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestWriteRequestStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedWriteRequest(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestWriteResponseStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedWriteResponse(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestLearnedMessageStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedLearnedMessage(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestRecoverRequestStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRecoverRequest(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestRecoverResponseStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRecoverResponse(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } //These tests are generated by github.com/gogo/protobuf/plugin/testgen mesos-go-0.0.1/mesosproto/mesos.pb.go000066400000000000000000031505111257601144100175370ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: mesos.proto // DO NOT EDIT! package mesosproto import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto" import bytes "bytes" import strings "strings" import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" import sort "sort" import strconv "strconv" import reflect "reflect" import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // * // Status is used to indicate the state of the scheduler and executor // driver after function calls. type Status int32 const ( Status_DRIVER_NOT_STARTED Status = 1 Status_DRIVER_RUNNING Status = 2 Status_DRIVER_ABORTED Status = 3 Status_DRIVER_STOPPED Status = 4 ) var Status_name = map[int32]string{ 1: "DRIVER_NOT_STARTED", 2: "DRIVER_RUNNING", 3: "DRIVER_ABORTED", 4: "DRIVER_STOPPED", } var Status_value = map[string]int32{ "DRIVER_NOT_STARTED": 1, "DRIVER_RUNNING": 2, "DRIVER_ABORTED": 3, "DRIVER_STOPPED": 4, } func (x Status) Enum() *Status { p := new(Status) *p = x return p } func (x Status) String() string { return proto.EnumName(Status_name, int32(x)) } func (x *Status) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(Status_value, data, "Status") if err != nil { return err } *x = Status(value) return nil } // * // Describes possible task states. IMPORTANT: Mesos assumes tasks that // enter terminal states (see below) imply the task is no longer // running and thus clean up any thing associated with the task // (ultimately offering any resources being consumed by that task to // another task). type TaskState int32 const ( TaskState_TASK_STAGING TaskState = 6 TaskState_TASK_STARTING TaskState = 0 TaskState_TASK_RUNNING TaskState = 1 TaskState_TASK_FINISHED TaskState = 2 TaskState_TASK_FAILED TaskState = 3 TaskState_TASK_KILLED TaskState = 4 TaskState_TASK_LOST TaskState = 5 TaskState_TASK_ERROR TaskState = 7 ) var TaskState_name = map[int32]string{ 6: "TASK_STAGING", 0: "TASK_STARTING", 1: "TASK_RUNNING", 2: "TASK_FINISHED", 3: "TASK_FAILED", 4: "TASK_KILLED", 5: "TASK_LOST", 7: "TASK_ERROR", } var TaskState_value = map[string]int32{ "TASK_STAGING": 6, "TASK_STARTING": 0, "TASK_RUNNING": 1, "TASK_FINISHED": 2, "TASK_FAILED": 3, "TASK_KILLED": 4, "TASK_LOST": 5, "TASK_ERROR": 7, } func (x TaskState) Enum() *TaskState { p := new(TaskState) *p = x return p } func (x TaskState) String() string { return proto.EnumName(TaskState_name, int32(x)) } func (x *TaskState) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(TaskState_value, data, "TaskState") if err != nil { return err } *x = TaskState(value) return nil } type FrameworkInfo_Capability_Type int32 const ( // Receive offers with revocable resources. See 'Resource' // message for details. // TODO(vinod): This is currently a no-op. FrameworkInfo_Capability_REVOCABLE_RESOURCES FrameworkInfo_Capability_Type = 1 ) var FrameworkInfo_Capability_Type_name = map[int32]string{ 1: "REVOCABLE_RESOURCES", } var FrameworkInfo_Capability_Type_value = map[string]int32{ "REVOCABLE_RESOURCES": 1, } func (x FrameworkInfo_Capability_Type) Enum() *FrameworkInfo_Capability_Type { p := new(FrameworkInfo_Capability_Type) *p = x return p } func (x FrameworkInfo_Capability_Type) String() string { return proto.EnumName(FrameworkInfo_Capability_Type_name, int32(x)) } func (x *FrameworkInfo_Capability_Type) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(FrameworkInfo_Capability_Type_value, data, "FrameworkInfo_Capability_Type") if err != nil { return err } *x = FrameworkInfo_Capability_Type(value) return nil } type Value_Type int32 const ( Value_SCALAR Value_Type = 0 Value_RANGES Value_Type = 1 Value_SET Value_Type = 2 Value_TEXT Value_Type = 3 ) var Value_Type_name = map[int32]string{ 0: "SCALAR", 1: "RANGES", 2: "SET", 3: "TEXT", } var Value_Type_value = map[string]int32{ "SCALAR": 0, "RANGES": 1, "SET": 2, "TEXT": 3, } func (x Value_Type) Enum() *Value_Type { p := new(Value_Type) *p = x return p } func (x Value_Type) String() string { return proto.EnumName(Value_Type_name, int32(x)) } func (x *Value_Type) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(Value_Type_value, data, "Value_Type") if err != nil { return err } *x = Value_Type(value) return nil } type Offer_Operation_Type int32 const ( Offer_Operation_LAUNCH Offer_Operation_Type = 1 Offer_Operation_RESERVE Offer_Operation_Type = 2 Offer_Operation_UNRESERVE Offer_Operation_Type = 3 Offer_Operation_CREATE Offer_Operation_Type = 4 Offer_Operation_DESTROY Offer_Operation_Type = 5 ) var Offer_Operation_Type_name = map[int32]string{ 1: "LAUNCH", 2: "RESERVE", 3: "UNRESERVE", 4: "CREATE", 5: "DESTROY", } var Offer_Operation_Type_value = map[string]int32{ "LAUNCH": 1, "RESERVE": 2, "UNRESERVE": 3, "CREATE": 4, "DESTROY": 5, } func (x Offer_Operation_Type) Enum() *Offer_Operation_Type { p := new(Offer_Operation_Type) *p = x return p } func (x Offer_Operation_Type) String() string { return proto.EnumName(Offer_Operation_Type_name, int32(x)) } func (x *Offer_Operation_Type) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(Offer_Operation_Type_value, data, "Offer_Operation_Type") if err != nil { return err } *x = Offer_Operation_Type(value) return nil } // Describes the source of the task status update. type TaskStatus_Source int32 const ( TaskStatus_SOURCE_MASTER TaskStatus_Source = 0 TaskStatus_SOURCE_SLAVE TaskStatus_Source = 1 TaskStatus_SOURCE_EXECUTOR TaskStatus_Source = 2 ) var TaskStatus_Source_name = map[int32]string{ 0: "SOURCE_MASTER", 1: "SOURCE_SLAVE", 2: "SOURCE_EXECUTOR", } var TaskStatus_Source_value = map[string]int32{ "SOURCE_MASTER": 0, "SOURCE_SLAVE": 1, "SOURCE_EXECUTOR": 2, } func (x TaskStatus_Source) Enum() *TaskStatus_Source { p := new(TaskStatus_Source) *p = x return p } func (x TaskStatus_Source) String() string { return proto.EnumName(TaskStatus_Source_name, int32(x)) } func (x *TaskStatus_Source) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(TaskStatus_Source_value, data, "TaskStatus_Source") if err != nil { return err } *x = TaskStatus_Source(value) return nil } // Detailed reason for the task status update. // // TODO(bmahler): Differentiate between slave removal reasons // (e.g. unhealthy vs. unregistered for maintenance). type TaskStatus_Reason int32 const ( TaskStatus_REASON_COMMAND_EXECUTOR_FAILED TaskStatus_Reason = 0 TaskStatus_REASON_EXECUTOR_PREEMPTED TaskStatus_Reason = 17 TaskStatus_REASON_EXECUTOR_TERMINATED TaskStatus_Reason = 1 TaskStatus_REASON_EXECUTOR_UNREGISTERED TaskStatus_Reason = 2 TaskStatus_REASON_FRAMEWORK_REMOVED TaskStatus_Reason = 3 TaskStatus_REASON_GC_ERROR TaskStatus_Reason = 4 TaskStatus_REASON_INVALID_FRAMEWORKID TaskStatus_Reason = 5 TaskStatus_REASON_INVALID_OFFERS TaskStatus_Reason = 6 TaskStatus_REASON_MASTER_DISCONNECTED TaskStatus_Reason = 7 TaskStatus_REASON_MEMORY_LIMIT TaskStatus_Reason = 8 TaskStatus_REASON_RECONCILIATION TaskStatus_Reason = 9 TaskStatus_REASON_RESOURCES_UNKNOWN TaskStatus_Reason = 18 TaskStatus_REASON_SLAVE_DISCONNECTED TaskStatus_Reason = 10 TaskStatus_REASON_SLAVE_REMOVED TaskStatus_Reason = 11 TaskStatus_REASON_SLAVE_RESTARTED TaskStatus_Reason = 12 TaskStatus_REASON_SLAVE_UNKNOWN TaskStatus_Reason = 13 TaskStatus_REASON_TASK_INVALID TaskStatus_Reason = 14 TaskStatus_REASON_TASK_UNAUTHORIZED TaskStatus_Reason = 15 TaskStatus_REASON_TASK_UNKNOWN TaskStatus_Reason = 16 ) var TaskStatus_Reason_name = map[int32]string{ 0: "REASON_COMMAND_EXECUTOR_FAILED", 17: "REASON_EXECUTOR_PREEMPTED", 1: "REASON_EXECUTOR_TERMINATED", 2: "REASON_EXECUTOR_UNREGISTERED", 3: "REASON_FRAMEWORK_REMOVED", 4: "REASON_GC_ERROR", 5: "REASON_INVALID_FRAMEWORKID", 6: "REASON_INVALID_OFFERS", 7: "REASON_MASTER_DISCONNECTED", 8: "REASON_MEMORY_LIMIT", 9: "REASON_RECONCILIATION", 18: "REASON_RESOURCES_UNKNOWN", 10: "REASON_SLAVE_DISCONNECTED", 11: "REASON_SLAVE_REMOVED", 12: "REASON_SLAVE_RESTARTED", 13: "REASON_SLAVE_UNKNOWN", 14: "REASON_TASK_INVALID", 15: "REASON_TASK_UNAUTHORIZED", 16: "REASON_TASK_UNKNOWN", } var TaskStatus_Reason_value = map[string]int32{ "REASON_COMMAND_EXECUTOR_FAILED": 0, "REASON_EXECUTOR_PREEMPTED": 17, "REASON_EXECUTOR_TERMINATED": 1, "REASON_EXECUTOR_UNREGISTERED": 2, "REASON_FRAMEWORK_REMOVED": 3, "REASON_GC_ERROR": 4, "REASON_INVALID_FRAMEWORKID": 5, "REASON_INVALID_OFFERS": 6, "REASON_MASTER_DISCONNECTED": 7, "REASON_MEMORY_LIMIT": 8, "REASON_RECONCILIATION": 9, "REASON_RESOURCES_UNKNOWN": 18, "REASON_SLAVE_DISCONNECTED": 10, "REASON_SLAVE_REMOVED": 11, "REASON_SLAVE_RESTARTED": 12, "REASON_SLAVE_UNKNOWN": 13, "REASON_TASK_INVALID": 14, "REASON_TASK_UNAUTHORIZED": 15, "REASON_TASK_UNKNOWN": 16, } func (x TaskStatus_Reason) Enum() *TaskStatus_Reason { p := new(TaskStatus_Reason) *p = x return p } func (x TaskStatus_Reason) String() string { return proto.EnumName(TaskStatus_Reason_name, int32(x)) } func (x *TaskStatus_Reason) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(TaskStatus_Reason_value, data, "TaskStatus_Reason") if err != nil { return err } *x = TaskStatus_Reason(value) return nil } type ACL_Entity_Type int32 const ( ACL_Entity_SOME ACL_Entity_Type = 0 ACL_Entity_ANY ACL_Entity_Type = 1 ACL_Entity_NONE ACL_Entity_Type = 2 ) var ACL_Entity_Type_name = map[int32]string{ 0: "SOME", 1: "ANY", 2: "NONE", } var ACL_Entity_Type_value = map[string]int32{ "SOME": 0, "ANY": 1, "NONE": 2, } func (x ACL_Entity_Type) Enum() *ACL_Entity_Type { p := new(ACL_Entity_Type) *p = x return p } func (x ACL_Entity_Type) String() string { return proto.EnumName(ACL_Entity_Type_name, int32(x)) } func (x *ACL_Entity_Type) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(ACL_Entity_Type_value, data, "ACL_Entity_Type") if err != nil { return err } *x = ACL_Entity_Type(value) return nil } type Volume_Mode int32 const ( Volume_RW Volume_Mode = 1 Volume_RO Volume_Mode = 2 ) var Volume_Mode_name = map[int32]string{ 1: "RW", 2: "RO", } var Volume_Mode_value = map[string]int32{ "RW": 1, "RO": 2, } func (x Volume_Mode) Enum() *Volume_Mode { p := new(Volume_Mode) *p = x return p } func (x Volume_Mode) String() string { return proto.EnumName(Volume_Mode_name, int32(x)) } func (x *Volume_Mode) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(Volume_Mode_value, data, "Volume_Mode") if err != nil { return err } *x = Volume_Mode(value) return nil } // All container implementation types. type ContainerInfo_Type int32 const ( ContainerInfo_DOCKER ContainerInfo_Type = 1 ContainerInfo_MESOS ContainerInfo_Type = 2 ) var ContainerInfo_Type_name = map[int32]string{ 1: "DOCKER", 2: "MESOS", } var ContainerInfo_Type_value = map[string]int32{ "DOCKER": 1, "MESOS": 2, } func (x ContainerInfo_Type) Enum() *ContainerInfo_Type { p := new(ContainerInfo_Type) *p = x return p } func (x ContainerInfo_Type) String() string { return proto.EnumName(ContainerInfo_Type_name, int32(x)) } func (x *ContainerInfo_Type) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(ContainerInfo_Type_value, data, "ContainerInfo_Type") if err != nil { return err } *x = ContainerInfo_Type(value) return nil } // Network options. type ContainerInfo_DockerInfo_Network int32 const ( ContainerInfo_DockerInfo_HOST ContainerInfo_DockerInfo_Network = 1 ContainerInfo_DockerInfo_BRIDGE ContainerInfo_DockerInfo_Network = 2 ContainerInfo_DockerInfo_NONE ContainerInfo_DockerInfo_Network = 3 ) var ContainerInfo_DockerInfo_Network_name = map[int32]string{ 1: "HOST", 2: "BRIDGE", 3: "NONE", } var ContainerInfo_DockerInfo_Network_value = map[string]int32{ "HOST": 1, "BRIDGE": 2, "NONE": 3, } func (x ContainerInfo_DockerInfo_Network) Enum() *ContainerInfo_DockerInfo_Network { p := new(ContainerInfo_DockerInfo_Network) *p = x return p } func (x ContainerInfo_DockerInfo_Network) String() string { return proto.EnumName(ContainerInfo_DockerInfo_Network_name, int32(x)) } func (x *ContainerInfo_DockerInfo_Network) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(ContainerInfo_DockerInfo_Network_value, data, "ContainerInfo_DockerInfo_Network") if err != nil { return err } *x = ContainerInfo_DockerInfo_Network(value) return nil } type DiscoveryInfo_Visibility int32 const ( DiscoveryInfo_FRAMEWORK DiscoveryInfo_Visibility = 0 DiscoveryInfo_CLUSTER DiscoveryInfo_Visibility = 1 DiscoveryInfo_EXTERNAL DiscoveryInfo_Visibility = 2 ) var DiscoveryInfo_Visibility_name = map[int32]string{ 0: "FRAMEWORK", 1: "CLUSTER", 2: "EXTERNAL", } var DiscoveryInfo_Visibility_value = map[string]int32{ "FRAMEWORK": 0, "CLUSTER": 1, "EXTERNAL": 2, } func (x DiscoveryInfo_Visibility) Enum() *DiscoveryInfo_Visibility { p := new(DiscoveryInfo_Visibility) *p = x return p } func (x DiscoveryInfo_Visibility) String() string { return proto.EnumName(DiscoveryInfo_Visibility_name, int32(x)) } func (x *DiscoveryInfo_Visibility) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(DiscoveryInfo_Visibility_value, data, "DiscoveryInfo_Visibility") if err != nil { return err } *x = DiscoveryInfo_Visibility(value) return nil } // * // A unique ID assigned to a framework. A framework can reuse this ID // in order to do failover (see MesosSchedulerDriver). type FrameworkID struct { Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *FrameworkID) Reset() { *m = FrameworkID{} } func (*FrameworkID) ProtoMessage() {} func (m *FrameworkID) GetValue() string { if m != nil && m.Value != nil { return *m.Value } return "" } // * // A unique ID assigned to an offer. type OfferID struct { Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *OfferID) Reset() { *m = OfferID{} } func (*OfferID) ProtoMessage() {} func (m *OfferID) GetValue() string { if m != nil && m.Value != nil { return *m.Value } return "" } // * // A unique ID assigned to a slave. Currently, a slave gets a new ID // whenever it (re)registers with Mesos. Framework writers shouldn't // assume any binding between a slave ID and and a hostname. type SlaveID struct { Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *SlaveID) Reset() { *m = SlaveID{} } func (*SlaveID) ProtoMessage() {} func (m *SlaveID) GetValue() string { if m != nil && m.Value != nil { return *m.Value } return "" } // * // A framework generated ID to distinguish a task. The ID must remain // unique while the task is active. However, a framework can reuse an // ID _only_ if a previous task with the same ID has reached a // terminal state (e.g., TASK_FINISHED, TASK_LOST, TASK_KILLED, etc.). type TaskID struct { Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *TaskID) Reset() { *m = TaskID{} } func (*TaskID) ProtoMessage() {} func (m *TaskID) GetValue() string { if m != nil && m.Value != nil { return *m.Value } return "" } // * // A framework generated ID to distinguish an executor. Only one // executor with the same ID can be active on the same slave at a // time. type ExecutorID struct { Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ExecutorID) Reset() { *m = ExecutorID{} } func (*ExecutorID) ProtoMessage() {} func (m *ExecutorID) GetValue() string { if m != nil && m.Value != nil { return *m.Value } return "" } // * // A slave generated ID to distinguish a container. The ID must be unique // between any active or completed containers on the slave. In particular, // containers for different runs of the same (framework, executor) pair must be // unique. type ContainerID struct { Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ContainerID) Reset() { *m = ContainerID{} } func (*ContainerID) ProtoMessage() {} func (m *ContainerID) GetValue() string { if m != nil && m.Value != nil { return *m.Value } return "" } // * // Describes a framework. type FrameworkInfo struct { // Used to determine the Unix user that an executor or task should // be launched as. If the user field is set to an empty string Mesos // will automagically set it to the current user. User *string `protobuf:"bytes,1,req,name=user" json:"user,omitempty"` // Name of the framework that shows up in the Mesos Web UI. Name *string `protobuf:"bytes,2,req,name=name" json:"name,omitempty"` // Note that 'id' is only available after a framework has // registered, however, it is included here in order to facilitate // scheduler failover (i.e., if it is set then the // MesosSchedulerDriver expects the scheduler is performing // failover). Id *FrameworkID `protobuf:"bytes,3,opt,name=id" json:"id,omitempty"` // The amount of time that the master will wait for the scheduler to // failover before it tears down the framework by killing all its // tasks/executors. This should be non-zero if a framework expects // to reconnect after a failover and not lose its tasks/executors. FailoverTimeout *float64 `protobuf:"fixed64,4,opt,name=failover_timeout,def=0" json:"failover_timeout,omitempty"` // If set, framework pid, executor pids and status updates are // checkpointed to disk by the slaves. Checkpointing allows a // restarted slave to reconnect with old executors and recover // status updates, at the cost of disk I/O. Checkpoint *bool `protobuf:"varint,5,opt,name=checkpoint,def=0" json:"checkpoint,omitempty"` // Used to group frameworks for allocation decisions, depending on // the allocation policy being used. Role *string `protobuf:"bytes,6,opt,name=role,def=*" json:"role,omitempty"` // Used to indicate the current host from which the scheduler is // registered in the Mesos Web UI. If set to an empty string Mesos // will automagically set it to the current hostname. Hostname *string `protobuf:"bytes,7,opt,name=hostname" json:"hostname,omitempty"` // This field should match the credential's principal the framework // uses for authentication. This field is used for framework API // rate limiting and dynamic reservations. It should be set even // if authentication is not enabled if these features are desired. Principal *string `protobuf:"bytes,8,opt,name=principal" json:"principal,omitempty"` // This field allows a framework to advertise its web UI, so that // the Mesos web UI can link to it. It is expected to be a full URL, // for example http://my-scheduler.example.com:8080/. WebuiUrl *string `protobuf:"bytes,9,opt,name=webui_url" json:"webui_url,omitempty"` // This field allows a framework to advertise its set of // capabilities (e.g., ability to receive offers for revocable // resources). Capabilities []*FrameworkInfo_Capability `protobuf:"bytes,10,rep,name=capabilities" json:"capabilities,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *FrameworkInfo) Reset() { *m = FrameworkInfo{} } func (*FrameworkInfo) ProtoMessage() {} const Default_FrameworkInfo_FailoverTimeout float64 = 0 const Default_FrameworkInfo_Checkpoint bool = false const Default_FrameworkInfo_Role string = "*" func (m *FrameworkInfo) GetUser() string { if m != nil && m.User != nil { return *m.User } return "" } func (m *FrameworkInfo) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *FrameworkInfo) GetId() *FrameworkID { if m != nil { return m.Id } return nil } func (m *FrameworkInfo) GetFailoverTimeout() float64 { if m != nil && m.FailoverTimeout != nil { return *m.FailoverTimeout } return Default_FrameworkInfo_FailoverTimeout } func (m *FrameworkInfo) GetCheckpoint() bool { if m != nil && m.Checkpoint != nil { return *m.Checkpoint } return Default_FrameworkInfo_Checkpoint } func (m *FrameworkInfo) GetRole() string { if m != nil && m.Role != nil { return *m.Role } return Default_FrameworkInfo_Role } func (m *FrameworkInfo) GetHostname() string { if m != nil && m.Hostname != nil { return *m.Hostname } return "" } func (m *FrameworkInfo) GetPrincipal() string { if m != nil && m.Principal != nil { return *m.Principal } return "" } func (m *FrameworkInfo) GetWebuiUrl() string { if m != nil && m.WebuiUrl != nil { return *m.WebuiUrl } return "" } func (m *FrameworkInfo) GetCapabilities() []*FrameworkInfo_Capability { if m != nil { return m.Capabilities } return nil } type FrameworkInfo_Capability struct { Type *FrameworkInfo_Capability_Type `protobuf:"varint,1,req,name=type,enum=mesosproto.FrameworkInfo_Capability_Type" json:"type,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *FrameworkInfo_Capability) Reset() { *m = FrameworkInfo_Capability{} } func (*FrameworkInfo_Capability) ProtoMessage() {} func (m *FrameworkInfo_Capability) GetType() FrameworkInfo_Capability_Type { if m != nil && m.Type != nil { return *m.Type } return FrameworkInfo_Capability_REVOCABLE_RESOURCES } // * // Describes a health check for a task or executor (or any arbitrary // process/command). A "strategy" is picked by specifying one of the // optional fields; currently only 'command' is supported. // Specifying more than one strategy is an error. type HealthCheck struct { // HTTP health check - not yet recommended for use, see MESOS-2533. Http *HealthCheck_HTTP `protobuf:"bytes,1,opt,name=http" json:"http,omitempty"` // Amount of time to wait until starting the health checks. DelaySeconds *float64 `protobuf:"fixed64,2,opt,name=delay_seconds,def=15" json:"delay_seconds,omitempty"` // Interval between health checks. IntervalSeconds *float64 `protobuf:"fixed64,3,opt,name=interval_seconds,def=10" json:"interval_seconds,omitempty"` // Amount of time to wait for the health check to complete. TimeoutSeconds *float64 `protobuf:"fixed64,4,opt,name=timeout_seconds,def=20" json:"timeout_seconds,omitempty"` // Number of consecutive failures until considered unhealthy. ConsecutiveFailures *uint32 `protobuf:"varint,5,opt,name=consecutive_failures,def=3" json:"consecutive_failures,omitempty"` // Amount of time to allow failed health checks since launch. GracePeriodSeconds *float64 `protobuf:"fixed64,6,opt,name=grace_period_seconds,def=10" json:"grace_period_seconds,omitempty"` // Command health check. Command *CommandInfo `protobuf:"bytes,7,opt,name=command" json:"command,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *HealthCheck) Reset() { *m = HealthCheck{} } func (*HealthCheck) ProtoMessage() {} const Default_HealthCheck_DelaySeconds float64 = 15 const Default_HealthCheck_IntervalSeconds float64 = 10 const Default_HealthCheck_TimeoutSeconds float64 = 20 const Default_HealthCheck_ConsecutiveFailures uint32 = 3 const Default_HealthCheck_GracePeriodSeconds float64 = 10 func (m *HealthCheck) GetHttp() *HealthCheck_HTTP { if m != nil { return m.Http } return nil } func (m *HealthCheck) GetDelaySeconds() float64 { if m != nil && m.DelaySeconds != nil { return *m.DelaySeconds } return Default_HealthCheck_DelaySeconds } func (m *HealthCheck) GetIntervalSeconds() float64 { if m != nil && m.IntervalSeconds != nil { return *m.IntervalSeconds } return Default_HealthCheck_IntervalSeconds } func (m *HealthCheck) GetTimeoutSeconds() float64 { if m != nil && m.TimeoutSeconds != nil { return *m.TimeoutSeconds } return Default_HealthCheck_TimeoutSeconds } func (m *HealthCheck) GetConsecutiveFailures() uint32 { if m != nil && m.ConsecutiveFailures != nil { return *m.ConsecutiveFailures } return Default_HealthCheck_ConsecutiveFailures } func (m *HealthCheck) GetGracePeriodSeconds() float64 { if m != nil && m.GracePeriodSeconds != nil { return *m.GracePeriodSeconds } return Default_HealthCheck_GracePeriodSeconds } func (m *HealthCheck) GetCommand() *CommandInfo { if m != nil { return m.Command } return nil } // Describes an HTTP health check. This is not fully implemented and not // recommended for use - see MESOS-2533. type HealthCheck_HTTP struct { // Port to send the HTTP request. Port *uint32 `protobuf:"varint,1,req,name=port" json:"port,omitempty"` // HTTP request path. Path *string `protobuf:"bytes,2,opt,name=path,def=/" json:"path,omitempty"` // Expected response statuses. Not specifying any statuses implies // that any returned status is acceptable. Statuses []uint32 `protobuf:"varint,4,rep,name=statuses" json:"statuses,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *HealthCheck_HTTP) Reset() { *m = HealthCheck_HTTP{} } func (*HealthCheck_HTTP) ProtoMessage() {} const Default_HealthCheck_HTTP_Path string = "/" func (m *HealthCheck_HTTP) GetPort() uint32 { if m != nil && m.Port != nil { return *m.Port } return 0 } func (m *HealthCheck_HTTP) GetPath() string { if m != nil && m.Path != nil { return *m.Path } return Default_HealthCheck_HTTP_Path } func (m *HealthCheck_HTTP) GetStatuses() []uint32 { if m != nil { return m.Statuses } return nil } // * // Describes a command, executed via: '/bin/sh -c value'. Any URIs specified // are fetched before executing the command. If the executable field for an // uri is set, executable file permission is set on the downloaded file. // Otherwise, if the downloaded file has a recognized archive extension // (currently [compressed] tar and zip) it is extracted into the executor's // working directory. This extraction can be disabled by setting `extract` to // false. In addition, any environment variables are set before executing // the command (so they can be used to "parameterize" your command). type CommandInfo struct { // NOTE: MesosContainerizer does currently not support this // attribute and tasks supplying a 'container' will fail. Container *CommandInfo_ContainerInfo `protobuf:"bytes,4,opt,name=container" json:"container,omitempty"` Uris []*CommandInfo_URI `protobuf:"bytes,1,rep,name=uris" json:"uris,omitempty"` Environment *Environment `protobuf:"bytes,2,opt,name=environment" json:"environment,omitempty"` // There are two ways to specify the command: // 1) If 'shell == true', the command will be launched via shell // (i.e., /bin/sh -c 'value'). The 'value' specified will be // treated as the shell command. The 'arguments' will be ignored. // 2) If 'shell == false', the command will be launched by passing // arguments to an executable. The 'value' specified will be // treated as the filename of the executable. The 'arguments' // will be treated as the arguments to the executable. This is // similar to how POSIX exec families launch processes (i.e., // execlp(value, arguments(0), arguments(1), ...)). // NOTE: The field 'value' is changed from 'required' to 'optional' // in 0.20.0. It will only cause issues if a new framework is // connecting to an old master. Shell *bool `protobuf:"varint,6,opt,name=shell,def=1" json:"shell,omitempty"` Value *string `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"` Arguments []string `protobuf:"bytes,7,rep,name=arguments" json:"arguments,omitempty"` // Enables executor and tasks to run as a specific user. If the user // field is present both in FrameworkInfo and here, the CommandInfo // user value takes precedence. User *string `protobuf:"bytes,5,opt,name=user" json:"user,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CommandInfo) Reset() { *m = CommandInfo{} } func (*CommandInfo) ProtoMessage() {} const Default_CommandInfo_Shell bool = true func (m *CommandInfo) GetContainer() *CommandInfo_ContainerInfo { if m != nil { return m.Container } return nil } func (m *CommandInfo) GetUris() []*CommandInfo_URI { if m != nil { return m.Uris } return nil } func (m *CommandInfo) GetEnvironment() *Environment { if m != nil { return m.Environment } return nil } func (m *CommandInfo) GetShell() bool { if m != nil && m.Shell != nil { return *m.Shell } return Default_CommandInfo_Shell } func (m *CommandInfo) GetValue() string { if m != nil && m.Value != nil { return *m.Value } return "" } func (m *CommandInfo) GetArguments() []string { if m != nil { return m.Arguments } return nil } func (m *CommandInfo) GetUser() string { if m != nil && m.User != nil { return *m.User } return "" } type CommandInfo_URI struct { Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` Executable *bool `protobuf:"varint,2,opt,name=executable" json:"executable,omitempty"` // In case the fetched file is recognized as an archive, extract // its contents into the sandbox. Note that a cached archive is // not copied from the cache to the sandbox in case extraction // originates from an archive in the cache. Extract *bool `protobuf:"varint,3,opt,name=extract,def=1" json:"extract,omitempty"` // If this field is "true", the fetcher cache will be used. If not, // fetching bypasses the cache and downloads directly into the // sandbox directory, no matter whether a suitable cache file is // available or not. The former directs the fetcher to download to // the file cache, then copy from there to the sandbox. Subsequent // fetch attempts with the same URI will omit downloading and copy // from the cache as long as the file is resident there. Cache files // may get evicted at any time, which then leads to renewed // downloading. See also "docs/fetcher.md" and // "docs/fetcher-cache-internals.md". Cache *bool `protobuf:"varint,4,opt,name=cache" json:"cache,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CommandInfo_URI) Reset() { *m = CommandInfo_URI{} } func (*CommandInfo_URI) ProtoMessage() {} const Default_CommandInfo_URI_Extract bool = true func (m *CommandInfo_URI) GetValue() string { if m != nil && m.Value != nil { return *m.Value } return "" } func (m *CommandInfo_URI) GetExecutable() bool { if m != nil && m.Executable != nil { return *m.Executable } return false } func (m *CommandInfo_URI) GetExtract() bool { if m != nil && m.Extract != nil { return *m.Extract } return Default_CommandInfo_URI_Extract } func (m *CommandInfo_URI) GetCache() bool { if m != nil && m.Cache != nil { return *m.Cache } return false } // Describes a container. // Not all containerizers currently implement ContainerInfo, so it // is possible that a launched task will fail due to supplying this // attribute. // NOTE: The containerizer API is currently in an early beta or // even alpha state. Some details, like the exact semantics of an // "image" or "options" are not yet hardened. // TODO(tillt): Describe the exact scheme and semantics of "image" // and "options". type CommandInfo_ContainerInfo struct { // URI describing the container image name. Image *string `protobuf:"bytes,1,req,name=image" json:"image,omitempty"` // Describes additional options passed to the containerizer. Options []string `protobuf:"bytes,2,rep,name=options" json:"options,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CommandInfo_ContainerInfo) Reset() { *m = CommandInfo_ContainerInfo{} } func (*CommandInfo_ContainerInfo) ProtoMessage() {} func (m *CommandInfo_ContainerInfo) GetImage() string { if m != nil && m.Image != nil { return *m.Image } return "" } func (m *CommandInfo_ContainerInfo) GetOptions() []string { if m != nil { return m.Options } return nil } // * // Describes information about an executor. The 'data' field can be // used to pass arbitrary bytes to an executor. type ExecutorInfo struct { ExecutorId *ExecutorID `protobuf:"bytes,1,req,name=executor_id" json:"executor_id,omitempty"` FrameworkId *FrameworkID `protobuf:"bytes,8,opt,name=framework_id" json:"framework_id,omitempty"` Command *CommandInfo `protobuf:"bytes,7,req,name=command" json:"command,omitempty"` // Executor provided with a container will launch the container // with the executor's CommandInfo and we expect the container to // act as a Mesos executor. Container *ContainerInfo `protobuf:"bytes,11,opt,name=container" json:"container,omitempty"` Resources []*Resource `protobuf:"bytes,5,rep,name=resources" json:"resources,omitempty"` Name *string `protobuf:"bytes,9,opt,name=name" json:"name,omitempty"` // Source is an identifier style string used by frameworks to track // the source of an executor. This is useful when it's possible for // different executor ids to be related semantically. // NOTE: Source is exposed alongside the resource usage of the // executor via JSON on the slave. This allows users to import // usage information into a time series database for monitoring. Source *string `protobuf:"bytes,10,opt,name=source" json:"source,omitempty"` Data []byte `protobuf:"bytes,4,opt,name=data" json:"data,omitempty"` // Service discovery information for the executor. It is not // interpreted or acted upon by Mesos. It is up to a service // discovery system to use this information as needed and to handle // executors without service discovery information. Discovery *DiscoveryInfo `protobuf:"bytes,12,opt,name=discovery" json:"discovery,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ExecutorInfo) Reset() { *m = ExecutorInfo{} } func (*ExecutorInfo) ProtoMessage() {} func (m *ExecutorInfo) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *ExecutorInfo) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *ExecutorInfo) GetCommand() *CommandInfo { if m != nil { return m.Command } return nil } func (m *ExecutorInfo) GetContainer() *ContainerInfo { if m != nil { return m.Container } return nil } func (m *ExecutorInfo) GetResources() []*Resource { if m != nil { return m.Resources } return nil } func (m *ExecutorInfo) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *ExecutorInfo) GetSource() string { if m != nil && m.Source != nil { return *m.Source } return "" } func (m *ExecutorInfo) GetData() []byte { if m != nil { return m.Data } return nil } func (m *ExecutorInfo) GetDiscovery() *DiscoveryInfo { if m != nil { return m.Discovery } return nil } // * // Describes a master. This will probably have more fields in the // future which might be used, for example, to link a framework webui // to a master webui. type MasterInfo struct { Id *string `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` Ip *uint32 `protobuf:"varint,2,req,name=ip" json:"ip,omitempty"` Port *uint32 `protobuf:"varint,3,req,name=port,def=5050" json:"port,omitempty"` Pid *string `protobuf:"bytes,4,opt,name=pid" json:"pid,omitempty"` Hostname *string `protobuf:"bytes,5,opt,name=hostname" json:"hostname,omitempty"` Version *string `protobuf:"bytes,6,opt,name=version" json:"version,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *MasterInfo) Reset() { *m = MasterInfo{} } func (*MasterInfo) ProtoMessage() {} const Default_MasterInfo_Port uint32 = 5050 func (m *MasterInfo) GetId() string { if m != nil && m.Id != nil { return *m.Id } return "" } func (m *MasterInfo) GetIp() uint32 { if m != nil && m.Ip != nil { return *m.Ip } return 0 } func (m *MasterInfo) GetPort() uint32 { if m != nil && m.Port != nil { return *m.Port } return Default_MasterInfo_Port } func (m *MasterInfo) GetPid() string { if m != nil && m.Pid != nil { return *m.Pid } return "" } func (m *MasterInfo) GetHostname() string { if m != nil && m.Hostname != nil { return *m.Hostname } return "" } func (m *MasterInfo) GetVersion() string { if m != nil && m.Version != nil { return *m.Version } return "" } // * // Describes a slave. Note that the 'id' field is only available after // a slave is registered with the master, and is made available here // to facilitate re-registration. If checkpoint is set, the slave is // checkpointing its own information and potentially frameworks' // information (if a framework has checkpointing enabled). type SlaveInfo struct { Hostname *string `protobuf:"bytes,1,req,name=hostname" json:"hostname,omitempty"` Port *int32 `protobuf:"varint,8,opt,name=port,def=5051" json:"port,omitempty"` Resources []*Resource `protobuf:"bytes,3,rep,name=resources" json:"resources,omitempty"` Attributes []*Attribute `protobuf:"bytes,5,rep,name=attributes" json:"attributes,omitempty"` Id *SlaveID `protobuf:"bytes,6,opt,name=id" json:"id,omitempty"` // TODO(joerg84): Remove checkpoint field as with 0.22.0 // slave checkpointing is enabled for all slaves (MESOS-2317). Checkpoint *bool `protobuf:"varint,7,opt,name=checkpoint,def=0" json:"checkpoint,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *SlaveInfo) Reset() { *m = SlaveInfo{} } func (*SlaveInfo) ProtoMessage() {} const Default_SlaveInfo_Port int32 = 5051 const Default_SlaveInfo_Checkpoint bool = false func (m *SlaveInfo) GetHostname() string { if m != nil && m.Hostname != nil { return *m.Hostname } return "" } func (m *SlaveInfo) GetPort() int32 { if m != nil && m.Port != nil { return *m.Port } return Default_SlaveInfo_Port } func (m *SlaveInfo) GetResources() []*Resource { if m != nil { return m.Resources } return nil } func (m *SlaveInfo) GetAttributes() []*Attribute { if m != nil { return m.Attributes } return nil } func (m *SlaveInfo) GetId() *SlaveID { if m != nil { return m.Id } return nil } func (m *SlaveInfo) GetCheckpoint() bool { if m != nil && m.Checkpoint != nil { return *m.Checkpoint } return Default_SlaveInfo_Checkpoint } // * // Describes an Attribute or Resource "value". A value is described // using the standard protocol buffer "union" trick. type Value struct { Type *Value_Type `protobuf:"varint,1,req,name=type,enum=mesosproto.Value_Type" json:"type,omitempty"` Scalar *Value_Scalar `protobuf:"bytes,2,opt,name=scalar" json:"scalar,omitempty"` Ranges *Value_Ranges `protobuf:"bytes,3,opt,name=ranges" json:"ranges,omitempty"` Set *Value_Set `protobuf:"bytes,4,opt,name=set" json:"set,omitempty"` Text *Value_Text `protobuf:"bytes,5,opt,name=text" json:"text,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Value) Reset() { *m = Value{} } func (*Value) ProtoMessage() {} func (m *Value) GetType() Value_Type { if m != nil && m.Type != nil { return *m.Type } return Value_SCALAR } func (m *Value) GetScalar() *Value_Scalar { if m != nil { return m.Scalar } return nil } func (m *Value) GetRanges() *Value_Ranges { if m != nil { return m.Ranges } return nil } func (m *Value) GetSet() *Value_Set { if m != nil { return m.Set } return nil } func (m *Value) GetText() *Value_Text { if m != nil { return m.Text } return nil } type Value_Scalar struct { Value *float64 `protobuf:"fixed64,1,req,name=value" json:"value,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Value_Scalar) Reset() { *m = Value_Scalar{} } func (*Value_Scalar) ProtoMessage() {} func (m *Value_Scalar) GetValue() float64 { if m != nil && m.Value != nil { return *m.Value } return 0 } type Value_Range struct { Begin *uint64 `protobuf:"varint,1,req,name=begin" json:"begin,omitempty"` End *uint64 `protobuf:"varint,2,req,name=end" json:"end,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Value_Range) Reset() { *m = Value_Range{} } func (*Value_Range) ProtoMessage() {} func (m *Value_Range) GetBegin() uint64 { if m != nil && m.Begin != nil { return *m.Begin } return 0 } func (m *Value_Range) GetEnd() uint64 { if m != nil && m.End != nil { return *m.End } return 0 } type Value_Ranges struct { Range []*Value_Range `protobuf:"bytes,1,rep,name=range" json:"range,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Value_Ranges) Reset() { *m = Value_Ranges{} } func (*Value_Ranges) ProtoMessage() {} func (m *Value_Ranges) GetRange() []*Value_Range { if m != nil { return m.Range } return nil } type Value_Set struct { Item []string `protobuf:"bytes,1,rep,name=item" json:"item,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Value_Set) Reset() { *m = Value_Set{} } func (*Value_Set) ProtoMessage() {} func (m *Value_Set) GetItem() []string { if m != nil { return m.Item } return nil } type Value_Text struct { Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Value_Text) Reset() { *m = Value_Text{} } func (*Value_Text) ProtoMessage() {} func (m *Value_Text) GetValue() string { if m != nil && m.Value != nil { return *m.Value } return "" } // * // Describes an attribute that can be set on a machine. For now, // attributes and resources share the same "value" type, but this may // change in the future and attributes may only be string based. type Attribute struct { Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` Type *Value_Type `protobuf:"varint,2,req,name=type,enum=mesosproto.Value_Type" json:"type,omitempty"` Scalar *Value_Scalar `protobuf:"bytes,3,opt,name=scalar" json:"scalar,omitempty"` Ranges *Value_Ranges `protobuf:"bytes,4,opt,name=ranges" json:"ranges,omitempty"` Set *Value_Set `protobuf:"bytes,6,opt,name=set" json:"set,omitempty"` Text *Value_Text `protobuf:"bytes,5,opt,name=text" json:"text,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Attribute) Reset() { *m = Attribute{} } func (*Attribute) ProtoMessage() {} func (m *Attribute) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *Attribute) GetType() Value_Type { if m != nil && m.Type != nil { return *m.Type } return Value_SCALAR } func (m *Attribute) GetScalar() *Value_Scalar { if m != nil { return m.Scalar } return nil } func (m *Attribute) GetRanges() *Value_Ranges { if m != nil { return m.Ranges } return nil } func (m *Attribute) GetSet() *Value_Set { if m != nil { return m.Set } return nil } func (m *Attribute) GetText() *Value_Text { if m != nil { return m.Text } return nil } // * // Describes a resource on a machine. A resource can take on one of // three types: scalar (double), a list of finite and discrete ranges // (e.g., [1-10, 20-30]), or a set of items. A resource is described // using the standard protocol buffer "union" trick. // // TODO(benh): Add better support for "expected" resources (e.g., // cpus, memory, disk, network). type Resource struct { Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` Type *Value_Type `protobuf:"varint,2,req,name=type,enum=mesosproto.Value_Type" json:"type,omitempty"` Scalar *Value_Scalar `protobuf:"bytes,3,opt,name=scalar" json:"scalar,omitempty"` Ranges *Value_Ranges `protobuf:"bytes,4,opt,name=ranges" json:"ranges,omitempty"` Set *Value_Set `protobuf:"bytes,5,opt,name=set" json:"set,omitempty"` Role *string `protobuf:"bytes,6,opt,name=role,def=*" json:"role,omitempty"` // If this is set, this resource was dynamically reserved by an // operator or a framework. Otherwise, this resource is either unreserved // or statically reserved by an operator via the --resources flag. Reservation *Resource_ReservationInfo `protobuf:"bytes,8,opt,name=reservation" json:"reservation,omitempty"` Disk *Resource_DiskInfo `protobuf:"bytes,7,opt,name=disk" json:"disk,omitempty"` // If this is set, the resources are revocable, i.e., any tasks or // executors launched using these resources could get preempted or // throttled at any time. This could be used by frameworks to run // best effort tasks that do not need strict uptime or performance // guarantees. Note that if this is set, 'disk' or 'reservation' // cannot be set. Revocable *Resource_RevocableInfo `protobuf:"bytes,9,opt,name=revocable" json:"revocable,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Resource) Reset() { *m = Resource{} } func (*Resource) ProtoMessage() {} const Default_Resource_Role string = "*" func (m *Resource) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *Resource) GetType() Value_Type { if m != nil && m.Type != nil { return *m.Type } return Value_SCALAR } func (m *Resource) GetScalar() *Value_Scalar { if m != nil { return m.Scalar } return nil } func (m *Resource) GetRanges() *Value_Ranges { if m != nil { return m.Ranges } return nil } func (m *Resource) GetSet() *Value_Set { if m != nil { return m.Set } return nil } func (m *Resource) GetRole() string { if m != nil && m.Role != nil { return *m.Role } return Default_Resource_Role } func (m *Resource) GetReservation() *Resource_ReservationInfo { if m != nil { return m.Reservation } return nil } func (m *Resource) GetDisk() *Resource_DiskInfo { if m != nil { return m.Disk } return nil } func (m *Resource) GetRevocable() *Resource_RevocableInfo { if m != nil { return m.Revocable } return nil } type Resource_ReservationInfo struct { // This field indicates the principal of the operator or framework // that reserved this resource. It is used in conjunction with the // "unreserve" ACL to determine whether the entity attempting to // unreserve this resource is permitted to do so. // NOTE: This field should match the FrameworkInfo.principal of // the framework that reserved this resource. Principal *string `protobuf:"bytes,1,req,name=principal" json:"principal,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Resource_ReservationInfo) Reset() { *m = Resource_ReservationInfo{} } func (*Resource_ReservationInfo) ProtoMessage() {} func (m *Resource_ReservationInfo) GetPrincipal() string { if m != nil && m.Principal != nil { return *m.Principal } return "" } type Resource_DiskInfo struct { Persistence *Resource_DiskInfo_Persistence `protobuf:"bytes,1,opt,name=persistence" json:"persistence,omitempty"` // Describes how this disk resource will be mounted in the // container. If not set, the disk resource will be used as the // sandbox. Otherwise, it will be mounted according to the // 'container_path' inside 'volume'. The 'host_path' inside // 'volume' is ignored. // NOTE: If 'volume' is set but 'persistence' is not set, the // volume will be automatically garbage collected after // task/executor terminates. Currently, if 'persistence' is set, // 'volume' must be set. Volume *Volume `protobuf:"bytes,2,opt,name=volume" json:"volume,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Resource_DiskInfo) Reset() { *m = Resource_DiskInfo{} } func (*Resource_DiskInfo) ProtoMessage() {} func (m *Resource_DiskInfo) GetPersistence() *Resource_DiskInfo_Persistence { if m != nil { return m.Persistence } return nil } func (m *Resource_DiskInfo) GetVolume() *Volume { if m != nil { return m.Volume } return nil } // Describes a persistent disk volume. // A persistent disk volume will not be automatically garbage // collected if the task/executor/slave terminates, but is // re-offered to the framework(s) belonging to the 'role'. // A framework can set the ID (if it is not set yet) to express // the intention to create a new persistent disk volume from a // regular disk resource. To reuse a previously created volume, a // framework can launch a task/executor when it receives an offer // with a persistent volume, i.e., ID is set. // NOTE: Currently, we do not allow a persistent disk volume // without a reservation (i.e., 'role' should not be '*'). type Resource_DiskInfo_Persistence struct { // A unique ID for the persistent disk volume. // NOTE: The ID needs to be unique per role on each slave. Id *string `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Resource_DiskInfo_Persistence) Reset() { *m = Resource_DiskInfo_Persistence{} } func (*Resource_DiskInfo_Persistence) ProtoMessage() {} func (m *Resource_DiskInfo_Persistence) GetId() string { if m != nil && m.Id != nil { return *m.Id } return "" } type Resource_RevocableInfo struct { XXX_unrecognized []byte `json:"-"` } func (m *Resource_RevocableInfo) Reset() { *m = Resource_RevocableInfo{} } func (*Resource_RevocableInfo) ProtoMessage() {} // * // When the network bandwidth caps are enabled and the container // is over its limit, outbound packets may be either delayed or // dropped completely either because it exceeds the maximum bandwidth // allocation for a single container (the cap) or because the combined // network traffic of multiple containers on the host exceeds the // transmit capacity of the host (the share). We can report the // following statistics for each of these conditions exported directly // from the Linux Traffic Control Queueing Discipline. // // id : name of the limiter, e.g. 'tx_bw_cap' // backlog : number of packets currently delayed // bytes : total bytes seen // drops : number of packets dropped in total // overlimits : number of packets which exceeded allocation // packets : total packets seen // qlen : number of packets currently queued // rate_bps : throughput in bytes/sec // rate_pps : throughput in packets/sec // requeues : number of times a packet has been delayed due to // locking or device contention issues // // More information on the operation of Linux Traffic Control can be // found at http://www.lartc.org/lartc.html. type TrafficControlStatistics struct { Id *string `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` Backlog *uint64 `protobuf:"varint,2,opt,name=backlog" json:"backlog,omitempty"` Bytes *uint64 `protobuf:"varint,3,opt,name=bytes" json:"bytes,omitempty"` Drops *uint64 `protobuf:"varint,4,opt,name=drops" json:"drops,omitempty"` Overlimits *uint64 `protobuf:"varint,5,opt,name=overlimits" json:"overlimits,omitempty"` Packets *uint64 `protobuf:"varint,6,opt,name=packets" json:"packets,omitempty"` Qlen *uint64 `protobuf:"varint,7,opt,name=qlen" json:"qlen,omitempty"` Ratebps *uint64 `protobuf:"varint,8,opt,name=ratebps" json:"ratebps,omitempty"` Ratepps *uint64 `protobuf:"varint,9,opt,name=ratepps" json:"ratepps,omitempty"` Requeues *uint64 `protobuf:"varint,10,opt,name=requeues" json:"requeues,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *TrafficControlStatistics) Reset() { *m = TrafficControlStatistics{} } func (*TrafficControlStatistics) ProtoMessage() {} func (m *TrafficControlStatistics) GetId() string { if m != nil && m.Id != nil { return *m.Id } return "" } func (m *TrafficControlStatistics) GetBacklog() uint64 { if m != nil && m.Backlog != nil { return *m.Backlog } return 0 } func (m *TrafficControlStatistics) GetBytes() uint64 { if m != nil && m.Bytes != nil { return *m.Bytes } return 0 } func (m *TrafficControlStatistics) GetDrops() uint64 { if m != nil && m.Drops != nil { return *m.Drops } return 0 } func (m *TrafficControlStatistics) GetOverlimits() uint64 { if m != nil && m.Overlimits != nil { return *m.Overlimits } return 0 } func (m *TrafficControlStatistics) GetPackets() uint64 { if m != nil && m.Packets != nil { return *m.Packets } return 0 } func (m *TrafficControlStatistics) GetQlen() uint64 { if m != nil && m.Qlen != nil { return *m.Qlen } return 0 } func (m *TrafficControlStatistics) GetRatebps() uint64 { if m != nil && m.Ratebps != nil { return *m.Ratebps } return 0 } func (m *TrafficControlStatistics) GetRatepps() uint64 { if m != nil && m.Ratepps != nil { return *m.Ratepps } return 0 } func (m *TrafficControlStatistics) GetRequeues() uint64 { if m != nil && m.Requeues != nil { return *m.Requeues } return 0 } // * // A snapshot of resource usage statistics. type ResourceStatistics struct { Timestamp *float64 `protobuf:"fixed64,1,req,name=timestamp" json:"timestamp,omitempty"` Processes *uint32 `protobuf:"varint,30,opt,name=processes" json:"processes,omitempty"` Threads *uint32 `protobuf:"varint,31,opt,name=threads" json:"threads,omitempty"` // CPU Usage Information: // Total CPU time spent in user mode, and kernel mode. CpusUserTimeSecs *float64 `protobuf:"fixed64,2,opt,name=cpus_user_time_secs" json:"cpus_user_time_secs,omitempty"` CpusSystemTimeSecs *float64 `protobuf:"fixed64,3,opt,name=cpus_system_time_secs" json:"cpus_system_time_secs,omitempty"` // Number of CPUs allocated. CpusLimit *float64 `protobuf:"fixed64,4,opt,name=cpus_limit" json:"cpus_limit,omitempty"` // cpu.stat on process throttling (for contention issues). CpusNrPeriods *uint32 `protobuf:"varint,7,opt,name=cpus_nr_periods" json:"cpus_nr_periods,omitempty"` CpusNrThrottled *uint32 `protobuf:"varint,8,opt,name=cpus_nr_throttled" json:"cpus_nr_throttled,omitempty"` CpusThrottledTimeSecs *float64 `protobuf:"fixed64,9,opt,name=cpus_throttled_time_secs" json:"cpus_throttled_time_secs,omitempty"` // mem_total_bytes was added in 0.23.0 to represent the total memory // of a process in RAM (as opposed to in Swap). This was previously // reported as mem_rss_bytes, which was also changed in 0.23.0 to // represent only the anonymous memory usage, to keep in sync with // Linux kernel's (arguably erroneous) use of terminology. MemTotalBytes *uint64 `protobuf:"varint,36,opt,name=mem_total_bytes" json:"mem_total_bytes,omitempty"` // Total memory + swap usage. This is set if swap is enabled. MemTotalMemswBytes *uint64 `protobuf:"varint,37,opt,name=mem_total_memsw_bytes" json:"mem_total_memsw_bytes,omitempty"` // Hard memory limit for a container. MemLimitBytes *uint64 `protobuf:"varint,6,opt,name=mem_limit_bytes" json:"mem_limit_bytes,omitempty"` // Soft memory limit for a container. MemSoftLimitBytes *uint64 `protobuf:"varint,38,opt,name=mem_soft_limit_bytes" json:"mem_soft_limit_bytes,omitempty"` // TODO(chzhcn) mem_file_bytes and mem_anon_bytes are deprecated in // 0.23.0 and will be removed in 0.24.0. MemFileBytes *uint64 `protobuf:"varint,10,opt,name=mem_file_bytes" json:"mem_file_bytes,omitempty"` MemAnonBytes *uint64 `protobuf:"varint,11,opt,name=mem_anon_bytes" json:"mem_anon_bytes,omitempty"` // mem_cache_bytes is added in 0.23.0 to represent page cache usage. MemCacheBytes *uint64 `protobuf:"varint,39,opt,name=mem_cache_bytes" json:"mem_cache_bytes,omitempty"` // Since 0.23.0, mem_rss_bytes is changed to represent only // anonymous memory usage. Note that neither its requiredness, type, // name nor numeric tag has been changed. MemRssBytes *uint64 `protobuf:"varint,5,opt,name=mem_rss_bytes" json:"mem_rss_bytes,omitempty"` MemMappedFileBytes *uint64 `protobuf:"varint,12,opt,name=mem_mapped_file_bytes" json:"mem_mapped_file_bytes,omitempty"` // This is only set if swap is enabled. MemSwapBytes *uint64 `protobuf:"varint,40,opt,name=mem_swap_bytes" json:"mem_swap_bytes,omitempty"` // Number of occurrences of different levels of memory pressure // events reported by memory cgroup. Pressure listening (re)starts // with these values set to 0 when slave (re)starts. See // https://www.kernel.org/doc/Documentation/cgroups/memory.txt for // more details. MemLowPressureCounter *uint64 `protobuf:"varint,32,opt,name=mem_low_pressure_counter" json:"mem_low_pressure_counter,omitempty"` MemMediumPressureCounter *uint64 `protobuf:"varint,33,opt,name=mem_medium_pressure_counter" json:"mem_medium_pressure_counter,omitempty"` MemCriticalPressureCounter *uint64 `protobuf:"varint,34,opt,name=mem_critical_pressure_counter" json:"mem_critical_pressure_counter,omitempty"` // Disk Usage Information for executor working directory. DiskLimitBytes *uint64 `protobuf:"varint,26,opt,name=disk_limit_bytes" json:"disk_limit_bytes,omitempty"` DiskUsedBytes *uint64 `protobuf:"varint,27,opt,name=disk_used_bytes" json:"disk_used_bytes,omitempty"` // Perf statistics. Perf *PerfStatistics `protobuf:"bytes,13,opt,name=perf" json:"perf,omitempty"` // Network Usage Information: NetRxPackets *uint64 `protobuf:"varint,14,opt,name=net_rx_packets" json:"net_rx_packets,omitempty"` NetRxBytes *uint64 `protobuf:"varint,15,opt,name=net_rx_bytes" json:"net_rx_bytes,omitempty"` NetRxErrors *uint64 `protobuf:"varint,16,opt,name=net_rx_errors" json:"net_rx_errors,omitempty"` NetRxDropped *uint64 `protobuf:"varint,17,opt,name=net_rx_dropped" json:"net_rx_dropped,omitempty"` NetTxPackets *uint64 `protobuf:"varint,18,opt,name=net_tx_packets" json:"net_tx_packets,omitempty"` NetTxBytes *uint64 `protobuf:"varint,19,opt,name=net_tx_bytes" json:"net_tx_bytes,omitempty"` NetTxErrors *uint64 `protobuf:"varint,20,opt,name=net_tx_errors" json:"net_tx_errors,omitempty"` NetTxDropped *uint64 `protobuf:"varint,21,opt,name=net_tx_dropped" json:"net_tx_dropped,omitempty"` // The kernel keeps track of RTT (round-trip time) for its TCP // sockets. RTT is a way to tell the latency of a container. NetTcpRttMicrosecsP50 *float64 `protobuf:"fixed64,22,opt,name=net_tcp_rtt_microsecs_p50" json:"net_tcp_rtt_microsecs_p50,omitempty"` NetTcpRttMicrosecsP90 *float64 `protobuf:"fixed64,23,opt,name=net_tcp_rtt_microsecs_p90" json:"net_tcp_rtt_microsecs_p90,omitempty"` NetTcpRttMicrosecsP95 *float64 `protobuf:"fixed64,24,opt,name=net_tcp_rtt_microsecs_p95" json:"net_tcp_rtt_microsecs_p95,omitempty"` NetTcpRttMicrosecsP99 *float64 `protobuf:"fixed64,25,opt,name=net_tcp_rtt_microsecs_p99" json:"net_tcp_rtt_microsecs_p99,omitempty"` NetTcpActiveConnections *float64 `protobuf:"fixed64,28,opt,name=net_tcp_active_connections" json:"net_tcp_active_connections,omitempty"` NetTcpTimeWaitConnections *float64 `protobuf:"fixed64,29,opt,name=net_tcp_time_wait_connections" json:"net_tcp_time_wait_connections,omitempty"` // Network traffic flowing into or out of a container can be delayed // or dropped due to congestion or policy inside and outside the // container. NetTrafficControlStatistics []*TrafficControlStatistics `protobuf:"bytes,35,rep,name=net_traffic_control_statistics" json:"net_traffic_control_statistics,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ResourceStatistics) Reset() { *m = ResourceStatistics{} } func (*ResourceStatistics) ProtoMessage() {} func (m *ResourceStatistics) GetTimestamp() float64 { if m != nil && m.Timestamp != nil { return *m.Timestamp } return 0 } func (m *ResourceStatistics) GetProcesses() uint32 { if m != nil && m.Processes != nil { return *m.Processes } return 0 } func (m *ResourceStatistics) GetThreads() uint32 { if m != nil && m.Threads != nil { return *m.Threads } return 0 } func (m *ResourceStatistics) GetCpusUserTimeSecs() float64 { if m != nil && m.CpusUserTimeSecs != nil { return *m.CpusUserTimeSecs } return 0 } func (m *ResourceStatistics) GetCpusSystemTimeSecs() float64 { if m != nil && m.CpusSystemTimeSecs != nil { return *m.CpusSystemTimeSecs } return 0 } func (m *ResourceStatistics) GetCpusLimit() float64 { if m != nil && m.CpusLimit != nil { return *m.CpusLimit } return 0 } func (m *ResourceStatistics) GetCpusNrPeriods() uint32 { if m != nil && m.CpusNrPeriods != nil { return *m.CpusNrPeriods } return 0 } func (m *ResourceStatistics) GetCpusNrThrottled() uint32 { if m != nil && m.CpusNrThrottled != nil { return *m.CpusNrThrottled } return 0 } func (m *ResourceStatistics) GetCpusThrottledTimeSecs() float64 { if m != nil && m.CpusThrottledTimeSecs != nil { return *m.CpusThrottledTimeSecs } return 0 } func (m *ResourceStatistics) GetMemTotalBytes() uint64 { if m != nil && m.MemTotalBytes != nil { return *m.MemTotalBytes } return 0 } func (m *ResourceStatistics) GetMemTotalMemswBytes() uint64 { if m != nil && m.MemTotalMemswBytes != nil { return *m.MemTotalMemswBytes } return 0 } func (m *ResourceStatistics) GetMemLimitBytes() uint64 { if m != nil && m.MemLimitBytes != nil { return *m.MemLimitBytes } return 0 } func (m *ResourceStatistics) GetMemSoftLimitBytes() uint64 { if m != nil && m.MemSoftLimitBytes != nil { return *m.MemSoftLimitBytes } return 0 } func (m *ResourceStatistics) GetMemFileBytes() uint64 { if m != nil && m.MemFileBytes != nil { return *m.MemFileBytes } return 0 } func (m *ResourceStatistics) GetMemAnonBytes() uint64 { if m != nil && m.MemAnonBytes != nil { return *m.MemAnonBytes } return 0 } func (m *ResourceStatistics) GetMemCacheBytes() uint64 { if m != nil && m.MemCacheBytes != nil { return *m.MemCacheBytes } return 0 } func (m *ResourceStatistics) GetMemRssBytes() uint64 { if m != nil && m.MemRssBytes != nil { return *m.MemRssBytes } return 0 } func (m *ResourceStatistics) GetMemMappedFileBytes() uint64 { if m != nil && m.MemMappedFileBytes != nil { return *m.MemMappedFileBytes } return 0 } func (m *ResourceStatistics) GetMemSwapBytes() uint64 { if m != nil && m.MemSwapBytes != nil { return *m.MemSwapBytes } return 0 } func (m *ResourceStatistics) GetMemLowPressureCounter() uint64 { if m != nil && m.MemLowPressureCounter != nil { return *m.MemLowPressureCounter } return 0 } func (m *ResourceStatistics) GetMemMediumPressureCounter() uint64 { if m != nil && m.MemMediumPressureCounter != nil { return *m.MemMediumPressureCounter } return 0 } func (m *ResourceStatistics) GetMemCriticalPressureCounter() uint64 { if m != nil && m.MemCriticalPressureCounter != nil { return *m.MemCriticalPressureCounter } return 0 } func (m *ResourceStatistics) GetDiskLimitBytes() uint64 { if m != nil && m.DiskLimitBytes != nil { return *m.DiskLimitBytes } return 0 } func (m *ResourceStatistics) GetDiskUsedBytes() uint64 { if m != nil && m.DiskUsedBytes != nil { return *m.DiskUsedBytes } return 0 } func (m *ResourceStatistics) GetPerf() *PerfStatistics { if m != nil { return m.Perf } return nil } func (m *ResourceStatistics) GetNetRxPackets() uint64 { if m != nil && m.NetRxPackets != nil { return *m.NetRxPackets } return 0 } func (m *ResourceStatistics) GetNetRxBytes() uint64 { if m != nil && m.NetRxBytes != nil { return *m.NetRxBytes } return 0 } func (m *ResourceStatistics) GetNetRxErrors() uint64 { if m != nil && m.NetRxErrors != nil { return *m.NetRxErrors } return 0 } func (m *ResourceStatistics) GetNetRxDropped() uint64 { if m != nil && m.NetRxDropped != nil { return *m.NetRxDropped } return 0 } func (m *ResourceStatistics) GetNetTxPackets() uint64 { if m != nil && m.NetTxPackets != nil { return *m.NetTxPackets } return 0 } func (m *ResourceStatistics) GetNetTxBytes() uint64 { if m != nil && m.NetTxBytes != nil { return *m.NetTxBytes } return 0 } func (m *ResourceStatistics) GetNetTxErrors() uint64 { if m != nil && m.NetTxErrors != nil { return *m.NetTxErrors } return 0 } func (m *ResourceStatistics) GetNetTxDropped() uint64 { if m != nil && m.NetTxDropped != nil { return *m.NetTxDropped } return 0 } func (m *ResourceStatistics) GetNetTcpRttMicrosecsP50() float64 { if m != nil && m.NetTcpRttMicrosecsP50 != nil { return *m.NetTcpRttMicrosecsP50 } return 0 } func (m *ResourceStatistics) GetNetTcpRttMicrosecsP90() float64 { if m != nil && m.NetTcpRttMicrosecsP90 != nil { return *m.NetTcpRttMicrosecsP90 } return 0 } func (m *ResourceStatistics) GetNetTcpRttMicrosecsP95() float64 { if m != nil && m.NetTcpRttMicrosecsP95 != nil { return *m.NetTcpRttMicrosecsP95 } return 0 } func (m *ResourceStatistics) GetNetTcpRttMicrosecsP99() float64 { if m != nil && m.NetTcpRttMicrosecsP99 != nil { return *m.NetTcpRttMicrosecsP99 } return 0 } func (m *ResourceStatistics) GetNetTcpActiveConnections() float64 { if m != nil && m.NetTcpActiveConnections != nil { return *m.NetTcpActiveConnections } return 0 } func (m *ResourceStatistics) GetNetTcpTimeWaitConnections() float64 { if m != nil && m.NetTcpTimeWaitConnections != nil { return *m.NetTcpTimeWaitConnections } return 0 } func (m *ResourceStatistics) GetNetTrafficControlStatistics() []*TrafficControlStatistics { if m != nil { return m.NetTrafficControlStatistics } return nil } // * // Describes a snapshot of the resource usage for executors. type ResourceUsage struct { Executors []*ResourceUsage_Executor `protobuf:"bytes,1,rep,name=executors" json:"executors,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ResourceUsage) Reset() { *m = ResourceUsage{} } func (*ResourceUsage) ProtoMessage() {} func (m *ResourceUsage) GetExecutors() []*ResourceUsage_Executor { if m != nil { return m.Executors } return nil } type ResourceUsage_Executor struct { ExecutorInfo *ExecutorInfo `protobuf:"bytes,1,req,name=executor_info" json:"executor_info,omitempty"` // This includes resources used by the executor itself // as well as its active tasks. Allocated []*Resource `protobuf:"bytes,2,rep,name=allocated" json:"allocated,omitempty"` // Current resource usage. If absent, the containerizer // cannot provide resource usage. Statistics *ResourceStatistics `protobuf:"bytes,3,opt,name=statistics" json:"statistics,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ResourceUsage_Executor) Reset() { *m = ResourceUsage_Executor{} } func (*ResourceUsage_Executor) ProtoMessage() {} func (m *ResourceUsage_Executor) GetExecutorInfo() *ExecutorInfo { if m != nil { return m.ExecutorInfo } return nil } func (m *ResourceUsage_Executor) GetAllocated() []*Resource { if m != nil { return m.Allocated } return nil } func (m *ResourceUsage_Executor) GetStatistics() *ResourceStatistics { if m != nil { return m.Statistics } return nil } // * // Describes a sample of events from "perf stat". Only available on // Linux. // // NOTE: Each optional field matches the name of a perf event (see // "perf list") with the following changes: // 1. Names are downcased. // 2. Hyphens ('-') are replaced with underscores ('_'). // 3. Events with alternate names use the name "perf stat" returns, // e.g., for the event "cycles OR cpu-cycles" perf always returns // cycles. type PerfStatistics struct { Timestamp *float64 `protobuf:"fixed64,1,req,name=timestamp" json:"timestamp,omitempty"` Duration *float64 `protobuf:"fixed64,2,req,name=duration" json:"duration,omitempty"` // Hardware event. Cycles *uint64 `protobuf:"varint,3,opt,name=cycles" json:"cycles,omitempty"` StalledCyclesFrontend *uint64 `protobuf:"varint,4,opt,name=stalled_cycles_frontend" json:"stalled_cycles_frontend,omitempty"` StalledCyclesBackend *uint64 `protobuf:"varint,5,opt,name=stalled_cycles_backend" json:"stalled_cycles_backend,omitempty"` Instructions *uint64 `protobuf:"varint,6,opt,name=instructions" json:"instructions,omitempty"` CacheReferences *uint64 `protobuf:"varint,7,opt,name=cache_references" json:"cache_references,omitempty"` CacheMisses *uint64 `protobuf:"varint,8,opt,name=cache_misses" json:"cache_misses,omitempty"` Branches *uint64 `protobuf:"varint,9,opt,name=branches" json:"branches,omitempty"` BranchMisses *uint64 `protobuf:"varint,10,opt,name=branch_misses" json:"branch_misses,omitempty"` BusCycles *uint64 `protobuf:"varint,11,opt,name=bus_cycles" json:"bus_cycles,omitempty"` RefCycles *uint64 `protobuf:"varint,12,opt,name=ref_cycles" json:"ref_cycles,omitempty"` // Software event. CpuClock *float64 `protobuf:"fixed64,13,opt,name=cpu_clock" json:"cpu_clock,omitempty"` TaskClock *float64 `protobuf:"fixed64,14,opt,name=task_clock" json:"task_clock,omitempty"` PageFaults *uint64 `protobuf:"varint,15,opt,name=page_faults" json:"page_faults,omitempty"` MinorFaults *uint64 `protobuf:"varint,16,opt,name=minor_faults" json:"minor_faults,omitempty"` MajorFaults *uint64 `protobuf:"varint,17,opt,name=major_faults" json:"major_faults,omitempty"` ContextSwitches *uint64 `protobuf:"varint,18,opt,name=context_switches" json:"context_switches,omitempty"` CpuMigrations *uint64 `protobuf:"varint,19,opt,name=cpu_migrations" json:"cpu_migrations,omitempty"` AlignmentFaults *uint64 `protobuf:"varint,20,opt,name=alignment_faults" json:"alignment_faults,omitempty"` EmulationFaults *uint64 `protobuf:"varint,21,opt,name=emulation_faults" json:"emulation_faults,omitempty"` // Hardware cache event. L1DcacheLoads *uint64 `protobuf:"varint,22,opt,name=l1_dcache_loads" json:"l1_dcache_loads,omitempty"` L1DcacheLoadMisses *uint64 `protobuf:"varint,23,opt,name=l1_dcache_load_misses" json:"l1_dcache_load_misses,omitempty"` L1DcacheStores *uint64 `protobuf:"varint,24,opt,name=l1_dcache_stores" json:"l1_dcache_stores,omitempty"` L1DcacheStoreMisses *uint64 `protobuf:"varint,25,opt,name=l1_dcache_store_misses" json:"l1_dcache_store_misses,omitempty"` L1DcachePrefetches *uint64 `protobuf:"varint,26,opt,name=l1_dcache_prefetches" json:"l1_dcache_prefetches,omitempty"` L1DcachePrefetchMisses *uint64 `protobuf:"varint,27,opt,name=l1_dcache_prefetch_misses" json:"l1_dcache_prefetch_misses,omitempty"` L1IcacheLoads *uint64 `protobuf:"varint,28,opt,name=l1_icache_loads" json:"l1_icache_loads,omitempty"` L1IcacheLoadMisses *uint64 `protobuf:"varint,29,opt,name=l1_icache_load_misses" json:"l1_icache_load_misses,omitempty"` L1IcachePrefetches *uint64 `protobuf:"varint,30,opt,name=l1_icache_prefetches" json:"l1_icache_prefetches,omitempty"` L1IcachePrefetchMisses *uint64 `protobuf:"varint,31,opt,name=l1_icache_prefetch_misses" json:"l1_icache_prefetch_misses,omitempty"` LlcLoads *uint64 `protobuf:"varint,32,opt,name=llc_loads" json:"llc_loads,omitempty"` LlcLoadMisses *uint64 `protobuf:"varint,33,opt,name=llc_load_misses" json:"llc_load_misses,omitempty"` LlcStores *uint64 `protobuf:"varint,34,opt,name=llc_stores" json:"llc_stores,omitempty"` LlcStoreMisses *uint64 `protobuf:"varint,35,opt,name=llc_store_misses" json:"llc_store_misses,omitempty"` LlcPrefetches *uint64 `protobuf:"varint,36,opt,name=llc_prefetches" json:"llc_prefetches,omitempty"` LlcPrefetchMisses *uint64 `protobuf:"varint,37,opt,name=llc_prefetch_misses" json:"llc_prefetch_misses,omitempty"` DtlbLoads *uint64 `protobuf:"varint,38,opt,name=dtlb_loads" json:"dtlb_loads,omitempty"` DtlbLoadMisses *uint64 `protobuf:"varint,39,opt,name=dtlb_load_misses" json:"dtlb_load_misses,omitempty"` DtlbStores *uint64 `protobuf:"varint,40,opt,name=dtlb_stores" json:"dtlb_stores,omitempty"` DtlbStoreMisses *uint64 `protobuf:"varint,41,opt,name=dtlb_store_misses" json:"dtlb_store_misses,omitempty"` DtlbPrefetches *uint64 `protobuf:"varint,42,opt,name=dtlb_prefetches" json:"dtlb_prefetches,omitempty"` DtlbPrefetchMisses *uint64 `protobuf:"varint,43,opt,name=dtlb_prefetch_misses" json:"dtlb_prefetch_misses,omitempty"` ItlbLoads *uint64 `protobuf:"varint,44,opt,name=itlb_loads" json:"itlb_loads,omitempty"` ItlbLoadMisses *uint64 `protobuf:"varint,45,opt,name=itlb_load_misses" json:"itlb_load_misses,omitempty"` BranchLoads *uint64 `protobuf:"varint,46,opt,name=branch_loads" json:"branch_loads,omitempty"` BranchLoadMisses *uint64 `protobuf:"varint,47,opt,name=branch_load_misses" json:"branch_load_misses,omitempty"` NodeLoads *uint64 `protobuf:"varint,48,opt,name=node_loads" json:"node_loads,omitempty"` NodeLoadMisses *uint64 `protobuf:"varint,49,opt,name=node_load_misses" json:"node_load_misses,omitempty"` NodeStores *uint64 `protobuf:"varint,50,opt,name=node_stores" json:"node_stores,omitempty"` NodeStoreMisses *uint64 `protobuf:"varint,51,opt,name=node_store_misses" json:"node_store_misses,omitempty"` NodePrefetches *uint64 `protobuf:"varint,52,opt,name=node_prefetches" json:"node_prefetches,omitempty"` NodePrefetchMisses *uint64 `protobuf:"varint,53,opt,name=node_prefetch_misses" json:"node_prefetch_misses,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *PerfStatistics) Reset() { *m = PerfStatistics{} } func (*PerfStatistics) ProtoMessage() {} func (m *PerfStatistics) GetTimestamp() float64 { if m != nil && m.Timestamp != nil { return *m.Timestamp } return 0 } func (m *PerfStatistics) GetDuration() float64 { if m != nil && m.Duration != nil { return *m.Duration } return 0 } func (m *PerfStatistics) GetCycles() uint64 { if m != nil && m.Cycles != nil { return *m.Cycles } return 0 } func (m *PerfStatistics) GetStalledCyclesFrontend() uint64 { if m != nil && m.StalledCyclesFrontend != nil { return *m.StalledCyclesFrontend } return 0 } func (m *PerfStatistics) GetStalledCyclesBackend() uint64 { if m != nil && m.StalledCyclesBackend != nil { return *m.StalledCyclesBackend } return 0 } func (m *PerfStatistics) GetInstructions() uint64 { if m != nil && m.Instructions != nil { return *m.Instructions } return 0 } func (m *PerfStatistics) GetCacheReferences() uint64 { if m != nil && m.CacheReferences != nil { return *m.CacheReferences } return 0 } func (m *PerfStatistics) GetCacheMisses() uint64 { if m != nil && m.CacheMisses != nil { return *m.CacheMisses } return 0 } func (m *PerfStatistics) GetBranches() uint64 { if m != nil && m.Branches != nil { return *m.Branches } return 0 } func (m *PerfStatistics) GetBranchMisses() uint64 { if m != nil && m.BranchMisses != nil { return *m.BranchMisses } return 0 } func (m *PerfStatistics) GetBusCycles() uint64 { if m != nil && m.BusCycles != nil { return *m.BusCycles } return 0 } func (m *PerfStatistics) GetRefCycles() uint64 { if m != nil && m.RefCycles != nil { return *m.RefCycles } return 0 } func (m *PerfStatistics) GetCpuClock() float64 { if m != nil && m.CpuClock != nil { return *m.CpuClock } return 0 } func (m *PerfStatistics) GetTaskClock() float64 { if m != nil && m.TaskClock != nil { return *m.TaskClock } return 0 } func (m *PerfStatistics) GetPageFaults() uint64 { if m != nil && m.PageFaults != nil { return *m.PageFaults } return 0 } func (m *PerfStatistics) GetMinorFaults() uint64 { if m != nil && m.MinorFaults != nil { return *m.MinorFaults } return 0 } func (m *PerfStatistics) GetMajorFaults() uint64 { if m != nil && m.MajorFaults != nil { return *m.MajorFaults } return 0 } func (m *PerfStatistics) GetContextSwitches() uint64 { if m != nil && m.ContextSwitches != nil { return *m.ContextSwitches } return 0 } func (m *PerfStatistics) GetCpuMigrations() uint64 { if m != nil && m.CpuMigrations != nil { return *m.CpuMigrations } return 0 } func (m *PerfStatistics) GetAlignmentFaults() uint64 { if m != nil && m.AlignmentFaults != nil { return *m.AlignmentFaults } return 0 } func (m *PerfStatistics) GetEmulationFaults() uint64 { if m != nil && m.EmulationFaults != nil { return *m.EmulationFaults } return 0 } func (m *PerfStatistics) GetL1DcacheLoads() uint64 { if m != nil && m.L1DcacheLoads != nil { return *m.L1DcacheLoads } return 0 } func (m *PerfStatistics) GetL1DcacheLoadMisses() uint64 { if m != nil && m.L1DcacheLoadMisses != nil { return *m.L1DcacheLoadMisses } return 0 } func (m *PerfStatistics) GetL1DcacheStores() uint64 { if m != nil && m.L1DcacheStores != nil { return *m.L1DcacheStores } return 0 } func (m *PerfStatistics) GetL1DcacheStoreMisses() uint64 { if m != nil && m.L1DcacheStoreMisses != nil { return *m.L1DcacheStoreMisses } return 0 } func (m *PerfStatistics) GetL1DcachePrefetches() uint64 { if m != nil && m.L1DcachePrefetches != nil { return *m.L1DcachePrefetches } return 0 } func (m *PerfStatistics) GetL1DcachePrefetchMisses() uint64 { if m != nil && m.L1DcachePrefetchMisses != nil { return *m.L1DcachePrefetchMisses } return 0 } func (m *PerfStatistics) GetL1IcacheLoads() uint64 { if m != nil && m.L1IcacheLoads != nil { return *m.L1IcacheLoads } return 0 } func (m *PerfStatistics) GetL1IcacheLoadMisses() uint64 { if m != nil && m.L1IcacheLoadMisses != nil { return *m.L1IcacheLoadMisses } return 0 } func (m *PerfStatistics) GetL1IcachePrefetches() uint64 { if m != nil && m.L1IcachePrefetches != nil { return *m.L1IcachePrefetches } return 0 } func (m *PerfStatistics) GetL1IcachePrefetchMisses() uint64 { if m != nil && m.L1IcachePrefetchMisses != nil { return *m.L1IcachePrefetchMisses } return 0 } func (m *PerfStatistics) GetLlcLoads() uint64 { if m != nil && m.LlcLoads != nil { return *m.LlcLoads } return 0 } func (m *PerfStatistics) GetLlcLoadMisses() uint64 { if m != nil && m.LlcLoadMisses != nil { return *m.LlcLoadMisses } return 0 } func (m *PerfStatistics) GetLlcStores() uint64 { if m != nil && m.LlcStores != nil { return *m.LlcStores } return 0 } func (m *PerfStatistics) GetLlcStoreMisses() uint64 { if m != nil && m.LlcStoreMisses != nil { return *m.LlcStoreMisses } return 0 } func (m *PerfStatistics) GetLlcPrefetches() uint64 { if m != nil && m.LlcPrefetches != nil { return *m.LlcPrefetches } return 0 } func (m *PerfStatistics) GetLlcPrefetchMisses() uint64 { if m != nil && m.LlcPrefetchMisses != nil { return *m.LlcPrefetchMisses } return 0 } func (m *PerfStatistics) GetDtlbLoads() uint64 { if m != nil && m.DtlbLoads != nil { return *m.DtlbLoads } return 0 } func (m *PerfStatistics) GetDtlbLoadMisses() uint64 { if m != nil && m.DtlbLoadMisses != nil { return *m.DtlbLoadMisses } return 0 } func (m *PerfStatistics) GetDtlbStores() uint64 { if m != nil && m.DtlbStores != nil { return *m.DtlbStores } return 0 } func (m *PerfStatistics) GetDtlbStoreMisses() uint64 { if m != nil && m.DtlbStoreMisses != nil { return *m.DtlbStoreMisses } return 0 } func (m *PerfStatistics) GetDtlbPrefetches() uint64 { if m != nil && m.DtlbPrefetches != nil { return *m.DtlbPrefetches } return 0 } func (m *PerfStatistics) GetDtlbPrefetchMisses() uint64 { if m != nil && m.DtlbPrefetchMisses != nil { return *m.DtlbPrefetchMisses } return 0 } func (m *PerfStatistics) GetItlbLoads() uint64 { if m != nil && m.ItlbLoads != nil { return *m.ItlbLoads } return 0 } func (m *PerfStatistics) GetItlbLoadMisses() uint64 { if m != nil && m.ItlbLoadMisses != nil { return *m.ItlbLoadMisses } return 0 } func (m *PerfStatistics) GetBranchLoads() uint64 { if m != nil && m.BranchLoads != nil { return *m.BranchLoads } return 0 } func (m *PerfStatistics) GetBranchLoadMisses() uint64 { if m != nil && m.BranchLoadMisses != nil { return *m.BranchLoadMisses } return 0 } func (m *PerfStatistics) GetNodeLoads() uint64 { if m != nil && m.NodeLoads != nil { return *m.NodeLoads } return 0 } func (m *PerfStatistics) GetNodeLoadMisses() uint64 { if m != nil && m.NodeLoadMisses != nil { return *m.NodeLoadMisses } return 0 } func (m *PerfStatistics) GetNodeStores() uint64 { if m != nil && m.NodeStores != nil { return *m.NodeStores } return 0 } func (m *PerfStatistics) GetNodeStoreMisses() uint64 { if m != nil && m.NodeStoreMisses != nil { return *m.NodeStoreMisses } return 0 } func (m *PerfStatistics) GetNodePrefetches() uint64 { if m != nil && m.NodePrefetches != nil { return *m.NodePrefetches } return 0 } func (m *PerfStatistics) GetNodePrefetchMisses() uint64 { if m != nil && m.NodePrefetchMisses != nil { return *m.NodePrefetchMisses } return 0 } // * // Describes a request for resources that can be used by a framework // to proactively influence the allocator. If 'slave_id' is provided // then this request is assumed to only apply to resources on that // slave. // // TODO(vinod): Remove this once the old driver is removed. type Request struct { SlaveId *SlaveID `protobuf:"bytes,1,opt,name=slave_id" json:"slave_id,omitempty"` Resources []*Resource `protobuf:"bytes,2,rep,name=resources" json:"resources,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Request) Reset() { *m = Request{} } func (*Request) ProtoMessage() {} func (m *Request) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *Request) GetResources() []*Resource { if m != nil { return m.Resources } return nil } // * // Describes some resources available on a slave. An offer only // contains resources from a single slave. type Offer struct { Id *OfferID `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` FrameworkId *FrameworkID `protobuf:"bytes,2,req,name=framework_id" json:"framework_id,omitempty"` SlaveId *SlaveID `protobuf:"bytes,3,req,name=slave_id" json:"slave_id,omitempty"` Hostname *string `protobuf:"bytes,4,req,name=hostname" json:"hostname,omitempty"` Resources []*Resource `protobuf:"bytes,5,rep,name=resources" json:"resources,omitempty"` Attributes []*Attribute `protobuf:"bytes,7,rep,name=attributes" json:"attributes,omitempty"` ExecutorIds []*ExecutorID `protobuf:"bytes,6,rep,name=executor_ids" json:"executor_ids,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Offer) Reset() { *m = Offer{} } func (*Offer) ProtoMessage() {} func (m *Offer) GetId() *OfferID { if m != nil { return m.Id } return nil } func (m *Offer) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *Offer) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *Offer) GetHostname() string { if m != nil && m.Hostname != nil { return *m.Hostname } return "" } func (m *Offer) GetResources() []*Resource { if m != nil { return m.Resources } return nil } func (m *Offer) GetAttributes() []*Attribute { if m != nil { return m.Attributes } return nil } func (m *Offer) GetExecutorIds() []*ExecutorID { if m != nil { return m.ExecutorIds } return nil } // Defines an operation that can be performed against offers. type Offer_Operation struct { Type *Offer_Operation_Type `protobuf:"varint,1,req,name=type,enum=mesosproto.Offer_Operation_Type" json:"type,omitempty"` Launch *Offer_Operation_Launch `protobuf:"bytes,2,opt,name=launch" json:"launch,omitempty"` Reserve *Offer_Operation_Reserve `protobuf:"bytes,3,opt,name=reserve" json:"reserve,omitempty"` Unreserve *Offer_Operation_Unreserve `protobuf:"bytes,4,opt,name=unreserve" json:"unreserve,omitempty"` Create *Offer_Operation_Create `protobuf:"bytes,5,opt,name=create" json:"create,omitempty"` Destroy *Offer_Operation_Destroy `protobuf:"bytes,6,opt,name=destroy" json:"destroy,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Offer_Operation) Reset() { *m = Offer_Operation{} } func (*Offer_Operation) ProtoMessage() {} func (m *Offer_Operation) GetType() Offer_Operation_Type { if m != nil && m.Type != nil { return *m.Type } return Offer_Operation_LAUNCH } func (m *Offer_Operation) GetLaunch() *Offer_Operation_Launch { if m != nil { return m.Launch } return nil } func (m *Offer_Operation) GetReserve() *Offer_Operation_Reserve { if m != nil { return m.Reserve } return nil } func (m *Offer_Operation) GetUnreserve() *Offer_Operation_Unreserve { if m != nil { return m.Unreserve } return nil } func (m *Offer_Operation) GetCreate() *Offer_Operation_Create { if m != nil { return m.Create } return nil } func (m *Offer_Operation) GetDestroy() *Offer_Operation_Destroy { if m != nil { return m.Destroy } return nil } type Offer_Operation_Launch struct { TaskInfos []*TaskInfo `protobuf:"bytes,1,rep,name=task_infos" json:"task_infos,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Offer_Operation_Launch) Reset() { *m = Offer_Operation_Launch{} } func (*Offer_Operation_Launch) ProtoMessage() {} func (m *Offer_Operation_Launch) GetTaskInfos() []*TaskInfo { if m != nil { return m.TaskInfos } return nil } type Offer_Operation_Reserve struct { Resources []*Resource `protobuf:"bytes,1,rep,name=resources" json:"resources,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Offer_Operation_Reserve) Reset() { *m = Offer_Operation_Reserve{} } func (*Offer_Operation_Reserve) ProtoMessage() {} func (m *Offer_Operation_Reserve) GetResources() []*Resource { if m != nil { return m.Resources } return nil } type Offer_Operation_Unreserve struct { Resources []*Resource `protobuf:"bytes,1,rep,name=resources" json:"resources,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Offer_Operation_Unreserve) Reset() { *m = Offer_Operation_Unreserve{} } func (*Offer_Operation_Unreserve) ProtoMessage() {} func (m *Offer_Operation_Unreserve) GetResources() []*Resource { if m != nil { return m.Resources } return nil } type Offer_Operation_Create struct { Volumes []*Resource `protobuf:"bytes,1,rep,name=volumes" json:"volumes,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Offer_Operation_Create) Reset() { *m = Offer_Operation_Create{} } func (*Offer_Operation_Create) ProtoMessage() {} func (m *Offer_Operation_Create) GetVolumes() []*Resource { if m != nil { return m.Volumes } return nil } type Offer_Operation_Destroy struct { Volumes []*Resource `protobuf:"bytes,1,rep,name=volumes" json:"volumes,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Offer_Operation_Destroy) Reset() { *m = Offer_Operation_Destroy{} } func (*Offer_Operation_Destroy) ProtoMessage() {} func (m *Offer_Operation_Destroy) GetVolumes() []*Resource { if m != nil { return m.Volumes } return nil } // * // Describes a task. Passed from the scheduler all the way to an // executor (see SchedulerDriver::launchTasks and // Executor::launchTask). Either ExecutorInfo or CommandInfo should be set. // A different executor can be used to launch this task, and subsequent tasks // meant for the same executor can reuse the same ExecutorInfo struct. type TaskInfo struct { Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` TaskId *TaskID `protobuf:"bytes,2,req,name=task_id" json:"task_id,omitempty"` SlaveId *SlaveID `protobuf:"bytes,3,req,name=slave_id" json:"slave_id,omitempty"` Resources []*Resource `protobuf:"bytes,4,rep,name=resources" json:"resources,omitempty"` Executor *ExecutorInfo `protobuf:"bytes,5,opt,name=executor" json:"executor,omitempty"` Command *CommandInfo `protobuf:"bytes,7,opt,name=command" json:"command,omitempty"` // Task provided with a container will launch the container as part // of this task paired with the task's CommandInfo. Container *ContainerInfo `protobuf:"bytes,9,opt,name=container" json:"container,omitempty"` Data []byte `protobuf:"bytes,6,opt,name=data" json:"data,omitempty"` // A health check for the task (currently in *alpha* and initial // support will only be for TaskInfo's that have a CommandInfo). HealthCheck *HealthCheck `protobuf:"bytes,8,opt,name=health_check" json:"health_check,omitempty"` // Labels are free-form key value pairs which are exposed through // master and slave endpoints. Labels will not be interpreted or // acted upon by Mesos itself. As opposed to the data field, labels // will be kept in memory on master and slave processes. Therefore, // labels should be used to tag tasks with light-weight meta-data. Labels *Labels `protobuf:"bytes,10,opt,name=labels" json:"labels,omitempty"` // Service discovery information for the task. It is not interpreted // or acted upon by Mesos. It is up to a service discovery system // to use this information as needed and to handle tasks without // service discovery information. Discovery *DiscoveryInfo `protobuf:"bytes,11,opt,name=discovery" json:"discovery,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *TaskInfo) Reset() { *m = TaskInfo{} } func (*TaskInfo) ProtoMessage() {} func (m *TaskInfo) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *TaskInfo) GetTaskId() *TaskID { if m != nil { return m.TaskId } return nil } func (m *TaskInfo) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *TaskInfo) GetResources() []*Resource { if m != nil { return m.Resources } return nil } func (m *TaskInfo) GetExecutor() *ExecutorInfo { if m != nil { return m.Executor } return nil } func (m *TaskInfo) GetCommand() *CommandInfo { if m != nil { return m.Command } return nil } func (m *TaskInfo) GetContainer() *ContainerInfo { if m != nil { return m.Container } return nil } func (m *TaskInfo) GetData() []byte { if m != nil { return m.Data } return nil } func (m *TaskInfo) GetHealthCheck() *HealthCheck { if m != nil { return m.HealthCheck } return nil } func (m *TaskInfo) GetLabels() *Labels { if m != nil { return m.Labels } return nil } func (m *TaskInfo) GetDiscovery() *DiscoveryInfo { if m != nil { return m.Discovery } return nil } // * // Describes the current status of a task. type TaskStatus struct { TaskId *TaskID `protobuf:"bytes,1,req,name=task_id" json:"task_id,omitempty"` State *TaskState `protobuf:"varint,2,req,name=state,enum=mesosproto.TaskState" json:"state,omitempty"` Message *string `protobuf:"bytes,4,opt,name=message" json:"message,omitempty"` Source *TaskStatus_Source `protobuf:"varint,9,opt,name=source,enum=mesosproto.TaskStatus_Source" json:"source,omitempty"` Reason *TaskStatus_Reason `protobuf:"varint,10,opt,name=reason,enum=mesosproto.TaskStatus_Reason" json:"reason,omitempty"` Data []byte `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"` SlaveId *SlaveID `protobuf:"bytes,5,opt,name=slave_id" json:"slave_id,omitempty"` ExecutorId *ExecutorID `protobuf:"bytes,7,opt,name=executor_id" json:"executor_id,omitempty"` Timestamp *float64 `protobuf:"fixed64,6,opt,name=timestamp" json:"timestamp,omitempty"` // Statuses that are delivered reliably to the scheduler will // include a 'uuid'. The status is considered delivered once // it is acknowledged by the scheduler. Schedulers can choose // to either explicitly acknowledge statuses or let the scheduler // driver implicitly acknowledge (default). // // TODO(bmahler): This is currently overwritten in the scheduler // driver and executor driver, but executors will need to set this // to a valid RFC-4122 UUID if using the HTTP API. Uuid []byte `protobuf:"bytes,11,opt,name=uuid" json:"uuid,omitempty"` // Describes whether the task has been determined to be healthy // (true) or unhealthy (false) according to the HealthCheck field in // the command info. Healthy *bool `protobuf:"varint,8,opt,name=healthy" json:"healthy,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *TaskStatus) Reset() { *m = TaskStatus{} } func (*TaskStatus) ProtoMessage() {} func (m *TaskStatus) GetTaskId() *TaskID { if m != nil { return m.TaskId } return nil } func (m *TaskStatus) GetState() TaskState { if m != nil && m.State != nil { return *m.State } return TaskState_TASK_STAGING } func (m *TaskStatus) GetMessage() string { if m != nil && m.Message != nil { return *m.Message } return "" } func (m *TaskStatus) GetSource() TaskStatus_Source { if m != nil && m.Source != nil { return *m.Source } return TaskStatus_SOURCE_MASTER } func (m *TaskStatus) GetReason() TaskStatus_Reason { if m != nil && m.Reason != nil { return *m.Reason } return TaskStatus_REASON_COMMAND_EXECUTOR_FAILED } func (m *TaskStatus) GetData() []byte { if m != nil { return m.Data } return nil } func (m *TaskStatus) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *TaskStatus) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *TaskStatus) GetTimestamp() float64 { if m != nil && m.Timestamp != nil { return *m.Timestamp } return 0 } func (m *TaskStatus) GetUuid() []byte { if m != nil { return m.Uuid } return nil } func (m *TaskStatus) GetHealthy() bool { if m != nil && m.Healthy != nil { return *m.Healthy } return false } // * // Describes possible filters that can be applied to unused resources // (see SchedulerDriver::launchTasks) to influence the allocator. type Filters struct { // Time to consider unused resources refused. Note that all unused // resources will be considered refused and use the default value // (below) regardless of whether Filters was passed to // SchedulerDriver::launchTasks. You MUST pass Filters with this // field set to change this behavior (i.e., get another offer which // includes unused resources sooner or later than the default). RefuseSeconds *float64 `protobuf:"fixed64,1,opt,name=refuse_seconds,def=5" json:"refuse_seconds,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Filters) Reset() { *m = Filters{} } func (*Filters) ProtoMessage() {} const Default_Filters_RefuseSeconds float64 = 5 func (m *Filters) GetRefuseSeconds() float64 { if m != nil && m.RefuseSeconds != nil { return *m.RefuseSeconds } return Default_Filters_RefuseSeconds } // * // Describes a collection of environment variables. This is used with // CommandInfo in order to set environment variables before running a // command. type Environment struct { Variables []*Environment_Variable `protobuf:"bytes,1,rep,name=variables" json:"variables,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Environment) Reset() { *m = Environment{} } func (*Environment) ProtoMessage() {} func (m *Environment) GetVariables() []*Environment_Variable { if m != nil { return m.Variables } return nil } type Environment_Variable struct { Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Environment_Variable) Reset() { *m = Environment_Variable{} } func (*Environment_Variable) ProtoMessage() {} func (m *Environment_Variable) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *Environment_Variable) GetValue() string { if m != nil && m.Value != nil { return *m.Value } return "" } // * // A generic (key, value) pair used in various places for parameters. type Parameter struct { Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Parameter) Reset() { *m = Parameter{} } func (*Parameter) ProtoMessage() {} func (m *Parameter) GetKey() string { if m != nil && m.Key != nil { return *m.Key } return "" } func (m *Parameter) GetValue() string { if m != nil && m.Value != nil { return *m.Value } return "" } // * // Collection of Parameter. type Parameters struct { Parameter []*Parameter `protobuf:"bytes,1,rep,name=parameter" json:"parameter,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Parameters) Reset() { *m = Parameters{} } func (*Parameters) ProtoMessage() {} func (m *Parameters) GetParameter() []*Parameter { if m != nil { return m.Parameter } return nil } // * // Credential used in various places for authentication and // authorization. // // NOTE: A 'principal' is different from 'FrameworkInfo.user'. The // former is used for authentication and authorization while the // latter is used to determine the default user under which the // framework's executors/tasks are run. type Credential struct { Principal *string `protobuf:"bytes,1,req,name=principal" json:"principal,omitempty"` Secret []byte `protobuf:"bytes,2,opt,name=secret" json:"secret,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Credential) Reset() { *m = Credential{} } func (*Credential) ProtoMessage() {} func (m *Credential) GetPrincipal() string { if m != nil && m.Principal != nil { return *m.Principal } return "" } func (m *Credential) GetSecret() []byte { if m != nil { return m.Secret } return nil } // * // Credentials used for framework authentication, HTTP authentication // (where the common 'username' and 'password' are captured as // 'principal' and 'secret' respectively), etc. type Credentials struct { Credentials []*Credential `protobuf:"bytes,1,rep,name=credentials" json:"credentials,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Credentials) Reset() { *m = Credentials{} } func (*Credentials) ProtoMessage() {} func (m *Credentials) GetCredentials() []*Credential { if m != nil { return m.Credentials } return nil } // * // ACLs used for authorization. type ACL struct { XXX_unrecognized []byte `json:"-"` } func (m *ACL) Reset() { *m = ACL{} } func (*ACL) ProtoMessage() {} // Entity is used to describe a subject(s) or an object(s) of an ACL. // NOTE: // To allow everyone access to an Entity set its type to 'ANY'. // To deny access to an Entity set its type to 'NONE'. type ACL_Entity struct { Type *ACL_Entity_Type `protobuf:"varint,1,opt,name=type,enum=mesosproto.ACL_Entity_Type,def=0" json:"type,omitempty"` Values []string `protobuf:"bytes,2,rep,name=values" json:"values,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ACL_Entity) Reset() { *m = ACL_Entity{} } func (*ACL_Entity) ProtoMessage() {} const Default_ACL_Entity_Type ACL_Entity_Type = ACL_Entity_SOME func (m *ACL_Entity) GetType() ACL_Entity_Type { if m != nil && m.Type != nil { return *m.Type } return Default_ACL_Entity_Type } func (m *ACL_Entity) GetValues() []string { if m != nil { return m.Values } return nil } // ACLs. type ACL_RegisterFramework struct { // Subjects. Principals *ACL_Entity `protobuf:"bytes,1,req,name=principals" json:"principals,omitempty"` // Objects. Roles *ACL_Entity `protobuf:"bytes,2,req,name=roles" json:"roles,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ACL_RegisterFramework) Reset() { *m = ACL_RegisterFramework{} } func (*ACL_RegisterFramework) ProtoMessage() {} func (m *ACL_RegisterFramework) GetPrincipals() *ACL_Entity { if m != nil { return m.Principals } return nil } func (m *ACL_RegisterFramework) GetRoles() *ACL_Entity { if m != nil { return m.Roles } return nil } type ACL_RunTask struct { // Subjects. Principals *ACL_Entity `protobuf:"bytes,1,req,name=principals" json:"principals,omitempty"` // Objects. Users *ACL_Entity `protobuf:"bytes,2,req,name=users" json:"users,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ACL_RunTask) Reset() { *m = ACL_RunTask{} } func (*ACL_RunTask) ProtoMessage() {} func (m *ACL_RunTask) GetPrincipals() *ACL_Entity { if m != nil { return m.Principals } return nil } func (m *ACL_RunTask) GetUsers() *ACL_Entity { if m != nil { return m.Users } return nil } // Which principals are authorized to shutdown frameworks of other // principals. type ACL_ShutdownFramework struct { // Subjects. Principals *ACL_Entity `protobuf:"bytes,1,req,name=principals" json:"principals,omitempty"` // Objects. FrameworkPrincipals *ACL_Entity `protobuf:"bytes,2,req,name=framework_principals" json:"framework_principals,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ACL_ShutdownFramework) Reset() { *m = ACL_ShutdownFramework{} } func (*ACL_ShutdownFramework) ProtoMessage() {} func (m *ACL_ShutdownFramework) GetPrincipals() *ACL_Entity { if m != nil { return m.Principals } return nil } func (m *ACL_ShutdownFramework) GetFrameworkPrincipals() *ACL_Entity { if m != nil { return m.FrameworkPrincipals } return nil } // * // Collection of ACL. // // Each authorization request is evaluated against the ACLs in the order // they are defined. // // For simplicity, the ACLs for a given action are not aggregated even // when they have the same subjects or objects. The first ACL that // matches the request determines whether that request should be // permitted or not. An ACL matches iff both the subjects // (e.g., clients, principals) and the objects (e.g., urls, users, // roles) of the ACL match the request. // // If none of the ACLs match the request, the 'permissive' field // determines whether the request should be permitted or not. // // TODO(vinod): Do aggregation of ACLs when possible. // type ACLs struct { Permissive *bool `protobuf:"varint,1,opt,name=permissive,def=1" json:"permissive,omitempty"` RegisterFrameworks []*ACL_RegisterFramework `protobuf:"bytes,2,rep,name=register_frameworks" json:"register_frameworks,omitempty"` RunTasks []*ACL_RunTask `protobuf:"bytes,3,rep,name=run_tasks" json:"run_tasks,omitempty"` ShutdownFrameworks []*ACL_ShutdownFramework `protobuf:"bytes,4,rep,name=shutdown_frameworks" json:"shutdown_frameworks,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ACLs) Reset() { *m = ACLs{} } func (*ACLs) ProtoMessage() {} const Default_ACLs_Permissive bool = true func (m *ACLs) GetPermissive() bool { if m != nil && m.Permissive != nil { return *m.Permissive } return Default_ACLs_Permissive } func (m *ACLs) GetRegisterFrameworks() []*ACL_RegisterFramework { if m != nil { return m.RegisterFrameworks } return nil } func (m *ACLs) GetRunTasks() []*ACL_RunTask { if m != nil { return m.RunTasks } return nil } func (m *ACLs) GetShutdownFrameworks() []*ACL_ShutdownFramework { if m != nil { return m.ShutdownFrameworks } return nil } // * // Rate (queries per second, QPS) limit for messages from a framework to master. // Strictly speaking they are the combined rate from all frameworks of the same // principal. type RateLimit struct { // Leaving QPS unset gives it unlimited rate (i.e., not throttled), // which also implies unlimited capacity. Qps *float64 `protobuf:"fixed64,1,opt,name=qps" json:"qps,omitempty"` // Principal of framework(s) to be throttled. Should match // FrameworkInfo.princpal and Credential.principal (if using authentication). Principal *string `protobuf:"bytes,2,req,name=principal" json:"principal,omitempty"` // Max number of outstanding messages from frameworks of this principal // allowed by master before the next message is dropped and an error is sent // back to the sender. Messages received before the capacity is reached are // still going to be processed after the error is sent. // If unspecified, this principal is assigned unlimited capacity. // NOTE: This value is ignored if 'qps' is not set. Capacity *uint64 `protobuf:"varint,3,opt,name=capacity" json:"capacity,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *RateLimit) Reset() { *m = RateLimit{} } func (*RateLimit) ProtoMessage() {} func (m *RateLimit) GetQps() float64 { if m != nil && m.Qps != nil { return *m.Qps } return 0 } func (m *RateLimit) GetPrincipal() string { if m != nil && m.Principal != nil { return *m.Principal } return "" } func (m *RateLimit) GetCapacity() uint64 { if m != nil && m.Capacity != nil { return *m.Capacity } return 0 } // * // Collection of RateLimit. // Frameworks without rate limits defined here are not throttled unless // 'aggregate_default_qps' is specified. type RateLimits struct { // Items should have unique principals. Limits []*RateLimit `protobuf:"bytes,1,rep,name=limits" json:"limits,omitempty"` // All the frameworks not specified in 'limits' get this default rate. // This rate is an aggregate rate for all of them, i.e., their combined // traffic is throttled together at this rate. AggregateDefaultQps *float64 `protobuf:"fixed64,2,opt,name=aggregate_default_qps" json:"aggregate_default_qps,omitempty"` // All the frameworks not specified in 'limits' get this default capacity. // This is an aggregate value similar to 'aggregate_default_qps'. AggregateDefaultCapacity *uint64 `protobuf:"varint,3,opt,name=aggregate_default_capacity" json:"aggregate_default_capacity,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *RateLimits) Reset() { *m = RateLimits{} } func (*RateLimits) ProtoMessage() {} func (m *RateLimits) GetLimits() []*RateLimit { if m != nil { return m.Limits } return nil } func (m *RateLimits) GetAggregateDefaultQps() float64 { if m != nil && m.AggregateDefaultQps != nil { return *m.AggregateDefaultQps } return 0 } func (m *RateLimits) GetAggregateDefaultCapacity() uint64 { if m != nil && m.AggregateDefaultCapacity != nil { return *m.AggregateDefaultCapacity } return 0 } // * // Describes a volume mapping either from host to container or vice // versa. Both paths can either refer to a directory or a file. type Volume struct { // Absolute path pointing to a directory or file in the container. ContainerPath *string `protobuf:"bytes,1,req,name=container_path" json:"container_path,omitempty"` // Absolute path pointing to a directory or file on the host or a path // relative to the container work directory. HostPath *string `protobuf:"bytes,2,opt,name=host_path" json:"host_path,omitempty"` Mode *Volume_Mode `protobuf:"varint,3,req,name=mode,enum=mesosproto.Volume_Mode" json:"mode,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Volume) Reset() { *m = Volume{} } func (*Volume) ProtoMessage() {} func (m *Volume) GetContainerPath() string { if m != nil && m.ContainerPath != nil { return *m.ContainerPath } return "" } func (m *Volume) GetHostPath() string { if m != nil && m.HostPath != nil { return *m.HostPath } return "" } func (m *Volume) GetMode() Volume_Mode { if m != nil && m.Mode != nil { return *m.Mode } return Volume_RW } // * // Describes a container configuration and allows extensible // configurations for different container implementations. type ContainerInfo struct { Type *ContainerInfo_Type `protobuf:"varint,1,req,name=type,enum=mesosproto.ContainerInfo_Type" json:"type,omitempty"` Volumes []*Volume `protobuf:"bytes,2,rep,name=volumes" json:"volumes,omitempty"` Hostname *string `protobuf:"bytes,4,opt,name=hostname" json:"hostname,omitempty"` Docker *ContainerInfo_DockerInfo `protobuf:"bytes,3,opt,name=docker" json:"docker,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ContainerInfo) Reset() { *m = ContainerInfo{} } func (*ContainerInfo) ProtoMessage() {} func (m *ContainerInfo) GetType() ContainerInfo_Type { if m != nil && m.Type != nil { return *m.Type } return ContainerInfo_DOCKER } func (m *ContainerInfo) GetVolumes() []*Volume { if m != nil { return m.Volumes } return nil } func (m *ContainerInfo) GetHostname() string { if m != nil && m.Hostname != nil { return *m.Hostname } return "" } func (m *ContainerInfo) GetDocker() *ContainerInfo_DockerInfo { if m != nil { return m.Docker } return nil } type ContainerInfo_DockerInfo struct { // The docker image that is going to be passed to the registry. Image *string `protobuf:"bytes,1,req,name=image" json:"image,omitempty"` Network *ContainerInfo_DockerInfo_Network `protobuf:"varint,2,opt,name=network,enum=mesosproto.ContainerInfo_DockerInfo_Network,def=1" json:"network,omitempty"` PortMappings []*ContainerInfo_DockerInfo_PortMapping `protobuf:"bytes,3,rep,name=port_mappings" json:"port_mappings,omitempty"` Privileged *bool `protobuf:"varint,4,opt,name=privileged,def=0" json:"privileged,omitempty"` // Allowing arbitrary parameters to be passed to docker CLI. // Note that anything passed to this field is not guaranteed // to be supported moving forward, as we might move away from // the docker CLI. Parameters []*Parameter `protobuf:"bytes,5,rep,name=parameters" json:"parameters,omitempty"` // With this flag set to true, the docker containerizer will // pull the docker image from the registry even if the image // is already downloaded on the slave. ForcePullImage *bool `protobuf:"varint,6,opt,name=force_pull_image" json:"force_pull_image,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ContainerInfo_DockerInfo) Reset() { *m = ContainerInfo_DockerInfo{} } func (*ContainerInfo_DockerInfo) ProtoMessage() {} const Default_ContainerInfo_DockerInfo_Network ContainerInfo_DockerInfo_Network = ContainerInfo_DockerInfo_HOST const Default_ContainerInfo_DockerInfo_Privileged bool = false func (m *ContainerInfo_DockerInfo) GetImage() string { if m != nil && m.Image != nil { return *m.Image } return "" } func (m *ContainerInfo_DockerInfo) GetNetwork() ContainerInfo_DockerInfo_Network { if m != nil && m.Network != nil { return *m.Network } return Default_ContainerInfo_DockerInfo_Network } func (m *ContainerInfo_DockerInfo) GetPortMappings() []*ContainerInfo_DockerInfo_PortMapping { if m != nil { return m.PortMappings } return nil } func (m *ContainerInfo_DockerInfo) GetPrivileged() bool { if m != nil && m.Privileged != nil { return *m.Privileged } return Default_ContainerInfo_DockerInfo_Privileged } func (m *ContainerInfo_DockerInfo) GetParameters() []*Parameter { if m != nil { return m.Parameters } return nil } func (m *ContainerInfo_DockerInfo) GetForcePullImage() bool { if m != nil && m.ForcePullImage != nil { return *m.ForcePullImage } return false } type ContainerInfo_DockerInfo_PortMapping struct { HostPort *uint32 `protobuf:"varint,1,req,name=host_port" json:"host_port,omitempty"` ContainerPort *uint32 `protobuf:"varint,2,req,name=container_port" json:"container_port,omitempty"` // Protocol to expose as (ie: tcp, udp). Protocol *string `protobuf:"bytes,3,opt,name=protocol" json:"protocol,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ContainerInfo_DockerInfo_PortMapping) Reset() { *m = ContainerInfo_DockerInfo_PortMapping{} } func (*ContainerInfo_DockerInfo_PortMapping) ProtoMessage() {} func (m *ContainerInfo_DockerInfo_PortMapping) GetHostPort() uint32 { if m != nil && m.HostPort != nil { return *m.HostPort } return 0 } func (m *ContainerInfo_DockerInfo_PortMapping) GetContainerPort() uint32 { if m != nil && m.ContainerPort != nil { return *m.ContainerPort } return 0 } func (m *ContainerInfo_DockerInfo_PortMapping) GetProtocol() string { if m != nil && m.Protocol != nil { return *m.Protocol } return "" } // * // Collection of labels. type Labels struct { Labels []*Label `protobuf:"bytes,1,rep,name=labels" json:"labels,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Labels) Reset() { *m = Labels{} } func (*Labels) ProtoMessage() {} func (m *Labels) GetLabels() []*Label { if m != nil { return m.Labels } return nil } // * // Key, value pair used to store free form user-data. type Label struct { Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Label) Reset() { *m = Label{} } func (*Label) ProtoMessage() {} func (m *Label) GetKey() string { if m != nil && m.Key != nil { return *m.Key } return "" } func (m *Label) GetValue() string { if m != nil && m.Value != nil { return *m.Value } return "" } // * // Named port used for service discovery. type Port struct { Number *uint32 `protobuf:"varint,1,req,name=number" json:"number,omitempty"` Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` Protocol *string `protobuf:"bytes,3,opt,name=protocol" json:"protocol,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Port) Reset() { *m = Port{} } func (*Port) ProtoMessage() {} func (m *Port) GetNumber() uint32 { if m != nil && m.Number != nil { return *m.Number } return 0 } func (m *Port) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *Port) GetProtocol() string { if m != nil && m.Protocol != nil { return *m.Protocol } return "" } // * // Collection of ports. type Ports struct { Ports []*Port `protobuf:"bytes,1,rep,name=ports" json:"ports,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Ports) Reset() { *m = Ports{} } func (*Ports) ProtoMessage() {} func (m *Ports) GetPorts() []*Port { if m != nil { return m.Ports } return nil } // * // Service discovery information. // The visibility field restricts discovery within a framework // (FRAMEWORK), within a Mesos cluster (CLUSTER), or places no // restrictions (EXTERNAL). // The environment, location, and version fields provide first class // support for common attributes used to differentiate between // similar services. The environment may receive values such as // PROD/QA/DEV, the location field may receive values like // EAST-US/WEST-US/EUROPE/AMEA, and the version field may receive // values like v2.0/v0.9. The exact use of these fields is up to each // service discovery system. type DiscoveryInfo struct { Visibility *DiscoveryInfo_Visibility `protobuf:"varint,1,req,name=visibility,enum=mesosproto.DiscoveryInfo_Visibility" json:"visibility,omitempty"` Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` Environment *string `protobuf:"bytes,3,opt,name=environment" json:"environment,omitempty"` Location *string `protobuf:"bytes,4,opt,name=location" json:"location,omitempty"` Version *string `protobuf:"bytes,5,opt,name=version" json:"version,omitempty"` Ports *Ports `protobuf:"bytes,6,opt,name=ports" json:"ports,omitempty"` Labels *Labels `protobuf:"bytes,7,opt,name=labels" json:"labels,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *DiscoveryInfo) Reset() { *m = DiscoveryInfo{} } func (*DiscoveryInfo) ProtoMessage() {} func (m *DiscoveryInfo) GetVisibility() DiscoveryInfo_Visibility { if m != nil && m.Visibility != nil { return *m.Visibility } return DiscoveryInfo_FRAMEWORK } func (m *DiscoveryInfo) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *DiscoveryInfo) GetEnvironment() string { if m != nil && m.Environment != nil { return *m.Environment } return "" } func (m *DiscoveryInfo) GetLocation() string { if m != nil && m.Location != nil { return *m.Location } return "" } func (m *DiscoveryInfo) GetVersion() string { if m != nil && m.Version != nil { return *m.Version } return "" } func (m *DiscoveryInfo) GetPorts() *Ports { if m != nil { return m.Ports } return nil } func (m *DiscoveryInfo) GetLabels() *Labels { if m != nil { return m.Labels } return nil } func init() { proto.RegisterEnum("mesosproto.Status", Status_name, Status_value) proto.RegisterEnum("mesosproto.TaskState", TaskState_name, TaskState_value) proto.RegisterEnum("mesosproto.FrameworkInfo_Capability_Type", FrameworkInfo_Capability_Type_name, FrameworkInfo_Capability_Type_value) proto.RegisterEnum("mesosproto.Value_Type", Value_Type_name, Value_Type_value) proto.RegisterEnum("mesosproto.Offer_Operation_Type", Offer_Operation_Type_name, Offer_Operation_Type_value) proto.RegisterEnum("mesosproto.TaskStatus_Source", TaskStatus_Source_name, TaskStatus_Source_value) proto.RegisterEnum("mesosproto.TaskStatus_Reason", TaskStatus_Reason_name, TaskStatus_Reason_value) proto.RegisterEnum("mesosproto.ACL_Entity_Type", ACL_Entity_Type_name, ACL_Entity_Type_value) proto.RegisterEnum("mesosproto.Volume_Mode", Volume_Mode_name, Volume_Mode_value) proto.RegisterEnum("mesosproto.ContainerInfo_Type", ContainerInfo_Type_name, ContainerInfo_Type_value) proto.RegisterEnum("mesosproto.ContainerInfo_DockerInfo_Network", ContainerInfo_DockerInfo_Network_name, ContainerInfo_DockerInfo_Network_value) proto.RegisterEnum("mesosproto.DiscoveryInfo_Visibility", DiscoveryInfo_Visibility_name, DiscoveryInfo_Visibility_value) } func (this *FrameworkID) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*FrameworkID) if !ok { return fmt.Errorf("that is not of type *FrameworkID") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *FrameworkID but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *FrameworkIDbut is not nil && this == nil") } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *FrameworkID) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*FrameworkID) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *OfferID) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*OfferID) if !ok { return fmt.Errorf("that is not of type *OfferID") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *OfferID but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *OfferIDbut is not nil && this == nil") } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *OfferID) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*OfferID) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *SlaveID) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*SlaveID) if !ok { return fmt.Errorf("that is not of type *SlaveID") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *SlaveID but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *SlaveIDbut is not nil && this == nil") } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *SlaveID) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*SlaveID) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *TaskID) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*TaskID) if !ok { return fmt.Errorf("that is not of type *TaskID") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *TaskID but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *TaskIDbut is not nil && this == nil") } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *TaskID) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*TaskID) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ExecutorID) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ExecutorID) if !ok { return fmt.Errorf("that is not of type *ExecutorID") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ExecutorID but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ExecutorIDbut is not nil && this == nil") } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ExecutorID) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ExecutorID) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ContainerID) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ContainerID) if !ok { return fmt.Errorf("that is not of type *ContainerID") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ContainerID but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ContainerIDbut is not nil && this == nil") } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ContainerID) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ContainerID) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *FrameworkInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*FrameworkInfo) if !ok { return fmt.Errorf("that is not of type *FrameworkInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *FrameworkInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *FrameworkInfobut is not nil && this == nil") } if this.User != nil && that1.User != nil { if *this.User != *that1.User { return fmt.Errorf("User this(%v) Not Equal that(%v)", *this.User, *that1.User) } } else if this.User != nil { return fmt.Errorf("this.User == nil && that.User != nil") } else if that1.User != nil { return fmt.Errorf("User this(%v) Not Equal that(%v)", this.User, that1.User) } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return fmt.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name) } } else if this.Name != nil { return fmt.Errorf("this.Name == nil && that.Name != nil") } else if that1.Name != nil { return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name) } if !this.Id.Equal(that1.Id) { return fmt.Errorf("Id this(%v) Not Equal that(%v)", this.Id, that1.Id) } if this.FailoverTimeout != nil && that1.FailoverTimeout != nil { if *this.FailoverTimeout != *that1.FailoverTimeout { return fmt.Errorf("FailoverTimeout this(%v) Not Equal that(%v)", *this.FailoverTimeout, *that1.FailoverTimeout) } } else if this.FailoverTimeout != nil { return fmt.Errorf("this.FailoverTimeout == nil && that.FailoverTimeout != nil") } else if that1.FailoverTimeout != nil { return fmt.Errorf("FailoverTimeout this(%v) Not Equal that(%v)", this.FailoverTimeout, that1.FailoverTimeout) } if this.Checkpoint != nil && that1.Checkpoint != nil { if *this.Checkpoint != *that1.Checkpoint { return fmt.Errorf("Checkpoint this(%v) Not Equal that(%v)", *this.Checkpoint, *that1.Checkpoint) } } else if this.Checkpoint != nil { return fmt.Errorf("this.Checkpoint == nil && that.Checkpoint != nil") } else if that1.Checkpoint != nil { return fmt.Errorf("Checkpoint this(%v) Not Equal that(%v)", this.Checkpoint, that1.Checkpoint) } if this.Role != nil && that1.Role != nil { if *this.Role != *that1.Role { return fmt.Errorf("Role this(%v) Not Equal that(%v)", *this.Role, *that1.Role) } } else if this.Role != nil { return fmt.Errorf("this.Role == nil && that.Role != nil") } else if that1.Role != nil { return fmt.Errorf("Role this(%v) Not Equal that(%v)", this.Role, that1.Role) } if this.Hostname != nil && that1.Hostname != nil { if *this.Hostname != *that1.Hostname { return fmt.Errorf("Hostname this(%v) Not Equal that(%v)", *this.Hostname, *that1.Hostname) } } else if this.Hostname != nil { return fmt.Errorf("this.Hostname == nil && that.Hostname != nil") } else if that1.Hostname != nil { return fmt.Errorf("Hostname this(%v) Not Equal that(%v)", this.Hostname, that1.Hostname) } if this.Principal != nil && that1.Principal != nil { if *this.Principal != *that1.Principal { return fmt.Errorf("Principal this(%v) Not Equal that(%v)", *this.Principal, *that1.Principal) } } else if this.Principal != nil { return fmt.Errorf("this.Principal == nil && that.Principal != nil") } else if that1.Principal != nil { return fmt.Errorf("Principal this(%v) Not Equal that(%v)", this.Principal, that1.Principal) } if this.WebuiUrl != nil && that1.WebuiUrl != nil { if *this.WebuiUrl != *that1.WebuiUrl { return fmt.Errorf("WebuiUrl this(%v) Not Equal that(%v)", *this.WebuiUrl, *that1.WebuiUrl) } } else if this.WebuiUrl != nil { return fmt.Errorf("this.WebuiUrl == nil && that.WebuiUrl != nil") } else if that1.WebuiUrl != nil { return fmt.Errorf("WebuiUrl this(%v) Not Equal that(%v)", this.WebuiUrl, that1.WebuiUrl) } if len(this.Capabilities) != len(that1.Capabilities) { return fmt.Errorf("Capabilities this(%v) Not Equal that(%v)", len(this.Capabilities), len(that1.Capabilities)) } for i := range this.Capabilities { if !this.Capabilities[i].Equal(that1.Capabilities[i]) { return fmt.Errorf("Capabilities this[%v](%v) Not Equal that[%v](%v)", i, this.Capabilities[i], i, that1.Capabilities[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *FrameworkInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*FrameworkInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.User != nil && that1.User != nil { if *this.User != *that1.User { return false } } else if this.User != nil { return false } else if that1.User != nil { return false } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return false } } else if this.Name != nil { return false } else if that1.Name != nil { return false } if !this.Id.Equal(that1.Id) { return false } if this.FailoverTimeout != nil && that1.FailoverTimeout != nil { if *this.FailoverTimeout != *that1.FailoverTimeout { return false } } else if this.FailoverTimeout != nil { return false } else if that1.FailoverTimeout != nil { return false } if this.Checkpoint != nil && that1.Checkpoint != nil { if *this.Checkpoint != *that1.Checkpoint { return false } } else if this.Checkpoint != nil { return false } else if that1.Checkpoint != nil { return false } if this.Role != nil && that1.Role != nil { if *this.Role != *that1.Role { return false } } else if this.Role != nil { return false } else if that1.Role != nil { return false } if this.Hostname != nil && that1.Hostname != nil { if *this.Hostname != *that1.Hostname { return false } } else if this.Hostname != nil { return false } else if that1.Hostname != nil { return false } if this.Principal != nil && that1.Principal != nil { if *this.Principal != *that1.Principal { return false } } else if this.Principal != nil { return false } else if that1.Principal != nil { return false } if this.WebuiUrl != nil && that1.WebuiUrl != nil { if *this.WebuiUrl != *that1.WebuiUrl { return false } } else if this.WebuiUrl != nil { return false } else if that1.WebuiUrl != nil { return false } if len(this.Capabilities) != len(that1.Capabilities) { return false } for i := range this.Capabilities { if !this.Capabilities[i].Equal(that1.Capabilities[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *FrameworkInfo_Capability) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*FrameworkInfo_Capability) if !ok { return fmt.Errorf("that is not of type *FrameworkInfo_Capability") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *FrameworkInfo_Capability but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *FrameworkInfo_Capabilitybut is not nil && this == nil") } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return fmt.Errorf("Type this(%v) Not Equal that(%v)", *this.Type, *that1.Type) } } else if this.Type != nil { return fmt.Errorf("this.Type == nil && that.Type != nil") } else if that1.Type != nil { return fmt.Errorf("Type this(%v) Not Equal that(%v)", this.Type, that1.Type) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *FrameworkInfo_Capability) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*FrameworkInfo_Capability) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return false } } else if this.Type != nil { return false } else if that1.Type != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *HealthCheck) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*HealthCheck) if !ok { return fmt.Errorf("that is not of type *HealthCheck") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *HealthCheck but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *HealthCheckbut is not nil && this == nil") } if !this.Http.Equal(that1.Http) { return fmt.Errorf("Http this(%v) Not Equal that(%v)", this.Http, that1.Http) } if this.DelaySeconds != nil && that1.DelaySeconds != nil { if *this.DelaySeconds != *that1.DelaySeconds { return fmt.Errorf("DelaySeconds this(%v) Not Equal that(%v)", *this.DelaySeconds, *that1.DelaySeconds) } } else if this.DelaySeconds != nil { return fmt.Errorf("this.DelaySeconds == nil && that.DelaySeconds != nil") } else if that1.DelaySeconds != nil { return fmt.Errorf("DelaySeconds this(%v) Not Equal that(%v)", this.DelaySeconds, that1.DelaySeconds) } if this.IntervalSeconds != nil && that1.IntervalSeconds != nil { if *this.IntervalSeconds != *that1.IntervalSeconds { return fmt.Errorf("IntervalSeconds this(%v) Not Equal that(%v)", *this.IntervalSeconds, *that1.IntervalSeconds) } } else if this.IntervalSeconds != nil { return fmt.Errorf("this.IntervalSeconds == nil && that.IntervalSeconds != nil") } else if that1.IntervalSeconds != nil { return fmt.Errorf("IntervalSeconds this(%v) Not Equal that(%v)", this.IntervalSeconds, that1.IntervalSeconds) } if this.TimeoutSeconds != nil && that1.TimeoutSeconds != nil { if *this.TimeoutSeconds != *that1.TimeoutSeconds { return fmt.Errorf("TimeoutSeconds this(%v) Not Equal that(%v)", *this.TimeoutSeconds, *that1.TimeoutSeconds) } } else if this.TimeoutSeconds != nil { return fmt.Errorf("this.TimeoutSeconds == nil && that.TimeoutSeconds != nil") } else if that1.TimeoutSeconds != nil { return fmt.Errorf("TimeoutSeconds this(%v) Not Equal that(%v)", this.TimeoutSeconds, that1.TimeoutSeconds) } if this.ConsecutiveFailures != nil && that1.ConsecutiveFailures != nil { if *this.ConsecutiveFailures != *that1.ConsecutiveFailures { return fmt.Errorf("ConsecutiveFailures this(%v) Not Equal that(%v)", *this.ConsecutiveFailures, *that1.ConsecutiveFailures) } } else if this.ConsecutiveFailures != nil { return fmt.Errorf("this.ConsecutiveFailures == nil && that.ConsecutiveFailures != nil") } else if that1.ConsecutiveFailures != nil { return fmt.Errorf("ConsecutiveFailures this(%v) Not Equal that(%v)", this.ConsecutiveFailures, that1.ConsecutiveFailures) } if this.GracePeriodSeconds != nil && that1.GracePeriodSeconds != nil { if *this.GracePeriodSeconds != *that1.GracePeriodSeconds { return fmt.Errorf("GracePeriodSeconds this(%v) Not Equal that(%v)", *this.GracePeriodSeconds, *that1.GracePeriodSeconds) } } else if this.GracePeriodSeconds != nil { return fmt.Errorf("this.GracePeriodSeconds == nil && that.GracePeriodSeconds != nil") } else if that1.GracePeriodSeconds != nil { return fmt.Errorf("GracePeriodSeconds this(%v) Not Equal that(%v)", this.GracePeriodSeconds, that1.GracePeriodSeconds) } if !this.Command.Equal(that1.Command) { return fmt.Errorf("Command this(%v) Not Equal that(%v)", this.Command, that1.Command) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *HealthCheck) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*HealthCheck) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.Http.Equal(that1.Http) { return false } if this.DelaySeconds != nil && that1.DelaySeconds != nil { if *this.DelaySeconds != *that1.DelaySeconds { return false } } else if this.DelaySeconds != nil { return false } else if that1.DelaySeconds != nil { return false } if this.IntervalSeconds != nil && that1.IntervalSeconds != nil { if *this.IntervalSeconds != *that1.IntervalSeconds { return false } } else if this.IntervalSeconds != nil { return false } else if that1.IntervalSeconds != nil { return false } if this.TimeoutSeconds != nil && that1.TimeoutSeconds != nil { if *this.TimeoutSeconds != *that1.TimeoutSeconds { return false } } else if this.TimeoutSeconds != nil { return false } else if that1.TimeoutSeconds != nil { return false } if this.ConsecutiveFailures != nil && that1.ConsecutiveFailures != nil { if *this.ConsecutiveFailures != *that1.ConsecutiveFailures { return false } } else if this.ConsecutiveFailures != nil { return false } else if that1.ConsecutiveFailures != nil { return false } if this.GracePeriodSeconds != nil && that1.GracePeriodSeconds != nil { if *this.GracePeriodSeconds != *that1.GracePeriodSeconds { return false } } else if this.GracePeriodSeconds != nil { return false } else if that1.GracePeriodSeconds != nil { return false } if !this.Command.Equal(that1.Command) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *HealthCheck_HTTP) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*HealthCheck_HTTP) if !ok { return fmt.Errorf("that is not of type *HealthCheck_HTTP") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *HealthCheck_HTTP but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *HealthCheck_HTTPbut is not nil && this == nil") } if this.Port != nil && that1.Port != nil { if *this.Port != *that1.Port { return fmt.Errorf("Port this(%v) Not Equal that(%v)", *this.Port, *that1.Port) } } else if this.Port != nil { return fmt.Errorf("this.Port == nil && that.Port != nil") } else if that1.Port != nil { return fmt.Errorf("Port this(%v) Not Equal that(%v)", this.Port, that1.Port) } if this.Path != nil && that1.Path != nil { if *this.Path != *that1.Path { return fmt.Errorf("Path this(%v) Not Equal that(%v)", *this.Path, *that1.Path) } } else if this.Path != nil { return fmt.Errorf("this.Path == nil && that.Path != nil") } else if that1.Path != nil { return fmt.Errorf("Path this(%v) Not Equal that(%v)", this.Path, that1.Path) } if len(this.Statuses) != len(that1.Statuses) { return fmt.Errorf("Statuses this(%v) Not Equal that(%v)", len(this.Statuses), len(that1.Statuses)) } for i := range this.Statuses { if this.Statuses[i] != that1.Statuses[i] { return fmt.Errorf("Statuses this[%v](%v) Not Equal that[%v](%v)", i, this.Statuses[i], i, that1.Statuses[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *HealthCheck_HTTP) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*HealthCheck_HTTP) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Port != nil && that1.Port != nil { if *this.Port != *that1.Port { return false } } else if this.Port != nil { return false } else if that1.Port != nil { return false } if this.Path != nil && that1.Path != nil { if *this.Path != *that1.Path { return false } } else if this.Path != nil { return false } else if that1.Path != nil { return false } if len(this.Statuses) != len(that1.Statuses) { return false } for i := range this.Statuses { if this.Statuses[i] != that1.Statuses[i] { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *CommandInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*CommandInfo) if !ok { return fmt.Errorf("that is not of type *CommandInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *CommandInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *CommandInfobut is not nil && this == nil") } if !this.Container.Equal(that1.Container) { return fmt.Errorf("Container this(%v) Not Equal that(%v)", this.Container, that1.Container) } if len(this.Uris) != len(that1.Uris) { return fmt.Errorf("Uris this(%v) Not Equal that(%v)", len(this.Uris), len(that1.Uris)) } for i := range this.Uris { if !this.Uris[i].Equal(that1.Uris[i]) { return fmt.Errorf("Uris this[%v](%v) Not Equal that[%v](%v)", i, this.Uris[i], i, that1.Uris[i]) } } if !this.Environment.Equal(that1.Environment) { return fmt.Errorf("Environment this(%v) Not Equal that(%v)", this.Environment, that1.Environment) } if this.Shell != nil && that1.Shell != nil { if *this.Shell != *that1.Shell { return fmt.Errorf("Shell this(%v) Not Equal that(%v)", *this.Shell, *that1.Shell) } } else if this.Shell != nil { return fmt.Errorf("this.Shell == nil && that.Shell != nil") } else if that1.Shell != nil { return fmt.Errorf("Shell this(%v) Not Equal that(%v)", this.Shell, that1.Shell) } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if len(this.Arguments) != len(that1.Arguments) { return fmt.Errorf("Arguments this(%v) Not Equal that(%v)", len(this.Arguments), len(that1.Arguments)) } for i := range this.Arguments { if this.Arguments[i] != that1.Arguments[i] { return fmt.Errorf("Arguments this[%v](%v) Not Equal that[%v](%v)", i, this.Arguments[i], i, that1.Arguments[i]) } } if this.User != nil && that1.User != nil { if *this.User != *that1.User { return fmt.Errorf("User this(%v) Not Equal that(%v)", *this.User, *that1.User) } } else if this.User != nil { return fmt.Errorf("this.User == nil && that.User != nil") } else if that1.User != nil { return fmt.Errorf("User this(%v) Not Equal that(%v)", this.User, that1.User) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *CommandInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*CommandInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.Container.Equal(that1.Container) { return false } if len(this.Uris) != len(that1.Uris) { return false } for i := range this.Uris { if !this.Uris[i].Equal(that1.Uris[i]) { return false } } if !this.Environment.Equal(that1.Environment) { return false } if this.Shell != nil && that1.Shell != nil { if *this.Shell != *that1.Shell { return false } } else if this.Shell != nil { return false } else if that1.Shell != nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if len(this.Arguments) != len(that1.Arguments) { return false } for i := range this.Arguments { if this.Arguments[i] != that1.Arguments[i] { return false } } if this.User != nil && that1.User != nil { if *this.User != *that1.User { return false } } else if this.User != nil { return false } else if that1.User != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *CommandInfo_URI) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*CommandInfo_URI) if !ok { return fmt.Errorf("that is not of type *CommandInfo_URI") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *CommandInfo_URI but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *CommandInfo_URIbut is not nil && this == nil") } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if this.Executable != nil && that1.Executable != nil { if *this.Executable != *that1.Executable { return fmt.Errorf("Executable this(%v) Not Equal that(%v)", *this.Executable, *that1.Executable) } } else if this.Executable != nil { return fmt.Errorf("this.Executable == nil && that.Executable != nil") } else if that1.Executable != nil { return fmt.Errorf("Executable this(%v) Not Equal that(%v)", this.Executable, that1.Executable) } if this.Extract != nil && that1.Extract != nil { if *this.Extract != *that1.Extract { return fmt.Errorf("Extract this(%v) Not Equal that(%v)", *this.Extract, *that1.Extract) } } else if this.Extract != nil { return fmt.Errorf("this.Extract == nil && that.Extract != nil") } else if that1.Extract != nil { return fmt.Errorf("Extract this(%v) Not Equal that(%v)", this.Extract, that1.Extract) } if this.Cache != nil && that1.Cache != nil { if *this.Cache != *that1.Cache { return fmt.Errorf("Cache this(%v) Not Equal that(%v)", *this.Cache, *that1.Cache) } } else if this.Cache != nil { return fmt.Errorf("this.Cache == nil && that.Cache != nil") } else if that1.Cache != nil { return fmt.Errorf("Cache this(%v) Not Equal that(%v)", this.Cache, that1.Cache) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *CommandInfo_URI) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*CommandInfo_URI) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if this.Executable != nil && that1.Executable != nil { if *this.Executable != *that1.Executable { return false } } else if this.Executable != nil { return false } else if that1.Executable != nil { return false } if this.Extract != nil && that1.Extract != nil { if *this.Extract != *that1.Extract { return false } } else if this.Extract != nil { return false } else if that1.Extract != nil { return false } if this.Cache != nil && that1.Cache != nil { if *this.Cache != *that1.Cache { return false } } else if this.Cache != nil { return false } else if that1.Cache != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *CommandInfo_ContainerInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*CommandInfo_ContainerInfo) if !ok { return fmt.Errorf("that is not of type *CommandInfo_ContainerInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *CommandInfo_ContainerInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *CommandInfo_ContainerInfobut is not nil && this == nil") } if this.Image != nil && that1.Image != nil { if *this.Image != *that1.Image { return fmt.Errorf("Image this(%v) Not Equal that(%v)", *this.Image, *that1.Image) } } else if this.Image != nil { return fmt.Errorf("this.Image == nil && that.Image != nil") } else if that1.Image != nil { return fmt.Errorf("Image this(%v) Not Equal that(%v)", this.Image, that1.Image) } if len(this.Options) != len(that1.Options) { return fmt.Errorf("Options this(%v) Not Equal that(%v)", len(this.Options), len(that1.Options)) } for i := range this.Options { if this.Options[i] != that1.Options[i] { return fmt.Errorf("Options this[%v](%v) Not Equal that[%v](%v)", i, this.Options[i], i, that1.Options[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *CommandInfo_ContainerInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*CommandInfo_ContainerInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Image != nil && that1.Image != nil { if *this.Image != *that1.Image { return false } } else if this.Image != nil { return false } else if that1.Image != nil { return false } if len(this.Options) != len(that1.Options) { return false } for i := range this.Options { if this.Options[i] != that1.Options[i] { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ExecutorInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ExecutorInfo) if !ok { return fmt.Errorf("that is not of type *ExecutorInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ExecutorInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ExecutorInfobut is not nil && this == nil") } if !this.ExecutorId.Equal(that1.ExecutorId) { return fmt.Errorf("ExecutorId this(%v) Not Equal that(%v)", this.ExecutorId, that1.ExecutorId) } if !this.FrameworkId.Equal(that1.FrameworkId) { return fmt.Errorf("FrameworkId this(%v) Not Equal that(%v)", this.FrameworkId, that1.FrameworkId) } if !this.Command.Equal(that1.Command) { return fmt.Errorf("Command this(%v) Not Equal that(%v)", this.Command, that1.Command) } if !this.Container.Equal(that1.Container) { return fmt.Errorf("Container this(%v) Not Equal that(%v)", this.Container, that1.Container) } if len(this.Resources) != len(that1.Resources) { return fmt.Errorf("Resources this(%v) Not Equal that(%v)", len(this.Resources), len(that1.Resources)) } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return fmt.Errorf("Resources this[%v](%v) Not Equal that[%v](%v)", i, this.Resources[i], i, that1.Resources[i]) } } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return fmt.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name) } } else if this.Name != nil { return fmt.Errorf("this.Name == nil && that.Name != nil") } else if that1.Name != nil { return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name) } if this.Source != nil && that1.Source != nil { if *this.Source != *that1.Source { return fmt.Errorf("Source this(%v) Not Equal that(%v)", *this.Source, *that1.Source) } } else if this.Source != nil { return fmt.Errorf("this.Source == nil && that.Source != nil") } else if that1.Source != nil { return fmt.Errorf("Source this(%v) Not Equal that(%v)", this.Source, that1.Source) } if !bytes.Equal(this.Data, that1.Data) { return fmt.Errorf("Data this(%v) Not Equal that(%v)", this.Data, that1.Data) } if !this.Discovery.Equal(that1.Discovery) { return fmt.Errorf("Discovery this(%v) Not Equal that(%v)", this.Discovery, that1.Discovery) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ExecutorInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ExecutorInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.ExecutorId.Equal(that1.ExecutorId) { return false } if !this.FrameworkId.Equal(that1.FrameworkId) { return false } if !this.Command.Equal(that1.Command) { return false } if !this.Container.Equal(that1.Container) { return false } if len(this.Resources) != len(that1.Resources) { return false } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return false } } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return false } } else if this.Name != nil { return false } else if that1.Name != nil { return false } if this.Source != nil && that1.Source != nil { if *this.Source != *that1.Source { return false } } else if this.Source != nil { return false } else if that1.Source != nil { return false } if !bytes.Equal(this.Data, that1.Data) { return false } if !this.Discovery.Equal(that1.Discovery) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *MasterInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*MasterInfo) if !ok { return fmt.Errorf("that is not of type *MasterInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *MasterInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *MasterInfobut is not nil && this == nil") } if this.Id != nil && that1.Id != nil { if *this.Id != *that1.Id { return fmt.Errorf("Id this(%v) Not Equal that(%v)", *this.Id, *that1.Id) } } else if this.Id != nil { return fmt.Errorf("this.Id == nil && that.Id != nil") } else if that1.Id != nil { return fmt.Errorf("Id this(%v) Not Equal that(%v)", this.Id, that1.Id) } if this.Ip != nil && that1.Ip != nil { if *this.Ip != *that1.Ip { return fmt.Errorf("Ip this(%v) Not Equal that(%v)", *this.Ip, *that1.Ip) } } else if this.Ip != nil { return fmt.Errorf("this.Ip == nil && that.Ip != nil") } else if that1.Ip != nil { return fmt.Errorf("Ip this(%v) Not Equal that(%v)", this.Ip, that1.Ip) } if this.Port != nil && that1.Port != nil { if *this.Port != *that1.Port { return fmt.Errorf("Port this(%v) Not Equal that(%v)", *this.Port, *that1.Port) } } else if this.Port != nil { return fmt.Errorf("this.Port == nil && that.Port != nil") } else if that1.Port != nil { return fmt.Errorf("Port this(%v) Not Equal that(%v)", this.Port, that1.Port) } if this.Pid != nil && that1.Pid != nil { if *this.Pid != *that1.Pid { return fmt.Errorf("Pid this(%v) Not Equal that(%v)", *this.Pid, *that1.Pid) } } else if this.Pid != nil { return fmt.Errorf("this.Pid == nil && that.Pid != nil") } else if that1.Pid != nil { return fmt.Errorf("Pid this(%v) Not Equal that(%v)", this.Pid, that1.Pid) } if this.Hostname != nil && that1.Hostname != nil { if *this.Hostname != *that1.Hostname { return fmt.Errorf("Hostname this(%v) Not Equal that(%v)", *this.Hostname, *that1.Hostname) } } else if this.Hostname != nil { return fmt.Errorf("this.Hostname == nil && that.Hostname != nil") } else if that1.Hostname != nil { return fmt.Errorf("Hostname this(%v) Not Equal that(%v)", this.Hostname, that1.Hostname) } if this.Version != nil && that1.Version != nil { if *this.Version != *that1.Version { return fmt.Errorf("Version this(%v) Not Equal that(%v)", *this.Version, *that1.Version) } } else if this.Version != nil { return fmt.Errorf("this.Version == nil && that.Version != nil") } else if that1.Version != nil { return fmt.Errorf("Version this(%v) Not Equal that(%v)", this.Version, that1.Version) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *MasterInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*MasterInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Id != nil && that1.Id != nil { if *this.Id != *that1.Id { return false } } else if this.Id != nil { return false } else if that1.Id != nil { return false } if this.Ip != nil && that1.Ip != nil { if *this.Ip != *that1.Ip { return false } } else if this.Ip != nil { return false } else if that1.Ip != nil { return false } if this.Port != nil && that1.Port != nil { if *this.Port != *that1.Port { return false } } else if this.Port != nil { return false } else if that1.Port != nil { return false } if this.Pid != nil && that1.Pid != nil { if *this.Pid != *that1.Pid { return false } } else if this.Pid != nil { return false } else if that1.Pid != nil { return false } if this.Hostname != nil && that1.Hostname != nil { if *this.Hostname != *that1.Hostname { return false } } else if this.Hostname != nil { return false } else if that1.Hostname != nil { return false } if this.Version != nil && that1.Version != nil { if *this.Version != *that1.Version { return false } } else if this.Version != nil { return false } else if that1.Version != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *SlaveInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*SlaveInfo) if !ok { return fmt.Errorf("that is not of type *SlaveInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *SlaveInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *SlaveInfobut is not nil && this == nil") } if this.Hostname != nil && that1.Hostname != nil { if *this.Hostname != *that1.Hostname { return fmt.Errorf("Hostname this(%v) Not Equal that(%v)", *this.Hostname, *that1.Hostname) } } else if this.Hostname != nil { return fmt.Errorf("this.Hostname == nil && that.Hostname != nil") } else if that1.Hostname != nil { return fmt.Errorf("Hostname this(%v) Not Equal that(%v)", this.Hostname, that1.Hostname) } if this.Port != nil && that1.Port != nil { if *this.Port != *that1.Port { return fmt.Errorf("Port this(%v) Not Equal that(%v)", *this.Port, *that1.Port) } } else if this.Port != nil { return fmt.Errorf("this.Port == nil && that.Port != nil") } else if that1.Port != nil { return fmt.Errorf("Port this(%v) Not Equal that(%v)", this.Port, that1.Port) } if len(this.Resources) != len(that1.Resources) { return fmt.Errorf("Resources this(%v) Not Equal that(%v)", len(this.Resources), len(that1.Resources)) } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return fmt.Errorf("Resources this[%v](%v) Not Equal that[%v](%v)", i, this.Resources[i], i, that1.Resources[i]) } } if len(this.Attributes) != len(that1.Attributes) { return fmt.Errorf("Attributes this(%v) Not Equal that(%v)", len(this.Attributes), len(that1.Attributes)) } for i := range this.Attributes { if !this.Attributes[i].Equal(that1.Attributes[i]) { return fmt.Errorf("Attributes this[%v](%v) Not Equal that[%v](%v)", i, this.Attributes[i], i, that1.Attributes[i]) } } if !this.Id.Equal(that1.Id) { return fmt.Errorf("Id this(%v) Not Equal that(%v)", this.Id, that1.Id) } if this.Checkpoint != nil && that1.Checkpoint != nil { if *this.Checkpoint != *that1.Checkpoint { return fmt.Errorf("Checkpoint this(%v) Not Equal that(%v)", *this.Checkpoint, *that1.Checkpoint) } } else if this.Checkpoint != nil { return fmt.Errorf("this.Checkpoint == nil && that.Checkpoint != nil") } else if that1.Checkpoint != nil { return fmt.Errorf("Checkpoint this(%v) Not Equal that(%v)", this.Checkpoint, that1.Checkpoint) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *SlaveInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*SlaveInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Hostname != nil && that1.Hostname != nil { if *this.Hostname != *that1.Hostname { return false } } else if this.Hostname != nil { return false } else if that1.Hostname != nil { return false } if this.Port != nil && that1.Port != nil { if *this.Port != *that1.Port { return false } } else if this.Port != nil { return false } else if that1.Port != nil { return false } if len(this.Resources) != len(that1.Resources) { return false } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return false } } if len(this.Attributes) != len(that1.Attributes) { return false } for i := range this.Attributes { if !this.Attributes[i].Equal(that1.Attributes[i]) { return false } } if !this.Id.Equal(that1.Id) { return false } if this.Checkpoint != nil && that1.Checkpoint != nil { if *this.Checkpoint != *that1.Checkpoint { return false } } else if this.Checkpoint != nil { return false } else if that1.Checkpoint != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Value) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Value) if !ok { return fmt.Errorf("that is not of type *Value") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Value but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Valuebut is not nil && this == nil") } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return fmt.Errorf("Type this(%v) Not Equal that(%v)", *this.Type, *that1.Type) } } else if this.Type != nil { return fmt.Errorf("this.Type == nil && that.Type != nil") } else if that1.Type != nil { return fmt.Errorf("Type this(%v) Not Equal that(%v)", this.Type, that1.Type) } if !this.Scalar.Equal(that1.Scalar) { return fmt.Errorf("Scalar this(%v) Not Equal that(%v)", this.Scalar, that1.Scalar) } if !this.Ranges.Equal(that1.Ranges) { return fmt.Errorf("Ranges this(%v) Not Equal that(%v)", this.Ranges, that1.Ranges) } if !this.Set.Equal(that1.Set) { return fmt.Errorf("Set this(%v) Not Equal that(%v)", this.Set, that1.Set) } if !this.Text.Equal(that1.Text) { return fmt.Errorf("Text this(%v) Not Equal that(%v)", this.Text, that1.Text) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Value) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Value) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return false } } else if this.Type != nil { return false } else if that1.Type != nil { return false } if !this.Scalar.Equal(that1.Scalar) { return false } if !this.Ranges.Equal(that1.Ranges) { return false } if !this.Set.Equal(that1.Set) { return false } if !this.Text.Equal(that1.Text) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Value_Scalar) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Value_Scalar) if !ok { return fmt.Errorf("that is not of type *Value_Scalar") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Value_Scalar but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Value_Scalarbut is not nil && this == nil") } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Value_Scalar) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Value_Scalar) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Value_Range) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Value_Range) if !ok { return fmt.Errorf("that is not of type *Value_Range") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Value_Range but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Value_Rangebut is not nil && this == nil") } if this.Begin != nil && that1.Begin != nil { if *this.Begin != *that1.Begin { return fmt.Errorf("Begin this(%v) Not Equal that(%v)", *this.Begin, *that1.Begin) } } else if this.Begin != nil { return fmt.Errorf("this.Begin == nil && that.Begin != nil") } else if that1.Begin != nil { return fmt.Errorf("Begin this(%v) Not Equal that(%v)", this.Begin, that1.Begin) } if this.End != nil && that1.End != nil { if *this.End != *that1.End { return fmt.Errorf("End this(%v) Not Equal that(%v)", *this.End, *that1.End) } } else if this.End != nil { return fmt.Errorf("this.End == nil && that.End != nil") } else if that1.End != nil { return fmt.Errorf("End this(%v) Not Equal that(%v)", this.End, that1.End) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Value_Range) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Value_Range) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Begin != nil && that1.Begin != nil { if *this.Begin != *that1.Begin { return false } } else if this.Begin != nil { return false } else if that1.Begin != nil { return false } if this.End != nil && that1.End != nil { if *this.End != *that1.End { return false } } else if this.End != nil { return false } else if that1.End != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Value_Ranges) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Value_Ranges) if !ok { return fmt.Errorf("that is not of type *Value_Ranges") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Value_Ranges but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Value_Rangesbut is not nil && this == nil") } if len(this.Range) != len(that1.Range) { return fmt.Errorf("Range this(%v) Not Equal that(%v)", len(this.Range), len(that1.Range)) } for i := range this.Range { if !this.Range[i].Equal(that1.Range[i]) { return fmt.Errorf("Range this[%v](%v) Not Equal that[%v](%v)", i, this.Range[i], i, that1.Range[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Value_Ranges) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Value_Ranges) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Range) != len(that1.Range) { return false } for i := range this.Range { if !this.Range[i].Equal(that1.Range[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Value_Set) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Value_Set) if !ok { return fmt.Errorf("that is not of type *Value_Set") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Value_Set but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Value_Setbut is not nil && this == nil") } if len(this.Item) != len(that1.Item) { return fmt.Errorf("Item this(%v) Not Equal that(%v)", len(this.Item), len(that1.Item)) } for i := range this.Item { if this.Item[i] != that1.Item[i] { return fmt.Errorf("Item this[%v](%v) Not Equal that[%v](%v)", i, this.Item[i], i, that1.Item[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Value_Set) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Value_Set) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Item) != len(that1.Item) { return false } for i := range this.Item { if this.Item[i] != that1.Item[i] { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Value_Text) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Value_Text) if !ok { return fmt.Errorf("that is not of type *Value_Text") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Value_Text but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Value_Textbut is not nil && this == nil") } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Value_Text) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Value_Text) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Attribute) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Attribute) if !ok { return fmt.Errorf("that is not of type *Attribute") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Attribute but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Attributebut is not nil && this == nil") } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return fmt.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name) } } else if this.Name != nil { return fmt.Errorf("this.Name == nil && that.Name != nil") } else if that1.Name != nil { return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name) } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return fmt.Errorf("Type this(%v) Not Equal that(%v)", *this.Type, *that1.Type) } } else if this.Type != nil { return fmt.Errorf("this.Type == nil && that.Type != nil") } else if that1.Type != nil { return fmt.Errorf("Type this(%v) Not Equal that(%v)", this.Type, that1.Type) } if !this.Scalar.Equal(that1.Scalar) { return fmt.Errorf("Scalar this(%v) Not Equal that(%v)", this.Scalar, that1.Scalar) } if !this.Ranges.Equal(that1.Ranges) { return fmt.Errorf("Ranges this(%v) Not Equal that(%v)", this.Ranges, that1.Ranges) } if !this.Set.Equal(that1.Set) { return fmt.Errorf("Set this(%v) Not Equal that(%v)", this.Set, that1.Set) } if !this.Text.Equal(that1.Text) { return fmt.Errorf("Text this(%v) Not Equal that(%v)", this.Text, that1.Text) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Attribute) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Attribute) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return false } } else if this.Name != nil { return false } else if that1.Name != nil { return false } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return false } } else if this.Type != nil { return false } else if that1.Type != nil { return false } if !this.Scalar.Equal(that1.Scalar) { return false } if !this.Ranges.Equal(that1.Ranges) { return false } if !this.Set.Equal(that1.Set) { return false } if !this.Text.Equal(that1.Text) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Resource) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Resource) if !ok { return fmt.Errorf("that is not of type *Resource") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Resource but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Resourcebut is not nil && this == nil") } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return fmt.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name) } } else if this.Name != nil { return fmt.Errorf("this.Name == nil && that.Name != nil") } else if that1.Name != nil { return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name) } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return fmt.Errorf("Type this(%v) Not Equal that(%v)", *this.Type, *that1.Type) } } else if this.Type != nil { return fmt.Errorf("this.Type == nil && that.Type != nil") } else if that1.Type != nil { return fmt.Errorf("Type this(%v) Not Equal that(%v)", this.Type, that1.Type) } if !this.Scalar.Equal(that1.Scalar) { return fmt.Errorf("Scalar this(%v) Not Equal that(%v)", this.Scalar, that1.Scalar) } if !this.Ranges.Equal(that1.Ranges) { return fmt.Errorf("Ranges this(%v) Not Equal that(%v)", this.Ranges, that1.Ranges) } if !this.Set.Equal(that1.Set) { return fmt.Errorf("Set this(%v) Not Equal that(%v)", this.Set, that1.Set) } if this.Role != nil && that1.Role != nil { if *this.Role != *that1.Role { return fmt.Errorf("Role this(%v) Not Equal that(%v)", *this.Role, *that1.Role) } } else if this.Role != nil { return fmt.Errorf("this.Role == nil && that.Role != nil") } else if that1.Role != nil { return fmt.Errorf("Role this(%v) Not Equal that(%v)", this.Role, that1.Role) } if !this.Reservation.Equal(that1.Reservation) { return fmt.Errorf("Reservation this(%v) Not Equal that(%v)", this.Reservation, that1.Reservation) } if !this.Disk.Equal(that1.Disk) { return fmt.Errorf("Disk this(%v) Not Equal that(%v)", this.Disk, that1.Disk) } if !this.Revocable.Equal(that1.Revocable) { return fmt.Errorf("Revocable this(%v) Not Equal that(%v)", this.Revocable, that1.Revocable) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Resource) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Resource) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return false } } else if this.Name != nil { return false } else if that1.Name != nil { return false } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return false } } else if this.Type != nil { return false } else if that1.Type != nil { return false } if !this.Scalar.Equal(that1.Scalar) { return false } if !this.Ranges.Equal(that1.Ranges) { return false } if !this.Set.Equal(that1.Set) { return false } if this.Role != nil && that1.Role != nil { if *this.Role != *that1.Role { return false } } else if this.Role != nil { return false } else if that1.Role != nil { return false } if !this.Reservation.Equal(that1.Reservation) { return false } if !this.Disk.Equal(that1.Disk) { return false } if !this.Revocable.Equal(that1.Revocable) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Resource_ReservationInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Resource_ReservationInfo) if !ok { return fmt.Errorf("that is not of type *Resource_ReservationInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Resource_ReservationInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Resource_ReservationInfobut is not nil && this == nil") } if this.Principal != nil && that1.Principal != nil { if *this.Principal != *that1.Principal { return fmt.Errorf("Principal this(%v) Not Equal that(%v)", *this.Principal, *that1.Principal) } } else if this.Principal != nil { return fmt.Errorf("this.Principal == nil && that.Principal != nil") } else if that1.Principal != nil { return fmt.Errorf("Principal this(%v) Not Equal that(%v)", this.Principal, that1.Principal) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Resource_ReservationInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Resource_ReservationInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Principal != nil && that1.Principal != nil { if *this.Principal != *that1.Principal { return false } } else if this.Principal != nil { return false } else if that1.Principal != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Resource_DiskInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Resource_DiskInfo) if !ok { return fmt.Errorf("that is not of type *Resource_DiskInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Resource_DiskInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Resource_DiskInfobut is not nil && this == nil") } if !this.Persistence.Equal(that1.Persistence) { return fmt.Errorf("Persistence this(%v) Not Equal that(%v)", this.Persistence, that1.Persistence) } if !this.Volume.Equal(that1.Volume) { return fmt.Errorf("Volume this(%v) Not Equal that(%v)", this.Volume, that1.Volume) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Resource_DiskInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Resource_DiskInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.Persistence.Equal(that1.Persistence) { return false } if !this.Volume.Equal(that1.Volume) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Resource_DiskInfo_Persistence) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Resource_DiskInfo_Persistence) if !ok { return fmt.Errorf("that is not of type *Resource_DiskInfo_Persistence") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Resource_DiskInfo_Persistence but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Resource_DiskInfo_Persistencebut is not nil && this == nil") } if this.Id != nil && that1.Id != nil { if *this.Id != *that1.Id { return fmt.Errorf("Id this(%v) Not Equal that(%v)", *this.Id, *that1.Id) } } else if this.Id != nil { return fmt.Errorf("this.Id == nil && that.Id != nil") } else if that1.Id != nil { return fmt.Errorf("Id this(%v) Not Equal that(%v)", this.Id, that1.Id) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Resource_DiskInfo_Persistence) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Resource_DiskInfo_Persistence) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Id != nil && that1.Id != nil { if *this.Id != *that1.Id { return false } } else if this.Id != nil { return false } else if that1.Id != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Resource_RevocableInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Resource_RevocableInfo) if !ok { return fmt.Errorf("that is not of type *Resource_RevocableInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Resource_RevocableInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Resource_RevocableInfobut is not nil && this == nil") } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Resource_RevocableInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Resource_RevocableInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *TrafficControlStatistics) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*TrafficControlStatistics) if !ok { return fmt.Errorf("that is not of type *TrafficControlStatistics") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *TrafficControlStatistics but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *TrafficControlStatisticsbut is not nil && this == nil") } if this.Id != nil && that1.Id != nil { if *this.Id != *that1.Id { return fmt.Errorf("Id this(%v) Not Equal that(%v)", *this.Id, *that1.Id) } } else if this.Id != nil { return fmt.Errorf("this.Id == nil && that.Id != nil") } else if that1.Id != nil { return fmt.Errorf("Id this(%v) Not Equal that(%v)", this.Id, that1.Id) } if this.Backlog != nil && that1.Backlog != nil { if *this.Backlog != *that1.Backlog { return fmt.Errorf("Backlog this(%v) Not Equal that(%v)", *this.Backlog, *that1.Backlog) } } else if this.Backlog != nil { return fmt.Errorf("this.Backlog == nil && that.Backlog != nil") } else if that1.Backlog != nil { return fmt.Errorf("Backlog this(%v) Not Equal that(%v)", this.Backlog, that1.Backlog) } if this.Bytes != nil && that1.Bytes != nil { if *this.Bytes != *that1.Bytes { return fmt.Errorf("Bytes this(%v) Not Equal that(%v)", *this.Bytes, *that1.Bytes) } } else if this.Bytes != nil { return fmt.Errorf("this.Bytes == nil && that.Bytes != nil") } else if that1.Bytes != nil { return fmt.Errorf("Bytes this(%v) Not Equal that(%v)", this.Bytes, that1.Bytes) } if this.Drops != nil && that1.Drops != nil { if *this.Drops != *that1.Drops { return fmt.Errorf("Drops this(%v) Not Equal that(%v)", *this.Drops, *that1.Drops) } } else if this.Drops != nil { return fmt.Errorf("this.Drops == nil && that.Drops != nil") } else if that1.Drops != nil { return fmt.Errorf("Drops this(%v) Not Equal that(%v)", this.Drops, that1.Drops) } if this.Overlimits != nil && that1.Overlimits != nil { if *this.Overlimits != *that1.Overlimits { return fmt.Errorf("Overlimits this(%v) Not Equal that(%v)", *this.Overlimits, *that1.Overlimits) } } else if this.Overlimits != nil { return fmt.Errorf("this.Overlimits == nil && that.Overlimits != nil") } else if that1.Overlimits != nil { return fmt.Errorf("Overlimits this(%v) Not Equal that(%v)", this.Overlimits, that1.Overlimits) } if this.Packets != nil && that1.Packets != nil { if *this.Packets != *that1.Packets { return fmt.Errorf("Packets this(%v) Not Equal that(%v)", *this.Packets, *that1.Packets) } } else if this.Packets != nil { return fmt.Errorf("this.Packets == nil && that.Packets != nil") } else if that1.Packets != nil { return fmt.Errorf("Packets this(%v) Not Equal that(%v)", this.Packets, that1.Packets) } if this.Qlen != nil && that1.Qlen != nil { if *this.Qlen != *that1.Qlen { return fmt.Errorf("Qlen this(%v) Not Equal that(%v)", *this.Qlen, *that1.Qlen) } } else if this.Qlen != nil { return fmt.Errorf("this.Qlen == nil && that.Qlen != nil") } else if that1.Qlen != nil { return fmt.Errorf("Qlen this(%v) Not Equal that(%v)", this.Qlen, that1.Qlen) } if this.Ratebps != nil && that1.Ratebps != nil { if *this.Ratebps != *that1.Ratebps { return fmt.Errorf("Ratebps this(%v) Not Equal that(%v)", *this.Ratebps, *that1.Ratebps) } } else if this.Ratebps != nil { return fmt.Errorf("this.Ratebps == nil && that.Ratebps != nil") } else if that1.Ratebps != nil { return fmt.Errorf("Ratebps this(%v) Not Equal that(%v)", this.Ratebps, that1.Ratebps) } if this.Ratepps != nil && that1.Ratepps != nil { if *this.Ratepps != *that1.Ratepps { return fmt.Errorf("Ratepps this(%v) Not Equal that(%v)", *this.Ratepps, *that1.Ratepps) } } else if this.Ratepps != nil { return fmt.Errorf("this.Ratepps == nil && that.Ratepps != nil") } else if that1.Ratepps != nil { return fmt.Errorf("Ratepps this(%v) Not Equal that(%v)", this.Ratepps, that1.Ratepps) } if this.Requeues != nil && that1.Requeues != nil { if *this.Requeues != *that1.Requeues { return fmt.Errorf("Requeues this(%v) Not Equal that(%v)", *this.Requeues, *that1.Requeues) } } else if this.Requeues != nil { return fmt.Errorf("this.Requeues == nil && that.Requeues != nil") } else if that1.Requeues != nil { return fmt.Errorf("Requeues this(%v) Not Equal that(%v)", this.Requeues, that1.Requeues) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *TrafficControlStatistics) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*TrafficControlStatistics) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Id != nil && that1.Id != nil { if *this.Id != *that1.Id { return false } } else if this.Id != nil { return false } else if that1.Id != nil { return false } if this.Backlog != nil && that1.Backlog != nil { if *this.Backlog != *that1.Backlog { return false } } else if this.Backlog != nil { return false } else if that1.Backlog != nil { return false } if this.Bytes != nil && that1.Bytes != nil { if *this.Bytes != *that1.Bytes { return false } } else if this.Bytes != nil { return false } else if that1.Bytes != nil { return false } if this.Drops != nil && that1.Drops != nil { if *this.Drops != *that1.Drops { return false } } else if this.Drops != nil { return false } else if that1.Drops != nil { return false } if this.Overlimits != nil && that1.Overlimits != nil { if *this.Overlimits != *that1.Overlimits { return false } } else if this.Overlimits != nil { return false } else if that1.Overlimits != nil { return false } if this.Packets != nil && that1.Packets != nil { if *this.Packets != *that1.Packets { return false } } else if this.Packets != nil { return false } else if that1.Packets != nil { return false } if this.Qlen != nil && that1.Qlen != nil { if *this.Qlen != *that1.Qlen { return false } } else if this.Qlen != nil { return false } else if that1.Qlen != nil { return false } if this.Ratebps != nil && that1.Ratebps != nil { if *this.Ratebps != *that1.Ratebps { return false } } else if this.Ratebps != nil { return false } else if that1.Ratebps != nil { return false } if this.Ratepps != nil && that1.Ratepps != nil { if *this.Ratepps != *that1.Ratepps { return false } } else if this.Ratepps != nil { return false } else if that1.Ratepps != nil { return false } if this.Requeues != nil && that1.Requeues != nil { if *this.Requeues != *that1.Requeues { return false } } else if this.Requeues != nil { return false } else if that1.Requeues != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ResourceStatistics) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ResourceStatistics) if !ok { return fmt.Errorf("that is not of type *ResourceStatistics") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ResourceStatistics but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ResourceStatisticsbut is not nil && this == nil") } if this.Timestamp != nil && that1.Timestamp != nil { if *this.Timestamp != *that1.Timestamp { return fmt.Errorf("Timestamp this(%v) Not Equal that(%v)", *this.Timestamp, *that1.Timestamp) } } else if this.Timestamp != nil { return fmt.Errorf("this.Timestamp == nil && that.Timestamp != nil") } else if that1.Timestamp != nil { return fmt.Errorf("Timestamp this(%v) Not Equal that(%v)", this.Timestamp, that1.Timestamp) } if this.Processes != nil && that1.Processes != nil { if *this.Processes != *that1.Processes { return fmt.Errorf("Processes this(%v) Not Equal that(%v)", *this.Processes, *that1.Processes) } } else if this.Processes != nil { return fmt.Errorf("this.Processes == nil && that.Processes != nil") } else if that1.Processes != nil { return fmt.Errorf("Processes this(%v) Not Equal that(%v)", this.Processes, that1.Processes) } if this.Threads != nil && that1.Threads != nil { if *this.Threads != *that1.Threads { return fmt.Errorf("Threads this(%v) Not Equal that(%v)", *this.Threads, *that1.Threads) } } else if this.Threads != nil { return fmt.Errorf("this.Threads == nil && that.Threads != nil") } else if that1.Threads != nil { return fmt.Errorf("Threads this(%v) Not Equal that(%v)", this.Threads, that1.Threads) } if this.CpusUserTimeSecs != nil && that1.CpusUserTimeSecs != nil { if *this.CpusUserTimeSecs != *that1.CpusUserTimeSecs { return fmt.Errorf("CpusUserTimeSecs this(%v) Not Equal that(%v)", *this.CpusUserTimeSecs, *that1.CpusUserTimeSecs) } } else if this.CpusUserTimeSecs != nil { return fmt.Errorf("this.CpusUserTimeSecs == nil && that.CpusUserTimeSecs != nil") } else if that1.CpusUserTimeSecs != nil { return fmt.Errorf("CpusUserTimeSecs this(%v) Not Equal that(%v)", this.CpusUserTimeSecs, that1.CpusUserTimeSecs) } if this.CpusSystemTimeSecs != nil && that1.CpusSystemTimeSecs != nil { if *this.CpusSystemTimeSecs != *that1.CpusSystemTimeSecs { return fmt.Errorf("CpusSystemTimeSecs this(%v) Not Equal that(%v)", *this.CpusSystemTimeSecs, *that1.CpusSystemTimeSecs) } } else if this.CpusSystemTimeSecs != nil { return fmt.Errorf("this.CpusSystemTimeSecs == nil && that.CpusSystemTimeSecs != nil") } else if that1.CpusSystemTimeSecs != nil { return fmt.Errorf("CpusSystemTimeSecs this(%v) Not Equal that(%v)", this.CpusSystemTimeSecs, that1.CpusSystemTimeSecs) } if this.CpusLimit != nil && that1.CpusLimit != nil { if *this.CpusLimit != *that1.CpusLimit { return fmt.Errorf("CpusLimit this(%v) Not Equal that(%v)", *this.CpusLimit, *that1.CpusLimit) } } else if this.CpusLimit != nil { return fmt.Errorf("this.CpusLimit == nil && that.CpusLimit != nil") } else if that1.CpusLimit != nil { return fmt.Errorf("CpusLimit this(%v) Not Equal that(%v)", this.CpusLimit, that1.CpusLimit) } if this.CpusNrPeriods != nil && that1.CpusNrPeriods != nil { if *this.CpusNrPeriods != *that1.CpusNrPeriods { return fmt.Errorf("CpusNrPeriods this(%v) Not Equal that(%v)", *this.CpusNrPeriods, *that1.CpusNrPeriods) } } else if this.CpusNrPeriods != nil { return fmt.Errorf("this.CpusNrPeriods == nil && that.CpusNrPeriods != nil") } else if that1.CpusNrPeriods != nil { return fmt.Errorf("CpusNrPeriods this(%v) Not Equal that(%v)", this.CpusNrPeriods, that1.CpusNrPeriods) } if this.CpusNrThrottled != nil && that1.CpusNrThrottled != nil { if *this.CpusNrThrottled != *that1.CpusNrThrottled { return fmt.Errorf("CpusNrThrottled this(%v) Not Equal that(%v)", *this.CpusNrThrottled, *that1.CpusNrThrottled) } } else if this.CpusNrThrottled != nil { return fmt.Errorf("this.CpusNrThrottled == nil && that.CpusNrThrottled != nil") } else if that1.CpusNrThrottled != nil { return fmt.Errorf("CpusNrThrottled this(%v) Not Equal that(%v)", this.CpusNrThrottled, that1.CpusNrThrottled) } if this.CpusThrottledTimeSecs != nil && that1.CpusThrottledTimeSecs != nil { if *this.CpusThrottledTimeSecs != *that1.CpusThrottledTimeSecs { return fmt.Errorf("CpusThrottledTimeSecs this(%v) Not Equal that(%v)", *this.CpusThrottledTimeSecs, *that1.CpusThrottledTimeSecs) } } else if this.CpusThrottledTimeSecs != nil { return fmt.Errorf("this.CpusThrottledTimeSecs == nil && that.CpusThrottledTimeSecs != nil") } else if that1.CpusThrottledTimeSecs != nil { return fmt.Errorf("CpusThrottledTimeSecs this(%v) Not Equal that(%v)", this.CpusThrottledTimeSecs, that1.CpusThrottledTimeSecs) } if this.MemTotalBytes != nil && that1.MemTotalBytes != nil { if *this.MemTotalBytes != *that1.MemTotalBytes { return fmt.Errorf("MemTotalBytes this(%v) Not Equal that(%v)", *this.MemTotalBytes, *that1.MemTotalBytes) } } else if this.MemTotalBytes != nil { return fmt.Errorf("this.MemTotalBytes == nil && that.MemTotalBytes != nil") } else if that1.MemTotalBytes != nil { return fmt.Errorf("MemTotalBytes this(%v) Not Equal that(%v)", this.MemTotalBytes, that1.MemTotalBytes) } if this.MemTotalMemswBytes != nil && that1.MemTotalMemswBytes != nil { if *this.MemTotalMemswBytes != *that1.MemTotalMemswBytes { return fmt.Errorf("MemTotalMemswBytes this(%v) Not Equal that(%v)", *this.MemTotalMemswBytes, *that1.MemTotalMemswBytes) } } else if this.MemTotalMemswBytes != nil { return fmt.Errorf("this.MemTotalMemswBytes == nil && that.MemTotalMemswBytes != nil") } else if that1.MemTotalMemswBytes != nil { return fmt.Errorf("MemTotalMemswBytes this(%v) Not Equal that(%v)", this.MemTotalMemswBytes, that1.MemTotalMemswBytes) } if this.MemLimitBytes != nil && that1.MemLimitBytes != nil { if *this.MemLimitBytes != *that1.MemLimitBytes { return fmt.Errorf("MemLimitBytes this(%v) Not Equal that(%v)", *this.MemLimitBytes, *that1.MemLimitBytes) } } else if this.MemLimitBytes != nil { return fmt.Errorf("this.MemLimitBytes == nil && that.MemLimitBytes != nil") } else if that1.MemLimitBytes != nil { return fmt.Errorf("MemLimitBytes this(%v) Not Equal that(%v)", this.MemLimitBytes, that1.MemLimitBytes) } if this.MemSoftLimitBytes != nil && that1.MemSoftLimitBytes != nil { if *this.MemSoftLimitBytes != *that1.MemSoftLimitBytes { return fmt.Errorf("MemSoftLimitBytes this(%v) Not Equal that(%v)", *this.MemSoftLimitBytes, *that1.MemSoftLimitBytes) } } else if this.MemSoftLimitBytes != nil { return fmt.Errorf("this.MemSoftLimitBytes == nil && that.MemSoftLimitBytes != nil") } else if that1.MemSoftLimitBytes != nil { return fmt.Errorf("MemSoftLimitBytes this(%v) Not Equal that(%v)", this.MemSoftLimitBytes, that1.MemSoftLimitBytes) } if this.MemFileBytes != nil && that1.MemFileBytes != nil { if *this.MemFileBytes != *that1.MemFileBytes { return fmt.Errorf("MemFileBytes this(%v) Not Equal that(%v)", *this.MemFileBytes, *that1.MemFileBytes) } } else if this.MemFileBytes != nil { return fmt.Errorf("this.MemFileBytes == nil && that.MemFileBytes != nil") } else if that1.MemFileBytes != nil { return fmt.Errorf("MemFileBytes this(%v) Not Equal that(%v)", this.MemFileBytes, that1.MemFileBytes) } if this.MemAnonBytes != nil && that1.MemAnonBytes != nil { if *this.MemAnonBytes != *that1.MemAnonBytes { return fmt.Errorf("MemAnonBytes this(%v) Not Equal that(%v)", *this.MemAnonBytes, *that1.MemAnonBytes) } } else if this.MemAnonBytes != nil { return fmt.Errorf("this.MemAnonBytes == nil && that.MemAnonBytes != nil") } else if that1.MemAnonBytes != nil { return fmt.Errorf("MemAnonBytes this(%v) Not Equal that(%v)", this.MemAnonBytes, that1.MemAnonBytes) } if this.MemCacheBytes != nil && that1.MemCacheBytes != nil { if *this.MemCacheBytes != *that1.MemCacheBytes { return fmt.Errorf("MemCacheBytes this(%v) Not Equal that(%v)", *this.MemCacheBytes, *that1.MemCacheBytes) } } else if this.MemCacheBytes != nil { return fmt.Errorf("this.MemCacheBytes == nil && that.MemCacheBytes != nil") } else if that1.MemCacheBytes != nil { return fmt.Errorf("MemCacheBytes this(%v) Not Equal that(%v)", this.MemCacheBytes, that1.MemCacheBytes) } if this.MemRssBytes != nil && that1.MemRssBytes != nil { if *this.MemRssBytes != *that1.MemRssBytes { return fmt.Errorf("MemRssBytes this(%v) Not Equal that(%v)", *this.MemRssBytes, *that1.MemRssBytes) } } else if this.MemRssBytes != nil { return fmt.Errorf("this.MemRssBytes == nil && that.MemRssBytes != nil") } else if that1.MemRssBytes != nil { return fmt.Errorf("MemRssBytes this(%v) Not Equal that(%v)", this.MemRssBytes, that1.MemRssBytes) } if this.MemMappedFileBytes != nil && that1.MemMappedFileBytes != nil { if *this.MemMappedFileBytes != *that1.MemMappedFileBytes { return fmt.Errorf("MemMappedFileBytes this(%v) Not Equal that(%v)", *this.MemMappedFileBytes, *that1.MemMappedFileBytes) } } else if this.MemMappedFileBytes != nil { return fmt.Errorf("this.MemMappedFileBytes == nil && that.MemMappedFileBytes != nil") } else if that1.MemMappedFileBytes != nil { return fmt.Errorf("MemMappedFileBytes this(%v) Not Equal that(%v)", this.MemMappedFileBytes, that1.MemMappedFileBytes) } if this.MemSwapBytes != nil && that1.MemSwapBytes != nil { if *this.MemSwapBytes != *that1.MemSwapBytes { return fmt.Errorf("MemSwapBytes this(%v) Not Equal that(%v)", *this.MemSwapBytes, *that1.MemSwapBytes) } } else if this.MemSwapBytes != nil { return fmt.Errorf("this.MemSwapBytes == nil && that.MemSwapBytes != nil") } else if that1.MemSwapBytes != nil { return fmt.Errorf("MemSwapBytes this(%v) Not Equal that(%v)", this.MemSwapBytes, that1.MemSwapBytes) } if this.MemLowPressureCounter != nil && that1.MemLowPressureCounter != nil { if *this.MemLowPressureCounter != *that1.MemLowPressureCounter { return fmt.Errorf("MemLowPressureCounter this(%v) Not Equal that(%v)", *this.MemLowPressureCounter, *that1.MemLowPressureCounter) } } else if this.MemLowPressureCounter != nil { return fmt.Errorf("this.MemLowPressureCounter == nil && that.MemLowPressureCounter != nil") } else if that1.MemLowPressureCounter != nil { return fmt.Errorf("MemLowPressureCounter this(%v) Not Equal that(%v)", this.MemLowPressureCounter, that1.MemLowPressureCounter) } if this.MemMediumPressureCounter != nil && that1.MemMediumPressureCounter != nil { if *this.MemMediumPressureCounter != *that1.MemMediumPressureCounter { return fmt.Errorf("MemMediumPressureCounter this(%v) Not Equal that(%v)", *this.MemMediumPressureCounter, *that1.MemMediumPressureCounter) } } else if this.MemMediumPressureCounter != nil { return fmt.Errorf("this.MemMediumPressureCounter == nil && that.MemMediumPressureCounter != nil") } else if that1.MemMediumPressureCounter != nil { return fmt.Errorf("MemMediumPressureCounter this(%v) Not Equal that(%v)", this.MemMediumPressureCounter, that1.MemMediumPressureCounter) } if this.MemCriticalPressureCounter != nil && that1.MemCriticalPressureCounter != nil { if *this.MemCriticalPressureCounter != *that1.MemCriticalPressureCounter { return fmt.Errorf("MemCriticalPressureCounter this(%v) Not Equal that(%v)", *this.MemCriticalPressureCounter, *that1.MemCriticalPressureCounter) } } else if this.MemCriticalPressureCounter != nil { return fmt.Errorf("this.MemCriticalPressureCounter == nil && that.MemCriticalPressureCounter != nil") } else if that1.MemCriticalPressureCounter != nil { return fmt.Errorf("MemCriticalPressureCounter this(%v) Not Equal that(%v)", this.MemCriticalPressureCounter, that1.MemCriticalPressureCounter) } if this.DiskLimitBytes != nil && that1.DiskLimitBytes != nil { if *this.DiskLimitBytes != *that1.DiskLimitBytes { return fmt.Errorf("DiskLimitBytes this(%v) Not Equal that(%v)", *this.DiskLimitBytes, *that1.DiskLimitBytes) } } else if this.DiskLimitBytes != nil { return fmt.Errorf("this.DiskLimitBytes == nil && that.DiskLimitBytes != nil") } else if that1.DiskLimitBytes != nil { return fmt.Errorf("DiskLimitBytes this(%v) Not Equal that(%v)", this.DiskLimitBytes, that1.DiskLimitBytes) } if this.DiskUsedBytes != nil && that1.DiskUsedBytes != nil { if *this.DiskUsedBytes != *that1.DiskUsedBytes { return fmt.Errorf("DiskUsedBytes this(%v) Not Equal that(%v)", *this.DiskUsedBytes, *that1.DiskUsedBytes) } } else if this.DiskUsedBytes != nil { return fmt.Errorf("this.DiskUsedBytes == nil && that.DiskUsedBytes != nil") } else if that1.DiskUsedBytes != nil { return fmt.Errorf("DiskUsedBytes this(%v) Not Equal that(%v)", this.DiskUsedBytes, that1.DiskUsedBytes) } if !this.Perf.Equal(that1.Perf) { return fmt.Errorf("Perf this(%v) Not Equal that(%v)", this.Perf, that1.Perf) } if this.NetRxPackets != nil && that1.NetRxPackets != nil { if *this.NetRxPackets != *that1.NetRxPackets { return fmt.Errorf("NetRxPackets this(%v) Not Equal that(%v)", *this.NetRxPackets, *that1.NetRxPackets) } } else if this.NetRxPackets != nil { return fmt.Errorf("this.NetRxPackets == nil && that.NetRxPackets != nil") } else if that1.NetRxPackets != nil { return fmt.Errorf("NetRxPackets this(%v) Not Equal that(%v)", this.NetRxPackets, that1.NetRxPackets) } if this.NetRxBytes != nil && that1.NetRxBytes != nil { if *this.NetRxBytes != *that1.NetRxBytes { return fmt.Errorf("NetRxBytes this(%v) Not Equal that(%v)", *this.NetRxBytes, *that1.NetRxBytes) } } else if this.NetRxBytes != nil { return fmt.Errorf("this.NetRxBytes == nil && that.NetRxBytes != nil") } else if that1.NetRxBytes != nil { return fmt.Errorf("NetRxBytes this(%v) Not Equal that(%v)", this.NetRxBytes, that1.NetRxBytes) } if this.NetRxErrors != nil && that1.NetRxErrors != nil { if *this.NetRxErrors != *that1.NetRxErrors { return fmt.Errorf("NetRxErrors this(%v) Not Equal that(%v)", *this.NetRxErrors, *that1.NetRxErrors) } } else if this.NetRxErrors != nil { return fmt.Errorf("this.NetRxErrors == nil && that.NetRxErrors != nil") } else if that1.NetRxErrors != nil { return fmt.Errorf("NetRxErrors this(%v) Not Equal that(%v)", this.NetRxErrors, that1.NetRxErrors) } if this.NetRxDropped != nil && that1.NetRxDropped != nil { if *this.NetRxDropped != *that1.NetRxDropped { return fmt.Errorf("NetRxDropped this(%v) Not Equal that(%v)", *this.NetRxDropped, *that1.NetRxDropped) } } else if this.NetRxDropped != nil { return fmt.Errorf("this.NetRxDropped == nil && that.NetRxDropped != nil") } else if that1.NetRxDropped != nil { return fmt.Errorf("NetRxDropped this(%v) Not Equal that(%v)", this.NetRxDropped, that1.NetRxDropped) } if this.NetTxPackets != nil && that1.NetTxPackets != nil { if *this.NetTxPackets != *that1.NetTxPackets { return fmt.Errorf("NetTxPackets this(%v) Not Equal that(%v)", *this.NetTxPackets, *that1.NetTxPackets) } } else if this.NetTxPackets != nil { return fmt.Errorf("this.NetTxPackets == nil && that.NetTxPackets != nil") } else if that1.NetTxPackets != nil { return fmt.Errorf("NetTxPackets this(%v) Not Equal that(%v)", this.NetTxPackets, that1.NetTxPackets) } if this.NetTxBytes != nil && that1.NetTxBytes != nil { if *this.NetTxBytes != *that1.NetTxBytes { return fmt.Errorf("NetTxBytes this(%v) Not Equal that(%v)", *this.NetTxBytes, *that1.NetTxBytes) } } else if this.NetTxBytes != nil { return fmt.Errorf("this.NetTxBytes == nil && that.NetTxBytes != nil") } else if that1.NetTxBytes != nil { return fmt.Errorf("NetTxBytes this(%v) Not Equal that(%v)", this.NetTxBytes, that1.NetTxBytes) } if this.NetTxErrors != nil && that1.NetTxErrors != nil { if *this.NetTxErrors != *that1.NetTxErrors { return fmt.Errorf("NetTxErrors this(%v) Not Equal that(%v)", *this.NetTxErrors, *that1.NetTxErrors) } } else if this.NetTxErrors != nil { return fmt.Errorf("this.NetTxErrors == nil && that.NetTxErrors != nil") } else if that1.NetTxErrors != nil { return fmt.Errorf("NetTxErrors this(%v) Not Equal that(%v)", this.NetTxErrors, that1.NetTxErrors) } if this.NetTxDropped != nil && that1.NetTxDropped != nil { if *this.NetTxDropped != *that1.NetTxDropped { return fmt.Errorf("NetTxDropped this(%v) Not Equal that(%v)", *this.NetTxDropped, *that1.NetTxDropped) } } else if this.NetTxDropped != nil { return fmt.Errorf("this.NetTxDropped == nil && that.NetTxDropped != nil") } else if that1.NetTxDropped != nil { return fmt.Errorf("NetTxDropped this(%v) Not Equal that(%v)", this.NetTxDropped, that1.NetTxDropped) } if this.NetTcpRttMicrosecsP50 != nil && that1.NetTcpRttMicrosecsP50 != nil { if *this.NetTcpRttMicrosecsP50 != *that1.NetTcpRttMicrosecsP50 { return fmt.Errorf("NetTcpRttMicrosecsP50 this(%v) Not Equal that(%v)", *this.NetTcpRttMicrosecsP50, *that1.NetTcpRttMicrosecsP50) } } else if this.NetTcpRttMicrosecsP50 != nil { return fmt.Errorf("this.NetTcpRttMicrosecsP50 == nil && that.NetTcpRttMicrosecsP50 != nil") } else if that1.NetTcpRttMicrosecsP50 != nil { return fmt.Errorf("NetTcpRttMicrosecsP50 this(%v) Not Equal that(%v)", this.NetTcpRttMicrosecsP50, that1.NetTcpRttMicrosecsP50) } if this.NetTcpRttMicrosecsP90 != nil && that1.NetTcpRttMicrosecsP90 != nil { if *this.NetTcpRttMicrosecsP90 != *that1.NetTcpRttMicrosecsP90 { return fmt.Errorf("NetTcpRttMicrosecsP90 this(%v) Not Equal that(%v)", *this.NetTcpRttMicrosecsP90, *that1.NetTcpRttMicrosecsP90) } } else if this.NetTcpRttMicrosecsP90 != nil { return fmt.Errorf("this.NetTcpRttMicrosecsP90 == nil && that.NetTcpRttMicrosecsP90 != nil") } else if that1.NetTcpRttMicrosecsP90 != nil { return fmt.Errorf("NetTcpRttMicrosecsP90 this(%v) Not Equal that(%v)", this.NetTcpRttMicrosecsP90, that1.NetTcpRttMicrosecsP90) } if this.NetTcpRttMicrosecsP95 != nil && that1.NetTcpRttMicrosecsP95 != nil { if *this.NetTcpRttMicrosecsP95 != *that1.NetTcpRttMicrosecsP95 { return fmt.Errorf("NetTcpRttMicrosecsP95 this(%v) Not Equal that(%v)", *this.NetTcpRttMicrosecsP95, *that1.NetTcpRttMicrosecsP95) } } else if this.NetTcpRttMicrosecsP95 != nil { return fmt.Errorf("this.NetTcpRttMicrosecsP95 == nil && that.NetTcpRttMicrosecsP95 != nil") } else if that1.NetTcpRttMicrosecsP95 != nil { return fmt.Errorf("NetTcpRttMicrosecsP95 this(%v) Not Equal that(%v)", this.NetTcpRttMicrosecsP95, that1.NetTcpRttMicrosecsP95) } if this.NetTcpRttMicrosecsP99 != nil && that1.NetTcpRttMicrosecsP99 != nil { if *this.NetTcpRttMicrosecsP99 != *that1.NetTcpRttMicrosecsP99 { return fmt.Errorf("NetTcpRttMicrosecsP99 this(%v) Not Equal that(%v)", *this.NetTcpRttMicrosecsP99, *that1.NetTcpRttMicrosecsP99) } } else if this.NetTcpRttMicrosecsP99 != nil { return fmt.Errorf("this.NetTcpRttMicrosecsP99 == nil && that.NetTcpRttMicrosecsP99 != nil") } else if that1.NetTcpRttMicrosecsP99 != nil { return fmt.Errorf("NetTcpRttMicrosecsP99 this(%v) Not Equal that(%v)", this.NetTcpRttMicrosecsP99, that1.NetTcpRttMicrosecsP99) } if this.NetTcpActiveConnections != nil && that1.NetTcpActiveConnections != nil { if *this.NetTcpActiveConnections != *that1.NetTcpActiveConnections { return fmt.Errorf("NetTcpActiveConnections this(%v) Not Equal that(%v)", *this.NetTcpActiveConnections, *that1.NetTcpActiveConnections) } } else if this.NetTcpActiveConnections != nil { return fmt.Errorf("this.NetTcpActiveConnections == nil && that.NetTcpActiveConnections != nil") } else if that1.NetTcpActiveConnections != nil { return fmt.Errorf("NetTcpActiveConnections this(%v) Not Equal that(%v)", this.NetTcpActiveConnections, that1.NetTcpActiveConnections) } if this.NetTcpTimeWaitConnections != nil && that1.NetTcpTimeWaitConnections != nil { if *this.NetTcpTimeWaitConnections != *that1.NetTcpTimeWaitConnections { return fmt.Errorf("NetTcpTimeWaitConnections this(%v) Not Equal that(%v)", *this.NetTcpTimeWaitConnections, *that1.NetTcpTimeWaitConnections) } } else if this.NetTcpTimeWaitConnections != nil { return fmt.Errorf("this.NetTcpTimeWaitConnections == nil && that.NetTcpTimeWaitConnections != nil") } else if that1.NetTcpTimeWaitConnections != nil { return fmt.Errorf("NetTcpTimeWaitConnections this(%v) Not Equal that(%v)", this.NetTcpTimeWaitConnections, that1.NetTcpTimeWaitConnections) } if len(this.NetTrafficControlStatistics) != len(that1.NetTrafficControlStatistics) { return fmt.Errorf("NetTrafficControlStatistics this(%v) Not Equal that(%v)", len(this.NetTrafficControlStatistics), len(that1.NetTrafficControlStatistics)) } for i := range this.NetTrafficControlStatistics { if !this.NetTrafficControlStatistics[i].Equal(that1.NetTrafficControlStatistics[i]) { return fmt.Errorf("NetTrafficControlStatistics this[%v](%v) Not Equal that[%v](%v)", i, this.NetTrafficControlStatistics[i], i, that1.NetTrafficControlStatistics[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ResourceStatistics) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ResourceStatistics) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Timestamp != nil && that1.Timestamp != nil { if *this.Timestamp != *that1.Timestamp { return false } } else if this.Timestamp != nil { return false } else if that1.Timestamp != nil { return false } if this.Processes != nil && that1.Processes != nil { if *this.Processes != *that1.Processes { return false } } else if this.Processes != nil { return false } else if that1.Processes != nil { return false } if this.Threads != nil && that1.Threads != nil { if *this.Threads != *that1.Threads { return false } } else if this.Threads != nil { return false } else if that1.Threads != nil { return false } if this.CpusUserTimeSecs != nil && that1.CpusUserTimeSecs != nil { if *this.CpusUserTimeSecs != *that1.CpusUserTimeSecs { return false } } else if this.CpusUserTimeSecs != nil { return false } else if that1.CpusUserTimeSecs != nil { return false } if this.CpusSystemTimeSecs != nil && that1.CpusSystemTimeSecs != nil { if *this.CpusSystemTimeSecs != *that1.CpusSystemTimeSecs { return false } } else if this.CpusSystemTimeSecs != nil { return false } else if that1.CpusSystemTimeSecs != nil { return false } if this.CpusLimit != nil && that1.CpusLimit != nil { if *this.CpusLimit != *that1.CpusLimit { return false } } else if this.CpusLimit != nil { return false } else if that1.CpusLimit != nil { return false } if this.CpusNrPeriods != nil && that1.CpusNrPeriods != nil { if *this.CpusNrPeriods != *that1.CpusNrPeriods { return false } } else if this.CpusNrPeriods != nil { return false } else if that1.CpusNrPeriods != nil { return false } if this.CpusNrThrottled != nil && that1.CpusNrThrottled != nil { if *this.CpusNrThrottled != *that1.CpusNrThrottled { return false } } else if this.CpusNrThrottled != nil { return false } else if that1.CpusNrThrottled != nil { return false } if this.CpusThrottledTimeSecs != nil && that1.CpusThrottledTimeSecs != nil { if *this.CpusThrottledTimeSecs != *that1.CpusThrottledTimeSecs { return false } } else if this.CpusThrottledTimeSecs != nil { return false } else if that1.CpusThrottledTimeSecs != nil { return false } if this.MemTotalBytes != nil && that1.MemTotalBytes != nil { if *this.MemTotalBytes != *that1.MemTotalBytes { return false } } else if this.MemTotalBytes != nil { return false } else if that1.MemTotalBytes != nil { return false } if this.MemTotalMemswBytes != nil && that1.MemTotalMemswBytes != nil { if *this.MemTotalMemswBytes != *that1.MemTotalMemswBytes { return false } } else if this.MemTotalMemswBytes != nil { return false } else if that1.MemTotalMemswBytes != nil { return false } if this.MemLimitBytes != nil && that1.MemLimitBytes != nil { if *this.MemLimitBytes != *that1.MemLimitBytes { return false } } else if this.MemLimitBytes != nil { return false } else if that1.MemLimitBytes != nil { return false } if this.MemSoftLimitBytes != nil && that1.MemSoftLimitBytes != nil { if *this.MemSoftLimitBytes != *that1.MemSoftLimitBytes { return false } } else if this.MemSoftLimitBytes != nil { return false } else if that1.MemSoftLimitBytes != nil { return false } if this.MemFileBytes != nil && that1.MemFileBytes != nil { if *this.MemFileBytes != *that1.MemFileBytes { return false } } else if this.MemFileBytes != nil { return false } else if that1.MemFileBytes != nil { return false } if this.MemAnonBytes != nil && that1.MemAnonBytes != nil { if *this.MemAnonBytes != *that1.MemAnonBytes { return false } } else if this.MemAnonBytes != nil { return false } else if that1.MemAnonBytes != nil { return false } if this.MemCacheBytes != nil && that1.MemCacheBytes != nil { if *this.MemCacheBytes != *that1.MemCacheBytes { return false } } else if this.MemCacheBytes != nil { return false } else if that1.MemCacheBytes != nil { return false } if this.MemRssBytes != nil && that1.MemRssBytes != nil { if *this.MemRssBytes != *that1.MemRssBytes { return false } } else if this.MemRssBytes != nil { return false } else if that1.MemRssBytes != nil { return false } if this.MemMappedFileBytes != nil && that1.MemMappedFileBytes != nil { if *this.MemMappedFileBytes != *that1.MemMappedFileBytes { return false } } else if this.MemMappedFileBytes != nil { return false } else if that1.MemMappedFileBytes != nil { return false } if this.MemSwapBytes != nil && that1.MemSwapBytes != nil { if *this.MemSwapBytes != *that1.MemSwapBytes { return false } } else if this.MemSwapBytes != nil { return false } else if that1.MemSwapBytes != nil { return false } if this.MemLowPressureCounter != nil && that1.MemLowPressureCounter != nil { if *this.MemLowPressureCounter != *that1.MemLowPressureCounter { return false } } else if this.MemLowPressureCounter != nil { return false } else if that1.MemLowPressureCounter != nil { return false } if this.MemMediumPressureCounter != nil && that1.MemMediumPressureCounter != nil { if *this.MemMediumPressureCounter != *that1.MemMediumPressureCounter { return false } } else if this.MemMediumPressureCounter != nil { return false } else if that1.MemMediumPressureCounter != nil { return false } if this.MemCriticalPressureCounter != nil && that1.MemCriticalPressureCounter != nil { if *this.MemCriticalPressureCounter != *that1.MemCriticalPressureCounter { return false } } else if this.MemCriticalPressureCounter != nil { return false } else if that1.MemCriticalPressureCounter != nil { return false } if this.DiskLimitBytes != nil && that1.DiskLimitBytes != nil { if *this.DiskLimitBytes != *that1.DiskLimitBytes { return false } } else if this.DiskLimitBytes != nil { return false } else if that1.DiskLimitBytes != nil { return false } if this.DiskUsedBytes != nil && that1.DiskUsedBytes != nil { if *this.DiskUsedBytes != *that1.DiskUsedBytes { return false } } else if this.DiskUsedBytes != nil { return false } else if that1.DiskUsedBytes != nil { return false } if !this.Perf.Equal(that1.Perf) { return false } if this.NetRxPackets != nil && that1.NetRxPackets != nil { if *this.NetRxPackets != *that1.NetRxPackets { return false } } else if this.NetRxPackets != nil { return false } else if that1.NetRxPackets != nil { return false } if this.NetRxBytes != nil && that1.NetRxBytes != nil { if *this.NetRxBytes != *that1.NetRxBytes { return false } } else if this.NetRxBytes != nil { return false } else if that1.NetRxBytes != nil { return false } if this.NetRxErrors != nil && that1.NetRxErrors != nil { if *this.NetRxErrors != *that1.NetRxErrors { return false } } else if this.NetRxErrors != nil { return false } else if that1.NetRxErrors != nil { return false } if this.NetRxDropped != nil && that1.NetRxDropped != nil { if *this.NetRxDropped != *that1.NetRxDropped { return false } } else if this.NetRxDropped != nil { return false } else if that1.NetRxDropped != nil { return false } if this.NetTxPackets != nil && that1.NetTxPackets != nil { if *this.NetTxPackets != *that1.NetTxPackets { return false } } else if this.NetTxPackets != nil { return false } else if that1.NetTxPackets != nil { return false } if this.NetTxBytes != nil && that1.NetTxBytes != nil { if *this.NetTxBytes != *that1.NetTxBytes { return false } } else if this.NetTxBytes != nil { return false } else if that1.NetTxBytes != nil { return false } if this.NetTxErrors != nil && that1.NetTxErrors != nil { if *this.NetTxErrors != *that1.NetTxErrors { return false } } else if this.NetTxErrors != nil { return false } else if that1.NetTxErrors != nil { return false } if this.NetTxDropped != nil && that1.NetTxDropped != nil { if *this.NetTxDropped != *that1.NetTxDropped { return false } } else if this.NetTxDropped != nil { return false } else if that1.NetTxDropped != nil { return false } if this.NetTcpRttMicrosecsP50 != nil && that1.NetTcpRttMicrosecsP50 != nil { if *this.NetTcpRttMicrosecsP50 != *that1.NetTcpRttMicrosecsP50 { return false } } else if this.NetTcpRttMicrosecsP50 != nil { return false } else if that1.NetTcpRttMicrosecsP50 != nil { return false } if this.NetTcpRttMicrosecsP90 != nil && that1.NetTcpRttMicrosecsP90 != nil { if *this.NetTcpRttMicrosecsP90 != *that1.NetTcpRttMicrosecsP90 { return false } } else if this.NetTcpRttMicrosecsP90 != nil { return false } else if that1.NetTcpRttMicrosecsP90 != nil { return false } if this.NetTcpRttMicrosecsP95 != nil && that1.NetTcpRttMicrosecsP95 != nil { if *this.NetTcpRttMicrosecsP95 != *that1.NetTcpRttMicrosecsP95 { return false } } else if this.NetTcpRttMicrosecsP95 != nil { return false } else if that1.NetTcpRttMicrosecsP95 != nil { return false } if this.NetTcpRttMicrosecsP99 != nil && that1.NetTcpRttMicrosecsP99 != nil { if *this.NetTcpRttMicrosecsP99 != *that1.NetTcpRttMicrosecsP99 { return false } } else if this.NetTcpRttMicrosecsP99 != nil { return false } else if that1.NetTcpRttMicrosecsP99 != nil { return false } if this.NetTcpActiveConnections != nil && that1.NetTcpActiveConnections != nil { if *this.NetTcpActiveConnections != *that1.NetTcpActiveConnections { return false } } else if this.NetTcpActiveConnections != nil { return false } else if that1.NetTcpActiveConnections != nil { return false } if this.NetTcpTimeWaitConnections != nil && that1.NetTcpTimeWaitConnections != nil { if *this.NetTcpTimeWaitConnections != *that1.NetTcpTimeWaitConnections { return false } } else if this.NetTcpTimeWaitConnections != nil { return false } else if that1.NetTcpTimeWaitConnections != nil { return false } if len(this.NetTrafficControlStatistics) != len(that1.NetTrafficControlStatistics) { return false } for i := range this.NetTrafficControlStatistics { if !this.NetTrafficControlStatistics[i].Equal(that1.NetTrafficControlStatistics[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ResourceUsage) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ResourceUsage) if !ok { return fmt.Errorf("that is not of type *ResourceUsage") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ResourceUsage but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ResourceUsagebut is not nil && this == nil") } if len(this.Executors) != len(that1.Executors) { return fmt.Errorf("Executors this(%v) Not Equal that(%v)", len(this.Executors), len(that1.Executors)) } for i := range this.Executors { if !this.Executors[i].Equal(that1.Executors[i]) { return fmt.Errorf("Executors this[%v](%v) Not Equal that[%v](%v)", i, this.Executors[i], i, that1.Executors[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ResourceUsage) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ResourceUsage) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Executors) != len(that1.Executors) { return false } for i := range this.Executors { if !this.Executors[i].Equal(that1.Executors[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ResourceUsage_Executor) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ResourceUsage_Executor) if !ok { return fmt.Errorf("that is not of type *ResourceUsage_Executor") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ResourceUsage_Executor but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ResourceUsage_Executorbut is not nil && this == nil") } if !this.ExecutorInfo.Equal(that1.ExecutorInfo) { return fmt.Errorf("ExecutorInfo this(%v) Not Equal that(%v)", this.ExecutorInfo, that1.ExecutorInfo) } if len(this.Allocated) != len(that1.Allocated) { return fmt.Errorf("Allocated this(%v) Not Equal that(%v)", len(this.Allocated), len(that1.Allocated)) } for i := range this.Allocated { if !this.Allocated[i].Equal(that1.Allocated[i]) { return fmt.Errorf("Allocated this[%v](%v) Not Equal that[%v](%v)", i, this.Allocated[i], i, that1.Allocated[i]) } } if !this.Statistics.Equal(that1.Statistics) { return fmt.Errorf("Statistics this(%v) Not Equal that(%v)", this.Statistics, that1.Statistics) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ResourceUsage_Executor) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ResourceUsage_Executor) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.ExecutorInfo.Equal(that1.ExecutorInfo) { return false } if len(this.Allocated) != len(that1.Allocated) { return false } for i := range this.Allocated { if !this.Allocated[i].Equal(that1.Allocated[i]) { return false } } if !this.Statistics.Equal(that1.Statistics) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *PerfStatistics) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*PerfStatistics) if !ok { return fmt.Errorf("that is not of type *PerfStatistics") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *PerfStatistics but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *PerfStatisticsbut is not nil && this == nil") } if this.Timestamp != nil && that1.Timestamp != nil { if *this.Timestamp != *that1.Timestamp { return fmt.Errorf("Timestamp this(%v) Not Equal that(%v)", *this.Timestamp, *that1.Timestamp) } } else if this.Timestamp != nil { return fmt.Errorf("this.Timestamp == nil && that.Timestamp != nil") } else if that1.Timestamp != nil { return fmt.Errorf("Timestamp this(%v) Not Equal that(%v)", this.Timestamp, that1.Timestamp) } if this.Duration != nil && that1.Duration != nil { if *this.Duration != *that1.Duration { return fmt.Errorf("Duration this(%v) Not Equal that(%v)", *this.Duration, *that1.Duration) } } else if this.Duration != nil { return fmt.Errorf("this.Duration == nil && that.Duration != nil") } else if that1.Duration != nil { return fmt.Errorf("Duration this(%v) Not Equal that(%v)", this.Duration, that1.Duration) } if this.Cycles != nil && that1.Cycles != nil { if *this.Cycles != *that1.Cycles { return fmt.Errorf("Cycles this(%v) Not Equal that(%v)", *this.Cycles, *that1.Cycles) } } else if this.Cycles != nil { return fmt.Errorf("this.Cycles == nil && that.Cycles != nil") } else if that1.Cycles != nil { return fmt.Errorf("Cycles this(%v) Not Equal that(%v)", this.Cycles, that1.Cycles) } if this.StalledCyclesFrontend != nil && that1.StalledCyclesFrontend != nil { if *this.StalledCyclesFrontend != *that1.StalledCyclesFrontend { return fmt.Errorf("StalledCyclesFrontend this(%v) Not Equal that(%v)", *this.StalledCyclesFrontend, *that1.StalledCyclesFrontend) } } else if this.StalledCyclesFrontend != nil { return fmt.Errorf("this.StalledCyclesFrontend == nil && that.StalledCyclesFrontend != nil") } else if that1.StalledCyclesFrontend != nil { return fmt.Errorf("StalledCyclesFrontend this(%v) Not Equal that(%v)", this.StalledCyclesFrontend, that1.StalledCyclesFrontend) } if this.StalledCyclesBackend != nil && that1.StalledCyclesBackend != nil { if *this.StalledCyclesBackend != *that1.StalledCyclesBackend { return fmt.Errorf("StalledCyclesBackend this(%v) Not Equal that(%v)", *this.StalledCyclesBackend, *that1.StalledCyclesBackend) } } else if this.StalledCyclesBackend != nil { return fmt.Errorf("this.StalledCyclesBackend == nil && that.StalledCyclesBackend != nil") } else if that1.StalledCyclesBackend != nil { return fmt.Errorf("StalledCyclesBackend this(%v) Not Equal that(%v)", this.StalledCyclesBackend, that1.StalledCyclesBackend) } if this.Instructions != nil && that1.Instructions != nil { if *this.Instructions != *that1.Instructions { return fmt.Errorf("Instructions this(%v) Not Equal that(%v)", *this.Instructions, *that1.Instructions) } } else if this.Instructions != nil { return fmt.Errorf("this.Instructions == nil && that.Instructions != nil") } else if that1.Instructions != nil { return fmt.Errorf("Instructions this(%v) Not Equal that(%v)", this.Instructions, that1.Instructions) } if this.CacheReferences != nil && that1.CacheReferences != nil { if *this.CacheReferences != *that1.CacheReferences { return fmt.Errorf("CacheReferences this(%v) Not Equal that(%v)", *this.CacheReferences, *that1.CacheReferences) } } else if this.CacheReferences != nil { return fmt.Errorf("this.CacheReferences == nil && that.CacheReferences != nil") } else if that1.CacheReferences != nil { return fmt.Errorf("CacheReferences this(%v) Not Equal that(%v)", this.CacheReferences, that1.CacheReferences) } if this.CacheMisses != nil && that1.CacheMisses != nil { if *this.CacheMisses != *that1.CacheMisses { return fmt.Errorf("CacheMisses this(%v) Not Equal that(%v)", *this.CacheMisses, *that1.CacheMisses) } } else if this.CacheMisses != nil { return fmt.Errorf("this.CacheMisses == nil && that.CacheMisses != nil") } else if that1.CacheMisses != nil { return fmt.Errorf("CacheMisses this(%v) Not Equal that(%v)", this.CacheMisses, that1.CacheMisses) } if this.Branches != nil && that1.Branches != nil { if *this.Branches != *that1.Branches { return fmt.Errorf("Branches this(%v) Not Equal that(%v)", *this.Branches, *that1.Branches) } } else if this.Branches != nil { return fmt.Errorf("this.Branches == nil && that.Branches != nil") } else if that1.Branches != nil { return fmt.Errorf("Branches this(%v) Not Equal that(%v)", this.Branches, that1.Branches) } if this.BranchMisses != nil && that1.BranchMisses != nil { if *this.BranchMisses != *that1.BranchMisses { return fmt.Errorf("BranchMisses this(%v) Not Equal that(%v)", *this.BranchMisses, *that1.BranchMisses) } } else if this.BranchMisses != nil { return fmt.Errorf("this.BranchMisses == nil && that.BranchMisses != nil") } else if that1.BranchMisses != nil { return fmt.Errorf("BranchMisses this(%v) Not Equal that(%v)", this.BranchMisses, that1.BranchMisses) } if this.BusCycles != nil && that1.BusCycles != nil { if *this.BusCycles != *that1.BusCycles { return fmt.Errorf("BusCycles this(%v) Not Equal that(%v)", *this.BusCycles, *that1.BusCycles) } } else if this.BusCycles != nil { return fmt.Errorf("this.BusCycles == nil && that.BusCycles != nil") } else if that1.BusCycles != nil { return fmt.Errorf("BusCycles this(%v) Not Equal that(%v)", this.BusCycles, that1.BusCycles) } if this.RefCycles != nil && that1.RefCycles != nil { if *this.RefCycles != *that1.RefCycles { return fmt.Errorf("RefCycles this(%v) Not Equal that(%v)", *this.RefCycles, *that1.RefCycles) } } else if this.RefCycles != nil { return fmt.Errorf("this.RefCycles == nil && that.RefCycles != nil") } else if that1.RefCycles != nil { return fmt.Errorf("RefCycles this(%v) Not Equal that(%v)", this.RefCycles, that1.RefCycles) } if this.CpuClock != nil && that1.CpuClock != nil { if *this.CpuClock != *that1.CpuClock { return fmt.Errorf("CpuClock this(%v) Not Equal that(%v)", *this.CpuClock, *that1.CpuClock) } } else if this.CpuClock != nil { return fmt.Errorf("this.CpuClock == nil && that.CpuClock != nil") } else if that1.CpuClock != nil { return fmt.Errorf("CpuClock this(%v) Not Equal that(%v)", this.CpuClock, that1.CpuClock) } if this.TaskClock != nil && that1.TaskClock != nil { if *this.TaskClock != *that1.TaskClock { return fmt.Errorf("TaskClock this(%v) Not Equal that(%v)", *this.TaskClock, *that1.TaskClock) } } else if this.TaskClock != nil { return fmt.Errorf("this.TaskClock == nil && that.TaskClock != nil") } else if that1.TaskClock != nil { return fmt.Errorf("TaskClock this(%v) Not Equal that(%v)", this.TaskClock, that1.TaskClock) } if this.PageFaults != nil && that1.PageFaults != nil { if *this.PageFaults != *that1.PageFaults { return fmt.Errorf("PageFaults this(%v) Not Equal that(%v)", *this.PageFaults, *that1.PageFaults) } } else if this.PageFaults != nil { return fmt.Errorf("this.PageFaults == nil && that.PageFaults != nil") } else if that1.PageFaults != nil { return fmt.Errorf("PageFaults this(%v) Not Equal that(%v)", this.PageFaults, that1.PageFaults) } if this.MinorFaults != nil && that1.MinorFaults != nil { if *this.MinorFaults != *that1.MinorFaults { return fmt.Errorf("MinorFaults this(%v) Not Equal that(%v)", *this.MinorFaults, *that1.MinorFaults) } } else if this.MinorFaults != nil { return fmt.Errorf("this.MinorFaults == nil && that.MinorFaults != nil") } else if that1.MinorFaults != nil { return fmt.Errorf("MinorFaults this(%v) Not Equal that(%v)", this.MinorFaults, that1.MinorFaults) } if this.MajorFaults != nil && that1.MajorFaults != nil { if *this.MajorFaults != *that1.MajorFaults { return fmt.Errorf("MajorFaults this(%v) Not Equal that(%v)", *this.MajorFaults, *that1.MajorFaults) } } else if this.MajorFaults != nil { return fmt.Errorf("this.MajorFaults == nil && that.MajorFaults != nil") } else if that1.MajorFaults != nil { return fmt.Errorf("MajorFaults this(%v) Not Equal that(%v)", this.MajorFaults, that1.MajorFaults) } if this.ContextSwitches != nil && that1.ContextSwitches != nil { if *this.ContextSwitches != *that1.ContextSwitches { return fmt.Errorf("ContextSwitches this(%v) Not Equal that(%v)", *this.ContextSwitches, *that1.ContextSwitches) } } else if this.ContextSwitches != nil { return fmt.Errorf("this.ContextSwitches == nil && that.ContextSwitches != nil") } else if that1.ContextSwitches != nil { return fmt.Errorf("ContextSwitches this(%v) Not Equal that(%v)", this.ContextSwitches, that1.ContextSwitches) } if this.CpuMigrations != nil && that1.CpuMigrations != nil { if *this.CpuMigrations != *that1.CpuMigrations { return fmt.Errorf("CpuMigrations this(%v) Not Equal that(%v)", *this.CpuMigrations, *that1.CpuMigrations) } } else if this.CpuMigrations != nil { return fmt.Errorf("this.CpuMigrations == nil && that.CpuMigrations != nil") } else if that1.CpuMigrations != nil { return fmt.Errorf("CpuMigrations this(%v) Not Equal that(%v)", this.CpuMigrations, that1.CpuMigrations) } if this.AlignmentFaults != nil && that1.AlignmentFaults != nil { if *this.AlignmentFaults != *that1.AlignmentFaults { return fmt.Errorf("AlignmentFaults this(%v) Not Equal that(%v)", *this.AlignmentFaults, *that1.AlignmentFaults) } } else if this.AlignmentFaults != nil { return fmt.Errorf("this.AlignmentFaults == nil && that.AlignmentFaults != nil") } else if that1.AlignmentFaults != nil { return fmt.Errorf("AlignmentFaults this(%v) Not Equal that(%v)", this.AlignmentFaults, that1.AlignmentFaults) } if this.EmulationFaults != nil && that1.EmulationFaults != nil { if *this.EmulationFaults != *that1.EmulationFaults { return fmt.Errorf("EmulationFaults this(%v) Not Equal that(%v)", *this.EmulationFaults, *that1.EmulationFaults) } } else if this.EmulationFaults != nil { return fmt.Errorf("this.EmulationFaults == nil && that.EmulationFaults != nil") } else if that1.EmulationFaults != nil { return fmt.Errorf("EmulationFaults this(%v) Not Equal that(%v)", this.EmulationFaults, that1.EmulationFaults) } if this.L1DcacheLoads != nil && that1.L1DcacheLoads != nil { if *this.L1DcacheLoads != *that1.L1DcacheLoads { return fmt.Errorf("L1DcacheLoads this(%v) Not Equal that(%v)", *this.L1DcacheLoads, *that1.L1DcacheLoads) } } else if this.L1DcacheLoads != nil { return fmt.Errorf("this.L1DcacheLoads == nil && that.L1DcacheLoads != nil") } else if that1.L1DcacheLoads != nil { return fmt.Errorf("L1DcacheLoads this(%v) Not Equal that(%v)", this.L1DcacheLoads, that1.L1DcacheLoads) } if this.L1DcacheLoadMisses != nil && that1.L1DcacheLoadMisses != nil { if *this.L1DcacheLoadMisses != *that1.L1DcacheLoadMisses { return fmt.Errorf("L1DcacheLoadMisses this(%v) Not Equal that(%v)", *this.L1DcacheLoadMisses, *that1.L1DcacheLoadMisses) } } else if this.L1DcacheLoadMisses != nil { return fmt.Errorf("this.L1DcacheLoadMisses == nil && that.L1DcacheLoadMisses != nil") } else if that1.L1DcacheLoadMisses != nil { return fmt.Errorf("L1DcacheLoadMisses this(%v) Not Equal that(%v)", this.L1DcacheLoadMisses, that1.L1DcacheLoadMisses) } if this.L1DcacheStores != nil && that1.L1DcacheStores != nil { if *this.L1DcacheStores != *that1.L1DcacheStores { return fmt.Errorf("L1DcacheStores this(%v) Not Equal that(%v)", *this.L1DcacheStores, *that1.L1DcacheStores) } } else if this.L1DcacheStores != nil { return fmt.Errorf("this.L1DcacheStores == nil && that.L1DcacheStores != nil") } else if that1.L1DcacheStores != nil { return fmt.Errorf("L1DcacheStores this(%v) Not Equal that(%v)", this.L1DcacheStores, that1.L1DcacheStores) } if this.L1DcacheStoreMisses != nil && that1.L1DcacheStoreMisses != nil { if *this.L1DcacheStoreMisses != *that1.L1DcacheStoreMisses { return fmt.Errorf("L1DcacheStoreMisses this(%v) Not Equal that(%v)", *this.L1DcacheStoreMisses, *that1.L1DcacheStoreMisses) } } else if this.L1DcacheStoreMisses != nil { return fmt.Errorf("this.L1DcacheStoreMisses == nil && that.L1DcacheStoreMisses != nil") } else if that1.L1DcacheStoreMisses != nil { return fmt.Errorf("L1DcacheStoreMisses this(%v) Not Equal that(%v)", this.L1DcacheStoreMisses, that1.L1DcacheStoreMisses) } if this.L1DcachePrefetches != nil && that1.L1DcachePrefetches != nil { if *this.L1DcachePrefetches != *that1.L1DcachePrefetches { return fmt.Errorf("L1DcachePrefetches this(%v) Not Equal that(%v)", *this.L1DcachePrefetches, *that1.L1DcachePrefetches) } } else if this.L1DcachePrefetches != nil { return fmt.Errorf("this.L1DcachePrefetches == nil && that.L1DcachePrefetches != nil") } else if that1.L1DcachePrefetches != nil { return fmt.Errorf("L1DcachePrefetches this(%v) Not Equal that(%v)", this.L1DcachePrefetches, that1.L1DcachePrefetches) } if this.L1DcachePrefetchMisses != nil && that1.L1DcachePrefetchMisses != nil { if *this.L1DcachePrefetchMisses != *that1.L1DcachePrefetchMisses { return fmt.Errorf("L1DcachePrefetchMisses this(%v) Not Equal that(%v)", *this.L1DcachePrefetchMisses, *that1.L1DcachePrefetchMisses) } } else if this.L1DcachePrefetchMisses != nil { return fmt.Errorf("this.L1DcachePrefetchMisses == nil && that.L1DcachePrefetchMisses != nil") } else if that1.L1DcachePrefetchMisses != nil { return fmt.Errorf("L1DcachePrefetchMisses this(%v) Not Equal that(%v)", this.L1DcachePrefetchMisses, that1.L1DcachePrefetchMisses) } if this.L1IcacheLoads != nil && that1.L1IcacheLoads != nil { if *this.L1IcacheLoads != *that1.L1IcacheLoads { return fmt.Errorf("L1IcacheLoads this(%v) Not Equal that(%v)", *this.L1IcacheLoads, *that1.L1IcacheLoads) } } else if this.L1IcacheLoads != nil { return fmt.Errorf("this.L1IcacheLoads == nil && that.L1IcacheLoads != nil") } else if that1.L1IcacheLoads != nil { return fmt.Errorf("L1IcacheLoads this(%v) Not Equal that(%v)", this.L1IcacheLoads, that1.L1IcacheLoads) } if this.L1IcacheLoadMisses != nil && that1.L1IcacheLoadMisses != nil { if *this.L1IcacheLoadMisses != *that1.L1IcacheLoadMisses { return fmt.Errorf("L1IcacheLoadMisses this(%v) Not Equal that(%v)", *this.L1IcacheLoadMisses, *that1.L1IcacheLoadMisses) } } else if this.L1IcacheLoadMisses != nil { return fmt.Errorf("this.L1IcacheLoadMisses == nil && that.L1IcacheLoadMisses != nil") } else if that1.L1IcacheLoadMisses != nil { return fmt.Errorf("L1IcacheLoadMisses this(%v) Not Equal that(%v)", this.L1IcacheLoadMisses, that1.L1IcacheLoadMisses) } if this.L1IcachePrefetches != nil && that1.L1IcachePrefetches != nil { if *this.L1IcachePrefetches != *that1.L1IcachePrefetches { return fmt.Errorf("L1IcachePrefetches this(%v) Not Equal that(%v)", *this.L1IcachePrefetches, *that1.L1IcachePrefetches) } } else if this.L1IcachePrefetches != nil { return fmt.Errorf("this.L1IcachePrefetches == nil && that.L1IcachePrefetches != nil") } else if that1.L1IcachePrefetches != nil { return fmt.Errorf("L1IcachePrefetches this(%v) Not Equal that(%v)", this.L1IcachePrefetches, that1.L1IcachePrefetches) } if this.L1IcachePrefetchMisses != nil && that1.L1IcachePrefetchMisses != nil { if *this.L1IcachePrefetchMisses != *that1.L1IcachePrefetchMisses { return fmt.Errorf("L1IcachePrefetchMisses this(%v) Not Equal that(%v)", *this.L1IcachePrefetchMisses, *that1.L1IcachePrefetchMisses) } } else if this.L1IcachePrefetchMisses != nil { return fmt.Errorf("this.L1IcachePrefetchMisses == nil && that.L1IcachePrefetchMisses != nil") } else if that1.L1IcachePrefetchMisses != nil { return fmt.Errorf("L1IcachePrefetchMisses this(%v) Not Equal that(%v)", this.L1IcachePrefetchMisses, that1.L1IcachePrefetchMisses) } if this.LlcLoads != nil && that1.LlcLoads != nil { if *this.LlcLoads != *that1.LlcLoads { return fmt.Errorf("LlcLoads this(%v) Not Equal that(%v)", *this.LlcLoads, *that1.LlcLoads) } } else if this.LlcLoads != nil { return fmt.Errorf("this.LlcLoads == nil && that.LlcLoads != nil") } else if that1.LlcLoads != nil { return fmt.Errorf("LlcLoads this(%v) Not Equal that(%v)", this.LlcLoads, that1.LlcLoads) } if this.LlcLoadMisses != nil && that1.LlcLoadMisses != nil { if *this.LlcLoadMisses != *that1.LlcLoadMisses { return fmt.Errorf("LlcLoadMisses this(%v) Not Equal that(%v)", *this.LlcLoadMisses, *that1.LlcLoadMisses) } } else if this.LlcLoadMisses != nil { return fmt.Errorf("this.LlcLoadMisses == nil && that.LlcLoadMisses != nil") } else if that1.LlcLoadMisses != nil { return fmt.Errorf("LlcLoadMisses this(%v) Not Equal that(%v)", this.LlcLoadMisses, that1.LlcLoadMisses) } if this.LlcStores != nil && that1.LlcStores != nil { if *this.LlcStores != *that1.LlcStores { return fmt.Errorf("LlcStores this(%v) Not Equal that(%v)", *this.LlcStores, *that1.LlcStores) } } else if this.LlcStores != nil { return fmt.Errorf("this.LlcStores == nil && that.LlcStores != nil") } else if that1.LlcStores != nil { return fmt.Errorf("LlcStores this(%v) Not Equal that(%v)", this.LlcStores, that1.LlcStores) } if this.LlcStoreMisses != nil && that1.LlcStoreMisses != nil { if *this.LlcStoreMisses != *that1.LlcStoreMisses { return fmt.Errorf("LlcStoreMisses this(%v) Not Equal that(%v)", *this.LlcStoreMisses, *that1.LlcStoreMisses) } } else if this.LlcStoreMisses != nil { return fmt.Errorf("this.LlcStoreMisses == nil && that.LlcStoreMisses != nil") } else if that1.LlcStoreMisses != nil { return fmt.Errorf("LlcStoreMisses this(%v) Not Equal that(%v)", this.LlcStoreMisses, that1.LlcStoreMisses) } if this.LlcPrefetches != nil && that1.LlcPrefetches != nil { if *this.LlcPrefetches != *that1.LlcPrefetches { return fmt.Errorf("LlcPrefetches this(%v) Not Equal that(%v)", *this.LlcPrefetches, *that1.LlcPrefetches) } } else if this.LlcPrefetches != nil { return fmt.Errorf("this.LlcPrefetches == nil && that.LlcPrefetches != nil") } else if that1.LlcPrefetches != nil { return fmt.Errorf("LlcPrefetches this(%v) Not Equal that(%v)", this.LlcPrefetches, that1.LlcPrefetches) } if this.LlcPrefetchMisses != nil && that1.LlcPrefetchMisses != nil { if *this.LlcPrefetchMisses != *that1.LlcPrefetchMisses { return fmt.Errorf("LlcPrefetchMisses this(%v) Not Equal that(%v)", *this.LlcPrefetchMisses, *that1.LlcPrefetchMisses) } } else if this.LlcPrefetchMisses != nil { return fmt.Errorf("this.LlcPrefetchMisses == nil && that.LlcPrefetchMisses != nil") } else if that1.LlcPrefetchMisses != nil { return fmt.Errorf("LlcPrefetchMisses this(%v) Not Equal that(%v)", this.LlcPrefetchMisses, that1.LlcPrefetchMisses) } if this.DtlbLoads != nil && that1.DtlbLoads != nil { if *this.DtlbLoads != *that1.DtlbLoads { return fmt.Errorf("DtlbLoads this(%v) Not Equal that(%v)", *this.DtlbLoads, *that1.DtlbLoads) } } else if this.DtlbLoads != nil { return fmt.Errorf("this.DtlbLoads == nil && that.DtlbLoads != nil") } else if that1.DtlbLoads != nil { return fmt.Errorf("DtlbLoads this(%v) Not Equal that(%v)", this.DtlbLoads, that1.DtlbLoads) } if this.DtlbLoadMisses != nil && that1.DtlbLoadMisses != nil { if *this.DtlbLoadMisses != *that1.DtlbLoadMisses { return fmt.Errorf("DtlbLoadMisses this(%v) Not Equal that(%v)", *this.DtlbLoadMisses, *that1.DtlbLoadMisses) } } else if this.DtlbLoadMisses != nil { return fmt.Errorf("this.DtlbLoadMisses == nil && that.DtlbLoadMisses != nil") } else if that1.DtlbLoadMisses != nil { return fmt.Errorf("DtlbLoadMisses this(%v) Not Equal that(%v)", this.DtlbLoadMisses, that1.DtlbLoadMisses) } if this.DtlbStores != nil && that1.DtlbStores != nil { if *this.DtlbStores != *that1.DtlbStores { return fmt.Errorf("DtlbStores this(%v) Not Equal that(%v)", *this.DtlbStores, *that1.DtlbStores) } } else if this.DtlbStores != nil { return fmt.Errorf("this.DtlbStores == nil && that.DtlbStores != nil") } else if that1.DtlbStores != nil { return fmt.Errorf("DtlbStores this(%v) Not Equal that(%v)", this.DtlbStores, that1.DtlbStores) } if this.DtlbStoreMisses != nil && that1.DtlbStoreMisses != nil { if *this.DtlbStoreMisses != *that1.DtlbStoreMisses { return fmt.Errorf("DtlbStoreMisses this(%v) Not Equal that(%v)", *this.DtlbStoreMisses, *that1.DtlbStoreMisses) } } else if this.DtlbStoreMisses != nil { return fmt.Errorf("this.DtlbStoreMisses == nil && that.DtlbStoreMisses != nil") } else if that1.DtlbStoreMisses != nil { return fmt.Errorf("DtlbStoreMisses this(%v) Not Equal that(%v)", this.DtlbStoreMisses, that1.DtlbStoreMisses) } if this.DtlbPrefetches != nil && that1.DtlbPrefetches != nil { if *this.DtlbPrefetches != *that1.DtlbPrefetches { return fmt.Errorf("DtlbPrefetches this(%v) Not Equal that(%v)", *this.DtlbPrefetches, *that1.DtlbPrefetches) } } else if this.DtlbPrefetches != nil { return fmt.Errorf("this.DtlbPrefetches == nil && that.DtlbPrefetches != nil") } else if that1.DtlbPrefetches != nil { return fmt.Errorf("DtlbPrefetches this(%v) Not Equal that(%v)", this.DtlbPrefetches, that1.DtlbPrefetches) } if this.DtlbPrefetchMisses != nil && that1.DtlbPrefetchMisses != nil { if *this.DtlbPrefetchMisses != *that1.DtlbPrefetchMisses { return fmt.Errorf("DtlbPrefetchMisses this(%v) Not Equal that(%v)", *this.DtlbPrefetchMisses, *that1.DtlbPrefetchMisses) } } else if this.DtlbPrefetchMisses != nil { return fmt.Errorf("this.DtlbPrefetchMisses == nil && that.DtlbPrefetchMisses != nil") } else if that1.DtlbPrefetchMisses != nil { return fmt.Errorf("DtlbPrefetchMisses this(%v) Not Equal that(%v)", this.DtlbPrefetchMisses, that1.DtlbPrefetchMisses) } if this.ItlbLoads != nil && that1.ItlbLoads != nil { if *this.ItlbLoads != *that1.ItlbLoads { return fmt.Errorf("ItlbLoads this(%v) Not Equal that(%v)", *this.ItlbLoads, *that1.ItlbLoads) } } else if this.ItlbLoads != nil { return fmt.Errorf("this.ItlbLoads == nil && that.ItlbLoads != nil") } else if that1.ItlbLoads != nil { return fmt.Errorf("ItlbLoads this(%v) Not Equal that(%v)", this.ItlbLoads, that1.ItlbLoads) } if this.ItlbLoadMisses != nil && that1.ItlbLoadMisses != nil { if *this.ItlbLoadMisses != *that1.ItlbLoadMisses { return fmt.Errorf("ItlbLoadMisses this(%v) Not Equal that(%v)", *this.ItlbLoadMisses, *that1.ItlbLoadMisses) } } else if this.ItlbLoadMisses != nil { return fmt.Errorf("this.ItlbLoadMisses == nil && that.ItlbLoadMisses != nil") } else if that1.ItlbLoadMisses != nil { return fmt.Errorf("ItlbLoadMisses this(%v) Not Equal that(%v)", this.ItlbLoadMisses, that1.ItlbLoadMisses) } if this.BranchLoads != nil && that1.BranchLoads != nil { if *this.BranchLoads != *that1.BranchLoads { return fmt.Errorf("BranchLoads this(%v) Not Equal that(%v)", *this.BranchLoads, *that1.BranchLoads) } } else if this.BranchLoads != nil { return fmt.Errorf("this.BranchLoads == nil && that.BranchLoads != nil") } else if that1.BranchLoads != nil { return fmt.Errorf("BranchLoads this(%v) Not Equal that(%v)", this.BranchLoads, that1.BranchLoads) } if this.BranchLoadMisses != nil && that1.BranchLoadMisses != nil { if *this.BranchLoadMisses != *that1.BranchLoadMisses { return fmt.Errorf("BranchLoadMisses this(%v) Not Equal that(%v)", *this.BranchLoadMisses, *that1.BranchLoadMisses) } } else if this.BranchLoadMisses != nil { return fmt.Errorf("this.BranchLoadMisses == nil && that.BranchLoadMisses != nil") } else if that1.BranchLoadMisses != nil { return fmt.Errorf("BranchLoadMisses this(%v) Not Equal that(%v)", this.BranchLoadMisses, that1.BranchLoadMisses) } if this.NodeLoads != nil && that1.NodeLoads != nil { if *this.NodeLoads != *that1.NodeLoads { return fmt.Errorf("NodeLoads this(%v) Not Equal that(%v)", *this.NodeLoads, *that1.NodeLoads) } } else if this.NodeLoads != nil { return fmt.Errorf("this.NodeLoads == nil && that.NodeLoads != nil") } else if that1.NodeLoads != nil { return fmt.Errorf("NodeLoads this(%v) Not Equal that(%v)", this.NodeLoads, that1.NodeLoads) } if this.NodeLoadMisses != nil && that1.NodeLoadMisses != nil { if *this.NodeLoadMisses != *that1.NodeLoadMisses { return fmt.Errorf("NodeLoadMisses this(%v) Not Equal that(%v)", *this.NodeLoadMisses, *that1.NodeLoadMisses) } } else if this.NodeLoadMisses != nil { return fmt.Errorf("this.NodeLoadMisses == nil && that.NodeLoadMisses != nil") } else if that1.NodeLoadMisses != nil { return fmt.Errorf("NodeLoadMisses this(%v) Not Equal that(%v)", this.NodeLoadMisses, that1.NodeLoadMisses) } if this.NodeStores != nil && that1.NodeStores != nil { if *this.NodeStores != *that1.NodeStores { return fmt.Errorf("NodeStores this(%v) Not Equal that(%v)", *this.NodeStores, *that1.NodeStores) } } else if this.NodeStores != nil { return fmt.Errorf("this.NodeStores == nil && that.NodeStores != nil") } else if that1.NodeStores != nil { return fmt.Errorf("NodeStores this(%v) Not Equal that(%v)", this.NodeStores, that1.NodeStores) } if this.NodeStoreMisses != nil && that1.NodeStoreMisses != nil { if *this.NodeStoreMisses != *that1.NodeStoreMisses { return fmt.Errorf("NodeStoreMisses this(%v) Not Equal that(%v)", *this.NodeStoreMisses, *that1.NodeStoreMisses) } } else if this.NodeStoreMisses != nil { return fmt.Errorf("this.NodeStoreMisses == nil && that.NodeStoreMisses != nil") } else if that1.NodeStoreMisses != nil { return fmt.Errorf("NodeStoreMisses this(%v) Not Equal that(%v)", this.NodeStoreMisses, that1.NodeStoreMisses) } if this.NodePrefetches != nil && that1.NodePrefetches != nil { if *this.NodePrefetches != *that1.NodePrefetches { return fmt.Errorf("NodePrefetches this(%v) Not Equal that(%v)", *this.NodePrefetches, *that1.NodePrefetches) } } else if this.NodePrefetches != nil { return fmt.Errorf("this.NodePrefetches == nil && that.NodePrefetches != nil") } else if that1.NodePrefetches != nil { return fmt.Errorf("NodePrefetches this(%v) Not Equal that(%v)", this.NodePrefetches, that1.NodePrefetches) } if this.NodePrefetchMisses != nil && that1.NodePrefetchMisses != nil { if *this.NodePrefetchMisses != *that1.NodePrefetchMisses { return fmt.Errorf("NodePrefetchMisses this(%v) Not Equal that(%v)", *this.NodePrefetchMisses, *that1.NodePrefetchMisses) } } else if this.NodePrefetchMisses != nil { return fmt.Errorf("this.NodePrefetchMisses == nil && that.NodePrefetchMisses != nil") } else if that1.NodePrefetchMisses != nil { return fmt.Errorf("NodePrefetchMisses this(%v) Not Equal that(%v)", this.NodePrefetchMisses, that1.NodePrefetchMisses) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *PerfStatistics) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*PerfStatistics) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Timestamp != nil && that1.Timestamp != nil { if *this.Timestamp != *that1.Timestamp { return false } } else if this.Timestamp != nil { return false } else if that1.Timestamp != nil { return false } if this.Duration != nil && that1.Duration != nil { if *this.Duration != *that1.Duration { return false } } else if this.Duration != nil { return false } else if that1.Duration != nil { return false } if this.Cycles != nil && that1.Cycles != nil { if *this.Cycles != *that1.Cycles { return false } } else if this.Cycles != nil { return false } else if that1.Cycles != nil { return false } if this.StalledCyclesFrontend != nil && that1.StalledCyclesFrontend != nil { if *this.StalledCyclesFrontend != *that1.StalledCyclesFrontend { return false } } else if this.StalledCyclesFrontend != nil { return false } else if that1.StalledCyclesFrontend != nil { return false } if this.StalledCyclesBackend != nil && that1.StalledCyclesBackend != nil { if *this.StalledCyclesBackend != *that1.StalledCyclesBackend { return false } } else if this.StalledCyclesBackend != nil { return false } else if that1.StalledCyclesBackend != nil { return false } if this.Instructions != nil && that1.Instructions != nil { if *this.Instructions != *that1.Instructions { return false } } else if this.Instructions != nil { return false } else if that1.Instructions != nil { return false } if this.CacheReferences != nil && that1.CacheReferences != nil { if *this.CacheReferences != *that1.CacheReferences { return false } } else if this.CacheReferences != nil { return false } else if that1.CacheReferences != nil { return false } if this.CacheMisses != nil && that1.CacheMisses != nil { if *this.CacheMisses != *that1.CacheMisses { return false } } else if this.CacheMisses != nil { return false } else if that1.CacheMisses != nil { return false } if this.Branches != nil && that1.Branches != nil { if *this.Branches != *that1.Branches { return false } } else if this.Branches != nil { return false } else if that1.Branches != nil { return false } if this.BranchMisses != nil && that1.BranchMisses != nil { if *this.BranchMisses != *that1.BranchMisses { return false } } else if this.BranchMisses != nil { return false } else if that1.BranchMisses != nil { return false } if this.BusCycles != nil && that1.BusCycles != nil { if *this.BusCycles != *that1.BusCycles { return false } } else if this.BusCycles != nil { return false } else if that1.BusCycles != nil { return false } if this.RefCycles != nil && that1.RefCycles != nil { if *this.RefCycles != *that1.RefCycles { return false } } else if this.RefCycles != nil { return false } else if that1.RefCycles != nil { return false } if this.CpuClock != nil && that1.CpuClock != nil { if *this.CpuClock != *that1.CpuClock { return false } } else if this.CpuClock != nil { return false } else if that1.CpuClock != nil { return false } if this.TaskClock != nil && that1.TaskClock != nil { if *this.TaskClock != *that1.TaskClock { return false } } else if this.TaskClock != nil { return false } else if that1.TaskClock != nil { return false } if this.PageFaults != nil && that1.PageFaults != nil { if *this.PageFaults != *that1.PageFaults { return false } } else if this.PageFaults != nil { return false } else if that1.PageFaults != nil { return false } if this.MinorFaults != nil && that1.MinorFaults != nil { if *this.MinorFaults != *that1.MinorFaults { return false } } else if this.MinorFaults != nil { return false } else if that1.MinorFaults != nil { return false } if this.MajorFaults != nil && that1.MajorFaults != nil { if *this.MajorFaults != *that1.MajorFaults { return false } } else if this.MajorFaults != nil { return false } else if that1.MajorFaults != nil { return false } if this.ContextSwitches != nil && that1.ContextSwitches != nil { if *this.ContextSwitches != *that1.ContextSwitches { return false } } else if this.ContextSwitches != nil { return false } else if that1.ContextSwitches != nil { return false } if this.CpuMigrations != nil && that1.CpuMigrations != nil { if *this.CpuMigrations != *that1.CpuMigrations { return false } } else if this.CpuMigrations != nil { return false } else if that1.CpuMigrations != nil { return false } if this.AlignmentFaults != nil && that1.AlignmentFaults != nil { if *this.AlignmentFaults != *that1.AlignmentFaults { return false } } else if this.AlignmentFaults != nil { return false } else if that1.AlignmentFaults != nil { return false } if this.EmulationFaults != nil && that1.EmulationFaults != nil { if *this.EmulationFaults != *that1.EmulationFaults { return false } } else if this.EmulationFaults != nil { return false } else if that1.EmulationFaults != nil { return false } if this.L1DcacheLoads != nil && that1.L1DcacheLoads != nil { if *this.L1DcacheLoads != *that1.L1DcacheLoads { return false } } else if this.L1DcacheLoads != nil { return false } else if that1.L1DcacheLoads != nil { return false } if this.L1DcacheLoadMisses != nil && that1.L1DcacheLoadMisses != nil { if *this.L1DcacheLoadMisses != *that1.L1DcacheLoadMisses { return false } } else if this.L1DcacheLoadMisses != nil { return false } else if that1.L1DcacheLoadMisses != nil { return false } if this.L1DcacheStores != nil && that1.L1DcacheStores != nil { if *this.L1DcacheStores != *that1.L1DcacheStores { return false } } else if this.L1DcacheStores != nil { return false } else if that1.L1DcacheStores != nil { return false } if this.L1DcacheStoreMisses != nil && that1.L1DcacheStoreMisses != nil { if *this.L1DcacheStoreMisses != *that1.L1DcacheStoreMisses { return false } } else if this.L1DcacheStoreMisses != nil { return false } else if that1.L1DcacheStoreMisses != nil { return false } if this.L1DcachePrefetches != nil && that1.L1DcachePrefetches != nil { if *this.L1DcachePrefetches != *that1.L1DcachePrefetches { return false } } else if this.L1DcachePrefetches != nil { return false } else if that1.L1DcachePrefetches != nil { return false } if this.L1DcachePrefetchMisses != nil && that1.L1DcachePrefetchMisses != nil { if *this.L1DcachePrefetchMisses != *that1.L1DcachePrefetchMisses { return false } } else if this.L1DcachePrefetchMisses != nil { return false } else if that1.L1DcachePrefetchMisses != nil { return false } if this.L1IcacheLoads != nil && that1.L1IcacheLoads != nil { if *this.L1IcacheLoads != *that1.L1IcacheLoads { return false } } else if this.L1IcacheLoads != nil { return false } else if that1.L1IcacheLoads != nil { return false } if this.L1IcacheLoadMisses != nil && that1.L1IcacheLoadMisses != nil { if *this.L1IcacheLoadMisses != *that1.L1IcacheLoadMisses { return false } } else if this.L1IcacheLoadMisses != nil { return false } else if that1.L1IcacheLoadMisses != nil { return false } if this.L1IcachePrefetches != nil && that1.L1IcachePrefetches != nil { if *this.L1IcachePrefetches != *that1.L1IcachePrefetches { return false } } else if this.L1IcachePrefetches != nil { return false } else if that1.L1IcachePrefetches != nil { return false } if this.L1IcachePrefetchMisses != nil && that1.L1IcachePrefetchMisses != nil { if *this.L1IcachePrefetchMisses != *that1.L1IcachePrefetchMisses { return false } } else if this.L1IcachePrefetchMisses != nil { return false } else if that1.L1IcachePrefetchMisses != nil { return false } if this.LlcLoads != nil && that1.LlcLoads != nil { if *this.LlcLoads != *that1.LlcLoads { return false } } else if this.LlcLoads != nil { return false } else if that1.LlcLoads != nil { return false } if this.LlcLoadMisses != nil && that1.LlcLoadMisses != nil { if *this.LlcLoadMisses != *that1.LlcLoadMisses { return false } } else if this.LlcLoadMisses != nil { return false } else if that1.LlcLoadMisses != nil { return false } if this.LlcStores != nil && that1.LlcStores != nil { if *this.LlcStores != *that1.LlcStores { return false } } else if this.LlcStores != nil { return false } else if that1.LlcStores != nil { return false } if this.LlcStoreMisses != nil && that1.LlcStoreMisses != nil { if *this.LlcStoreMisses != *that1.LlcStoreMisses { return false } } else if this.LlcStoreMisses != nil { return false } else if that1.LlcStoreMisses != nil { return false } if this.LlcPrefetches != nil && that1.LlcPrefetches != nil { if *this.LlcPrefetches != *that1.LlcPrefetches { return false } } else if this.LlcPrefetches != nil { return false } else if that1.LlcPrefetches != nil { return false } if this.LlcPrefetchMisses != nil && that1.LlcPrefetchMisses != nil { if *this.LlcPrefetchMisses != *that1.LlcPrefetchMisses { return false } } else if this.LlcPrefetchMisses != nil { return false } else if that1.LlcPrefetchMisses != nil { return false } if this.DtlbLoads != nil && that1.DtlbLoads != nil { if *this.DtlbLoads != *that1.DtlbLoads { return false } } else if this.DtlbLoads != nil { return false } else if that1.DtlbLoads != nil { return false } if this.DtlbLoadMisses != nil && that1.DtlbLoadMisses != nil { if *this.DtlbLoadMisses != *that1.DtlbLoadMisses { return false } } else if this.DtlbLoadMisses != nil { return false } else if that1.DtlbLoadMisses != nil { return false } if this.DtlbStores != nil && that1.DtlbStores != nil { if *this.DtlbStores != *that1.DtlbStores { return false } } else if this.DtlbStores != nil { return false } else if that1.DtlbStores != nil { return false } if this.DtlbStoreMisses != nil && that1.DtlbStoreMisses != nil { if *this.DtlbStoreMisses != *that1.DtlbStoreMisses { return false } } else if this.DtlbStoreMisses != nil { return false } else if that1.DtlbStoreMisses != nil { return false } if this.DtlbPrefetches != nil && that1.DtlbPrefetches != nil { if *this.DtlbPrefetches != *that1.DtlbPrefetches { return false } } else if this.DtlbPrefetches != nil { return false } else if that1.DtlbPrefetches != nil { return false } if this.DtlbPrefetchMisses != nil && that1.DtlbPrefetchMisses != nil { if *this.DtlbPrefetchMisses != *that1.DtlbPrefetchMisses { return false } } else if this.DtlbPrefetchMisses != nil { return false } else if that1.DtlbPrefetchMisses != nil { return false } if this.ItlbLoads != nil && that1.ItlbLoads != nil { if *this.ItlbLoads != *that1.ItlbLoads { return false } } else if this.ItlbLoads != nil { return false } else if that1.ItlbLoads != nil { return false } if this.ItlbLoadMisses != nil && that1.ItlbLoadMisses != nil { if *this.ItlbLoadMisses != *that1.ItlbLoadMisses { return false } } else if this.ItlbLoadMisses != nil { return false } else if that1.ItlbLoadMisses != nil { return false } if this.BranchLoads != nil && that1.BranchLoads != nil { if *this.BranchLoads != *that1.BranchLoads { return false } } else if this.BranchLoads != nil { return false } else if that1.BranchLoads != nil { return false } if this.BranchLoadMisses != nil && that1.BranchLoadMisses != nil { if *this.BranchLoadMisses != *that1.BranchLoadMisses { return false } } else if this.BranchLoadMisses != nil { return false } else if that1.BranchLoadMisses != nil { return false } if this.NodeLoads != nil && that1.NodeLoads != nil { if *this.NodeLoads != *that1.NodeLoads { return false } } else if this.NodeLoads != nil { return false } else if that1.NodeLoads != nil { return false } if this.NodeLoadMisses != nil && that1.NodeLoadMisses != nil { if *this.NodeLoadMisses != *that1.NodeLoadMisses { return false } } else if this.NodeLoadMisses != nil { return false } else if that1.NodeLoadMisses != nil { return false } if this.NodeStores != nil && that1.NodeStores != nil { if *this.NodeStores != *that1.NodeStores { return false } } else if this.NodeStores != nil { return false } else if that1.NodeStores != nil { return false } if this.NodeStoreMisses != nil && that1.NodeStoreMisses != nil { if *this.NodeStoreMisses != *that1.NodeStoreMisses { return false } } else if this.NodeStoreMisses != nil { return false } else if that1.NodeStoreMisses != nil { return false } if this.NodePrefetches != nil && that1.NodePrefetches != nil { if *this.NodePrefetches != *that1.NodePrefetches { return false } } else if this.NodePrefetches != nil { return false } else if that1.NodePrefetches != nil { return false } if this.NodePrefetchMisses != nil && that1.NodePrefetchMisses != nil { if *this.NodePrefetchMisses != *that1.NodePrefetchMisses { return false } } else if this.NodePrefetchMisses != nil { return false } else if that1.NodePrefetchMisses != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Request) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Request) if !ok { return fmt.Errorf("that is not of type *Request") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Request but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Requestbut is not nil && this == nil") } if !this.SlaveId.Equal(that1.SlaveId) { return fmt.Errorf("SlaveId this(%v) Not Equal that(%v)", this.SlaveId, that1.SlaveId) } if len(this.Resources) != len(that1.Resources) { return fmt.Errorf("Resources this(%v) Not Equal that(%v)", len(this.Resources), len(that1.Resources)) } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return fmt.Errorf("Resources this[%v](%v) Not Equal that[%v](%v)", i, this.Resources[i], i, that1.Resources[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Request) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Request) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.SlaveId.Equal(that1.SlaveId) { return false } if len(this.Resources) != len(that1.Resources) { return false } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Offer) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Offer) if !ok { return fmt.Errorf("that is not of type *Offer") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Offer but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Offerbut is not nil && this == nil") } if !this.Id.Equal(that1.Id) { return fmt.Errorf("Id this(%v) Not Equal that(%v)", this.Id, that1.Id) } if !this.FrameworkId.Equal(that1.FrameworkId) { return fmt.Errorf("FrameworkId this(%v) Not Equal that(%v)", this.FrameworkId, that1.FrameworkId) } if !this.SlaveId.Equal(that1.SlaveId) { return fmt.Errorf("SlaveId this(%v) Not Equal that(%v)", this.SlaveId, that1.SlaveId) } if this.Hostname != nil && that1.Hostname != nil { if *this.Hostname != *that1.Hostname { return fmt.Errorf("Hostname this(%v) Not Equal that(%v)", *this.Hostname, *that1.Hostname) } } else if this.Hostname != nil { return fmt.Errorf("this.Hostname == nil && that.Hostname != nil") } else if that1.Hostname != nil { return fmt.Errorf("Hostname this(%v) Not Equal that(%v)", this.Hostname, that1.Hostname) } if len(this.Resources) != len(that1.Resources) { return fmt.Errorf("Resources this(%v) Not Equal that(%v)", len(this.Resources), len(that1.Resources)) } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return fmt.Errorf("Resources this[%v](%v) Not Equal that[%v](%v)", i, this.Resources[i], i, that1.Resources[i]) } } if len(this.Attributes) != len(that1.Attributes) { return fmt.Errorf("Attributes this(%v) Not Equal that(%v)", len(this.Attributes), len(that1.Attributes)) } for i := range this.Attributes { if !this.Attributes[i].Equal(that1.Attributes[i]) { return fmt.Errorf("Attributes this[%v](%v) Not Equal that[%v](%v)", i, this.Attributes[i], i, that1.Attributes[i]) } } if len(this.ExecutorIds) != len(that1.ExecutorIds) { return fmt.Errorf("ExecutorIds this(%v) Not Equal that(%v)", len(this.ExecutorIds), len(that1.ExecutorIds)) } for i := range this.ExecutorIds { if !this.ExecutorIds[i].Equal(that1.ExecutorIds[i]) { return fmt.Errorf("ExecutorIds this[%v](%v) Not Equal that[%v](%v)", i, this.ExecutorIds[i], i, that1.ExecutorIds[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Offer) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Offer) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.Id.Equal(that1.Id) { return false } if !this.FrameworkId.Equal(that1.FrameworkId) { return false } if !this.SlaveId.Equal(that1.SlaveId) { return false } if this.Hostname != nil && that1.Hostname != nil { if *this.Hostname != *that1.Hostname { return false } } else if this.Hostname != nil { return false } else if that1.Hostname != nil { return false } if len(this.Resources) != len(that1.Resources) { return false } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return false } } if len(this.Attributes) != len(that1.Attributes) { return false } for i := range this.Attributes { if !this.Attributes[i].Equal(that1.Attributes[i]) { return false } } if len(this.ExecutorIds) != len(that1.ExecutorIds) { return false } for i := range this.ExecutorIds { if !this.ExecutorIds[i].Equal(that1.ExecutorIds[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Offer_Operation) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Offer_Operation) if !ok { return fmt.Errorf("that is not of type *Offer_Operation") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Offer_Operation but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Offer_Operationbut is not nil && this == nil") } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return fmt.Errorf("Type this(%v) Not Equal that(%v)", *this.Type, *that1.Type) } } else if this.Type != nil { return fmt.Errorf("this.Type == nil && that.Type != nil") } else if that1.Type != nil { return fmt.Errorf("Type this(%v) Not Equal that(%v)", this.Type, that1.Type) } if !this.Launch.Equal(that1.Launch) { return fmt.Errorf("Launch this(%v) Not Equal that(%v)", this.Launch, that1.Launch) } if !this.Reserve.Equal(that1.Reserve) { return fmt.Errorf("Reserve this(%v) Not Equal that(%v)", this.Reserve, that1.Reserve) } if !this.Unreserve.Equal(that1.Unreserve) { return fmt.Errorf("Unreserve this(%v) Not Equal that(%v)", this.Unreserve, that1.Unreserve) } if !this.Create.Equal(that1.Create) { return fmt.Errorf("Create this(%v) Not Equal that(%v)", this.Create, that1.Create) } if !this.Destroy.Equal(that1.Destroy) { return fmt.Errorf("Destroy this(%v) Not Equal that(%v)", this.Destroy, that1.Destroy) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Offer_Operation) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Offer_Operation) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return false } } else if this.Type != nil { return false } else if that1.Type != nil { return false } if !this.Launch.Equal(that1.Launch) { return false } if !this.Reserve.Equal(that1.Reserve) { return false } if !this.Unreserve.Equal(that1.Unreserve) { return false } if !this.Create.Equal(that1.Create) { return false } if !this.Destroy.Equal(that1.Destroy) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Offer_Operation_Launch) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Offer_Operation_Launch) if !ok { return fmt.Errorf("that is not of type *Offer_Operation_Launch") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Offer_Operation_Launch but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Offer_Operation_Launchbut is not nil && this == nil") } if len(this.TaskInfos) != len(that1.TaskInfos) { return fmt.Errorf("TaskInfos this(%v) Not Equal that(%v)", len(this.TaskInfos), len(that1.TaskInfos)) } for i := range this.TaskInfos { if !this.TaskInfos[i].Equal(that1.TaskInfos[i]) { return fmt.Errorf("TaskInfos this[%v](%v) Not Equal that[%v](%v)", i, this.TaskInfos[i], i, that1.TaskInfos[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Offer_Operation_Launch) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Offer_Operation_Launch) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.TaskInfos) != len(that1.TaskInfos) { return false } for i := range this.TaskInfos { if !this.TaskInfos[i].Equal(that1.TaskInfos[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Offer_Operation_Reserve) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Offer_Operation_Reserve) if !ok { return fmt.Errorf("that is not of type *Offer_Operation_Reserve") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Offer_Operation_Reserve but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Offer_Operation_Reservebut is not nil && this == nil") } if len(this.Resources) != len(that1.Resources) { return fmt.Errorf("Resources this(%v) Not Equal that(%v)", len(this.Resources), len(that1.Resources)) } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return fmt.Errorf("Resources this[%v](%v) Not Equal that[%v](%v)", i, this.Resources[i], i, that1.Resources[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Offer_Operation_Reserve) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Offer_Operation_Reserve) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Resources) != len(that1.Resources) { return false } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Offer_Operation_Unreserve) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Offer_Operation_Unreserve) if !ok { return fmt.Errorf("that is not of type *Offer_Operation_Unreserve") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Offer_Operation_Unreserve but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Offer_Operation_Unreservebut is not nil && this == nil") } if len(this.Resources) != len(that1.Resources) { return fmt.Errorf("Resources this(%v) Not Equal that(%v)", len(this.Resources), len(that1.Resources)) } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return fmt.Errorf("Resources this[%v](%v) Not Equal that[%v](%v)", i, this.Resources[i], i, that1.Resources[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Offer_Operation_Unreserve) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Offer_Operation_Unreserve) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Resources) != len(that1.Resources) { return false } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Offer_Operation_Create) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Offer_Operation_Create) if !ok { return fmt.Errorf("that is not of type *Offer_Operation_Create") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Offer_Operation_Create but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Offer_Operation_Createbut is not nil && this == nil") } if len(this.Volumes) != len(that1.Volumes) { return fmt.Errorf("Volumes this(%v) Not Equal that(%v)", len(this.Volumes), len(that1.Volumes)) } for i := range this.Volumes { if !this.Volumes[i].Equal(that1.Volumes[i]) { return fmt.Errorf("Volumes this[%v](%v) Not Equal that[%v](%v)", i, this.Volumes[i], i, that1.Volumes[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Offer_Operation_Create) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Offer_Operation_Create) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Volumes) != len(that1.Volumes) { return false } for i := range this.Volumes { if !this.Volumes[i].Equal(that1.Volumes[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Offer_Operation_Destroy) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Offer_Operation_Destroy) if !ok { return fmt.Errorf("that is not of type *Offer_Operation_Destroy") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Offer_Operation_Destroy but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Offer_Operation_Destroybut is not nil && this == nil") } if len(this.Volumes) != len(that1.Volumes) { return fmt.Errorf("Volumes this(%v) Not Equal that(%v)", len(this.Volumes), len(that1.Volumes)) } for i := range this.Volumes { if !this.Volumes[i].Equal(that1.Volumes[i]) { return fmt.Errorf("Volumes this[%v](%v) Not Equal that[%v](%v)", i, this.Volumes[i], i, that1.Volumes[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Offer_Operation_Destroy) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Offer_Operation_Destroy) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Volumes) != len(that1.Volumes) { return false } for i := range this.Volumes { if !this.Volumes[i].Equal(that1.Volumes[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *TaskInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*TaskInfo) if !ok { return fmt.Errorf("that is not of type *TaskInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *TaskInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *TaskInfobut is not nil && this == nil") } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return fmt.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name) } } else if this.Name != nil { return fmt.Errorf("this.Name == nil && that.Name != nil") } else if that1.Name != nil { return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name) } if !this.TaskId.Equal(that1.TaskId) { return fmt.Errorf("TaskId this(%v) Not Equal that(%v)", this.TaskId, that1.TaskId) } if !this.SlaveId.Equal(that1.SlaveId) { return fmt.Errorf("SlaveId this(%v) Not Equal that(%v)", this.SlaveId, that1.SlaveId) } if len(this.Resources) != len(that1.Resources) { return fmt.Errorf("Resources this(%v) Not Equal that(%v)", len(this.Resources), len(that1.Resources)) } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return fmt.Errorf("Resources this[%v](%v) Not Equal that[%v](%v)", i, this.Resources[i], i, that1.Resources[i]) } } if !this.Executor.Equal(that1.Executor) { return fmt.Errorf("Executor this(%v) Not Equal that(%v)", this.Executor, that1.Executor) } if !this.Command.Equal(that1.Command) { return fmt.Errorf("Command this(%v) Not Equal that(%v)", this.Command, that1.Command) } if !this.Container.Equal(that1.Container) { return fmt.Errorf("Container this(%v) Not Equal that(%v)", this.Container, that1.Container) } if !bytes.Equal(this.Data, that1.Data) { return fmt.Errorf("Data this(%v) Not Equal that(%v)", this.Data, that1.Data) } if !this.HealthCheck.Equal(that1.HealthCheck) { return fmt.Errorf("HealthCheck this(%v) Not Equal that(%v)", this.HealthCheck, that1.HealthCheck) } if !this.Labels.Equal(that1.Labels) { return fmt.Errorf("Labels this(%v) Not Equal that(%v)", this.Labels, that1.Labels) } if !this.Discovery.Equal(that1.Discovery) { return fmt.Errorf("Discovery this(%v) Not Equal that(%v)", this.Discovery, that1.Discovery) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *TaskInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*TaskInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return false } } else if this.Name != nil { return false } else if that1.Name != nil { return false } if !this.TaskId.Equal(that1.TaskId) { return false } if !this.SlaveId.Equal(that1.SlaveId) { return false } if len(this.Resources) != len(that1.Resources) { return false } for i := range this.Resources { if !this.Resources[i].Equal(that1.Resources[i]) { return false } } if !this.Executor.Equal(that1.Executor) { return false } if !this.Command.Equal(that1.Command) { return false } if !this.Container.Equal(that1.Container) { return false } if !bytes.Equal(this.Data, that1.Data) { return false } if !this.HealthCheck.Equal(that1.HealthCheck) { return false } if !this.Labels.Equal(that1.Labels) { return false } if !this.Discovery.Equal(that1.Discovery) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *TaskStatus) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*TaskStatus) if !ok { return fmt.Errorf("that is not of type *TaskStatus") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *TaskStatus but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *TaskStatusbut is not nil && this == nil") } if !this.TaskId.Equal(that1.TaskId) { return fmt.Errorf("TaskId this(%v) Not Equal that(%v)", this.TaskId, that1.TaskId) } if this.State != nil && that1.State != nil { if *this.State != *that1.State { return fmt.Errorf("State this(%v) Not Equal that(%v)", *this.State, *that1.State) } } else if this.State != nil { return fmt.Errorf("this.State == nil && that.State != nil") } else if that1.State != nil { return fmt.Errorf("State this(%v) Not Equal that(%v)", this.State, that1.State) } if this.Message != nil && that1.Message != nil { if *this.Message != *that1.Message { return fmt.Errorf("Message this(%v) Not Equal that(%v)", *this.Message, *that1.Message) } } else if this.Message != nil { return fmt.Errorf("this.Message == nil && that.Message != nil") } else if that1.Message != nil { return fmt.Errorf("Message this(%v) Not Equal that(%v)", this.Message, that1.Message) } if this.Source != nil && that1.Source != nil { if *this.Source != *that1.Source { return fmt.Errorf("Source this(%v) Not Equal that(%v)", *this.Source, *that1.Source) } } else if this.Source != nil { return fmt.Errorf("this.Source == nil && that.Source != nil") } else if that1.Source != nil { return fmt.Errorf("Source this(%v) Not Equal that(%v)", this.Source, that1.Source) } if this.Reason != nil && that1.Reason != nil { if *this.Reason != *that1.Reason { return fmt.Errorf("Reason this(%v) Not Equal that(%v)", *this.Reason, *that1.Reason) } } else if this.Reason != nil { return fmt.Errorf("this.Reason == nil && that.Reason != nil") } else if that1.Reason != nil { return fmt.Errorf("Reason this(%v) Not Equal that(%v)", this.Reason, that1.Reason) } if !bytes.Equal(this.Data, that1.Data) { return fmt.Errorf("Data this(%v) Not Equal that(%v)", this.Data, that1.Data) } if !this.SlaveId.Equal(that1.SlaveId) { return fmt.Errorf("SlaveId this(%v) Not Equal that(%v)", this.SlaveId, that1.SlaveId) } if !this.ExecutorId.Equal(that1.ExecutorId) { return fmt.Errorf("ExecutorId this(%v) Not Equal that(%v)", this.ExecutorId, that1.ExecutorId) } if this.Timestamp != nil && that1.Timestamp != nil { if *this.Timestamp != *that1.Timestamp { return fmt.Errorf("Timestamp this(%v) Not Equal that(%v)", *this.Timestamp, *that1.Timestamp) } } else if this.Timestamp != nil { return fmt.Errorf("this.Timestamp == nil && that.Timestamp != nil") } else if that1.Timestamp != nil { return fmt.Errorf("Timestamp this(%v) Not Equal that(%v)", this.Timestamp, that1.Timestamp) } if !bytes.Equal(this.Uuid, that1.Uuid) { return fmt.Errorf("Uuid this(%v) Not Equal that(%v)", this.Uuid, that1.Uuid) } if this.Healthy != nil && that1.Healthy != nil { if *this.Healthy != *that1.Healthy { return fmt.Errorf("Healthy this(%v) Not Equal that(%v)", *this.Healthy, *that1.Healthy) } } else if this.Healthy != nil { return fmt.Errorf("this.Healthy == nil && that.Healthy != nil") } else if that1.Healthy != nil { return fmt.Errorf("Healthy this(%v) Not Equal that(%v)", this.Healthy, that1.Healthy) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *TaskStatus) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*TaskStatus) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.TaskId.Equal(that1.TaskId) { return false } if this.State != nil && that1.State != nil { if *this.State != *that1.State { return false } } else if this.State != nil { return false } else if that1.State != nil { return false } if this.Message != nil && that1.Message != nil { if *this.Message != *that1.Message { return false } } else if this.Message != nil { return false } else if that1.Message != nil { return false } if this.Source != nil && that1.Source != nil { if *this.Source != *that1.Source { return false } } else if this.Source != nil { return false } else if that1.Source != nil { return false } if this.Reason != nil && that1.Reason != nil { if *this.Reason != *that1.Reason { return false } } else if this.Reason != nil { return false } else if that1.Reason != nil { return false } if !bytes.Equal(this.Data, that1.Data) { return false } if !this.SlaveId.Equal(that1.SlaveId) { return false } if !this.ExecutorId.Equal(that1.ExecutorId) { return false } if this.Timestamp != nil && that1.Timestamp != nil { if *this.Timestamp != *that1.Timestamp { return false } } else if this.Timestamp != nil { return false } else if that1.Timestamp != nil { return false } if !bytes.Equal(this.Uuid, that1.Uuid) { return false } if this.Healthy != nil && that1.Healthy != nil { if *this.Healthy != *that1.Healthy { return false } } else if this.Healthy != nil { return false } else if that1.Healthy != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Filters) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Filters) if !ok { return fmt.Errorf("that is not of type *Filters") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Filters but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Filtersbut is not nil && this == nil") } if this.RefuseSeconds != nil && that1.RefuseSeconds != nil { if *this.RefuseSeconds != *that1.RefuseSeconds { return fmt.Errorf("RefuseSeconds this(%v) Not Equal that(%v)", *this.RefuseSeconds, *that1.RefuseSeconds) } } else if this.RefuseSeconds != nil { return fmt.Errorf("this.RefuseSeconds == nil && that.RefuseSeconds != nil") } else if that1.RefuseSeconds != nil { return fmt.Errorf("RefuseSeconds this(%v) Not Equal that(%v)", this.RefuseSeconds, that1.RefuseSeconds) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Filters) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Filters) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.RefuseSeconds != nil && that1.RefuseSeconds != nil { if *this.RefuseSeconds != *that1.RefuseSeconds { return false } } else if this.RefuseSeconds != nil { return false } else if that1.RefuseSeconds != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Environment) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Environment) if !ok { return fmt.Errorf("that is not of type *Environment") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Environment but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Environmentbut is not nil && this == nil") } if len(this.Variables) != len(that1.Variables) { return fmt.Errorf("Variables this(%v) Not Equal that(%v)", len(this.Variables), len(that1.Variables)) } for i := range this.Variables { if !this.Variables[i].Equal(that1.Variables[i]) { return fmt.Errorf("Variables this[%v](%v) Not Equal that[%v](%v)", i, this.Variables[i], i, that1.Variables[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Environment) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Environment) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Variables) != len(that1.Variables) { return false } for i := range this.Variables { if !this.Variables[i].Equal(that1.Variables[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Environment_Variable) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Environment_Variable) if !ok { return fmt.Errorf("that is not of type *Environment_Variable") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Environment_Variable but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Environment_Variablebut is not nil && this == nil") } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return fmt.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name) } } else if this.Name != nil { return fmt.Errorf("this.Name == nil && that.Name != nil") } else if that1.Name != nil { return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name) } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Environment_Variable) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Environment_Variable) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return false } } else if this.Name != nil { return false } else if that1.Name != nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Parameter) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Parameter) if !ok { return fmt.Errorf("that is not of type *Parameter") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Parameter but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Parameterbut is not nil && this == nil") } if this.Key != nil && that1.Key != nil { if *this.Key != *that1.Key { return fmt.Errorf("Key this(%v) Not Equal that(%v)", *this.Key, *that1.Key) } } else if this.Key != nil { return fmt.Errorf("this.Key == nil && that.Key != nil") } else if that1.Key != nil { return fmt.Errorf("Key this(%v) Not Equal that(%v)", this.Key, that1.Key) } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Parameter) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Parameter) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Key != nil && that1.Key != nil { if *this.Key != *that1.Key { return false } } else if this.Key != nil { return false } else if that1.Key != nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Parameters) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Parameters) if !ok { return fmt.Errorf("that is not of type *Parameters") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Parameters but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Parametersbut is not nil && this == nil") } if len(this.Parameter) != len(that1.Parameter) { return fmt.Errorf("Parameter this(%v) Not Equal that(%v)", len(this.Parameter), len(that1.Parameter)) } for i := range this.Parameter { if !this.Parameter[i].Equal(that1.Parameter[i]) { return fmt.Errorf("Parameter this[%v](%v) Not Equal that[%v](%v)", i, this.Parameter[i], i, that1.Parameter[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Parameters) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Parameters) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Parameter) != len(that1.Parameter) { return false } for i := range this.Parameter { if !this.Parameter[i].Equal(that1.Parameter[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Credential) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Credential) if !ok { return fmt.Errorf("that is not of type *Credential") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Credential but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Credentialbut is not nil && this == nil") } if this.Principal != nil && that1.Principal != nil { if *this.Principal != *that1.Principal { return fmt.Errorf("Principal this(%v) Not Equal that(%v)", *this.Principal, *that1.Principal) } } else if this.Principal != nil { return fmt.Errorf("this.Principal == nil && that.Principal != nil") } else if that1.Principal != nil { return fmt.Errorf("Principal this(%v) Not Equal that(%v)", this.Principal, that1.Principal) } if !bytes.Equal(this.Secret, that1.Secret) { return fmt.Errorf("Secret this(%v) Not Equal that(%v)", this.Secret, that1.Secret) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Credential) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Credential) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Principal != nil && that1.Principal != nil { if *this.Principal != *that1.Principal { return false } } else if this.Principal != nil { return false } else if that1.Principal != nil { return false } if !bytes.Equal(this.Secret, that1.Secret) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Credentials) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Credentials) if !ok { return fmt.Errorf("that is not of type *Credentials") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Credentials but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Credentialsbut is not nil && this == nil") } if len(this.Credentials) != len(that1.Credentials) { return fmt.Errorf("Credentials this(%v) Not Equal that(%v)", len(this.Credentials), len(that1.Credentials)) } for i := range this.Credentials { if !this.Credentials[i].Equal(that1.Credentials[i]) { return fmt.Errorf("Credentials this[%v](%v) Not Equal that[%v](%v)", i, this.Credentials[i], i, that1.Credentials[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Credentials) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Credentials) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Credentials) != len(that1.Credentials) { return false } for i := range this.Credentials { if !this.Credentials[i].Equal(that1.Credentials[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ACL) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ACL) if !ok { return fmt.Errorf("that is not of type *ACL") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ACL but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ACLbut is not nil && this == nil") } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ACL) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ACL) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ACL_Entity) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ACL_Entity) if !ok { return fmt.Errorf("that is not of type *ACL_Entity") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ACL_Entity but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ACL_Entitybut is not nil && this == nil") } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return fmt.Errorf("Type this(%v) Not Equal that(%v)", *this.Type, *that1.Type) } } else if this.Type != nil { return fmt.Errorf("this.Type == nil && that.Type != nil") } else if that1.Type != nil { return fmt.Errorf("Type this(%v) Not Equal that(%v)", this.Type, that1.Type) } if len(this.Values) != len(that1.Values) { return fmt.Errorf("Values this(%v) Not Equal that(%v)", len(this.Values), len(that1.Values)) } for i := range this.Values { if this.Values[i] != that1.Values[i] { return fmt.Errorf("Values this[%v](%v) Not Equal that[%v](%v)", i, this.Values[i], i, that1.Values[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ACL_Entity) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ACL_Entity) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return false } } else if this.Type != nil { return false } else if that1.Type != nil { return false } if len(this.Values) != len(that1.Values) { return false } for i := range this.Values { if this.Values[i] != that1.Values[i] { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ACL_RegisterFramework) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ACL_RegisterFramework) if !ok { return fmt.Errorf("that is not of type *ACL_RegisterFramework") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ACL_RegisterFramework but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ACL_RegisterFrameworkbut is not nil && this == nil") } if !this.Principals.Equal(that1.Principals) { return fmt.Errorf("Principals this(%v) Not Equal that(%v)", this.Principals, that1.Principals) } if !this.Roles.Equal(that1.Roles) { return fmt.Errorf("Roles this(%v) Not Equal that(%v)", this.Roles, that1.Roles) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ACL_RegisterFramework) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ACL_RegisterFramework) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.Principals.Equal(that1.Principals) { return false } if !this.Roles.Equal(that1.Roles) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ACL_RunTask) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ACL_RunTask) if !ok { return fmt.Errorf("that is not of type *ACL_RunTask") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ACL_RunTask but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ACL_RunTaskbut is not nil && this == nil") } if !this.Principals.Equal(that1.Principals) { return fmt.Errorf("Principals this(%v) Not Equal that(%v)", this.Principals, that1.Principals) } if !this.Users.Equal(that1.Users) { return fmt.Errorf("Users this(%v) Not Equal that(%v)", this.Users, that1.Users) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ACL_RunTask) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ACL_RunTask) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.Principals.Equal(that1.Principals) { return false } if !this.Users.Equal(that1.Users) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ACL_ShutdownFramework) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ACL_ShutdownFramework) if !ok { return fmt.Errorf("that is not of type *ACL_ShutdownFramework") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ACL_ShutdownFramework but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ACL_ShutdownFrameworkbut is not nil && this == nil") } if !this.Principals.Equal(that1.Principals) { return fmt.Errorf("Principals this(%v) Not Equal that(%v)", this.Principals, that1.Principals) } if !this.FrameworkPrincipals.Equal(that1.FrameworkPrincipals) { return fmt.Errorf("FrameworkPrincipals this(%v) Not Equal that(%v)", this.FrameworkPrincipals, that1.FrameworkPrincipals) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ACL_ShutdownFramework) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ACL_ShutdownFramework) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.Principals.Equal(that1.Principals) { return false } if !this.FrameworkPrincipals.Equal(that1.FrameworkPrincipals) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ACLs) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ACLs) if !ok { return fmt.Errorf("that is not of type *ACLs") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ACLs but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ACLsbut is not nil && this == nil") } if this.Permissive != nil && that1.Permissive != nil { if *this.Permissive != *that1.Permissive { return fmt.Errorf("Permissive this(%v) Not Equal that(%v)", *this.Permissive, *that1.Permissive) } } else if this.Permissive != nil { return fmt.Errorf("this.Permissive == nil && that.Permissive != nil") } else if that1.Permissive != nil { return fmt.Errorf("Permissive this(%v) Not Equal that(%v)", this.Permissive, that1.Permissive) } if len(this.RegisterFrameworks) != len(that1.RegisterFrameworks) { return fmt.Errorf("RegisterFrameworks this(%v) Not Equal that(%v)", len(this.RegisterFrameworks), len(that1.RegisterFrameworks)) } for i := range this.RegisterFrameworks { if !this.RegisterFrameworks[i].Equal(that1.RegisterFrameworks[i]) { return fmt.Errorf("RegisterFrameworks this[%v](%v) Not Equal that[%v](%v)", i, this.RegisterFrameworks[i], i, that1.RegisterFrameworks[i]) } } if len(this.RunTasks) != len(that1.RunTasks) { return fmt.Errorf("RunTasks this(%v) Not Equal that(%v)", len(this.RunTasks), len(that1.RunTasks)) } for i := range this.RunTasks { if !this.RunTasks[i].Equal(that1.RunTasks[i]) { return fmt.Errorf("RunTasks this[%v](%v) Not Equal that[%v](%v)", i, this.RunTasks[i], i, that1.RunTasks[i]) } } if len(this.ShutdownFrameworks) != len(that1.ShutdownFrameworks) { return fmt.Errorf("ShutdownFrameworks this(%v) Not Equal that(%v)", len(this.ShutdownFrameworks), len(that1.ShutdownFrameworks)) } for i := range this.ShutdownFrameworks { if !this.ShutdownFrameworks[i].Equal(that1.ShutdownFrameworks[i]) { return fmt.Errorf("ShutdownFrameworks this[%v](%v) Not Equal that[%v](%v)", i, this.ShutdownFrameworks[i], i, that1.ShutdownFrameworks[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ACLs) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ACLs) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Permissive != nil && that1.Permissive != nil { if *this.Permissive != *that1.Permissive { return false } } else if this.Permissive != nil { return false } else if that1.Permissive != nil { return false } if len(this.RegisterFrameworks) != len(that1.RegisterFrameworks) { return false } for i := range this.RegisterFrameworks { if !this.RegisterFrameworks[i].Equal(that1.RegisterFrameworks[i]) { return false } } if len(this.RunTasks) != len(that1.RunTasks) { return false } for i := range this.RunTasks { if !this.RunTasks[i].Equal(that1.RunTasks[i]) { return false } } if len(this.ShutdownFrameworks) != len(that1.ShutdownFrameworks) { return false } for i := range this.ShutdownFrameworks { if !this.ShutdownFrameworks[i].Equal(that1.ShutdownFrameworks[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *RateLimit) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*RateLimit) if !ok { return fmt.Errorf("that is not of type *RateLimit") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *RateLimit but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *RateLimitbut is not nil && this == nil") } if this.Qps != nil && that1.Qps != nil { if *this.Qps != *that1.Qps { return fmt.Errorf("Qps this(%v) Not Equal that(%v)", *this.Qps, *that1.Qps) } } else if this.Qps != nil { return fmt.Errorf("this.Qps == nil && that.Qps != nil") } else if that1.Qps != nil { return fmt.Errorf("Qps this(%v) Not Equal that(%v)", this.Qps, that1.Qps) } if this.Principal != nil && that1.Principal != nil { if *this.Principal != *that1.Principal { return fmt.Errorf("Principal this(%v) Not Equal that(%v)", *this.Principal, *that1.Principal) } } else if this.Principal != nil { return fmt.Errorf("this.Principal == nil && that.Principal != nil") } else if that1.Principal != nil { return fmt.Errorf("Principal this(%v) Not Equal that(%v)", this.Principal, that1.Principal) } if this.Capacity != nil && that1.Capacity != nil { if *this.Capacity != *that1.Capacity { return fmt.Errorf("Capacity this(%v) Not Equal that(%v)", *this.Capacity, *that1.Capacity) } } else if this.Capacity != nil { return fmt.Errorf("this.Capacity == nil && that.Capacity != nil") } else if that1.Capacity != nil { return fmt.Errorf("Capacity this(%v) Not Equal that(%v)", this.Capacity, that1.Capacity) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *RateLimit) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*RateLimit) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Qps != nil && that1.Qps != nil { if *this.Qps != *that1.Qps { return false } } else if this.Qps != nil { return false } else if that1.Qps != nil { return false } if this.Principal != nil && that1.Principal != nil { if *this.Principal != *that1.Principal { return false } } else if this.Principal != nil { return false } else if that1.Principal != nil { return false } if this.Capacity != nil && that1.Capacity != nil { if *this.Capacity != *that1.Capacity { return false } } else if this.Capacity != nil { return false } else if that1.Capacity != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *RateLimits) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*RateLimits) if !ok { return fmt.Errorf("that is not of type *RateLimits") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *RateLimits but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *RateLimitsbut is not nil && this == nil") } if len(this.Limits) != len(that1.Limits) { return fmt.Errorf("Limits this(%v) Not Equal that(%v)", len(this.Limits), len(that1.Limits)) } for i := range this.Limits { if !this.Limits[i].Equal(that1.Limits[i]) { return fmt.Errorf("Limits this[%v](%v) Not Equal that[%v](%v)", i, this.Limits[i], i, that1.Limits[i]) } } if this.AggregateDefaultQps != nil && that1.AggregateDefaultQps != nil { if *this.AggregateDefaultQps != *that1.AggregateDefaultQps { return fmt.Errorf("AggregateDefaultQps this(%v) Not Equal that(%v)", *this.AggregateDefaultQps, *that1.AggregateDefaultQps) } } else if this.AggregateDefaultQps != nil { return fmt.Errorf("this.AggregateDefaultQps == nil && that.AggregateDefaultQps != nil") } else if that1.AggregateDefaultQps != nil { return fmt.Errorf("AggregateDefaultQps this(%v) Not Equal that(%v)", this.AggregateDefaultQps, that1.AggregateDefaultQps) } if this.AggregateDefaultCapacity != nil && that1.AggregateDefaultCapacity != nil { if *this.AggregateDefaultCapacity != *that1.AggregateDefaultCapacity { return fmt.Errorf("AggregateDefaultCapacity this(%v) Not Equal that(%v)", *this.AggregateDefaultCapacity, *that1.AggregateDefaultCapacity) } } else if this.AggregateDefaultCapacity != nil { return fmt.Errorf("this.AggregateDefaultCapacity == nil && that.AggregateDefaultCapacity != nil") } else if that1.AggregateDefaultCapacity != nil { return fmt.Errorf("AggregateDefaultCapacity this(%v) Not Equal that(%v)", this.AggregateDefaultCapacity, that1.AggregateDefaultCapacity) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *RateLimits) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*RateLimits) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Limits) != len(that1.Limits) { return false } for i := range this.Limits { if !this.Limits[i].Equal(that1.Limits[i]) { return false } } if this.AggregateDefaultQps != nil && that1.AggregateDefaultQps != nil { if *this.AggregateDefaultQps != *that1.AggregateDefaultQps { return false } } else if this.AggregateDefaultQps != nil { return false } else if that1.AggregateDefaultQps != nil { return false } if this.AggregateDefaultCapacity != nil && that1.AggregateDefaultCapacity != nil { if *this.AggregateDefaultCapacity != *that1.AggregateDefaultCapacity { return false } } else if this.AggregateDefaultCapacity != nil { return false } else if that1.AggregateDefaultCapacity != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Volume) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Volume) if !ok { return fmt.Errorf("that is not of type *Volume") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Volume but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Volumebut is not nil && this == nil") } if this.ContainerPath != nil && that1.ContainerPath != nil { if *this.ContainerPath != *that1.ContainerPath { return fmt.Errorf("ContainerPath this(%v) Not Equal that(%v)", *this.ContainerPath, *that1.ContainerPath) } } else if this.ContainerPath != nil { return fmt.Errorf("this.ContainerPath == nil && that.ContainerPath != nil") } else if that1.ContainerPath != nil { return fmt.Errorf("ContainerPath this(%v) Not Equal that(%v)", this.ContainerPath, that1.ContainerPath) } if this.HostPath != nil && that1.HostPath != nil { if *this.HostPath != *that1.HostPath { return fmt.Errorf("HostPath this(%v) Not Equal that(%v)", *this.HostPath, *that1.HostPath) } } else if this.HostPath != nil { return fmt.Errorf("this.HostPath == nil && that.HostPath != nil") } else if that1.HostPath != nil { return fmt.Errorf("HostPath this(%v) Not Equal that(%v)", this.HostPath, that1.HostPath) } if this.Mode != nil && that1.Mode != nil { if *this.Mode != *that1.Mode { return fmt.Errorf("Mode this(%v) Not Equal that(%v)", *this.Mode, *that1.Mode) } } else if this.Mode != nil { return fmt.Errorf("this.Mode == nil && that.Mode != nil") } else if that1.Mode != nil { return fmt.Errorf("Mode this(%v) Not Equal that(%v)", this.Mode, that1.Mode) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Volume) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Volume) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.ContainerPath != nil && that1.ContainerPath != nil { if *this.ContainerPath != *that1.ContainerPath { return false } } else if this.ContainerPath != nil { return false } else if that1.ContainerPath != nil { return false } if this.HostPath != nil && that1.HostPath != nil { if *this.HostPath != *that1.HostPath { return false } } else if this.HostPath != nil { return false } else if that1.HostPath != nil { return false } if this.Mode != nil && that1.Mode != nil { if *this.Mode != *that1.Mode { return false } } else if this.Mode != nil { return false } else if that1.Mode != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ContainerInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ContainerInfo) if !ok { return fmt.Errorf("that is not of type *ContainerInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ContainerInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ContainerInfobut is not nil && this == nil") } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return fmt.Errorf("Type this(%v) Not Equal that(%v)", *this.Type, *that1.Type) } } else if this.Type != nil { return fmt.Errorf("this.Type == nil && that.Type != nil") } else if that1.Type != nil { return fmt.Errorf("Type this(%v) Not Equal that(%v)", this.Type, that1.Type) } if len(this.Volumes) != len(that1.Volumes) { return fmt.Errorf("Volumes this(%v) Not Equal that(%v)", len(this.Volumes), len(that1.Volumes)) } for i := range this.Volumes { if !this.Volumes[i].Equal(that1.Volumes[i]) { return fmt.Errorf("Volumes this[%v](%v) Not Equal that[%v](%v)", i, this.Volumes[i], i, that1.Volumes[i]) } } if this.Hostname != nil && that1.Hostname != nil { if *this.Hostname != *that1.Hostname { return fmt.Errorf("Hostname this(%v) Not Equal that(%v)", *this.Hostname, *that1.Hostname) } } else if this.Hostname != nil { return fmt.Errorf("this.Hostname == nil && that.Hostname != nil") } else if that1.Hostname != nil { return fmt.Errorf("Hostname this(%v) Not Equal that(%v)", this.Hostname, that1.Hostname) } if !this.Docker.Equal(that1.Docker) { return fmt.Errorf("Docker this(%v) Not Equal that(%v)", this.Docker, that1.Docker) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ContainerInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ContainerInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return false } } else if this.Type != nil { return false } else if that1.Type != nil { return false } if len(this.Volumes) != len(that1.Volumes) { return false } for i := range this.Volumes { if !this.Volumes[i].Equal(that1.Volumes[i]) { return false } } if this.Hostname != nil && that1.Hostname != nil { if *this.Hostname != *that1.Hostname { return false } } else if this.Hostname != nil { return false } else if that1.Hostname != nil { return false } if !this.Docker.Equal(that1.Docker) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ContainerInfo_DockerInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ContainerInfo_DockerInfo) if !ok { return fmt.Errorf("that is not of type *ContainerInfo_DockerInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ContainerInfo_DockerInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ContainerInfo_DockerInfobut is not nil && this == nil") } if this.Image != nil && that1.Image != nil { if *this.Image != *that1.Image { return fmt.Errorf("Image this(%v) Not Equal that(%v)", *this.Image, *that1.Image) } } else if this.Image != nil { return fmt.Errorf("this.Image == nil && that.Image != nil") } else if that1.Image != nil { return fmt.Errorf("Image this(%v) Not Equal that(%v)", this.Image, that1.Image) } if this.Network != nil && that1.Network != nil { if *this.Network != *that1.Network { return fmt.Errorf("Network this(%v) Not Equal that(%v)", *this.Network, *that1.Network) } } else if this.Network != nil { return fmt.Errorf("this.Network == nil && that.Network != nil") } else if that1.Network != nil { return fmt.Errorf("Network this(%v) Not Equal that(%v)", this.Network, that1.Network) } if len(this.PortMappings) != len(that1.PortMappings) { return fmt.Errorf("PortMappings this(%v) Not Equal that(%v)", len(this.PortMappings), len(that1.PortMappings)) } for i := range this.PortMappings { if !this.PortMappings[i].Equal(that1.PortMappings[i]) { return fmt.Errorf("PortMappings this[%v](%v) Not Equal that[%v](%v)", i, this.PortMappings[i], i, that1.PortMappings[i]) } } if this.Privileged != nil && that1.Privileged != nil { if *this.Privileged != *that1.Privileged { return fmt.Errorf("Privileged this(%v) Not Equal that(%v)", *this.Privileged, *that1.Privileged) } } else if this.Privileged != nil { return fmt.Errorf("this.Privileged == nil && that.Privileged != nil") } else if that1.Privileged != nil { return fmt.Errorf("Privileged this(%v) Not Equal that(%v)", this.Privileged, that1.Privileged) } if len(this.Parameters) != len(that1.Parameters) { return fmt.Errorf("Parameters this(%v) Not Equal that(%v)", len(this.Parameters), len(that1.Parameters)) } for i := range this.Parameters { if !this.Parameters[i].Equal(that1.Parameters[i]) { return fmt.Errorf("Parameters this[%v](%v) Not Equal that[%v](%v)", i, this.Parameters[i], i, that1.Parameters[i]) } } if this.ForcePullImage != nil && that1.ForcePullImage != nil { if *this.ForcePullImage != *that1.ForcePullImage { return fmt.Errorf("ForcePullImage this(%v) Not Equal that(%v)", *this.ForcePullImage, *that1.ForcePullImage) } } else if this.ForcePullImage != nil { return fmt.Errorf("this.ForcePullImage == nil && that.ForcePullImage != nil") } else if that1.ForcePullImage != nil { return fmt.Errorf("ForcePullImage this(%v) Not Equal that(%v)", this.ForcePullImage, that1.ForcePullImage) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ContainerInfo_DockerInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ContainerInfo_DockerInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Image != nil && that1.Image != nil { if *this.Image != *that1.Image { return false } } else if this.Image != nil { return false } else if that1.Image != nil { return false } if this.Network != nil && that1.Network != nil { if *this.Network != *that1.Network { return false } } else if this.Network != nil { return false } else if that1.Network != nil { return false } if len(this.PortMappings) != len(that1.PortMappings) { return false } for i := range this.PortMappings { if !this.PortMappings[i].Equal(that1.PortMappings[i]) { return false } } if this.Privileged != nil && that1.Privileged != nil { if *this.Privileged != *that1.Privileged { return false } } else if this.Privileged != nil { return false } else if that1.Privileged != nil { return false } if len(this.Parameters) != len(that1.Parameters) { return false } for i := range this.Parameters { if !this.Parameters[i].Equal(that1.Parameters[i]) { return false } } if this.ForcePullImage != nil && that1.ForcePullImage != nil { if *this.ForcePullImage != *that1.ForcePullImage { return false } } else if this.ForcePullImage != nil { return false } else if that1.ForcePullImage != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ContainerInfo_DockerInfo_PortMapping) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ContainerInfo_DockerInfo_PortMapping) if !ok { return fmt.Errorf("that is not of type *ContainerInfo_DockerInfo_PortMapping") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ContainerInfo_DockerInfo_PortMapping but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ContainerInfo_DockerInfo_PortMappingbut is not nil && this == nil") } if this.HostPort != nil && that1.HostPort != nil { if *this.HostPort != *that1.HostPort { return fmt.Errorf("HostPort this(%v) Not Equal that(%v)", *this.HostPort, *that1.HostPort) } } else if this.HostPort != nil { return fmt.Errorf("this.HostPort == nil && that.HostPort != nil") } else if that1.HostPort != nil { return fmt.Errorf("HostPort this(%v) Not Equal that(%v)", this.HostPort, that1.HostPort) } if this.ContainerPort != nil && that1.ContainerPort != nil { if *this.ContainerPort != *that1.ContainerPort { return fmt.Errorf("ContainerPort this(%v) Not Equal that(%v)", *this.ContainerPort, *that1.ContainerPort) } } else if this.ContainerPort != nil { return fmt.Errorf("this.ContainerPort == nil && that.ContainerPort != nil") } else if that1.ContainerPort != nil { return fmt.Errorf("ContainerPort this(%v) Not Equal that(%v)", this.ContainerPort, that1.ContainerPort) } if this.Protocol != nil && that1.Protocol != nil { if *this.Protocol != *that1.Protocol { return fmt.Errorf("Protocol this(%v) Not Equal that(%v)", *this.Protocol, *that1.Protocol) } } else if this.Protocol != nil { return fmt.Errorf("this.Protocol == nil && that.Protocol != nil") } else if that1.Protocol != nil { return fmt.Errorf("Protocol this(%v) Not Equal that(%v)", this.Protocol, that1.Protocol) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ContainerInfo_DockerInfo_PortMapping) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*ContainerInfo_DockerInfo_PortMapping) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.HostPort != nil && that1.HostPort != nil { if *this.HostPort != *that1.HostPort { return false } } else if this.HostPort != nil { return false } else if that1.HostPort != nil { return false } if this.ContainerPort != nil && that1.ContainerPort != nil { if *this.ContainerPort != *that1.ContainerPort { return false } } else if this.ContainerPort != nil { return false } else if that1.ContainerPort != nil { return false } if this.Protocol != nil && that1.Protocol != nil { if *this.Protocol != *that1.Protocol { return false } } else if this.Protocol != nil { return false } else if that1.Protocol != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Labels) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Labels) if !ok { return fmt.Errorf("that is not of type *Labels") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Labels but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Labelsbut is not nil && this == nil") } if len(this.Labels) != len(that1.Labels) { return fmt.Errorf("Labels this(%v) Not Equal that(%v)", len(this.Labels), len(that1.Labels)) } for i := range this.Labels { if !this.Labels[i].Equal(that1.Labels[i]) { return fmt.Errorf("Labels this[%v](%v) Not Equal that[%v](%v)", i, this.Labels[i], i, that1.Labels[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Labels) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Labels) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Labels) != len(that1.Labels) { return false } for i := range this.Labels { if !this.Labels[i].Equal(that1.Labels[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Label) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Label) if !ok { return fmt.Errorf("that is not of type *Label") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Label but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Labelbut is not nil && this == nil") } if this.Key != nil && that1.Key != nil { if *this.Key != *that1.Key { return fmt.Errorf("Key this(%v) Not Equal that(%v)", *this.Key, *that1.Key) } } else if this.Key != nil { return fmt.Errorf("this.Key == nil && that.Key != nil") } else if that1.Key != nil { return fmt.Errorf("Key this(%v) Not Equal that(%v)", this.Key, that1.Key) } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return fmt.Errorf("Value this(%v) Not Equal that(%v)", *this.Value, *that1.Value) } } else if this.Value != nil { return fmt.Errorf("this.Value == nil && that.Value != nil") } else if that1.Value != nil { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Label) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Label) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Key != nil && that1.Key != nil { if *this.Key != *that1.Key { return false } } else if this.Key != nil { return false } else if that1.Key != nil { return false } if this.Value != nil && that1.Value != nil { if *this.Value != *that1.Value { return false } } else if this.Value != nil { return false } else if that1.Value != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Port) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Port) if !ok { return fmt.Errorf("that is not of type *Port") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Port but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Portbut is not nil && this == nil") } if this.Number != nil && that1.Number != nil { if *this.Number != *that1.Number { return fmt.Errorf("Number this(%v) Not Equal that(%v)", *this.Number, *that1.Number) } } else if this.Number != nil { return fmt.Errorf("this.Number == nil && that.Number != nil") } else if that1.Number != nil { return fmt.Errorf("Number this(%v) Not Equal that(%v)", this.Number, that1.Number) } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return fmt.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name) } } else if this.Name != nil { return fmt.Errorf("this.Name == nil && that.Name != nil") } else if that1.Name != nil { return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name) } if this.Protocol != nil && that1.Protocol != nil { if *this.Protocol != *that1.Protocol { return fmt.Errorf("Protocol this(%v) Not Equal that(%v)", *this.Protocol, *that1.Protocol) } } else if this.Protocol != nil { return fmt.Errorf("this.Protocol == nil && that.Protocol != nil") } else if that1.Protocol != nil { return fmt.Errorf("Protocol this(%v) Not Equal that(%v)", this.Protocol, that1.Protocol) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Port) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Port) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Number != nil && that1.Number != nil { if *this.Number != *that1.Number { return false } } else if this.Number != nil { return false } else if that1.Number != nil { return false } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return false } } else if this.Name != nil { return false } else if that1.Name != nil { return false } if this.Protocol != nil && that1.Protocol != nil { if *this.Protocol != *that1.Protocol { return false } } else if this.Protocol != nil { return false } else if that1.Protocol != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Ports) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Ports) if !ok { return fmt.Errorf("that is not of type *Ports") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Ports but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Portsbut is not nil && this == nil") } if len(this.Ports) != len(that1.Ports) { return fmt.Errorf("Ports this(%v) Not Equal that(%v)", len(this.Ports), len(that1.Ports)) } for i := range this.Ports { if !this.Ports[i].Equal(that1.Ports[i]) { return fmt.Errorf("Ports this[%v](%v) Not Equal that[%v](%v)", i, this.Ports[i], i, that1.Ports[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Ports) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Ports) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Ports) != len(that1.Ports) { return false } for i := range this.Ports { if !this.Ports[i].Equal(that1.Ports[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *DiscoveryInfo) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*DiscoveryInfo) if !ok { return fmt.Errorf("that is not of type *DiscoveryInfo") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *DiscoveryInfo but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *DiscoveryInfobut is not nil && this == nil") } if this.Visibility != nil && that1.Visibility != nil { if *this.Visibility != *that1.Visibility { return fmt.Errorf("Visibility this(%v) Not Equal that(%v)", *this.Visibility, *that1.Visibility) } } else if this.Visibility != nil { return fmt.Errorf("this.Visibility == nil && that.Visibility != nil") } else if that1.Visibility != nil { return fmt.Errorf("Visibility this(%v) Not Equal that(%v)", this.Visibility, that1.Visibility) } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return fmt.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name) } } else if this.Name != nil { return fmt.Errorf("this.Name == nil && that.Name != nil") } else if that1.Name != nil { return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name) } if this.Environment != nil && that1.Environment != nil { if *this.Environment != *that1.Environment { return fmt.Errorf("Environment this(%v) Not Equal that(%v)", *this.Environment, *that1.Environment) } } else if this.Environment != nil { return fmt.Errorf("this.Environment == nil && that.Environment != nil") } else if that1.Environment != nil { return fmt.Errorf("Environment this(%v) Not Equal that(%v)", this.Environment, that1.Environment) } if this.Location != nil && that1.Location != nil { if *this.Location != *that1.Location { return fmt.Errorf("Location this(%v) Not Equal that(%v)", *this.Location, *that1.Location) } } else if this.Location != nil { return fmt.Errorf("this.Location == nil && that.Location != nil") } else if that1.Location != nil { return fmt.Errorf("Location this(%v) Not Equal that(%v)", this.Location, that1.Location) } if this.Version != nil && that1.Version != nil { if *this.Version != *that1.Version { return fmt.Errorf("Version this(%v) Not Equal that(%v)", *this.Version, *that1.Version) } } else if this.Version != nil { return fmt.Errorf("this.Version == nil && that.Version != nil") } else if that1.Version != nil { return fmt.Errorf("Version this(%v) Not Equal that(%v)", this.Version, that1.Version) } if !this.Ports.Equal(that1.Ports) { return fmt.Errorf("Ports this(%v) Not Equal that(%v)", this.Ports, that1.Ports) } if !this.Labels.Equal(that1.Labels) { return fmt.Errorf("Labels this(%v) Not Equal that(%v)", this.Labels, that1.Labels) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *DiscoveryInfo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*DiscoveryInfo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Visibility != nil && that1.Visibility != nil { if *this.Visibility != *that1.Visibility { return false } } else if this.Visibility != nil { return false } else if that1.Visibility != nil { return false } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return false } } else if this.Name != nil { return false } else if that1.Name != nil { return false } if this.Environment != nil && that1.Environment != nil { if *this.Environment != *that1.Environment { return false } } else if this.Environment != nil { return false } else if that1.Environment != nil { return false } if this.Location != nil && that1.Location != nil { if *this.Location != *that1.Location { return false } } else if this.Location != nil { return false } else if that1.Location != nil { return false } if this.Version != nil && that1.Version != nil { if *this.Version != *that1.Version { return false } } else if this.Version != nil { return false } else if that1.Version != nil { return false } if !this.Ports.Equal(that1.Ports) { return false } if !this.Labels.Equal(that1.Labels) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *FrameworkID) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.FrameworkID{") if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *OfferID) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.OfferID{") if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *SlaveID) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.SlaveID{") if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *TaskID) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.TaskID{") if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ExecutorID) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.ExecutorID{") if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ContainerID) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.ContainerID{") if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *FrameworkInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 14) s = append(s, "&mesosproto.FrameworkInfo{") if this.User != nil { s = append(s, "User: "+valueToGoStringMesos(this.User, "string")+",\n") } if this.Name != nil { s = append(s, "Name: "+valueToGoStringMesos(this.Name, "string")+",\n") } if this.Id != nil { s = append(s, "Id: "+fmt.Sprintf("%#v", this.Id)+",\n") } if this.FailoverTimeout != nil { s = append(s, "FailoverTimeout: "+valueToGoStringMesos(this.FailoverTimeout, "float64")+",\n") } if this.Checkpoint != nil { s = append(s, "Checkpoint: "+valueToGoStringMesos(this.Checkpoint, "bool")+",\n") } if this.Role != nil { s = append(s, "Role: "+valueToGoStringMesos(this.Role, "string")+",\n") } if this.Hostname != nil { s = append(s, "Hostname: "+valueToGoStringMesos(this.Hostname, "string")+",\n") } if this.Principal != nil { s = append(s, "Principal: "+valueToGoStringMesos(this.Principal, "string")+",\n") } if this.WebuiUrl != nil { s = append(s, "WebuiUrl: "+valueToGoStringMesos(this.WebuiUrl, "string")+",\n") } if this.Capabilities != nil { s = append(s, "Capabilities: "+fmt.Sprintf("%#v", this.Capabilities)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *FrameworkInfo_Capability) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.FrameworkInfo_Capability{") if this.Type != nil { s = append(s, "Type: "+valueToGoStringMesos(this.Type, "mesosproto.FrameworkInfo_Capability_Type")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *HealthCheck) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 11) s = append(s, "&mesosproto.HealthCheck{") if this.Http != nil { s = append(s, "Http: "+fmt.Sprintf("%#v", this.Http)+",\n") } if this.DelaySeconds != nil { s = append(s, "DelaySeconds: "+valueToGoStringMesos(this.DelaySeconds, "float64")+",\n") } if this.IntervalSeconds != nil { s = append(s, "IntervalSeconds: "+valueToGoStringMesos(this.IntervalSeconds, "float64")+",\n") } if this.TimeoutSeconds != nil { s = append(s, "TimeoutSeconds: "+valueToGoStringMesos(this.TimeoutSeconds, "float64")+",\n") } if this.ConsecutiveFailures != nil { s = append(s, "ConsecutiveFailures: "+valueToGoStringMesos(this.ConsecutiveFailures, "uint32")+",\n") } if this.GracePeriodSeconds != nil { s = append(s, "GracePeriodSeconds: "+valueToGoStringMesos(this.GracePeriodSeconds, "float64")+",\n") } if this.Command != nil { s = append(s, "Command: "+fmt.Sprintf("%#v", this.Command)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *HealthCheck_HTTP) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 7) s = append(s, "&mesosproto.HealthCheck_HTTP{") if this.Port != nil { s = append(s, "Port: "+valueToGoStringMesos(this.Port, "uint32")+",\n") } if this.Path != nil { s = append(s, "Path: "+valueToGoStringMesos(this.Path, "string")+",\n") } if this.Statuses != nil { s = append(s, "Statuses: "+fmt.Sprintf("%#v", this.Statuses)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *CommandInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 11) s = append(s, "&mesosproto.CommandInfo{") if this.Container != nil { s = append(s, "Container: "+fmt.Sprintf("%#v", this.Container)+",\n") } if this.Uris != nil { s = append(s, "Uris: "+fmt.Sprintf("%#v", this.Uris)+",\n") } if this.Environment != nil { s = append(s, "Environment: "+fmt.Sprintf("%#v", this.Environment)+",\n") } if this.Shell != nil { s = append(s, "Shell: "+valueToGoStringMesos(this.Shell, "bool")+",\n") } if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "string")+",\n") } if this.Arguments != nil { s = append(s, "Arguments: "+fmt.Sprintf("%#v", this.Arguments)+",\n") } if this.User != nil { s = append(s, "User: "+valueToGoStringMesos(this.User, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *CommandInfo_URI) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 8) s = append(s, "&mesosproto.CommandInfo_URI{") if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "string")+",\n") } if this.Executable != nil { s = append(s, "Executable: "+valueToGoStringMesos(this.Executable, "bool")+",\n") } if this.Extract != nil { s = append(s, "Extract: "+valueToGoStringMesos(this.Extract, "bool")+",\n") } if this.Cache != nil { s = append(s, "Cache: "+valueToGoStringMesos(this.Cache, "bool")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *CommandInfo_ContainerInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.CommandInfo_ContainerInfo{") if this.Image != nil { s = append(s, "Image: "+valueToGoStringMesos(this.Image, "string")+",\n") } if this.Options != nil { s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ExecutorInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 13) s = append(s, "&mesosproto.ExecutorInfo{") if this.ExecutorId != nil { s = append(s, "ExecutorId: "+fmt.Sprintf("%#v", this.ExecutorId)+",\n") } if this.FrameworkId != nil { s = append(s, "FrameworkId: "+fmt.Sprintf("%#v", this.FrameworkId)+",\n") } if this.Command != nil { s = append(s, "Command: "+fmt.Sprintf("%#v", this.Command)+",\n") } if this.Container != nil { s = append(s, "Container: "+fmt.Sprintf("%#v", this.Container)+",\n") } if this.Resources != nil { s = append(s, "Resources: "+fmt.Sprintf("%#v", this.Resources)+",\n") } if this.Name != nil { s = append(s, "Name: "+valueToGoStringMesos(this.Name, "string")+",\n") } if this.Source != nil { s = append(s, "Source: "+valueToGoStringMesos(this.Source, "string")+",\n") } if this.Data != nil { s = append(s, "Data: "+valueToGoStringMesos(this.Data, "byte")+",\n") } if this.Discovery != nil { s = append(s, "Discovery: "+fmt.Sprintf("%#v", this.Discovery)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *MasterInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 10) s = append(s, "&mesosproto.MasterInfo{") if this.Id != nil { s = append(s, "Id: "+valueToGoStringMesos(this.Id, "string")+",\n") } if this.Ip != nil { s = append(s, "Ip: "+valueToGoStringMesos(this.Ip, "uint32")+",\n") } if this.Port != nil { s = append(s, "Port: "+valueToGoStringMesos(this.Port, "uint32")+",\n") } if this.Pid != nil { s = append(s, "Pid: "+valueToGoStringMesos(this.Pid, "string")+",\n") } if this.Hostname != nil { s = append(s, "Hostname: "+valueToGoStringMesos(this.Hostname, "string")+",\n") } if this.Version != nil { s = append(s, "Version: "+valueToGoStringMesos(this.Version, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *SlaveInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 10) s = append(s, "&mesosproto.SlaveInfo{") if this.Hostname != nil { s = append(s, "Hostname: "+valueToGoStringMesos(this.Hostname, "string")+",\n") } if this.Port != nil { s = append(s, "Port: "+valueToGoStringMesos(this.Port, "int32")+",\n") } if this.Resources != nil { s = append(s, "Resources: "+fmt.Sprintf("%#v", this.Resources)+",\n") } if this.Attributes != nil { s = append(s, "Attributes: "+fmt.Sprintf("%#v", this.Attributes)+",\n") } if this.Id != nil { s = append(s, "Id: "+fmt.Sprintf("%#v", this.Id)+",\n") } if this.Checkpoint != nil { s = append(s, "Checkpoint: "+valueToGoStringMesos(this.Checkpoint, "bool")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Value) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 9) s = append(s, "&mesosproto.Value{") if this.Type != nil { s = append(s, "Type: "+valueToGoStringMesos(this.Type, "mesosproto.Value_Type")+",\n") } if this.Scalar != nil { s = append(s, "Scalar: "+fmt.Sprintf("%#v", this.Scalar)+",\n") } if this.Ranges != nil { s = append(s, "Ranges: "+fmt.Sprintf("%#v", this.Ranges)+",\n") } if this.Set != nil { s = append(s, "Set: "+fmt.Sprintf("%#v", this.Set)+",\n") } if this.Text != nil { s = append(s, "Text: "+fmt.Sprintf("%#v", this.Text)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Value_Scalar) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Value_Scalar{") if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "float64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Value_Range) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.Value_Range{") if this.Begin != nil { s = append(s, "Begin: "+valueToGoStringMesos(this.Begin, "uint64")+",\n") } if this.End != nil { s = append(s, "End: "+valueToGoStringMesos(this.End, "uint64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Value_Ranges) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Value_Ranges{") if this.Range != nil { s = append(s, "Range: "+fmt.Sprintf("%#v", this.Range)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Value_Set) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Value_Set{") if this.Item != nil { s = append(s, "Item: "+fmt.Sprintf("%#v", this.Item)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Value_Text) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Value_Text{") if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Attribute) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 10) s = append(s, "&mesosproto.Attribute{") if this.Name != nil { s = append(s, "Name: "+valueToGoStringMesos(this.Name, "string")+",\n") } if this.Type != nil { s = append(s, "Type: "+valueToGoStringMesos(this.Type, "mesosproto.Value_Type")+",\n") } if this.Scalar != nil { s = append(s, "Scalar: "+fmt.Sprintf("%#v", this.Scalar)+",\n") } if this.Ranges != nil { s = append(s, "Ranges: "+fmt.Sprintf("%#v", this.Ranges)+",\n") } if this.Set != nil { s = append(s, "Set: "+fmt.Sprintf("%#v", this.Set)+",\n") } if this.Text != nil { s = append(s, "Text: "+fmt.Sprintf("%#v", this.Text)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Resource) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 13) s = append(s, "&mesosproto.Resource{") if this.Name != nil { s = append(s, "Name: "+valueToGoStringMesos(this.Name, "string")+",\n") } if this.Type != nil { s = append(s, "Type: "+valueToGoStringMesos(this.Type, "mesosproto.Value_Type")+",\n") } if this.Scalar != nil { s = append(s, "Scalar: "+fmt.Sprintf("%#v", this.Scalar)+",\n") } if this.Ranges != nil { s = append(s, "Ranges: "+fmt.Sprintf("%#v", this.Ranges)+",\n") } if this.Set != nil { s = append(s, "Set: "+fmt.Sprintf("%#v", this.Set)+",\n") } if this.Role != nil { s = append(s, "Role: "+valueToGoStringMesos(this.Role, "string")+",\n") } if this.Reservation != nil { s = append(s, "Reservation: "+fmt.Sprintf("%#v", this.Reservation)+",\n") } if this.Disk != nil { s = append(s, "Disk: "+fmt.Sprintf("%#v", this.Disk)+",\n") } if this.Revocable != nil { s = append(s, "Revocable: "+fmt.Sprintf("%#v", this.Revocable)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Resource_ReservationInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Resource_ReservationInfo{") if this.Principal != nil { s = append(s, "Principal: "+valueToGoStringMesos(this.Principal, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Resource_DiskInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.Resource_DiskInfo{") if this.Persistence != nil { s = append(s, "Persistence: "+fmt.Sprintf("%#v", this.Persistence)+",\n") } if this.Volume != nil { s = append(s, "Volume: "+fmt.Sprintf("%#v", this.Volume)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Resource_DiskInfo_Persistence) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Resource_DiskInfo_Persistence{") if this.Id != nil { s = append(s, "Id: "+valueToGoStringMesos(this.Id, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Resource_RevocableInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 4) s = append(s, "&mesosproto.Resource_RevocableInfo{") if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *TrafficControlStatistics) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 14) s = append(s, "&mesosproto.TrafficControlStatistics{") if this.Id != nil { s = append(s, "Id: "+valueToGoStringMesos(this.Id, "string")+",\n") } if this.Backlog != nil { s = append(s, "Backlog: "+valueToGoStringMesos(this.Backlog, "uint64")+",\n") } if this.Bytes != nil { s = append(s, "Bytes: "+valueToGoStringMesos(this.Bytes, "uint64")+",\n") } if this.Drops != nil { s = append(s, "Drops: "+valueToGoStringMesos(this.Drops, "uint64")+",\n") } if this.Overlimits != nil { s = append(s, "Overlimits: "+valueToGoStringMesos(this.Overlimits, "uint64")+",\n") } if this.Packets != nil { s = append(s, "Packets: "+valueToGoStringMesos(this.Packets, "uint64")+",\n") } if this.Qlen != nil { s = append(s, "Qlen: "+valueToGoStringMesos(this.Qlen, "uint64")+",\n") } if this.Ratebps != nil { s = append(s, "Ratebps: "+valueToGoStringMesos(this.Ratebps, "uint64")+",\n") } if this.Ratepps != nil { s = append(s, "Ratepps: "+valueToGoStringMesos(this.Ratepps, "uint64")+",\n") } if this.Requeues != nil { s = append(s, "Requeues: "+valueToGoStringMesos(this.Requeues, "uint64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ResourceStatistics) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 44) s = append(s, "&mesosproto.ResourceStatistics{") if this.Timestamp != nil { s = append(s, "Timestamp: "+valueToGoStringMesos(this.Timestamp, "float64")+",\n") } if this.Processes != nil { s = append(s, "Processes: "+valueToGoStringMesos(this.Processes, "uint32")+",\n") } if this.Threads != nil { s = append(s, "Threads: "+valueToGoStringMesos(this.Threads, "uint32")+",\n") } if this.CpusUserTimeSecs != nil { s = append(s, "CpusUserTimeSecs: "+valueToGoStringMesos(this.CpusUserTimeSecs, "float64")+",\n") } if this.CpusSystemTimeSecs != nil { s = append(s, "CpusSystemTimeSecs: "+valueToGoStringMesos(this.CpusSystemTimeSecs, "float64")+",\n") } if this.CpusLimit != nil { s = append(s, "CpusLimit: "+valueToGoStringMesos(this.CpusLimit, "float64")+",\n") } if this.CpusNrPeriods != nil { s = append(s, "CpusNrPeriods: "+valueToGoStringMesos(this.CpusNrPeriods, "uint32")+",\n") } if this.CpusNrThrottled != nil { s = append(s, "CpusNrThrottled: "+valueToGoStringMesos(this.CpusNrThrottled, "uint32")+",\n") } if this.CpusThrottledTimeSecs != nil { s = append(s, "CpusThrottledTimeSecs: "+valueToGoStringMesos(this.CpusThrottledTimeSecs, "float64")+",\n") } if this.MemTotalBytes != nil { s = append(s, "MemTotalBytes: "+valueToGoStringMesos(this.MemTotalBytes, "uint64")+",\n") } if this.MemTotalMemswBytes != nil { s = append(s, "MemTotalMemswBytes: "+valueToGoStringMesos(this.MemTotalMemswBytes, "uint64")+",\n") } if this.MemLimitBytes != nil { s = append(s, "MemLimitBytes: "+valueToGoStringMesos(this.MemLimitBytes, "uint64")+",\n") } if this.MemSoftLimitBytes != nil { s = append(s, "MemSoftLimitBytes: "+valueToGoStringMesos(this.MemSoftLimitBytes, "uint64")+",\n") } if this.MemFileBytes != nil { s = append(s, "MemFileBytes: "+valueToGoStringMesos(this.MemFileBytes, "uint64")+",\n") } if this.MemAnonBytes != nil { s = append(s, "MemAnonBytes: "+valueToGoStringMesos(this.MemAnonBytes, "uint64")+",\n") } if this.MemCacheBytes != nil { s = append(s, "MemCacheBytes: "+valueToGoStringMesos(this.MemCacheBytes, "uint64")+",\n") } if this.MemRssBytes != nil { s = append(s, "MemRssBytes: "+valueToGoStringMesos(this.MemRssBytes, "uint64")+",\n") } if this.MemMappedFileBytes != nil { s = append(s, "MemMappedFileBytes: "+valueToGoStringMesos(this.MemMappedFileBytes, "uint64")+",\n") } if this.MemSwapBytes != nil { s = append(s, "MemSwapBytes: "+valueToGoStringMesos(this.MemSwapBytes, "uint64")+",\n") } if this.MemLowPressureCounter != nil { s = append(s, "MemLowPressureCounter: "+valueToGoStringMesos(this.MemLowPressureCounter, "uint64")+",\n") } if this.MemMediumPressureCounter != nil { s = append(s, "MemMediumPressureCounter: "+valueToGoStringMesos(this.MemMediumPressureCounter, "uint64")+",\n") } if this.MemCriticalPressureCounter != nil { s = append(s, "MemCriticalPressureCounter: "+valueToGoStringMesos(this.MemCriticalPressureCounter, "uint64")+",\n") } if this.DiskLimitBytes != nil { s = append(s, "DiskLimitBytes: "+valueToGoStringMesos(this.DiskLimitBytes, "uint64")+",\n") } if this.DiskUsedBytes != nil { s = append(s, "DiskUsedBytes: "+valueToGoStringMesos(this.DiskUsedBytes, "uint64")+",\n") } if this.Perf != nil { s = append(s, "Perf: "+fmt.Sprintf("%#v", this.Perf)+",\n") } if this.NetRxPackets != nil { s = append(s, "NetRxPackets: "+valueToGoStringMesos(this.NetRxPackets, "uint64")+",\n") } if this.NetRxBytes != nil { s = append(s, "NetRxBytes: "+valueToGoStringMesos(this.NetRxBytes, "uint64")+",\n") } if this.NetRxErrors != nil { s = append(s, "NetRxErrors: "+valueToGoStringMesos(this.NetRxErrors, "uint64")+",\n") } if this.NetRxDropped != nil { s = append(s, "NetRxDropped: "+valueToGoStringMesos(this.NetRxDropped, "uint64")+",\n") } if this.NetTxPackets != nil { s = append(s, "NetTxPackets: "+valueToGoStringMesos(this.NetTxPackets, "uint64")+",\n") } if this.NetTxBytes != nil { s = append(s, "NetTxBytes: "+valueToGoStringMesos(this.NetTxBytes, "uint64")+",\n") } if this.NetTxErrors != nil { s = append(s, "NetTxErrors: "+valueToGoStringMesos(this.NetTxErrors, "uint64")+",\n") } if this.NetTxDropped != nil { s = append(s, "NetTxDropped: "+valueToGoStringMesos(this.NetTxDropped, "uint64")+",\n") } if this.NetTcpRttMicrosecsP50 != nil { s = append(s, "NetTcpRttMicrosecsP50: "+valueToGoStringMesos(this.NetTcpRttMicrosecsP50, "float64")+",\n") } if this.NetTcpRttMicrosecsP90 != nil { s = append(s, "NetTcpRttMicrosecsP90: "+valueToGoStringMesos(this.NetTcpRttMicrosecsP90, "float64")+",\n") } if this.NetTcpRttMicrosecsP95 != nil { s = append(s, "NetTcpRttMicrosecsP95: "+valueToGoStringMesos(this.NetTcpRttMicrosecsP95, "float64")+",\n") } if this.NetTcpRttMicrosecsP99 != nil { s = append(s, "NetTcpRttMicrosecsP99: "+valueToGoStringMesos(this.NetTcpRttMicrosecsP99, "float64")+",\n") } if this.NetTcpActiveConnections != nil { s = append(s, "NetTcpActiveConnections: "+valueToGoStringMesos(this.NetTcpActiveConnections, "float64")+",\n") } if this.NetTcpTimeWaitConnections != nil { s = append(s, "NetTcpTimeWaitConnections: "+valueToGoStringMesos(this.NetTcpTimeWaitConnections, "float64")+",\n") } if this.NetTrafficControlStatistics != nil { s = append(s, "NetTrafficControlStatistics: "+fmt.Sprintf("%#v", this.NetTrafficControlStatistics)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ResourceUsage) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.ResourceUsage{") if this.Executors != nil { s = append(s, "Executors: "+fmt.Sprintf("%#v", this.Executors)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ResourceUsage_Executor) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 7) s = append(s, "&mesosproto.ResourceUsage_Executor{") if this.ExecutorInfo != nil { s = append(s, "ExecutorInfo: "+fmt.Sprintf("%#v", this.ExecutorInfo)+",\n") } if this.Allocated != nil { s = append(s, "Allocated: "+fmt.Sprintf("%#v", this.Allocated)+",\n") } if this.Statistics != nil { s = append(s, "Statistics: "+fmt.Sprintf("%#v", this.Statistics)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *PerfStatistics) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 57) s = append(s, "&mesosproto.PerfStatistics{") if this.Timestamp != nil { s = append(s, "Timestamp: "+valueToGoStringMesos(this.Timestamp, "float64")+",\n") } if this.Duration != nil { s = append(s, "Duration: "+valueToGoStringMesos(this.Duration, "float64")+",\n") } if this.Cycles != nil { s = append(s, "Cycles: "+valueToGoStringMesos(this.Cycles, "uint64")+",\n") } if this.StalledCyclesFrontend != nil { s = append(s, "StalledCyclesFrontend: "+valueToGoStringMesos(this.StalledCyclesFrontend, "uint64")+",\n") } if this.StalledCyclesBackend != nil { s = append(s, "StalledCyclesBackend: "+valueToGoStringMesos(this.StalledCyclesBackend, "uint64")+",\n") } if this.Instructions != nil { s = append(s, "Instructions: "+valueToGoStringMesos(this.Instructions, "uint64")+",\n") } if this.CacheReferences != nil { s = append(s, "CacheReferences: "+valueToGoStringMesos(this.CacheReferences, "uint64")+",\n") } if this.CacheMisses != nil { s = append(s, "CacheMisses: "+valueToGoStringMesos(this.CacheMisses, "uint64")+",\n") } if this.Branches != nil { s = append(s, "Branches: "+valueToGoStringMesos(this.Branches, "uint64")+",\n") } if this.BranchMisses != nil { s = append(s, "BranchMisses: "+valueToGoStringMesos(this.BranchMisses, "uint64")+",\n") } if this.BusCycles != nil { s = append(s, "BusCycles: "+valueToGoStringMesos(this.BusCycles, "uint64")+",\n") } if this.RefCycles != nil { s = append(s, "RefCycles: "+valueToGoStringMesos(this.RefCycles, "uint64")+",\n") } if this.CpuClock != nil { s = append(s, "CpuClock: "+valueToGoStringMesos(this.CpuClock, "float64")+",\n") } if this.TaskClock != nil { s = append(s, "TaskClock: "+valueToGoStringMesos(this.TaskClock, "float64")+",\n") } if this.PageFaults != nil { s = append(s, "PageFaults: "+valueToGoStringMesos(this.PageFaults, "uint64")+",\n") } if this.MinorFaults != nil { s = append(s, "MinorFaults: "+valueToGoStringMesos(this.MinorFaults, "uint64")+",\n") } if this.MajorFaults != nil { s = append(s, "MajorFaults: "+valueToGoStringMesos(this.MajorFaults, "uint64")+",\n") } if this.ContextSwitches != nil { s = append(s, "ContextSwitches: "+valueToGoStringMesos(this.ContextSwitches, "uint64")+",\n") } if this.CpuMigrations != nil { s = append(s, "CpuMigrations: "+valueToGoStringMesos(this.CpuMigrations, "uint64")+",\n") } if this.AlignmentFaults != nil { s = append(s, "AlignmentFaults: "+valueToGoStringMesos(this.AlignmentFaults, "uint64")+",\n") } if this.EmulationFaults != nil { s = append(s, "EmulationFaults: "+valueToGoStringMesos(this.EmulationFaults, "uint64")+",\n") } if this.L1DcacheLoads != nil { s = append(s, "L1DcacheLoads: "+valueToGoStringMesos(this.L1DcacheLoads, "uint64")+",\n") } if this.L1DcacheLoadMisses != nil { s = append(s, "L1DcacheLoadMisses: "+valueToGoStringMesos(this.L1DcacheLoadMisses, "uint64")+",\n") } if this.L1DcacheStores != nil { s = append(s, "L1DcacheStores: "+valueToGoStringMesos(this.L1DcacheStores, "uint64")+",\n") } if this.L1DcacheStoreMisses != nil { s = append(s, "L1DcacheStoreMisses: "+valueToGoStringMesos(this.L1DcacheStoreMisses, "uint64")+",\n") } if this.L1DcachePrefetches != nil { s = append(s, "L1DcachePrefetches: "+valueToGoStringMesos(this.L1DcachePrefetches, "uint64")+",\n") } if this.L1DcachePrefetchMisses != nil { s = append(s, "L1DcachePrefetchMisses: "+valueToGoStringMesos(this.L1DcachePrefetchMisses, "uint64")+",\n") } if this.L1IcacheLoads != nil { s = append(s, "L1IcacheLoads: "+valueToGoStringMesos(this.L1IcacheLoads, "uint64")+",\n") } if this.L1IcacheLoadMisses != nil { s = append(s, "L1IcacheLoadMisses: "+valueToGoStringMesos(this.L1IcacheLoadMisses, "uint64")+",\n") } if this.L1IcachePrefetches != nil { s = append(s, "L1IcachePrefetches: "+valueToGoStringMesos(this.L1IcachePrefetches, "uint64")+",\n") } if this.L1IcachePrefetchMisses != nil { s = append(s, "L1IcachePrefetchMisses: "+valueToGoStringMesos(this.L1IcachePrefetchMisses, "uint64")+",\n") } if this.LlcLoads != nil { s = append(s, "LlcLoads: "+valueToGoStringMesos(this.LlcLoads, "uint64")+",\n") } if this.LlcLoadMisses != nil { s = append(s, "LlcLoadMisses: "+valueToGoStringMesos(this.LlcLoadMisses, "uint64")+",\n") } if this.LlcStores != nil { s = append(s, "LlcStores: "+valueToGoStringMesos(this.LlcStores, "uint64")+",\n") } if this.LlcStoreMisses != nil { s = append(s, "LlcStoreMisses: "+valueToGoStringMesos(this.LlcStoreMisses, "uint64")+",\n") } if this.LlcPrefetches != nil { s = append(s, "LlcPrefetches: "+valueToGoStringMesos(this.LlcPrefetches, "uint64")+",\n") } if this.LlcPrefetchMisses != nil { s = append(s, "LlcPrefetchMisses: "+valueToGoStringMesos(this.LlcPrefetchMisses, "uint64")+",\n") } if this.DtlbLoads != nil { s = append(s, "DtlbLoads: "+valueToGoStringMesos(this.DtlbLoads, "uint64")+",\n") } if this.DtlbLoadMisses != nil { s = append(s, "DtlbLoadMisses: "+valueToGoStringMesos(this.DtlbLoadMisses, "uint64")+",\n") } if this.DtlbStores != nil { s = append(s, "DtlbStores: "+valueToGoStringMesos(this.DtlbStores, "uint64")+",\n") } if this.DtlbStoreMisses != nil { s = append(s, "DtlbStoreMisses: "+valueToGoStringMesos(this.DtlbStoreMisses, "uint64")+",\n") } if this.DtlbPrefetches != nil { s = append(s, "DtlbPrefetches: "+valueToGoStringMesos(this.DtlbPrefetches, "uint64")+",\n") } if this.DtlbPrefetchMisses != nil { s = append(s, "DtlbPrefetchMisses: "+valueToGoStringMesos(this.DtlbPrefetchMisses, "uint64")+",\n") } if this.ItlbLoads != nil { s = append(s, "ItlbLoads: "+valueToGoStringMesos(this.ItlbLoads, "uint64")+",\n") } if this.ItlbLoadMisses != nil { s = append(s, "ItlbLoadMisses: "+valueToGoStringMesos(this.ItlbLoadMisses, "uint64")+",\n") } if this.BranchLoads != nil { s = append(s, "BranchLoads: "+valueToGoStringMesos(this.BranchLoads, "uint64")+",\n") } if this.BranchLoadMisses != nil { s = append(s, "BranchLoadMisses: "+valueToGoStringMesos(this.BranchLoadMisses, "uint64")+",\n") } if this.NodeLoads != nil { s = append(s, "NodeLoads: "+valueToGoStringMesos(this.NodeLoads, "uint64")+",\n") } if this.NodeLoadMisses != nil { s = append(s, "NodeLoadMisses: "+valueToGoStringMesos(this.NodeLoadMisses, "uint64")+",\n") } if this.NodeStores != nil { s = append(s, "NodeStores: "+valueToGoStringMesos(this.NodeStores, "uint64")+",\n") } if this.NodeStoreMisses != nil { s = append(s, "NodeStoreMisses: "+valueToGoStringMesos(this.NodeStoreMisses, "uint64")+",\n") } if this.NodePrefetches != nil { s = append(s, "NodePrefetches: "+valueToGoStringMesos(this.NodePrefetches, "uint64")+",\n") } if this.NodePrefetchMisses != nil { s = append(s, "NodePrefetchMisses: "+valueToGoStringMesos(this.NodePrefetchMisses, "uint64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Request) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.Request{") if this.SlaveId != nil { s = append(s, "SlaveId: "+fmt.Sprintf("%#v", this.SlaveId)+",\n") } if this.Resources != nil { s = append(s, "Resources: "+fmt.Sprintf("%#v", this.Resources)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Offer) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 11) s = append(s, "&mesosproto.Offer{") if this.Id != nil { s = append(s, "Id: "+fmt.Sprintf("%#v", this.Id)+",\n") } if this.FrameworkId != nil { s = append(s, "FrameworkId: "+fmt.Sprintf("%#v", this.FrameworkId)+",\n") } if this.SlaveId != nil { s = append(s, "SlaveId: "+fmt.Sprintf("%#v", this.SlaveId)+",\n") } if this.Hostname != nil { s = append(s, "Hostname: "+valueToGoStringMesos(this.Hostname, "string")+",\n") } if this.Resources != nil { s = append(s, "Resources: "+fmt.Sprintf("%#v", this.Resources)+",\n") } if this.Attributes != nil { s = append(s, "Attributes: "+fmt.Sprintf("%#v", this.Attributes)+",\n") } if this.ExecutorIds != nil { s = append(s, "ExecutorIds: "+fmt.Sprintf("%#v", this.ExecutorIds)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Offer_Operation) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 10) s = append(s, "&mesosproto.Offer_Operation{") if this.Type != nil { s = append(s, "Type: "+valueToGoStringMesos(this.Type, "mesosproto.Offer_Operation_Type")+",\n") } if this.Launch != nil { s = append(s, "Launch: "+fmt.Sprintf("%#v", this.Launch)+",\n") } if this.Reserve != nil { s = append(s, "Reserve: "+fmt.Sprintf("%#v", this.Reserve)+",\n") } if this.Unreserve != nil { s = append(s, "Unreserve: "+fmt.Sprintf("%#v", this.Unreserve)+",\n") } if this.Create != nil { s = append(s, "Create: "+fmt.Sprintf("%#v", this.Create)+",\n") } if this.Destroy != nil { s = append(s, "Destroy: "+fmt.Sprintf("%#v", this.Destroy)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Offer_Operation_Launch) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Offer_Operation_Launch{") if this.TaskInfos != nil { s = append(s, "TaskInfos: "+fmt.Sprintf("%#v", this.TaskInfos)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Offer_Operation_Reserve) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Offer_Operation_Reserve{") if this.Resources != nil { s = append(s, "Resources: "+fmt.Sprintf("%#v", this.Resources)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Offer_Operation_Unreserve) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Offer_Operation_Unreserve{") if this.Resources != nil { s = append(s, "Resources: "+fmt.Sprintf("%#v", this.Resources)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Offer_Operation_Create) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Offer_Operation_Create{") if this.Volumes != nil { s = append(s, "Volumes: "+fmt.Sprintf("%#v", this.Volumes)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Offer_Operation_Destroy) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Offer_Operation_Destroy{") if this.Volumes != nil { s = append(s, "Volumes: "+fmt.Sprintf("%#v", this.Volumes)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *TaskInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 15) s = append(s, "&mesosproto.TaskInfo{") if this.Name != nil { s = append(s, "Name: "+valueToGoStringMesos(this.Name, "string")+",\n") } if this.TaskId != nil { s = append(s, "TaskId: "+fmt.Sprintf("%#v", this.TaskId)+",\n") } if this.SlaveId != nil { s = append(s, "SlaveId: "+fmt.Sprintf("%#v", this.SlaveId)+",\n") } if this.Resources != nil { s = append(s, "Resources: "+fmt.Sprintf("%#v", this.Resources)+",\n") } if this.Executor != nil { s = append(s, "Executor: "+fmt.Sprintf("%#v", this.Executor)+",\n") } if this.Command != nil { s = append(s, "Command: "+fmt.Sprintf("%#v", this.Command)+",\n") } if this.Container != nil { s = append(s, "Container: "+fmt.Sprintf("%#v", this.Container)+",\n") } if this.Data != nil { s = append(s, "Data: "+valueToGoStringMesos(this.Data, "byte")+",\n") } if this.HealthCheck != nil { s = append(s, "HealthCheck: "+fmt.Sprintf("%#v", this.HealthCheck)+",\n") } if this.Labels != nil { s = append(s, "Labels: "+fmt.Sprintf("%#v", this.Labels)+",\n") } if this.Discovery != nil { s = append(s, "Discovery: "+fmt.Sprintf("%#v", this.Discovery)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *TaskStatus) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 15) s = append(s, "&mesosproto.TaskStatus{") if this.TaskId != nil { s = append(s, "TaskId: "+fmt.Sprintf("%#v", this.TaskId)+",\n") } if this.State != nil { s = append(s, "State: "+valueToGoStringMesos(this.State, "mesosproto.TaskState")+",\n") } if this.Message != nil { s = append(s, "Message: "+valueToGoStringMesos(this.Message, "string")+",\n") } if this.Source != nil { s = append(s, "Source: "+valueToGoStringMesos(this.Source, "mesosproto.TaskStatus_Source")+",\n") } if this.Reason != nil { s = append(s, "Reason: "+valueToGoStringMesos(this.Reason, "mesosproto.TaskStatus_Reason")+",\n") } if this.Data != nil { s = append(s, "Data: "+valueToGoStringMesos(this.Data, "byte")+",\n") } if this.SlaveId != nil { s = append(s, "SlaveId: "+fmt.Sprintf("%#v", this.SlaveId)+",\n") } if this.ExecutorId != nil { s = append(s, "ExecutorId: "+fmt.Sprintf("%#v", this.ExecutorId)+",\n") } if this.Timestamp != nil { s = append(s, "Timestamp: "+valueToGoStringMesos(this.Timestamp, "float64")+",\n") } if this.Uuid != nil { s = append(s, "Uuid: "+valueToGoStringMesos(this.Uuid, "byte")+",\n") } if this.Healthy != nil { s = append(s, "Healthy: "+valueToGoStringMesos(this.Healthy, "bool")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Filters) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Filters{") if this.RefuseSeconds != nil { s = append(s, "RefuseSeconds: "+valueToGoStringMesos(this.RefuseSeconds, "float64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Environment) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Environment{") if this.Variables != nil { s = append(s, "Variables: "+fmt.Sprintf("%#v", this.Variables)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Environment_Variable) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.Environment_Variable{") if this.Name != nil { s = append(s, "Name: "+valueToGoStringMesos(this.Name, "string")+",\n") } if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Parameter) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.Parameter{") if this.Key != nil { s = append(s, "Key: "+valueToGoStringMesos(this.Key, "string")+",\n") } if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Parameters) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Parameters{") if this.Parameter != nil { s = append(s, "Parameter: "+fmt.Sprintf("%#v", this.Parameter)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Credential) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.Credential{") if this.Principal != nil { s = append(s, "Principal: "+valueToGoStringMesos(this.Principal, "string")+",\n") } if this.Secret != nil { s = append(s, "Secret: "+valueToGoStringMesos(this.Secret, "byte")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Credentials) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Credentials{") if this.Credentials != nil { s = append(s, "Credentials: "+fmt.Sprintf("%#v", this.Credentials)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ACL) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 4) s = append(s, "&mesosproto.ACL{") if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ACL_Entity) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.ACL_Entity{") if this.Type != nil { s = append(s, "Type: "+valueToGoStringMesos(this.Type, "mesosproto.ACL_Entity_Type")+",\n") } if this.Values != nil { s = append(s, "Values: "+fmt.Sprintf("%#v", this.Values)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ACL_RegisterFramework) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.ACL_RegisterFramework{") if this.Principals != nil { s = append(s, "Principals: "+fmt.Sprintf("%#v", this.Principals)+",\n") } if this.Roles != nil { s = append(s, "Roles: "+fmt.Sprintf("%#v", this.Roles)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ACL_RunTask) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.ACL_RunTask{") if this.Principals != nil { s = append(s, "Principals: "+fmt.Sprintf("%#v", this.Principals)+",\n") } if this.Users != nil { s = append(s, "Users: "+fmt.Sprintf("%#v", this.Users)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ACL_ShutdownFramework) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.ACL_ShutdownFramework{") if this.Principals != nil { s = append(s, "Principals: "+fmt.Sprintf("%#v", this.Principals)+",\n") } if this.FrameworkPrincipals != nil { s = append(s, "FrameworkPrincipals: "+fmt.Sprintf("%#v", this.FrameworkPrincipals)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ACLs) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 8) s = append(s, "&mesosproto.ACLs{") if this.Permissive != nil { s = append(s, "Permissive: "+valueToGoStringMesos(this.Permissive, "bool")+",\n") } if this.RegisterFrameworks != nil { s = append(s, "RegisterFrameworks: "+fmt.Sprintf("%#v", this.RegisterFrameworks)+",\n") } if this.RunTasks != nil { s = append(s, "RunTasks: "+fmt.Sprintf("%#v", this.RunTasks)+",\n") } if this.ShutdownFrameworks != nil { s = append(s, "ShutdownFrameworks: "+fmt.Sprintf("%#v", this.ShutdownFrameworks)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *RateLimit) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 7) s = append(s, "&mesosproto.RateLimit{") if this.Qps != nil { s = append(s, "Qps: "+valueToGoStringMesos(this.Qps, "float64")+",\n") } if this.Principal != nil { s = append(s, "Principal: "+valueToGoStringMesos(this.Principal, "string")+",\n") } if this.Capacity != nil { s = append(s, "Capacity: "+valueToGoStringMesos(this.Capacity, "uint64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *RateLimits) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 7) s = append(s, "&mesosproto.RateLimits{") if this.Limits != nil { s = append(s, "Limits: "+fmt.Sprintf("%#v", this.Limits)+",\n") } if this.AggregateDefaultQps != nil { s = append(s, "AggregateDefaultQps: "+valueToGoStringMesos(this.AggregateDefaultQps, "float64")+",\n") } if this.AggregateDefaultCapacity != nil { s = append(s, "AggregateDefaultCapacity: "+valueToGoStringMesos(this.AggregateDefaultCapacity, "uint64")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Volume) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 7) s = append(s, "&mesosproto.Volume{") if this.ContainerPath != nil { s = append(s, "ContainerPath: "+valueToGoStringMesos(this.ContainerPath, "string")+",\n") } if this.HostPath != nil { s = append(s, "HostPath: "+valueToGoStringMesos(this.HostPath, "string")+",\n") } if this.Mode != nil { s = append(s, "Mode: "+valueToGoStringMesos(this.Mode, "mesosproto.Volume_Mode")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ContainerInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 8) s = append(s, "&mesosproto.ContainerInfo{") if this.Type != nil { s = append(s, "Type: "+valueToGoStringMesos(this.Type, "mesosproto.ContainerInfo_Type")+",\n") } if this.Volumes != nil { s = append(s, "Volumes: "+fmt.Sprintf("%#v", this.Volumes)+",\n") } if this.Hostname != nil { s = append(s, "Hostname: "+valueToGoStringMesos(this.Hostname, "string")+",\n") } if this.Docker != nil { s = append(s, "Docker: "+fmt.Sprintf("%#v", this.Docker)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ContainerInfo_DockerInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 10) s = append(s, "&mesosproto.ContainerInfo_DockerInfo{") if this.Image != nil { s = append(s, "Image: "+valueToGoStringMesos(this.Image, "string")+",\n") } if this.Network != nil { s = append(s, "Network: "+valueToGoStringMesos(this.Network, "mesosproto.ContainerInfo_DockerInfo_Network")+",\n") } if this.PortMappings != nil { s = append(s, "PortMappings: "+fmt.Sprintf("%#v", this.PortMappings)+",\n") } if this.Privileged != nil { s = append(s, "Privileged: "+valueToGoStringMesos(this.Privileged, "bool")+",\n") } if this.Parameters != nil { s = append(s, "Parameters: "+fmt.Sprintf("%#v", this.Parameters)+",\n") } if this.ForcePullImage != nil { s = append(s, "ForcePullImage: "+valueToGoStringMesos(this.ForcePullImage, "bool")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ContainerInfo_DockerInfo_PortMapping) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 7) s = append(s, "&mesosproto.ContainerInfo_DockerInfo_PortMapping{") if this.HostPort != nil { s = append(s, "HostPort: "+valueToGoStringMesos(this.HostPort, "uint32")+",\n") } if this.ContainerPort != nil { s = append(s, "ContainerPort: "+valueToGoStringMesos(this.ContainerPort, "uint32")+",\n") } if this.Protocol != nil { s = append(s, "Protocol: "+valueToGoStringMesos(this.Protocol, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Labels) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Labels{") if this.Labels != nil { s = append(s, "Labels: "+fmt.Sprintf("%#v", this.Labels)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Label) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&mesosproto.Label{") if this.Key != nil { s = append(s, "Key: "+valueToGoStringMesos(this.Key, "string")+",\n") } if this.Value != nil { s = append(s, "Value: "+valueToGoStringMesos(this.Value, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Port) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 7) s = append(s, "&mesosproto.Port{") if this.Number != nil { s = append(s, "Number: "+valueToGoStringMesos(this.Number, "uint32")+",\n") } if this.Name != nil { s = append(s, "Name: "+valueToGoStringMesos(this.Name, "string")+",\n") } if this.Protocol != nil { s = append(s, "Protocol: "+valueToGoStringMesos(this.Protocol, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Ports) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Ports{") if this.Ports != nil { s = append(s, "Ports: "+fmt.Sprintf("%#v", this.Ports)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *DiscoveryInfo) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 11) s = append(s, "&mesosproto.DiscoveryInfo{") if this.Visibility != nil { s = append(s, "Visibility: "+valueToGoStringMesos(this.Visibility, "mesosproto.DiscoveryInfo_Visibility")+",\n") } if this.Name != nil { s = append(s, "Name: "+valueToGoStringMesos(this.Name, "string")+",\n") } if this.Environment != nil { s = append(s, "Environment: "+valueToGoStringMesos(this.Environment, "string")+",\n") } if this.Location != nil { s = append(s, "Location: "+valueToGoStringMesos(this.Location, "string")+",\n") } if this.Version != nil { s = append(s, "Version: "+valueToGoStringMesos(this.Version, "string")+",\n") } if this.Ports != nil { s = append(s, "Ports: "+fmt.Sprintf("%#v", this.Ports)+",\n") } if this.Labels != nil { s = append(s, "Labels: "+fmt.Sprintf("%#v", this.Labels)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func valueToGoStringMesos(v interface{}, typ string) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) } func extensionToGoStringMesos(e map[int32]github_com_gogo_protobuf_proto.Extension) string { if e == nil { return "nil" } s := "map[int32]proto.Extension{" keys := make([]int, 0, len(e)) for k := range e { keys = append(keys, int(k)) } sort.Ints(keys) ss := []string{} for _, k := range keys { ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) } s += strings.Join(ss, ",") + "}" return s } func (m *FrameworkID) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *FrameworkID) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Value == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Value))) i += copy(data[i:], *m.Value) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *OfferID) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *OfferID) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Value == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Value))) i += copy(data[i:], *m.Value) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *SlaveID) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *SlaveID) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Value == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Value))) i += copy(data[i:], *m.Value) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *TaskID) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *TaskID) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Value == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Value))) i += copy(data[i:], *m.Value) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ExecutorID) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ExecutorID) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Value == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Value))) i += copy(data[i:], *m.Value) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ContainerID) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ContainerID) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Value == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Value))) i += copy(data[i:], *m.Value) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *FrameworkInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *FrameworkInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.User == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("user") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.User))) i += copy(data[i:], *m.User) } if m.Name == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } else { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Name))) i += copy(data[i:], *m.Name) } if m.Id != nil { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(m.Id.Size())) n1, err := m.Id.MarshalTo(data[i:]) if err != nil { return 0, err } i += n1 } if m.FailoverTimeout != nil { data[i] = 0x21 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.FailoverTimeout))) } if m.Checkpoint != nil { data[i] = 0x28 i++ if *m.Checkpoint { data[i] = 1 } else { data[i] = 0 } i++ } if m.Role != nil { data[i] = 0x32 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Role))) i += copy(data[i:], *m.Role) } if m.Hostname != nil { data[i] = 0x3a i++ i = encodeVarintMesos(data, i, uint64(len(*m.Hostname))) i += copy(data[i:], *m.Hostname) } if m.Principal != nil { data[i] = 0x42 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Principal))) i += copy(data[i:], *m.Principal) } if m.WebuiUrl != nil { data[i] = 0x4a i++ i = encodeVarintMesos(data, i, uint64(len(*m.WebuiUrl))) i += copy(data[i:], *m.WebuiUrl) } if len(m.Capabilities) > 0 { for _, msg := range m.Capabilities { data[i] = 0x52 i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *FrameworkInfo_Capability) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *FrameworkInfo_Capability) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Type == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } else { data[i] = 0x8 i++ i = encodeVarintMesos(data, i, uint64(*m.Type)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *HealthCheck) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *HealthCheck) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Http != nil { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(m.Http.Size())) n2, err := m.Http.MarshalTo(data[i:]) if err != nil { return 0, err } i += n2 } if m.DelaySeconds != nil { data[i] = 0x11 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.DelaySeconds))) } if m.IntervalSeconds != nil { data[i] = 0x19 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.IntervalSeconds))) } if m.TimeoutSeconds != nil { data[i] = 0x21 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.TimeoutSeconds))) } if m.ConsecutiveFailures != nil { data[i] = 0x28 i++ i = encodeVarintMesos(data, i, uint64(*m.ConsecutiveFailures)) } if m.GracePeriodSeconds != nil { data[i] = 0x31 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.GracePeriodSeconds))) } if m.Command != nil { data[i] = 0x3a i++ i = encodeVarintMesos(data, i, uint64(m.Command.Size())) n3, err := m.Command.MarshalTo(data[i:]) if err != nil { return 0, err } i += n3 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *HealthCheck_HTTP) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *HealthCheck_HTTP) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Port == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("port") } else { data[i] = 0x8 i++ i = encodeVarintMesos(data, i, uint64(*m.Port)) } if m.Path != nil { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Path))) i += copy(data[i:], *m.Path) } if len(m.Statuses) > 0 { for _, num := range m.Statuses { data[i] = 0x20 i++ i = encodeVarintMesos(data, i, uint64(num)) } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *CommandInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *CommandInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Uris) > 0 { for _, msg := range m.Uris { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.Environment != nil { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(m.Environment.Size())) n4, err := m.Environment.MarshalTo(data[i:]) if err != nil { return 0, err } i += n4 } if m.Value != nil { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(len(*m.Value))) i += copy(data[i:], *m.Value) } if m.Container != nil { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(m.Container.Size())) n5, err := m.Container.MarshalTo(data[i:]) if err != nil { return 0, err } i += n5 } if m.User != nil { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(len(*m.User))) i += copy(data[i:], *m.User) } if m.Shell != nil { data[i] = 0x30 i++ if *m.Shell { data[i] = 1 } else { data[i] = 0 } i++ } if len(m.Arguments) > 0 { for _, s := range m.Arguments { data[i] = 0x3a i++ l = len(s) for l >= 1<<7 { data[i] = uint8(uint64(l)&0x7f | 0x80) l >>= 7 i++ } data[i] = uint8(l) i++ i += copy(data[i:], s) } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *CommandInfo_URI) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *CommandInfo_URI) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Value == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Value))) i += copy(data[i:], *m.Value) } if m.Executable != nil { data[i] = 0x10 i++ if *m.Executable { data[i] = 1 } else { data[i] = 0 } i++ } if m.Extract != nil { data[i] = 0x18 i++ if *m.Extract { data[i] = 1 } else { data[i] = 0 } i++ } if m.Cache != nil { data[i] = 0x20 i++ if *m.Cache { data[i] = 1 } else { data[i] = 0 } i++ } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *CommandInfo_ContainerInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *CommandInfo_ContainerInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Image == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("image") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Image))) i += copy(data[i:], *m.Image) } if len(m.Options) > 0 { for _, s := range m.Options { data[i] = 0x12 i++ l = len(s) for l >= 1<<7 { data[i] = uint8(uint64(l)&0x7f | 0x80) l >>= 7 i++ } data[i] = uint8(l) i++ i += copy(data[i:], s) } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ExecutorInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ExecutorInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.ExecutorId == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("executor_id") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(m.ExecutorId.Size())) n6, err := m.ExecutorId.MarshalTo(data[i:]) if err != nil { return 0, err } i += n6 } if m.Data != nil { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(len(m.Data))) i += copy(data[i:], m.Data) } if len(m.Resources) > 0 { for _, msg := range m.Resources { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.Command == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("command") } else { data[i] = 0x3a i++ i = encodeVarintMesos(data, i, uint64(m.Command.Size())) n7, err := m.Command.MarshalTo(data[i:]) if err != nil { return 0, err } i += n7 } if m.FrameworkId != nil { data[i] = 0x42 i++ i = encodeVarintMesos(data, i, uint64(m.FrameworkId.Size())) n8, err := m.FrameworkId.MarshalTo(data[i:]) if err != nil { return 0, err } i += n8 } if m.Name != nil { data[i] = 0x4a i++ i = encodeVarintMesos(data, i, uint64(len(*m.Name))) i += copy(data[i:], *m.Name) } if m.Source != nil { data[i] = 0x52 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Source))) i += copy(data[i:], *m.Source) } if m.Container != nil { data[i] = 0x5a i++ i = encodeVarintMesos(data, i, uint64(m.Container.Size())) n9, err := m.Container.MarshalTo(data[i:]) if err != nil { return 0, err } i += n9 } if m.Discovery != nil { data[i] = 0x62 i++ i = encodeVarintMesos(data, i, uint64(m.Discovery.Size())) n10, err := m.Discovery.MarshalTo(data[i:]) if err != nil { return 0, err } i += n10 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *MasterInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *MasterInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Id == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Id))) i += copy(data[i:], *m.Id) } if m.Ip == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("ip") } else { data[i] = 0x10 i++ i = encodeVarintMesos(data, i, uint64(*m.Ip)) } if m.Port == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("port") } else { data[i] = 0x18 i++ i = encodeVarintMesos(data, i, uint64(*m.Port)) } if m.Pid != nil { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Pid))) i += copy(data[i:], *m.Pid) } if m.Hostname != nil { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(len(*m.Hostname))) i += copy(data[i:], *m.Hostname) } if m.Version != nil { data[i] = 0x32 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Version))) i += copy(data[i:], *m.Version) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *SlaveInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *SlaveInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Hostname == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("hostname") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Hostname))) i += copy(data[i:], *m.Hostname) } if len(m.Resources) > 0 { for _, msg := range m.Resources { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if len(m.Attributes) > 0 { for _, msg := range m.Attributes { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.Id != nil { data[i] = 0x32 i++ i = encodeVarintMesos(data, i, uint64(m.Id.Size())) n11, err := m.Id.MarshalTo(data[i:]) if err != nil { return 0, err } i += n11 } if m.Checkpoint != nil { data[i] = 0x38 i++ if *m.Checkpoint { data[i] = 1 } else { data[i] = 0 } i++ } if m.Port != nil { data[i] = 0x40 i++ i = encodeVarintMesos(data, i, uint64(*m.Port)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Value) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Value) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Type == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } else { data[i] = 0x8 i++ i = encodeVarintMesos(data, i, uint64(*m.Type)) } if m.Scalar != nil { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(m.Scalar.Size())) n12, err := m.Scalar.MarshalTo(data[i:]) if err != nil { return 0, err } i += n12 } if m.Ranges != nil { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(m.Ranges.Size())) n13, err := m.Ranges.MarshalTo(data[i:]) if err != nil { return 0, err } i += n13 } if m.Set != nil { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(m.Set.Size())) n14, err := m.Set.MarshalTo(data[i:]) if err != nil { return 0, err } i += n14 } if m.Text != nil { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(m.Text.Size())) n15, err := m.Text.MarshalTo(data[i:]) if err != nil { return 0, err } i += n15 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Value_Scalar) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Value_Scalar) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Value == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } else { data[i] = 0x9 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.Value))) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Value_Range) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Value_Range) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Begin == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("begin") } else { data[i] = 0x8 i++ i = encodeVarintMesos(data, i, uint64(*m.Begin)) } if m.End == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("end") } else { data[i] = 0x10 i++ i = encodeVarintMesos(data, i, uint64(*m.End)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Value_Ranges) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Value_Ranges) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Range) > 0 { for _, msg := range m.Range { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Value_Set) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Value_Set) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Item) > 0 { for _, s := range m.Item { data[i] = 0xa i++ l = len(s) for l >= 1<<7 { data[i] = uint8(uint64(l)&0x7f | 0x80) l >>= 7 i++ } data[i] = uint8(l) i++ i += copy(data[i:], s) } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Value_Text) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Value_Text) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Value == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Value))) i += copy(data[i:], *m.Value) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Attribute) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Attribute) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Name == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Name))) i += copy(data[i:], *m.Name) } if m.Type == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } else { data[i] = 0x10 i++ i = encodeVarintMesos(data, i, uint64(*m.Type)) } if m.Scalar != nil { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(m.Scalar.Size())) n16, err := m.Scalar.MarshalTo(data[i:]) if err != nil { return 0, err } i += n16 } if m.Ranges != nil { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(m.Ranges.Size())) n17, err := m.Ranges.MarshalTo(data[i:]) if err != nil { return 0, err } i += n17 } if m.Text != nil { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(m.Text.Size())) n18, err := m.Text.MarshalTo(data[i:]) if err != nil { return 0, err } i += n18 } if m.Set != nil { data[i] = 0x32 i++ i = encodeVarintMesos(data, i, uint64(m.Set.Size())) n19, err := m.Set.MarshalTo(data[i:]) if err != nil { return 0, err } i += n19 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Resource) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Resource) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Name == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Name))) i += copy(data[i:], *m.Name) } if m.Type == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } else { data[i] = 0x10 i++ i = encodeVarintMesos(data, i, uint64(*m.Type)) } if m.Scalar != nil { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(m.Scalar.Size())) n20, err := m.Scalar.MarshalTo(data[i:]) if err != nil { return 0, err } i += n20 } if m.Ranges != nil { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(m.Ranges.Size())) n21, err := m.Ranges.MarshalTo(data[i:]) if err != nil { return 0, err } i += n21 } if m.Set != nil { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(m.Set.Size())) n22, err := m.Set.MarshalTo(data[i:]) if err != nil { return 0, err } i += n22 } if m.Role != nil { data[i] = 0x32 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Role))) i += copy(data[i:], *m.Role) } if m.Disk != nil { data[i] = 0x3a i++ i = encodeVarintMesos(data, i, uint64(m.Disk.Size())) n23, err := m.Disk.MarshalTo(data[i:]) if err != nil { return 0, err } i += n23 } if m.Reservation != nil { data[i] = 0x42 i++ i = encodeVarintMesos(data, i, uint64(m.Reservation.Size())) n24, err := m.Reservation.MarshalTo(data[i:]) if err != nil { return 0, err } i += n24 } if m.Revocable != nil { data[i] = 0x4a i++ i = encodeVarintMesos(data, i, uint64(m.Revocable.Size())) n25, err := m.Revocable.MarshalTo(data[i:]) if err != nil { return 0, err } i += n25 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Resource_ReservationInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Resource_ReservationInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Principal == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("principal") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Principal))) i += copy(data[i:], *m.Principal) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Resource_DiskInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Resource_DiskInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Persistence != nil { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(m.Persistence.Size())) n26, err := m.Persistence.MarshalTo(data[i:]) if err != nil { return 0, err } i += n26 } if m.Volume != nil { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(m.Volume.Size())) n27, err := m.Volume.MarshalTo(data[i:]) if err != nil { return 0, err } i += n27 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Resource_DiskInfo_Persistence) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Resource_DiskInfo_Persistence) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Id == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Id))) i += copy(data[i:], *m.Id) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Resource_RevocableInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Resource_RevocableInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *TrafficControlStatistics) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *TrafficControlStatistics) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Id == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Id))) i += copy(data[i:], *m.Id) } if m.Backlog != nil { data[i] = 0x10 i++ i = encodeVarintMesos(data, i, uint64(*m.Backlog)) } if m.Bytes != nil { data[i] = 0x18 i++ i = encodeVarintMesos(data, i, uint64(*m.Bytes)) } if m.Drops != nil { data[i] = 0x20 i++ i = encodeVarintMesos(data, i, uint64(*m.Drops)) } if m.Overlimits != nil { data[i] = 0x28 i++ i = encodeVarintMesos(data, i, uint64(*m.Overlimits)) } if m.Packets != nil { data[i] = 0x30 i++ i = encodeVarintMesos(data, i, uint64(*m.Packets)) } if m.Qlen != nil { data[i] = 0x38 i++ i = encodeVarintMesos(data, i, uint64(*m.Qlen)) } if m.Ratebps != nil { data[i] = 0x40 i++ i = encodeVarintMesos(data, i, uint64(*m.Ratebps)) } if m.Ratepps != nil { data[i] = 0x48 i++ i = encodeVarintMesos(data, i, uint64(*m.Ratepps)) } if m.Requeues != nil { data[i] = 0x50 i++ i = encodeVarintMesos(data, i, uint64(*m.Requeues)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ResourceStatistics) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ResourceStatistics) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Timestamp == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("timestamp") } else { data[i] = 0x9 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.Timestamp))) } if m.CpusUserTimeSecs != nil { data[i] = 0x11 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.CpusUserTimeSecs))) } if m.CpusSystemTimeSecs != nil { data[i] = 0x19 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.CpusSystemTimeSecs))) } if m.CpusLimit != nil { data[i] = 0x21 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.CpusLimit))) } if m.MemRssBytes != nil { data[i] = 0x28 i++ i = encodeVarintMesos(data, i, uint64(*m.MemRssBytes)) } if m.MemLimitBytes != nil { data[i] = 0x30 i++ i = encodeVarintMesos(data, i, uint64(*m.MemLimitBytes)) } if m.CpusNrPeriods != nil { data[i] = 0x38 i++ i = encodeVarintMesos(data, i, uint64(*m.CpusNrPeriods)) } if m.CpusNrThrottled != nil { data[i] = 0x40 i++ i = encodeVarintMesos(data, i, uint64(*m.CpusNrThrottled)) } if m.CpusThrottledTimeSecs != nil { data[i] = 0x49 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.CpusThrottledTimeSecs))) } if m.MemFileBytes != nil { data[i] = 0x50 i++ i = encodeVarintMesos(data, i, uint64(*m.MemFileBytes)) } if m.MemAnonBytes != nil { data[i] = 0x58 i++ i = encodeVarintMesos(data, i, uint64(*m.MemAnonBytes)) } if m.MemMappedFileBytes != nil { data[i] = 0x60 i++ i = encodeVarintMesos(data, i, uint64(*m.MemMappedFileBytes)) } if m.Perf != nil { data[i] = 0x6a i++ i = encodeVarintMesos(data, i, uint64(m.Perf.Size())) n28, err := m.Perf.MarshalTo(data[i:]) if err != nil { return 0, err } i += n28 } if m.NetRxPackets != nil { data[i] = 0x70 i++ i = encodeVarintMesos(data, i, uint64(*m.NetRxPackets)) } if m.NetRxBytes != nil { data[i] = 0x78 i++ i = encodeVarintMesos(data, i, uint64(*m.NetRxBytes)) } if m.NetRxErrors != nil { data[i] = 0x80 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.NetRxErrors)) } if m.NetRxDropped != nil { data[i] = 0x88 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.NetRxDropped)) } if m.NetTxPackets != nil { data[i] = 0x90 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.NetTxPackets)) } if m.NetTxBytes != nil { data[i] = 0x98 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.NetTxBytes)) } if m.NetTxErrors != nil { data[i] = 0xa0 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.NetTxErrors)) } if m.NetTxDropped != nil { data[i] = 0xa8 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.NetTxDropped)) } if m.NetTcpRttMicrosecsP50 != nil { data[i] = 0xb1 i++ data[i] = 0x1 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.NetTcpRttMicrosecsP50))) } if m.NetTcpRttMicrosecsP90 != nil { data[i] = 0xb9 i++ data[i] = 0x1 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.NetTcpRttMicrosecsP90))) } if m.NetTcpRttMicrosecsP95 != nil { data[i] = 0xc1 i++ data[i] = 0x1 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.NetTcpRttMicrosecsP95))) } if m.NetTcpRttMicrosecsP99 != nil { data[i] = 0xc9 i++ data[i] = 0x1 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.NetTcpRttMicrosecsP99))) } if m.DiskLimitBytes != nil { data[i] = 0xd0 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.DiskLimitBytes)) } if m.DiskUsedBytes != nil { data[i] = 0xd8 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.DiskUsedBytes)) } if m.NetTcpActiveConnections != nil { data[i] = 0xe1 i++ data[i] = 0x1 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.NetTcpActiveConnections))) } if m.NetTcpTimeWaitConnections != nil { data[i] = 0xe9 i++ data[i] = 0x1 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.NetTcpTimeWaitConnections))) } if m.Processes != nil { data[i] = 0xf0 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.Processes)) } if m.Threads != nil { data[i] = 0xf8 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.Threads)) } if m.MemLowPressureCounter != nil { data[i] = 0x80 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.MemLowPressureCounter)) } if m.MemMediumPressureCounter != nil { data[i] = 0x88 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.MemMediumPressureCounter)) } if m.MemCriticalPressureCounter != nil { data[i] = 0x90 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.MemCriticalPressureCounter)) } if len(m.NetTrafficControlStatistics) > 0 { for _, msg := range m.NetTrafficControlStatistics { data[i] = 0x9a i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.MemTotalBytes != nil { data[i] = 0xa0 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.MemTotalBytes)) } if m.MemTotalMemswBytes != nil { data[i] = 0xa8 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.MemTotalMemswBytes)) } if m.MemSoftLimitBytes != nil { data[i] = 0xb0 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.MemSoftLimitBytes)) } if m.MemCacheBytes != nil { data[i] = 0xb8 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.MemCacheBytes)) } if m.MemSwapBytes != nil { data[i] = 0xc0 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.MemSwapBytes)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ResourceUsage) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ResourceUsage) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Executors) > 0 { for _, msg := range m.Executors { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ResourceUsage_Executor) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ResourceUsage_Executor) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.ExecutorInfo == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("executor_info") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(m.ExecutorInfo.Size())) n29, err := m.ExecutorInfo.MarshalTo(data[i:]) if err != nil { return 0, err } i += n29 } if len(m.Allocated) > 0 { for _, msg := range m.Allocated { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.Statistics != nil { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(m.Statistics.Size())) n30, err := m.Statistics.MarshalTo(data[i:]) if err != nil { return 0, err } i += n30 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *PerfStatistics) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *PerfStatistics) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Timestamp == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("timestamp") } else { data[i] = 0x9 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.Timestamp))) } if m.Duration == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("duration") } else { data[i] = 0x11 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.Duration))) } if m.Cycles != nil { data[i] = 0x18 i++ i = encodeVarintMesos(data, i, uint64(*m.Cycles)) } if m.StalledCyclesFrontend != nil { data[i] = 0x20 i++ i = encodeVarintMesos(data, i, uint64(*m.StalledCyclesFrontend)) } if m.StalledCyclesBackend != nil { data[i] = 0x28 i++ i = encodeVarintMesos(data, i, uint64(*m.StalledCyclesBackend)) } if m.Instructions != nil { data[i] = 0x30 i++ i = encodeVarintMesos(data, i, uint64(*m.Instructions)) } if m.CacheReferences != nil { data[i] = 0x38 i++ i = encodeVarintMesos(data, i, uint64(*m.CacheReferences)) } if m.CacheMisses != nil { data[i] = 0x40 i++ i = encodeVarintMesos(data, i, uint64(*m.CacheMisses)) } if m.Branches != nil { data[i] = 0x48 i++ i = encodeVarintMesos(data, i, uint64(*m.Branches)) } if m.BranchMisses != nil { data[i] = 0x50 i++ i = encodeVarintMesos(data, i, uint64(*m.BranchMisses)) } if m.BusCycles != nil { data[i] = 0x58 i++ i = encodeVarintMesos(data, i, uint64(*m.BusCycles)) } if m.RefCycles != nil { data[i] = 0x60 i++ i = encodeVarintMesos(data, i, uint64(*m.RefCycles)) } if m.CpuClock != nil { data[i] = 0x69 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.CpuClock))) } if m.TaskClock != nil { data[i] = 0x71 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.TaskClock))) } if m.PageFaults != nil { data[i] = 0x78 i++ i = encodeVarintMesos(data, i, uint64(*m.PageFaults)) } if m.MinorFaults != nil { data[i] = 0x80 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.MinorFaults)) } if m.MajorFaults != nil { data[i] = 0x88 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.MajorFaults)) } if m.ContextSwitches != nil { data[i] = 0x90 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.ContextSwitches)) } if m.CpuMigrations != nil { data[i] = 0x98 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.CpuMigrations)) } if m.AlignmentFaults != nil { data[i] = 0xa0 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.AlignmentFaults)) } if m.EmulationFaults != nil { data[i] = 0xa8 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.EmulationFaults)) } if m.L1DcacheLoads != nil { data[i] = 0xb0 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.L1DcacheLoads)) } if m.L1DcacheLoadMisses != nil { data[i] = 0xb8 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.L1DcacheLoadMisses)) } if m.L1DcacheStores != nil { data[i] = 0xc0 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.L1DcacheStores)) } if m.L1DcacheStoreMisses != nil { data[i] = 0xc8 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.L1DcacheStoreMisses)) } if m.L1DcachePrefetches != nil { data[i] = 0xd0 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.L1DcachePrefetches)) } if m.L1DcachePrefetchMisses != nil { data[i] = 0xd8 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.L1DcachePrefetchMisses)) } if m.L1IcacheLoads != nil { data[i] = 0xe0 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.L1IcacheLoads)) } if m.L1IcacheLoadMisses != nil { data[i] = 0xe8 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.L1IcacheLoadMisses)) } if m.L1IcachePrefetches != nil { data[i] = 0xf0 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.L1IcachePrefetches)) } if m.L1IcachePrefetchMisses != nil { data[i] = 0xf8 i++ data[i] = 0x1 i++ i = encodeVarintMesos(data, i, uint64(*m.L1IcachePrefetchMisses)) } if m.LlcLoads != nil { data[i] = 0x80 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.LlcLoads)) } if m.LlcLoadMisses != nil { data[i] = 0x88 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.LlcLoadMisses)) } if m.LlcStores != nil { data[i] = 0x90 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.LlcStores)) } if m.LlcStoreMisses != nil { data[i] = 0x98 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.LlcStoreMisses)) } if m.LlcPrefetches != nil { data[i] = 0xa0 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.LlcPrefetches)) } if m.LlcPrefetchMisses != nil { data[i] = 0xa8 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.LlcPrefetchMisses)) } if m.DtlbLoads != nil { data[i] = 0xb0 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.DtlbLoads)) } if m.DtlbLoadMisses != nil { data[i] = 0xb8 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.DtlbLoadMisses)) } if m.DtlbStores != nil { data[i] = 0xc0 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.DtlbStores)) } if m.DtlbStoreMisses != nil { data[i] = 0xc8 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.DtlbStoreMisses)) } if m.DtlbPrefetches != nil { data[i] = 0xd0 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.DtlbPrefetches)) } if m.DtlbPrefetchMisses != nil { data[i] = 0xd8 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.DtlbPrefetchMisses)) } if m.ItlbLoads != nil { data[i] = 0xe0 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.ItlbLoads)) } if m.ItlbLoadMisses != nil { data[i] = 0xe8 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.ItlbLoadMisses)) } if m.BranchLoads != nil { data[i] = 0xf0 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.BranchLoads)) } if m.BranchLoadMisses != nil { data[i] = 0xf8 i++ data[i] = 0x2 i++ i = encodeVarintMesos(data, i, uint64(*m.BranchLoadMisses)) } if m.NodeLoads != nil { data[i] = 0x80 i++ data[i] = 0x3 i++ i = encodeVarintMesos(data, i, uint64(*m.NodeLoads)) } if m.NodeLoadMisses != nil { data[i] = 0x88 i++ data[i] = 0x3 i++ i = encodeVarintMesos(data, i, uint64(*m.NodeLoadMisses)) } if m.NodeStores != nil { data[i] = 0x90 i++ data[i] = 0x3 i++ i = encodeVarintMesos(data, i, uint64(*m.NodeStores)) } if m.NodeStoreMisses != nil { data[i] = 0x98 i++ data[i] = 0x3 i++ i = encodeVarintMesos(data, i, uint64(*m.NodeStoreMisses)) } if m.NodePrefetches != nil { data[i] = 0xa0 i++ data[i] = 0x3 i++ i = encodeVarintMesos(data, i, uint64(*m.NodePrefetches)) } if m.NodePrefetchMisses != nil { data[i] = 0xa8 i++ data[i] = 0x3 i++ i = encodeVarintMesos(data, i, uint64(*m.NodePrefetchMisses)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Request) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Request) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.SlaveId != nil { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(m.SlaveId.Size())) n31, err := m.SlaveId.MarshalTo(data[i:]) if err != nil { return 0, err } i += n31 } if len(m.Resources) > 0 { for _, msg := range m.Resources { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Offer) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Offer) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Id == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(m.Id.Size())) n32, err := m.Id.MarshalTo(data[i:]) if err != nil { return 0, err } i += n32 } if m.FrameworkId == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("framework_id") } else { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(m.FrameworkId.Size())) n33, err := m.FrameworkId.MarshalTo(data[i:]) if err != nil { return 0, err } i += n33 } if m.SlaveId == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("slave_id") } else { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(m.SlaveId.Size())) n34, err := m.SlaveId.MarshalTo(data[i:]) if err != nil { return 0, err } i += n34 } if m.Hostname == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("hostname") } else { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Hostname))) i += copy(data[i:], *m.Hostname) } if len(m.Resources) > 0 { for _, msg := range m.Resources { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if len(m.ExecutorIds) > 0 { for _, msg := range m.ExecutorIds { data[i] = 0x32 i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if len(m.Attributes) > 0 { for _, msg := range m.Attributes { data[i] = 0x3a i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Offer_Operation) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Offer_Operation) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Type == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } else { data[i] = 0x8 i++ i = encodeVarintMesos(data, i, uint64(*m.Type)) } if m.Launch != nil { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(m.Launch.Size())) n35, err := m.Launch.MarshalTo(data[i:]) if err != nil { return 0, err } i += n35 } if m.Reserve != nil { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(m.Reserve.Size())) n36, err := m.Reserve.MarshalTo(data[i:]) if err != nil { return 0, err } i += n36 } if m.Unreserve != nil { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(m.Unreserve.Size())) n37, err := m.Unreserve.MarshalTo(data[i:]) if err != nil { return 0, err } i += n37 } if m.Create != nil { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(m.Create.Size())) n38, err := m.Create.MarshalTo(data[i:]) if err != nil { return 0, err } i += n38 } if m.Destroy != nil { data[i] = 0x32 i++ i = encodeVarintMesos(data, i, uint64(m.Destroy.Size())) n39, err := m.Destroy.MarshalTo(data[i:]) if err != nil { return 0, err } i += n39 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Offer_Operation_Launch) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Offer_Operation_Launch) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.TaskInfos) > 0 { for _, msg := range m.TaskInfos { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Offer_Operation_Reserve) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Offer_Operation_Reserve) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Resources) > 0 { for _, msg := range m.Resources { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Offer_Operation_Unreserve) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Offer_Operation_Unreserve) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Resources) > 0 { for _, msg := range m.Resources { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Offer_Operation_Create) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Offer_Operation_Create) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Volumes) > 0 { for _, msg := range m.Volumes { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Offer_Operation_Destroy) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Offer_Operation_Destroy) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Volumes) > 0 { for _, msg := range m.Volumes { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *TaskInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *TaskInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Name == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Name))) i += copy(data[i:], *m.Name) } if m.TaskId == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("task_id") } else { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(m.TaskId.Size())) n40, err := m.TaskId.MarshalTo(data[i:]) if err != nil { return 0, err } i += n40 } if m.SlaveId == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("slave_id") } else { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(m.SlaveId.Size())) n41, err := m.SlaveId.MarshalTo(data[i:]) if err != nil { return 0, err } i += n41 } if len(m.Resources) > 0 { for _, msg := range m.Resources { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.Executor != nil { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(m.Executor.Size())) n42, err := m.Executor.MarshalTo(data[i:]) if err != nil { return 0, err } i += n42 } if m.Data != nil { data[i] = 0x32 i++ i = encodeVarintMesos(data, i, uint64(len(m.Data))) i += copy(data[i:], m.Data) } if m.Command != nil { data[i] = 0x3a i++ i = encodeVarintMesos(data, i, uint64(m.Command.Size())) n43, err := m.Command.MarshalTo(data[i:]) if err != nil { return 0, err } i += n43 } if m.HealthCheck != nil { data[i] = 0x42 i++ i = encodeVarintMesos(data, i, uint64(m.HealthCheck.Size())) n44, err := m.HealthCheck.MarshalTo(data[i:]) if err != nil { return 0, err } i += n44 } if m.Container != nil { data[i] = 0x4a i++ i = encodeVarintMesos(data, i, uint64(m.Container.Size())) n45, err := m.Container.MarshalTo(data[i:]) if err != nil { return 0, err } i += n45 } if m.Labels != nil { data[i] = 0x52 i++ i = encodeVarintMesos(data, i, uint64(m.Labels.Size())) n46, err := m.Labels.MarshalTo(data[i:]) if err != nil { return 0, err } i += n46 } if m.Discovery != nil { data[i] = 0x5a i++ i = encodeVarintMesos(data, i, uint64(m.Discovery.Size())) n47, err := m.Discovery.MarshalTo(data[i:]) if err != nil { return 0, err } i += n47 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *TaskStatus) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *TaskStatus) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.TaskId == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("task_id") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(m.TaskId.Size())) n48, err := m.TaskId.MarshalTo(data[i:]) if err != nil { return 0, err } i += n48 } if m.State == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("state") } else { data[i] = 0x10 i++ i = encodeVarintMesos(data, i, uint64(*m.State)) } if m.Data != nil { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(len(m.Data))) i += copy(data[i:], m.Data) } if m.Message != nil { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Message))) i += copy(data[i:], *m.Message) } if m.SlaveId != nil { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(m.SlaveId.Size())) n49, err := m.SlaveId.MarshalTo(data[i:]) if err != nil { return 0, err } i += n49 } if m.Timestamp != nil { data[i] = 0x31 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.Timestamp))) } if m.ExecutorId != nil { data[i] = 0x3a i++ i = encodeVarintMesos(data, i, uint64(m.ExecutorId.Size())) n50, err := m.ExecutorId.MarshalTo(data[i:]) if err != nil { return 0, err } i += n50 } if m.Healthy != nil { data[i] = 0x40 i++ if *m.Healthy { data[i] = 1 } else { data[i] = 0 } i++ } if m.Source != nil { data[i] = 0x48 i++ i = encodeVarintMesos(data, i, uint64(*m.Source)) } if m.Reason != nil { data[i] = 0x50 i++ i = encodeVarintMesos(data, i, uint64(*m.Reason)) } if m.Uuid != nil { data[i] = 0x5a i++ i = encodeVarintMesos(data, i, uint64(len(m.Uuid))) i += copy(data[i:], m.Uuid) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Filters) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Filters) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.RefuseSeconds != nil { data[i] = 0x9 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.RefuseSeconds))) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Environment) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Environment) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Variables) > 0 { for _, msg := range m.Variables { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Environment_Variable) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Environment_Variable) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Name == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Name))) i += copy(data[i:], *m.Name) } if m.Value == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } else { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Value))) i += copy(data[i:], *m.Value) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Parameter) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Parameter) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Key == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("key") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Key))) i += copy(data[i:], *m.Key) } if m.Value == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } else { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Value))) i += copy(data[i:], *m.Value) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Parameters) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Parameters) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Parameter) > 0 { for _, msg := range m.Parameter { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Credential) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Credential) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Principal == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("principal") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Principal))) i += copy(data[i:], *m.Principal) } if m.Secret != nil { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(len(m.Secret))) i += copy(data[i:], m.Secret) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Credentials) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Credentials) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Credentials) > 0 { for _, msg := range m.Credentials { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ACL) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ACL) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ACL_Entity) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ACL_Entity) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Type != nil { data[i] = 0x8 i++ i = encodeVarintMesos(data, i, uint64(*m.Type)) } if len(m.Values) > 0 { for _, s := range m.Values { data[i] = 0x12 i++ l = len(s) for l >= 1<<7 { data[i] = uint8(uint64(l)&0x7f | 0x80) l >>= 7 i++ } data[i] = uint8(l) i++ i += copy(data[i:], s) } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ACL_RegisterFramework) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ACL_RegisterFramework) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Principals == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("principals") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(m.Principals.Size())) n51, err := m.Principals.MarshalTo(data[i:]) if err != nil { return 0, err } i += n51 } if m.Roles == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("roles") } else { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(m.Roles.Size())) n52, err := m.Roles.MarshalTo(data[i:]) if err != nil { return 0, err } i += n52 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ACL_RunTask) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ACL_RunTask) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Principals == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("principals") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(m.Principals.Size())) n53, err := m.Principals.MarshalTo(data[i:]) if err != nil { return 0, err } i += n53 } if m.Users == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("users") } else { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(m.Users.Size())) n54, err := m.Users.MarshalTo(data[i:]) if err != nil { return 0, err } i += n54 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ACL_ShutdownFramework) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ACL_ShutdownFramework) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Principals == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("principals") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(m.Principals.Size())) n55, err := m.Principals.MarshalTo(data[i:]) if err != nil { return 0, err } i += n55 } if m.FrameworkPrincipals == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("framework_principals") } else { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(m.FrameworkPrincipals.Size())) n56, err := m.FrameworkPrincipals.MarshalTo(data[i:]) if err != nil { return 0, err } i += n56 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ACLs) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ACLs) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Permissive != nil { data[i] = 0x8 i++ if *m.Permissive { data[i] = 1 } else { data[i] = 0 } i++ } if len(m.RegisterFrameworks) > 0 { for _, msg := range m.RegisterFrameworks { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if len(m.RunTasks) > 0 { for _, msg := range m.RunTasks { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if len(m.ShutdownFrameworks) > 0 { for _, msg := range m.ShutdownFrameworks { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *RateLimit) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *RateLimit) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Qps != nil { data[i] = 0x9 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.Qps))) } if m.Principal == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("principal") } else { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Principal))) i += copy(data[i:], *m.Principal) } if m.Capacity != nil { data[i] = 0x18 i++ i = encodeVarintMesos(data, i, uint64(*m.Capacity)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *RateLimits) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *RateLimits) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Limits) > 0 { for _, msg := range m.Limits { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.AggregateDefaultQps != nil { data[i] = 0x11 i++ i = encodeFixed64Mesos(data, i, uint64(math.Float64bits(*m.AggregateDefaultQps))) } if m.AggregateDefaultCapacity != nil { data[i] = 0x18 i++ i = encodeVarintMesos(data, i, uint64(*m.AggregateDefaultCapacity)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Volume) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Volume) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.ContainerPath == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("container_path") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.ContainerPath))) i += copy(data[i:], *m.ContainerPath) } if m.HostPath != nil { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(len(*m.HostPath))) i += copy(data[i:], *m.HostPath) } if m.Mode == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("mode") } else { data[i] = 0x18 i++ i = encodeVarintMesos(data, i, uint64(*m.Mode)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ContainerInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ContainerInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Type == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } else { data[i] = 0x8 i++ i = encodeVarintMesos(data, i, uint64(*m.Type)) } if len(m.Volumes) > 0 { for _, msg := range m.Volumes { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.Docker != nil { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(m.Docker.Size())) n57, err := m.Docker.MarshalTo(data[i:]) if err != nil { return 0, err } i += n57 } if m.Hostname != nil { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Hostname))) i += copy(data[i:], *m.Hostname) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ContainerInfo_DockerInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ContainerInfo_DockerInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Image == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("image") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Image))) i += copy(data[i:], *m.Image) } if m.Network != nil { data[i] = 0x10 i++ i = encodeVarintMesos(data, i, uint64(*m.Network)) } if len(m.PortMappings) > 0 { for _, msg := range m.PortMappings { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.Privileged != nil { data[i] = 0x20 i++ if *m.Privileged { data[i] = 1 } else { data[i] = 0 } i++ } if len(m.Parameters) > 0 { for _, msg := range m.Parameters { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.ForcePullImage != nil { data[i] = 0x30 i++ if *m.ForcePullImage { data[i] = 1 } else { data[i] = 0 } i++ } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *ContainerInfo_DockerInfo_PortMapping) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *ContainerInfo_DockerInfo_PortMapping) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.HostPort == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("host_port") } else { data[i] = 0x8 i++ i = encodeVarintMesos(data, i, uint64(*m.HostPort)) } if m.ContainerPort == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("container_port") } else { data[i] = 0x10 i++ i = encodeVarintMesos(data, i, uint64(*m.ContainerPort)) } if m.Protocol != nil { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(len(*m.Protocol))) i += copy(data[i:], *m.Protocol) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Labels) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Labels) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Labels) > 0 { for _, msg := range m.Labels { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Label) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Label) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Key == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("key") } else { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(len(*m.Key))) i += copy(data[i:], *m.Key) } if m.Value != nil { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Value))) i += copy(data[i:], *m.Value) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Port) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Port) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Number == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("number") } else { data[i] = 0x8 i++ i = encodeVarintMesos(data, i, uint64(*m.Number)) } if m.Name != nil { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Name))) i += copy(data[i:], *m.Name) } if m.Protocol != nil { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(len(*m.Protocol))) i += copy(data[i:], *m.Protocol) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Ports) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Ports) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if len(m.Ports) > 0 { for _, msg := range m.Ports { data[i] = 0xa i++ i = encodeVarintMesos(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *DiscoveryInfo) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *DiscoveryInfo) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Visibility == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("visibility") } else { data[i] = 0x8 i++ i = encodeVarintMesos(data, i, uint64(*m.Visibility)) } if m.Name != nil { data[i] = 0x12 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Name))) i += copy(data[i:], *m.Name) } if m.Environment != nil { data[i] = 0x1a i++ i = encodeVarintMesos(data, i, uint64(len(*m.Environment))) i += copy(data[i:], *m.Environment) } if m.Location != nil { data[i] = 0x22 i++ i = encodeVarintMesos(data, i, uint64(len(*m.Location))) i += copy(data[i:], *m.Location) } if m.Version != nil { data[i] = 0x2a i++ i = encodeVarintMesos(data, i, uint64(len(*m.Version))) i += copy(data[i:], *m.Version) } if m.Ports != nil { data[i] = 0x32 i++ i = encodeVarintMesos(data, i, uint64(m.Ports.Size())) n58, err := m.Ports.MarshalTo(data[i:]) if err != nil { return 0, err } i += n58 } if m.Labels != nil { data[i] = 0x3a i++ i = encodeVarintMesos(data, i, uint64(m.Labels.Size())) n59, err := m.Labels.MarshalTo(data[i:]) if err != nil { return 0, err } i += n59 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func encodeFixed64Mesos(data []byte, offset int, v uint64) int { data[offset] = uint8(v) data[offset+1] = uint8(v >> 8) data[offset+2] = uint8(v >> 16) data[offset+3] = uint8(v >> 24) data[offset+4] = uint8(v >> 32) data[offset+5] = uint8(v >> 40) data[offset+6] = uint8(v >> 48) data[offset+7] = uint8(v >> 56) return offset + 8 } func encodeFixed32Mesos(data []byte, offset int, v uint32) int { data[offset] = uint8(v) data[offset+1] = uint8(v >> 8) data[offset+2] = uint8(v >> 16) data[offset+3] = uint8(v >> 24) return offset + 4 } func encodeVarintMesos(data []byte, offset int, v uint64) int { for v >= 1<<7 { data[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } data[offset] = uint8(v) return offset + 1 } func NewPopulatedFrameworkID(r randyMesos, easy bool) *FrameworkID { this := &FrameworkID{} v1 := randStringMesos(r) this.Value = &v1 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedOfferID(r randyMesos, easy bool) *OfferID { this := &OfferID{} v2 := randStringMesos(r) this.Value = &v2 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedSlaveID(r randyMesos, easy bool) *SlaveID { this := &SlaveID{} v3 := randStringMesos(r) this.Value = &v3 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedTaskID(r randyMesos, easy bool) *TaskID { this := &TaskID{} v4 := randStringMesos(r) this.Value = &v4 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedExecutorID(r randyMesos, easy bool) *ExecutorID { this := &ExecutorID{} v5 := randStringMesos(r) this.Value = &v5 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedContainerID(r randyMesos, easy bool) *ContainerID { this := &ContainerID{} v6 := randStringMesos(r) this.Value = &v6 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedFrameworkInfo(r randyMesos, easy bool) *FrameworkInfo { this := &FrameworkInfo{} v7 := randStringMesos(r) this.User = &v7 v8 := randStringMesos(r) this.Name = &v8 if r.Intn(10) != 0 { this.Id = NewPopulatedFrameworkID(r, easy) } if r.Intn(10) != 0 { v9 := float64(r.Float64()) if r.Intn(2) == 0 { v9 *= -1 } this.FailoverTimeout = &v9 } if r.Intn(10) != 0 { v10 := bool(bool(r.Intn(2) == 0)) this.Checkpoint = &v10 } if r.Intn(10) != 0 { v11 := randStringMesos(r) this.Role = &v11 } if r.Intn(10) != 0 { v12 := randStringMesos(r) this.Hostname = &v12 } if r.Intn(10) != 0 { v13 := randStringMesos(r) this.Principal = &v13 } if r.Intn(10) != 0 { v14 := randStringMesos(r) this.WebuiUrl = &v14 } if r.Intn(10) != 0 { v15 := r.Intn(10) this.Capabilities = make([]*FrameworkInfo_Capability, v15) for i := 0; i < v15; i++ { this.Capabilities[i] = NewPopulatedFrameworkInfo_Capability(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 11) } return this } func NewPopulatedFrameworkInfo_Capability(r randyMesos, easy bool) *FrameworkInfo_Capability { this := &FrameworkInfo_Capability{} v16 := FrameworkInfo_Capability_Type([]int32{1}[r.Intn(1)]) this.Type = &v16 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedHealthCheck(r randyMesos, easy bool) *HealthCheck { this := &HealthCheck{} if r.Intn(10) != 0 { this.Http = NewPopulatedHealthCheck_HTTP(r, easy) } if r.Intn(10) != 0 { v17 := float64(r.Float64()) if r.Intn(2) == 0 { v17 *= -1 } this.DelaySeconds = &v17 } if r.Intn(10) != 0 { v18 := float64(r.Float64()) if r.Intn(2) == 0 { v18 *= -1 } this.IntervalSeconds = &v18 } if r.Intn(10) != 0 { v19 := float64(r.Float64()) if r.Intn(2) == 0 { v19 *= -1 } this.TimeoutSeconds = &v19 } if r.Intn(10) != 0 { v20 := uint32(r.Uint32()) this.ConsecutiveFailures = &v20 } if r.Intn(10) != 0 { v21 := float64(r.Float64()) if r.Intn(2) == 0 { v21 *= -1 } this.GracePeriodSeconds = &v21 } if r.Intn(10) != 0 { this.Command = NewPopulatedCommandInfo(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 8) } return this } func NewPopulatedHealthCheck_HTTP(r randyMesos, easy bool) *HealthCheck_HTTP { this := &HealthCheck_HTTP{} v22 := uint32(r.Uint32()) this.Port = &v22 if r.Intn(10) != 0 { v23 := randStringMesos(r) this.Path = &v23 } if r.Intn(10) != 0 { v24 := r.Intn(100) this.Statuses = make([]uint32, v24) for i := 0; i < v24; i++ { this.Statuses[i] = uint32(r.Uint32()) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 5) } return this } func NewPopulatedCommandInfo(r randyMesos, easy bool) *CommandInfo { this := &CommandInfo{} if r.Intn(10) != 0 { v25 := r.Intn(10) this.Uris = make([]*CommandInfo_URI, v25) for i := 0; i < v25; i++ { this.Uris[i] = NewPopulatedCommandInfo_URI(r, easy) } } if r.Intn(10) != 0 { this.Environment = NewPopulatedEnvironment(r, easy) } if r.Intn(10) != 0 { v26 := randStringMesos(r) this.Value = &v26 } if r.Intn(10) != 0 { this.Container = NewPopulatedCommandInfo_ContainerInfo(r, easy) } if r.Intn(10) != 0 { v27 := randStringMesos(r) this.User = &v27 } if r.Intn(10) != 0 { v28 := bool(bool(r.Intn(2) == 0)) this.Shell = &v28 } if r.Intn(10) != 0 { v29 := r.Intn(10) this.Arguments = make([]string, v29) for i := 0; i < v29; i++ { this.Arguments[i] = randStringMesos(r) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 8) } return this } func NewPopulatedCommandInfo_URI(r randyMesos, easy bool) *CommandInfo_URI { this := &CommandInfo_URI{} v30 := randStringMesos(r) this.Value = &v30 if r.Intn(10) != 0 { v31 := bool(bool(r.Intn(2) == 0)) this.Executable = &v31 } if r.Intn(10) != 0 { v32 := bool(bool(r.Intn(2) == 0)) this.Extract = &v32 } if r.Intn(10) != 0 { v33 := bool(bool(r.Intn(2) == 0)) this.Cache = &v33 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 5) } return this } func NewPopulatedCommandInfo_ContainerInfo(r randyMesos, easy bool) *CommandInfo_ContainerInfo { this := &CommandInfo_ContainerInfo{} v34 := randStringMesos(r) this.Image = &v34 if r.Intn(10) != 0 { v35 := r.Intn(10) this.Options = make([]string, v35) for i := 0; i < v35; i++ { this.Options[i] = randStringMesos(r) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 3) } return this } func NewPopulatedExecutorInfo(r randyMesos, easy bool) *ExecutorInfo { this := &ExecutorInfo{} this.ExecutorId = NewPopulatedExecutorID(r, easy) if r.Intn(10) != 0 { v36 := r.Intn(100) this.Data = make([]byte, v36) for i := 0; i < v36; i++ { this.Data[i] = byte(r.Intn(256)) } } if r.Intn(10) != 0 { v37 := r.Intn(10) this.Resources = make([]*Resource, v37) for i := 0; i < v37; i++ { this.Resources[i] = NewPopulatedResource(r, easy) } } this.Command = NewPopulatedCommandInfo(r, easy) if r.Intn(10) != 0 { this.FrameworkId = NewPopulatedFrameworkID(r, easy) } if r.Intn(10) != 0 { v38 := randStringMesos(r) this.Name = &v38 } if r.Intn(10) != 0 { v39 := randStringMesos(r) this.Source = &v39 } if r.Intn(10) != 0 { this.Container = NewPopulatedContainerInfo(r, easy) } if r.Intn(10) != 0 { this.Discovery = NewPopulatedDiscoveryInfo(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 13) } return this } func NewPopulatedMasterInfo(r randyMesos, easy bool) *MasterInfo { this := &MasterInfo{} v40 := randStringMesos(r) this.Id = &v40 v41 := uint32(r.Uint32()) this.Ip = &v41 v42 := uint32(r.Uint32()) this.Port = &v42 if r.Intn(10) != 0 { v43 := randStringMesos(r) this.Pid = &v43 } if r.Intn(10) != 0 { v44 := randStringMesos(r) this.Hostname = &v44 } if r.Intn(10) != 0 { v45 := randStringMesos(r) this.Version = &v45 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 7) } return this } func NewPopulatedSlaveInfo(r randyMesos, easy bool) *SlaveInfo { this := &SlaveInfo{} v46 := randStringMesos(r) this.Hostname = &v46 if r.Intn(10) != 0 { v47 := r.Intn(10) this.Resources = make([]*Resource, v47) for i := 0; i < v47; i++ { this.Resources[i] = NewPopulatedResource(r, easy) } } if r.Intn(10) != 0 { v48 := r.Intn(10) this.Attributes = make([]*Attribute, v48) for i := 0; i < v48; i++ { this.Attributes[i] = NewPopulatedAttribute(r, easy) } } if r.Intn(10) != 0 { this.Id = NewPopulatedSlaveID(r, easy) } if r.Intn(10) != 0 { v49 := bool(bool(r.Intn(2) == 0)) this.Checkpoint = &v49 } if r.Intn(10) != 0 { v50 := int32(r.Int31()) if r.Intn(2) == 0 { v50 *= -1 } this.Port = &v50 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 9) } return this } func NewPopulatedValue(r randyMesos, easy bool) *Value { this := &Value{} v51 := Value_Type([]int32{0, 1, 2, 3}[r.Intn(4)]) this.Type = &v51 if r.Intn(10) != 0 { this.Scalar = NewPopulatedValue_Scalar(r, easy) } if r.Intn(10) != 0 { this.Ranges = NewPopulatedValue_Ranges(r, easy) } if r.Intn(10) != 0 { this.Set = NewPopulatedValue_Set(r, easy) } if r.Intn(10) != 0 { this.Text = NewPopulatedValue_Text(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 6) } return this } func NewPopulatedValue_Scalar(r randyMesos, easy bool) *Value_Scalar { this := &Value_Scalar{} v52 := float64(r.Float64()) if r.Intn(2) == 0 { v52 *= -1 } this.Value = &v52 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedValue_Range(r randyMesos, easy bool) *Value_Range { this := &Value_Range{} v53 := uint64(uint64(r.Uint32())) this.Begin = &v53 v54 := uint64(uint64(r.Uint32())) this.End = &v54 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 3) } return this } func NewPopulatedValue_Ranges(r randyMesos, easy bool) *Value_Ranges { this := &Value_Ranges{} if r.Intn(10) != 0 { v55 := r.Intn(10) this.Range = make([]*Value_Range, v55) for i := 0; i < v55; i++ { this.Range[i] = NewPopulatedValue_Range(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedValue_Set(r randyMesos, easy bool) *Value_Set { this := &Value_Set{} if r.Intn(10) != 0 { v56 := r.Intn(10) this.Item = make([]string, v56) for i := 0; i < v56; i++ { this.Item[i] = randStringMesos(r) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedValue_Text(r randyMesos, easy bool) *Value_Text { this := &Value_Text{} v57 := randStringMesos(r) this.Value = &v57 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedAttribute(r randyMesos, easy bool) *Attribute { this := &Attribute{} v58 := randStringMesos(r) this.Name = &v58 v59 := Value_Type([]int32{0, 1, 2, 3}[r.Intn(4)]) this.Type = &v59 if r.Intn(10) != 0 { this.Scalar = NewPopulatedValue_Scalar(r, easy) } if r.Intn(10) != 0 { this.Ranges = NewPopulatedValue_Ranges(r, easy) } if r.Intn(10) != 0 { this.Text = NewPopulatedValue_Text(r, easy) } if r.Intn(10) != 0 { this.Set = NewPopulatedValue_Set(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 7) } return this } func NewPopulatedResource(r randyMesos, easy bool) *Resource { this := &Resource{} v60 := randStringMesos(r) this.Name = &v60 v61 := Value_Type([]int32{0, 1, 2, 3}[r.Intn(4)]) this.Type = &v61 if r.Intn(10) != 0 { this.Scalar = NewPopulatedValue_Scalar(r, easy) } if r.Intn(10) != 0 { this.Ranges = NewPopulatedValue_Ranges(r, easy) } if r.Intn(10) != 0 { this.Set = NewPopulatedValue_Set(r, easy) } if r.Intn(10) != 0 { v62 := randStringMesos(r) this.Role = &v62 } if r.Intn(10) != 0 { this.Disk = NewPopulatedResource_DiskInfo(r, easy) } if r.Intn(10) != 0 { this.Reservation = NewPopulatedResource_ReservationInfo(r, easy) } if r.Intn(10) != 0 { this.Revocable = NewPopulatedResource_RevocableInfo(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 10) } return this } func NewPopulatedResource_ReservationInfo(r randyMesos, easy bool) *Resource_ReservationInfo { this := &Resource_ReservationInfo{} v63 := randStringMesos(r) this.Principal = &v63 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedResource_DiskInfo(r randyMesos, easy bool) *Resource_DiskInfo { this := &Resource_DiskInfo{} if r.Intn(10) != 0 { this.Persistence = NewPopulatedResource_DiskInfo_Persistence(r, easy) } if r.Intn(10) != 0 { this.Volume = NewPopulatedVolume(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 3) } return this } func NewPopulatedResource_DiskInfo_Persistence(r randyMesos, easy bool) *Resource_DiskInfo_Persistence { this := &Resource_DiskInfo_Persistence{} v64 := randStringMesos(r) this.Id = &v64 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedResource_RevocableInfo(r randyMesos, easy bool) *Resource_RevocableInfo { this := &Resource_RevocableInfo{} if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 1) } return this } func NewPopulatedTrafficControlStatistics(r randyMesos, easy bool) *TrafficControlStatistics { this := &TrafficControlStatistics{} v65 := randStringMesos(r) this.Id = &v65 if r.Intn(10) != 0 { v66 := uint64(uint64(r.Uint32())) this.Backlog = &v66 } if r.Intn(10) != 0 { v67 := uint64(uint64(r.Uint32())) this.Bytes = &v67 } if r.Intn(10) != 0 { v68 := uint64(uint64(r.Uint32())) this.Drops = &v68 } if r.Intn(10) != 0 { v69 := uint64(uint64(r.Uint32())) this.Overlimits = &v69 } if r.Intn(10) != 0 { v70 := uint64(uint64(r.Uint32())) this.Packets = &v70 } if r.Intn(10) != 0 { v71 := uint64(uint64(r.Uint32())) this.Qlen = &v71 } if r.Intn(10) != 0 { v72 := uint64(uint64(r.Uint32())) this.Ratebps = &v72 } if r.Intn(10) != 0 { v73 := uint64(uint64(r.Uint32())) this.Ratepps = &v73 } if r.Intn(10) != 0 { v74 := uint64(uint64(r.Uint32())) this.Requeues = &v74 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 11) } return this } func NewPopulatedResourceStatistics(r randyMesos, easy bool) *ResourceStatistics { this := &ResourceStatistics{} v75 := float64(r.Float64()) if r.Intn(2) == 0 { v75 *= -1 } this.Timestamp = &v75 if r.Intn(10) != 0 { v76 := float64(r.Float64()) if r.Intn(2) == 0 { v76 *= -1 } this.CpusUserTimeSecs = &v76 } if r.Intn(10) != 0 { v77 := float64(r.Float64()) if r.Intn(2) == 0 { v77 *= -1 } this.CpusSystemTimeSecs = &v77 } if r.Intn(10) != 0 { v78 := float64(r.Float64()) if r.Intn(2) == 0 { v78 *= -1 } this.CpusLimit = &v78 } if r.Intn(10) != 0 { v79 := uint64(uint64(r.Uint32())) this.MemRssBytes = &v79 } if r.Intn(10) != 0 { v80 := uint64(uint64(r.Uint32())) this.MemLimitBytes = &v80 } if r.Intn(10) != 0 { v81 := uint32(r.Uint32()) this.CpusNrPeriods = &v81 } if r.Intn(10) != 0 { v82 := uint32(r.Uint32()) this.CpusNrThrottled = &v82 } if r.Intn(10) != 0 { v83 := float64(r.Float64()) if r.Intn(2) == 0 { v83 *= -1 } this.CpusThrottledTimeSecs = &v83 } if r.Intn(10) != 0 { v84 := uint64(uint64(r.Uint32())) this.MemFileBytes = &v84 } if r.Intn(10) != 0 { v85 := uint64(uint64(r.Uint32())) this.MemAnonBytes = &v85 } if r.Intn(10) != 0 { v86 := uint64(uint64(r.Uint32())) this.MemMappedFileBytes = &v86 } if r.Intn(10) != 0 { this.Perf = NewPopulatedPerfStatistics(r, easy) } if r.Intn(10) != 0 { v87 := uint64(uint64(r.Uint32())) this.NetRxPackets = &v87 } if r.Intn(10) != 0 { v88 := uint64(uint64(r.Uint32())) this.NetRxBytes = &v88 } if r.Intn(10) != 0 { v89 := uint64(uint64(r.Uint32())) this.NetRxErrors = &v89 } if r.Intn(10) != 0 { v90 := uint64(uint64(r.Uint32())) this.NetRxDropped = &v90 } if r.Intn(10) != 0 { v91 := uint64(uint64(r.Uint32())) this.NetTxPackets = &v91 } if r.Intn(10) != 0 { v92 := uint64(uint64(r.Uint32())) this.NetTxBytes = &v92 } if r.Intn(10) != 0 { v93 := uint64(uint64(r.Uint32())) this.NetTxErrors = &v93 } if r.Intn(10) != 0 { v94 := uint64(uint64(r.Uint32())) this.NetTxDropped = &v94 } if r.Intn(10) != 0 { v95 := float64(r.Float64()) if r.Intn(2) == 0 { v95 *= -1 } this.NetTcpRttMicrosecsP50 = &v95 } if r.Intn(10) != 0 { v96 := float64(r.Float64()) if r.Intn(2) == 0 { v96 *= -1 } this.NetTcpRttMicrosecsP90 = &v96 } if r.Intn(10) != 0 { v97 := float64(r.Float64()) if r.Intn(2) == 0 { v97 *= -1 } this.NetTcpRttMicrosecsP95 = &v97 } if r.Intn(10) != 0 { v98 := float64(r.Float64()) if r.Intn(2) == 0 { v98 *= -1 } this.NetTcpRttMicrosecsP99 = &v98 } if r.Intn(10) != 0 { v99 := uint64(uint64(r.Uint32())) this.DiskLimitBytes = &v99 } if r.Intn(10) != 0 { v100 := uint64(uint64(r.Uint32())) this.DiskUsedBytes = &v100 } if r.Intn(10) != 0 { v101 := float64(r.Float64()) if r.Intn(2) == 0 { v101 *= -1 } this.NetTcpActiveConnections = &v101 } if r.Intn(10) != 0 { v102 := float64(r.Float64()) if r.Intn(2) == 0 { v102 *= -1 } this.NetTcpTimeWaitConnections = &v102 } if r.Intn(10) != 0 { v103 := uint32(r.Uint32()) this.Processes = &v103 } if r.Intn(10) != 0 { v104 := uint32(r.Uint32()) this.Threads = &v104 } if r.Intn(10) != 0 { v105 := uint64(uint64(r.Uint32())) this.MemLowPressureCounter = &v105 } if r.Intn(10) != 0 { v106 := uint64(uint64(r.Uint32())) this.MemMediumPressureCounter = &v106 } if r.Intn(10) != 0 { v107 := uint64(uint64(r.Uint32())) this.MemCriticalPressureCounter = &v107 } if r.Intn(10) != 0 { v108 := r.Intn(10) this.NetTrafficControlStatistics = make([]*TrafficControlStatistics, v108) for i := 0; i < v108; i++ { this.NetTrafficControlStatistics[i] = NewPopulatedTrafficControlStatistics(r, easy) } } if r.Intn(10) != 0 { v109 := uint64(uint64(r.Uint32())) this.MemTotalBytes = &v109 } if r.Intn(10) != 0 { v110 := uint64(uint64(r.Uint32())) this.MemTotalMemswBytes = &v110 } if r.Intn(10) != 0 { v111 := uint64(uint64(r.Uint32())) this.MemSoftLimitBytes = &v111 } if r.Intn(10) != 0 { v112 := uint64(uint64(r.Uint32())) this.MemCacheBytes = &v112 } if r.Intn(10) != 0 { v113 := uint64(uint64(r.Uint32())) this.MemSwapBytes = &v113 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 41) } return this } func NewPopulatedResourceUsage(r randyMesos, easy bool) *ResourceUsage { this := &ResourceUsage{} if r.Intn(10) != 0 { v114 := r.Intn(10) this.Executors = make([]*ResourceUsage_Executor, v114) for i := 0; i < v114; i++ { this.Executors[i] = NewPopulatedResourceUsage_Executor(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedResourceUsage_Executor(r randyMesos, easy bool) *ResourceUsage_Executor { this := &ResourceUsage_Executor{} this.ExecutorInfo = NewPopulatedExecutorInfo(r, easy) if r.Intn(10) != 0 { v115 := r.Intn(10) this.Allocated = make([]*Resource, v115) for i := 0; i < v115; i++ { this.Allocated[i] = NewPopulatedResource(r, easy) } } if r.Intn(10) != 0 { this.Statistics = NewPopulatedResourceStatistics(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 4) } return this } func NewPopulatedPerfStatistics(r randyMesos, easy bool) *PerfStatistics { this := &PerfStatistics{} v116 := float64(r.Float64()) if r.Intn(2) == 0 { v116 *= -1 } this.Timestamp = &v116 v117 := float64(r.Float64()) if r.Intn(2) == 0 { v117 *= -1 } this.Duration = &v117 if r.Intn(10) != 0 { v118 := uint64(uint64(r.Uint32())) this.Cycles = &v118 } if r.Intn(10) != 0 { v119 := uint64(uint64(r.Uint32())) this.StalledCyclesFrontend = &v119 } if r.Intn(10) != 0 { v120 := uint64(uint64(r.Uint32())) this.StalledCyclesBackend = &v120 } if r.Intn(10) != 0 { v121 := uint64(uint64(r.Uint32())) this.Instructions = &v121 } if r.Intn(10) != 0 { v122 := uint64(uint64(r.Uint32())) this.CacheReferences = &v122 } if r.Intn(10) != 0 { v123 := uint64(uint64(r.Uint32())) this.CacheMisses = &v123 } if r.Intn(10) != 0 { v124 := uint64(uint64(r.Uint32())) this.Branches = &v124 } if r.Intn(10) != 0 { v125 := uint64(uint64(r.Uint32())) this.BranchMisses = &v125 } if r.Intn(10) != 0 { v126 := uint64(uint64(r.Uint32())) this.BusCycles = &v126 } if r.Intn(10) != 0 { v127 := uint64(uint64(r.Uint32())) this.RefCycles = &v127 } if r.Intn(10) != 0 { v128 := float64(r.Float64()) if r.Intn(2) == 0 { v128 *= -1 } this.CpuClock = &v128 } if r.Intn(10) != 0 { v129 := float64(r.Float64()) if r.Intn(2) == 0 { v129 *= -1 } this.TaskClock = &v129 } if r.Intn(10) != 0 { v130 := uint64(uint64(r.Uint32())) this.PageFaults = &v130 } if r.Intn(10) != 0 { v131 := uint64(uint64(r.Uint32())) this.MinorFaults = &v131 } if r.Intn(10) != 0 { v132 := uint64(uint64(r.Uint32())) this.MajorFaults = &v132 } if r.Intn(10) != 0 { v133 := uint64(uint64(r.Uint32())) this.ContextSwitches = &v133 } if r.Intn(10) != 0 { v134 := uint64(uint64(r.Uint32())) this.CpuMigrations = &v134 } if r.Intn(10) != 0 { v135 := uint64(uint64(r.Uint32())) this.AlignmentFaults = &v135 } if r.Intn(10) != 0 { v136 := uint64(uint64(r.Uint32())) this.EmulationFaults = &v136 } if r.Intn(10) != 0 { v137 := uint64(uint64(r.Uint32())) this.L1DcacheLoads = &v137 } if r.Intn(10) != 0 { v138 := uint64(uint64(r.Uint32())) this.L1DcacheLoadMisses = &v138 } if r.Intn(10) != 0 { v139 := uint64(uint64(r.Uint32())) this.L1DcacheStores = &v139 } if r.Intn(10) != 0 { v140 := uint64(uint64(r.Uint32())) this.L1DcacheStoreMisses = &v140 } if r.Intn(10) != 0 { v141 := uint64(uint64(r.Uint32())) this.L1DcachePrefetches = &v141 } if r.Intn(10) != 0 { v142 := uint64(uint64(r.Uint32())) this.L1DcachePrefetchMisses = &v142 } if r.Intn(10) != 0 { v143 := uint64(uint64(r.Uint32())) this.L1IcacheLoads = &v143 } if r.Intn(10) != 0 { v144 := uint64(uint64(r.Uint32())) this.L1IcacheLoadMisses = &v144 } if r.Intn(10) != 0 { v145 := uint64(uint64(r.Uint32())) this.L1IcachePrefetches = &v145 } if r.Intn(10) != 0 { v146 := uint64(uint64(r.Uint32())) this.L1IcachePrefetchMisses = &v146 } if r.Intn(10) != 0 { v147 := uint64(uint64(r.Uint32())) this.LlcLoads = &v147 } if r.Intn(10) != 0 { v148 := uint64(uint64(r.Uint32())) this.LlcLoadMisses = &v148 } if r.Intn(10) != 0 { v149 := uint64(uint64(r.Uint32())) this.LlcStores = &v149 } if r.Intn(10) != 0 { v150 := uint64(uint64(r.Uint32())) this.LlcStoreMisses = &v150 } if r.Intn(10) != 0 { v151 := uint64(uint64(r.Uint32())) this.LlcPrefetches = &v151 } if r.Intn(10) != 0 { v152 := uint64(uint64(r.Uint32())) this.LlcPrefetchMisses = &v152 } if r.Intn(10) != 0 { v153 := uint64(uint64(r.Uint32())) this.DtlbLoads = &v153 } if r.Intn(10) != 0 { v154 := uint64(uint64(r.Uint32())) this.DtlbLoadMisses = &v154 } if r.Intn(10) != 0 { v155 := uint64(uint64(r.Uint32())) this.DtlbStores = &v155 } if r.Intn(10) != 0 { v156 := uint64(uint64(r.Uint32())) this.DtlbStoreMisses = &v156 } if r.Intn(10) != 0 { v157 := uint64(uint64(r.Uint32())) this.DtlbPrefetches = &v157 } if r.Intn(10) != 0 { v158 := uint64(uint64(r.Uint32())) this.DtlbPrefetchMisses = &v158 } if r.Intn(10) != 0 { v159 := uint64(uint64(r.Uint32())) this.ItlbLoads = &v159 } if r.Intn(10) != 0 { v160 := uint64(uint64(r.Uint32())) this.ItlbLoadMisses = &v160 } if r.Intn(10) != 0 { v161 := uint64(uint64(r.Uint32())) this.BranchLoads = &v161 } if r.Intn(10) != 0 { v162 := uint64(uint64(r.Uint32())) this.BranchLoadMisses = &v162 } if r.Intn(10) != 0 { v163 := uint64(uint64(r.Uint32())) this.NodeLoads = &v163 } if r.Intn(10) != 0 { v164 := uint64(uint64(r.Uint32())) this.NodeLoadMisses = &v164 } if r.Intn(10) != 0 { v165 := uint64(uint64(r.Uint32())) this.NodeStores = &v165 } if r.Intn(10) != 0 { v166 := uint64(uint64(r.Uint32())) this.NodeStoreMisses = &v166 } if r.Intn(10) != 0 { v167 := uint64(uint64(r.Uint32())) this.NodePrefetches = &v167 } if r.Intn(10) != 0 { v168 := uint64(uint64(r.Uint32())) this.NodePrefetchMisses = &v168 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 54) } return this } func NewPopulatedRequest(r randyMesos, easy bool) *Request { this := &Request{} if r.Intn(10) != 0 { this.SlaveId = NewPopulatedSlaveID(r, easy) } if r.Intn(10) != 0 { v169 := r.Intn(10) this.Resources = make([]*Resource, v169) for i := 0; i < v169; i++ { this.Resources[i] = NewPopulatedResource(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 3) } return this } func NewPopulatedOffer(r randyMesos, easy bool) *Offer { this := &Offer{} this.Id = NewPopulatedOfferID(r, easy) this.FrameworkId = NewPopulatedFrameworkID(r, easy) this.SlaveId = NewPopulatedSlaveID(r, easy) v170 := randStringMesos(r) this.Hostname = &v170 if r.Intn(10) != 0 { v171 := r.Intn(10) this.Resources = make([]*Resource, v171) for i := 0; i < v171; i++ { this.Resources[i] = NewPopulatedResource(r, easy) } } if r.Intn(10) != 0 { v172 := r.Intn(10) this.ExecutorIds = make([]*ExecutorID, v172) for i := 0; i < v172; i++ { this.ExecutorIds[i] = NewPopulatedExecutorID(r, easy) } } if r.Intn(10) != 0 { v173 := r.Intn(10) this.Attributes = make([]*Attribute, v173) for i := 0; i < v173; i++ { this.Attributes[i] = NewPopulatedAttribute(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 8) } return this } func NewPopulatedOffer_Operation(r randyMesos, easy bool) *Offer_Operation { this := &Offer_Operation{} v174 := Offer_Operation_Type([]int32{1, 2, 3, 4, 5}[r.Intn(5)]) this.Type = &v174 if r.Intn(10) != 0 { this.Launch = NewPopulatedOffer_Operation_Launch(r, easy) } if r.Intn(10) != 0 { this.Reserve = NewPopulatedOffer_Operation_Reserve(r, easy) } if r.Intn(10) != 0 { this.Unreserve = NewPopulatedOffer_Operation_Unreserve(r, easy) } if r.Intn(10) != 0 { this.Create = NewPopulatedOffer_Operation_Create(r, easy) } if r.Intn(10) != 0 { this.Destroy = NewPopulatedOffer_Operation_Destroy(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 7) } return this } func NewPopulatedOffer_Operation_Launch(r randyMesos, easy bool) *Offer_Operation_Launch { this := &Offer_Operation_Launch{} if r.Intn(10) != 0 { v175 := r.Intn(10) this.TaskInfos = make([]*TaskInfo, v175) for i := 0; i < v175; i++ { this.TaskInfos[i] = NewPopulatedTaskInfo(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedOffer_Operation_Reserve(r randyMesos, easy bool) *Offer_Operation_Reserve { this := &Offer_Operation_Reserve{} if r.Intn(10) != 0 { v176 := r.Intn(10) this.Resources = make([]*Resource, v176) for i := 0; i < v176; i++ { this.Resources[i] = NewPopulatedResource(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedOffer_Operation_Unreserve(r randyMesos, easy bool) *Offer_Operation_Unreserve { this := &Offer_Operation_Unreserve{} if r.Intn(10) != 0 { v177 := r.Intn(10) this.Resources = make([]*Resource, v177) for i := 0; i < v177; i++ { this.Resources[i] = NewPopulatedResource(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedOffer_Operation_Create(r randyMesos, easy bool) *Offer_Operation_Create { this := &Offer_Operation_Create{} if r.Intn(10) != 0 { v178 := r.Intn(10) this.Volumes = make([]*Resource, v178) for i := 0; i < v178; i++ { this.Volumes[i] = NewPopulatedResource(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedOffer_Operation_Destroy(r randyMesos, easy bool) *Offer_Operation_Destroy { this := &Offer_Operation_Destroy{} if r.Intn(10) != 0 { v179 := r.Intn(10) this.Volumes = make([]*Resource, v179) for i := 0; i < v179; i++ { this.Volumes[i] = NewPopulatedResource(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedTaskInfo(r randyMesos, easy bool) *TaskInfo { this := &TaskInfo{} v180 := randStringMesos(r) this.Name = &v180 this.TaskId = NewPopulatedTaskID(r, easy) this.SlaveId = NewPopulatedSlaveID(r, easy) if r.Intn(10) != 0 { v181 := r.Intn(10) this.Resources = make([]*Resource, v181) for i := 0; i < v181; i++ { this.Resources[i] = NewPopulatedResource(r, easy) } } if r.Intn(10) != 0 { this.Executor = NewPopulatedExecutorInfo(r, easy) } if r.Intn(10) != 0 { v182 := r.Intn(100) this.Data = make([]byte, v182) for i := 0; i < v182; i++ { this.Data[i] = byte(r.Intn(256)) } } if r.Intn(10) != 0 { this.Command = NewPopulatedCommandInfo(r, easy) } if r.Intn(10) != 0 { this.HealthCheck = NewPopulatedHealthCheck(r, easy) } if r.Intn(10) != 0 { this.Container = NewPopulatedContainerInfo(r, easy) } if r.Intn(10) != 0 { this.Labels = NewPopulatedLabels(r, easy) } if r.Intn(10) != 0 { this.Discovery = NewPopulatedDiscoveryInfo(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 12) } return this } func NewPopulatedTaskStatus(r randyMesos, easy bool) *TaskStatus { this := &TaskStatus{} this.TaskId = NewPopulatedTaskID(r, easy) v183 := TaskState([]int32{6, 0, 1, 2, 3, 4, 5, 7}[r.Intn(8)]) this.State = &v183 if r.Intn(10) != 0 { v184 := r.Intn(100) this.Data = make([]byte, v184) for i := 0; i < v184; i++ { this.Data[i] = byte(r.Intn(256)) } } if r.Intn(10) != 0 { v185 := randStringMesos(r) this.Message = &v185 } if r.Intn(10) != 0 { this.SlaveId = NewPopulatedSlaveID(r, easy) } if r.Intn(10) != 0 { v186 := float64(r.Float64()) if r.Intn(2) == 0 { v186 *= -1 } this.Timestamp = &v186 } if r.Intn(10) != 0 { this.ExecutorId = NewPopulatedExecutorID(r, easy) } if r.Intn(10) != 0 { v187 := bool(bool(r.Intn(2) == 0)) this.Healthy = &v187 } if r.Intn(10) != 0 { v188 := TaskStatus_Source([]int32{0, 1, 2}[r.Intn(3)]) this.Source = &v188 } if r.Intn(10) != 0 { v189 := TaskStatus_Reason([]int32{0, 17, 1, 2, 3, 4, 5, 6, 7, 8, 9, 18, 10, 11, 12, 13, 14, 15, 16}[r.Intn(19)]) this.Reason = &v189 } if r.Intn(10) != 0 { v190 := r.Intn(100) this.Uuid = make([]byte, v190) for i := 0; i < v190; i++ { this.Uuid[i] = byte(r.Intn(256)) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 12) } return this } func NewPopulatedFilters(r randyMesos, easy bool) *Filters { this := &Filters{} if r.Intn(10) != 0 { v191 := float64(r.Float64()) if r.Intn(2) == 0 { v191 *= -1 } this.RefuseSeconds = &v191 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedEnvironment(r randyMesos, easy bool) *Environment { this := &Environment{} if r.Intn(10) != 0 { v192 := r.Intn(10) this.Variables = make([]*Environment_Variable, v192) for i := 0; i < v192; i++ { this.Variables[i] = NewPopulatedEnvironment_Variable(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedEnvironment_Variable(r randyMesos, easy bool) *Environment_Variable { this := &Environment_Variable{} v193 := randStringMesos(r) this.Name = &v193 v194 := randStringMesos(r) this.Value = &v194 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 3) } return this } func NewPopulatedParameter(r randyMesos, easy bool) *Parameter { this := &Parameter{} v195 := randStringMesos(r) this.Key = &v195 v196 := randStringMesos(r) this.Value = &v196 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 3) } return this } func NewPopulatedParameters(r randyMesos, easy bool) *Parameters { this := &Parameters{} if r.Intn(10) != 0 { v197 := r.Intn(10) this.Parameter = make([]*Parameter, v197) for i := 0; i < v197; i++ { this.Parameter[i] = NewPopulatedParameter(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedCredential(r randyMesos, easy bool) *Credential { this := &Credential{} v198 := randStringMesos(r) this.Principal = &v198 if r.Intn(10) != 0 { v199 := r.Intn(100) this.Secret = make([]byte, v199) for i := 0; i < v199; i++ { this.Secret[i] = byte(r.Intn(256)) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 3) } return this } func NewPopulatedCredentials(r randyMesos, easy bool) *Credentials { this := &Credentials{} if r.Intn(10) != 0 { v200 := r.Intn(10) this.Credentials = make([]*Credential, v200) for i := 0; i < v200; i++ { this.Credentials[i] = NewPopulatedCredential(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedACL(r randyMesos, easy bool) *ACL { this := &ACL{} if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 1) } return this } func NewPopulatedACL_Entity(r randyMesos, easy bool) *ACL_Entity { this := &ACL_Entity{} if r.Intn(10) != 0 { v201 := ACL_Entity_Type([]int32{0, 1, 2}[r.Intn(3)]) this.Type = &v201 } if r.Intn(10) != 0 { v202 := r.Intn(10) this.Values = make([]string, v202) for i := 0; i < v202; i++ { this.Values[i] = randStringMesos(r) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 3) } return this } func NewPopulatedACL_RegisterFramework(r randyMesos, easy bool) *ACL_RegisterFramework { this := &ACL_RegisterFramework{} this.Principals = NewPopulatedACL_Entity(r, easy) this.Roles = NewPopulatedACL_Entity(r, easy) if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 3) } return this } func NewPopulatedACL_RunTask(r randyMesos, easy bool) *ACL_RunTask { this := &ACL_RunTask{} this.Principals = NewPopulatedACL_Entity(r, easy) this.Users = NewPopulatedACL_Entity(r, easy) if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 3) } return this } func NewPopulatedACL_ShutdownFramework(r randyMesos, easy bool) *ACL_ShutdownFramework { this := &ACL_ShutdownFramework{} this.Principals = NewPopulatedACL_Entity(r, easy) this.FrameworkPrincipals = NewPopulatedACL_Entity(r, easy) if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 3) } return this } func NewPopulatedACLs(r randyMesos, easy bool) *ACLs { this := &ACLs{} if r.Intn(10) != 0 { v203 := bool(bool(r.Intn(2) == 0)) this.Permissive = &v203 } if r.Intn(10) != 0 { v204 := r.Intn(10) this.RegisterFrameworks = make([]*ACL_RegisterFramework, v204) for i := 0; i < v204; i++ { this.RegisterFrameworks[i] = NewPopulatedACL_RegisterFramework(r, easy) } } if r.Intn(10) != 0 { v205 := r.Intn(10) this.RunTasks = make([]*ACL_RunTask, v205) for i := 0; i < v205; i++ { this.RunTasks[i] = NewPopulatedACL_RunTask(r, easy) } } if r.Intn(10) != 0 { v206 := r.Intn(10) this.ShutdownFrameworks = make([]*ACL_ShutdownFramework, v206) for i := 0; i < v206; i++ { this.ShutdownFrameworks[i] = NewPopulatedACL_ShutdownFramework(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 5) } return this } func NewPopulatedRateLimit(r randyMesos, easy bool) *RateLimit { this := &RateLimit{} if r.Intn(10) != 0 { v207 := float64(r.Float64()) if r.Intn(2) == 0 { v207 *= -1 } this.Qps = &v207 } v208 := randStringMesos(r) this.Principal = &v208 if r.Intn(10) != 0 { v209 := uint64(uint64(r.Uint32())) this.Capacity = &v209 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 4) } return this } func NewPopulatedRateLimits(r randyMesos, easy bool) *RateLimits { this := &RateLimits{} if r.Intn(10) != 0 { v210 := r.Intn(10) this.Limits = make([]*RateLimit, v210) for i := 0; i < v210; i++ { this.Limits[i] = NewPopulatedRateLimit(r, easy) } } if r.Intn(10) != 0 { v211 := float64(r.Float64()) if r.Intn(2) == 0 { v211 *= -1 } this.AggregateDefaultQps = &v211 } if r.Intn(10) != 0 { v212 := uint64(uint64(r.Uint32())) this.AggregateDefaultCapacity = &v212 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 4) } return this } func NewPopulatedVolume(r randyMesos, easy bool) *Volume { this := &Volume{} v213 := randStringMesos(r) this.ContainerPath = &v213 if r.Intn(10) != 0 { v214 := randStringMesos(r) this.HostPath = &v214 } v215 := Volume_Mode([]int32{1, 2}[r.Intn(2)]) this.Mode = &v215 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 4) } return this } func NewPopulatedContainerInfo(r randyMesos, easy bool) *ContainerInfo { this := &ContainerInfo{} v216 := ContainerInfo_Type([]int32{1, 2}[r.Intn(2)]) this.Type = &v216 if r.Intn(10) != 0 { v217 := r.Intn(10) this.Volumes = make([]*Volume, v217) for i := 0; i < v217; i++ { this.Volumes[i] = NewPopulatedVolume(r, easy) } } if r.Intn(10) != 0 { this.Docker = NewPopulatedContainerInfo_DockerInfo(r, easy) } if r.Intn(10) != 0 { v218 := randStringMesos(r) this.Hostname = &v218 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 5) } return this } func NewPopulatedContainerInfo_DockerInfo(r randyMesos, easy bool) *ContainerInfo_DockerInfo { this := &ContainerInfo_DockerInfo{} v219 := randStringMesos(r) this.Image = &v219 if r.Intn(10) != 0 { v220 := ContainerInfo_DockerInfo_Network([]int32{1, 2, 3}[r.Intn(3)]) this.Network = &v220 } if r.Intn(10) != 0 { v221 := r.Intn(10) this.PortMappings = make([]*ContainerInfo_DockerInfo_PortMapping, v221) for i := 0; i < v221; i++ { this.PortMappings[i] = NewPopulatedContainerInfo_DockerInfo_PortMapping(r, easy) } } if r.Intn(10) != 0 { v222 := bool(bool(r.Intn(2) == 0)) this.Privileged = &v222 } if r.Intn(10) != 0 { v223 := r.Intn(10) this.Parameters = make([]*Parameter, v223) for i := 0; i < v223; i++ { this.Parameters[i] = NewPopulatedParameter(r, easy) } } if r.Intn(10) != 0 { v224 := bool(bool(r.Intn(2) == 0)) this.ForcePullImage = &v224 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 7) } return this } func NewPopulatedContainerInfo_DockerInfo_PortMapping(r randyMesos, easy bool) *ContainerInfo_DockerInfo_PortMapping { this := &ContainerInfo_DockerInfo_PortMapping{} v225 := uint32(r.Uint32()) this.HostPort = &v225 v226 := uint32(r.Uint32()) this.ContainerPort = &v226 if r.Intn(10) != 0 { v227 := randStringMesos(r) this.Protocol = &v227 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 4) } return this } func NewPopulatedLabels(r randyMesos, easy bool) *Labels { this := &Labels{} if r.Intn(10) != 0 { v228 := r.Intn(10) this.Labels = make([]*Label, v228) for i := 0; i < v228; i++ { this.Labels[i] = NewPopulatedLabel(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedLabel(r randyMesos, easy bool) *Label { this := &Label{} v229 := randStringMesos(r) this.Key = &v229 if r.Intn(10) != 0 { v230 := randStringMesos(r) this.Value = &v230 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 3) } return this } func NewPopulatedPort(r randyMesos, easy bool) *Port { this := &Port{} v231 := uint32(r.Uint32()) this.Number = &v231 if r.Intn(10) != 0 { v232 := randStringMesos(r) this.Name = &v232 } if r.Intn(10) != 0 { v233 := randStringMesos(r) this.Protocol = &v233 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 4) } return this } func NewPopulatedPorts(r randyMesos, easy bool) *Ports { this := &Ports{} if r.Intn(10) != 0 { v234 := r.Intn(10) this.Ports = make([]*Port, v234) for i := 0; i < v234; i++ { this.Ports[i] = NewPopulatedPort(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 2) } return this } func NewPopulatedDiscoveryInfo(r randyMesos, easy bool) *DiscoveryInfo { this := &DiscoveryInfo{} v235 := DiscoveryInfo_Visibility([]int32{0, 1, 2}[r.Intn(3)]) this.Visibility = &v235 if r.Intn(10) != 0 { v236 := randStringMesos(r) this.Name = &v236 } if r.Intn(10) != 0 { v237 := randStringMesos(r) this.Environment = &v237 } if r.Intn(10) != 0 { v238 := randStringMesos(r) this.Location = &v238 } if r.Intn(10) != 0 { v239 := randStringMesos(r) this.Version = &v239 } if r.Intn(10) != 0 { this.Ports = NewPopulatedPorts(r, easy) } if r.Intn(10) != 0 { this.Labels = NewPopulatedLabels(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedMesos(r, 8) } return this } type randyMesos interface { Float32() float32 Float64() float64 Int63() int64 Int31() int32 Uint32() uint32 Intn(n int) int } func randUTF8RuneMesos(r randyMesos) rune { ru := r.Intn(62) if ru < 10 { return rune(ru + 48) } else if ru < 36 { return rune(ru + 55) } return rune(ru + 61) } func randStringMesos(r randyMesos) string { v240 := r.Intn(100) tmps := make([]rune, v240) for i := 0; i < v240; i++ { tmps[i] = randUTF8RuneMesos(r) } return string(tmps) } func randUnrecognizedMesos(r randyMesos, maxFieldNumber int) (data []byte) { l := r.Intn(5) for i := 0; i < l; i++ { wire := r.Intn(4) if wire == 3 { wire = 5 } fieldNumber := maxFieldNumber + r.Intn(100) data = randFieldMesos(data, r, fieldNumber, wire) } return data } func randFieldMesos(data []byte, r randyMesos, fieldNumber int, wire int) []byte { key := uint32(fieldNumber)<<3 | uint32(wire) switch wire { case 0: data = encodeVarintPopulateMesos(data, uint64(key)) v241 := r.Int63() if r.Intn(2) == 0 { v241 *= -1 } data = encodeVarintPopulateMesos(data, uint64(v241)) case 1: data = encodeVarintPopulateMesos(data, uint64(key)) data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) case 2: data = encodeVarintPopulateMesos(data, uint64(key)) ll := r.Intn(100) data = encodeVarintPopulateMesos(data, uint64(ll)) for j := 0; j < ll; j++ { data = append(data, byte(r.Intn(256))) } default: data = encodeVarintPopulateMesos(data, uint64(key)) data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) } return data } func encodeVarintPopulateMesos(data []byte, v uint64) []byte { for v >= 1<<7 { data = append(data, uint8(uint64(v)&0x7f|0x80)) v >>= 7 } data = append(data, uint8(v)) return data } func (m *FrameworkID) Size() (n int) { var l int _ = l if m.Value != nil { l = len(*m.Value) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *OfferID) Size() (n int) { var l int _ = l if m.Value != nil { l = len(*m.Value) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *SlaveID) Size() (n int) { var l int _ = l if m.Value != nil { l = len(*m.Value) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *TaskID) Size() (n int) { var l int _ = l if m.Value != nil { l = len(*m.Value) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ExecutorID) Size() (n int) { var l int _ = l if m.Value != nil { l = len(*m.Value) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ContainerID) Size() (n int) { var l int _ = l if m.Value != nil { l = len(*m.Value) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *FrameworkInfo) Size() (n int) { var l int _ = l if m.User != nil { l = len(*m.User) n += 1 + l + sovMesos(uint64(l)) } if m.Name != nil { l = len(*m.Name) n += 1 + l + sovMesos(uint64(l)) } if m.Id != nil { l = m.Id.Size() n += 1 + l + sovMesos(uint64(l)) } if m.FailoverTimeout != nil { n += 9 } if m.Checkpoint != nil { n += 2 } if m.Role != nil { l = len(*m.Role) n += 1 + l + sovMesos(uint64(l)) } if m.Hostname != nil { l = len(*m.Hostname) n += 1 + l + sovMesos(uint64(l)) } if m.Principal != nil { l = len(*m.Principal) n += 1 + l + sovMesos(uint64(l)) } if m.WebuiUrl != nil { l = len(*m.WebuiUrl) n += 1 + l + sovMesos(uint64(l)) } if len(m.Capabilities) > 0 { for _, e := range m.Capabilities { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *FrameworkInfo_Capability) Size() (n int) { var l int _ = l if m.Type != nil { n += 1 + sovMesos(uint64(*m.Type)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *HealthCheck) Size() (n int) { var l int _ = l if m.Http != nil { l = m.Http.Size() n += 1 + l + sovMesos(uint64(l)) } if m.DelaySeconds != nil { n += 9 } if m.IntervalSeconds != nil { n += 9 } if m.TimeoutSeconds != nil { n += 9 } if m.ConsecutiveFailures != nil { n += 1 + sovMesos(uint64(*m.ConsecutiveFailures)) } if m.GracePeriodSeconds != nil { n += 9 } if m.Command != nil { l = m.Command.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *HealthCheck_HTTP) Size() (n int) { var l int _ = l if m.Port != nil { n += 1 + sovMesos(uint64(*m.Port)) } if m.Path != nil { l = len(*m.Path) n += 1 + l + sovMesos(uint64(l)) } if len(m.Statuses) > 0 { for _, e := range m.Statuses { n += 1 + sovMesos(uint64(e)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *CommandInfo) Size() (n int) { var l int _ = l if len(m.Uris) > 0 { for _, e := range m.Uris { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.Environment != nil { l = m.Environment.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Value != nil { l = len(*m.Value) n += 1 + l + sovMesos(uint64(l)) } if m.Container != nil { l = m.Container.Size() n += 1 + l + sovMesos(uint64(l)) } if m.User != nil { l = len(*m.User) n += 1 + l + sovMesos(uint64(l)) } if m.Shell != nil { n += 2 } if len(m.Arguments) > 0 { for _, s := range m.Arguments { l = len(s) n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *CommandInfo_URI) Size() (n int) { var l int _ = l if m.Value != nil { l = len(*m.Value) n += 1 + l + sovMesos(uint64(l)) } if m.Executable != nil { n += 2 } if m.Extract != nil { n += 2 } if m.Cache != nil { n += 2 } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *CommandInfo_ContainerInfo) Size() (n int) { var l int _ = l if m.Image != nil { l = len(*m.Image) n += 1 + l + sovMesos(uint64(l)) } if len(m.Options) > 0 { for _, s := range m.Options { l = len(s) n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ExecutorInfo) Size() (n int) { var l int _ = l if m.ExecutorId != nil { l = m.ExecutorId.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Data != nil { l = len(m.Data) n += 1 + l + sovMesos(uint64(l)) } if len(m.Resources) > 0 { for _, e := range m.Resources { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.Command != nil { l = m.Command.Size() n += 1 + l + sovMesos(uint64(l)) } if m.FrameworkId != nil { l = m.FrameworkId.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Name != nil { l = len(*m.Name) n += 1 + l + sovMesos(uint64(l)) } if m.Source != nil { l = len(*m.Source) n += 1 + l + sovMesos(uint64(l)) } if m.Container != nil { l = m.Container.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Discovery != nil { l = m.Discovery.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *MasterInfo) Size() (n int) { var l int _ = l if m.Id != nil { l = len(*m.Id) n += 1 + l + sovMesos(uint64(l)) } if m.Ip != nil { n += 1 + sovMesos(uint64(*m.Ip)) } if m.Port != nil { n += 1 + sovMesos(uint64(*m.Port)) } if m.Pid != nil { l = len(*m.Pid) n += 1 + l + sovMesos(uint64(l)) } if m.Hostname != nil { l = len(*m.Hostname) n += 1 + l + sovMesos(uint64(l)) } if m.Version != nil { l = len(*m.Version) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *SlaveInfo) Size() (n int) { var l int _ = l if m.Hostname != nil { l = len(*m.Hostname) n += 1 + l + sovMesos(uint64(l)) } if len(m.Resources) > 0 { for _, e := range m.Resources { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if len(m.Attributes) > 0 { for _, e := range m.Attributes { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.Id != nil { l = m.Id.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Checkpoint != nil { n += 2 } if m.Port != nil { n += 1 + sovMesos(uint64(*m.Port)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Value) Size() (n int) { var l int _ = l if m.Type != nil { n += 1 + sovMesos(uint64(*m.Type)) } if m.Scalar != nil { l = m.Scalar.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Ranges != nil { l = m.Ranges.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Set != nil { l = m.Set.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Text != nil { l = m.Text.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Value_Scalar) Size() (n int) { var l int _ = l if m.Value != nil { n += 9 } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Value_Range) Size() (n int) { var l int _ = l if m.Begin != nil { n += 1 + sovMesos(uint64(*m.Begin)) } if m.End != nil { n += 1 + sovMesos(uint64(*m.End)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Value_Ranges) Size() (n int) { var l int _ = l if len(m.Range) > 0 { for _, e := range m.Range { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Value_Set) Size() (n int) { var l int _ = l if len(m.Item) > 0 { for _, s := range m.Item { l = len(s) n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Value_Text) Size() (n int) { var l int _ = l if m.Value != nil { l = len(*m.Value) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Attribute) Size() (n int) { var l int _ = l if m.Name != nil { l = len(*m.Name) n += 1 + l + sovMesos(uint64(l)) } if m.Type != nil { n += 1 + sovMesos(uint64(*m.Type)) } if m.Scalar != nil { l = m.Scalar.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Ranges != nil { l = m.Ranges.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Text != nil { l = m.Text.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Set != nil { l = m.Set.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Resource) Size() (n int) { var l int _ = l if m.Name != nil { l = len(*m.Name) n += 1 + l + sovMesos(uint64(l)) } if m.Type != nil { n += 1 + sovMesos(uint64(*m.Type)) } if m.Scalar != nil { l = m.Scalar.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Ranges != nil { l = m.Ranges.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Set != nil { l = m.Set.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Role != nil { l = len(*m.Role) n += 1 + l + sovMesos(uint64(l)) } if m.Disk != nil { l = m.Disk.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Reservation != nil { l = m.Reservation.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Revocable != nil { l = m.Revocable.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Resource_ReservationInfo) Size() (n int) { var l int _ = l if m.Principal != nil { l = len(*m.Principal) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Resource_DiskInfo) Size() (n int) { var l int _ = l if m.Persistence != nil { l = m.Persistence.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Volume != nil { l = m.Volume.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Resource_DiskInfo_Persistence) Size() (n int) { var l int _ = l if m.Id != nil { l = len(*m.Id) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Resource_RevocableInfo) Size() (n int) { var l int _ = l if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *TrafficControlStatistics) Size() (n int) { var l int _ = l if m.Id != nil { l = len(*m.Id) n += 1 + l + sovMesos(uint64(l)) } if m.Backlog != nil { n += 1 + sovMesos(uint64(*m.Backlog)) } if m.Bytes != nil { n += 1 + sovMesos(uint64(*m.Bytes)) } if m.Drops != nil { n += 1 + sovMesos(uint64(*m.Drops)) } if m.Overlimits != nil { n += 1 + sovMesos(uint64(*m.Overlimits)) } if m.Packets != nil { n += 1 + sovMesos(uint64(*m.Packets)) } if m.Qlen != nil { n += 1 + sovMesos(uint64(*m.Qlen)) } if m.Ratebps != nil { n += 1 + sovMesos(uint64(*m.Ratebps)) } if m.Ratepps != nil { n += 1 + sovMesos(uint64(*m.Ratepps)) } if m.Requeues != nil { n += 1 + sovMesos(uint64(*m.Requeues)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ResourceStatistics) Size() (n int) { var l int _ = l if m.Timestamp != nil { n += 9 } if m.CpusUserTimeSecs != nil { n += 9 } if m.CpusSystemTimeSecs != nil { n += 9 } if m.CpusLimit != nil { n += 9 } if m.MemRssBytes != nil { n += 1 + sovMesos(uint64(*m.MemRssBytes)) } if m.MemLimitBytes != nil { n += 1 + sovMesos(uint64(*m.MemLimitBytes)) } if m.CpusNrPeriods != nil { n += 1 + sovMesos(uint64(*m.CpusNrPeriods)) } if m.CpusNrThrottled != nil { n += 1 + sovMesos(uint64(*m.CpusNrThrottled)) } if m.CpusThrottledTimeSecs != nil { n += 9 } if m.MemFileBytes != nil { n += 1 + sovMesos(uint64(*m.MemFileBytes)) } if m.MemAnonBytes != nil { n += 1 + sovMesos(uint64(*m.MemAnonBytes)) } if m.MemMappedFileBytes != nil { n += 1 + sovMesos(uint64(*m.MemMappedFileBytes)) } if m.Perf != nil { l = m.Perf.Size() n += 1 + l + sovMesos(uint64(l)) } if m.NetRxPackets != nil { n += 1 + sovMesos(uint64(*m.NetRxPackets)) } if m.NetRxBytes != nil { n += 1 + sovMesos(uint64(*m.NetRxBytes)) } if m.NetRxErrors != nil { n += 2 + sovMesos(uint64(*m.NetRxErrors)) } if m.NetRxDropped != nil { n += 2 + sovMesos(uint64(*m.NetRxDropped)) } if m.NetTxPackets != nil { n += 2 + sovMesos(uint64(*m.NetTxPackets)) } if m.NetTxBytes != nil { n += 2 + sovMesos(uint64(*m.NetTxBytes)) } if m.NetTxErrors != nil { n += 2 + sovMesos(uint64(*m.NetTxErrors)) } if m.NetTxDropped != nil { n += 2 + sovMesos(uint64(*m.NetTxDropped)) } if m.NetTcpRttMicrosecsP50 != nil { n += 10 } if m.NetTcpRttMicrosecsP90 != nil { n += 10 } if m.NetTcpRttMicrosecsP95 != nil { n += 10 } if m.NetTcpRttMicrosecsP99 != nil { n += 10 } if m.DiskLimitBytes != nil { n += 2 + sovMesos(uint64(*m.DiskLimitBytes)) } if m.DiskUsedBytes != nil { n += 2 + sovMesos(uint64(*m.DiskUsedBytes)) } if m.NetTcpActiveConnections != nil { n += 10 } if m.NetTcpTimeWaitConnections != nil { n += 10 } if m.Processes != nil { n += 2 + sovMesos(uint64(*m.Processes)) } if m.Threads != nil { n += 2 + sovMesos(uint64(*m.Threads)) } if m.MemLowPressureCounter != nil { n += 2 + sovMesos(uint64(*m.MemLowPressureCounter)) } if m.MemMediumPressureCounter != nil { n += 2 + sovMesos(uint64(*m.MemMediumPressureCounter)) } if m.MemCriticalPressureCounter != nil { n += 2 + sovMesos(uint64(*m.MemCriticalPressureCounter)) } if len(m.NetTrafficControlStatistics) > 0 { for _, e := range m.NetTrafficControlStatistics { l = e.Size() n += 2 + l + sovMesos(uint64(l)) } } if m.MemTotalBytes != nil { n += 2 + sovMesos(uint64(*m.MemTotalBytes)) } if m.MemTotalMemswBytes != nil { n += 2 + sovMesos(uint64(*m.MemTotalMemswBytes)) } if m.MemSoftLimitBytes != nil { n += 2 + sovMesos(uint64(*m.MemSoftLimitBytes)) } if m.MemCacheBytes != nil { n += 2 + sovMesos(uint64(*m.MemCacheBytes)) } if m.MemSwapBytes != nil { n += 2 + sovMesos(uint64(*m.MemSwapBytes)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ResourceUsage) Size() (n int) { var l int _ = l if len(m.Executors) > 0 { for _, e := range m.Executors { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ResourceUsage_Executor) Size() (n int) { var l int _ = l if m.ExecutorInfo != nil { l = m.ExecutorInfo.Size() n += 1 + l + sovMesos(uint64(l)) } if len(m.Allocated) > 0 { for _, e := range m.Allocated { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.Statistics != nil { l = m.Statistics.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *PerfStatistics) Size() (n int) { var l int _ = l if m.Timestamp != nil { n += 9 } if m.Duration != nil { n += 9 } if m.Cycles != nil { n += 1 + sovMesos(uint64(*m.Cycles)) } if m.StalledCyclesFrontend != nil { n += 1 + sovMesos(uint64(*m.StalledCyclesFrontend)) } if m.StalledCyclesBackend != nil { n += 1 + sovMesos(uint64(*m.StalledCyclesBackend)) } if m.Instructions != nil { n += 1 + sovMesos(uint64(*m.Instructions)) } if m.CacheReferences != nil { n += 1 + sovMesos(uint64(*m.CacheReferences)) } if m.CacheMisses != nil { n += 1 + sovMesos(uint64(*m.CacheMisses)) } if m.Branches != nil { n += 1 + sovMesos(uint64(*m.Branches)) } if m.BranchMisses != nil { n += 1 + sovMesos(uint64(*m.BranchMisses)) } if m.BusCycles != nil { n += 1 + sovMesos(uint64(*m.BusCycles)) } if m.RefCycles != nil { n += 1 + sovMesos(uint64(*m.RefCycles)) } if m.CpuClock != nil { n += 9 } if m.TaskClock != nil { n += 9 } if m.PageFaults != nil { n += 1 + sovMesos(uint64(*m.PageFaults)) } if m.MinorFaults != nil { n += 2 + sovMesos(uint64(*m.MinorFaults)) } if m.MajorFaults != nil { n += 2 + sovMesos(uint64(*m.MajorFaults)) } if m.ContextSwitches != nil { n += 2 + sovMesos(uint64(*m.ContextSwitches)) } if m.CpuMigrations != nil { n += 2 + sovMesos(uint64(*m.CpuMigrations)) } if m.AlignmentFaults != nil { n += 2 + sovMesos(uint64(*m.AlignmentFaults)) } if m.EmulationFaults != nil { n += 2 + sovMesos(uint64(*m.EmulationFaults)) } if m.L1DcacheLoads != nil { n += 2 + sovMesos(uint64(*m.L1DcacheLoads)) } if m.L1DcacheLoadMisses != nil { n += 2 + sovMesos(uint64(*m.L1DcacheLoadMisses)) } if m.L1DcacheStores != nil { n += 2 + sovMesos(uint64(*m.L1DcacheStores)) } if m.L1DcacheStoreMisses != nil { n += 2 + sovMesos(uint64(*m.L1DcacheStoreMisses)) } if m.L1DcachePrefetches != nil { n += 2 + sovMesos(uint64(*m.L1DcachePrefetches)) } if m.L1DcachePrefetchMisses != nil { n += 2 + sovMesos(uint64(*m.L1DcachePrefetchMisses)) } if m.L1IcacheLoads != nil { n += 2 + sovMesos(uint64(*m.L1IcacheLoads)) } if m.L1IcacheLoadMisses != nil { n += 2 + sovMesos(uint64(*m.L1IcacheLoadMisses)) } if m.L1IcachePrefetches != nil { n += 2 + sovMesos(uint64(*m.L1IcachePrefetches)) } if m.L1IcachePrefetchMisses != nil { n += 2 + sovMesos(uint64(*m.L1IcachePrefetchMisses)) } if m.LlcLoads != nil { n += 2 + sovMesos(uint64(*m.LlcLoads)) } if m.LlcLoadMisses != nil { n += 2 + sovMesos(uint64(*m.LlcLoadMisses)) } if m.LlcStores != nil { n += 2 + sovMesos(uint64(*m.LlcStores)) } if m.LlcStoreMisses != nil { n += 2 + sovMesos(uint64(*m.LlcStoreMisses)) } if m.LlcPrefetches != nil { n += 2 + sovMesos(uint64(*m.LlcPrefetches)) } if m.LlcPrefetchMisses != nil { n += 2 + sovMesos(uint64(*m.LlcPrefetchMisses)) } if m.DtlbLoads != nil { n += 2 + sovMesos(uint64(*m.DtlbLoads)) } if m.DtlbLoadMisses != nil { n += 2 + sovMesos(uint64(*m.DtlbLoadMisses)) } if m.DtlbStores != nil { n += 2 + sovMesos(uint64(*m.DtlbStores)) } if m.DtlbStoreMisses != nil { n += 2 + sovMesos(uint64(*m.DtlbStoreMisses)) } if m.DtlbPrefetches != nil { n += 2 + sovMesos(uint64(*m.DtlbPrefetches)) } if m.DtlbPrefetchMisses != nil { n += 2 + sovMesos(uint64(*m.DtlbPrefetchMisses)) } if m.ItlbLoads != nil { n += 2 + sovMesos(uint64(*m.ItlbLoads)) } if m.ItlbLoadMisses != nil { n += 2 + sovMesos(uint64(*m.ItlbLoadMisses)) } if m.BranchLoads != nil { n += 2 + sovMesos(uint64(*m.BranchLoads)) } if m.BranchLoadMisses != nil { n += 2 + sovMesos(uint64(*m.BranchLoadMisses)) } if m.NodeLoads != nil { n += 2 + sovMesos(uint64(*m.NodeLoads)) } if m.NodeLoadMisses != nil { n += 2 + sovMesos(uint64(*m.NodeLoadMisses)) } if m.NodeStores != nil { n += 2 + sovMesos(uint64(*m.NodeStores)) } if m.NodeStoreMisses != nil { n += 2 + sovMesos(uint64(*m.NodeStoreMisses)) } if m.NodePrefetches != nil { n += 2 + sovMesos(uint64(*m.NodePrefetches)) } if m.NodePrefetchMisses != nil { n += 2 + sovMesos(uint64(*m.NodePrefetchMisses)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Request) Size() (n int) { var l int _ = l if m.SlaveId != nil { l = m.SlaveId.Size() n += 1 + l + sovMesos(uint64(l)) } if len(m.Resources) > 0 { for _, e := range m.Resources { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Offer) Size() (n int) { var l int _ = l if m.Id != nil { l = m.Id.Size() n += 1 + l + sovMesos(uint64(l)) } if m.FrameworkId != nil { l = m.FrameworkId.Size() n += 1 + l + sovMesos(uint64(l)) } if m.SlaveId != nil { l = m.SlaveId.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Hostname != nil { l = len(*m.Hostname) n += 1 + l + sovMesos(uint64(l)) } if len(m.Resources) > 0 { for _, e := range m.Resources { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if len(m.ExecutorIds) > 0 { for _, e := range m.ExecutorIds { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if len(m.Attributes) > 0 { for _, e := range m.Attributes { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Offer_Operation) Size() (n int) { var l int _ = l if m.Type != nil { n += 1 + sovMesos(uint64(*m.Type)) } if m.Launch != nil { l = m.Launch.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Reserve != nil { l = m.Reserve.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Unreserve != nil { l = m.Unreserve.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Create != nil { l = m.Create.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Destroy != nil { l = m.Destroy.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Offer_Operation_Launch) Size() (n int) { var l int _ = l if len(m.TaskInfos) > 0 { for _, e := range m.TaskInfos { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Offer_Operation_Reserve) Size() (n int) { var l int _ = l if len(m.Resources) > 0 { for _, e := range m.Resources { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Offer_Operation_Unreserve) Size() (n int) { var l int _ = l if len(m.Resources) > 0 { for _, e := range m.Resources { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Offer_Operation_Create) Size() (n int) { var l int _ = l if len(m.Volumes) > 0 { for _, e := range m.Volumes { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Offer_Operation_Destroy) Size() (n int) { var l int _ = l if len(m.Volumes) > 0 { for _, e := range m.Volumes { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *TaskInfo) Size() (n int) { var l int _ = l if m.Name != nil { l = len(*m.Name) n += 1 + l + sovMesos(uint64(l)) } if m.TaskId != nil { l = m.TaskId.Size() n += 1 + l + sovMesos(uint64(l)) } if m.SlaveId != nil { l = m.SlaveId.Size() n += 1 + l + sovMesos(uint64(l)) } if len(m.Resources) > 0 { for _, e := range m.Resources { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.Executor != nil { l = m.Executor.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Data != nil { l = len(m.Data) n += 1 + l + sovMesos(uint64(l)) } if m.Command != nil { l = m.Command.Size() n += 1 + l + sovMesos(uint64(l)) } if m.HealthCheck != nil { l = m.HealthCheck.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Container != nil { l = m.Container.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Labels != nil { l = m.Labels.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Discovery != nil { l = m.Discovery.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *TaskStatus) Size() (n int) { var l int _ = l if m.TaskId != nil { l = m.TaskId.Size() n += 1 + l + sovMesos(uint64(l)) } if m.State != nil { n += 1 + sovMesos(uint64(*m.State)) } if m.Data != nil { l = len(m.Data) n += 1 + l + sovMesos(uint64(l)) } if m.Message != nil { l = len(*m.Message) n += 1 + l + sovMesos(uint64(l)) } if m.SlaveId != nil { l = m.SlaveId.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Timestamp != nil { n += 9 } if m.ExecutorId != nil { l = m.ExecutorId.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Healthy != nil { n += 2 } if m.Source != nil { n += 1 + sovMesos(uint64(*m.Source)) } if m.Reason != nil { n += 1 + sovMesos(uint64(*m.Reason)) } if m.Uuid != nil { l = len(m.Uuid) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Filters) Size() (n int) { var l int _ = l if m.RefuseSeconds != nil { n += 9 } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Environment) Size() (n int) { var l int _ = l if len(m.Variables) > 0 { for _, e := range m.Variables { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Environment_Variable) Size() (n int) { var l int _ = l if m.Name != nil { l = len(*m.Name) n += 1 + l + sovMesos(uint64(l)) } if m.Value != nil { l = len(*m.Value) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Parameter) Size() (n int) { var l int _ = l if m.Key != nil { l = len(*m.Key) n += 1 + l + sovMesos(uint64(l)) } if m.Value != nil { l = len(*m.Value) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Parameters) Size() (n int) { var l int _ = l if len(m.Parameter) > 0 { for _, e := range m.Parameter { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Credential) Size() (n int) { var l int _ = l if m.Principal != nil { l = len(*m.Principal) n += 1 + l + sovMesos(uint64(l)) } if m.Secret != nil { l = len(m.Secret) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Credentials) Size() (n int) { var l int _ = l if len(m.Credentials) > 0 { for _, e := range m.Credentials { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ACL) Size() (n int) { var l int _ = l if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ACL_Entity) Size() (n int) { var l int _ = l if m.Type != nil { n += 1 + sovMesos(uint64(*m.Type)) } if len(m.Values) > 0 { for _, s := range m.Values { l = len(s) n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ACL_RegisterFramework) Size() (n int) { var l int _ = l if m.Principals != nil { l = m.Principals.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Roles != nil { l = m.Roles.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ACL_RunTask) Size() (n int) { var l int _ = l if m.Principals != nil { l = m.Principals.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Users != nil { l = m.Users.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ACL_ShutdownFramework) Size() (n int) { var l int _ = l if m.Principals != nil { l = m.Principals.Size() n += 1 + l + sovMesos(uint64(l)) } if m.FrameworkPrincipals != nil { l = m.FrameworkPrincipals.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ACLs) Size() (n int) { var l int _ = l if m.Permissive != nil { n += 2 } if len(m.RegisterFrameworks) > 0 { for _, e := range m.RegisterFrameworks { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if len(m.RunTasks) > 0 { for _, e := range m.RunTasks { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if len(m.ShutdownFrameworks) > 0 { for _, e := range m.ShutdownFrameworks { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *RateLimit) Size() (n int) { var l int _ = l if m.Qps != nil { n += 9 } if m.Principal != nil { l = len(*m.Principal) n += 1 + l + sovMesos(uint64(l)) } if m.Capacity != nil { n += 1 + sovMesos(uint64(*m.Capacity)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *RateLimits) Size() (n int) { var l int _ = l if len(m.Limits) > 0 { for _, e := range m.Limits { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.AggregateDefaultQps != nil { n += 9 } if m.AggregateDefaultCapacity != nil { n += 1 + sovMesos(uint64(*m.AggregateDefaultCapacity)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Volume) Size() (n int) { var l int _ = l if m.ContainerPath != nil { l = len(*m.ContainerPath) n += 1 + l + sovMesos(uint64(l)) } if m.HostPath != nil { l = len(*m.HostPath) n += 1 + l + sovMesos(uint64(l)) } if m.Mode != nil { n += 1 + sovMesos(uint64(*m.Mode)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ContainerInfo) Size() (n int) { var l int _ = l if m.Type != nil { n += 1 + sovMesos(uint64(*m.Type)) } if len(m.Volumes) > 0 { for _, e := range m.Volumes { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.Docker != nil { l = m.Docker.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Hostname != nil { l = len(*m.Hostname) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ContainerInfo_DockerInfo) Size() (n int) { var l int _ = l if m.Image != nil { l = len(*m.Image) n += 1 + l + sovMesos(uint64(l)) } if m.Network != nil { n += 1 + sovMesos(uint64(*m.Network)) } if len(m.PortMappings) > 0 { for _, e := range m.PortMappings { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.Privileged != nil { n += 2 } if len(m.Parameters) > 0 { for _, e := range m.Parameters { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.ForcePullImage != nil { n += 2 } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ContainerInfo_DockerInfo_PortMapping) Size() (n int) { var l int _ = l if m.HostPort != nil { n += 1 + sovMesos(uint64(*m.HostPort)) } if m.ContainerPort != nil { n += 1 + sovMesos(uint64(*m.ContainerPort)) } if m.Protocol != nil { l = len(*m.Protocol) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Labels) Size() (n int) { var l int _ = l if len(m.Labels) > 0 { for _, e := range m.Labels { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Label) Size() (n int) { var l int _ = l if m.Key != nil { l = len(*m.Key) n += 1 + l + sovMesos(uint64(l)) } if m.Value != nil { l = len(*m.Value) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Port) Size() (n int) { var l int _ = l if m.Number != nil { n += 1 + sovMesos(uint64(*m.Number)) } if m.Name != nil { l = len(*m.Name) n += 1 + l + sovMesos(uint64(l)) } if m.Protocol != nil { l = len(*m.Protocol) n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Ports) Size() (n int) { var l int _ = l if len(m.Ports) > 0 { for _, e := range m.Ports { l = e.Size() n += 1 + l + sovMesos(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *DiscoveryInfo) Size() (n int) { var l int _ = l if m.Visibility != nil { n += 1 + sovMesos(uint64(*m.Visibility)) } if m.Name != nil { l = len(*m.Name) n += 1 + l + sovMesos(uint64(l)) } if m.Environment != nil { l = len(*m.Environment) n += 1 + l + sovMesos(uint64(l)) } if m.Location != nil { l = len(*m.Location) n += 1 + l + sovMesos(uint64(l)) } if m.Version != nil { l = len(*m.Version) n += 1 + l + sovMesos(uint64(l)) } if m.Ports != nil { l = m.Ports.Size() n += 1 + l + sovMesos(uint64(l)) } if m.Labels != nil { l = m.Labels.Size() n += 1 + l + sovMesos(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func sovMesos(x uint64) (n int) { for { n++ x >>= 7 if x == 0 { break } } return n } func sozMesos(x uint64) (n int) { return sovMesos(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (this *FrameworkID) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&FrameworkID{`, `Value:` + valueToStringMesos(this.Value) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *OfferID) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&OfferID{`, `Value:` + valueToStringMesos(this.Value) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *SlaveID) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&SlaveID{`, `Value:` + valueToStringMesos(this.Value) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *TaskID) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&TaskID{`, `Value:` + valueToStringMesos(this.Value) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ExecutorID) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ExecutorID{`, `Value:` + valueToStringMesos(this.Value) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ContainerID) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ContainerID{`, `Value:` + valueToStringMesos(this.Value) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *FrameworkInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&FrameworkInfo{`, `User:` + valueToStringMesos(this.User) + `,`, `Name:` + valueToStringMesos(this.Name) + `,`, `Id:` + strings.Replace(fmt.Sprintf("%v", this.Id), "FrameworkID", "FrameworkID", 1) + `,`, `FailoverTimeout:` + valueToStringMesos(this.FailoverTimeout) + `,`, `Checkpoint:` + valueToStringMesos(this.Checkpoint) + `,`, `Role:` + valueToStringMesos(this.Role) + `,`, `Hostname:` + valueToStringMesos(this.Hostname) + `,`, `Principal:` + valueToStringMesos(this.Principal) + `,`, `WebuiUrl:` + valueToStringMesos(this.WebuiUrl) + `,`, `Capabilities:` + strings.Replace(fmt.Sprintf("%v", this.Capabilities), "FrameworkInfo_Capability", "FrameworkInfo_Capability", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *FrameworkInfo_Capability) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&FrameworkInfo_Capability{`, `Type:` + valueToStringMesos(this.Type) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *HealthCheck) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&HealthCheck{`, `Http:` + strings.Replace(fmt.Sprintf("%v", this.Http), "HealthCheck_HTTP", "HealthCheck_HTTP", 1) + `,`, `DelaySeconds:` + valueToStringMesos(this.DelaySeconds) + `,`, `IntervalSeconds:` + valueToStringMesos(this.IntervalSeconds) + `,`, `TimeoutSeconds:` + valueToStringMesos(this.TimeoutSeconds) + `,`, `ConsecutiveFailures:` + valueToStringMesos(this.ConsecutiveFailures) + `,`, `GracePeriodSeconds:` + valueToStringMesos(this.GracePeriodSeconds) + `,`, `Command:` + strings.Replace(fmt.Sprintf("%v", this.Command), "CommandInfo", "CommandInfo", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *HealthCheck_HTTP) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&HealthCheck_HTTP{`, `Port:` + valueToStringMesos(this.Port) + `,`, `Path:` + valueToStringMesos(this.Path) + `,`, `Statuses:` + fmt.Sprintf("%v", this.Statuses) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *CommandInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&CommandInfo{`, `Uris:` + strings.Replace(fmt.Sprintf("%v", this.Uris), "CommandInfo_URI", "CommandInfo_URI", 1) + `,`, `Environment:` + strings.Replace(fmt.Sprintf("%v", this.Environment), "Environment", "Environment", 1) + `,`, `Value:` + valueToStringMesos(this.Value) + `,`, `Container:` + strings.Replace(fmt.Sprintf("%v", this.Container), "CommandInfo_ContainerInfo", "CommandInfo_ContainerInfo", 1) + `,`, `User:` + valueToStringMesos(this.User) + `,`, `Shell:` + valueToStringMesos(this.Shell) + `,`, `Arguments:` + fmt.Sprintf("%v", this.Arguments) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *CommandInfo_URI) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&CommandInfo_URI{`, `Value:` + valueToStringMesos(this.Value) + `,`, `Executable:` + valueToStringMesos(this.Executable) + `,`, `Extract:` + valueToStringMesos(this.Extract) + `,`, `Cache:` + valueToStringMesos(this.Cache) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *CommandInfo_ContainerInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&CommandInfo_ContainerInfo{`, `Image:` + valueToStringMesos(this.Image) + `,`, `Options:` + fmt.Sprintf("%v", this.Options) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ExecutorInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ExecutorInfo{`, `ExecutorId:` + strings.Replace(fmt.Sprintf("%v", this.ExecutorId), "ExecutorID", "ExecutorID", 1) + `,`, `Data:` + valueToStringMesos(this.Data) + `,`, `Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Resource", "Resource", 1) + `,`, `Command:` + strings.Replace(fmt.Sprintf("%v", this.Command), "CommandInfo", "CommandInfo", 1) + `,`, `FrameworkId:` + strings.Replace(fmt.Sprintf("%v", this.FrameworkId), "FrameworkID", "FrameworkID", 1) + `,`, `Name:` + valueToStringMesos(this.Name) + `,`, `Source:` + valueToStringMesos(this.Source) + `,`, `Container:` + strings.Replace(fmt.Sprintf("%v", this.Container), "ContainerInfo", "ContainerInfo", 1) + `,`, `Discovery:` + strings.Replace(fmt.Sprintf("%v", this.Discovery), "DiscoveryInfo", "DiscoveryInfo", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *MasterInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&MasterInfo{`, `Id:` + valueToStringMesos(this.Id) + `,`, `Ip:` + valueToStringMesos(this.Ip) + `,`, `Port:` + valueToStringMesos(this.Port) + `,`, `Pid:` + valueToStringMesos(this.Pid) + `,`, `Hostname:` + valueToStringMesos(this.Hostname) + `,`, `Version:` + valueToStringMesos(this.Version) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *SlaveInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&SlaveInfo{`, `Hostname:` + valueToStringMesos(this.Hostname) + `,`, `Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Resource", "Resource", 1) + `,`, `Attributes:` + strings.Replace(fmt.Sprintf("%v", this.Attributes), "Attribute", "Attribute", 1) + `,`, `Id:` + strings.Replace(fmt.Sprintf("%v", this.Id), "SlaveID", "SlaveID", 1) + `,`, `Checkpoint:` + valueToStringMesos(this.Checkpoint) + `,`, `Port:` + valueToStringMesos(this.Port) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Value) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Value{`, `Type:` + valueToStringMesos(this.Type) + `,`, `Scalar:` + strings.Replace(fmt.Sprintf("%v", this.Scalar), "Value_Scalar", "Value_Scalar", 1) + `,`, `Ranges:` + strings.Replace(fmt.Sprintf("%v", this.Ranges), "Value_Ranges", "Value_Ranges", 1) + `,`, `Set:` + strings.Replace(fmt.Sprintf("%v", this.Set), "Value_Set", "Value_Set", 1) + `,`, `Text:` + strings.Replace(fmt.Sprintf("%v", this.Text), "Value_Text", "Value_Text", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Value_Scalar) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Value_Scalar{`, `Value:` + valueToStringMesos(this.Value) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Value_Range) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Value_Range{`, `Begin:` + valueToStringMesos(this.Begin) + `,`, `End:` + valueToStringMesos(this.End) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Value_Ranges) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Value_Ranges{`, `Range:` + strings.Replace(fmt.Sprintf("%v", this.Range), "Value_Range", "Value_Range", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Value_Set) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Value_Set{`, `Item:` + fmt.Sprintf("%v", this.Item) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Value_Text) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Value_Text{`, `Value:` + valueToStringMesos(this.Value) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Attribute) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Attribute{`, `Name:` + valueToStringMesos(this.Name) + `,`, `Type:` + valueToStringMesos(this.Type) + `,`, `Scalar:` + strings.Replace(fmt.Sprintf("%v", this.Scalar), "Value_Scalar", "Value_Scalar", 1) + `,`, `Ranges:` + strings.Replace(fmt.Sprintf("%v", this.Ranges), "Value_Ranges", "Value_Ranges", 1) + `,`, `Text:` + strings.Replace(fmt.Sprintf("%v", this.Text), "Value_Text", "Value_Text", 1) + `,`, `Set:` + strings.Replace(fmt.Sprintf("%v", this.Set), "Value_Set", "Value_Set", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Resource) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Resource{`, `Name:` + valueToStringMesos(this.Name) + `,`, `Type:` + valueToStringMesos(this.Type) + `,`, `Scalar:` + strings.Replace(fmt.Sprintf("%v", this.Scalar), "Value_Scalar", "Value_Scalar", 1) + `,`, `Ranges:` + strings.Replace(fmt.Sprintf("%v", this.Ranges), "Value_Ranges", "Value_Ranges", 1) + `,`, `Set:` + strings.Replace(fmt.Sprintf("%v", this.Set), "Value_Set", "Value_Set", 1) + `,`, `Role:` + valueToStringMesos(this.Role) + `,`, `Disk:` + strings.Replace(fmt.Sprintf("%v", this.Disk), "Resource_DiskInfo", "Resource_DiskInfo", 1) + `,`, `Reservation:` + strings.Replace(fmt.Sprintf("%v", this.Reservation), "Resource_ReservationInfo", "Resource_ReservationInfo", 1) + `,`, `Revocable:` + strings.Replace(fmt.Sprintf("%v", this.Revocable), "Resource_RevocableInfo", "Resource_RevocableInfo", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Resource_ReservationInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Resource_ReservationInfo{`, `Principal:` + valueToStringMesos(this.Principal) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Resource_DiskInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Resource_DiskInfo{`, `Persistence:` + strings.Replace(fmt.Sprintf("%v", this.Persistence), "Resource_DiskInfo_Persistence", "Resource_DiskInfo_Persistence", 1) + `,`, `Volume:` + strings.Replace(fmt.Sprintf("%v", this.Volume), "Volume", "Volume", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Resource_DiskInfo_Persistence) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Resource_DiskInfo_Persistence{`, `Id:` + valueToStringMesos(this.Id) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Resource_RevocableInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Resource_RevocableInfo{`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *TrafficControlStatistics) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&TrafficControlStatistics{`, `Id:` + valueToStringMesos(this.Id) + `,`, `Backlog:` + valueToStringMesos(this.Backlog) + `,`, `Bytes:` + valueToStringMesos(this.Bytes) + `,`, `Drops:` + valueToStringMesos(this.Drops) + `,`, `Overlimits:` + valueToStringMesos(this.Overlimits) + `,`, `Packets:` + valueToStringMesos(this.Packets) + `,`, `Qlen:` + valueToStringMesos(this.Qlen) + `,`, `Ratebps:` + valueToStringMesos(this.Ratebps) + `,`, `Ratepps:` + valueToStringMesos(this.Ratepps) + `,`, `Requeues:` + valueToStringMesos(this.Requeues) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ResourceStatistics) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ResourceStatistics{`, `Timestamp:` + valueToStringMesos(this.Timestamp) + `,`, `CpusUserTimeSecs:` + valueToStringMesos(this.CpusUserTimeSecs) + `,`, `CpusSystemTimeSecs:` + valueToStringMesos(this.CpusSystemTimeSecs) + `,`, `CpusLimit:` + valueToStringMesos(this.CpusLimit) + `,`, `MemRssBytes:` + valueToStringMesos(this.MemRssBytes) + `,`, `MemLimitBytes:` + valueToStringMesos(this.MemLimitBytes) + `,`, `CpusNrPeriods:` + valueToStringMesos(this.CpusNrPeriods) + `,`, `CpusNrThrottled:` + valueToStringMesos(this.CpusNrThrottled) + `,`, `CpusThrottledTimeSecs:` + valueToStringMesos(this.CpusThrottledTimeSecs) + `,`, `MemFileBytes:` + valueToStringMesos(this.MemFileBytes) + `,`, `MemAnonBytes:` + valueToStringMesos(this.MemAnonBytes) + `,`, `MemMappedFileBytes:` + valueToStringMesos(this.MemMappedFileBytes) + `,`, `Perf:` + strings.Replace(fmt.Sprintf("%v", this.Perf), "PerfStatistics", "PerfStatistics", 1) + `,`, `NetRxPackets:` + valueToStringMesos(this.NetRxPackets) + `,`, `NetRxBytes:` + valueToStringMesos(this.NetRxBytes) + `,`, `NetRxErrors:` + valueToStringMesos(this.NetRxErrors) + `,`, `NetRxDropped:` + valueToStringMesos(this.NetRxDropped) + `,`, `NetTxPackets:` + valueToStringMesos(this.NetTxPackets) + `,`, `NetTxBytes:` + valueToStringMesos(this.NetTxBytes) + `,`, `NetTxErrors:` + valueToStringMesos(this.NetTxErrors) + `,`, `NetTxDropped:` + valueToStringMesos(this.NetTxDropped) + `,`, `NetTcpRttMicrosecsP50:` + valueToStringMesos(this.NetTcpRttMicrosecsP50) + `,`, `NetTcpRttMicrosecsP90:` + valueToStringMesos(this.NetTcpRttMicrosecsP90) + `,`, `NetTcpRttMicrosecsP95:` + valueToStringMesos(this.NetTcpRttMicrosecsP95) + `,`, `NetTcpRttMicrosecsP99:` + valueToStringMesos(this.NetTcpRttMicrosecsP99) + `,`, `DiskLimitBytes:` + valueToStringMesos(this.DiskLimitBytes) + `,`, `DiskUsedBytes:` + valueToStringMesos(this.DiskUsedBytes) + `,`, `NetTcpActiveConnections:` + valueToStringMesos(this.NetTcpActiveConnections) + `,`, `NetTcpTimeWaitConnections:` + valueToStringMesos(this.NetTcpTimeWaitConnections) + `,`, `Processes:` + valueToStringMesos(this.Processes) + `,`, `Threads:` + valueToStringMesos(this.Threads) + `,`, `MemLowPressureCounter:` + valueToStringMesos(this.MemLowPressureCounter) + `,`, `MemMediumPressureCounter:` + valueToStringMesos(this.MemMediumPressureCounter) + `,`, `MemCriticalPressureCounter:` + valueToStringMesos(this.MemCriticalPressureCounter) + `,`, `NetTrafficControlStatistics:` + strings.Replace(fmt.Sprintf("%v", this.NetTrafficControlStatistics), "TrafficControlStatistics", "TrafficControlStatistics", 1) + `,`, `MemTotalBytes:` + valueToStringMesos(this.MemTotalBytes) + `,`, `MemTotalMemswBytes:` + valueToStringMesos(this.MemTotalMemswBytes) + `,`, `MemSoftLimitBytes:` + valueToStringMesos(this.MemSoftLimitBytes) + `,`, `MemCacheBytes:` + valueToStringMesos(this.MemCacheBytes) + `,`, `MemSwapBytes:` + valueToStringMesos(this.MemSwapBytes) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ResourceUsage) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ResourceUsage{`, `Executors:` + strings.Replace(fmt.Sprintf("%v", this.Executors), "ResourceUsage_Executor", "ResourceUsage_Executor", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ResourceUsage_Executor) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ResourceUsage_Executor{`, `ExecutorInfo:` + strings.Replace(fmt.Sprintf("%v", this.ExecutorInfo), "ExecutorInfo", "ExecutorInfo", 1) + `,`, `Allocated:` + strings.Replace(fmt.Sprintf("%v", this.Allocated), "Resource", "Resource", 1) + `,`, `Statistics:` + strings.Replace(fmt.Sprintf("%v", this.Statistics), "ResourceStatistics", "ResourceStatistics", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *PerfStatistics) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&PerfStatistics{`, `Timestamp:` + valueToStringMesos(this.Timestamp) + `,`, `Duration:` + valueToStringMesos(this.Duration) + `,`, `Cycles:` + valueToStringMesos(this.Cycles) + `,`, `StalledCyclesFrontend:` + valueToStringMesos(this.StalledCyclesFrontend) + `,`, `StalledCyclesBackend:` + valueToStringMesos(this.StalledCyclesBackend) + `,`, `Instructions:` + valueToStringMesos(this.Instructions) + `,`, `CacheReferences:` + valueToStringMesos(this.CacheReferences) + `,`, `CacheMisses:` + valueToStringMesos(this.CacheMisses) + `,`, `Branches:` + valueToStringMesos(this.Branches) + `,`, `BranchMisses:` + valueToStringMesos(this.BranchMisses) + `,`, `BusCycles:` + valueToStringMesos(this.BusCycles) + `,`, `RefCycles:` + valueToStringMesos(this.RefCycles) + `,`, `CpuClock:` + valueToStringMesos(this.CpuClock) + `,`, `TaskClock:` + valueToStringMesos(this.TaskClock) + `,`, `PageFaults:` + valueToStringMesos(this.PageFaults) + `,`, `MinorFaults:` + valueToStringMesos(this.MinorFaults) + `,`, `MajorFaults:` + valueToStringMesos(this.MajorFaults) + `,`, `ContextSwitches:` + valueToStringMesos(this.ContextSwitches) + `,`, `CpuMigrations:` + valueToStringMesos(this.CpuMigrations) + `,`, `AlignmentFaults:` + valueToStringMesos(this.AlignmentFaults) + `,`, `EmulationFaults:` + valueToStringMesos(this.EmulationFaults) + `,`, `L1DcacheLoads:` + valueToStringMesos(this.L1DcacheLoads) + `,`, `L1DcacheLoadMisses:` + valueToStringMesos(this.L1DcacheLoadMisses) + `,`, `L1DcacheStores:` + valueToStringMesos(this.L1DcacheStores) + `,`, `L1DcacheStoreMisses:` + valueToStringMesos(this.L1DcacheStoreMisses) + `,`, `L1DcachePrefetches:` + valueToStringMesos(this.L1DcachePrefetches) + `,`, `L1DcachePrefetchMisses:` + valueToStringMesos(this.L1DcachePrefetchMisses) + `,`, `L1IcacheLoads:` + valueToStringMesos(this.L1IcacheLoads) + `,`, `L1IcacheLoadMisses:` + valueToStringMesos(this.L1IcacheLoadMisses) + `,`, `L1IcachePrefetches:` + valueToStringMesos(this.L1IcachePrefetches) + `,`, `L1IcachePrefetchMisses:` + valueToStringMesos(this.L1IcachePrefetchMisses) + `,`, `LlcLoads:` + valueToStringMesos(this.LlcLoads) + `,`, `LlcLoadMisses:` + valueToStringMesos(this.LlcLoadMisses) + `,`, `LlcStores:` + valueToStringMesos(this.LlcStores) + `,`, `LlcStoreMisses:` + valueToStringMesos(this.LlcStoreMisses) + `,`, `LlcPrefetches:` + valueToStringMesos(this.LlcPrefetches) + `,`, `LlcPrefetchMisses:` + valueToStringMesos(this.LlcPrefetchMisses) + `,`, `DtlbLoads:` + valueToStringMesos(this.DtlbLoads) + `,`, `DtlbLoadMisses:` + valueToStringMesos(this.DtlbLoadMisses) + `,`, `DtlbStores:` + valueToStringMesos(this.DtlbStores) + `,`, `DtlbStoreMisses:` + valueToStringMesos(this.DtlbStoreMisses) + `,`, `DtlbPrefetches:` + valueToStringMesos(this.DtlbPrefetches) + `,`, `DtlbPrefetchMisses:` + valueToStringMesos(this.DtlbPrefetchMisses) + `,`, `ItlbLoads:` + valueToStringMesos(this.ItlbLoads) + `,`, `ItlbLoadMisses:` + valueToStringMesos(this.ItlbLoadMisses) + `,`, `BranchLoads:` + valueToStringMesos(this.BranchLoads) + `,`, `BranchLoadMisses:` + valueToStringMesos(this.BranchLoadMisses) + `,`, `NodeLoads:` + valueToStringMesos(this.NodeLoads) + `,`, `NodeLoadMisses:` + valueToStringMesos(this.NodeLoadMisses) + `,`, `NodeStores:` + valueToStringMesos(this.NodeStores) + `,`, `NodeStoreMisses:` + valueToStringMesos(this.NodeStoreMisses) + `,`, `NodePrefetches:` + valueToStringMesos(this.NodePrefetches) + `,`, `NodePrefetchMisses:` + valueToStringMesos(this.NodePrefetchMisses) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Request) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Request{`, `SlaveId:` + strings.Replace(fmt.Sprintf("%v", this.SlaveId), "SlaveID", "SlaveID", 1) + `,`, `Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Resource", "Resource", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Offer) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Offer{`, `Id:` + strings.Replace(fmt.Sprintf("%v", this.Id), "OfferID", "OfferID", 1) + `,`, `FrameworkId:` + strings.Replace(fmt.Sprintf("%v", this.FrameworkId), "FrameworkID", "FrameworkID", 1) + `,`, `SlaveId:` + strings.Replace(fmt.Sprintf("%v", this.SlaveId), "SlaveID", "SlaveID", 1) + `,`, `Hostname:` + valueToStringMesos(this.Hostname) + `,`, `Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Resource", "Resource", 1) + `,`, `ExecutorIds:` + strings.Replace(fmt.Sprintf("%v", this.ExecutorIds), "ExecutorID", "ExecutorID", 1) + `,`, `Attributes:` + strings.Replace(fmt.Sprintf("%v", this.Attributes), "Attribute", "Attribute", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Offer_Operation) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Offer_Operation{`, `Type:` + valueToStringMesos(this.Type) + `,`, `Launch:` + strings.Replace(fmt.Sprintf("%v", this.Launch), "Offer_Operation_Launch", "Offer_Operation_Launch", 1) + `,`, `Reserve:` + strings.Replace(fmt.Sprintf("%v", this.Reserve), "Offer_Operation_Reserve", "Offer_Operation_Reserve", 1) + `,`, `Unreserve:` + strings.Replace(fmt.Sprintf("%v", this.Unreserve), "Offer_Operation_Unreserve", "Offer_Operation_Unreserve", 1) + `,`, `Create:` + strings.Replace(fmt.Sprintf("%v", this.Create), "Offer_Operation_Create", "Offer_Operation_Create", 1) + `,`, `Destroy:` + strings.Replace(fmt.Sprintf("%v", this.Destroy), "Offer_Operation_Destroy", "Offer_Operation_Destroy", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Offer_Operation_Launch) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Offer_Operation_Launch{`, `TaskInfos:` + strings.Replace(fmt.Sprintf("%v", this.TaskInfos), "TaskInfo", "TaskInfo", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Offer_Operation_Reserve) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Offer_Operation_Reserve{`, `Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Resource", "Resource", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Offer_Operation_Unreserve) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Offer_Operation_Unreserve{`, `Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Resource", "Resource", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Offer_Operation_Create) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Offer_Operation_Create{`, `Volumes:` + strings.Replace(fmt.Sprintf("%v", this.Volumes), "Resource", "Resource", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Offer_Operation_Destroy) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Offer_Operation_Destroy{`, `Volumes:` + strings.Replace(fmt.Sprintf("%v", this.Volumes), "Resource", "Resource", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *TaskInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&TaskInfo{`, `Name:` + valueToStringMesos(this.Name) + `,`, `TaskId:` + strings.Replace(fmt.Sprintf("%v", this.TaskId), "TaskID", "TaskID", 1) + `,`, `SlaveId:` + strings.Replace(fmt.Sprintf("%v", this.SlaveId), "SlaveID", "SlaveID", 1) + `,`, `Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Resource", "Resource", 1) + `,`, `Executor:` + strings.Replace(fmt.Sprintf("%v", this.Executor), "ExecutorInfo", "ExecutorInfo", 1) + `,`, `Data:` + valueToStringMesos(this.Data) + `,`, `Command:` + strings.Replace(fmt.Sprintf("%v", this.Command), "CommandInfo", "CommandInfo", 1) + `,`, `HealthCheck:` + strings.Replace(fmt.Sprintf("%v", this.HealthCheck), "HealthCheck", "HealthCheck", 1) + `,`, `Container:` + strings.Replace(fmt.Sprintf("%v", this.Container), "ContainerInfo", "ContainerInfo", 1) + `,`, `Labels:` + strings.Replace(fmt.Sprintf("%v", this.Labels), "Labels", "Labels", 1) + `,`, `Discovery:` + strings.Replace(fmt.Sprintf("%v", this.Discovery), "DiscoveryInfo", "DiscoveryInfo", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *TaskStatus) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&TaskStatus{`, `TaskId:` + strings.Replace(fmt.Sprintf("%v", this.TaskId), "TaskID", "TaskID", 1) + `,`, `State:` + valueToStringMesos(this.State) + `,`, `Data:` + valueToStringMesos(this.Data) + `,`, `Message:` + valueToStringMesos(this.Message) + `,`, `SlaveId:` + strings.Replace(fmt.Sprintf("%v", this.SlaveId), "SlaveID", "SlaveID", 1) + `,`, `Timestamp:` + valueToStringMesos(this.Timestamp) + `,`, `ExecutorId:` + strings.Replace(fmt.Sprintf("%v", this.ExecutorId), "ExecutorID", "ExecutorID", 1) + `,`, `Healthy:` + valueToStringMesos(this.Healthy) + `,`, `Source:` + valueToStringMesos(this.Source) + `,`, `Reason:` + valueToStringMesos(this.Reason) + `,`, `Uuid:` + valueToStringMesos(this.Uuid) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Filters) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Filters{`, `RefuseSeconds:` + valueToStringMesos(this.RefuseSeconds) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Environment) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Environment{`, `Variables:` + strings.Replace(fmt.Sprintf("%v", this.Variables), "Environment_Variable", "Environment_Variable", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Environment_Variable) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Environment_Variable{`, `Name:` + valueToStringMesos(this.Name) + `,`, `Value:` + valueToStringMesos(this.Value) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Parameter) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Parameter{`, `Key:` + valueToStringMesos(this.Key) + `,`, `Value:` + valueToStringMesos(this.Value) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Parameters) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Parameters{`, `Parameter:` + strings.Replace(fmt.Sprintf("%v", this.Parameter), "Parameter", "Parameter", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Credential) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Credential{`, `Principal:` + valueToStringMesos(this.Principal) + `,`, `Secret:` + valueToStringMesos(this.Secret) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Credentials) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Credentials{`, `Credentials:` + strings.Replace(fmt.Sprintf("%v", this.Credentials), "Credential", "Credential", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ACL) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ACL{`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ACL_Entity) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ACL_Entity{`, `Type:` + valueToStringMesos(this.Type) + `,`, `Values:` + fmt.Sprintf("%v", this.Values) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ACL_RegisterFramework) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ACL_RegisterFramework{`, `Principals:` + strings.Replace(fmt.Sprintf("%v", this.Principals), "ACL_Entity", "ACL_Entity", 1) + `,`, `Roles:` + strings.Replace(fmt.Sprintf("%v", this.Roles), "ACL_Entity", "ACL_Entity", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ACL_RunTask) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ACL_RunTask{`, `Principals:` + strings.Replace(fmt.Sprintf("%v", this.Principals), "ACL_Entity", "ACL_Entity", 1) + `,`, `Users:` + strings.Replace(fmt.Sprintf("%v", this.Users), "ACL_Entity", "ACL_Entity", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ACL_ShutdownFramework) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ACL_ShutdownFramework{`, `Principals:` + strings.Replace(fmt.Sprintf("%v", this.Principals), "ACL_Entity", "ACL_Entity", 1) + `,`, `FrameworkPrincipals:` + strings.Replace(fmt.Sprintf("%v", this.FrameworkPrincipals), "ACL_Entity", "ACL_Entity", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ACLs) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ACLs{`, `Permissive:` + valueToStringMesos(this.Permissive) + `,`, `RegisterFrameworks:` + strings.Replace(fmt.Sprintf("%v", this.RegisterFrameworks), "ACL_RegisterFramework", "ACL_RegisterFramework", 1) + `,`, `RunTasks:` + strings.Replace(fmt.Sprintf("%v", this.RunTasks), "ACL_RunTask", "ACL_RunTask", 1) + `,`, `ShutdownFrameworks:` + strings.Replace(fmt.Sprintf("%v", this.ShutdownFrameworks), "ACL_ShutdownFramework", "ACL_ShutdownFramework", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *RateLimit) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&RateLimit{`, `Qps:` + valueToStringMesos(this.Qps) + `,`, `Principal:` + valueToStringMesos(this.Principal) + `,`, `Capacity:` + valueToStringMesos(this.Capacity) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *RateLimits) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&RateLimits{`, `Limits:` + strings.Replace(fmt.Sprintf("%v", this.Limits), "RateLimit", "RateLimit", 1) + `,`, `AggregateDefaultQps:` + valueToStringMesos(this.AggregateDefaultQps) + `,`, `AggregateDefaultCapacity:` + valueToStringMesos(this.AggregateDefaultCapacity) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Volume) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Volume{`, `ContainerPath:` + valueToStringMesos(this.ContainerPath) + `,`, `HostPath:` + valueToStringMesos(this.HostPath) + `,`, `Mode:` + valueToStringMesos(this.Mode) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ContainerInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ContainerInfo{`, `Type:` + valueToStringMesos(this.Type) + `,`, `Volumes:` + strings.Replace(fmt.Sprintf("%v", this.Volumes), "Volume", "Volume", 1) + `,`, `Docker:` + strings.Replace(fmt.Sprintf("%v", this.Docker), "ContainerInfo_DockerInfo", "ContainerInfo_DockerInfo", 1) + `,`, `Hostname:` + valueToStringMesos(this.Hostname) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ContainerInfo_DockerInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ContainerInfo_DockerInfo{`, `Image:` + valueToStringMesos(this.Image) + `,`, `Network:` + valueToStringMesos(this.Network) + `,`, `PortMappings:` + strings.Replace(fmt.Sprintf("%v", this.PortMappings), "ContainerInfo_DockerInfo_PortMapping", "ContainerInfo_DockerInfo_PortMapping", 1) + `,`, `Privileged:` + valueToStringMesos(this.Privileged) + `,`, `Parameters:` + strings.Replace(fmt.Sprintf("%v", this.Parameters), "Parameter", "Parameter", 1) + `,`, `ForcePullImage:` + valueToStringMesos(this.ForcePullImage) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ContainerInfo_DockerInfo_PortMapping) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ContainerInfo_DockerInfo_PortMapping{`, `HostPort:` + valueToStringMesos(this.HostPort) + `,`, `ContainerPort:` + valueToStringMesos(this.ContainerPort) + `,`, `Protocol:` + valueToStringMesos(this.Protocol) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Labels) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Labels{`, `Labels:` + strings.Replace(fmt.Sprintf("%v", this.Labels), "Label", "Label", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Label) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Label{`, `Key:` + valueToStringMesos(this.Key) + `,`, `Value:` + valueToStringMesos(this.Value) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Port) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Port{`, `Number:` + valueToStringMesos(this.Number) + `,`, `Name:` + valueToStringMesos(this.Name) + `,`, `Protocol:` + valueToStringMesos(this.Protocol) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Ports) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Ports{`, `Ports:` + strings.Replace(fmt.Sprintf("%v", this.Ports), "Port", "Port", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *DiscoveryInfo) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&DiscoveryInfo{`, `Visibility:` + valueToStringMesos(this.Visibility) + `,`, `Name:` + valueToStringMesos(this.Name) + `,`, `Environment:` + valueToStringMesos(this.Environment) + `,`, `Location:` + valueToStringMesos(this.Location) + `,`, `Version:` + valueToStringMesos(this.Version) + `,`, `Ports:` + strings.Replace(fmt.Sprintf("%v", this.Ports), "Ports", "Ports", 1) + `,`, `Labels:` + strings.Replace(fmt.Sprintf("%v", this.Labels), "Labels", "Labels", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func valueToStringMesos(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } func (m *FrameworkID) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Value = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } return nil } func (m *OfferID) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Value = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } return nil } func (m *SlaveID) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Value = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } return nil } func (m *TaskID) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Value = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } return nil } func (m *ExecutorID) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Value = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } return nil } func (m *ContainerID) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Value = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } return nil } func (m *FrameworkInfo) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.User = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Name = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000002) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Id == nil { m.Id = &FrameworkID{} } if err := m.Id.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field FailoverTimeout", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.FailoverTimeout = &v2 case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Checkpoint", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Checkpoint = &b case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Role = &s iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Hostname = &s iNdEx = postIndex case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Principal", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Principal = &s iNdEx = postIndex case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field WebuiUrl", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.WebuiUrl = &s iNdEx = postIndex case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Capabilities", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Capabilities = append(m.Capabilities, &FrameworkInfo_Capability{}) if err := m.Capabilities[len(m.Capabilities)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("user") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } return nil } func (m *FrameworkInfo_Capability) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var v FrameworkInfo_Capability_Type for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (FrameworkInfo_Capability_Type(b) & 0x7F) << shift if b < 0x80 { break } } m.Type = &v hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } return nil } func (m *HealthCheck) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Http", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Http == nil { m.Http = &HealthCheck_HTTP{} } if err := m.Http.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field DelaySeconds", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.DelaySeconds = &v2 case 3: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field IntervalSeconds", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.IntervalSeconds = &v2 case 4: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field TimeoutSeconds", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.TimeoutSeconds = &v2 case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ConsecutiveFailures", wireType) } var v uint32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } m.ConsecutiveFailures = &v case 6: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field GracePeriodSeconds", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.GracePeriodSeconds = &v2 case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Command", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Command == nil { m.Command = &CommandInfo{} } if err := m.Command.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *HealthCheck_HTTP) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) } var v uint32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } m.Port = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Path = &s iNdEx = postIndex case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Statuses", wireType) } var v uint32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } m.Statuses = append(m.Statuses, v) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("port") } return nil } func (m *CommandInfo) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Uris", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Uris = append(m.Uris, &CommandInfo_URI{}) if err := m.Uris[len(m.Uris)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Environment", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Environment == nil { m.Environment = &Environment{} } if err := m.Environment.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Value = &s iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Container == nil { m.Container = &CommandInfo_ContainerInfo{} } if err := m.Container.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.User = &s iNdEx = postIndex case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Shell", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Shell = &b case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Arguments", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } m.Arguments = append(m.Arguments, string(data[iNdEx:postIndex])) iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *CommandInfo_URI) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Value = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Executable", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Executable = &b case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Extract", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Extract = &b case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Cache", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Cache = &b default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } return nil } func (m *CommandInfo_ContainerInfo) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Image", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Image = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } m.Options = append(m.Options, string(data[iNdEx:postIndex])) iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("image") } return nil } func (m *ExecutorInfo) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExecutorId", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.ExecutorId == nil { m.ExecutorId = &ExecutorID{} } if err := m.ExecutorId.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ byteLen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + byteLen if postIndex > l { return io.ErrUnexpectedEOF } m.Data = append([]byte{}, data[iNdEx:postIndex]...) iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Resources = append(m.Resources, &Resource{}) if err := m.Resources[len(m.Resources)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Command", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Command == nil { m.Command = &CommandInfo{} } if err := m.Command.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000002) case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FrameworkId", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.FrameworkId == nil { m.FrameworkId = &FrameworkID{} } if err := m.FrameworkId.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Name = &s iNdEx = postIndex case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Source = &s iNdEx = postIndex case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Container == nil { m.Container = &ContainerInfo{} } if err := m.Container.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Discovery", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Discovery == nil { m.Discovery = &DiscoveryInfo{} } if err := m.Discovery.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("executor_id") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("command") } return nil } func (m *MasterInfo) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Id = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Ip", wireType) } var v uint32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } m.Ip = &v hasFields[0] |= uint64(0x00000002) case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) } var v uint32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } m.Port = &v hasFields[0] |= uint64(0x00000004) case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Pid = &s iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Hostname = &s iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Version = &s iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("ip") } if hasFields[0]&uint64(0x00000004) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("port") } return nil } func (m *SlaveInfo) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Hostname = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Resources = append(m.Resources, &Resource{}) if err := m.Resources[len(m.Resources)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Attributes = append(m.Attributes, &Attribute{}) if err := m.Attributes[len(m.Attributes)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Id == nil { m.Id = &SlaveID{} } if err := m.Id.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Checkpoint", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Checkpoint = &b case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) } var v int32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int32(b) & 0x7F) << shift if b < 0x80 { break } } m.Port = &v default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("hostname") } return nil } func (m *Value) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var v Value_Type for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (Value_Type(b) & 0x7F) << shift if b < 0x80 { break } } m.Type = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Scalar", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Scalar == nil { m.Scalar = &Value_Scalar{} } if err := m.Scalar.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Ranges == nil { m.Ranges = &Value_Ranges{} } if err := m.Ranges.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Set", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Set == nil { m.Set = &Value_Set{} } if err := m.Set.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Text == nil { m.Text = &Value_Text{} } if err := m.Text.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } return nil } func (m *Value_Scalar) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.Value = &v2 hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } return nil } func (m *Value_Range) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Begin", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Begin = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field End", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.End = &v hasFields[0] |= uint64(0x00000002) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("begin") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("end") } return nil } func (m *Value_Ranges) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Range = append(m.Range, &Value_Range{}) if err := m.Range[len(m.Range)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Value_Set) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Item", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } m.Item = append(m.Item, string(data[iNdEx:postIndex])) iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Value_Text) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Value = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } return nil } func (m *Attribute) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Name = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var v Value_Type for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (Value_Type(b) & 0x7F) << shift if b < 0x80 { break } } m.Type = &v hasFields[0] |= uint64(0x00000002) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Scalar", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Scalar == nil { m.Scalar = &Value_Scalar{} } if err := m.Scalar.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Ranges == nil { m.Ranges = &Value_Ranges{} } if err := m.Ranges.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Text == nil { m.Text = &Value_Text{} } if err := m.Text.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Set", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Set == nil { m.Set = &Value_Set{} } if err := m.Set.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } return nil } func (m *Resource) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Name = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var v Value_Type for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (Value_Type(b) & 0x7F) << shift if b < 0x80 { break } } m.Type = &v hasFields[0] |= uint64(0x00000002) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Scalar", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Scalar == nil { m.Scalar = &Value_Scalar{} } if err := m.Scalar.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Ranges == nil { m.Ranges = &Value_Ranges{} } if err := m.Ranges.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Set", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Set == nil { m.Set = &Value_Set{} } if err := m.Set.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Role = &s iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Disk", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Disk == nil { m.Disk = &Resource_DiskInfo{} } if err := m.Disk.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Reservation", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Reservation == nil { m.Reservation = &Resource_ReservationInfo{} } if err := m.Reservation.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Revocable", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Revocable == nil { m.Revocable = &Resource_RevocableInfo{} } if err := m.Revocable.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } return nil } func (m *Resource_ReservationInfo) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Principal", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Principal = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("principal") } return nil } func (m *Resource_DiskInfo) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Persistence", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Persistence == nil { m.Persistence = &Resource_DiskInfo_Persistence{} } if err := m.Persistence.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Volume", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Volume == nil { m.Volume = &Volume{} } if err := m.Volume.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Resource_DiskInfo_Persistence) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Id = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") } return nil } func (m *Resource_RevocableInfo) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) switch fieldNum { default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *TrafficControlStatistics) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Id = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Backlog", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Backlog = &v case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Bytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Bytes = &v case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Drops", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Drops = &v case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Overlimits", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Overlimits = &v case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Packets", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Packets = &v case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Qlen", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Qlen = &v case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Ratebps", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Ratebps = &v case 9: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Ratepps", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Ratepps = &v case 10: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Requeues", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Requeues = &v default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") } return nil } func (m *ResourceStatistics) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.Timestamp = &v2 hasFields[0] |= uint64(0x00000001) case 2: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field CpusUserTimeSecs", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.CpusUserTimeSecs = &v2 case 3: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field CpusSystemTimeSecs", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.CpusSystemTimeSecs = &v2 case 4: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field CpusLimit", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.CpusLimit = &v2 case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemRssBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemRssBytes = &v case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemLimitBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemLimitBytes = &v case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CpusNrPeriods", wireType) } var v uint32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } m.CpusNrPeriods = &v case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CpusNrThrottled", wireType) } var v uint32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } m.CpusNrThrottled = &v case 9: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field CpusThrottledTimeSecs", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.CpusThrottledTimeSecs = &v2 case 10: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemFileBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemFileBytes = &v case 11: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemAnonBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemAnonBytes = &v case 12: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemMappedFileBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemMappedFileBytes = &v case 13: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Perf", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Perf == nil { m.Perf = &PerfStatistics{} } if err := m.Perf.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 14: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NetRxPackets", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NetRxPackets = &v case 15: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NetRxBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NetRxBytes = &v case 16: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NetRxErrors", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NetRxErrors = &v case 17: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NetRxDropped", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NetRxDropped = &v case 18: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NetTxPackets", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NetTxPackets = &v case 19: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NetTxBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NetTxBytes = &v case 20: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NetTxErrors", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NetTxErrors = &v case 21: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NetTxDropped", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NetTxDropped = &v case 22: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field NetTcpRttMicrosecsP50", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.NetTcpRttMicrosecsP50 = &v2 case 23: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field NetTcpRttMicrosecsP90", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.NetTcpRttMicrosecsP90 = &v2 case 24: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field NetTcpRttMicrosecsP95", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.NetTcpRttMicrosecsP95 = &v2 case 25: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field NetTcpRttMicrosecsP99", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.NetTcpRttMicrosecsP99 = &v2 case 26: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DiskLimitBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.DiskLimitBytes = &v case 27: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DiskUsedBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.DiskUsedBytes = &v case 28: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field NetTcpActiveConnections", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.NetTcpActiveConnections = &v2 case 29: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field NetTcpTimeWaitConnections", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.NetTcpTimeWaitConnections = &v2 case 30: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Processes", wireType) } var v uint32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } m.Processes = &v case 31: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Threads", wireType) } var v uint32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } m.Threads = &v case 32: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemLowPressureCounter", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemLowPressureCounter = &v case 33: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemMediumPressureCounter", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemMediumPressureCounter = &v case 34: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemCriticalPressureCounter", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemCriticalPressureCounter = &v case 35: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NetTrafficControlStatistics", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.NetTrafficControlStatistics = append(m.NetTrafficControlStatistics, &TrafficControlStatistics{}) if err := m.NetTrafficControlStatistics[len(m.NetTrafficControlStatistics)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 36: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemTotalBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemTotalBytes = &v case 37: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemTotalMemswBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemTotalMemswBytes = &v case 38: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemSoftLimitBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemSoftLimitBytes = &v case 39: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemCacheBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemCacheBytes = &v case 40: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemSwapBytes", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MemSwapBytes = &v default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("timestamp") } return nil } func (m *ResourceUsage) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Executors", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Executors = append(m.Executors, &ResourceUsage_Executor{}) if err := m.Executors[len(m.Executors)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *ResourceUsage_Executor) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExecutorInfo", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.ExecutorInfo == nil { m.ExecutorInfo = &ExecutorInfo{} } if err := m.ExecutorInfo.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Allocated", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Allocated = append(m.Allocated, &Resource{}) if err := m.Allocated[len(m.Allocated)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Statistics", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Statistics == nil { m.Statistics = &ResourceStatistics{} } if err := m.Statistics.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("executor_info") } return nil } func (m *PerfStatistics) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.Timestamp = &v2 hasFields[0] |= uint64(0x00000001) case 2: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field Duration", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.Duration = &v2 hasFields[0] |= uint64(0x00000002) case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Cycles", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Cycles = &v case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field StalledCyclesFrontend", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.StalledCyclesFrontend = &v case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field StalledCyclesBackend", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.StalledCyclesBackend = &v case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Instructions", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Instructions = &v case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CacheReferences", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.CacheReferences = &v case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CacheMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.CacheMisses = &v case 9: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Branches", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Branches = &v case 10: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field BranchMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.BranchMisses = &v case 11: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field BusCycles", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.BusCycles = &v case 12: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RefCycles", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.RefCycles = &v case 13: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field CpuClock", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.CpuClock = &v2 case 14: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field TaskClock", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.TaskClock = &v2 case 15: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field PageFaults", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.PageFaults = &v case 16: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MinorFaults", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MinorFaults = &v case 17: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MajorFaults", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.MajorFaults = &v case 18: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ContextSwitches", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.ContextSwitches = &v case 19: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CpuMigrations", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.CpuMigrations = &v case 20: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field AlignmentFaults", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.AlignmentFaults = &v case 21: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field EmulationFaults", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.EmulationFaults = &v case 22: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field L1DcacheLoads", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.L1DcacheLoads = &v case 23: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field L1DcacheLoadMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.L1DcacheLoadMisses = &v case 24: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field L1DcacheStores", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.L1DcacheStores = &v case 25: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field L1DcacheStoreMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.L1DcacheStoreMisses = &v case 26: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field L1DcachePrefetches", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.L1DcachePrefetches = &v case 27: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field L1DcachePrefetchMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.L1DcachePrefetchMisses = &v case 28: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field L1IcacheLoads", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.L1IcacheLoads = &v case 29: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field L1IcacheLoadMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.L1IcacheLoadMisses = &v case 30: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field L1IcachePrefetches", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.L1IcachePrefetches = &v case 31: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field L1IcachePrefetchMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.L1IcachePrefetchMisses = &v case 32: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field LlcLoads", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.LlcLoads = &v case 33: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field LlcLoadMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.LlcLoadMisses = &v case 34: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field LlcStores", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.LlcStores = &v case 35: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field LlcStoreMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.LlcStoreMisses = &v case 36: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field LlcPrefetches", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.LlcPrefetches = &v case 37: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field LlcPrefetchMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.LlcPrefetchMisses = &v case 38: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DtlbLoads", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.DtlbLoads = &v case 39: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DtlbLoadMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.DtlbLoadMisses = &v case 40: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DtlbStores", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.DtlbStores = &v case 41: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DtlbStoreMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.DtlbStoreMisses = &v case 42: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DtlbPrefetches", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.DtlbPrefetches = &v case 43: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DtlbPrefetchMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.DtlbPrefetchMisses = &v case 44: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ItlbLoads", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.ItlbLoads = &v case 45: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ItlbLoadMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.ItlbLoadMisses = &v case 46: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field BranchLoads", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.BranchLoads = &v case 47: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field BranchLoadMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.BranchLoadMisses = &v case 48: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NodeLoads", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NodeLoads = &v case 49: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NodeLoadMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NodeLoadMisses = &v case 50: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NodeStores", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NodeStores = &v case 51: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NodeStoreMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NodeStoreMisses = &v case 52: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NodePrefetches", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NodePrefetches = &v case 53: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NodePrefetchMisses", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.NodePrefetchMisses = &v default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("timestamp") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("duration") } return nil } func (m *Request) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SlaveId", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.SlaveId == nil { m.SlaveId = &SlaveID{} } if err := m.SlaveId.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Resources = append(m.Resources, &Resource{}) if err := m.Resources[len(m.Resources)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Offer) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Id == nil { m.Id = &OfferID{} } if err := m.Id.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FrameworkId", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.FrameworkId == nil { m.FrameworkId = &FrameworkID{} } if err := m.FrameworkId.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000002) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SlaveId", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.SlaveId == nil { m.SlaveId = &SlaveID{} } if err := m.SlaveId.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000004) case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Hostname = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000008) case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Resources = append(m.Resources, &Resource{}) if err := m.Resources[len(m.Resources)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExecutorIds", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.ExecutorIds = append(m.ExecutorIds, &ExecutorID{}) if err := m.ExecutorIds[len(m.ExecutorIds)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Attributes = append(m.Attributes, &Attribute{}) if err := m.Attributes[len(m.Attributes)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("framework_id") } if hasFields[0]&uint64(0x00000004) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("slave_id") } if hasFields[0]&uint64(0x00000008) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("hostname") } return nil } func (m *Offer_Operation) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var v Offer_Operation_Type for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (Offer_Operation_Type(b) & 0x7F) << shift if b < 0x80 { break } } m.Type = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Launch", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Launch == nil { m.Launch = &Offer_Operation_Launch{} } if err := m.Launch.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Reserve", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Reserve == nil { m.Reserve = &Offer_Operation_Reserve{} } if err := m.Reserve.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Unreserve", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Unreserve == nil { m.Unreserve = &Offer_Operation_Unreserve{} } if err := m.Unreserve.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Create", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Create == nil { m.Create = &Offer_Operation_Create{} } if err := m.Create.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Destroy", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Destroy == nil { m.Destroy = &Offer_Operation_Destroy{} } if err := m.Destroy.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } return nil } func (m *Offer_Operation_Launch) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TaskInfos", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.TaskInfos = append(m.TaskInfos, &TaskInfo{}) if err := m.TaskInfos[len(m.TaskInfos)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Offer_Operation_Reserve) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Resources = append(m.Resources, &Resource{}) if err := m.Resources[len(m.Resources)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Offer_Operation_Unreserve) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Resources = append(m.Resources, &Resource{}) if err := m.Resources[len(m.Resources)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Offer_Operation_Create) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Volumes", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Volumes = append(m.Volumes, &Resource{}) if err := m.Volumes[len(m.Volumes)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Offer_Operation_Destroy) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Volumes", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Volumes = append(m.Volumes, &Resource{}) if err := m.Volumes[len(m.Volumes)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *TaskInfo) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Name = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TaskId", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.TaskId == nil { m.TaskId = &TaskID{} } if err := m.TaskId.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000002) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SlaveId", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.SlaveId == nil { m.SlaveId = &SlaveID{} } if err := m.SlaveId.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000004) case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Resources = append(m.Resources, &Resource{}) if err := m.Resources[len(m.Resources)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Executor", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Executor == nil { m.Executor = &ExecutorInfo{} } if err := m.Executor.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ byteLen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + byteLen if postIndex > l { return io.ErrUnexpectedEOF } m.Data = append([]byte{}, data[iNdEx:postIndex]...) iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Command", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Command == nil { m.Command = &CommandInfo{} } if err := m.Command.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field HealthCheck", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.HealthCheck == nil { m.HealthCheck = &HealthCheck{} } if err := m.HealthCheck.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Container == nil { m.Container = &ContainerInfo{} } if err := m.Container.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Labels == nil { m.Labels = &Labels{} } if err := m.Labels.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Discovery", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Discovery == nil { m.Discovery = &DiscoveryInfo{} } if err := m.Discovery.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("task_id") } if hasFields[0]&uint64(0x00000004) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("slave_id") } return nil } func (m *TaskStatus) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TaskId", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.TaskId == nil { m.TaskId = &TaskID{} } if err := m.TaskId.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) } var v TaskState for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (TaskState(b) & 0x7F) << shift if b < 0x80 { break } } m.State = &v hasFields[0] |= uint64(0x00000002) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ byteLen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + byteLen if postIndex > l { return io.ErrUnexpectedEOF } m.Data = append([]byte{}, data[iNdEx:postIndex]...) iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Message = &s iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SlaveId", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.SlaveId == nil { m.SlaveId = &SlaveID{} } if err := m.SlaveId.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 6: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.Timestamp = &v2 case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExecutorId", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.ExecutorId == nil { m.ExecutorId = &ExecutorID{} } if err := m.ExecutorId.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Healthy", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Healthy = &b case 9: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) } var v TaskStatus_Source for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (TaskStatus_Source(b) & 0x7F) << shift if b < 0x80 { break } } m.Source = &v case 10: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) } var v TaskStatus_Reason for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (TaskStatus_Reason(b) & 0x7F) << shift if b < 0x80 { break } } m.Reason = &v case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Uuid", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ byteLen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + byteLen if postIndex > l { return io.ErrUnexpectedEOF } m.Uuid = append([]byte{}, data[iNdEx:postIndex]...) iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("task_id") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("state") } return nil } func (m *Filters) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field RefuseSeconds", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.RefuseSeconds = &v2 default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Environment) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Variables", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Variables = append(m.Variables, &Environment_Variable{}) if err := m.Variables[len(m.Variables)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Environment_Variable) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Name = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Value = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000002) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } return nil } func (m *Parameter) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Key = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Value = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000002) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("key") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } return nil } func (m *Parameters) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Parameter", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Parameter = append(m.Parameter, &Parameter{}) if err := m.Parameter[len(m.Parameter)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Credential) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Principal", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Principal = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Secret", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ byteLen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + byteLen if postIndex > l { return io.ErrUnexpectedEOF } m.Secret = append([]byte{}, data[iNdEx:postIndex]...) iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("principal") } return nil } func (m *Credentials) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Credentials", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Credentials = append(m.Credentials, &Credential{}) if err := m.Credentials[len(m.Credentials)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *ACL) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) switch fieldNum { default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *ACL_Entity) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var v ACL_Entity_Type for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (ACL_Entity_Type(b) & 0x7F) << shift if b < 0x80 { break } } m.Type = &v case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } m.Values = append(m.Values, string(data[iNdEx:postIndex])) iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *ACL_RegisterFramework) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Principals", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Principals == nil { m.Principals = &ACL_Entity{} } if err := m.Principals.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Roles", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Roles == nil { m.Roles = &ACL_Entity{} } if err := m.Roles.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000002) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("principals") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("roles") } return nil } func (m *ACL_RunTask) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Principals", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Principals == nil { m.Principals = &ACL_Entity{} } if err := m.Principals.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Users", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Users == nil { m.Users = &ACL_Entity{} } if err := m.Users.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000002) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("principals") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("users") } return nil } func (m *ACL_ShutdownFramework) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Principals", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Principals == nil { m.Principals = &ACL_Entity{} } if err := m.Principals.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FrameworkPrincipals", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.FrameworkPrincipals == nil { m.FrameworkPrincipals = &ACL_Entity{} } if err := m.FrameworkPrincipals.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000002) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("principals") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("framework_principals") } return nil } func (m *ACLs) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Permissive", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Permissive = &b case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RegisterFrameworks", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.RegisterFrameworks = append(m.RegisterFrameworks, &ACL_RegisterFramework{}) if err := m.RegisterFrameworks[len(m.RegisterFrameworks)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RunTasks", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.RunTasks = append(m.RunTasks, &ACL_RunTask{}) if err := m.RunTasks[len(m.RunTasks)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ShutdownFrameworks", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.ShutdownFrameworks = append(m.ShutdownFrameworks, &ACL_ShutdownFramework{}) if err := m.ShutdownFrameworks[len(m.ShutdownFrameworks)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *RateLimit) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field Qps", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.Qps = &v2 case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Principal", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Principal = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Capacity = &v default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("principal") } return nil } func (m *RateLimits) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Limits", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Limits = append(m.Limits, &RateLimit{}) if err := m.Limits[len(m.Limits)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field AggregateDefaultQps", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 v = uint64(data[iNdEx-8]) v |= uint64(data[iNdEx-7]) << 8 v |= uint64(data[iNdEx-6]) << 16 v |= uint64(data[iNdEx-5]) << 24 v |= uint64(data[iNdEx-4]) << 32 v |= uint64(data[iNdEx-3]) << 40 v |= uint64(data[iNdEx-2]) << 48 v |= uint64(data[iNdEx-1]) << 56 v2 := float64(math.Float64frombits(v)) m.AggregateDefaultQps = &v2 case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field AggregateDefaultCapacity", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.AggregateDefaultCapacity = &v default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Volume) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ContainerPath", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.ContainerPath = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field HostPath", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.HostPath = &s iNdEx = postIndex case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) } var v Volume_Mode for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (Volume_Mode(b) & 0x7F) << shift if b < 0x80 { break } } m.Mode = &v hasFields[0] |= uint64(0x00000002) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("container_path") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("mode") } return nil } func (m *ContainerInfo) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var v ContainerInfo_Type for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (ContainerInfo_Type(b) & 0x7F) << shift if b < 0x80 { break } } m.Type = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Volumes", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Volumes = append(m.Volumes, &Volume{}) if err := m.Volumes[len(m.Volumes)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Docker", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Docker == nil { m.Docker = &ContainerInfo_DockerInfo{} } if err := m.Docker.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Hostname = &s iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } return nil } func (m *ContainerInfo_DockerInfo) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Image", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Image = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Network", wireType) } var v ContainerInfo_DockerInfo_Network for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (ContainerInfo_DockerInfo_Network(b) & 0x7F) << shift if b < 0x80 { break } } m.Network = &v case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PortMappings", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.PortMappings = append(m.PortMappings, &ContainerInfo_DockerInfo_PortMapping{}) if err := m.PortMappings[len(m.PortMappings)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Privileged", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Privileged = &b case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Parameters", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Parameters = append(m.Parameters, &Parameter{}) if err := m.Parameters[len(m.Parameters)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ForcePullImage", wireType) } var v int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.ForcePullImage = &b default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("image") } return nil } func (m *ContainerInfo_DockerInfo_PortMapping) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field HostPort", wireType) } var v uint32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } m.HostPort = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ContainerPort", wireType) } var v uint32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } m.ContainerPort = &v hasFields[0] |= uint64(0x00000002) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Protocol = &s iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("host_port") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("container_port") } return nil } func (m *Labels) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Labels = append(m.Labels, &Label{}) if err := m.Labels[len(m.Labels)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *Label) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Key = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Value = &s iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("key") } return nil } func (m *Port) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) } var v uint32 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } m.Number = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Name = &s iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Protocol = &s iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("number") } return nil } func (m *Ports) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Ports = append(m.Ports, &Port{}) if err := m.Ports[len(m.Ports)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } return nil } func (m *DiscoveryInfo) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Visibility", wireType) } var v DiscoveryInfo_Visibility for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (DiscoveryInfo_Visibility(b) & 0x7F) << shift if b < 0x80 { break } } m.Visibility = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Name = &s iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Environment", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Environment = &s iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Location", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Location = &s iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Version = &s iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Ports == nil { m.Ports = &Ports{} } if err := m.Ports.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthMesos } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Labels == nil { m.Labels = &Labels{} } if err := m.Labels.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipMesos(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthMesos } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("visibility") } return nil } func skipMesos(data []byte) (n int, err error) { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if data[iNdEx-1] < 0x80 { break } } return iNdEx, nil case 1: iNdEx += 8 return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } iNdEx += length if length < 0 { return 0, ErrInvalidLengthMesos } return iNdEx, nil case 3: for { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ innerWire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } innerWireType := int(innerWire & 0x7) if innerWireType == 4 { break } next, err := skipMesos(data[start:]) if err != nil { return 0, err } iNdEx = start + next } return iNdEx, nil case 4: return iNdEx, nil case 5: iNdEx += 4 return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } } panic("unreachable") } var ( ErrInvalidLengthMesos = fmt.Errorf("proto: negative length found during unmarshaling") ) mesos-go-0.0.1/mesosproto/mesos.proto000066400000000000000000001213511257601144100176720ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 mesosproto; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.gostring_all) = true; option (gogoproto.equal_all) = true; option (gogoproto.verbose_equal_all) = true; option (gogoproto.goproto_stringer_all) = false; option (gogoproto.stringer_all) = true; option (gogoproto.populate_all) = true; option (gogoproto.testgen_all) = true; option (gogoproto.benchgen_all) = true; option (gogoproto.marshaler_all) = true; option (gogoproto.sizer_all) = true; option (gogoproto.unmarshaler_all) = true; /** * Status is used to indicate the state of the scheduler and executor * driver after function calls. */ enum Status { DRIVER_NOT_STARTED = 1; DRIVER_RUNNING = 2; DRIVER_ABORTED = 3; DRIVER_STOPPED = 4; } /** * A unique ID assigned to a framework. A framework can reuse this ID * in order to do failover (see MesosSchedulerDriver). */ message FrameworkID { required string value = 1; } /** * A unique ID assigned to an offer. */ message OfferID { required string value = 1; } /** * A unique ID assigned to a slave. Currently, a slave gets a new ID * whenever it (re)registers with Mesos. Framework writers shouldn't * assume any binding between a slave ID and and a hostname. */ message SlaveID { required string value = 1; } /** * A framework generated ID to distinguish a task. The ID must remain * unique while the task is active. However, a framework can reuse an * ID _only_ if a previous task with the same ID has reached a * terminal state (e.g., TASK_FINISHED, TASK_LOST, TASK_KILLED, etc.). */ message TaskID { required string value = 1; } /** * A framework generated ID to distinguish an executor. Only one * executor with the same ID can be active on the same slave at a * time. */ message ExecutorID { required string value = 1; } /** * A slave generated ID to distinguish a container. The ID must be unique * between any active or completed containers on the slave. In particular, * containers for different runs of the same (framework, executor) pair must be * unique. */ message ContainerID { required string value = 1; } /** * Describes a framework. */ message FrameworkInfo { // Used to determine the Unix user that an executor or task should // be launched as. If the user field is set to an empty string Mesos // will automagically set it to the current user. required string user = 1; // Name of the framework that shows up in the Mesos Web UI. required string name = 2; // Note that 'id' is only available after a framework has // registered, however, it is included here in order to facilitate // scheduler failover (i.e., if it is set then the // MesosSchedulerDriver expects the scheduler is performing // failover). optional FrameworkID id = 3; // The amount of time that the master will wait for the scheduler to // failover before it tears down the framework by killing all its // tasks/executors. This should be non-zero if a framework expects // to reconnect after a failover and not lose its tasks/executors. optional double failover_timeout = 4 [default = 0.0]; // If set, framework pid, executor pids and status updates are // checkpointed to disk by the slaves. Checkpointing allows a // restarted slave to reconnect with old executors and recover // status updates, at the cost of disk I/O. optional bool checkpoint = 5 [default = false]; // Used to group frameworks for allocation decisions, depending on // the allocation policy being used. optional string role = 6 [default = "*"]; // Used to indicate the current host from which the scheduler is // registered in the Mesos Web UI. If set to an empty string Mesos // will automagically set it to the current hostname. optional string hostname = 7; // This field should match the credential's principal the framework // uses for authentication. This field is used for framework API // rate limiting and dynamic reservations. It should be set even // if authentication is not enabled if these features are desired. optional string principal = 8; // This field allows a framework to advertise its web UI, so that // the Mesos web UI can link to it. It is expected to be a full URL, // for example http://my-scheduler.example.com:8080/. optional string webui_url = 9; message Capability { enum Type { // Receive offers with revocable resources. See 'Resource' // message for details. // TODO(vinod): This is currently a no-op. REVOCABLE_RESOURCES = 1; } required Type type = 1; } // This field allows a framework to advertise its set of // capabilities (e.g., ability to receive offers for revocable // resources). repeated Capability capabilities = 10; } /** * Describes a health check for a task or executor (or any arbitrary * process/command). A "strategy" is picked by specifying one of the * optional fields; currently only 'command' is supported. * Specifying more than one strategy is an error. */ message HealthCheck { // Describes an HTTP health check. This is not fully implemented and not // recommended for use - see MESOS-2533. message HTTP { // Port to send the HTTP request. required uint32 port = 1; // HTTP request path. optional string path = 2 [default = "/"]; // TODO(benh): Implement: // Whether or not to use HTTPS. // optional bool ssl = 3 [default = false]; // Expected response statuses. Not specifying any statuses implies // that any returned status is acceptable. repeated uint32 statuses = 4; // TODO(benh): Include an 'optional bytes data' field for checking // for specific data in the response. } // HTTP health check - not yet recommended for use, see MESOS-2533. optional HTTP http = 1; // TODO(benh): Consider adding a URL health check strategy which // allows doing something similar to the HTTP strategy but // encapsulates all the details in a single string field. // TODO(benh): Other possible health check strategies could include // one for TCP/UDP. // Amount of time to wait until starting the health checks. optional double delay_seconds = 2 [default = 15.0]; // Interval between health checks. optional double interval_seconds = 3 [default = 10.0]; // Amount of time to wait for the health check to complete. optional double timeout_seconds = 4 [default = 20.0]; // Number of consecutive failures until considered unhealthy. optional uint32 consecutive_failures = 5 [default = 3]; // Amount of time to allow failed health checks since launch. optional double grace_period_seconds = 6 [default = 10.0]; // Command health check. optional CommandInfo command = 7; } /** * Describes a command, executed via: '/bin/sh -c value'. Any URIs specified * are fetched before executing the command. If the executable field for an * uri is set, executable file permission is set on the downloaded file. * Otherwise, if the downloaded file has a recognized archive extension * (currently [compressed] tar and zip) it is extracted into the executor's * working directory. This extraction can be disabled by setting `extract` to * false. In addition, any environment variables are set before executing * the command (so they can be used to "parameterize" your command). */ message CommandInfo { message URI { required string value = 1; optional bool executable = 2; // In case the fetched file is recognized as an archive, extract // its contents into the sandbox. Note that a cached archive is // not copied from the cache to the sandbox in case extraction // originates from an archive in the cache. optional bool extract = 3 [default = true]; // If this field is "true", the fetcher cache will be used. If not, // fetching bypasses the cache and downloads directly into the // sandbox directory, no matter whether a suitable cache file is // available or not. The former directs the fetcher to download to // the file cache, then copy from there to the sandbox. Subsequent // fetch attempts with the same URI will omit downloading and copy // from the cache as long as the file is resident there. Cache files // may get evicted at any time, which then leads to renewed // downloading. See also "docs/fetcher.md" and // "docs/fetcher-cache-internals.md". optional bool cache = 4; } // Describes a container. // Not all containerizers currently implement ContainerInfo, so it // is possible that a launched task will fail due to supplying this // attribute. // NOTE: The containerizer API is currently in an early beta or // even alpha state. Some details, like the exact semantics of an // "image" or "options" are not yet hardened. // TODO(tillt): Describe the exact scheme and semantics of "image" // and "options". message ContainerInfo { // URI describing the container image name. required string image = 1; // Describes additional options passed to the containerizer. repeated string options = 2; } // NOTE: MesosContainerizer does currently not support this // attribute and tasks supplying a 'container' will fail. optional ContainerInfo container = 4; repeated URI uris = 1; optional Environment environment = 2; // There are two ways to specify the command: // 1) If 'shell == true', the command will be launched via shell // (i.e., /bin/sh -c 'value'). The 'value' specified will be // treated as the shell command. The 'arguments' will be ignored. // 2) If 'shell == false', the command will be launched by passing // arguments to an executable. The 'value' specified will be // treated as the filename of the executable. The 'arguments' // will be treated as the arguments to the executable. This is // similar to how POSIX exec families launch processes (i.e., // execlp(value, arguments(0), arguments(1), ...)). // NOTE: The field 'value' is changed from 'required' to 'optional' // in 0.20.0. It will only cause issues if a new framework is // connecting to an old master. optional bool shell = 6 [default = true]; optional string value = 3; repeated string arguments = 7; // Enables executor and tasks to run as a specific user. If the user // field is present both in FrameworkInfo and here, the CommandInfo // user value takes precedence. optional string user = 5; } /** * Describes information about an executor. The 'data' field can be * used to pass arbitrary bytes to an executor. */ message ExecutorInfo { required ExecutorID executor_id = 1; optional FrameworkID framework_id = 8; // TODO(benh): Make this required. required CommandInfo command = 7; // Executor provided with a container will launch the container // with the executor's CommandInfo and we expect the container to // act as a Mesos executor. optional ContainerInfo container = 11; repeated Resource resources = 5; optional string name = 9; // Source is an identifier style string used by frameworks to track // the source of an executor. This is useful when it's possible for // different executor ids to be related semantically. // NOTE: Source is exposed alongside the resource usage of the // executor via JSON on the slave. This allows users to import // usage information into a time series database for monitoring. optional string source = 10; optional bytes data = 4; // Service discovery information for the executor. It is not // interpreted or acted upon by Mesos. It is up to a service // discovery system to use this information as needed and to handle // executors without service discovery information. optional DiscoveryInfo discovery = 12; } /** * Describes a master. This will probably have more fields in the * future which might be used, for example, to link a framework webui * to a master webui. */ message MasterInfo { required string id = 1; required uint32 ip = 2; required uint32 port = 3 [default = 5050]; optional string pid = 4; optional string hostname = 5; optional string version = 6; } /** * Describes a slave. Note that the 'id' field is only available after * a slave is registered with the master, and is made available here * to facilitate re-registration. If checkpoint is set, the slave is * checkpointing its own information and potentially frameworks' * information (if a framework has checkpointing enabled). */ message SlaveInfo { required string hostname = 1; optional int32 port = 8 [default = 5051]; repeated Resource resources = 3; repeated Attribute attributes = 5; optional SlaveID id = 6; // TODO(joerg84): Remove checkpoint field as with 0.22.0 // slave checkpointing is enabled for all slaves (MESOS-2317). optional bool checkpoint = 7 [default = false]; } /** * Describes an Attribute or Resource "value". A value is described * using the standard protocol buffer "union" trick. */ message Value { enum Type { SCALAR = 0; RANGES = 1; SET = 2; TEXT = 3; } message Scalar { required double value = 1; } message Range { required uint64 begin = 1; required uint64 end = 2; } message Ranges { repeated Range range = 1; } message Set { repeated string item = 1; } message Text { required string value = 1; } required Type type = 1; optional Scalar scalar = 2; optional Ranges ranges = 3; optional Set set = 4; optional Text text = 5; } /** * Describes an attribute that can be set on a machine. For now, * attributes and resources share the same "value" type, but this may * change in the future and attributes may only be string based. */ message Attribute { required string name = 1; required Value.Type type = 2; optional Value.Scalar scalar = 3; optional Value.Ranges ranges = 4; optional Value.Set set = 6; optional Value.Text text = 5; } /** * Describes a resource on a machine. A resource can take on one of * three types: scalar (double), a list of finite and discrete ranges * (e.g., [1-10, 20-30]), or a set of items. A resource is described * using the standard protocol buffer "union" trick. * * TODO(benh): Add better support for "expected" resources (e.g., * cpus, memory, disk, network). */ message Resource { required string name = 1; required Value.Type type = 2; optional Value.Scalar scalar = 3; optional Value.Ranges ranges = 4; optional Value.Set set = 5; optional string role = 6 [default = "*"]; message ReservationInfo { // Describes a dynamic reservation. A dynamic reservation is // acquired by an operator via the '/reserve' HTTP endpoint or by // a framework via the offer cycle by sending back an // 'Offer::Operation::Reserve' message. // NOTE: We currently do not allow frameworks with role "*" to // make dynamic reservations. // This field indicates the principal of the operator or framework // that reserved this resource. It is used in conjunction with the // "unreserve" ACL to determine whether the entity attempting to // unreserve this resource is permitted to do so. // NOTE: This field should match the FrameworkInfo.principal of // the framework that reserved this resource. required string principal = 1; } // If this is set, this resource was dynamically reserved by an // operator or a framework. Otherwise, this resource is either unreserved // or statically reserved by an operator via the --resources flag. optional ReservationInfo reservation = 8; message DiskInfo { // Describes a persistent disk volume. // A persistent disk volume will not be automatically garbage // collected if the task/executor/slave terminates, but is // re-offered to the framework(s) belonging to the 'role'. // A framework can set the ID (if it is not set yet) to express // the intention to create a new persistent disk volume from a // regular disk resource. To reuse a previously created volume, a // framework can launch a task/executor when it receives an offer // with a persistent volume, i.e., ID is set. // NOTE: Currently, we do not allow a persistent disk volume // without a reservation (i.e., 'role' should not be '*'). message Persistence { // A unique ID for the persistent disk volume. // NOTE: The ID needs to be unique per role on each slave. required string id = 1; } optional Persistence persistence = 1; // Describes how this disk resource will be mounted in the // container. If not set, the disk resource will be used as the // sandbox. Otherwise, it will be mounted according to the // 'container_path' inside 'volume'. The 'host_path' inside // 'volume' is ignored. // NOTE: If 'volume' is set but 'persistence' is not set, the // volume will be automatically garbage collected after // task/executor terminates. Currently, if 'persistence' is set, // 'volume' must be set. optional Volume volume = 2; } optional DiskInfo disk = 7; message RevocableInfo {} // If this is set, the resources are revocable, i.e., any tasks or // executors launched using these resources could get preempted or // throttled at any time. This could be used by frameworks to run // best effort tasks that do not need strict uptime or performance // guarantees. Note that if this is set, 'disk' or 'reservation' // cannot be set. optional RevocableInfo revocable = 9; } /** * When the network bandwidth caps are enabled and the container * is over its limit, outbound packets may be either delayed or * dropped completely either because it exceeds the maximum bandwidth * allocation for a single container (the cap) or because the combined * network traffic of multiple containers on the host exceeds the * transmit capacity of the host (the share). We can report the * following statistics for each of these conditions exported directly * from the Linux Traffic Control Queueing Discipline. * * id : name of the limiter, e.g. 'tx_bw_cap' * backlog : number of packets currently delayed * bytes : total bytes seen * drops : number of packets dropped in total * overlimits : number of packets which exceeded allocation * packets : total packets seen * qlen : number of packets currently queued * rate_bps : throughput in bytes/sec * rate_pps : throughput in packets/sec * requeues : number of times a packet has been delayed due to * locking or device contention issues * * More information on the operation of Linux Traffic Control can be * found at http://www.lartc.org/lartc.html. */ message TrafficControlStatistics { required string id = 1; optional uint64 backlog = 2; optional uint64 bytes = 3; optional uint64 drops = 4; optional uint64 overlimits = 5; optional uint64 packets = 6; optional uint64 qlen = 7; optional uint64 ratebps = 8; optional uint64 ratepps = 9; optional uint64 requeues = 10; } /** * A snapshot of resource usage statistics. */ message ResourceStatistics { required double timestamp = 1; // Snapshot time, in seconds since the Epoch. optional uint32 processes = 30; optional uint32 threads = 31; // CPU Usage Information: // Total CPU time spent in user mode, and kernel mode. optional double cpus_user_time_secs = 2; optional double cpus_system_time_secs = 3; // Number of CPUs allocated. optional double cpus_limit = 4; // cpu.stat on process throttling (for contention issues). optional uint32 cpus_nr_periods = 7; optional uint32 cpus_nr_throttled = 8; optional double cpus_throttled_time_secs = 9; // Memory Usage Information: // mem_total_bytes was added in 0.23.0 to represent the total memory // of a process in RAM (as opposed to in Swap). This was previously // reported as mem_rss_bytes, which was also changed in 0.23.0 to // represent only the anonymous memory usage, to keep in sync with // Linux kernel's (arguably erroneous) use of terminology. optional uint64 mem_total_bytes = 36; // Total memory + swap usage. This is set if swap is enabled. optional uint64 mem_total_memsw_bytes = 37; // Hard memory limit for a container. optional uint64 mem_limit_bytes = 6; // Soft memory limit for a container. optional uint64 mem_soft_limit_bytes = 38; // Broken out memory usage information: pagecache, rss (anonymous), // mmaped files and swap. // TODO(chzhcn) mem_file_bytes and mem_anon_bytes are deprecated in // 0.23.0 and will be removed in 0.24.0. optional uint64 mem_file_bytes = 10; optional uint64 mem_anon_bytes = 11; // mem_cache_bytes is added in 0.23.0 to represent page cache usage. optional uint64 mem_cache_bytes = 39; // Since 0.23.0, mem_rss_bytes is changed to represent only // anonymous memory usage. Note that neither its requiredness, type, // name nor numeric tag has been changed. optional uint64 mem_rss_bytes = 5; optional uint64 mem_mapped_file_bytes = 12; // This is only set if swap is enabled. optional uint64 mem_swap_bytes = 40; // Number of occurrences of different levels of memory pressure // events reported by memory cgroup. Pressure listening (re)starts // with these values set to 0 when slave (re)starts. See // https://www.kernel.org/doc/Documentation/cgroups/memory.txt for // more details. optional uint64 mem_low_pressure_counter = 32; optional uint64 mem_medium_pressure_counter = 33; optional uint64 mem_critical_pressure_counter = 34; // Disk Usage Information for executor working directory. optional uint64 disk_limit_bytes = 26; optional uint64 disk_used_bytes = 27; // Perf statistics. optional PerfStatistics perf = 13; // Network Usage Information: optional uint64 net_rx_packets = 14; optional uint64 net_rx_bytes = 15; optional uint64 net_rx_errors = 16; optional uint64 net_rx_dropped = 17; optional uint64 net_tx_packets = 18; optional uint64 net_tx_bytes = 19; optional uint64 net_tx_errors = 20; optional uint64 net_tx_dropped = 21; // The kernel keeps track of RTT (round-trip time) for its TCP // sockets. RTT is a way to tell the latency of a container. optional double net_tcp_rtt_microsecs_p50 = 22; optional double net_tcp_rtt_microsecs_p90 = 23; optional double net_tcp_rtt_microsecs_p95 = 24; optional double net_tcp_rtt_microsecs_p99 = 25; optional double net_tcp_active_connections = 28; optional double net_tcp_time_wait_connections = 29; // Network traffic flowing into or out of a container can be delayed // or dropped due to congestion or policy inside and outside the // container. repeated TrafficControlStatistics net_traffic_control_statistics = 35; } /** * Describes a snapshot of the resource usage for executors. */ message ResourceUsage { message Executor { required ExecutorInfo executor_info = 1; // This includes resources used by the executor itself // as well as its active tasks. repeated Resource allocated = 2; // Current resource usage. If absent, the containerizer // cannot provide resource usage. optional ResourceStatistics statistics = 3; } repeated Executor executors = 1; // TODO(jieyu): Include slave's total resources here. } /** * Describes a sample of events from "perf stat". Only available on * Linux. * * NOTE: Each optional field matches the name of a perf event (see * "perf list") with the following changes: * 1. Names are downcased. * 2. Hyphens ('-') are replaced with underscores ('_'). * 3. Events with alternate names use the name "perf stat" returns, * e.g., for the event "cycles OR cpu-cycles" perf always returns * cycles. */ message PerfStatistics { required double timestamp = 1; // Start of sample interval, in seconds since the Epoch. required double duration = 2; // Duration of sample interval, in seconds. // Hardware event. optional uint64 cycles = 3; optional uint64 stalled_cycles_frontend = 4; optional uint64 stalled_cycles_backend = 5; optional uint64 instructions = 6; optional uint64 cache_references = 7; optional uint64 cache_misses = 8; optional uint64 branches = 9; optional uint64 branch_misses = 10; optional uint64 bus_cycles = 11; optional uint64 ref_cycles = 12; // Software event. optional double cpu_clock = 13; optional double task_clock = 14; optional uint64 page_faults = 15; optional uint64 minor_faults = 16; optional uint64 major_faults = 17; optional uint64 context_switches = 18; optional uint64 cpu_migrations = 19; optional uint64 alignment_faults = 20; optional uint64 emulation_faults = 21; // Hardware cache event. optional uint64 l1_dcache_loads = 22; optional uint64 l1_dcache_load_misses = 23; optional uint64 l1_dcache_stores = 24; optional uint64 l1_dcache_store_misses = 25; optional uint64 l1_dcache_prefetches = 26; optional uint64 l1_dcache_prefetch_misses = 27; optional uint64 l1_icache_loads = 28; optional uint64 l1_icache_load_misses = 29; optional uint64 l1_icache_prefetches = 30; optional uint64 l1_icache_prefetch_misses = 31; optional uint64 llc_loads = 32; optional uint64 llc_load_misses = 33; optional uint64 llc_stores = 34; optional uint64 llc_store_misses = 35; optional uint64 llc_prefetches = 36; optional uint64 llc_prefetch_misses = 37; optional uint64 dtlb_loads = 38; optional uint64 dtlb_load_misses = 39; optional uint64 dtlb_stores = 40; optional uint64 dtlb_store_misses = 41; optional uint64 dtlb_prefetches = 42; optional uint64 dtlb_prefetch_misses = 43; optional uint64 itlb_loads = 44; optional uint64 itlb_load_misses = 45; optional uint64 branch_loads = 46; optional uint64 branch_load_misses = 47; optional uint64 node_loads = 48; optional uint64 node_load_misses = 49; optional uint64 node_stores = 50; optional uint64 node_store_misses = 51; optional uint64 node_prefetches = 52; optional uint64 node_prefetch_misses = 53; } /** * Describes a request for resources that can be used by a framework * to proactively influence the allocator. If 'slave_id' is provided * then this request is assumed to only apply to resources on that * slave. * * TODO(vinod): Remove this once the old driver is removed. */ message Request { optional SlaveID slave_id = 1; repeated Resource resources = 2; } /** * Describes some resources available on a slave. An offer only * contains resources from a single slave. */ message Offer { required OfferID id = 1; required FrameworkID framework_id = 2; required SlaveID slave_id = 3; required string hostname = 4; repeated Resource resources = 5; repeated Attribute attributes = 7; repeated ExecutorID executor_ids = 6; // Defines an operation that can be performed against offers. message Operation { enum Type { LAUNCH = 1; RESERVE = 2; UNRESERVE = 3; CREATE = 4; DESTROY = 5; } message Launch { repeated TaskInfo task_infos = 1; } message Reserve { repeated Resource resources = 1; } message Unreserve { repeated Resource resources = 1; } message Create { repeated Resource volumes = 1; } message Destroy { repeated Resource volumes = 1; } required Type type = 1; optional Launch launch = 2; optional Reserve reserve = 3; optional Unreserve unreserve = 4; optional Create create = 5; optional Destroy destroy = 6; } } /** * Describes a task. Passed from the scheduler all the way to an * executor (see SchedulerDriver::launchTasks and * Executor::launchTask). Either ExecutorInfo or CommandInfo should be set. * A different executor can be used to launch this task, and subsequent tasks * meant for the same executor can reuse the same ExecutorInfo struct. */ message TaskInfo { required string name = 1; required TaskID task_id = 2; required SlaveID slave_id = 3; repeated Resource resources = 4; optional ExecutorInfo executor = 5; optional CommandInfo command = 7; // Task provided with a container will launch the container as part // of this task paired with the task's CommandInfo. optional ContainerInfo container = 9; optional bytes data = 6; // A health check for the task (currently in *alpha* and initial // support will only be for TaskInfo's that have a CommandInfo). optional HealthCheck health_check = 8; // Labels are free-form key value pairs which are exposed through // master and slave endpoints. Labels will not be interpreted or // acted upon by Mesos itself. As opposed to the data field, labels // will be kept in memory on master and slave processes. Therefore, // labels should be used to tag tasks with light-weight meta-data. optional Labels labels = 10; // Service discovery information for the task. It is not interpreted // or acted upon by Mesos. It is up to a service discovery system // to use this information as needed and to handle tasks without // service discovery information. optional DiscoveryInfo discovery = 11; } /** * Describes possible task states. IMPORTANT: Mesos assumes tasks that * enter terminal states (see below) imply the task is no longer * running and thus clean up any thing associated with the task * (ultimately offering any resources being consumed by that task to * another task). */ enum TaskState { TASK_STAGING = 6; // Initial state. Framework status updates should not use. TASK_STARTING = 0; TASK_RUNNING = 1; TASK_FINISHED = 2; // TERMINAL. The task finished successfully. TASK_FAILED = 3; // TERMINAL. The task failed to finish successfully. TASK_KILLED = 4; // TERMINAL. The task was killed by the executor. TASK_LOST = 5; // TERMINAL. The task failed but can be rescheduled. TASK_ERROR = 7; // TERMINAL. The task description contains an error. } /** * Describes the current status of a task. */ message TaskStatus { // Describes the source of the task status update. enum Source { SOURCE_MASTER = 0; SOURCE_SLAVE = 1; SOURCE_EXECUTOR = 2; } // Detailed reason for the task status update. // // TODO(bmahler): Differentiate between slave removal reasons // (e.g. unhealthy vs. unregistered for maintenance). enum Reason { REASON_COMMAND_EXECUTOR_FAILED = 0; REASON_EXECUTOR_PREEMPTED = 17; REASON_EXECUTOR_TERMINATED = 1; REASON_EXECUTOR_UNREGISTERED = 2; REASON_FRAMEWORK_REMOVED = 3; REASON_GC_ERROR = 4; REASON_INVALID_FRAMEWORKID = 5; REASON_INVALID_OFFERS = 6; REASON_MASTER_DISCONNECTED = 7; REASON_MEMORY_LIMIT = 8; REASON_RECONCILIATION = 9; REASON_RESOURCES_UNKNOWN = 18; REASON_SLAVE_DISCONNECTED = 10; REASON_SLAVE_REMOVED = 11; REASON_SLAVE_RESTARTED = 12; REASON_SLAVE_UNKNOWN = 13; REASON_TASK_INVALID = 14; REASON_TASK_UNAUTHORIZED = 15; REASON_TASK_UNKNOWN = 16; } required TaskID task_id = 1; required TaskState state = 2; optional string message = 4; // Possible message explaining state. optional Source source = 9; optional Reason reason = 10; optional bytes data = 3; optional SlaveID slave_id = 5; optional ExecutorID executor_id = 7; // TODO(benh): Use in master/slave. optional double timestamp = 6; // Statuses that are delivered reliably to the scheduler will // include a 'uuid'. The status is considered delivered once // it is acknowledged by the scheduler. Schedulers can choose // to either explicitly acknowledge statuses or let the scheduler // driver implicitly acknowledge (default). // // TODO(bmahler): This is currently overwritten in the scheduler // driver and executor driver, but executors will need to set this // to a valid RFC-4122 UUID if using the HTTP API. optional bytes uuid = 11; // Describes whether the task has been determined to be healthy // (true) or unhealthy (false) according to the HealthCheck field in // the command info. optional bool healthy = 8; } /** * Describes possible filters that can be applied to unused resources * (see SchedulerDriver::launchTasks) to influence the allocator. */ message Filters { // Time to consider unused resources refused. Note that all unused // resources will be considered refused and use the default value // (below) regardless of whether Filters was passed to // SchedulerDriver::launchTasks. You MUST pass Filters with this // field set to change this behavior (i.e., get another offer which // includes unused resources sooner or later than the default). optional double refuse_seconds = 1 [default = 5.0]; } /** * Describes a collection of environment variables. This is used with * CommandInfo in order to set environment variables before running a * command. */ message Environment { message Variable { required string name = 1; required string value = 2; } repeated Variable variables = 1; } /** * A generic (key, value) pair used in various places for parameters. */ message Parameter { required string key = 1; required string value = 2; } /** * Collection of Parameter. */ message Parameters { repeated Parameter parameter = 1; } /** * Credential used in various places for authentication and * authorization. * * NOTE: A 'principal' is different from 'FrameworkInfo.user'. The * former is used for authentication and authorization while the * latter is used to determine the default user under which the * framework's executors/tasks are run. */ message Credential { required string principal = 1; optional bytes secret = 2; } /** * Credentials used for framework authentication, HTTP authentication * (where the common 'username' and 'password' are captured as * 'principal' and 'secret' respectively), etc. */ message Credentials { repeated Credential credentials = 1; } /** * ACLs used for authorization. */ message ACL { // Entity is used to describe a subject(s) or an object(s) of an ACL. // NOTE: // To allow everyone access to an Entity set its type to 'ANY'. // To deny access to an Entity set its type to 'NONE'. message Entity { enum Type { SOME = 0; ANY = 1; NONE = 2; } optional Type type = 1 [default = SOME]; repeated string values = 2; // Ignored for ANY/NONE. } // ACLs. message RegisterFramework { // Subjects. required Entity principals = 1; // Framework principals. // Objects. required Entity roles = 2; // Roles for resource offers. } message RunTask { // Subjects. required Entity principals = 1; // Framework principals. // Objects. required Entity users = 2; // Users to run the tasks/executors as. } // Which principals are authorized to shutdown frameworks of other // principals. message ShutdownFramework { // Subjects. required Entity principals = 1; // Objects. required Entity framework_principals = 2; } } /** * Collection of ACL. * * Each authorization request is evaluated against the ACLs in the order * they are defined. * * For simplicity, the ACLs for a given action are not aggregated even * when they have the same subjects or objects. The first ACL that * matches the request determines whether that request should be * permitted or not. An ACL matches iff both the subjects * (e.g., clients, principals) and the objects (e.g., urls, users, * roles) of the ACL match the request. * * If none of the ACLs match the request, the 'permissive' field * determines whether the request should be permitted or not. * * TODO(vinod): Do aggregation of ACLs when possible. * */ message ACLs { optional bool permissive = 1 [default = true]; repeated ACL.RegisterFramework register_frameworks = 2; repeated ACL.RunTask run_tasks = 3; repeated ACL.ShutdownFramework shutdown_frameworks = 4; } /** * Rate (queries per second, QPS) limit for messages from a framework to master. * Strictly speaking they are the combined rate from all frameworks of the same * principal. */ message RateLimit { // Leaving QPS unset gives it unlimited rate (i.e., not throttled), // which also implies unlimited capacity. optional double qps = 1; // Principal of framework(s) to be throttled. Should match // FrameworkInfo.princpal and Credential.principal (if using authentication). required string principal = 2; // Max number of outstanding messages from frameworks of this principal // allowed by master before the next message is dropped and an error is sent // back to the sender. Messages received before the capacity is reached are // still going to be processed after the error is sent. // If unspecified, this principal is assigned unlimited capacity. // NOTE: This value is ignored if 'qps' is not set. optional uint64 capacity = 3; } /** * Collection of RateLimit. * Frameworks without rate limits defined here are not throttled unless * 'aggregate_default_qps' is specified. */ message RateLimits { // Items should have unique principals. repeated RateLimit limits = 1; // All the frameworks not specified in 'limits' get this default rate. // This rate is an aggregate rate for all of them, i.e., their combined // traffic is throttled together at this rate. optional double aggregate_default_qps = 2; // All the frameworks not specified in 'limits' get this default capacity. // This is an aggregate value similar to 'aggregate_default_qps'. optional uint64 aggregate_default_capacity = 3; } /** * Describes a volume mapping either from host to container or vice * versa. Both paths can either refer to a directory or a file. */ message Volume { // Absolute path pointing to a directory or file in the container. required string container_path = 1; // Absolute path pointing to a directory or file on the host or a path // relative to the container work directory. optional string host_path = 2; enum Mode { RW = 1; // read-write. RO = 2; // read-only. } required Mode mode = 3; } /** * Describes a container configuration and allows extensible * configurations for different container implementations. */ message ContainerInfo { // All container implementation types. enum Type { DOCKER = 1; MESOS = 2; } message DockerInfo { // The docker image that is going to be passed to the registry. required string image = 1; // Network options. enum Network { HOST = 1; BRIDGE = 2; NONE = 3; } optional Network network = 2 [default = HOST]; message PortMapping { required uint32 host_port = 1; required uint32 container_port = 2; // Protocol to expose as (ie: tcp, udp). optional string protocol = 3; } repeated PortMapping port_mappings = 3; optional bool privileged = 4 [default = false]; // Allowing arbitrary parameters to be passed to docker CLI. // Note that anything passed to this field is not guaranteed // to be supported moving forward, as we might move away from // the docker CLI. repeated Parameter parameters = 5; // With this flag set to true, the docker containerizer will // pull the docker image from the registry even if the image // is already downloaded on the slave. optional bool force_pull_image = 6; } required Type type = 1; repeated Volume volumes = 2; optional string hostname = 4; optional DockerInfo docker = 3; } /** * Collection of labels. */ message Labels { repeated Label labels = 1; } /** * Key, value pair used to store free form user-data. */ message Label { required string key = 1; optional string value = 2; } /** * Named port used for service discovery. */ message Port { required uint32 number = 1; optional string name = 2; optional string protocol = 3; } /** * Collection of ports. */ message Ports { repeated Port ports = 1; } /** * Service discovery information. * The visibility field restricts discovery within a framework * (FRAMEWORK), within a Mesos cluster (CLUSTER), or places no * restrictions (EXTERNAL). * The environment, location, and version fields provide first class * support for common attributes used to differentiate between * similar services. The environment may receive values such as * PROD/QA/DEV, the location field may receive values like * EAST-US/WEST-US/EUROPE/AMEA, and the version field may receive * values like v2.0/v0.9. The exact use of these fields is up to each * service discovery system. */ message DiscoveryInfo { enum Visibility { FRAMEWORK = 0; CLUSTER = 1; EXTERNAL = 2; } required Visibility visibility = 1; optional string name = 2; optional string environment = 3; optional string location = 4; optional string version = 5; optional Ports ports = 6; optional Labels labels = 7; } mesos-go-0.0.1/mesosproto/mesospb_test.go000066400000000000000000016155561257601144100205350ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: mesos.proto // DO NOT EDIT! package mesosproto import testing "testing" import math_rand "math/rand" import time "time" import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" import fmt "fmt" import go_parser "go/parser" import proto "github.com/gogo/protobuf/proto" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf func TestFrameworkIDProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkID(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &FrameworkID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestFrameworkIDMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkID(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &FrameworkID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkFrameworkIDProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*FrameworkID, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedFrameworkID(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkFrameworkIDProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedFrameworkID(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &FrameworkID{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestOfferIDProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOfferID(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &OfferID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestOfferIDMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOfferID(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &OfferID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkOfferIDProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*OfferID, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedOfferID(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkOfferIDProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOfferID(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &OfferID{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestSlaveIDProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedSlaveID(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &SlaveID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestSlaveIDMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedSlaveID(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &SlaveID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkSlaveIDProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*SlaveID, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedSlaveID(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkSlaveIDProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedSlaveID(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &SlaveID{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestTaskIDProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskID(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &TaskID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestTaskIDMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskID(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &TaskID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkTaskIDProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*TaskID, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedTaskID(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkTaskIDProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedTaskID(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &TaskID{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestExecutorIDProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedExecutorID(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ExecutorID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestExecutorIDMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedExecutorID(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ExecutorID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkExecutorIDProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ExecutorID, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedExecutorID(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkExecutorIDProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedExecutorID(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ExecutorID{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestContainerIDProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerID(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ContainerID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestContainerIDMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerID(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ContainerID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkContainerIDProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ContainerID, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedContainerID(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkContainerIDProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedContainerID(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ContainerID{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestFrameworkInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &FrameworkInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestFrameworkInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &FrameworkInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkFrameworkInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*FrameworkInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedFrameworkInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkFrameworkInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedFrameworkInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &FrameworkInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestFrameworkInfo_CapabilityProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkInfo_Capability(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &FrameworkInfo_Capability{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestFrameworkInfo_CapabilityMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkInfo_Capability(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &FrameworkInfo_Capability{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkFrameworkInfo_CapabilityProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*FrameworkInfo_Capability, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedFrameworkInfo_Capability(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkFrameworkInfo_CapabilityProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedFrameworkInfo_Capability(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &FrameworkInfo_Capability{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestHealthCheckProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedHealthCheck(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &HealthCheck{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestHealthCheckMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedHealthCheck(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &HealthCheck{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkHealthCheckProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*HealthCheck, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedHealthCheck(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkHealthCheckProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedHealthCheck(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &HealthCheck{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestHealthCheck_HTTPProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedHealthCheck_HTTP(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &HealthCheck_HTTP{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestHealthCheck_HTTPMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedHealthCheck_HTTP(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &HealthCheck_HTTP{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkHealthCheck_HTTPProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*HealthCheck_HTTP, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedHealthCheck_HTTP(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkHealthCheck_HTTPProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedHealthCheck_HTTP(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &HealthCheck_HTTP{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestCommandInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &CommandInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestCommandInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &CommandInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkCommandInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*CommandInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedCommandInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkCommandInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCommandInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &CommandInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestCommandInfo_URIProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo_URI(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &CommandInfo_URI{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestCommandInfo_URIMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo_URI(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &CommandInfo_URI{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkCommandInfo_URIProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*CommandInfo_URI, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedCommandInfo_URI(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkCommandInfo_URIProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCommandInfo_URI(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &CommandInfo_URI{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestCommandInfo_ContainerInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo_ContainerInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &CommandInfo_ContainerInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestCommandInfo_ContainerInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo_ContainerInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &CommandInfo_ContainerInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkCommandInfo_ContainerInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*CommandInfo_ContainerInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedCommandInfo_ContainerInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkCommandInfo_ContainerInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCommandInfo_ContainerInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &CommandInfo_ContainerInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestExecutorInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedExecutorInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ExecutorInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestExecutorInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedExecutorInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ExecutorInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkExecutorInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ExecutorInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedExecutorInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkExecutorInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedExecutorInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ExecutorInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestMasterInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedMasterInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &MasterInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestMasterInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedMasterInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &MasterInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkMasterInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*MasterInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedMasterInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkMasterInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedMasterInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &MasterInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestSlaveInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedSlaveInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &SlaveInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestSlaveInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedSlaveInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &SlaveInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkSlaveInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*SlaveInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedSlaveInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkSlaveInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedSlaveInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &SlaveInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestValueProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestValueMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkValueProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Value, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedValue(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkValueProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedValue(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Value{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestValue_ScalarProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Scalar(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Scalar{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestValue_ScalarMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Scalar(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Scalar{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkValue_ScalarProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Value_Scalar, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedValue_Scalar(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkValue_ScalarProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedValue_Scalar(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Value_Scalar{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestValue_RangeProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Range(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Range{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestValue_RangeMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Range(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Range{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkValue_RangeProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Value_Range, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedValue_Range(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkValue_RangeProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedValue_Range(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Value_Range{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestValue_RangesProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Ranges(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Ranges{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestValue_RangesMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Ranges(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Ranges{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkValue_RangesProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Value_Ranges, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedValue_Ranges(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkValue_RangesProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedValue_Ranges(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Value_Ranges{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestValue_SetProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Set(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Set{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestValue_SetMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Set(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Set{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkValue_SetProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Value_Set, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedValue_Set(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkValue_SetProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedValue_Set(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Value_Set{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestValue_TextProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Text(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Text{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestValue_TextMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Text(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Text{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkValue_TextProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Value_Text, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedValue_Text(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkValue_TextProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedValue_Text(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Value_Text{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestAttributeProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAttribute(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Attribute{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestAttributeMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAttribute(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Attribute{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkAttributeProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Attribute, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedAttribute(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkAttributeProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedAttribute(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Attribute{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestResourceProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestResourceMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkResourceProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Resource, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedResource(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkResourceProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedResource(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Resource{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestResource_ReservationInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_ReservationInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource_ReservationInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestResource_ReservationInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_ReservationInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource_ReservationInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkResource_ReservationInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Resource_ReservationInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedResource_ReservationInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkResource_ReservationInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedResource_ReservationInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Resource_ReservationInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestResource_DiskInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_DiskInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource_DiskInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestResource_DiskInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_DiskInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource_DiskInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkResource_DiskInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Resource_DiskInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedResource_DiskInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkResource_DiskInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedResource_DiskInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Resource_DiskInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestResource_DiskInfo_PersistenceProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_DiskInfo_Persistence(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource_DiskInfo_Persistence{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestResource_DiskInfo_PersistenceMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_DiskInfo_Persistence(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource_DiskInfo_Persistence{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkResource_DiskInfo_PersistenceProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Resource_DiskInfo_Persistence, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedResource_DiskInfo_Persistence(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkResource_DiskInfo_PersistenceProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedResource_DiskInfo_Persistence(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Resource_DiskInfo_Persistence{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestResource_RevocableInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_RevocableInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource_RevocableInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestResource_RevocableInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_RevocableInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource_RevocableInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkResource_RevocableInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Resource_RevocableInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedResource_RevocableInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkResource_RevocableInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedResource_RevocableInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Resource_RevocableInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestTrafficControlStatisticsProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTrafficControlStatistics(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &TrafficControlStatistics{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestTrafficControlStatisticsMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTrafficControlStatistics(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &TrafficControlStatistics{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkTrafficControlStatisticsProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*TrafficControlStatistics, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedTrafficControlStatistics(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkTrafficControlStatisticsProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedTrafficControlStatistics(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &TrafficControlStatistics{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestResourceStatisticsProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceStatistics(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ResourceStatistics{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestResourceStatisticsMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceStatistics(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ResourceStatistics{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkResourceStatisticsProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ResourceStatistics, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedResourceStatistics(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkResourceStatisticsProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedResourceStatistics(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ResourceStatistics{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestResourceUsageProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceUsage(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ResourceUsage{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestResourceUsageMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceUsage(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ResourceUsage{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkResourceUsageProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ResourceUsage, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedResourceUsage(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkResourceUsageProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedResourceUsage(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ResourceUsage{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestResourceUsage_ExecutorProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceUsage_Executor(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ResourceUsage_Executor{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestResourceUsage_ExecutorMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceUsage_Executor(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ResourceUsage_Executor{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkResourceUsage_ExecutorProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ResourceUsage_Executor, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedResourceUsage_Executor(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkResourceUsage_ExecutorProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedResourceUsage_Executor(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ResourceUsage_Executor{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestPerfStatisticsProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPerfStatistics(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &PerfStatistics{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestPerfStatisticsMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPerfStatistics(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &PerfStatistics{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkPerfStatisticsProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*PerfStatistics, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedPerfStatistics(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkPerfStatisticsProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedPerfStatistics(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &PerfStatistics{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestRequestProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRequest(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Request{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestRequestMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRequest(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Request{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkRequestProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Request, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedRequest(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkRequestProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedRequest(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Request{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestOfferProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestOfferMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkOfferProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedOffer(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkOfferProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOffer(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Offer{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestOffer_OperationProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestOffer_OperationMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkOffer_OperationProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer_Operation, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedOffer_Operation(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkOffer_OperationProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOffer_Operation(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Offer_Operation{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestOffer_Operation_LaunchProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Launch(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Launch{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestOffer_Operation_LaunchMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Launch(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Launch{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkOffer_Operation_LaunchProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer_Operation_Launch, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedOffer_Operation_Launch(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkOffer_Operation_LaunchProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOffer_Operation_Launch(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Offer_Operation_Launch{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestOffer_Operation_ReserveProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Reserve(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Reserve{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestOffer_Operation_ReserveMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Reserve(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Reserve{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkOffer_Operation_ReserveProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer_Operation_Reserve, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedOffer_Operation_Reserve(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkOffer_Operation_ReserveProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOffer_Operation_Reserve(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Offer_Operation_Reserve{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestOffer_Operation_UnreserveProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Unreserve(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Unreserve{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestOffer_Operation_UnreserveMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Unreserve(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Unreserve{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkOffer_Operation_UnreserveProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer_Operation_Unreserve, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedOffer_Operation_Unreserve(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkOffer_Operation_UnreserveProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOffer_Operation_Unreserve(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Offer_Operation_Unreserve{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestOffer_Operation_CreateProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Create(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Create{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestOffer_Operation_CreateMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Create(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Create{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkOffer_Operation_CreateProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer_Operation_Create, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedOffer_Operation_Create(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkOffer_Operation_CreateProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOffer_Operation_Create(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Offer_Operation_Create{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestOffer_Operation_DestroyProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Destroy(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Destroy{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestOffer_Operation_DestroyMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Destroy(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Destroy{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkOffer_Operation_DestroyProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer_Operation_Destroy, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedOffer_Operation_Destroy(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkOffer_Operation_DestroyProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOffer_Operation_Destroy(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Offer_Operation_Destroy{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestTaskInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &TaskInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestTaskInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &TaskInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkTaskInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*TaskInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedTaskInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkTaskInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedTaskInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &TaskInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestTaskStatusProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskStatus(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &TaskStatus{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestTaskStatusMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskStatus(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &TaskStatus{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkTaskStatusProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*TaskStatus, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedTaskStatus(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkTaskStatusProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedTaskStatus(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &TaskStatus{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestFiltersProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFilters(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Filters{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestFiltersMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFilters(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Filters{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkFiltersProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Filters, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedFilters(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkFiltersProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedFilters(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Filters{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestEnvironmentProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEnvironment(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Environment{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestEnvironmentMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEnvironment(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Environment{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkEnvironmentProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Environment, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedEnvironment(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkEnvironmentProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedEnvironment(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Environment{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestEnvironment_VariableProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEnvironment_Variable(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Environment_Variable{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestEnvironment_VariableMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEnvironment_Variable(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Environment_Variable{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkEnvironment_VariableProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Environment_Variable, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedEnvironment_Variable(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkEnvironment_VariableProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedEnvironment_Variable(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Environment_Variable{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestParameterProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedParameter(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Parameter{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestParameterMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedParameter(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Parameter{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkParameterProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Parameter, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedParameter(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkParameterProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedParameter(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Parameter{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestParametersProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedParameters(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Parameters{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestParametersMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedParameters(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Parameters{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkParametersProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Parameters, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedParameters(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkParametersProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedParameters(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Parameters{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestCredentialProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCredential(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Credential{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestCredentialMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCredential(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Credential{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkCredentialProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Credential, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedCredential(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkCredentialProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCredential(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Credential{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestCredentialsProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCredentials(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Credentials{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestCredentialsMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCredentials(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Credentials{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkCredentialsProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Credentials, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedCredentials(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkCredentialsProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCredentials(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Credentials{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestACLProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestACLMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkACLProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ACL, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedACL(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkACLProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedACL(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ACL{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestACL_EntityProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_Entity(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL_Entity{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestACL_EntityMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_Entity(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL_Entity{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkACL_EntityProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ACL_Entity, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedACL_Entity(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkACL_EntityProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedACL_Entity(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ACL_Entity{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestACL_RegisterFrameworkProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_RegisterFramework(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL_RegisterFramework{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestACL_RegisterFrameworkMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_RegisterFramework(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL_RegisterFramework{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkACL_RegisterFrameworkProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ACL_RegisterFramework, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedACL_RegisterFramework(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkACL_RegisterFrameworkProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedACL_RegisterFramework(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ACL_RegisterFramework{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestACL_RunTaskProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_RunTask(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL_RunTask{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestACL_RunTaskMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_RunTask(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL_RunTask{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkACL_RunTaskProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ACL_RunTask, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedACL_RunTask(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkACL_RunTaskProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedACL_RunTask(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ACL_RunTask{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestACL_ShutdownFrameworkProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_ShutdownFramework(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL_ShutdownFramework{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestACL_ShutdownFrameworkMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_ShutdownFramework(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL_ShutdownFramework{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkACL_ShutdownFrameworkProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ACL_ShutdownFramework, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedACL_ShutdownFramework(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkACL_ShutdownFrameworkProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedACL_ShutdownFramework(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ACL_ShutdownFramework{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestACLsProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACLs(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACLs{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestACLsMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACLs(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACLs{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkACLsProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ACLs, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedACLs(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkACLsProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedACLs(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ACLs{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestRateLimitProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRateLimit(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &RateLimit{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestRateLimitMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRateLimit(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &RateLimit{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkRateLimitProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*RateLimit, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedRateLimit(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkRateLimitProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedRateLimit(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &RateLimit{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestRateLimitsProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRateLimits(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &RateLimits{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestRateLimitsMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRateLimits(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &RateLimits{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkRateLimitsProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*RateLimits, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedRateLimits(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkRateLimitsProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedRateLimits(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &RateLimits{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestVolumeProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedVolume(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Volume{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestVolumeMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedVolume(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Volume{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkVolumeProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Volume, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedVolume(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkVolumeProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedVolume(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Volume{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestContainerInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ContainerInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestContainerInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ContainerInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkContainerInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ContainerInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedContainerInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkContainerInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedContainerInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ContainerInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestContainerInfo_DockerInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo_DockerInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ContainerInfo_DockerInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestContainerInfo_DockerInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo_DockerInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ContainerInfo_DockerInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkContainerInfo_DockerInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ContainerInfo_DockerInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedContainerInfo_DockerInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkContainerInfo_DockerInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedContainerInfo_DockerInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ContainerInfo_DockerInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestContainerInfo_DockerInfo_PortMappingProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo_DockerInfo_PortMapping(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ContainerInfo_DockerInfo_PortMapping{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestContainerInfo_DockerInfo_PortMappingMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo_DockerInfo_PortMapping(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ContainerInfo_DockerInfo_PortMapping{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkContainerInfo_DockerInfo_PortMappingProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ContainerInfo_DockerInfo_PortMapping, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedContainerInfo_DockerInfo_PortMapping(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkContainerInfo_DockerInfo_PortMappingProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedContainerInfo_DockerInfo_PortMapping(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &ContainerInfo_DockerInfo_PortMapping{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestLabelsProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLabels(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Labels{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestLabelsMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLabels(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Labels{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkLabelsProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Labels, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedLabels(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkLabelsProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedLabels(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Labels{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestLabelProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLabel(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Label{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestLabelMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLabel(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Label{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkLabelProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Label, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedLabel(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkLabelProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedLabel(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Label{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestPortProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPort(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Port{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestPortMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPort(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Port{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkPortProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Port, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedPort(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkPortProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedPort(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Port{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestPortsProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPorts(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Ports{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestPortsMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPorts(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Ports{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkPortsProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Ports, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedPorts(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkPortsProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedPorts(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Ports{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestDiscoveryInfoProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedDiscoveryInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &DiscoveryInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestDiscoveryInfoMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedDiscoveryInfo(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &DiscoveryInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkDiscoveryInfoProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*DiscoveryInfo, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedDiscoveryInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkDiscoveryInfoProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedDiscoveryInfo(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &DiscoveryInfo{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestFrameworkIDJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkID(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &FrameworkID{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestOfferIDJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOfferID(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &OfferID{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestSlaveIDJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedSlaveID(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &SlaveID{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestTaskIDJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskID(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &TaskID{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestExecutorIDJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedExecutorID(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ExecutorID{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestContainerIDJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerID(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ContainerID{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestFrameworkInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &FrameworkInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestFrameworkInfo_CapabilityJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkInfo_Capability(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &FrameworkInfo_Capability{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestHealthCheckJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedHealthCheck(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &HealthCheck{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestHealthCheck_HTTPJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedHealthCheck_HTTP(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &HealthCheck_HTTP{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestCommandInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &CommandInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestCommandInfo_URIJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo_URI(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &CommandInfo_URI{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestCommandInfo_ContainerInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo_ContainerInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &CommandInfo_ContainerInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestExecutorInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedExecutorInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ExecutorInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestMasterInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedMasterInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &MasterInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestSlaveInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedSlaveInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &SlaveInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestValueJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestValue_ScalarJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Scalar(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Scalar{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestValue_RangeJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Range(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Range{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestValue_RangesJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Ranges(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Ranges{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestValue_SetJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Set(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Set{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestValue_TextJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Text(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Value_Text{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestAttributeJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAttribute(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Attribute{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestResourceJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestResource_ReservationInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_ReservationInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource_ReservationInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestResource_DiskInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_DiskInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource_DiskInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestResource_DiskInfo_PersistenceJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_DiskInfo_Persistence(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource_DiskInfo_Persistence{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestResource_RevocableInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_RevocableInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Resource_RevocableInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestTrafficControlStatisticsJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTrafficControlStatistics(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &TrafficControlStatistics{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestResourceStatisticsJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceStatistics(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ResourceStatistics{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestResourceUsageJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceUsage(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ResourceUsage{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestResourceUsage_ExecutorJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceUsage_Executor(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ResourceUsage_Executor{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestPerfStatisticsJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPerfStatistics(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &PerfStatistics{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestRequestJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRequest(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Request{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestOfferJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestOffer_OperationJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestOffer_Operation_LaunchJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Launch(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Launch{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestOffer_Operation_ReserveJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Reserve(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Reserve{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestOffer_Operation_UnreserveJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Unreserve(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Unreserve{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestOffer_Operation_CreateJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Create(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Create{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestOffer_Operation_DestroyJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Destroy(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Offer_Operation_Destroy{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestTaskInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &TaskInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestTaskStatusJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskStatus(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &TaskStatus{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestFiltersJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFilters(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Filters{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestEnvironmentJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEnvironment(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Environment{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestEnvironment_VariableJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEnvironment_Variable(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Environment_Variable{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestParameterJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedParameter(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Parameter{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestParametersJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedParameters(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Parameters{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestCredentialJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCredential(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Credential{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestCredentialsJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCredentials(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Credentials{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestACLJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestACL_EntityJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_Entity(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL_Entity{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestACL_RegisterFrameworkJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_RegisterFramework(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL_RegisterFramework{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestACL_RunTaskJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_RunTask(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL_RunTask{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestACL_ShutdownFrameworkJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_ShutdownFramework(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACL_ShutdownFramework{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestACLsJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACLs(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ACLs{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestRateLimitJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRateLimit(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &RateLimit{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestRateLimitsJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRateLimits(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &RateLimits{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestVolumeJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedVolume(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Volume{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestContainerInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ContainerInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestContainerInfo_DockerInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo_DockerInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ContainerInfo_DockerInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestContainerInfo_DockerInfo_PortMappingJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo_DockerInfo_PortMapping(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &ContainerInfo_DockerInfo_PortMapping{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestLabelsJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLabels(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Labels{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestLabelJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLabel(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Label{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestPortJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPort(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Port{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestPortsJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPorts(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Ports{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestDiscoveryInfoJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedDiscoveryInfo(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &DiscoveryInfo{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestFrameworkIDProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkID(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &FrameworkID{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestFrameworkIDProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkID(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &FrameworkID{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOfferIDProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOfferID(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &OfferID{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOfferIDProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOfferID(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &OfferID{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestSlaveIDProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedSlaveID(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &SlaveID{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestSlaveIDProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedSlaveID(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &SlaveID{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestTaskIDProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskID(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &TaskID{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestTaskIDProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskID(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &TaskID{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestExecutorIDProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedExecutorID(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ExecutorID{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestExecutorIDProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedExecutorID(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ExecutorID{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestContainerIDProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerID(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ContainerID{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestContainerIDProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerID(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ContainerID{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestFrameworkInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &FrameworkInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestFrameworkInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &FrameworkInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestFrameworkInfo_CapabilityProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkInfo_Capability(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &FrameworkInfo_Capability{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestFrameworkInfo_CapabilityProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkInfo_Capability(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &FrameworkInfo_Capability{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestHealthCheckProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedHealthCheck(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &HealthCheck{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestHealthCheckProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedHealthCheck(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &HealthCheck{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestHealthCheck_HTTPProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedHealthCheck_HTTP(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &HealthCheck_HTTP{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestHealthCheck_HTTPProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedHealthCheck_HTTP(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &HealthCheck_HTTP{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestCommandInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &CommandInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestCommandInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &CommandInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestCommandInfo_URIProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo_URI(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &CommandInfo_URI{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestCommandInfo_URIProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo_URI(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &CommandInfo_URI{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestCommandInfo_ContainerInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo_ContainerInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &CommandInfo_ContainerInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestCommandInfo_ContainerInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo_ContainerInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &CommandInfo_ContainerInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestExecutorInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedExecutorInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ExecutorInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestExecutorInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedExecutorInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ExecutorInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestMasterInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedMasterInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &MasterInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestMasterInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedMasterInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &MasterInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestSlaveInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedSlaveInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &SlaveInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestSlaveInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedSlaveInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &SlaveInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestValueProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Value{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestValueProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Value{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestValue_ScalarProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Scalar(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Value_Scalar{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestValue_ScalarProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Scalar(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Value_Scalar{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestValue_RangeProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Range(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Value_Range{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestValue_RangeProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Range(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Value_Range{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestValue_RangesProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Ranges(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Value_Ranges{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestValue_RangesProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Ranges(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Value_Ranges{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestValue_SetProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Set(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Value_Set{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestValue_SetProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Set(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Value_Set{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestValue_TextProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Text(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Value_Text{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestValue_TextProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Text(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Value_Text{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestAttributeProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAttribute(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Attribute{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestAttributeProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAttribute(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Attribute{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResourceProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Resource{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResourceProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Resource{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResource_ReservationInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_ReservationInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Resource_ReservationInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResource_ReservationInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_ReservationInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Resource_ReservationInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResource_DiskInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_DiskInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Resource_DiskInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResource_DiskInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_DiskInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Resource_DiskInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResource_DiskInfo_PersistenceProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_DiskInfo_Persistence(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Resource_DiskInfo_Persistence{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResource_DiskInfo_PersistenceProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_DiskInfo_Persistence(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Resource_DiskInfo_Persistence{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResource_RevocableInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_RevocableInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Resource_RevocableInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResource_RevocableInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_RevocableInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Resource_RevocableInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestTrafficControlStatisticsProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTrafficControlStatistics(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &TrafficControlStatistics{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestTrafficControlStatisticsProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTrafficControlStatistics(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &TrafficControlStatistics{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResourceStatisticsProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceStatistics(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ResourceStatistics{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResourceStatisticsProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceStatistics(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ResourceStatistics{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResourceUsageProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceUsage(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ResourceUsage{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResourceUsageProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceUsage(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ResourceUsage{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResourceUsage_ExecutorProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceUsage_Executor(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ResourceUsage_Executor{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestResourceUsage_ExecutorProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceUsage_Executor(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ResourceUsage_Executor{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestPerfStatisticsProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPerfStatistics(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &PerfStatistics{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestPerfStatisticsProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPerfStatistics(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &PerfStatistics{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestRequestProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRequest(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Request{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestRequestProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRequest(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Request{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOfferProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Offer{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOfferProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Offer{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOffer_OperationProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Offer_Operation{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOffer_OperationProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Offer_Operation{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOffer_Operation_LaunchProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Launch(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Offer_Operation_Launch{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOffer_Operation_LaunchProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Launch(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Offer_Operation_Launch{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOffer_Operation_ReserveProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Reserve(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Offer_Operation_Reserve{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOffer_Operation_ReserveProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Reserve(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Offer_Operation_Reserve{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOffer_Operation_UnreserveProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Unreserve(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Offer_Operation_Unreserve{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOffer_Operation_UnreserveProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Unreserve(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Offer_Operation_Unreserve{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOffer_Operation_CreateProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Create(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Offer_Operation_Create{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOffer_Operation_CreateProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Create(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Offer_Operation_Create{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOffer_Operation_DestroyProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Destroy(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Offer_Operation_Destroy{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOffer_Operation_DestroyProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Destroy(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Offer_Operation_Destroy{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestTaskInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &TaskInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestTaskInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &TaskInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestTaskStatusProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskStatus(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &TaskStatus{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestTaskStatusProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskStatus(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &TaskStatus{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestFiltersProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFilters(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Filters{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestFiltersProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFilters(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Filters{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestEnvironmentProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEnvironment(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Environment{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestEnvironmentProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEnvironment(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Environment{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestEnvironment_VariableProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEnvironment_Variable(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Environment_Variable{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestEnvironment_VariableProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEnvironment_Variable(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Environment_Variable{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestParameterProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedParameter(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Parameter{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestParameterProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedParameter(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Parameter{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestParametersProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedParameters(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Parameters{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestParametersProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedParameters(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Parameters{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestCredentialProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCredential(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Credential{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestCredentialProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCredential(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Credential{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestCredentialsProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCredentials(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Credentials{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestCredentialsProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCredentials(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Credentials{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestACLProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ACL{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestACLProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ACL{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestACL_EntityProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_Entity(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ACL_Entity{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestACL_EntityProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_Entity(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ACL_Entity{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestACL_RegisterFrameworkProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_RegisterFramework(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ACL_RegisterFramework{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestACL_RegisterFrameworkProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_RegisterFramework(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ACL_RegisterFramework{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestACL_RunTaskProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_RunTask(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ACL_RunTask{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestACL_RunTaskProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_RunTask(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ACL_RunTask{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestACL_ShutdownFrameworkProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_ShutdownFramework(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ACL_ShutdownFramework{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestACL_ShutdownFrameworkProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_ShutdownFramework(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ACL_ShutdownFramework{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestACLsProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACLs(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ACLs{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestACLsProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACLs(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ACLs{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestRateLimitProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRateLimit(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &RateLimit{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestRateLimitProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRateLimit(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &RateLimit{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestRateLimitsProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRateLimits(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &RateLimits{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestRateLimitsProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRateLimits(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &RateLimits{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestVolumeProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedVolume(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Volume{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestVolumeProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedVolume(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Volume{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestContainerInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ContainerInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestContainerInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ContainerInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestContainerInfo_DockerInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo_DockerInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ContainerInfo_DockerInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestContainerInfo_DockerInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo_DockerInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ContainerInfo_DockerInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestContainerInfo_DockerInfo_PortMappingProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo_DockerInfo_PortMapping(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &ContainerInfo_DockerInfo_PortMapping{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestContainerInfo_DockerInfo_PortMappingProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo_DockerInfo_PortMapping(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &ContainerInfo_DockerInfo_PortMapping{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestLabelsProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLabels(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Labels{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestLabelsProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLabels(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Labels{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestLabelProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLabel(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Label{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestLabelProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLabel(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Label{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestPortProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPort(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Port{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestPortProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPort(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Port{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestPortsProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPorts(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Ports{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestPortsProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPorts(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Ports{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestDiscoveryInfoProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedDiscoveryInfo(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &DiscoveryInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestDiscoveryInfoProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedDiscoveryInfo(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &DiscoveryInfo{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestFrameworkIDVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedFrameworkID(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &FrameworkID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestOfferIDVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOfferID(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &OfferID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestSlaveIDVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedSlaveID(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &SlaveID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestTaskIDVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedTaskID(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &TaskID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestExecutorIDVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedExecutorID(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ExecutorID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestContainerIDVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedContainerID(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ContainerID{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestFrameworkInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedFrameworkInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &FrameworkInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestFrameworkInfo_CapabilityVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedFrameworkInfo_Capability(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &FrameworkInfo_Capability{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestHealthCheckVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedHealthCheck(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &HealthCheck{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestHealthCheck_HTTPVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedHealthCheck_HTTP(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &HealthCheck_HTTP{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestCommandInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCommandInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &CommandInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestCommandInfo_URIVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCommandInfo_URI(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &CommandInfo_URI{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestCommandInfo_ContainerInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCommandInfo_ContainerInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &CommandInfo_ContainerInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestExecutorInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedExecutorInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ExecutorInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestMasterInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedMasterInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &MasterInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestSlaveInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedSlaveInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &SlaveInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestValueVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Value{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestValue_ScalarVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Scalar(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Value_Scalar{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestValue_RangeVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Range(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Value_Range{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestValue_RangesVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Ranges(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Value_Ranges{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestValue_SetVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Set(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Value_Set{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestValue_TextVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Text(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Value_Text{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestAttributeVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAttribute(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Attribute{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestResourceVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Resource{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestResource_ReservationInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource_ReservationInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Resource_ReservationInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestResource_DiskInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource_DiskInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Resource_DiskInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestResource_DiskInfo_PersistenceVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource_DiskInfo_Persistence(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Resource_DiskInfo_Persistence{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestResource_RevocableInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource_RevocableInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Resource_RevocableInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestTrafficControlStatisticsVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedTrafficControlStatistics(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &TrafficControlStatistics{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestResourceStatisticsVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResourceStatistics(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ResourceStatistics{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestResourceUsageVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResourceUsage(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ResourceUsage{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestResourceUsage_ExecutorVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResourceUsage_Executor(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ResourceUsage_Executor{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestPerfStatisticsVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPerfStatistics(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &PerfStatistics{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestRequestVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRequest(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Request{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestOfferVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Offer{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestOffer_OperationVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Offer_Operation{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestOffer_Operation_LaunchVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Launch(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Offer_Operation_Launch{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestOffer_Operation_ReserveVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Reserve(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Offer_Operation_Reserve{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestOffer_Operation_UnreserveVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Unreserve(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Offer_Operation_Unreserve{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestOffer_Operation_CreateVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Create(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Offer_Operation_Create{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestOffer_Operation_DestroyVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Destroy(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Offer_Operation_Destroy{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestTaskInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedTaskInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &TaskInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestTaskStatusVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedTaskStatus(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &TaskStatus{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestFiltersVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedFilters(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Filters{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestEnvironmentVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedEnvironment(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Environment{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestEnvironment_VariableVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedEnvironment_Variable(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Environment_Variable{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestParameterVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedParameter(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Parameter{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestParametersVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedParameters(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Parameters{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestCredentialVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCredential(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Credential{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestCredentialsVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCredentials(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Credentials{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestACLVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ACL{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestACL_EntityVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL_Entity(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ACL_Entity{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestACL_RegisterFrameworkVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL_RegisterFramework(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ACL_RegisterFramework{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestACL_RunTaskVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL_RunTask(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ACL_RunTask{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestACL_ShutdownFrameworkVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL_ShutdownFramework(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ACL_ShutdownFramework{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestACLsVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACLs(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ACLs{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestRateLimitVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRateLimit(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &RateLimit{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestRateLimitsVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRateLimits(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &RateLimits{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestVolumeVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedVolume(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Volume{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestContainerInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedContainerInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ContainerInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestContainerInfo_DockerInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedContainerInfo_DockerInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ContainerInfo_DockerInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestContainerInfo_DockerInfo_PortMappingVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedContainerInfo_DockerInfo_PortMapping(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &ContainerInfo_DockerInfo_PortMapping{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestLabelsVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedLabels(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Labels{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestLabelVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedLabel(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Label{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestPortVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPort(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Port{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestPortsVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPorts(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Ports{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestDiscoveryInfoVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedDiscoveryInfo(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &DiscoveryInfo{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestFrameworkIDGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedFrameworkID(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestOfferIDGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOfferID(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestSlaveIDGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedSlaveID(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestTaskIDGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedTaskID(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestExecutorIDGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedExecutorID(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestContainerIDGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedContainerID(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestFrameworkInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedFrameworkInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestFrameworkInfo_CapabilityGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedFrameworkInfo_Capability(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestHealthCheckGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedHealthCheck(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestHealthCheck_HTTPGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedHealthCheck_HTTP(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestCommandInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCommandInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestCommandInfo_URIGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCommandInfo_URI(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestCommandInfo_ContainerInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCommandInfo_ContainerInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestExecutorInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedExecutorInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestMasterInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedMasterInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestSlaveInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedSlaveInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestValueGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestValue_ScalarGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Scalar(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestValue_RangeGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Range(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestValue_RangesGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Ranges(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestValue_SetGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Set(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestValue_TextGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Text(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestAttributeGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAttribute(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestResourceGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestResource_ReservationInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource_ReservationInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestResource_DiskInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource_DiskInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestResource_DiskInfo_PersistenceGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource_DiskInfo_Persistence(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestResource_RevocableInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource_RevocableInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestTrafficControlStatisticsGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedTrafficControlStatistics(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestResourceStatisticsGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResourceStatistics(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestResourceUsageGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResourceUsage(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestResourceUsage_ExecutorGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResourceUsage_Executor(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestPerfStatisticsGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPerfStatistics(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestRequestGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRequest(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestOfferGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestOffer_OperationGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestOffer_Operation_LaunchGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Launch(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestOffer_Operation_ReserveGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Reserve(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestOffer_Operation_UnreserveGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Unreserve(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestOffer_Operation_CreateGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Create(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestOffer_Operation_DestroyGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Destroy(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestTaskInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedTaskInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestTaskStatusGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedTaskStatus(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestFiltersGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedFilters(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestEnvironmentGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedEnvironment(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestEnvironment_VariableGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedEnvironment_Variable(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestParameterGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedParameter(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestParametersGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedParameters(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestCredentialGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCredential(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestCredentialsGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCredentials(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestACLGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestACL_EntityGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL_Entity(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestACL_RegisterFrameworkGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL_RegisterFramework(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestACL_RunTaskGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL_RunTask(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestACL_ShutdownFrameworkGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL_ShutdownFramework(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestACLsGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACLs(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestRateLimitGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRateLimit(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestRateLimitsGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRateLimits(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestVolumeGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedVolume(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestContainerInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedContainerInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestContainerInfo_DockerInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedContainerInfo_DockerInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestContainerInfo_DockerInfo_PortMappingGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedContainerInfo_DockerInfo_PortMapping(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestLabelsGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedLabels(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestLabelGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedLabel(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestPortGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPort(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestPortsGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPorts(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestDiscoveryInfoGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedDiscoveryInfo(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestFrameworkIDSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkID(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkFrameworkIDSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*FrameworkID, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedFrameworkID(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestOfferIDSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOfferID(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkOfferIDSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*OfferID, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedOfferID(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestSlaveIDSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedSlaveID(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkSlaveIDSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*SlaveID, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedSlaveID(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestTaskIDSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskID(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkTaskIDSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*TaskID, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedTaskID(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestExecutorIDSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedExecutorID(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkExecutorIDSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ExecutorID, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedExecutorID(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestContainerIDSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerID(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkContainerIDSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ContainerID, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedContainerID(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestFrameworkInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkFrameworkInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*FrameworkInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedFrameworkInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestFrameworkInfo_CapabilitySize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFrameworkInfo_Capability(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkFrameworkInfo_CapabilitySize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*FrameworkInfo_Capability, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedFrameworkInfo_Capability(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestHealthCheckSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedHealthCheck(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkHealthCheckSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*HealthCheck, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedHealthCheck(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestHealthCheck_HTTPSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedHealthCheck_HTTP(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkHealthCheck_HTTPSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*HealthCheck_HTTP, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedHealthCheck_HTTP(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestCommandInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkCommandInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*CommandInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedCommandInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestCommandInfo_URISize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo_URI(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkCommandInfo_URISize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*CommandInfo_URI, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedCommandInfo_URI(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestCommandInfo_ContainerInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCommandInfo_ContainerInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkCommandInfo_ContainerInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*CommandInfo_ContainerInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedCommandInfo_ContainerInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestExecutorInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedExecutorInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkExecutorInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ExecutorInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedExecutorInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestMasterInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedMasterInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkMasterInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*MasterInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedMasterInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestSlaveInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedSlaveInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkSlaveInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*SlaveInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedSlaveInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestValueSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkValueSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Value, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedValue(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestValue_ScalarSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Scalar(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkValue_ScalarSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Value_Scalar, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedValue_Scalar(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestValue_RangeSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Range(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkValue_RangeSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Value_Range, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedValue_Range(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestValue_RangesSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Ranges(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkValue_RangesSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Value_Ranges, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedValue_Ranges(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestValue_SetSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Set(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkValue_SetSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Value_Set, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedValue_Set(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestValue_TextSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedValue_Text(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkValue_TextSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Value_Text, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedValue_Text(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestAttributeSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedAttribute(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkAttributeSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Attribute, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedAttribute(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestResourceSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkResourceSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Resource, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedResource(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestResource_ReservationInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_ReservationInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkResource_ReservationInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Resource_ReservationInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedResource_ReservationInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestResource_DiskInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_DiskInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkResource_DiskInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Resource_DiskInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedResource_DiskInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestResource_DiskInfo_PersistenceSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_DiskInfo_Persistence(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkResource_DiskInfo_PersistenceSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Resource_DiskInfo_Persistence, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedResource_DiskInfo_Persistence(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestResource_RevocableInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResource_RevocableInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkResource_RevocableInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Resource_RevocableInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedResource_RevocableInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestTrafficControlStatisticsSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTrafficControlStatistics(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkTrafficControlStatisticsSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*TrafficControlStatistics, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedTrafficControlStatistics(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestResourceStatisticsSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceStatistics(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkResourceStatisticsSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ResourceStatistics, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedResourceStatistics(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestResourceUsageSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceUsage(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkResourceUsageSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ResourceUsage, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedResourceUsage(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestResourceUsage_ExecutorSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedResourceUsage_Executor(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkResourceUsage_ExecutorSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ResourceUsage_Executor, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedResourceUsage_Executor(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestPerfStatisticsSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPerfStatistics(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkPerfStatisticsSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*PerfStatistics, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedPerfStatistics(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestRequestSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRequest(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkRequestSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Request, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedRequest(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestOfferSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkOfferSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedOffer(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestOffer_OperationSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkOffer_OperationSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer_Operation, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedOffer_Operation(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestOffer_Operation_LaunchSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Launch(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkOffer_Operation_LaunchSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer_Operation_Launch, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedOffer_Operation_Launch(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestOffer_Operation_ReserveSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Reserve(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkOffer_Operation_ReserveSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer_Operation_Reserve, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedOffer_Operation_Reserve(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestOffer_Operation_UnreserveSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Unreserve(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkOffer_Operation_UnreserveSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer_Operation_Unreserve, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedOffer_Operation_Unreserve(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestOffer_Operation_CreateSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Create(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkOffer_Operation_CreateSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer_Operation_Create, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedOffer_Operation_Create(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestOffer_Operation_DestroySize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOffer_Operation_Destroy(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkOffer_Operation_DestroySize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Offer_Operation_Destroy, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedOffer_Operation_Destroy(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestTaskInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkTaskInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*TaskInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedTaskInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestTaskStatusSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedTaskStatus(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkTaskStatusSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*TaskStatus, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedTaskStatus(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestFiltersSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFilters(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkFiltersSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Filters, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedFilters(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestEnvironmentSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEnvironment(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkEnvironmentSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Environment, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedEnvironment(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestEnvironment_VariableSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEnvironment_Variable(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkEnvironment_VariableSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Environment_Variable, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedEnvironment_Variable(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestParameterSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedParameter(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkParameterSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Parameter, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedParameter(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestParametersSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedParameters(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkParametersSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Parameters, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedParameters(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestCredentialSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCredential(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkCredentialSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Credential, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedCredential(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestCredentialsSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedCredentials(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkCredentialsSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Credentials, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedCredentials(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestACLSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkACLSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ACL, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedACL(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestACL_EntitySize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_Entity(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkACL_EntitySize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ACL_Entity, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedACL_Entity(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestACL_RegisterFrameworkSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_RegisterFramework(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkACL_RegisterFrameworkSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ACL_RegisterFramework, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedACL_RegisterFramework(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestACL_RunTaskSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_RunTask(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkACL_RunTaskSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ACL_RunTask, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedACL_RunTask(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestACL_ShutdownFrameworkSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACL_ShutdownFramework(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkACL_ShutdownFrameworkSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ACL_ShutdownFramework, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedACL_ShutdownFramework(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestACLsSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedACLs(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkACLsSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ACLs, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedACLs(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestRateLimitSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRateLimit(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkRateLimitSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*RateLimit, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedRateLimit(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestRateLimitsSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedRateLimits(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkRateLimitsSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*RateLimits, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedRateLimits(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestVolumeSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedVolume(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkVolumeSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Volume, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedVolume(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestContainerInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkContainerInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ContainerInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedContainerInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestContainerInfo_DockerInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo_DockerInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkContainerInfo_DockerInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ContainerInfo_DockerInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedContainerInfo_DockerInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestContainerInfo_DockerInfo_PortMappingSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedContainerInfo_DockerInfo_PortMapping(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkContainerInfo_DockerInfo_PortMappingSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*ContainerInfo_DockerInfo_PortMapping, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedContainerInfo_DockerInfo_PortMapping(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestLabelsSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLabels(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkLabelsSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Labels, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedLabels(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestLabelSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedLabel(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkLabelSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Label, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedLabel(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestPortSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPort(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkPortSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Port, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedPort(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestPortsSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedPorts(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkPortsSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Ports, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedPorts(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestDiscoveryInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedDiscoveryInfo(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkDiscoveryInfoSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*DiscoveryInfo, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedDiscoveryInfo(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestFrameworkIDStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedFrameworkID(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestOfferIDStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOfferID(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestSlaveIDStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedSlaveID(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestTaskIDStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedTaskID(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestExecutorIDStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedExecutorID(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestContainerIDStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedContainerID(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestFrameworkInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedFrameworkInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestFrameworkInfo_CapabilityStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedFrameworkInfo_Capability(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestHealthCheckStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedHealthCheck(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestHealthCheck_HTTPStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedHealthCheck_HTTP(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestCommandInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCommandInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestCommandInfo_URIStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCommandInfo_URI(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestCommandInfo_ContainerInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCommandInfo_ContainerInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestExecutorInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedExecutorInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestMasterInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedMasterInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestSlaveInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedSlaveInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestValueStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestValue_ScalarStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Scalar(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestValue_RangeStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Range(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestValue_RangesStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Ranges(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestValue_SetStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Set(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestValue_TextStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedValue_Text(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestAttributeStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedAttribute(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestResourceStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestResource_ReservationInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource_ReservationInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestResource_DiskInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource_DiskInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestResource_DiskInfo_PersistenceStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource_DiskInfo_Persistence(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestResource_RevocableInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResource_RevocableInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestTrafficControlStatisticsStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedTrafficControlStatistics(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestResourceStatisticsStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResourceStatistics(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestResourceUsageStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResourceUsage(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestResourceUsage_ExecutorStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedResourceUsage_Executor(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestPerfStatisticsStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPerfStatistics(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestRequestStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRequest(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestOfferStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestOffer_OperationStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestOffer_Operation_LaunchStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Launch(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestOffer_Operation_ReserveStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Reserve(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestOffer_Operation_UnreserveStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Unreserve(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestOffer_Operation_CreateStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Create(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestOffer_Operation_DestroyStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOffer_Operation_Destroy(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestTaskInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedTaskInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestTaskStatusStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedTaskStatus(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestFiltersStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedFilters(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestEnvironmentStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedEnvironment(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestEnvironment_VariableStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedEnvironment_Variable(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestParameterStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedParameter(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestParametersStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedParameters(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestCredentialStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCredential(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestCredentialsStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedCredentials(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestACLStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestACL_EntityStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL_Entity(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestACL_RegisterFrameworkStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL_RegisterFramework(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestACL_RunTaskStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL_RunTask(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestACL_ShutdownFrameworkStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACL_ShutdownFramework(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestACLsStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedACLs(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestRateLimitStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRateLimit(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestRateLimitsStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedRateLimits(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestVolumeStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedVolume(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestContainerInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedContainerInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestContainerInfo_DockerInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedContainerInfo_DockerInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestContainerInfo_DockerInfo_PortMappingStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedContainerInfo_DockerInfo_PortMapping(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestLabelsStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedLabels(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestLabelStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedLabel(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestPortStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPort(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestPortsStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedPorts(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestDiscoveryInfoStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedDiscoveryInfo(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } //These tests are generated by github.com/gogo/protobuf/plugin/testgen mesos-go-0.0.1/mesosproto/messages.pb.go000066400000000000000000001333671257601144100202270ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: messages.proto // DO NOT EDIT! package mesosproto import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf type StatusUpdateRecord_Type int32 const ( StatusUpdateRecord_UPDATE StatusUpdateRecord_Type = 0 StatusUpdateRecord_ACK StatusUpdateRecord_Type = 1 ) var StatusUpdateRecord_Type_name = map[int32]string{ 0: "UPDATE", 1: "ACK", } var StatusUpdateRecord_Type_value = map[string]int32{ "UPDATE": 0, "ACK": 1, } func (x StatusUpdateRecord_Type) Enum() *StatusUpdateRecord_Type { p := new(StatusUpdateRecord_Type) *p = x return p } func (x StatusUpdateRecord_Type) String() string { return proto.EnumName(StatusUpdateRecord_Type_name, int32(x)) } func (x *StatusUpdateRecord_Type) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(StatusUpdateRecord_Type_value, data, "StatusUpdateRecord_Type") if err != nil { return err } *x = StatusUpdateRecord_Type(value) return nil } // TODO(benh): It would be great if this could just be a // TaskInfo wherever it gets used! However, doing so would // require adding the framework_id field, the executor_id field, and // the state field into TaskInfo though (or send them another // way). Also, one performance reason why we don't do that now is // because storing whatever data is coupled with a TaskInfo // could be large and unnecessary. // TODO(bmahler): Add executor_uuid here, and send it to the master. This will // allow us to expose executor work directories for tasks in the webui when // looking from the master level. Currently only the slave knows which run the // task belongs to. type Task struct { Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` TaskId *TaskID `protobuf:"bytes,2,req,name=task_id" json:"task_id,omitempty"` FrameworkId *FrameworkID `protobuf:"bytes,3,req,name=framework_id" json:"framework_id,omitempty"` ExecutorId *ExecutorID `protobuf:"bytes,4,opt,name=executor_id" json:"executor_id,omitempty"` SlaveId *SlaveID `protobuf:"bytes,5,req,name=slave_id" json:"slave_id,omitempty"` State *TaskState `protobuf:"varint,6,req,name=state,enum=mesosproto.TaskState" json:"state,omitempty"` Resources []*Resource `protobuf:"bytes,7,rep,name=resources" json:"resources,omitempty"` Statuses []*TaskStatus `protobuf:"bytes,8,rep,name=statuses" json:"statuses,omitempty"` // These fields correspond to the state and uuid of the latest // status update forwarded to the master. // NOTE: Either both the fields must be set or both must be unset. StatusUpdateState *TaskState `protobuf:"varint,9,opt,name=status_update_state,enum=mesosproto.TaskState" json:"status_update_state,omitempty"` StatusUpdateUuid []byte `protobuf:"bytes,10,opt,name=status_update_uuid" json:"status_update_uuid,omitempty"` Labels *Labels `protobuf:"bytes,11,opt,name=labels" json:"labels,omitempty"` // Service discovery information for the task. It is not interpreted // or acted upon by Mesos. It is up to a service discovery system // to use this information as needed and to handle tasks without // service discovery information. Discovery *DiscoveryInfo `protobuf:"bytes,12,opt,name=discovery" json:"discovery,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Task) Reset() { *m = Task{} } func (m *Task) String() string { return proto.CompactTextString(m) } func (*Task) ProtoMessage() {} func (m *Task) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *Task) GetTaskId() *TaskID { if m != nil { return m.TaskId } return nil } func (m *Task) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *Task) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *Task) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *Task) GetState() TaskState { if m != nil && m.State != nil { return *m.State } return TaskState_TASK_STAGING } func (m *Task) GetResources() []*Resource { if m != nil { return m.Resources } return nil } func (m *Task) GetStatuses() []*TaskStatus { if m != nil { return m.Statuses } return nil } func (m *Task) GetStatusUpdateState() TaskState { if m != nil && m.StatusUpdateState != nil { return *m.StatusUpdateState } return TaskState_TASK_STAGING } func (m *Task) GetStatusUpdateUuid() []byte { if m != nil { return m.StatusUpdateUuid } return nil } func (m *Task) GetLabels() *Labels { if m != nil { return m.Labels } return nil } func (m *Task) GetDiscovery() *DiscoveryInfo { if m != nil { return m.Discovery } return nil } // TODO(vinod): Create a new UUID message type. type StatusUpdate struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` ExecutorId *ExecutorID `protobuf:"bytes,2,opt,name=executor_id" json:"executor_id,omitempty"` SlaveId *SlaveID `protobuf:"bytes,3,opt,name=slave_id" json:"slave_id,omitempty"` Status *TaskStatus `protobuf:"bytes,4,req,name=status" json:"status,omitempty"` Timestamp *float64 `protobuf:"fixed64,5,req,name=timestamp" json:"timestamp,omitempty"` // This is being deprecated in favor of TaskStatus.uuid. In 0.23.0, // we set the TaskStatus 'uuid' in the executor driver for all // retryable status updates. Uuid []byte `protobuf:"bytes,6,opt,name=uuid" json:"uuid,omitempty"` // This corresponds to the latest state of the task according to the // slave. Note that this state might be different than the state in // 'status' because status update manager queues updates. In other // words, 'status' corresponds to the update at top of the queue and // 'latest_state' corresponds to the update at bottom of the queue. LatestState *TaskState `protobuf:"varint,7,opt,name=latest_state,enum=mesosproto.TaskState" json:"latest_state,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *StatusUpdate) Reset() { *m = StatusUpdate{} } func (m *StatusUpdate) String() string { return proto.CompactTextString(m) } func (*StatusUpdate) ProtoMessage() {} func (m *StatusUpdate) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *StatusUpdate) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *StatusUpdate) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *StatusUpdate) GetStatus() *TaskStatus { if m != nil { return m.Status } return nil } func (m *StatusUpdate) GetTimestamp() float64 { if m != nil && m.Timestamp != nil { return *m.Timestamp } return 0 } func (m *StatusUpdate) GetUuid() []byte { if m != nil { return m.Uuid } return nil } func (m *StatusUpdate) GetLatestState() TaskState { if m != nil && m.LatestState != nil { return *m.LatestState } return TaskState_TASK_STAGING } // This message encapsulates how we checkpoint a status update to disk. // NOTE: If type == UPDATE, the 'update' field is required. // NOTE: If type == ACK, the 'uuid' field is required. type StatusUpdateRecord struct { Type *StatusUpdateRecord_Type `protobuf:"varint,1,req,name=type,enum=mesosproto.StatusUpdateRecord_Type" json:"type,omitempty"` Update *StatusUpdate `protobuf:"bytes,2,opt,name=update" json:"update,omitempty"` Uuid []byte `protobuf:"bytes,3,opt,name=uuid" json:"uuid,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *StatusUpdateRecord) Reset() { *m = StatusUpdateRecord{} } func (m *StatusUpdateRecord) String() string { return proto.CompactTextString(m) } func (*StatusUpdateRecord) ProtoMessage() {} func (m *StatusUpdateRecord) GetType() StatusUpdateRecord_Type { if m != nil && m.Type != nil { return *m.Type } return StatusUpdateRecord_UPDATE } func (m *StatusUpdateRecord) GetUpdate() *StatusUpdate { if m != nil { return m.Update } return nil } func (m *StatusUpdateRecord) GetUuid() []byte { if m != nil { return m.Uuid } return nil } type SubmitSchedulerRequest struct { Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *SubmitSchedulerRequest) Reset() { *m = SubmitSchedulerRequest{} } func (m *SubmitSchedulerRequest) String() string { return proto.CompactTextString(m) } func (*SubmitSchedulerRequest) ProtoMessage() {} func (m *SubmitSchedulerRequest) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } type SubmitSchedulerResponse struct { Okay *bool `protobuf:"varint,1,req,name=okay" json:"okay,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *SubmitSchedulerResponse) Reset() { *m = SubmitSchedulerResponse{} } func (m *SubmitSchedulerResponse) String() string { return proto.CompactTextString(m) } func (*SubmitSchedulerResponse) ProtoMessage() {} func (m *SubmitSchedulerResponse) GetOkay() bool { if m != nil && m.Okay != nil { return *m.Okay } return false } type ExecutorToFrameworkMessage struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` FrameworkId *FrameworkID `protobuf:"bytes,2,req,name=framework_id" json:"framework_id,omitempty"` ExecutorId *ExecutorID `protobuf:"bytes,3,req,name=executor_id" json:"executor_id,omitempty"` Data []byte `protobuf:"bytes,4,req,name=data" json:"data,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ExecutorToFrameworkMessage) Reset() { *m = ExecutorToFrameworkMessage{} } func (m *ExecutorToFrameworkMessage) String() string { return proto.CompactTextString(m) } func (*ExecutorToFrameworkMessage) ProtoMessage() {} func (m *ExecutorToFrameworkMessage) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *ExecutorToFrameworkMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *ExecutorToFrameworkMessage) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *ExecutorToFrameworkMessage) GetData() []byte { if m != nil { return m.Data } return nil } type FrameworkToExecutorMessage struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` FrameworkId *FrameworkID `protobuf:"bytes,2,req,name=framework_id" json:"framework_id,omitempty"` ExecutorId *ExecutorID `protobuf:"bytes,3,req,name=executor_id" json:"executor_id,omitempty"` Data []byte `protobuf:"bytes,4,req,name=data" json:"data,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *FrameworkToExecutorMessage) Reset() { *m = FrameworkToExecutorMessage{} } func (m *FrameworkToExecutorMessage) String() string { return proto.CompactTextString(m) } func (*FrameworkToExecutorMessage) ProtoMessage() {} func (m *FrameworkToExecutorMessage) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *FrameworkToExecutorMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *FrameworkToExecutorMessage) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *FrameworkToExecutorMessage) GetData() []byte { if m != nil { return m.Data } return nil } type RegisterFrameworkMessage struct { Framework *FrameworkInfo `protobuf:"bytes,1,req,name=framework" json:"framework,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *RegisterFrameworkMessage) Reset() { *m = RegisterFrameworkMessage{} } func (m *RegisterFrameworkMessage) String() string { return proto.CompactTextString(m) } func (*RegisterFrameworkMessage) ProtoMessage() {} func (m *RegisterFrameworkMessage) GetFramework() *FrameworkInfo { if m != nil { return m.Framework } return nil } type ReregisterFrameworkMessage struct { Framework *FrameworkInfo `protobuf:"bytes,2,req,name=framework" json:"framework,omitempty"` Failover *bool `protobuf:"varint,3,req,name=failover" json:"failover,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ReregisterFrameworkMessage) Reset() { *m = ReregisterFrameworkMessage{} } func (m *ReregisterFrameworkMessage) String() string { return proto.CompactTextString(m) } func (*ReregisterFrameworkMessage) ProtoMessage() {} func (m *ReregisterFrameworkMessage) GetFramework() *FrameworkInfo { if m != nil { return m.Framework } return nil } func (m *ReregisterFrameworkMessage) GetFailover() bool { if m != nil && m.Failover != nil { return *m.Failover } return false } type FrameworkRegisteredMessage struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` MasterInfo *MasterInfo `protobuf:"bytes,2,req,name=master_info" json:"master_info,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *FrameworkRegisteredMessage) Reset() { *m = FrameworkRegisteredMessage{} } func (m *FrameworkRegisteredMessage) String() string { return proto.CompactTextString(m) } func (*FrameworkRegisteredMessage) ProtoMessage() {} func (m *FrameworkRegisteredMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *FrameworkRegisteredMessage) GetMasterInfo() *MasterInfo { if m != nil { return m.MasterInfo } return nil } type FrameworkReregisteredMessage struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` MasterInfo *MasterInfo `protobuf:"bytes,2,req,name=master_info" json:"master_info,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *FrameworkReregisteredMessage) Reset() { *m = FrameworkReregisteredMessage{} } func (m *FrameworkReregisteredMessage) String() string { return proto.CompactTextString(m) } func (*FrameworkReregisteredMessage) ProtoMessage() {} func (m *FrameworkReregisteredMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *FrameworkReregisteredMessage) GetMasterInfo() *MasterInfo { if m != nil { return m.MasterInfo } return nil } type UnregisterFrameworkMessage struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *UnregisterFrameworkMessage) Reset() { *m = UnregisterFrameworkMessage{} } func (m *UnregisterFrameworkMessage) String() string { return proto.CompactTextString(m) } func (*UnregisterFrameworkMessage) ProtoMessage() {} func (m *UnregisterFrameworkMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } type DeactivateFrameworkMessage struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *DeactivateFrameworkMessage) Reset() { *m = DeactivateFrameworkMessage{} } func (m *DeactivateFrameworkMessage) String() string { return proto.CompactTextString(m) } func (*DeactivateFrameworkMessage) ProtoMessage() {} func (m *DeactivateFrameworkMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } type ResourceRequestMessage struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` Requests []*Request `protobuf:"bytes,2,rep,name=requests" json:"requests,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ResourceRequestMessage) Reset() { *m = ResourceRequestMessage{} } func (m *ResourceRequestMessage) String() string { return proto.CompactTextString(m) } func (*ResourceRequestMessage) ProtoMessage() {} func (m *ResourceRequestMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *ResourceRequestMessage) GetRequests() []*Request { if m != nil { return m.Requests } return nil } type ResourceOffersMessage struct { Offers []*Offer `protobuf:"bytes,1,rep,name=offers" json:"offers,omitempty"` Pids []string `protobuf:"bytes,2,rep,name=pids" json:"pids,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ResourceOffersMessage) Reset() { *m = ResourceOffersMessage{} } func (m *ResourceOffersMessage) String() string { return proto.CompactTextString(m) } func (*ResourceOffersMessage) ProtoMessage() {} func (m *ResourceOffersMessage) GetOffers() []*Offer { if m != nil { return m.Offers } return nil } func (m *ResourceOffersMessage) GetPids() []string { if m != nil { return m.Pids } return nil } type LaunchTasksMessage struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` Tasks []*TaskInfo `protobuf:"bytes,3,rep,name=tasks" json:"tasks,omitempty"` Filters *Filters `protobuf:"bytes,5,req,name=filters" json:"filters,omitempty"` OfferIds []*OfferID `protobuf:"bytes,6,rep,name=offer_ids" json:"offer_ids,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *LaunchTasksMessage) Reset() { *m = LaunchTasksMessage{} } func (m *LaunchTasksMessage) String() string { return proto.CompactTextString(m) } func (*LaunchTasksMessage) ProtoMessage() {} func (m *LaunchTasksMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *LaunchTasksMessage) GetTasks() []*TaskInfo { if m != nil { return m.Tasks } return nil } func (m *LaunchTasksMessage) GetFilters() *Filters { if m != nil { return m.Filters } return nil } func (m *LaunchTasksMessage) GetOfferIds() []*OfferID { if m != nil { return m.OfferIds } return nil } type RescindResourceOfferMessage struct { OfferId *OfferID `protobuf:"bytes,1,req,name=offer_id" json:"offer_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *RescindResourceOfferMessage) Reset() { *m = RescindResourceOfferMessage{} } func (m *RescindResourceOfferMessage) String() string { return proto.CompactTextString(m) } func (*RescindResourceOfferMessage) ProtoMessage() {} func (m *RescindResourceOfferMessage) GetOfferId() *OfferID { if m != nil { return m.OfferId } return nil } type ReviveOffersMessage struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ReviveOffersMessage) Reset() { *m = ReviveOffersMessage{} } func (m *ReviveOffersMessage) String() string { return proto.CompactTextString(m) } func (*ReviveOffersMessage) ProtoMessage() {} func (m *ReviveOffersMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } type RunTaskMessage struct { // TODO(karya): Remove framework_id after MESOS-2559 has shipped. FrameworkId *FrameworkID `protobuf:"bytes,1,opt,name=framework_id" json:"framework_id,omitempty"` Framework *FrameworkInfo `protobuf:"bytes,2,req,name=framework" json:"framework,omitempty"` Pid *string `protobuf:"bytes,3,req,name=pid" json:"pid,omitempty"` Task *TaskInfo `protobuf:"bytes,4,req,name=task" json:"task,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *RunTaskMessage) Reset() { *m = RunTaskMessage{} } func (m *RunTaskMessage) String() string { return proto.CompactTextString(m) } func (*RunTaskMessage) ProtoMessage() {} func (m *RunTaskMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *RunTaskMessage) GetFramework() *FrameworkInfo { if m != nil { return m.Framework } return nil } func (m *RunTaskMessage) GetPid() string { if m != nil && m.Pid != nil { return *m.Pid } return "" } func (m *RunTaskMessage) GetTask() *TaskInfo { if m != nil { return m.Task } return nil } type KillTaskMessage struct { // TODO(bmahler): Include the SlaveID here to improve the Master's // ability to respond for non-activated slaves. FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` TaskId *TaskID `protobuf:"bytes,2,req,name=task_id" json:"task_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *KillTaskMessage) Reset() { *m = KillTaskMessage{} } func (m *KillTaskMessage) String() string { return proto.CompactTextString(m) } func (*KillTaskMessage) ProtoMessage() {} func (m *KillTaskMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *KillTaskMessage) GetTaskId() *TaskID { if m != nil { return m.TaskId } return nil } // NOTE: If 'pid' is present, scheduler driver sends an // acknowledgement to the pid. type StatusUpdateMessage struct { Update *StatusUpdate `protobuf:"bytes,1,req,name=update" json:"update,omitempty"` Pid *string `protobuf:"bytes,2,opt,name=pid" json:"pid,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *StatusUpdateMessage) Reset() { *m = StatusUpdateMessage{} } func (m *StatusUpdateMessage) String() string { return proto.CompactTextString(m) } func (*StatusUpdateMessage) ProtoMessage() {} func (m *StatusUpdateMessage) GetUpdate() *StatusUpdate { if m != nil { return m.Update } return nil } func (m *StatusUpdateMessage) GetPid() string { if m != nil && m.Pid != nil { return *m.Pid } return "" } type StatusUpdateAcknowledgementMessage struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` FrameworkId *FrameworkID `protobuf:"bytes,2,req,name=framework_id" json:"framework_id,omitempty"` TaskId *TaskID `protobuf:"bytes,3,req,name=task_id" json:"task_id,omitempty"` Uuid []byte `protobuf:"bytes,4,req,name=uuid" json:"uuid,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *StatusUpdateAcknowledgementMessage) Reset() { *m = StatusUpdateAcknowledgementMessage{} } func (m *StatusUpdateAcknowledgementMessage) String() string { return proto.CompactTextString(m) } func (*StatusUpdateAcknowledgementMessage) ProtoMessage() {} func (m *StatusUpdateAcknowledgementMessage) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *StatusUpdateAcknowledgementMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *StatusUpdateAcknowledgementMessage) GetTaskId() *TaskID { if m != nil { return m.TaskId } return nil } func (m *StatusUpdateAcknowledgementMessage) GetUuid() []byte { if m != nil { return m.Uuid } return nil } type LostSlaveMessage struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *LostSlaveMessage) Reset() { *m = LostSlaveMessage{} } func (m *LostSlaveMessage) String() string { return proto.CompactTextString(m) } func (*LostSlaveMessage) ProtoMessage() {} func (m *LostSlaveMessage) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } // Allows the framework to query the status for non-terminal tasks. // This causes the master to send back the latest task status for // each task in 'statuses', if possible. Tasks that are no longer // known will result in a TASK_LOST update. If statuses is empty, // then the master will send the latest status for each task // currently known. type ReconcileTasksMessage struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` Statuses []*TaskStatus `protobuf:"bytes,2,rep,name=statuses" json:"statuses,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ReconcileTasksMessage) Reset() { *m = ReconcileTasksMessage{} } func (m *ReconcileTasksMessage) String() string { return proto.CompactTextString(m) } func (*ReconcileTasksMessage) ProtoMessage() {} func (m *ReconcileTasksMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *ReconcileTasksMessage) GetStatuses() []*TaskStatus { if m != nil { return m.Statuses } return nil } type FrameworkErrorMessage struct { Message *string `protobuf:"bytes,2,req,name=message" json:"message,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *FrameworkErrorMessage) Reset() { *m = FrameworkErrorMessage{} } func (m *FrameworkErrorMessage) String() string { return proto.CompactTextString(m) } func (*FrameworkErrorMessage) ProtoMessage() {} func (m *FrameworkErrorMessage) GetMessage() string { if m != nil && m.Message != nil { return *m.Message } return "" } type RegisterSlaveMessage struct { Slave *SlaveInfo `protobuf:"bytes,1,req,name=slave" json:"slave,omitempty"` // Resources that are checkpointed by the slave (e.g., persistent // volume or dynamic reservation). Frameworks need to release // checkpointed resources explicitly. CheckpointedResources []*Resource `protobuf:"bytes,3,rep,name=checkpointed_resources" json:"checkpointed_resources,omitempty"` // NOTE: This is a hack for the master to detect the slave's // version. If unset the slave is < 0.21.0. // TODO(bmahler): Do proper versioning: MESOS-986. Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *RegisterSlaveMessage) Reset() { *m = RegisterSlaveMessage{} } func (m *RegisterSlaveMessage) String() string { return proto.CompactTextString(m) } func (*RegisterSlaveMessage) ProtoMessage() {} func (m *RegisterSlaveMessage) GetSlave() *SlaveInfo { if m != nil { return m.Slave } return nil } func (m *RegisterSlaveMessage) GetCheckpointedResources() []*Resource { if m != nil { return m.CheckpointedResources } return nil } func (m *RegisterSlaveMessage) GetVersion() string { if m != nil && m.Version != nil { return *m.Version } return "" } type ReregisterSlaveMessage struct { Slave *SlaveInfo `protobuf:"bytes,2,req,name=slave" json:"slave,omitempty"` // Resources that are checkpointed by the slave (e.g., persistent // volume or dynamic reservation). Frameworks need to release // checkpointed resources explicitly. CheckpointedResources []*Resource `protobuf:"bytes,7,rep,name=checkpointed_resources" json:"checkpointed_resources,omitempty"` ExecutorInfos []*ExecutorInfo `protobuf:"bytes,4,rep,name=executor_infos" json:"executor_infos,omitempty"` Tasks []*Task `protobuf:"bytes,3,rep,name=tasks" json:"tasks,omitempty"` CompletedFrameworks []*Archive_Framework `protobuf:"bytes,5,rep,name=completed_frameworks" json:"completed_frameworks,omitempty"` // NOTE: This is a hack for the master to detect the slave's // version. If unset the slave is < 0.21.0. // TODO(bmahler): Do proper versioning: MESOS-986. Version *string `protobuf:"bytes,6,opt,name=version" json:"version,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ReregisterSlaveMessage) Reset() { *m = ReregisterSlaveMessage{} } func (m *ReregisterSlaveMessage) String() string { return proto.CompactTextString(m) } func (*ReregisterSlaveMessage) ProtoMessage() {} func (m *ReregisterSlaveMessage) GetSlave() *SlaveInfo { if m != nil { return m.Slave } return nil } func (m *ReregisterSlaveMessage) GetCheckpointedResources() []*Resource { if m != nil { return m.CheckpointedResources } return nil } func (m *ReregisterSlaveMessage) GetExecutorInfos() []*ExecutorInfo { if m != nil { return m.ExecutorInfos } return nil } func (m *ReregisterSlaveMessage) GetTasks() []*Task { if m != nil { return m.Tasks } return nil } func (m *ReregisterSlaveMessage) GetCompletedFrameworks() []*Archive_Framework { if m != nil { return m.CompletedFrameworks } return nil } func (m *ReregisterSlaveMessage) GetVersion() string { if m != nil && m.Version != nil { return *m.Version } return "" } type SlaveRegisteredMessage struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` Connection *MasterSlaveConnection `protobuf:"bytes,2,opt,name=connection" json:"connection,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *SlaveRegisteredMessage) Reset() { *m = SlaveRegisteredMessage{} } func (m *SlaveRegisteredMessage) String() string { return proto.CompactTextString(m) } func (*SlaveRegisteredMessage) ProtoMessage() {} func (m *SlaveRegisteredMessage) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *SlaveRegisteredMessage) GetConnection() *MasterSlaveConnection { if m != nil { return m.Connection } return nil } type SlaveReregisteredMessage struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` Reconciliations []*ReconcileTasksMessage `protobuf:"bytes,2,rep,name=reconciliations" json:"reconciliations,omitempty"` Connection *MasterSlaveConnection `protobuf:"bytes,3,opt,name=connection" json:"connection,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *SlaveReregisteredMessage) Reset() { *m = SlaveReregisteredMessage{} } func (m *SlaveReregisteredMessage) String() string { return proto.CompactTextString(m) } func (*SlaveReregisteredMessage) ProtoMessage() {} func (m *SlaveReregisteredMessage) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *SlaveReregisteredMessage) GetReconciliations() []*ReconcileTasksMessage { if m != nil { return m.Reconciliations } return nil } func (m *SlaveReregisteredMessage) GetConnection() *MasterSlaveConnection { if m != nil { return m.Connection } return nil } type UnregisterSlaveMessage struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *UnregisterSlaveMessage) Reset() { *m = UnregisterSlaveMessage{} } func (m *UnregisterSlaveMessage) String() string { return proto.CompactTextString(m) } func (*UnregisterSlaveMessage) ProtoMessage() {} func (m *UnregisterSlaveMessage) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } type MasterSlaveConnection struct { // Product of max_slave_ping_timeouts * slave_ping_timeout. // If no pings are received within the total timeout, // the master will remove the slave. TotalPingTimeoutSeconds *float64 `protobuf:"fixed64,1,opt,name=total_ping_timeout_seconds" json:"total_ping_timeout_seconds,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *MasterSlaveConnection) Reset() { *m = MasterSlaveConnection{} } func (m *MasterSlaveConnection) String() string { return proto.CompactTextString(m) } func (*MasterSlaveConnection) ProtoMessage() {} func (m *MasterSlaveConnection) GetTotalPingTimeoutSeconds() float64 { if m != nil && m.TotalPingTimeoutSeconds != nil { return *m.TotalPingTimeoutSeconds } return 0 } // This message is periodically sent by the master to the slave. // If the slave is connected to the master, "connected" is true. type PingSlaveMessage struct { Connected *bool `protobuf:"varint,1,req,name=connected" json:"connected,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *PingSlaveMessage) Reset() { *m = PingSlaveMessage{} } func (m *PingSlaveMessage) String() string { return proto.CompactTextString(m) } func (*PingSlaveMessage) ProtoMessage() {} func (m *PingSlaveMessage) GetConnected() bool { if m != nil && m.Connected != nil { return *m.Connected } return false } // This message is sent by the slave to the master in response to the // PingSlaveMessage. type PongSlaveMessage struct { XXX_unrecognized []byte `json:"-"` } func (m *PongSlaveMessage) Reset() { *m = PongSlaveMessage{} } func (m *PongSlaveMessage) String() string { return proto.CompactTextString(m) } func (*PongSlaveMessage) ProtoMessage() {} // Tells a slave to shut down all executors of the given framework. type ShutdownFrameworkMessage struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ShutdownFrameworkMessage) Reset() { *m = ShutdownFrameworkMessage{} } func (m *ShutdownFrameworkMessage) String() string { return proto.CompactTextString(m) } func (*ShutdownFrameworkMessage) ProtoMessage() {} func (m *ShutdownFrameworkMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } // Tells a slave (and consequently executor) to shutdown an executor. type ShutdownExecutorMessage struct { // TODO(vinod): Make these fields required. These are made optional // for backwards compatibility between 0.23.0 slave and pre 0.23.0 // executor driver. ExecutorId *ExecutorID `protobuf:"bytes,1,opt,name=executor_id" json:"executor_id,omitempty"` FrameworkId *FrameworkID `protobuf:"bytes,2,opt,name=framework_id" json:"framework_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ShutdownExecutorMessage) Reset() { *m = ShutdownExecutorMessage{} } func (m *ShutdownExecutorMessage) String() string { return proto.CompactTextString(m) } func (*ShutdownExecutorMessage) ProtoMessage() {} func (m *ShutdownExecutorMessage) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *ShutdownExecutorMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } type UpdateFrameworkMessage struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` Pid *string `protobuf:"bytes,2,req,name=pid" json:"pid,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *UpdateFrameworkMessage) Reset() { *m = UpdateFrameworkMessage{} } func (m *UpdateFrameworkMessage) String() string { return proto.CompactTextString(m) } func (*UpdateFrameworkMessage) ProtoMessage() {} func (m *UpdateFrameworkMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *UpdateFrameworkMessage) GetPid() string { if m != nil && m.Pid != nil { return *m.Pid } return "" } // This message is sent to the slave whenever there is an update of // the resources that need to be checkpointed (e.g., persistent volume // or dynamic reservation). type CheckpointResourcesMessage struct { Resources []*Resource `protobuf:"bytes,1,rep,name=resources" json:"resources,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CheckpointResourcesMessage) Reset() { *m = CheckpointResourcesMessage{} } func (m *CheckpointResourcesMessage) String() string { return proto.CompactTextString(m) } func (*CheckpointResourcesMessage) ProtoMessage() {} func (m *CheckpointResourcesMessage) GetResources() []*Resource { if m != nil { return m.Resources } return nil } // This message is sent by the slave to the master to inform the // master about the total amount of oversubscribed (allocated and // allocatable) resources. type UpdateSlaveMessage struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` OversubscribedResources []*Resource `protobuf:"bytes,2,rep,name=oversubscribed_resources" json:"oversubscribed_resources,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *UpdateSlaveMessage) Reset() { *m = UpdateSlaveMessage{} } func (m *UpdateSlaveMessage) String() string { return proto.CompactTextString(m) } func (*UpdateSlaveMessage) ProtoMessage() {} func (m *UpdateSlaveMessage) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *UpdateSlaveMessage) GetOversubscribedResources() []*Resource { if m != nil { return m.OversubscribedResources } return nil } type RegisterExecutorMessage struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` ExecutorId *ExecutorID `protobuf:"bytes,2,req,name=executor_id" json:"executor_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *RegisterExecutorMessage) Reset() { *m = RegisterExecutorMessage{} } func (m *RegisterExecutorMessage) String() string { return proto.CompactTextString(m) } func (*RegisterExecutorMessage) ProtoMessage() {} func (m *RegisterExecutorMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *RegisterExecutorMessage) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } type ExecutorRegisteredMessage struct { ExecutorInfo *ExecutorInfo `protobuf:"bytes,2,req,name=executor_info" json:"executor_info,omitempty"` FrameworkId *FrameworkID `protobuf:"bytes,3,req,name=framework_id" json:"framework_id,omitempty"` FrameworkInfo *FrameworkInfo `protobuf:"bytes,4,req,name=framework_info" json:"framework_info,omitempty"` SlaveId *SlaveID `protobuf:"bytes,5,req,name=slave_id" json:"slave_id,omitempty"` SlaveInfo *SlaveInfo `protobuf:"bytes,6,req,name=slave_info" json:"slave_info,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ExecutorRegisteredMessage) Reset() { *m = ExecutorRegisteredMessage{} } func (m *ExecutorRegisteredMessage) String() string { return proto.CompactTextString(m) } func (*ExecutorRegisteredMessage) ProtoMessage() {} func (m *ExecutorRegisteredMessage) GetExecutorInfo() *ExecutorInfo { if m != nil { return m.ExecutorInfo } return nil } func (m *ExecutorRegisteredMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *ExecutorRegisteredMessage) GetFrameworkInfo() *FrameworkInfo { if m != nil { return m.FrameworkInfo } return nil } func (m *ExecutorRegisteredMessage) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *ExecutorRegisteredMessage) GetSlaveInfo() *SlaveInfo { if m != nil { return m.SlaveInfo } return nil } type ExecutorReregisteredMessage struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` SlaveInfo *SlaveInfo `protobuf:"bytes,2,req,name=slave_info" json:"slave_info,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ExecutorReregisteredMessage) Reset() { *m = ExecutorReregisteredMessage{} } func (m *ExecutorReregisteredMessage) String() string { return proto.CompactTextString(m) } func (*ExecutorReregisteredMessage) ProtoMessage() {} func (m *ExecutorReregisteredMessage) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *ExecutorReregisteredMessage) GetSlaveInfo() *SlaveInfo { if m != nil { return m.SlaveInfo } return nil } type ExitedExecutorMessage struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` FrameworkId *FrameworkID `protobuf:"bytes,2,req,name=framework_id" json:"framework_id,omitempty"` ExecutorId *ExecutorID `protobuf:"bytes,3,req,name=executor_id" json:"executor_id,omitempty"` Status *int32 `protobuf:"varint,4,req,name=status" json:"status,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ExitedExecutorMessage) Reset() { *m = ExitedExecutorMessage{} } func (m *ExitedExecutorMessage) String() string { return proto.CompactTextString(m) } func (*ExitedExecutorMessage) ProtoMessage() {} func (m *ExitedExecutorMessage) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *ExitedExecutorMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *ExitedExecutorMessage) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *ExitedExecutorMessage) GetStatus() int32 { if m != nil && m.Status != nil { return *m.Status } return 0 } type ReconnectExecutorMessage struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ReconnectExecutorMessage) Reset() { *m = ReconnectExecutorMessage{} } func (m *ReconnectExecutorMessage) String() string { return proto.CompactTextString(m) } func (*ReconnectExecutorMessage) ProtoMessage() {} func (m *ReconnectExecutorMessage) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } type ReregisterExecutorMessage struct { ExecutorId *ExecutorID `protobuf:"bytes,1,req,name=executor_id" json:"executor_id,omitempty"` FrameworkId *FrameworkID `protobuf:"bytes,2,req,name=framework_id" json:"framework_id,omitempty"` Tasks []*TaskInfo `protobuf:"bytes,3,rep,name=tasks" json:"tasks,omitempty"` Updates []*StatusUpdate `protobuf:"bytes,4,rep,name=updates" json:"updates,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ReregisterExecutorMessage) Reset() { *m = ReregisterExecutorMessage{} } func (m *ReregisterExecutorMessage) String() string { return proto.CompactTextString(m) } func (*ReregisterExecutorMessage) ProtoMessage() {} func (m *ReregisterExecutorMessage) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *ReregisterExecutorMessage) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *ReregisterExecutorMessage) GetTasks() []*TaskInfo { if m != nil { return m.Tasks } return nil } func (m *ReregisterExecutorMessage) GetUpdates() []*StatusUpdate { if m != nil { return m.Updates } return nil } type ShutdownMessage struct { Message *string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ShutdownMessage) Reset() { *m = ShutdownMessage{} } func (m *ShutdownMessage) String() string { return proto.CompactTextString(m) } func (*ShutdownMessage) ProtoMessage() {} func (m *ShutdownMessage) GetMessage() string { if m != nil && m.Message != nil { return *m.Message } return "" } // * // Describes Completed Frameworks, etc. for archival. type Archive struct { Frameworks []*Archive_Framework `protobuf:"bytes,1,rep,name=frameworks" json:"frameworks,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Archive) Reset() { *m = Archive{} } func (m *Archive) String() string { return proto.CompactTextString(m) } func (*Archive) ProtoMessage() {} func (m *Archive) GetFrameworks() []*Archive_Framework { if m != nil { return m.Frameworks } return nil } type Archive_Framework struct { FrameworkInfo *FrameworkInfo `protobuf:"bytes,1,req,name=framework_info" json:"framework_info,omitempty"` Pid *string `protobuf:"bytes,2,opt,name=pid" json:"pid,omitempty"` Tasks []*Task `protobuf:"bytes,3,rep,name=tasks" json:"tasks,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Archive_Framework) Reset() { *m = Archive_Framework{} } func (m *Archive_Framework) String() string { return proto.CompactTextString(m) } func (*Archive_Framework) ProtoMessage() {} func (m *Archive_Framework) GetFrameworkInfo() *FrameworkInfo { if m != nil { return m.FrameworkInfo } return nil } func (m *Archive_Framework) GetPid() string { if m != nil && m.Pid != nil { return *m.Pid } return "" } func (m *Archive_Framework) GetTasks() []*Task { if m != nil { return m.Tasks } return nil } // Message describing task current health status that is sent by // the task health checker to the command executor. // The command executor reports the task status back to the // on each receive. If the health checker configured faiure // condition meets, then kill_task flag will be set to true which // the executor on message receive will kill the task. type TaskHealthStatus struct { TaskId *TaskID `protobuf:"bytes,1,req,name=task_id" json:"task_id,omitempty"` Healthy *bool `protobuf:"varint,2,req,name=healthy" json:"healthy,omitempty"` // Flag to initiate task kill. KillTask *bool `protobuf:"varint,3,opt,name=kill_task,def=0" json:"kill_task,omitempty"` // Number of consecutive counts in current status. // This will not be populated if task is healthy. ConsecutiveFailures *int32 `protobuf:"varint,4,opt,name=consecutive_failures" json:"consecutive_failures,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *TaskHealthStatus) Reset() { *m = TaskHealthStatus{} } func (m *TaskHealthStatus) String() string { return proto.CompactTextString(m) } func (*TaskHealthStatus) ProtoMessage() {} const Default_TaskHealthStatus_KillTask bool = false func (m *TaskHealthStatus) GetTaskId() *TaskID { if m != nil { return m.TaskId } return nil } func (m *TaskHealthStatus) GetHealthy() bool { if m != nil && m.Healthy != nil { return *m.Healthy } return false } func (m *TaskHealthStatus) GetKillTask() bool { if m != nil && m.KillTask != nil { return *m.KillTask } return Default_TaskHealthStatus_KillTask } func (m *TaskHealthStatus) GetConsecutiveFailures() int32 { if m != nil && m.ConsecutiveFailures != nil { return *m.ConsecutiveFailures } return 0 } // * // Message to signal completion of an event within a module. type HookExecuted struct { Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *HookExecuted) Reset() { *m = HookExecuted{} } func (m *HookExecuted) String() string { return proto.CompactTextString(m) } func (*HookExecuted) ProtoMessage() {} func (m *HookExecuted) GetModule() string { if m != nil && m.Module != nil { return *m.Module } return "" } func init() { proto.RegisterEnum("mesosproto.StatusUpdateRecord_Type", StatusUpdateRecord_Type_name, StatusUpdateRecord_Type_value) } mesos-go-0.0.1/mesosproto/messages.proto000066400000000000000000000277401257601144100203620ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 mesosproto; import "mesos.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; // TODO(benh): Provide comments for each of these messages. Also, // consider splitting these messages into different "packages" which // represent which messages get handled by which components (e.g., the // "mesos.internal.executor" package includes messages that the // executor handles). // TODO(benh): It would be great if this could just be a // TaskInfo wherever it gets used! However, doing so would // require adding the framework_id field, the executor_id field, and // the state field into TaskInfo though (or send them another // way). Also, one performance reason why we don't do that now is // because storing whatever data is coupled with a TaskInfo // could be large and unnecessary. // TODO(bmahler): Add executor_uuid here, and send it to the master. This will // allow us to expose executor work directories for tasks in the webui when // looking from the master level. Currently only the slave knows which run the // task belongs to. message Task { required string name = 1; required TaskID task_id = 2; required FrameworkID framework_id = 3; optional ExecutorID executor_id = 4; required SlaveID slave_id = 5; required TaskState state = 6; // Latest state of the task. repeated Resource resources = 7; repeated TaskStatus statuses = 8; // These fields correspond to the state and uuid of the latest // status update forwarded to the master. // NOTE: Either both the fields must be set or both must be unset. optional TaskState status_update_state = 9; optional bytes status_update_uuid = 10; optional Labels labels = 11; // Service discovery information for the task. It is not interpreted // or acted upon by Mesos. It is up to a service discovery system // to use this information as needed and to handle tasks without // service discovery information. optional DiscoveryInfo discovery = 12; } // TODO(vinod): Create a new UUID message type. message StatusUpdate { required FrameworkID framework_id = 1; optional ExecutorID executor_id = 2; optional SlaveID slave_id = 3; required TaskStatus status = 4; required double timestamp = 5; // This is being deprecated in favor of TaskStatus.uuid. In 0.23.0, // we set the TaskStatus 'uuid' in the executor driver for all // retryable status updates. optional bytes uuid = 6; // This corresponds to the latest state of the task according to the // slave. Note that this state might be different than the state in // 'status' because status update manager queues updates. In other // words, 'status' corresponds to the update at top of the queue and // 'latest_state' corresponds to the update at bottom of the queue. optional TaskState latest_state = 7; } // This message encapsulates how we checkpoint a status update to disk. // NOTE: If type == UPDATE, the 'update' field is required. // NOTE: If type == ACK, the 'uuid' field is required. message StatusUpdateRecord { enum Type { UPDATE = 0; ACK = 1; } required Type type = 1; optional StatusUpdate update = 2; optional bytes uuid = 3; } message SubmitSchedulerRequest { required string name = 1; } message SubmitSchedulerResponse { required bool okay = 1; } message ExecutorToFrameworkMessage { required SlaveID slave_id = 1; required FrameworkID framework_id = 2; required ExecutorID executor_id = 3; required bytes data = 4; } message FrameworkToExecutorMessage { required SlaveID slave_id = 1; required FrameworkID framework_id = 2; required ExecutorID executor_id = 3; required bytes data = 4; } message RegisterFrameworkMessage { required FrameworkInfo framework = 1; } message ReregisterFrameworkMessage { required FrameworkInfo framework = 2; required bool failover = 3; } message FrameworkRegisteredMessage { required FrameworkID framework_id = 1; required MasterInfo master_info = 2; } message FrameworkReregisteredMessage { required FrameworkID framework_id = 1; required MasterInfo master_info = 2; } message UnregisterFrameworkMessage { required FrameworkID framework_id = 1; } message DeactivateFrameworkMessage { required FrameworkID framework_id = 1; } message ResourceRequestMessage { required FrameworkID framework_id = 1; repeated Request requests = 2; } message ResourceOffersMessage { repeated Offer offers = 1; repeated string pids = 2; } message LaunchTasksMessage { required FrameworkID framework_id = 1; repeated TaskInfo tasks = 3; required Filters filters = 5; repeated OfferID offer_ids = 6; } message RescindResourceOfferMessage { required OfferID offer_id = 1; } message ReviveOffersMessage { required FrameworkID framework_id = 1; } message RunTaskMessage { // TODO(karya): Remove framework_id after MESOS-2559 has shipped. optional FrameworkID framework_id = 1 [deprecated = true]; required FrameworkInfo framework = 2; required string pid = 3; required TaskInfo task = 4; } message KillTaskMessage { // TODO(bmahler): Include the SlaveID here to improve the Master's // ability to respond for non-activated slaves. required FrameworkID framework_id = 1; required TaskID task_id = 2; } // NOTE: If 'pid' is present, scheduler driver sends an // acknowledgement to the pid. message StatusUpdateMessage { required StatusUpdate update = 1; optional string pid = 2; } message StatusUpdateAcknowledgementMessage { required SlaveID slave_id = 1; required FrameworkID framework_id = 2; required TaskID task_id = 3; required bytes uuid = 4; } message LostSlaveMessage { required SlaveID slave_id = 1; } // Allows the framework to query the status for non-terminal tasks. // This causes the master to send back the latest task status for // each task in 'statuses', if possible. Tasks that are no longer // known will result in a TASK_LOST update. If statuses is empty, // then the master will send the latest status for each task // currently known. message ReconcileTasksMessage { required FrameworkID framework_id = 1; repeated TaskStatus statuses = 2; // Should be non-terminal only. } message FrameworkErrorMessage { required string message = 2; } message RegisterSlaveMessage { required SlaveInfo slave = 1; // Resources that are checkpointed by the slave (e.g., persistent // volume or dynamic reservation). Frameworks need to release // checkpointed resources explicitly. repeated Resource checkpointed_resources = 3; // NOTE: This is a hack for the master to detect the slave's // version. If unset the slave is < 0.21.0. // TODO(bmahler): Do proper versioning: MESOS-986. optional string version = 2; } message ReregisterSlaveMessage { required SlaveInfo slave = 2; // Resources that are checkpointed by the slave (e.g., persistent // volume or dynamic reservation). Frameworks need to release // checkpointed resources explicitly. repeated Resource checkpointed_resources = 7; repeated ExecutorInfo executor_infos = 4; repeated Task tasks = 3; repeated Archive.Framework completed_frameworks = 5; // NOTE: This is a hack for the master to detect the slave's // version. If unset the slave is < 0.21.0. // TODO(bmahler): Do proper versioning: MESOS-986. optional string version = 6; } message SlaveRegisteredMessage { required SlaveID slave_id = 1; optional MasterSlaveConnection connection = 2; } message SlaveReregisteredMessage { required SlaveID slave_id = 1; repeated ReconcileTasksMessage reconciliations = 2; optional MasterSlaveConnection connection = 3; } message UnregisterSlaveMessage { required SlaveID slave_id = 1; } message MasterSlaveConnection { // Product of max_slave_ping_timeouts * slave_ping_timeout. // If no pings are received within the total timeout, // the master will remove the slave. optional double total_ping_timeout_seconds = 1; } // This message is periodically sent by the master to the slave. // If the slave is connected to the master, "connected" is true. message PingSlaveMessage { required bool connected = 1; } // This message is sent by the slave to the master in response to the // PingSlaveMessage. message PongSlaveMessage {} // Tells a slave to shut down all executors of the given framework. message ShutdownFrameworkMessage { required FrameworkID framework_id = 1; } // Tells a slave (and consequently executor) to shutdown an executor. message ShutdownExecutorMessage { // TODO(vinod): Make these fields required. These are made optional // for backwards compatibility between 0.23.0 slave and pre 0.23.0 // executor driver. optional ExecutorID executor_id = 1; optional FrameworkID framework_id = 2; } message UpdateFrameworkMessage { required FrameworkID framework_id = 1; required string pid = 2; } // This message is sent to the slave whenever there is an update of // the resources that need to be checkpointed (e.g., persistent volume // or dynamic reservation). message CheckpointResourcesMessage { repeated Resource resources = 1; } // This message is sent by the slave to the master to inform the // master about the total amount of oversubscribed (allocated and // allocatable) resources. message UpdateSlaveMessage { required SlaveID slave_id = 1; repeated Resource oversubscribed_resources = 2; } message RegisterExecutorMessage { required FrameworkID framework_id = 1; required ExecutorID executor_id = 2; } message ExecutorRegisteredMessage { required ExecutorInfo executor_info = 2; required FrameworkID framework_id = 3; required FrameworkInfo framework_info = 4; required SlaveID slave_id = 5; required SlaveInfo slave_info = 6; } message ExecutorReregisteredMessage { required SlaveID slave_id = 1; required SlaveInfo slave_info = 2; } message ExitedExecutorMessage { required SlaveID slave_id = 1; required FrameworkID framework_id = 2; required ExecutorID executor_id = 3; required int32 status = 4; } message ReconnectExecutorMessage { required SlaveID slave_id = 1; } message ReregisterExecutorMessage { required ExecutorID executor_id = 1; required FrameworkID framework_id = 2; repeated TaskInfo tasks = 3; repeated StatusUpdate updates = 4; } message ShutdownMessage { optional string message = 1; } // TODO(adam-mesos): Move this to an 'archive' package. /** * Describes Completed Frameworks, etc. for archival. */ message Archive { message Framework { required FrameworkInfo framework_info = 1; optional string pid = 2; repeated Task tasks = 3; } repeated Framework frameworks = 1; } // Message describing task current health status that is sent by // the task health checker to the command executor. // The command executor reports the task status back to the // on each receive. If the health checker configured faiure // condition meets, then kill_task flag will be set to true which // the executor on message receive will kill the task. message TaskHealthStatus { required TaskID task_id = 1; required bool healthy = 2; // Flag to initiate task kill. optional bool kill_task = 3 [default = false]; // Number of consecutive counts in current status. // This will not be populated if task is healthy. optional int32 consecutive_failures = 4; } /** * Message to signal completion of an event within a module. */ message HookExecuted { optional string module = 1; } mesos-go-0.0.1/mesosproto/registry.pb.go000066400000000000000000000046241257601144100202610ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: registry.proto // DO NOT EDIT! package mesosproto import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf type Registry struct { // Most recent leading master. Master *Registry_Master `protobuf:"bytes,1,opt,name=master" json:"master,omitempty"` // All admitted slaves. Slaves *Registry_Slaves `protobuf:"bytes,2,opt,name=slaves" json:"slaves,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Registry) Reset() { *m = Registry{} } func (m *Registry) String() string { return proto.CompactTextString(m) } func (*Registry) ProtoMessage() {} func (m *Registry) GetMaster() *Registry_Master { if m != nil { return m.Master } return nil } func (m *Registry) GetSlaves() *Registry_Slaves { if m != nil { return m.Slaves } return nil } type Registry_Master struct { Info *MasterInfo `protobuf:"bytes,1,req,name=info" json:"info,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Registry_Master) Reset() { *m = Registry_Master{} } func (m *Registry_Master) String() string { return proto.CompactTextString(m) } func (*Registry_Master) ProtoMessage() {} func (m *Registry_Master) GetInfo() *MasterInfo { if m != nil { return m.Info } return nil } type Registry_Slave struct { Info *SlaveInfo `protobuf:"bytes,1,req,name=info" json:"info,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Registry_Slave) Reset() { *m = Registry_Slave{} } func (m *Registry_Slave) String() string { return proto.CompactTextString(m) } func (*Registry_Slave) ProtoMessage() {} func (m *Registry_Slave) GetInfo() *SlaveInfo { if m != nil { return m.Info } return nil } type Registry_Slaves struct { Slaves []*Registry_Slave `protobuf:"bytes,1,rep,name=slaves" json:"slaves,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Registry_Slaves) Reset() { *m = Registry_Slaves{} } func (m *Registry_Slaves) String() string { return proto.CompactTextString(m) } func (*Registry_Slaves) ProtoMessage() {} func (m *Registry_Slaves) GetSlaves() []*Registry_Slave { if m != nil { return m.Slaves } return nil } mesos-go-0.0.1/mesosproto/registry.proto000066400000000000000000000023021257601144100204060ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 mesosproto; import "mesos.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; message Registry { message Master { required MasterInfo info = 1; } message Slave { required SlaveInfo info = 1; } message Slaves { repeated Slave slaves = 1; } // Most recent leading master. optional Master master = 1; // All admitted slaves. optional Slaves slaves = 2; } mesos-go-0.0.1/mesosproto/scheduler.pb.go000066400000000000000000000576041257601144100203750ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: scheduler.proto // DO NOT EDIT! package mesosproto import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // Possible event types, followed by message definitions if // applicable. type Event_Type int32 const ( Event_SUBSCRIBED Event_Type = 1 Event_OFFERS Event_Type = 2 Event_RESCIND Event_Type = 3 Event_UPDATE Event_Type = 4 Event_MESSAGE Event_Type = 5 Event_FAILURE Event_Type = 6 Event_ERROR Event_Type = 7 ) var Event_Type_name = map[int32]string{ 1: "SUBSCRIBED", 2: "OFFERS", 3: "RESCIND", 4: "UPDATE", 5: "MESSAGE", 6: "FAILURE", 7: "ERROR", } var Event_Type_value = map[string]int32{ "SUBSCRIBED": 1, "OFFERS": 2, "RESCIND": 3, "UPDATE": 4, "MESSAGE": 5, "FAILURE": 6, "ERROR": 7, } func (x Event_Type) Enum() *Event_Type { p := new(Event_Type) *p = x return p } func (x Event_Type) String() string { return proto.EnumName(Event_Type_name, int32(x)) } func (x *Event_Type) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(Event_Type_value, data, "Event_Type") if err != nil { return err } *x = Event_Type(value) return nil } // Possible call types, followed by message definitions if // applicable. type Call_Type int32 const ( Call_SUBSCRIBE Call_Type = 1 Call_TEARDOWN Call_Type = 2 Call_ACCEPT Call_Type = 3 Call_DECLINE Call_Type = 4 Call_REVIVE Call_Type = 5 Call_KILL Call_Type = 6 Call_SHUTDOWN Call_Type = 7 Call_ACKNOWLEDGE Call_Type = 8 Call_RECONCILE Call_Type = 9 Call_MESSAGE Call_Type = 10 ) var Call_Type_name = map[int32]string{ 1: "SUBSCRIBE", 2: "TEARDOWN", 3: "ACCEPT", 4: "DECLINE", 5: "REVIVE", 6: "KILL", 7: "SHUTDOWN", 8: "ACKNOWLEDGE", 9: "RECONCILE", 10: "MESSAGE", } var Call_Type_value = map[string]int32{ "SUBSCRIBE": 1, "TEARDOWN": 2, "ACCEPT": 3, "DECLINE": 4, "REVIVE": 5, "KILL": 6, "SHUTDOWN": 7, "ACKNOWLEDGE": 8, "RECONCILE": 9, "MESSAGE": 10, } func (x Call_Type) Enum() *Call_Type { p := new(Call_Type) *p = x return p } func (x Call_Type) String() string { return proto.EnumName(Call_Type_name, int32(x)) } func (x *Call_Type) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(Call_Type_value, data, "Call_Type") if err != nil { return err } *x = Call_Type(value) return nil } // * // Scheduler event API. // // An event is described using the standard protocol buffer "union" // trick, see: // https://developers.google.com/protocol-buffers/docs/techniques#union. type Event struct { // Type of the event, indicates which optional field below should be // present if that type has a nested message definition. Type *Event_Type `protobuf:"varint,1,req,name=type,enum=mesosproto.Event_Type" json:"type,omitempty"` Subscribed *Event_Subscribed `protobuf:"bytes,2,opt,name=subscribed" json:"subscribed,omitempty"` Offers *Event_Offers `protobuf:"bytes,3,opt,name=offers" json:"offers,omitempty"` Rescind *Event_Rescind `protobuf:"bytes,4,opt,name=rescind" json:"rescind,omitempty"` Update *Event_Update `protobuf:"bytes,5,opt,name=update" json:"update,omitempty"` Message *Event_Message `protobuf:"bytes,6,opt,name=message" json:"message,omitempty"` Failure *Event_Failure `protobuf:"bytes,7,opt,name=failure" json:"failure,omitempty"` Error *Event_Error `protobuf:"bytes,8,opt,name=error" json:"error,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Event) Reset() { *m = Event{} } func (m *Event) String() string { return proto.CompactTextString(m) } func (*Event) ProtoMessage() {} func (m *Event) GetType() Event_Type { if m != nil && m.Type != nil { return *m.Type } return Event_SUBSCRIBED } func (m *Event) GetSubscribed() *Event_Subscribed { if m != nil { return m.Subscribed } return nil } func (m *Event) GetOffers() *Event_Offers { if m != nil { return m.Offers } return nil } func (m *Event) GetRescind() *Event_Rescind { if m != nil { return m.Rescind } return nil } func (m *Event) GetUpdate() *Event_Update { if m != nil { return m.Update } return nil } func (m *Event) GetMessage() *Event_Message { if m != nil { return m.Message } return nil } func (m *Event) GetFailure() *Event_Failure { if m != nil { return m.Failure } return nil } func (m *Event) GetError() *Event_Error { if m != nil { return m.Error } return nil } // First event received when the scheduler subscribes. type Event_Subscribed struct { FrameworkId *FrameworkID `protobuf:"bytes,1,req,name=framework_id" json:"framework_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Event_Subscribed) Reset() { *m = Event_Subscribed{} } func (m *Event_Subscribed) String() string { return proto.CompactTextString(m) } func (*Event_Subscribed) ProtoMessage() {} func (m *Event_Subscribed) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } // Received whenever there are new resources that are offered to the // scheduler. Each offer corresponds to a set of resources on a // slave. Until the scheduler accepts or declines an offer the // resources are considered allocated to the scheduler. type Event_Offers struct { Offers []*Offer `protobuf:"bytes,1,rep,name=offers" json:"offers,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Event_Offers) Reset() { *m = Event_Offers{} } func (m *Event_Offers) String() string { return proto.CompactTextString(m) } func (*Event_Offers) ProtoMessage() {} func (m *Event_Offers) GetOffers() []*Offer { if m != nil { return m.Offers } return nil } // Received when a particular offer is no longer valid (e.g., the // slave corresponding to the offer has been removed) and hence // needs to be rescinded. Any future calls ('Accept' / 'Decline') made // by the scheduler regarding this offer will be invalid. type Event_Rescind struct { OfferId *OfferID `protobuf:"bytes,1,req,name=offer_id" json:"offer_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Event_Rescind) Reset() { *m = Event_Rescind{} } func (m *Event_Rescind) String() string { return proto.CompactTextString(m) } func (*Event_Rescind) ProtoMessage() {} func (m *Event_Rescind) GetOfferId() *OfferID { if m != nil { return m.OfferId } return nil } // Received whenever there is a status update that is generated by // the executor or slave or master. Status updates should be used by // executors to reliably communicate the status of the tasks that // they manage. It is crucial that a terminal update (see TaskState // in mesos.proto) is sent by the executor as soon as the task // terminates, in order for Mesos to release the resources allocated // to the task. It is also the responsibility of the scheduler to // explicitly acknowledge the receipt of a status update. See // 'Acknowledge' in the 'Call' section below for the semantics. type Event_Update struct { Status *TaskStatus `protobuf:"bytes,1,req,name=status" json:"status,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Event_Update) Reset() { *m = Event_Update{} } func (m *Event_Update) String() string { return proto.CompactTextString(m) } func (*Event_Update) ProtoMessage() {} func (m *Event_Update) GetStatus() *TaskStatus { if m != nil { return m.Status } return nil } // Received when a custom message generated by the executor is // forwarded by the master. Note that this message is not // interpreted by Mesos and is only forwarded (without reliability // guarantees) to the scheduler. It is up to the executor to retry // if the message is dropped for any reason. type Event_Message struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` ExecutorId *ExecutorID `protobuf:"bytes,2,req,name=executor_id" json:"executor_id,omitempty"` Data []byte `protobuf:"bytes,3,req,name=data" json:"data,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Event_Message) Reset() { *m = Event_Message{} } func (m *Event_Message) String() string { return proto.CompactTextString(m) } func (*Event_Message) ProtoMessage() {} func (m *Event_Message) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *Event_Message) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *Event_Message) GetData() []byte { if m != nil { return m.Data } return nil } // Received when a slave is removed from the cluster (e.g., failed // health checks) or when an executor is terminated. Note that, this // event coincides with receipt of terminal UPDATE events for any // active tasks belonging to the slave or executor and receipt of // 'Rescind' events for any outstanding offers belonging to the // slave. Note that there is no guaranteed order between the // 'Failure', 'Update' and 'Rescind' events when a slave or executor // is removed. // TODO(vinod): Consider splitting the lost slave and terminated // executor into separate events and ensure it's reliably generated. type Event_Failure struct { SlaveId *SlaveID `protobuf:"bytes,1,opt,name=slave_id" json:"slave_id,omitempty"` // If this was just a failure of an executor on a slave then // 'executor_id' will be set and possibly 'status' (if we were // able to determine the exit status). ExecutorId *ExecutorID `protobuf:"bytes,2,opt,name=executor_id" json:"executor_id,omitempty"` Status *int32 `protobuf:"varint,3,opt,name=status" json:"status,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Event_Failure) Reset() { *m = Event_Failure{} } func (m *Event_Failure) String() string { return proto.CompactTextString(m) } func (*Event_Failure) ProtoMessage() {} func (m *Event_Failure) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *Event_Failure) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *Event_Failure) GetStatus() int32 { if m != nil && m.Status != nil { return *m.Status } return 0 } // Received when an invalid framework (e.g., unauthenticated, // unauthorized) attempts to subscribe with the master. Error can // also be received if scheduler sends invalid Calls (e.g., not // properly initialized). // TODO(vinod): Remove this once the old scheduler driver is no // longer supported. With HTTP API all errors will be signaled via // HTTP response codes. type Event_Error struct { Message *string `protobuf:"bytes,1,req,name=message" json:"message,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Event_Error) Reset() { *m = Event_Error{} } func (m *Event_Error) String() string { return proto.CompactTextString(m) } func (*Event_Error) ProtoMessage() {} func (m *Event_Error) GetMessage() string { if m != nil && m.Message != nil { return *m.Message } return "" } // * // Scheduler call API. // // Like Event, a Call is described using the standard protocol buffer // "union" trick (see above). type Call struct { // Identifies who generated this call. Master assigns a framework id // when a new scheduler subscribes for the first time. Once assigned, // the scheduler must set the 'framework_id' here and within its // FrameworkInfo (in any further 'Subscribe' calls). This allows the // master to identify a scheduler correctly across disconnections, // failovers, etc. FrameworkId *FrameworkID `protobuf:"bytes,1,opt,name=framework_id" json:"framework_id,omitempty"` // Type of the call, indicates which optional field below should be // present if that type has a nested message definition. Type *Call_Type `protobuf:"varint,2,req,name=type,enum=mesosproto.Call_Type" json:"type,omitempty"` Subscribe *Call_Subscribe `protobuf:"bytes,3,opt,name=subscribe" json:"subscribe,omitempty"` Accept *Call_Accept `protobuf:"bytes,4,opt,name=accept" json:"accept,omitempty"` Decline *Call_Decline `protobuf:"bytes,5,opt,name=decline" json:"decline,omitempty"` Kill *Call_Kill `protobuf:"bytes,6,opt,name=kill" json:"kill,omitempty"` Shutdown *Call_Shutdown `protobuf:"bytes,7,opt,name=shutdown" json:"shutdown,omitempty"` Acknowledge *Call_Acknowledge `protobuf:"bytes,8,opt,name=acknowledge" json:"acknowledge,omitempty"` Reconcile *Call_Reconcile `protobuf:"bytes,9,opt,name=reconcile" json:"reconcile,omitempty"` Message *Call_Message `protobuf:"bytes,10,opt,name=message" json:"message,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Call) Reset() { *m = Call{} } func (m *Call) String() string { return proto.CompactTextString(m) } func (*Call) ProtoMessage() {} func (m *Call) GetFrameworkId() *FrameworkID { if m != nil { return m.FrameworkId } return nil } func (m *Call) GetType() Call_Type { if m != nil && m.Type != nil { return *m.Type } return Call_SUBSCRIBE } func (m *Call) GetSubscribe() *Call_Subscribe { if m != nil { return m.Subscribe } return nil } func (m *Call) GetAccept() *Call_Accept { if m != nil { return m.Accept } return nil } func (m *Call) GetDecline() *Call_Decline { if m != nil { return m.Decline } return nil } func (m *Call) GetKill() *Call_Kill { if m != nil { return m.Kill } return nil } func (m *Call) GetShutdown() *Call_Shutdown { if m != nil { return m.Shutdown } return nil } func (m *Call) GetAcknowledge() *Call_Acknowledge { if m != nil { return m.Acknowledge } return nil } func (m *Call) GetReconcile() *Call_Reconcile { if m != nil { return m.Reconcile } return nil } func (m *Call) GetMessage() *Call_Message { if m != nil { return m.Message } return nil } // Subscribes the scheduler with the master to receive events. A // scheduler must send other calls only after it has received the // SUBCRIBED event. type Call_Subscribe struct { // See the comments below on 'framework_id' on the semantics for // 'framework_info.id'. FrameworkInfo *FrameworkInfo `protobuf:"bytes,1,req,name=framework_info" json:"framework_info,omitempty"` // 'force' field is only relevant when 'framework_info.id' is set. // It tells the master what to do in case an instance of the // scheduler attempts to subscribe when another instance of it is // already connected (e.g., split brain due to network partition). // If 'force' is true, this scheduler instance is allowed and the // old connected scheduler instance is disconnected. If false, // this scheduler instance is disallowed subscription in favor of // the already connected scheduler instance. // // It is recommended to set this to true only when a newly elected // scheduler instance is attempting to subscribe but not when a // scheduler is retrying subscription (e.g., disconnection or // master failover; see sched/sched.cpp for an example). Force *bool `protobuf:"varint,2,opt,name=force" json:"force,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Call_Subscribe) Reset() { *m = Call_Subscribe{} } func (m *Call_Subscribe) String() string { return proto.CompactTextString(m) } func (*Call_Subscribe) ProtoMessage() {} func (m *Call_Subscribe) GetFrameworkInfo() *FrameworkInfo { if m != nil { return m.FrameworkInfo } return nil } func (m *Call_Subscribe) GetForce() bool { if m != nil && m.Force != nil { return *m.Force } return false } // Accepts an offer, performing the specified operations // in a sequential manner. // // E.g. Launch a task with a newly reserved persistent volume: // // Accept { // offer_ids: [ ... ] // operations: [ // { type: RESERVE, // reserve: { resources: [ disk(role):2 ] } } // { type: CREATE, // create: { volumes: [ disk(role):1+persistence ] } } // { type: LAUNCH, // launch: { task_infos ... disk(role):1;disk(role):1+persistence } } // ] // } // // Note that any of the offer’s resources not used in the 'Accept' // call (e.g., to launch a task) are considered unused and might be // reoffered to other frameworks. In other words, the same OfferID // cannot be used in more than one 'Accept' call. type Call_Accept struct { OfferIds []*OfferID `protobuf:"bytes,1,rep,name=offer_ids" json:"offer_ids,omitempty"` Operations []*Offer_Operation `protobuf:"bytes,2,rep,name=operations" json:"operations,omitempty"` Filters *Filters `protobuf:"bytes,3,opt,name=filters" json:"filters,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Call_Accept) Reset() { *m = Call_Accept{} } func (m *Call_Accept) String() string { return proto.CompactTextString(m) } func (*Call_Accept) ProtoMessage() {} func (m *Call_Accept) GetOfferIds() []*OfferID { if m != nil { return m.OfferIds } return nil } func (m *Call_Accept) GetOperations() []*Offer_Operation { if m != nil { return m.Operations } return nil } func (m *Call_Accept) GetFilters() *Filters { if m != nil { return m.Filters } return nil } // Declines an offer, signaling the master to potentially reoffer // the resources to a different framework. Note that this is same // as sending an Accept call with no operations. See comments on // top of 'Accept' for semantics. type Call_Decline struct { OfferIds []*OfferID `protobuf:"bytes,1,rep,name=offer_ids" json:"offer_ids,omitempty"` Filters *Filters `protobuf:"bytes,2,opt,name=filters" json:"filters,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Call_Decline) Reset() { *m = Call_Decline{} } func (m *Call_Decline) String() string { return proto.CompactTextString(m) } func (*Call_Decline) ProtoMessage() {} func (m *Call_Decline) GetOfferIds() []*OfferID { if m != nil { return m.OfferIds } return nil } func (m *Call_Decline) GetFilters() *Filters { if m != nil { return m.Filters } return nil } // Kills a specific task. If the scheduler has a custom executor, // the kill is forwarded to the executor and it is up to the // executor to kill the task and send a TASK_KILLED (or TASK_FAILED) // update. Note that Mesos releases the resources for a task once it // receives a terminal update (See TaskState in mesos.proto) for it. // If the task is unknown to the master, a TASK_LOST update is // generated. type Call_Kill struct { TaskId *TaskID `protobuf:"bytes,1,req,name=task_id" json:"task_id,omitempty"` SlaveId *SlaveID `protobuf:"bytes,2,opt,name=slave_id" json:"slave_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Call_Kill) Reset() { *m = Call_Kill{} } func (m *Call_Kill) String() string { return proto.CompactTextString(m) } func (*Call_Kill) ProtoMessage() {} func (m *Call_Kill) GetTaskId() *TaskID { if m != nil { return m.TaskId } return nil } func (m *Call_Kill) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } // Shuts down a custom executor. When the executor gets a shutdown // event, it is expected to kill all its tasks (and send TASK_KILLED // updates) and terminate. If the executor doesn’t terminate within // a certain timeout (configurable via // '--executor_shutdown_grace_period' slave flag), the slave will // forcefully destroy the container (executor and its tasks) and // transition its active tasks to TASK_LOST. type Call_Shutdown struct { ExecutorId *ExecutorID `protobuf:"bytes,1,req,name=executor_id" json:"executor_id,omitempty"` SlaveId *SlaveID `protobuf:"bytes,2,req,name=slave_id" json:"slave_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Call_Shutdown) Reset() { *m = Call_Shutdown{} } func (m *Call_Shutdown) String() string { return proto.CompactTextString(m) } func (*Call_Shutdown) ProtoMessage() {} func (m *Call_Shutdown) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *Call_Shutdown) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } // Acknowledges the receipt of status update. Schedulers are // responsible for explicitly acknowledging the receipt of status // updates that have 'Update.status().uuid()' field set. Such status // updates are retried by the slave until they are acknowledged by // the scheduler. type Call_Acknowledge struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` TaskId *TaskID `protobuf:"bytes,2,req,name=task_id" json:"task_id,omitempty"` Uuid []byte `protobuf:"bytes,3,req,name=uuid" json:"uuid,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Call_Acknowledge) Reset() { *m = Call_Acknowledge{} } func (m *Call_Acknowledge) String() string { return proto.CompactTextString(m) } func (*Call_Acknowledge) ProtoMessage() {} func (m *Call_Acknowledge) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *Call_Acknowledge) GetTaskId() *TaskID { if m != nil { return m.TaskId } return nil } func (m *Call_Acknowledge) GetUuid() []byte { if m != nil { return m.Uuid } return nil } // Allows the scheduler to query the status for non-terminal tasks. // This causes the master to send back the latest task status for // each task in 'tasks', if possible. Tasks that are no longer known // will result in a TASK_LOST update. If 'statuses' is empty, then // the master will send the latest status for each task currently // known. type Call_Reconcile struct { Tasks []*Call_Reconcile_Task `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Call_Reconcile) Reset() { *m = Call_Reconcile{} } func (m *Call_Reconcile) String() string { return proto.CompactTextString(m) } func (*Call_Reconcile) ProtoMessage() {} func (m *Call_Reconcile) GetTasks() []*Call_Reconcile_Task { if m != nil { return m.Tasks } return nil } // TODO(vinod): Support arbitrary queries than just state of tasks. type Call_Reconcile_Task struct { TaskId *TaskID `protobuf:"bytes,1,req,name=task_id" json:"task_id,omitempty"` SlaveId *SlaveID `protobuf:"bytes,2,opt,name=slave_id" json:"slave_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Call_Reconcile_Task) Reset() { *m = Call_Reconcile_Task{} } func (m *Call_Reconcile_Task) String() string { return proto.CompactTextString(m) } func (*Call_Reconcile_Task) ProtoMessage() {} func (m *Call_Reconcile_Task) GetTaskId() *TaskID { if m != nil { return m.TaskId } return nil } func (m *Call_Reconcile_Task) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } // Sends arbitrary binary data to the executor. Note that Mesos // neither interprets this data nor makes any guarantees about the // delivery of this message to the executor. type Call_Message struct { SlaveId *SlaveID `protobuf:"bytes,1,req,name=slave_id" json:"slave_id,omitempty"` ExecutorId *ExecutorID `protobuf:"bytes,2,req,name=executor_id" json:"executor_id,omitempty"` Data []byte `protobuf:"bytes,3,req,name=data" json:"data,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Call_Message) Reset() { *m = Call_Message{} } func (m *Call_Message) String() string { return proto.CompactTextString(m) } func (*Call_Message) ProtoMessage() {} func (m *Call_Message) GetSlaveId() *SlaveID { if m != nil { return m.SlaveId } return nil } func (m *Call_Message) GetExecutorId() *ExecutorID { if m != nil { return m.ExecutorId } return nil } func (m *Call_Message) GetData() []byte { if m != nil { return m.Data } return nil } func init() { proto.RegisterEnum("mesosproto.Event_Type", Event_Type_name, Event_Type_value) proto.RegisterEnum("mesosproto.Call_Type", Call_Type_name, Call_Type_value) } mesos-go-0.0.1/mesosproto/scheduler.proto000066400000000000000000000274201257601144100205240ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 mesosproto; import "mesos.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; /** * Scheduler event API. * * An event is described using the standard protocol buffer "union" * trick, see: * https://developers.google.com/protocol-buffers/docs/techniques#union. */ message Event { // Possible event types, followed by message definitions if // applicable. enum Type { SUBSCRIBED = 1; // See 'Subscribed' below. OFFERS = 2; // See 'Offers' below. RESCIND = 3; // See 'Rescind' below. UPDATE = 4; // See 'Update' below. MESSAGE = 5; // See 'Message' below. FAILURE = 6; // See 'Failure' below. ERROR = 7; // See 'Error' below. } // First event received when the scheduler subscribes. message Subscribed { required FrameworkID framework_id = 1; } // Received whenever there are new resources that are offered to the // scheduler. Each offer corresponds to a set of resources on a // slave. Until the scheduler accepts or declines an offer the // resources are considered allocated to the scheduler. message Offers { repeated Offer offers = 1; } // Received when a particular offer is no longer valid (e.g., the // slave corresponding to the offer has been removed) and hence // needs to be rescinded. Any future calls ('Accept' / 'Decline') made // by the scheduler regarding this offer will be invalid. message Rescind { required OfferID offer_id = 1; } // Received whenever there is a status update that is generated by // the executor or slave or master. Status updates should be used by // executors to reliably communicate the status of the tasks that // they manage. It is crucial that a terminal update (see TaskState // in mesos.proto) is sent by the executor as soon as the task // terminates, in order for Mesos to release the resources allocated // to the task. It is also the responsibility of the scheduler to // explicitly acknowledge the receipt of a status update. See // 'Acknowledge' in the 'Call' section below for the semantics. message Update { required TaskStatus status = 1; } // Received when a custom message generated by the executor is // forwarded by the master. Note that this message is not // interpreted by Mesos and is only forwarded (without reliability // guarantees) to the scheduler. It is up to the executor to retry // if the message is dropped for any reason. message Message { required SlaveID slave_id = 1; required ExecutorID executor_id = 2; required bytes data = 3; } // Received when a slave is removed from the cluster (e.g., failed // health checks) or when an executor is terminated. Note that, this // event coincides with receipt of terminal UPDATE events for any // active tasks belonging to the slave or executor and receipt of // 'Rescind' events for any outstanding offers belonging to the // slave. Note that there is no guaranteed order between the // 'Failure', 'Update' and 'Rescind' events when a slave or executor // is removed. // TODO(vinod): Consider splitting the lost slave and terminated // executor into separate events and ensure it's reliably generated. message Failure { optional SlaveID slave_id = 1; // If this was just a failure of an executor on a slave then // 'executor_id' will be set and possibly 'status' (if we were // able to determine the exit status). optional ExecutorID executor_id = 2; optional int32 status = 3; } // Received when an invalid framework (e.g., unauthenticated, // unauthorized) attempts to subscribe with the master. Error can // also be received if scheduler sends invalid Calls (e.g., not // properly initialized). // TODO(vinod): Remove this once the old scheduler driver is no // longer supported. With HTTP API all errors will be signaled via // HTTP response codes. message Error { required string message = 1; } // Type of the event, indicates which optional field below should be // present if that type has a nested message definition. required Type type = 1; optional Subscribed subscribed = 2; optional Offers offers = 3; optional Rescind rescind = 4; optional Update update = 5; optional Message message = 6; optional Failure failure = 7; optional Error error = 8; } /** * Scheduler call API. * * Like Event, a Call is described using the standard protocol buffer * "union" trick (see above). */ message Call { // Possible call types, followed by message definitions if // applicable. enum Type { SUBSCRIBE = 1; // See 'Subscribe' below. TEARDOWN = 2; // Shuts down all tasks/executors and removes framework. ACCEPT = 3; // See 'Accept' below. DECLINE = 4; // See 'Decline' below. REVIVE = 5; // Removes any previous filters set via ACCEPT or DECLINE. KILL = 6; // See 'Kill' below. SHUTDOWN = 7; // See 'Shutdown' below. ACKNOWLEDGE = 8; // See 'Acknowledge' below. RECONCILE = 9; // See 'Reconcile' below. MESSAGE = 10; // See 'Message' below. // TODO(benh): Consider adding an 'ACTIVATE' and 'DEACTIVATE' for // already subscribed frameworks as a way of stopping offers from // being generated and other events from being sent by the master. // Note that this functionality existed originally to support // SchedulerDriver::abort which was only necessary to handle // exceptions getting thrown from within Scheduler callbacks, // something that is not an issue with the Event/Call API. } // Subscribes the scheduler with the master to receive events. A // scheduler must send other calls only after it has received the // SUBCRIBED event. message Subscribe { // See the comments below on 'framework_id' on the semantics for // 'framework_info.id'. required FrameworkInfo framework_info = 1; // 'force' field is only relevant when 'framework_info.id' is set. // It tells the master what to do in case an instance of the // scheduler attempts to subscribe when another instance of it is // already connected (e.g., split brain due to network partition). // If 'force' is true, this scheduler instance is allowed and the // old connected scheduler instance is disconnected. If false, // this scheduler instance is disallowed subscription in favor of // the already connected scheduler instance. // // It is recommended to set this to true only when a newly elected // scheduler instance is attempting to subscribe but not when a // scheduler is retrying subscription (e.g., disconnection or // master failover; see sched/sched.cpp for an example). optional bool force = 2; } // Accepts an offer, performing the specified operations // in a sequential manner. // // E.g. Launch a task with a newly reserved persistent volume: // // Accept { // offer_ids: [ ... ] // operations: [ // { type: RESERVE, // reserve: { resources: [ disk(role):2 ] } } // { type: CREATE, // create: { volumes: [ disk(role):1+persistence ] } } // { type: LAUNCH, // launch: { task_infos ... disk(role):1;disk(role):1+persistence } } // ] // } // // Note that any of the offer’s resources not used in the 'Accept' // call (e.g., to launch a task) are considered unused and might be // reoffered to other frameworks. In other words, the same OfferID // cannot be used in more than one 'Accept' call. message Accept { repeated OfferID offer_ids = 1; repeated Offer.Operation operations = 2; optional Filters filters = 3; } // Declines an offer, signaling the master to potentially reoffer // the resources to a different framework. Note that this is same // as sending an Accept call with no operations. See comments on // top of 'Accept' for semantics. message Decline { repeated OfferID offer_ids = 1; optional Filters filters = 2; } // Kills a specific task. If the scheduler has a custom executor, // the kill is forwarded to the executor and it is up to the // executor to kill the task and send a TASK_KILLED (or TASK_FAILED) // update. Note that Mesos releases the resources for a task once it // receives a terminal update (See TaskState in mesos.proto) for it. // If the task is unknown to the master, a TASK_LOST update is // generated. message Kill { required TaskID task_id = 1; optional SlaveID slave_id = 2; } // Shuts down a custom executor. When the executor gets a shutdown // event, it is expected to kill all its tasks (and send TASK_KILLED // updates) and terminate. If the executor doesn’t terminate within // a certain timeout (configurable via // '--executor_shutdown_grace_period' slave flag), the slave will // forcefully destroy the container (executor and its tasks) and // transition its active tasks to TASK_LOST. message Shutdown { required ExecutorID executor_id = 1; required SlaveID slave_id = 2; } // Acknowledges the receipt of status update. Schedulers are // responsible for explicitly acknowledging the receipt of status // updates that have 'Update.status().uuid()' field set. Such status // updates are retried by the slave until they are acknowledged by // the scheduler. message Acknowledge { required SlaveID slave_id = 1; required TaskID task_id = 2; required bytes uuid = 3; } // Allows the scheduler to query the status for non-terminal tasks. // This causes the master to send back the latest task status for // each task in 'tasks', if possible. Tasks that are no longer known // will result in a TASK_LOST update. If 'statuses' is empty, then // the master will send the latest status for each task currently // known. message Reconcile { // TODO(vinod): Support arbitrary queries than just state of tasks. message Task { required TaskID task_id = 1; optional SlaveID slave_id = 2; } repeated Task tasks = 1; } // Sends arbitrary binary data to the executor. Note that Mesos // neither interprets this data nor makes any guarantees about the // delivery of this message to the executor. message Message { required SlaveID slave_id = 1; required ExecutorID executor_id = 2; required bytes data = 3; } // Identifies who generated this call. Master assigns a framework id // when a new scheduler subscribes for the first time. Once assigned, // the scheduler must set the 'framework_id' here and within its // FrameworkInfo (in any further 'Subscribe' calls). This allows the // master to identify a scheduler correctly across disconnections, // failovers, etc. optional FrameworkID framework_id = 1; // Type of the call, indicates which optional field below should be // present if that type has a nested message definition. required Type type = 2; optional Subscribe subscribe = 3; optional Accept accept = 4; optional Decline decline = 5; optional Kill kill = 6; optional Shutdown shutdown = 7; optional Acknowledge acknowledge = 8; optional Reconcile reconcile = 9; optional Message message = 10; } mesos-go-0.0.1/mesosproto/state.pb.go000066400000000000000000001220521257601144100175250ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: state.proto // DO NOT EDIT! package mesosproto import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto" import bytes "bytes" import strings "strings" import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" import sort "sort" import strconv "strconv" import reflect "reflect" import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf type Operation_Type int32 const ( Operation_SNAPSHOT Operation_Type = 1 Operation_DIFF Operation_Type = 3 Operation_EXPUNGE Operation_Type = 2 ) var Operation_Type_name = map[int32]string{ 1: "SNAPSHOT", 3: "DIFF", 2: "EXPUNGE", } var Operation_Type_value = map[string]int32{ "SNAPSHOT": 1, "DIFF": 3, "EXPUNGE": 2, } func (x Operation_Type) Enum() *Operation_Type { p := new(Operation_Type) *p = x return p } func (x Operation_Type) String() string { return proto.EnumName(Operation_Type_name, int32(x)) } func (x *Operation_Type) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(Operation_Type_value, data, "Operation_Type") if err != nil { return err } *x = Operation_Type(value) return nil } // Describes a state entry, a versioned (via a UUID) key/value pair. type Entry struct { Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` Uuid []byte `protobuf:"bytes,2,req,name=uuid" json:"uuid,omitempty"` Value []byte `protobuf:"bytes,3,req,name=value" json:"value,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Entry) Reset() { *m = Entry{} } func (*Entry) ProtoMessage() {} func (m *Entry) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *Entry) GetUuid() []byte { if m != nil { return m.Uuid } return nil } func (m *Entry) GetValue() []byte { if m != nil { return m.Value } return nil } // Describes an operation used in the log storage implementation. type Operation struct { Type *Operation_Type `protobuf:"varint,1,req,name=type,enum=mesosproto.Operation_Type" json:"type,omitempty"` Snapshot *Operation_Snapshot `protobuf:"bytes,2,opt,name=snapshot" json:"snapshot,omitempty"` Diff *Operation_Diff `protobuf:"bytes,4,opt,name=diff" json:"diff,omitempty"` Expunge *Operation_Expunge `protobuf:"bytes,3,opt,name=expunge" json:"expunge,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Operation) Reset() { *m = Operation{} } func (*Operation) ProtoMessage() {} func (m *Operation) GetType() Operation_Type { if m != nil && m.Type != nil { return *m.Type } return Operation_SNAPSHOT } func (m *Operation) GetSnapshot() *Operation_Snapshot { if m != nil { return m.Snapshot } return nil } func (m *Operation) GetDiff() *Operation_Diff { if m != nil { return m.Diff } return nil } func (m *Operation) GetExpunge() *Operation_Expunge { if m != nil { return m.Expunge } return nil } // Describes a "snapshot" operation. type Operation_Snapshot struct { Entry *Entry `protobuf:"bytes,1,req,name=entry" json:"entry,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Operation_Snapshot) Reset() { *m = Operation_Snapshot{} } func (*Operation_Snapshot) ProtoMessage() {} func (m *Operation_Snapshot) GetEntry() *Entry { if m != nil { return m.Entry } return nil } // Describes a "diff" operation where the 'value' of the entry is // just the diff itself, but the 'uuid' represents the UUID of the // entry after applying this diff. type Operation_Diff struct { Entry *Entry `protobuf:"bytes,1,req,name=entry" json:"entry,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Operation_Diff) Reset() { *m = Operation_Diff{} } func (*Operation_Diff) ProtoMessage() {} func (m *Operation_Diff) GetEntry() *Entry { if m != nil { return m.Entry } return nil } // Describes an "expunge" operation. type Operation_Expunge struct { Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Operation_Expunge) Reset() { *m = Operation_Expunge{} } func (*Operation_Expunge) ProtoMessage() {} func (m *Operation_Expunge) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func init() { proto.RegisterEnum("mesosproto.Operation_Type", Operation_Type_name, Operation_Type_value) } func (this *Entry) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Entry) if !ok { return fmt.Errorf("that is not of type *Entry") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Entry but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Entrybut is not nil && this == nil") } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return fmt.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name) } } else if this.Name != nil { return fmt.Errorf("this.Name == nil && that.Name != nil") } else if that1.Name != nil { return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name) } if !bytes.Equal(this.Uuid, that1.Uuid) { return fmt.Errorf("Uuid this(%v) Not Equal that(%v)", this.Uuid, that1.Uuid) } if !bytes.Equal(this.Value, that1.Value) { return fmt.Errorf("Value this(%v) Not Equal that(%v)", this.Value, that1.Value) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Entry) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Entry) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return false } } else if this.Name != nil { return false } else if that1.Name != nil { return false } if !bytes.Equal(this.Uuid, that1.Uuid) { return false } if !bytes.Equal(this.Value, that1.Value) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Operation) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Operation) if !ok { return fmt.Errorf("that is not of type *Operation") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Operation but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Operationbut is not nil && this == nil") } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return fmt.Errorf("Type this(%v) Not Equal that(%v)", *this.Type, *that1.Type) } } else if this.Type != nil { return fmt.Errorf("this.Type == nil && that.Type != nil") } else if that1.Type != nil { return fmt.Errorf("Type this(%v) Not Equal that(%v)", this.Type, that1.Type) } if !this.Snapshot.Equal(that1.Snapshot) { return fmt.Errorf("Snapshot this(%v) Not Equal that(%v)", this.Snapshot, that1.Snapshot) } if !this.Diff.Equal(that1.Diff) { return fmt.Errorf("Diff this(%v) Not Equal that(%v)", this.Diff, that1.Diff) } if !this.Expunge.Equal(that1.Expunge) { return fmt.Errorf("Expunge this(%v) Not Equal that(%v)", this.Expunge, that1.Expunge) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Operation) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Operation) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Type != nil && that1.Type != nil { if *this.Type != *that1.Type { return false } } else if this.Type != nil { return false } else if that1.Type != nil { return false } if !this.Snapshot.Equal(that1.Snapshot) { return false } if !this.Diff.Equal(that1.Diff) { return false } if !this.Expunge.Equal(that1.Expunge) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Operation_Snapshot) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Operation_Snapshot) if !ok { return fmt.Errorf("that is not of type *Operation_Snapshot") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Operation_Snapshot but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Operation_Snapshotbut is not nil && this == nil") } if !this.Entry.Equal(that1.Entry) { return fmt.Errorf("Entry this(%v) Not Equal that(%v)", this.Entry, that1.Entry) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Operation_Snapshot) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Operation_Snapshot) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.Entry.Equal(that1.Entry) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Operation_Diff) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Operation_Diff) if !ok { return fmt.Errorf("that is not of type *Operation_Diff") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Operation_Diff but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Operation_Diffbut is not nil && this == nil") } if !this.Entry.Equal(that1.Entry) { return fmt.Errorf("Entry this(%v) Not Equal that(%v)", this.Entry, that1.Entry) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Operation_Diff) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Operation_Diff) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if !this.Entry.Equal(that1.Entry) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Operation_Expunge) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Operation_Expunge) if !ok { return fmt.Errorf("that is not of type *Operation_Expunge") } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Operation_Expunge but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Operation_Expungebut is not nil && this == nil") } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return fmt.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name) } } else if this.Name != nil { return fmt.Errorf("this.Name == nil && that.Name != nil") } else if that1.Name != nil { return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Operation_Expunge) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Operation_Expunge) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Name != nil && that1.Name != nil { if *this.Name != *that1.Name { return false } } else if this.Name != nil { return false } else if that1.Name != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Entry) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 7) s = append(s, "&mesosproto.Entry{") if this.Name != nil { s = append(s, "Name: "+valueToGoStringState(this.Name, "string")+",\n") } if this.Uuid != nil { s = append(s, "Uuid: "+valueToGoStringState(this.Uuid, "byte")+",\n") } if this.Value != nil { s = append(s, "Value: "+valueToGoStringState(this.Value, "byte")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Operation) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 8) s = append(s, "&mesosproto.Operation{") if this.Type != nil { s = append(s, "Type: "+valueToGoStringState(this.Type, "mesosproto.Operation_Type")+",\n") } if this.Snapshot != nil { s = append(s, "Snapshot: "+fmt.Sprintf("%#v", this.Snapshot)+",\n") } if this.Diff != nil { s = append(s, "Diff: "+fmt.Sprintf("%#v", this.Diff)+",\n") } if this.Expunge != nil { s = append(s, "Expunge: "+fmt.Sprintf("%#v", this.Expunge)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Operation_Snapshot) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Operation_Snapshot{") if this.Entry != nil { s = append(s, "Entry: "+fmt.Sprintf("%#v", this.Entry)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Operation_Diff) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Operation_Diff{") if this.Entry != nil { s = append(s, "Entry: "+fmt.Sprintf("%#v", this.Entry)+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Operation_Expunge) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&mesosproto.Operation_Expunge{") if this.Name != nil { s = append(s, "Name: "+valueToGoStringState(this.Name, "string")+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func valueToGoStringState(v interface{}, typ string) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) } func extensionToGoStringState(e map[int32]github_com_gogo_protobuf_proto.Extension) string { if e == nil { return "nil" } s := "map[int32]proto.Extension{" keys := make([]int, 0, len(e)) for k := range e { keys = append(keys, int(k)) } sort.Ints(keys) ss := []string{} for _, k := range keys { ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) } s += strings.Join(ss, ",") + "}" return s } func (m *Entry) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Entry) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Name == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } else { data[i] = 0xa i++ i = encodeVarintState(data, i, uint64(len(*m.Name))) i += copy(data[i:], *m.Name) } if m.Uuid == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("uuid") } else { data[i] = 0x12 i++ i = encodeVarintState(data, i, uint64(len(m.Uuid))) i += copy(data[i:], m.Uuid) } if m.Value == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } else { data[i] = 0x1a i++ i = encodeVarintState(data, i, uint64(len(m.Value))) i += copy(data[i:], m.Value) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Operation) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Operation) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Type == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } else { data[i] = 0x8 i++ i = encodeVarintState(data, i, uint64(*m.Type)) } if m.Snapshot != nil { data[i] = 0x12 i++ i = encodeVarintState(data, i, uint64(m.Snapshot.Size())) n1, err := m.Snapshot.MarshalTo(data[i:]) if err != nil { return 0, err } i += n1 } if m.Expunge != nil { data[i] = 0x1a i++ i = encodeVarintState(data, i, uint64(m.Expunge.Size())) n2, err := m.Expunge.MarshalTo(data[i:]) if err != nil { return 0, err } i += n2 } if m.Diff != nil { data[i] = 0x22 i++ i = encodeVarintState(data, i, uint64(m.Diff.Size())) n3, err := m.Diff.MarshalTo(data[i:]) if err != nil { return 0, err } i += n3 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Operation_Snapshot) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Operation_Snapshot) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Entry == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("entry") } else { data[i] = 0xa i++ i = encodeVarintState(data, i, uint64(m.Entry.Size())) n4, err := m.Entry.MarshalTo(data[i:]) if err != nil { return 0, err } i += n4 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Operation_Diff) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Operation_Diff) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Entry == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("entry") } else { data[i] = 0xa i++ i = encodeVarintState(data, i, uint64(m.Entry.Size())) n5, err := m.Entry.MarshalTo(data[i:]) if err != nil { return 0, err } i += n5 } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *Operation_Expunge) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *Operation_Expunge) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Name == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } else { data[i] = 0xa i++ i = encodeVarintState(data, i, uint64(len(*m.Name))) i += copy(data[i:], *m.Name) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func encodeFixed64State(data []byte, offset int, v uint64) int { data[offset] = uint8(v) data[offset+1] = uint8(v >> 8) data[offset+2] = uint8(v >> 16) data[offset+3] = uint8(v >> 24) data[offset+4] = uint8(v >> 32) data[offset+5] = uint8(v >> 40) data[offset+6] = uint8(v >> 48) data[offset+7] = uint8(v >> 56) return offset + 8 } func encodeFixed32State(data []byte, offset int, v uint32) int { data[offset] = uint8(v) data[offset+1] = uint8(v >> 8) data[offset+2] = uint8(v >> 16) data[offset+3] = uint8(v >> 24) return offset + 4 } func encodeVarintState(data []byte, offset int, v uint64) int { for v >= 1<<7 { data[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } data[offset] = uint8(v) return offset + 1 } func NewPopulatedEntry(r randyState, easy bool) *Entry { this := &Entry{} v1 := randStringState(r) this.Name = &v1 v2 := r.Intn(100) this.Uuid = make([]byte, v2) for i := 0; i < v2; i++ { this.Uuid[i] = byte(r.Intn(256)) } v3 := r.Intn(100) this.Value = make([]byte, v3) for i := 0; i < v3; i++ { this.Value[i] = byte(r.Intn(256)) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedState(r, 4) } return this } func NewPopulatedOperation(r randyState, easy bool) *Operation { this := &Operation{} v4 := Operation_Type([]int32{1, 3, 2}[r.Intn(3)]) this.Type = &v4 if r.Intn(10) != 0 { this.Snapshot = NewPopulatedOperation_Snapshot(r, easy) } if r.Intn(10) != 0 { this.Expunge = NewPopulatedOperation_Expunge(r, easy) } if r.Intn(10) != 0 { this.Diff = NewPopulatedOperation_Diff(r, easy) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedState(r, 5) } return this } func NewPopulatedOperation_Snapshot(r randyState, easy bool) *Operation_Snapshot { this := &Operation_Snapshot{} this.Entry = NewPopulatedEntry(r, easy) if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedState(r, 2) } return this } func NewPopulatedOperation_Diff(r randyState, easy bool) *Operation_Diff { this := &Operation_Diff{} this.Entry = NewPopulatedEntry(r, easy) if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedState(r, 2) } return this } func NewPopulatedOperation_Expunge(r randyState, easy bool) *Operation_Expunge { this := &Operation_Expunge{} v5 := randStringState(r) this.Name = &v5 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedState(r, 2) } return this } type randyState interface { Float32() float32 Float64() float64 Int63() int64 Int31() int32 Uint32() uint32 Intn(n int) int } func randUTF8RuneState(r randyState) rune { ru := r.Intn(62) if ru < 10 { return rune(ru + 48) } else if ru < 36 { return rune(ru + 55) } return rune(ru + 61) } func randStringState(r randyState) string { v6 := r.Intn(100) tmps := make([]rune, v6) for i := 0; i < v6; i++ { tmps[i] = randUTF8RuneState(r) } return string(tmps) } func randUnrecognizedState(r randyState, maxFieldNumber int) (data []byte) { l := r.Intn(5) for i := 0; i < l; i++ { wire := r.Intn(4) if wire == 3 { wire = 5 } fieldNumber := maxFieldNumber + r.Intn(100) data = randFieldState(data, r, fieldNumber, wire) } return data } func randFieldState(data []byte, r randyState, fieldNumber int, wire int) []byte { key := uint32(fieldNumber)<<3 | uint32(wire) switch wire { case 0: data = encodeVarintPopulateState(data, uint64(key)) v7 := r.Int63() if r.Intn(2) == 0 { v7 *= -1 } data = encodeVarintPopulateState(data, uint64(v7)) case 1: data = encodeVarintPopulateState(data, uint64(key)) data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) case 2: data = encodeVarintPopulateState(data, uint64(key)) ll := r.Intn(100) data = encodeVarintPopulateState(data, uint64(ll)) for j := 0; j < ll; j++ { data = append(data, byte(r.Intn(256))) } default: data = encodeVarintPopulateState(data, uint64(key)) data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) } return data } func encodeVarintPopulateState(data []byte, v uint64) []byte { for v >= 1<<7 { data = append(data, uint8(uint64(v)&0x7f|0x80)) v >>= 7 } data = append(data, uint8(v)) return data } func (m *Entry) Size() (n int) { var l int _ = l if m.Name != nil { l = len(*m.Name) n += 1 + l + sovState(uint64(l)) } if m.Uuid != nil { l = len(m.Uuid) n += 1 + l + sovState(uint64(l)) } if m.Value != nil { l = len(m.Value) n += 1 + l + sovState(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Operation) Size() (n int) { var l int _ = l if m.Type != nil { n += 1 + sovState(uint64(*m.Type)) } if m.Snapshot != nil { l = m.Snapshot.Size() n += 1 + l + sovState(uint64(l)) } if m.Expunge != nil { l = m.Expunge.Size() n += 1 + l + sovState(uint64(l)) } if m.Diff != nil { l = m.Diff.Size() n += 1 + l + sovState(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Operation_Snapshot) Size() (n int) { var l int _ = l if m.Entry != nil { l = m.Entry.Size() n += 1 + l + sovState(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Operation_Diff) Size() (n int) { var l int _ = l if m.Entry != nil { l = m.Entry.Size() n += 1 + l + sovState(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Operation_Expunge) Size() (n int) { var l int _ = l if m.Name != nil { l = len(*m.Name) n += 1 + l + sovState(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func sovState(x uint64) (n int) { for { n++ x >>= 7 if x == 0 { break } } return n } func sozState(x uint64) (n int) { return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (this *Entry) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Entry{`, `Name:` + valueToStringState(this.Name) + `,`, `Uuid:` + valueToStringState(this.Uuid) + `,`, `Value:` + valueToStringState(this.Value) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Operation) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Operation{`, `Type:` + valueToStringState(this.Type) + `,`, `Snapshot:` + strings.Replace(fmt.Sprintf("%v", this.Snapshot), "Operation_Snapshot", "Operation_Snapshot", 1) + `,`, `Expunge:` + strings.Replace(fmt.Sprintf("%v", this.Expunge), "Operation_Expunge", "Operation_Expunge", 1) + `,`, `Diff:` + strings.Replace(fmt.Sprintf("%v", this.Diff), "Operation_Diff", "Operation_Diff", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Operation_Snapshot) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Operation_Snapshot{`, `Entry:` + strings.Replace(fmt.Sprintf("%v", this.Entry), "Entry", "Entry", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Operation_Diff) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Operation_Diff{`, `Entry:` + strings.Replace(fmt.Sprintf("%v", this.Entry), "Entry", "Entry", 1) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Operation_Expunge) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Operation_Expunge{`, `Name:` + valueToStringState(this.Name) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func valueToStringState(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } func (m *Entry) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthState } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Name = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Uuid", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ byteLen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthState } postIndex := iNdEx + byteLen if postIndex > l { return io.ErrUnexpectedEOF } m.Uuid = append([]byte{}, data[iNdEx:postIndex]...) iNdEx = postIndex hasFields[0] |= uint64(0x00000002) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ byteLen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthState } postIndex := iNdEx + byteLen if postIndex > l { return io.ErrUnexpectedEOF } m.Value = append([]byte{}, data[iNdEx:postIndex]...) iNdEx = postIndex hasFields[0] |= uint64(0x00000004) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipState(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthState } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("uuid") } if hasFields[0]&uint64(0x00000004) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") } return nil } func (m *Operation) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var v Operation_Type for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (Operation_Type(b) & 0x7F) << shift if b < 0x80 { break } } m.Type = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthState } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Snapshot == nil { m.Snapshot = &Operation_Snapshot{} } if err := m.Snapshot.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Expunge", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthState } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Expunge == nil { m.Expunge = &Operation_Expunge{} } if err := m.Expunge.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Diff", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthState } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Diff == nil { m.Diff = &Operation_Diff{} } if err := m.Diff.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipState(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthState } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("type") } return nil } func (m *Operation_Snapshot) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Entry", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthState } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Entry == nil { m.Entry = &Entry{} } if err := m.Entry.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipState(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthState } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("entry") } return nil } func (m *Operation_Diff) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Entry", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthState } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Entry == nil { m.Entry = &Entry{} } if err := m.Entry.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipState(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthState } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("entry") } return nil } func (m *Operation_Expunge) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthState } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(data[iNdEx:postIndex]) m.Name = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } iNdEx -= sizeOfWire skippy, err := skipState(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthState } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("name") } return nil } func skipState(data []byte) (n int, err error) { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if data[iNdEx-1] < 0x80 { break } } return iNdEx, nil case 1: iNdEx += 8 return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } iNdEx += length if length < 0 { return 0, ErrInvalidLengthState } return iNdEx, nil case 3: for { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ innerWire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } innerWireType := int(innerWire & 0x7) if innerWireType == 4 { break } next, err := skipState(data[start:]) if err != nil { return 0, err } iNdEx = start + next } return iNdEx, nil case 4: return iNdEx, nil case 5: iNdEx += 4 return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } } panic("unreachable") } var ( ErrInvalidLengthState = fmt.Errorf("proto: negative length found during unmarshaling") ) mesos-go-0.0.1/mesosproto/state.proto000066400000000000000000000042311257601144100176610ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 mesosproto; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.gostring_all) = true; option (gogoproto.equal_all) = true; option (gogoproto.verbose_equal_all) = true; option (gogoproto.goproto_stringer_all) = false; option (gogoproto.stringer_all) = true; option (gogoproto.populate_all) = true; option (gogoproto.testgen_all) = true; option (gogoproto.benchgen_all) = true; option (gogoproto.marshaler_all) = true; option (gogoproto.sizer_all) = true; option (gogoproto.unmarshaler_all) = true; // Describes a state entry, a versioned (via a UUID) key/value pair. message Entry { required string name = 1; required bytes uuid = 2; required bytes value = 3; } // Describes an operation used in the log storage implementation. message Operation { enum Type { SNAPSHOT = 1; DIFF = 3; EXPUNGE = 2; } // Describes a "snapshot" operation. message Snapshot { required Entry entry = 1; } // Describes a "diff" operation where the 'value' of the entry is // just the diff itself, but the 'uuid' represents the UUID of the // entry after applying this diff. message Diff { required Entry entry = 1; } // Describes an "expunge" operation. message Expunge { required string name = 1; } required Type type = 1; optional Snapshot snapshot = 2; optional Diff diff = 4; optional Expunge expunge = 3; } mesos-go-0.0.1/mesosproto/statepb_test.go000066400000000000000000001047251257601144100205150ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: state.proto // DO NOT EDIT! package mesosproto import testing "testing" import math_rand "math/rand" import time "time" import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" import fmt "fmt" import go_parser "go/parser" import proto "github.com/gogo/protobuf/proto" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf func TestEntryProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEntry(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Entry{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestEntryMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEntry(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Entry{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkEntryProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Entry, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedEntry(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkEntryProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedEntry(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Entry{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestOperationProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Operation{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestOperationMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Operation{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkOperationProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Operation, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedOperation(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkOperationProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOperation(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Operation{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestOperation_SnapshotProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Snapshot(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Operation_Snapshot{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestOperation_SnapshotMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Snapshot(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Operation_Snapshot{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkOperation_SnapshotProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Operation_Snapshot, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedOperation_Snapshot(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkOperation_SnapshotProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOperation_Snapshot(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Operation_Snapshot{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestOperation_DiffProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Diff(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Operation_Diff{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestOperation_DiffMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Diff(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Operation_Diff{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkOperation_DiffProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Operation_Diff, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedOperation_Diff(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkOperation_DiffProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOperation_Diff(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Operation_Diff{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestOperation_ExpungeProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Expunge(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Operation_Expunge{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(data)) copy(littlefuzz, data) for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } } func TestOperation_ExpungeMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Expunge(popr, false) size := p.Size() data := make([]byte, size) for i := range data { data[i] = byte(popr.Intn(256)) } _, err := p.MarshalTo(data) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Operation_Expunge{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } for i := range data { data[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func BenchmarkOperation_ExpungeProtoMarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Operation_Expunge, 10000) for i := 0; i < 10000; i++ { pops[i] = NewPopulatedOperation_Expunge(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) if err != nil { panic(err) } total += len(data) } b.SetBytes(int64(total / b.N)) } func BenchmarkOperation_ExpungeProtoUnmarshal(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 datas := make([][]byte, 10000) for i := 0; i < 10000; i++ { data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOperation_Expunge(popr, false)) if err != nil { panic(err) } datas[i] = data } msg := &Operation_Expunge{} b.ResetTimer() for i := 0; i < b.N; i++ { total += len(datas[i%10000]) if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { panic(err) } } b.SetBytes(int64(total / b.N)) } func TestEntryJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEntry(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Entry{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestOperationJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Operation{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestOperation_SnapshotJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Snapshot(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Operation_Snapshot{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestOperation_DiffJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Diff(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Operation_Diff{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestOperation_ExpungeJSON(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Expunge(popr, true) marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &Operation_Expunge{} err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } func TestEntryProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEntry(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Entry{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestEntryProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEntry(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Entry{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOperationProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Operation{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOperationProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Operation{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOperation_SnapshotProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Snapshot(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Operation_Snapshot{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOperation_SnapshotProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Snapshot(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Operation_Snapshot{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOperation_DiffProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Diff(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Operation_Diff{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOperation_DiffProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Diff(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Operation_Diff{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOperation_ExpungeProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Expunge(popr, true) data := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &Operation_Expunge{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestOperation_ExpungeProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Expunge(popr, true) data := github_com_gogo_protobuf_proto.CompactTextString(p) msg := &Operation_Expunge{} if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } } func TestEntryVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedEntry(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Entry{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestOperationVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOperation(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Operation{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestOperation_SnapshotVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOperation_Snapshot(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Operation_Snapshot{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestOperation_DiffVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOperation_Diff(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Operation_Diff{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestOperation_ExpungeVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOperation_Expunge(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Operation_Expunge{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } } func TestEntryGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedEntry(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestOperationGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOperation(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestOperation_SnapshotGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOperation_Snapshot(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestOperation_DiffGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOperation_Diff(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestOperation_ExpungeGoString(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOperation_Expunge(popr, false) s1 := p.GoString() s2 := fmt.Sprintf("%#v", p) if s1 != s2 { t.Fatalf("GoString want %v got %v", s1, s2) } _, err := go_parser.ParseExpr(s1) if err != nil { panic(err) } } func TestEntrySize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedEntry(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkEntrySize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Entry, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedEntry(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestOperationSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkOperationSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Operation, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedOperation(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestOperation_SnapshotSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Snapshot(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkOperation_SnapshotSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Operation_Snapshot, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedOperation_Snapshot(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestOperation_DiffSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Diff(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkOperation_DiffSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Operation_Diff, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedOperation_Diff(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestOperation_ExpungeSize(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedOperation_Expunge(popr, true) size2 := github_com_gogo_protobuf_proto.Size(p) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } size := p.Size() if len(data) != size { t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data)) } if size2 != size { t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) } size3 := github_com_gogo_protobuf_proto.Size(p) if size3 != size { t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) } } func BenchmarkOperation_ExpungeSize(b *testing.B) { popr := math_rand.New(math_rand.NewSource(616)) total := 0 pops := make([]*Operation_Expunge, 1000) for i := 0; i < 1000; i++ { pops[i] = NewPopulatedOperation_Expunge(popr, false) } b.ResetTimer() for i := 0; i < b.N; i++ { total += pops[i%1000].Size() } b.SetBytes(int64(total / b.N)) } func TestEntryStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedEntry(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestOperationStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOperation(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestOperation_SnapshotStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOperation_Snapshot(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestOperation_DiffStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOperation_Diff(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } func TestOperation_ExpungeStringer(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedOperation_Expunge(popr, false) s1 := p.String() s2 := fmt.Sprintf("%v", p) if s1 != s2 { t.Fatalf("String want %v got %v", s1, s2) } } //These tests are generated by github.com/gogo/protobuf/plugin/testgen mesos-go-0.0.1/mesosutil/000077500000000000000000000000001257601144100152665ustar00rootroot00000000000000mesos-go-0.0.1/mesosutil/constants.go000066400000000000000000000001561257601144100176330ustar00rootroot00000000000000package mesosutil const ( // MesosVersion indicates the supported mesos version. MesosVersion = "0.24.0" ) mesos-go-0.0.1/mesosutil/mesosprotoutil.go000066400000000000000000000103571257601144100207330ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 mesosutil import ( "github.com/gogo/protobuf/proto" mesos "github.com/mesos/mesos-go/mesosproto" ) func NewValueRange(begin, end uint64) *mesos.Value_Range { return &mesos.Value_Range{Begin: proto.Uint64(begin), End: proto.Uint64(end)} } func FilterResources(resources []*mesos.Resource, filter func(*mesos.Resource) bool) (result []*mesos.Resource) { for _, resource := range resources { if filter(resource) { result = append(result, resource) } } return result } func NewScalarResource(name string, val float64) *mesos.Resource { return &mesos.Resource{ Name: proto.String(name), Type: mesos.Value_SCALAR.Enum(), Scalar: &mesos.Value_Scalar{Value: proto.Float64(val)}, } } func NewRangesResource(name string, ranges []*mesos.Value_Range) *mesos.Resource { return &mesos.Resource{ Name: proto.String(name), Type: mesos.Value_RANGES.Enum(), Ranges: &mesos.Value_Ranges{Range: ranges}, } } func NewSetResource(name string, items []string) *mesos.Resource { return &mesos.Resource{ Name: proto.String(name), Type: mesos.Value_SET.Enum(), Set: &mesos.Value_Set{Item: items}, } } func NewFrameworkID(id string) *mesos.FrameworkID { return &mesos.FrameworkID{Value: proto.String(id)} } func NewFrameworkInfo(user, name string, frameworkId *mesos.FrameworkID) *mesos.FrameworkInfo { return &mesos.FrameworkInfo{ User: proto.String(user), Name: proto.String(name), Id: frameworkId, } } func NewMasterInfo(id string, ip, port uint32) *mesos.MasterInfo { return &mesos.MasterInfo{ Id: proto.String(id), Ip: proto.Uint32(ip), Port: proto.Uint32(port), } } func NewOfferID(id string) *mesos.OfferID { return &mesos.OfferID{Value: proto.String(id)} } func NewOffer(offerId *mesos.OfferID, frameworkId *mesos.FrameworkID, slaveId *mesos.SlaveID, hostname string) *mesos.Offer { return &mesos.Offer{ Id: offerId, FrameworkId: frameworkId, SlaveId: slaveId, Hostname: proto.String(hostname), } } func FilterOffersResources(offers []*mesos.Offer, filter func(*mesos.Resource) bool) (result []*mesos.Resource) { for _, offer := range offers { result = FilterResources(offer.Resources, filter) } return result } func NewSlaveID(id string) *mesos.SlaveID { return &mesos.SlaveID{Value: proto.String(id)} } func NewTaskID(id string) *mesos.TaskID { return &mesos.TaskID{Value: proto.String(id)} } func NewTaskInfo( name string, taskId *mesos.TaskID, slaveId *mesos.SlaveID, resources []*mesos.Resource, ) *mesos.TaskInfo { return &mesos.TaskInfo{ Name: proto.String(name), TaskId: taskId, SlaveId: slaveId, Resources: resources, } } func NewTaskStatus(taskId *mesos.TaskID, state mesos.TaskState) *mesos.TaskStatus { return &mesos.TaskStatus{ TaskId: taskId, State: mesos.TaskState(state).Enum(), } } func NewStatusUpdate(frameworkId *mesos.FrameworkID, taskStatus *mesos.TaskStatus, timestamp float64, uuid []byte) *mesos.StatusUpdate { return &mesos.StatusUpdate{ FrameworkId: frameworkId, Status: taskStatus, Timestamp: proto.Float64(timestamp), Uuid: uuid, } } func NewCommandInfo(command string) *mesos.CommandInfo { return &mesos.CommandInfo{Value: proto.String(command)} } func NewExecutorID(id string) *mesos.ExecutorID { return &mesos.ExecutorID{Value: proto.String(id)} } func NewExecutorInfo(execId *mesos.ExecutorID, command *mesos.CommandInfo) *mesos.ExecutorInfo { return &mesos.ExecutorInfo{ ExecutorId: execId, Command: command, } } mesos-go-0.0.1/mesosutil/mesosprotoutil_test.go000066400000000000000000000163361257601144100217750ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 mesosutil import ( "github.com/gogo/protobuf/proto" mesos "github.com/mesos/mesos-go/mesosproto" "github.com/stretchr/testify/assert" "testing" ) func TestFilterResources(t *testing.T) { resources := []*mesos.Resource{ NewScalarResource("mem", 200), NewScalarResource("cpu", 4), NewScalarResource("mem", 500), } memRes := FilterResources(resources, func(res *mesos.Resource) bool { if res.GetType() == mesos.Value_SCALAR && res.GetName() == "mem" { return true } return false }) assert.Equal(t, 2, len(memRes)) } func TestNewValueRange(t *testing.T) { val := NewValueRange(20, 40) if val == nil { t.Fatal("Not creating protobuf object Value_Range.") } if (val.GetEnd() - val.GetBegin()) != 20 { t.Fatal("Protobuf object Value_Range not returning expected values.") } } func TestNewScalarResource(t *testing.T) { val := NewScalarResource("mem", 200) if val == nil { t.Fatal("Not creating protobuf object Resource properly.") } if val.GetType() != mesos.Value_SCALAR { t.Fatal("Expected type SCALAR for protobuf, got", val.GetType()) } if val.GetName() != "mem" && val.GetScalar().GetValue() != 200 { t.Fatal("Protobuf object Resource has wrong name and Scalar values.") } } func TestNewRangesResource(t *testing.T) { val := NewRangesResource("quotas", []*mesos.Value_Range{NewValueRange(20, 40)}) if val == nil { t.Fatal("Not creating protobuf object Resource properly.") } if val.GetType() != mesos.Value_RANGES { t.Fatal("Expected type SCALAR for protobuf, got", val.GetType()) } if len(val.GetRanges().GetRange()) != 1 { t.Fatal("Expected Resource of type RANGES with 1 range, but got", len(val.GetRanges().GetRange())) } } func TestNewSetResource(t *testing.T) { val := NewSetResource("greeting", []string{"hello", "world"}) if val == nil { t.Fatal("Not creating protobuf object Resource properly.") } if val.GetType() != mesos.Value_SET { t.Fatal("Expected type SET for protobuf, got", val.GetType()) } if len(val.GetSet().GetItem()) != 2 { t.Fatal("Expected Resource of type SET with 2 items, but got", len(val.GetRanges().GetRange())) } if val.GetSet().GetItem()[0] != "hello" { t.Fatal("Protobuf Resource of type SET got wrong value.") } } func TestNewFrameworkID(t *testing.T) { id := NewFrameworkID("test-id") if id == nil { t.Fatal("Not creating protobuf oject FrameworkID.") } if id.GetValue() != "test-id" { t.Fatal("Protobuf object not returning expected value.") } } func TestNewFrameworkInfo(t *testing.T) { info := NewFrameworkInfo("test-user", "test-name", NewFrameworkID("test-id")) info.Hostname = proto.String("localhost") if info == nil { t.Fatal("Not creating protobuf object FrameworkInfo") } if info.GetUser() != "test-user" { t.Fatal("Protobuf object FrameworkInfo.User missing value.") } if info.GetName() != "test-name" { t.Fatal("Protobuf object FrameworkInfo.Name missing value.") } if info.GetId() == nil { t.Fatal("Protobuf object FrameowrkInfo.Id missing value.") } if info.GetHostname() != "localhost" { t.Fatal("Protobuf object FrameworkInfo.Hostname missing value.") } } func TestNewMasterInfo(t *testing.T) { master := NewMasterInfo("master-1", 1234, 5678) if master == nil { t.Fatal("Not creating protobuf object MasterInfo") } if master.GetId() != "master-1" { t.Fatal("Protobuf object MasterInfo.Id missing.") } if master.GetIp() != 1234 { t.Fatal("Protobuf object MasterInfo.Ip missing.") } if master.GetPort() != 5678 { t.Fatal("Protobuf object MasterInfo.Port missing.") } } func TestNewOfferID(t *testing.T) { id := NewOfferID("offer-1") if id == nil { t.Fatal("Not creating protobuf object OfferID") } if id.GetValue() != "offer-1" { t.Fatal("Protobuf object OfferID.Value missing.") } } func TestNewOffer(t *testing.T) { offer := NewOffer(NewOfferID("offer-1"), NewFrameworkID("framework-1"), NewSlaveID("slave-1"), "localhost") if offer == nil { t.Fatal("Not creating protobuf object Offer") } if offer.GetId().GetValue() != "offer-1" { t.Fatal("Protobuf object Offer.Id missing") } if offer.GetFrameworkId().GetValue() != "framework-1" { t.Fatal("Protobuf object Offer.FrameworkId missing.") } if offer.GetSlaveId().GetValue() != "slave-1" { t.Fatal("Protobuf object Offer.SlaveId missing.") } if offer.GetHostname() != "localhost" { t.Fatal("Protobuf object offer.Hostname missing.") } } func TestNewSlaveID(t *testing.T) { id := NewSlaveID("slave-1") if id == nil { t.Fatal("Not creating protobuf object SlaveID") } if id.GetValue() != "slave-1" { t.Fatal("Protobuf object SlaveID.Value missing.") } } func TestNewTaskID(t *testing.T) { id := NewSlaveID("task-1") if id == nil { t.Fatal("Not creating protobuf object TaskID") } if id.GetValue() != "task-1" { t.Fatal("Protobuf object TaskID.Value missing.") } } func TestNewTaskInfo(t *testing.T) { info := NewTaskInfo( "simple-task", NewTaskID("simpe-task-1"), NewSlaveID("slave-1"), []*mesos.Resource{NewScalarResource("mem", 400)}, ) if info == nil { t.Fatal("Not creating protobuf object TaskInfo") } if info.GetName() != "simple-task" { t.Fatal("Protobuf object TaskInfo.Name missing.") } if info.GetTaskId() == nil { t.Fatal("Protobuf object TaskInfo.TaskId missing.") } if info.GetSlaveId() == nil { t.Fatal("Protobuf object TaskInfo.SlaveId missing.") } if len(info.GetResources()) != 1 { t.Fatal("Protobuf object TaskInfo.Resources missing.") } } func TestNewTaskStatus(t *testing.T) { status := NewTaskStatus(NewTaskID("task-1"), mesos.TaskState_TASK_RUNNING) if status == nil { t.Fatal("Not creating protobuf object TaskStatus") } if status.GetTaskId().GetValue() != "task-1" { t.Fatal("Protobuf object TaskStatus.TaskId missing.") } if status.GetState() != mesos.TaskState(mesos.TaskState_TASK_RUNNING) { t.Fatal("Protobuf object TaskStatus.State missing.") } } func TestNewCommandInfo(t *testing.T) { cmd := NewCommandInfo("echo Hello!") if cmd == nil { t.Fatal("Not creating protobuf object CommandInfo") } if cmd.GetValue() != "echo Hello!" { t.Fatal("Protobuf object CommandInfo.Value missing") } } func TestNewExecutorInfo(t *testing.T) { info := NewExecutorInfo(NewExecutorID("exec-1"), NewCommandInfo("ls -l")) if info == nil { t.Fatal("Not creating protobuf object ExecutorInfo") } if info.GetExecutorId().GetValue() != "exec-1" { t.Fatal("Protobuf object ExecutorInfo.ExecutorId missing") } if info.GetCommand().GetValue() != "ls -l" { t.Fatal("Protobuf object ExecutorInfo.Command missing") } } mesos-go-0.0.1/mesosutil/node.go000066400000000000000000000011001257601144100165320ustar00rootroot00000000000000package mesosutil import ( "os/exec" "strings" log "github.com/golang/glog" ) //TODO(jdef) copied from kubernetes/pkg/util/node.go func GetHostname(hostnameOverride string) string { hostname := []byte(hostnameOverride) if string(hostname) == "" { // Note: We use exec here instead of os.Hostname() because we // want the FQDN, and this is the easiest way to get it. fqdn, err := exec.Command("hostname", "-f").Output() if err != nil { log.Fatalf("Couldn't determine hostname: %v", err) } hostname = fqdn } return strings.TrimSpace(string(hostname)) } mesos-go-0.0.1/mesosutil/process/000077500000000000000000000000001257601144100167445ustar00rootroot00000000000000mesos-go-0.0.1/mesosutil/process/process.go000066400000000000000000000006671257601144100207620ustar00rootroot00000000000000package process import ( "fmt" "sync" ) var ( pidLock sync.Mutex pid uint64 ) func nextPid() uint64 { pidLock.Lock() defer pidLock.Unlock() pid++ return pid } //TODO(jdef) add lifecycle funcs //TODO(jdef) add messaging funcs type Process struct { label string } func New(kind string) *Process { return &Process{ label: fmt.Sprintf("%s(%d)", kind, nextPid()), } } func (p *Process) Label() string { return p.label } mesos-go-0.0.1/messenger/000077500000000000000000000000001257601144100152325ustar00rootroot00000000000000mesos-go-0.0.1/messenger/README.md000066400000000000000000000033351257601144100165150ustar00rootroot00000000000000####Benchmark of the messenger. ```shell $ go test -v -run=Benckmark* -bench=. PASS BenchmarkMessengerSendSmallMessage 50000 70568 ns/op BenchmarkMessengerSendMediumMessage 50000 70265 ns/op BenchmarkMessengerSendBigMessage 50000 72693 ns/op BenchmarkMessengerSendLargeMessage 50000 72896 ns/op BenchmarkMessengerSendMixedMessage 50000 72631 ns/op BenchmarkMessengerSendRecvSmallMessage 20000 78409 ns/op BenchmarkMessengerSendRecvMediumMessage 20000 80471 ns/op BenchmarkMessengerSendRecvBigMessage 20000 82629 ns/op BenchmarkMessengerSendRecvLargeMessage 20000 85987 ns/op BenchmarkMessengerSendRecvMixedMessage 20000 83678 ns/op ok github.com/mesos/mesos-go/messenger 115.135s $ go test -v -run=Benckmark* -bench=. -cpu=4 -send-routines=4 2>/dev/null PASS BenchmarkMessengerSendSmallMessage-4 50000 35529 ns/op BenchmarkMessengerSendMediumMessage-4 50000 35997 ns/op BenchmarkMessengerSendBigMessage-4 50000 36871 ns/op BenchmarkMessengerSendLargeMessage-4 50000 37310 ns/op BenchmarkMessengerSendMixedMessage-4 50000 37419 ns/op BenchmarkMessengerSendRecvSmallMessage-4 50000 39320 ns/op BenchmarkMessengerSendRecvMediumMessage-4 50000 41990 ns/op BenchmarkMessengerSendRecvBigMessage-4 50000 42157 ns/op BenchmarkMessengerSendRecvLargeMessage-4 50000 45472 ns/op BenchmarkMessengerSendRecvMixedMessage-4 50000 47393 ns/op ok github.com/mesos/mesos-go/messenger 105.173s ``` ####environment: ``` OS: Linux yifan-laptop 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux CPU: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz MEM: 4G DDR3 1600MHz ``` mesos-go-0.0.1/messenger/decoder.go000066400000000000000000000367431257601144100172030ustar00rootroot00000000000000package messenger import ( "bufio" "bytes" "errors" "io" "net" "net/http" "net/textproto" "net/url" "strconv" "strings" "sync" "sync/atomic" "time" log "github.com/golang/glog" ) const ( DefaultReadTimeout = 5 * time.Second DefaultWriteTimeout = 5 * time.Second ) type decoderID int32 func (did decoderID) String() string { return "[" + strconv.Itoa(int(did)) + "]" } func (did *decoderID) next() decoderID { return decoderID(atomic.AddInt32((*int32)(did), 1)) } var ( errHijackFailed = errors.New("failed to hijack http connection") did decoderID // decoder ID counter closedChan = make(chan struct{}) ) func init() { close(closedChan) } type Decoder interface { Requests() <-chan *Request Err() <-chan error Cancel(bool) } type Request struct { *http.Request response chan<- Response // callers that are finished with a Request should ensure that response is *always* closed, regardless of whether a Response has been written. } type Response struct { code int reason string } type httpDecoder struct { req *http.Request // original request kalive bool // keepalive chunked bool // chunked msg chan *Request con net.Conn rw *bufio.ReadWriter errCh chan error buf *bytes.Buffer lrc *io.LimitedReader shouldQuit chan struct{} // signal chan, closes upon calls to Cancel(...) forceQuit chan struct{} // signal chan, indicates that quit is NOT graceful; closes upon Cancel(false) cancelGuard sync.Mutex readTimeout time.Duration writeTimeout time.Duration idtag string // useful for debugging sendError func(err error) // abstraction for error handling outCh chan *bytes.Buffer } // DecodeHTTP hijacks an HTTP server connection and generates mesos libprocess HTTP // requests via the returned chan. Upon generation of an error in the error chan the // decoder's internal goroutine will terminate. This func returns immediately. // The caller should immediately *stop* using the ResponseWriter and Request that were // passed as parameters; the decoder assumes full control of the HTTP transport. func DecodeHTTP(w http.ResponseWriter, r *http.Request) Decoder { id := did.next() d := &httpDecoder{ msg: make(chan *Request), errCh: make(chan error, 1), req: r, shouldQuit: make(chan struct{}), forceQuit: make(chan struct{}), readTimeout: DefaultReadTimeout, writeTimeout: DefaultWriteTimeout, idtag: id.String(), outCh: make(chan *bytes.Buffer), } d.sendError = d.defaultSendError go d.run(w) return d } func (d *httpDecoder) Requests() <-chan *Request { return d.msg } func (d *httpDecoder) Err() <-chan error { return d.errCh } // Cancel the decoding process; if graceful then process pending responses before terminating func (d *httpDecoder) Cancel(graceful bool) { log.V(2).Infof("%scancel:%t", d.idtag, graceful) d.cancelGuard.Lock() defer d.cancelGuard.Unlock() select { case <-d.shouldQuit: // already quitting, but perhaps gracefully? default: close(d.shouldQuit) } // allow caller to "upgrade" from a graceful cancel to a forced one if !graceful { select { case <-d.forceQuit: // already forcefully quitting default: close(d.forceQuit) // push it! } } } func (d *httpDecoder) run(res http.ResponseWriter) { defer func() { close(d.outCh) log.V(2).Infoln(d.idtag + "run: terminating") }() go func() { for buf := range d.outCh { select { case <-d.forceQuit: return default: } //TODO(jdef) I worry about this busy-looping for buf.Len() > 0 { d.tryFlushResponse(buf) } } }() var next httpState for state := d.bootstrapState(res); state != nil; state = next { next = state(d) } } // tryFlushResponse flushes the response buffer (if not empty); returns true if flush succeeded func (d *httpDecoder) tryFlushResponse(out *bytes.Buffer) { log.V(2).Infof(d.idtag+"try-flush-responses: %d bytes to flush", out.Len()) // set a write deadline here so that we don't block for very long. err := d.setWriteTimeout() if err != nil { // this is a problem because if we can't set the timeout then we can't guarantee // how long a write op might block for. Log the error and skip this response. log.Errorln("failed to set write deadline, aborting response:", err.Error()) } else { _, err = out.WriteTo(d.rw.Writer) if err != nil { if neterr, ok := err.(net.Error); ok && neterr.Timeout() && out.Len() > 0 { // we couldn't fully write before timing out, return rch and hope that // we have better luck next time. return } // we don't really know how to deal with other kinds of errors, so // log it and skip the rest of the response. log.Errorln("failed to write response buffer:", err.Error()) } err = d.rw.Flush() if err != nil { if neterr, ok := err.(net.Error); ok && neterr.Timeout() && out.Len() > 0 { return } log.Errorln("failed to flush response buffer:", err.Error()) } } } // TODO(jdef) make this a func on Response, to write its contents to a *bytes.Buffer func (d *httpDecoder) buildResponseEntity(resp *Response) *bytes.Buffer { log.V(2).Infoln(d.idtag + "build-response-entity") out := &bytes.Buffer{} // generate new response buffer content and continue; buffer should have // at least a response status-line w/ Content-Length: 0 out.WriteString("HTTP/1.1 ") out.WriteString(strconv.Itoa(resp.code)) out.WriteString(" ") out.WriteString(resp.reason) out.WriteString(crlf + "Content-Length: 0" + crlf) select { case <-d.shouldQuit: // this is the last request in the pipeline and we've been told to quit, so // indicate that the server will close the connection. out.WriteString("Connection: Close" + crlf) default: } out.WriteString(crlf) // this ends the HTTP response entity return out } // updateForRequest updates the chunked and kalive fields of the decoder to align // with the header values of the request func (d *httpDecoder) updateForRequest() { // check "Transfer-Encoding" for "chunked" d.chunked = false for _, v := range d.req.Header["Transfer-Encoding"] { if v == "chunked" { d.chunked = true break } } if !d.chunked && d.req.ContentLength < 0 { // strongly suspect that Go's internal net/http lib is stripping // the Transfer-Encoding header from the initial request, so this // workaround makes a very mesos-specific assumption: an unknown // Content-Length indicates a chunked stream. d.chunked = true } // check "Connection" for "Keep-Alive" d.kalive = d.req.Header.Get("Connection") == "Keep-Alive" log.V(2).Infof(d.idtag+"update-for-request: chunked %v keep-alive %v", d.chunked, d.kalive) } func (d *httpDecoder) readBodyContent() httpState { log.V(2).Info(d.idtag + "read-body-content") if d.chunked { d.buf = &bytes.Buffer{} return readChunkHeaderState } else { d.lrc = limit(d.rw.Reader, d.req.ContentLength) d.buf = &bytes.Buffer{} return readBodyState } } const http202response = "HTTP/1.1 202 OK\r\nContent-Length: 0\r\n\r\n" func (d *httpDecoder) generateRequest() httpState { log.V(2).Infof(d.idtag + "generate-request") // send a Request to msg b := d.buf.Bytes() rch := make(chan Response, 1) r := &Request{ Request: &http.Request{ Method: d.req.Method, URL: d.req.URL, Proto: d.req.Proto, ProtoMajor: d.req.ProtoMajor, ProtoMinor: d.req.ProtoMinor, Header: d.req.Header, Close: !d.kalive, Host: d.req.Host, RequestURI: d.req.RequestURI, Body: &body{bytes.NewBuffer(b)}, ContentLength: int64(len(b)), }, response: rch, } select { case d.msg <- r: case <-d.forceQuit: return terminateState } select { case <-d.forceQuit: return terminateState case resp, ok := <-rch: if ok { // response required, so build it and ship it out := d.buildResponseEntity(&resp) select { case <-d.forceQuit: return terminateState case d.outCh <- out: } } } if d.kalive { d.req = &http.Request{ ContentLength: -1, Header: make(http.Header), } return awaitRequestState } else { return gracefulTerminateState } } func (d *httpDecoder) defaultSendError(err error) { d.errCh <- err } type httpState func(d *httpDecoder) httpState // terminateState forcefully shuts down the state machine func terminateState(d *httpDecoder) httpState { log.V(2).Infoln(d.idtag + "terminate-state") // closing these chans tells Decoder users that it's wrapping up close(d.msg) close(d.errCh) // attempt to forcefully close the connection and signal response handlers that // no further responses should be written d.Cancel(false) if d.con != nil { d.con.Close() } // there is no spoon return nil } func gracefulTerminateState(d *httpDecoder) httpState { log.V(2).Infoln(d.idtag + "gracefully-terminate-state") // closing these chans tells Decoder users that it's wrapping up close(d.msg) close(d.errCh) // gracefully terminate the connection; signal that we should flush pending // responses before closing the connection. d.Cancel(true) return nil } func limit(r *bufio.Reader, limit int64) *io.LimitedReader { return &io.LimitedReader{ R: r, N: limit, } } // bootstrapState expects to be called when the standard net/http lib has already // read the initial request query line + headers from a connection. the request // is ready to be hijacked at this point. func (d *httpDecoder) bootstrapState(res http.ResponseWriter) httpState { log.V(2).Infoln(d.idtag + "bootstrap-state") d.updateForRequest() // hijack hj, ok := res.(http.Hijacker) if !ok { http.Error(res, "server does not support hijack", http.StatusInternalServerError) d.sendError(errHijackFailed) return terminateState } c, rw, err := hj.Hijack() if err != nil { http.Error(res, "failed to hijack the connection", http.StatusInternalServerError) d.sendError(errHijackFailed) return terminateState } d.rw = rw d.con = c return d.readBodyContent() } type body struct { *bytes.Buffer } func (b *body) Close() error { return nil } // checkTimeoutOrFail tests whether the given error is related to a timeout condition. // returns true if the caller should advance to the returned state. func (d *httpDecoder) checkTimeoutOrFail(err error, stateContinue httpState) (httpState, bool) { if err != nil { if neterr, ok := err.(net.Error); ok && neterr.Timeout() { select { case <-d.forceQuit: return terminateState, true case <-d.shouldQuit: return gracefulTerminateState, true default: return stateContinue, true } } d.sendError(err) return terminateState, true } return nil, false } func (d *httpDecoder) setReadTimeoutOrFail() bool { if d.readTimeout > 0 { err := d.con.SetReadDeadline(time.Now().Add(d.readTimeout)) if err != nil { d.sendError(err) return false } } return true } func (d *httpDecoder) setWriteTimeout() error { if d.writeTimeout > 0 { return d.con.SetWriteDeadline(time.Now().Add(d.writeTimeout)) } return nil } func readChunkHeaderState(d *httpDecoder) httpState { log.V(2).Infoln(d.idtag + "read-chunk-header-state") tr := textproto.NewReader(d.rw.Reader) if !d.setReadTimeoutOrFail() { return terminateState } hexlen, err := tr.ReadLine() if next, ok := d.checkTimeoutOrFail(err, readChunkHeaderState); ok { return next } clen, err := strconv.ParseInt(hexlen, 16, 64) if err != nil { d.sendError(err) return terminateState } if clen == 0 { return readEndOfChunkStreamState } d.lrc = limit(d.rw.Reader, clen) return readChunkState } func readChunkState(d *httpDecoder) httpState { log.V(2).Infoln(d.idtag+"read-chunk-state, bytes remaining:", d.lrc.N) if !d.setReadTimeoutOrFail() { return terminateState } _, err := d.buf.ReadFrom(d.lrc) if next, ok := d.checkTimeoutOrFail(err, readChunkState); ok { return next } return readEndOfChunkState } const crlf = "\r\n" func readEndOfChunkState(d *httpDecoder) httpState { log.V(2).Infoln(d.idtag + "read-end-of-chunk-state") if !d.setReadTimeoutOrFail() { return terminateState } b, err := d.rw.Reader.Peek(2) if len(b) == 2 { if string(b) == crlf { d.rw.ReadByte() d.rw.ReadByte() return readChunkHeaderState } d.sendError(errors.New(d.idtag + "unexpected data at end-of-chunk marker")) return terminateState } // less than two bytes avail if next, ok := d.checkTimeoutOrFail(err, readEndOfChunkState); ok { return next } panic("couldn't peek 2 bytes, but didn't get an error?!") } func readEndOfChunkStreamState(d *httpDecoder) httpState { log.V(2).Infoln(d.idtag + "read-end-of-chunk-stream-state") if !d.setReadTimeoutOrFail() { return terminateState } b, err := d.rw.Reader.Peek(2) if len(b) == 2 { if string(b) == crlf { d.rw.ReadByte() d.rw.ReadByte() return d.generateRequest() } d.sendError(errors.New(d.idtag + "unexpected data at end-of-chunk marker")) return terminateState } // less than 2 bytes avail if next, ok := d.checkTimeoutOrFail(err, readEndOfChunkStreamState); ok { return next } panic("couldn't peek 2 bytes, but didn't get an error?!") } func readBodyState(d *httpDecoder) httpState { log.V(2).Infof(d.idtag+"read-body-state: %d bytes remaining", d.lrc.N) // read remaining bytes into the buffer var err error if d.lrc.N > 0 { if !d.setReadTimeoutOrFail() { return terminateState } _, err = d.buf.ReadFrom(d.lrc) } if d.lrc.N <= 0 { return d.generateRequest() } if next, ok := d.checkTimeoutOrFail(err, readBodyState); ok { return next } return readBodyState } func awaitRequestState(d *httpDecoder) httpState { log.V(2).Infoln(d.idtag + "await-request-state") tr := textproto.NewReader(d.rw.Reader) if !d.setReadTimeoutOrFail() { return terminateState } requestLine, err := tr.ReadLine() if requestLine == "" && err == io.EOF { // we're actually expecting this at some point, so don't react poorly return gracefulTerminateState } if next, ok := d.checkTimeoutOrFail(err, awaitRequestState); ok { return next } ss := strings.SplitN(requestLine, " ", 3) if len(ss) < 3 { if err == io.EOF { return gracefulTerminateState } d.sendError(errors.New(d.idtag + "illegal request line")) return terminateState } r := d.req r.Method = ss[0] r.RequestURI = ss[1] r.URL, err = url.ParseRequestURI(ss[1]) if err != nil { d.sendError(err) return terminateState } major, minor, ok := http.ParseHTTPVersion(ss[2]) if !ok { d.sendError(errors.New(d.idtag + "malformed HTTP version")) return terminateState } r.ProtoMajor = major r.ProtoMinor = minor r.Proto = ss[2] return readHeaderState } func readHeaderState(d *httpDecoder) httpState { log.V(2).Infoln(d.idtag + "read-header-state") if !d.setReadTimeoutOrFail() { return terminateState } r := d.req tr := textproto.NewReader(d.rw.Reader) h, err := tr.ReadMIMEHeader() // merge any headers that were read successfully (before a possible error) for k, v := range h { if rh, exists := r.Header[k]; exists { r.Header[k] = append(rh, v...) } else { r.Header[k] = v } log.V(2).Infoln(d.idtag+"request header", k, v) } if next, ok := d.checkTimeoutOrFail(err, readHeaderState); ok { return next } // special headers: Host, Content-Length, Transfer-Encoding r.Host = r.Header.Get("Host") r.TransferEncoding = r.Header["Transfer-Encoding"] if cl := r.Header.Get("Content-Length"); cl != "" { l, err := strconv.ParseInt(cl, 10, 64) if err != nil { d.sendError(err) return terminateState } if l > -1 { r.ContentLength = l log.V(2).Infoln(d.idtag+"set content length", r.ContentLength) } } d.updateForRequest() return d.readBodyContent() } mesos-go-0.0.1/messenger/doc.go000066400000000000000000000003471257601144100163320ustar00rootroot00000000000000/* Package messenger includes a messenger and a transporter. The messenger provides interfaces to send a protobuf message through the underlying transporter. It also dispatches messages to installed handlers. */ package messenger mesos-go-0.0.1/messenger/http_transporter.go000066400000000000000000000377301257601144100212150ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 messenger import ( "bytes" "encoding/hex" "errors" "fmt" "io" "io/ioutil" "net" "net/http" "net/url" "os" "strings" "sync" "syscall" "time" log "github.com/golang/glog" "github.com/mesos/mesos-go/upid" "golang.org/x/net/context" ) var ( discardOnStopError = fmt.Errorf("discarding message because transport is shutting down") errNotStarted = errors.New("HTTP transport has not been started") errTerminal = errors.New("HTTP transport is terminated") errAlreadyRunning = errors.New("HTTP transport is already running") ) // httpTransporter is a subset of the Transporter interface type httpTransporter interface { Send(ctx context.Context, msg *Message) error Recv() (*Message, error) Inject(ctx context.Context, msg *Message) error Install(messageName string) Start() <-chan error Stop(graceful bool) error } type notStartedState struct { h *HTTPTransporter } type stoppedState struct{} type runningState struct { *notStartedState } /* -- not-started state */ func (s *notStartedState) Send(ctx context.Context, msg *Message) error { return errNotStarted } func (s *notStartedState) Recv() (*Message, error) { return nil, errNotStarted } func (s *notStartedState) Inject(ctx context.Context, msg *Message) error { return errNotStarted } func (s *notStartedState) Stop(graceful bool) error { return errNotStarted } func (s *notStartedState) Install(messageName string) { s.h.install(messageName) } func (s *notStartedState) Start() <-chan error { s.h.state = &runningState{s} return s.h.start() } /* -- stopped state */ func (s *stoppedState) Send(ctx context.Context, msg *Message) error { return errTerminal } func (s *stoppedState) Recv() (*Message, error) { return nil, errTerminal } func (s *stoppedState) Inject(ctx context.Context, msg *Message) error { return errTerminal } func (s *stoppedState) Stop(graceful bool) error { return errTerminal } func (s *stoppedState) Install(messageName string) {} func (s *stoppedState) Start() <-chan error { ch := make(chan error, 1) ch <- errTerminal return ch } /* -- running state */ func (s *runningState) Send(ctx context.Context, msg *Message) error { return s.h.send(ctx, msg) } func (s *runningState) Recv() (*Message, error) { return s.h.recv() } func (s *runningState) Inject(ctx context.Context, msg *Message) error { return s.h.inject(ctx, msg) } func (s *runningState) Stop(graceful bool) error { s.h.state = &stoppedState{} return s.h.stop(graceful) } func (s *runningState) Start() <-chan error { ch := make(chan error, 1) ch <- errAlreadyRunning return ch } // HTTPTransporter implements the interfaces of the Transporter. type HTTPTransporter struct { // If the host is empty("") then it will listen on localhost. // If the port is empty("") then it will listen on random port. upid *upid.UPID listener net.Listener // TODO(yifan): Change to TCPListener. mux *http.ServeMux tr *http.Transport client *http.Client // TODO(yifan): Set read/write deadline. messageQueue chan *Message address net.IP // optional binding address shouldQuit chan struct{} stateLock sync.RWMutex // protect lifecycle (start/stop) funcs state httpTransporter } // NewHTTPTransporter creates a new http transporter with an optional binding address. func NewHTTPTransporter(upid *upid.UPID, address net.IP) *HTTPTransporter { tr := &http.Transport{} result := &HTTPTransporter{ upid: upid, messageQueue: make(chan *Message, defaultQueueSize), mux: http.NewServeMux(), client: &http.Client{Transport: tr}, tr: tr, address: address, shouldQuit: make(chan struct{}), } result.state = ¬StartedState{result} return result } func (t *HTTPTransporter) getState() httpTransporter { t.stateLock.RLock() defer t.stateLock.RUnlock() return t.state } // some network errors are probably recoverable, attempt to determine that here. func isRecoverableError(err error) bool { if urlErr, ok := err.(*url.Error); ok { log.V(2).Infof("checking url.Error for recoverability") return urlErr.Op == "Post" && isRecoverableError(urlErr.Err) } else if netErr, ok := err.(*net.OpError); ok && netErr.Err != nil { log.V(2).Infof("checking net.OpError for recoverability: %#v", err) if netErr.Temporary() { return true } //TODO(jdef) this is pretty hackish, there's probably a better way //TODO(jdef) should also check for EHOSTDOWN and EHOSTUNREACH return (netErr.Op == "dial" && netErr.Net == "tcp" && netErr.Err == syscall.ECONNREFUSED) } log.V(2).Infof("unrecoverable error: %#v", err) return false } type recoverableError struct { Err error } func (e *recoverableError) Error() string { if e == nil { return "" } return e.Err.Error() } // Send sends the message to its specified upid. func (t *HTTPTransporter) Send(ctx context.Context, msg *Message) (sendError error) { return t.getState().Send(ctx, msg) } func (t *HTTPTransporter) send(ctx context.Context, msg *Message) (sendError error) { log.V(2).Infof("Sending message to %v via http\n", msg.UPID) req, err := t.makeLibprocessRequest(msg) if err != nil { log.Errorf("Failed to make libprocess request: %v\n", err) return err } duration := 1 * time.Second for attempt := 0; attempt < 5; attempt++ { //TODO(jdef) extract/parameterize constant if sendError != nil { duration *= 2 log.Warningf("attempting to recover from error '%v', waiting before retry: %v", sendError, duration) select { case <-ctx.Done(): return ctx.Err() case <-time.After(duration): // ..retry request, continue case <-t.shouldQuit: return discardOnStopError } } sendError = t.httpDo(ctx, req, func(resp *http.Response, err error) error { if err != nil { if isRecoverableError(err) { return &recoverableError{Err: err} } log.Infof("Failed to POST: %v\n", err) return err } defer resp.Body.Close() // ensure master acknowledgement. if (resp.StatusCode != http.StatusOK) && (resp.StatusCode != http.StatusAccepted) { msg := fmt.Sprintf("Master %s rejected %s. Returned status %s.", msg.UPID, msg.RequestURI(), resp.Status) log.Warning(msg) return fmt.Errorf(msg) } return nil }) if sendError == nil { // success return } else if _, ok := sendError.(*recoverableError); ok { // recoverable, attempt backoff? continue } // unrecoverable break } if recoverable, ok := sendError.(*recoverableError); ok { sendError = recoverable.Err } return } func (t *HTTPTransporter) httpDo(ctx context.Context, req *http.Request, f func(*http.Response, error) error) error { select { case <-ctx.Done(): return ctx.Err() case <-t.shouldQuit: return discardOnStopError default: // continue } c := make(chan error, 1) go func() { c <- f(t.client.Do(req)) }() select { case <-ctx.Done(): t.tr.CancelRequest(req) <-c // Wait for f to return. return ctx.Err() case err := <-c: return err case <-t.shouldQuit: t.tr.CancelRequest(req) <-c // Wait for f to return. return discardOnStopError } } // Recv returns the message, one at a time. func (t *HTTPTransporter) Recv() (*Message, error) { return t.getState().Recv() } func (t *HTTPTransporter) recv() (*Message, error) { select { default: select { case msg := <-t.messageQueue: return msg, nil case <-t.shouldQuit: } case <-t.shouldQuit: } return nil, discardOnStopError } //Inject places a message into the incoming message queue. func (t *HTTPTransporter) Inject(ctx context.Context, msg *Message) error { return t.getState().Inject(ctx, msg) } func (t *HTTPTransporter) inject(ctx context.Context, msg *Message) error { select { case <-ctx.Done(): return ctx.Err() case <-t.shouldQuit: return discardOnStopError default: // continue } select { case t.messageQueue <- msg: return nil case <-ctx.Done(): return ctx.Err() case <-t.shouldQuit: return discardOnStopError } } // Install the request URI according to the message's name. func (t *HTTPTransporter) Install(msgName string) { t.getState().Install(msgName) } func (t *HTTPTransporter) install(msgName string) { requestURI := fmt.Sprintf("/%s/%s", t.upid.ID, msgName) t.mux.HandleFunc(requestURI, t.messageDecoder) } type loggedListener struct { delegate net.Listener done <-chan struct{} } func (l *loggedListener) Accept() (c net.Conn, err error) { c, err = l.delegate.Accept() if c != nil { log.Infoln("accepted connection from", c.RemoteAddr()) c = logConnection(c) } else if err != nil { select { case <-l.done: default: log.Errorln("failed to accept connection:", err.Error()) } } return } func (l *loggedListener) Close() (err error) { err = l.delegate.Close() if err != nil { select { case <-l.done: default: log.Errorln("error closing listener:", err.Error()) } } else { log.Infoln("closed listener") } return } func (l *loggedListener) Addr() net.Addr { return l.delegate.Addr() } func logConnection(c net.Conn) net.Conn { w := hex.Dumper(os.Stdout) r := io.TeeReader(c, w) return &loggedConnection{ Conn: c, reader: r, } } type loggedConnection struct { net.Conn reader io.Reader } func (c *loggedConnection) Read(b []byte) (int, error) { return c.reader.Read(b) } // Listen starts listen on UPID. If UPID is empty, the transporter // will listen on a random port, and then fill the UPID with the // host:port it is listening. func (t *HTTPTransporter) listen() error { var host string if t.address != nil { host = t.address.String() } else { host = t.upid.Host } var port string if t.upid.Port != "" { port = t.upid.Port } else { port = "0" } // NOTE: Explicitly specifies IPv4 because Libprocess // only supports IPv4 for now. ln, err := net.Listen("tcp4", net.JoinHostPort(host, port)) if err != nil { log.Errorf("HTTPTransporter failed to listen: %v\n", err) return err } // Save the host:port in case they are not specified in upid. host, port, _ = net.SplitHostPort(ln.Addr().String()) log.Infoln("listening on", host, "port", port) if len(t.upid.Host) == 0 { t.upid.Host = host } if len(t.upid.Port) == 0 || t.upid.Port == "0" { t.upid.Port = port } if log.V(3) { t.listener = &loggedListener{delegate: ln, done: t.shouldQuit} } else { t.listener = ln } return nil } // Start starts the http transporter func (t *HTTPTransporter) Start() <-chan error { t.stateLock.Lock() defer t.stateLock.Unlock() return t.state.Start() } // start expects to be guarded by stateLock func (t *HTTPTransporter) start() <-chan error { ch := make(chan error, 1) if err := t.listen(); err != nil { ch <- err } else { // TODO(yifan): Set read/write deadline. go func() { s := &http.Server{ ReadTimeout: DefaultReadTimeout, WriteTimeout: DefaultWriteTimeout, Handler: t.mux, } err := s.Serve(t.listener) select { case <-t.shouldQuit: ch <- nil default: if err != nil && log.V(1) { log.Errorln("HTTP server stopped with error", err.Error()) } ch <- err t.Stop(false) } }() } return ch } // Stop stops the http transporter by closing the listener. func (t *HTTPTransporter) Stop(graceful bool) error { t.stateLock.Lock() defer t.stateLock.Unlock() return t.state.Stop(graceful) } // stop expects to be guarded by stateLock func (t *HTTPTransporter) stop(graceful bool) error { close(t.shouldQuit) log.Info("stopping HTTP transport") //TODO(jdef) if graceful, wait for pending requests to terminate err := t.listener.Close() return err } // UPID returns the upid of the transporter. func (t *HTTPTransporter) UPID() *upid.UPID { return t.upid } func (t *HTTPTransporter) messageDecoder(w http.ResponseWriter, r *http.Request) { // Verify it's a libprocess request. from, err := getLibprocessFrom(r) if err != nil { log.Errorf("Ignoring the request, because it's not a libprocess request: %v\n", err) w.WriteHeader(http.StatusBadRequest) return } decoder := DecodeHTTP(w, r) defer decoder.Cancel(true) //TODO(jdef) Only send back an HTTP response if this isn't from libprocess // (which we determine by looking at the User-Agent). This is // necessary because older versions of libprocess would try and // recv the data and parse it as an HTTP request which would // fail thus causing the socket to get closed (but now // libprocess will ignore responses, see ignore_data). // see https://github.com/apache/mesos/blob/adecbfa6a216815bd7dc7d26e721c4c87e465c30/3rdparty/libprocess/src/process.cpp#L2192 for { if r, ok := <-decoder.Requests(); ok { if func() bool { // regardless of whether we write a Response we must close this chan defer close(r.response) //TODO(jdef) this is probably inefficient given the current implementation of the // decoder: no need to make another copy of data that's already competely buffered data, err := ioutil.ReadAll(r.Body) if err != nil { // this is unlikely given the current implementation of the decoder: // the body has been completely buffered in memory already log.Errorf("failed to read HTTP body: %v\n", err) return true } log.V(2).Infof("Receiving %s %v from %v, length %v\n", r.Method, r.URL, from, len(data)) m := &Message{ UPID: from, Name: extractNameFromRequestURI(r.RequestURI), Bytes: data, } keepGoing := true select { case <-t.shouldQuit: keepGoing = false case t.messageQueue <- m: } // if user-agent != libprocess then we need to send a response if _, ok := parseLibprocessAgent(r.Header); !ok { log.V(2).Infof("not libprocess agent, sending a 202") r.response <- Response{ code: 202, reason: "Accepted", } } return keepGoing }() { continue } } if err, ok := <-decoder.Err(); ok { log.Errorf("failed to decode HTTP message: %v", err) return } } } func (t *HTTPTransporter) makeLibprocessRequest(msg *Message) (*http.Request, error) { if msg.UPID == nil { panic(fmt.Sprintf("message is missing UPID: %+v", msg)) } hostport := net.JoinHostPort(msg.UPID.Host, msg.UPID.Port) targetURL := fmt.Sprintf("http://%s%s", hostport, msg.RequestURI()) log.V(2).Infof("libproc target URL %s", targetURL) req, err := http.NewRequest("POST", targetURL, bytes.NewReader(msg.Bytes)) if err != nil { log.Errorf("Failed to create request: %v\n", err) return nil, err } req.Header.Add("Libprocess-From", t.upid.String()) req.Header.Add("Content-Type", "application/x-protobuf") req.Header.Add("Connection", "Keep-Alive") return req, nil } func getLibprocessFrom(r *http.Request) (*upid.UPID, error) { if r.Method != "POST" { return nil, fmt.Errorf("Not a POST request") } if agent, ok := parseLibprocessAgent(r.Header); ok { return upid.Parse(agent) } lf, ok := r.Header["Libprocess-From"] if ok { // TODO(yifan): Just take the first field for now. return upid.Parse(lf[0]) } return nil, fmt.Errorf("Cannot find 'User-Agent' or 'Libprocess-From'") } func parseLibprocessAgent(h http.Header) (string, bool) { const prefix = "libprocess/" if ua, ok := h["User-Agent"]; ok { for _, agent := range ua { if strings.HasPrefix(agent, prefix) { return agent[len(prefix):], true } } } return "", false } mesos-go-0.0.1/messenger/http_transporter_test.go000066400000000000000000000211121257601144100222370ustar00rootroot00000000000000package messenger import ( "fmt" "net" "net/http" "net/http/httptest" "regexp" "strconv" "testing" "time" "github.com/mesos/mesos-go/messenger/testmessage" "github.com/mesos/mesos-go/upid" "github.com/stretchr/testify/assert" "golang.org/x/net/context" ) func TestTransporterNew(t *testing.T) { id, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(t, err) trans := NewHTTPTransporter(id, nil) assert.NotNil(t, trans) assert.NotNil(t, trans.upid) assert.NotNil(t, trans.messageQueue) assert.NotNil(t, trans.client) } func TestTransporterSend(t *testing.T) { idreg := regexp.MustCompile(`[A-Za-z0-9_\-]+@[A-Za-z0-9_\-\.]+:[0-9]+`) serverId := "testserver" // setup mesos client-side fromUpid, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(t, err) protoMsg := testmessage.GenerateSmallMessage() msgName := getMessageName(protoMsg) msg := &Message{ Name: msgName, ProtoMessage: protoMsg, } requestURI := fmt.Sprintf("/%s/%s", serverId, msgName) // setup server-side msgReceived := make(chan struct{}) srv := makeMockServer(requestURI, func(rsp http.ResponseWriter, req *http.Request) { defer close(msgReceived) from := req.Header.Get("Libprocess-From") assert.NotEmpty(t, from) assert.True(t, idreg.MatchString(from), fmt.Sprintf("regexp failed for '%v'", from)) }) defer srv.Close() toUpid, err := upid.Parse(fmt.Sprintf("%s@%s", serverId, srv.Listener.Addr().String())) assert.NoError(t, err) // make transport call. transport := NewHTTPTransporter(fromUpid, nil) errch := transport.Start() defer transport.Stop(false) msg.UPID = toUpid err = transport.Send(context.TODO(), msg) assert.NoError(t, err) select { case <-time.After(2 * time.Second): t.Fatalf("timed out waiting for message receipt") case <-msgReceived: case err := <-errch: if err != nil { t.Fatalf(err.Error()) } } } func TestTransporter_DiscardedSend(t *testing.T) { serverId := "testserver" // setup mesos client-side fromUpid, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(t, err) protoMsg := testmessage.GenerateSmallMessage() msgName := getMessageName(protoMsg) msg := &Message{ Name: msgName, ProtoMessage: protoMsg, } requestURI := fmt.Sprintf("/%s/%s", serverId, msgName) // setup server-side msgReceived := make(chan struct{}) srv := makeMockServer(requestURI, func(rsp http.ResponseWriter, req *http.Request) { close(msgReceived) time.Sleep(2 * time.Second) // long enough that we should be able to stop it }) defer srv.Close() toUpid, err := upid.Parse(fmt.Sprintf("%s@%s", serverId, srv.Listener.Addr().String())) assert.NoError(t, err) // make transport call. transport := NewHTTPTransporter(fromUpid, nil) errch := transport.Start() defer transport.Stop(false) msg.UPID = toUpid senderr := make(chan struct{}) go func() { defer close(senderr) err = transport.Send(context.TODO(), msg) assert.NotNil(t, err) assert.Equal(t, discardOnStopError, err) }() // wait for message to be received select { case <-time.After(2 * time.Second): t.Fatalf("timed out waiting for message receipt") return case <-msgReceived: transport.Stop(false) case err := <-errch: if err != nil { t.Fatalf(err.Error()) return } } // wait for send() to process discarded-error select { case <-time.After(5 * time.Second): t.Fatalf("timed out waiting for aborted send") return case <-senderr: // continue } } func TestTransporterStartAndRcvd(t *testing.T) { serverId := "testserver" serverPort := getNewPort() serverAddr := "127.0.0.1:" + strconv.Itoa(serverPort) protoMsg := testmessage.GenerateSmallMessage() msgName := getMessageName(protoMsg) ctrl := make(chan struct{}) // setup receiver (server) process rcvPid, err := upid.Parse(fmt.Sprintf("%s@%s", serverId, serverAddr)) assert.NoError(t, err) receiver := NewHTTPTransporter(rcvPid, nil) receiver.Install(msgName) go func() { defer close(ctrl) t.Logf("received something...") msg, err := receiver.Recv() assert.Nil(t, err) assert.NotNil(t, msg) if msg != nil { assert.Equal(t, msgName, msg.Name) } }() errch := receiver.Start() defer receiver.Stop(false) assert.NotNil(t, errch) time.Sleep(time.Millisecond * 7) // time to catchup // setup sender (client) process sndUpid, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(t, err) sender := NewHTTPTransporter(sndUpid, nil) msg := &Message{ UPID: rcvPid, Name: msgName, ProtoMessage: protoMsg, } errch2 := sender.Start() defer sender.Stop(false) t.Logf("sending test message") sender.Send(context.TODO(), msg) select { case <-time.After(time.Second * 5): t.Fatalf("Timeout") case <-ctrl: case err := <-errch: if err != nil { t.Fatalf(err.Error()) } case err := <-errch2: if err != nil { t.Fatalf(err.Error()) } } } func TestTransporterStartAndInject(t *testing.T) { serverId := "testserver" serverPort := getNewPort() serverAddr := "127.0.0.1:" + strconv.Itoa(serverPort) protoMsg := testmessage.GenerateSmallMessage() msgName := getMessageName(protoMsg) ctrl := make(chan struct{}) // setup receiver (server) process rcvPid, err := upid.Parse(fmt.Sprintf("%s@%s", serverId, serverAddr)) assert.NoError(t, err) receiver := NewHTTPTransporter(rcvPid, nil) receiver.Install(msgName) errch := receiver.Start() defer receiver.Stop(false) msg := &Message{ UPID: rcvPid, Name: msgName, ProtoMessage: protoMsg, } receiver.Inject(context.TODO(), msg) go func() { defer close(ctrl) msg, err := receiver.Recv() assert.Nil(t, err) assert.NotNil(t, msg) if msg != nil { assert.Equal(t, msgName, msg.Name) } }() select { case <-time.After(time.Second * 1): t.Fatalf("Timeout") case <-ctrl: case err := <-errch: if err != nil { t.Fatalf(err.Error()) } } } func TestTransporterStartAndStop(t *testing.T) { serverId := "testserver" serverPort := getNewPort() serverAddr := "127.0.0.1:" + strconv.Itoa(serverPort) // setup receiver (server) process rcvPid, err := upid.Parse(fmt.Sprintf("%s@%s", serverId, serverAddr)) assert.NoError(t, err) receiver := NewHTTPTransporter(rcvPid, nil) errch := receiver.Start() assert.NotNil(t, errch) time.Sleep(1 * time.Second) receiver.Stop(false) select { case <-time.After(2 * time.Second): t.Fatalf("timed out waiting for transport to stop") case err := <-errch: if err != nil { t.Fatalf(err.Error()) } } } func TestMutatedHostUPid(t *testing.T) { serverId := "testserver" // NOTE(tsenart): This static port can cause conflicts if multiple instances // of this test run concurrently or else if this port is already bound by // another socket. serverPort := 12345 serverHost := "127.0.0.1" serverAddr := serverHost + ":" + strconv.Itoa(serverPort) // override the upid.Host with this listener IP addr := net.ParseIP("0.0.0.0") // setup receiver (server) process uPid, err := upid.Parse(fmt.Sprintf("%s@%s", serverId, serverAddr)) assert.NoError(t, err) receiver := NewHTTPTransporter(uPid, addr) err = receiver.listen() assert.NoError(t, err) if receiver.upid.Host != "127.0.0.1" { t.Fatalf("reciever.upid.Host was expected to return %s, got %s\n", serverHost, receiver.upid.Host) } if receiver.upid.Port != strconv.Itoa(serverPort) { t.Fatalf("receiver.upid.Port was expected to return %d, got %s\n", serverPort, receiver.upid.Port) } } func TestEmptyHostPortUPid(t *testing.T) { serverId := "testserver" serverPort := getNewPort() serverHost := "127.0.0.1" serverAddr := serverHost + ":" + strconv.Itoa(serverPort) // setup receiver (server) process uPid, err := upid.Parse(fmt.Sprintf("%s@%s", serverId, serverAddr)) assert.NoError(t, err) // Unset upid host and port uPid.Host = "" uPid.Port = "" // override the upid.Host with this listener IP addr := net.ParseIP("0.0.0.0") receiver := NewHTTPTransporter(uPid, addr) err = receiver.listen() assert.NoError(t, err) // This should be the host that overrides as uPid.Host is empty if receiver.upid.Host != "0.0.0.0" { t.Fatalf("reciever.upid.Host was expected to return %s, got %s\n", serverHost, receiver.upid.Host) } // This should end up being a random port, not the server port as uPid // port is empty if receiver.upid.Port == strconv.Itoa(serverPort) { t.Fatalf("receiver.upid.Port was not expected to return %d, got %s\n", serverPort, receiver.upid.Port) } } func makeMockServer(path string, handler func(rsp http.ResponseWriter, req *http.Request)) *httptest.Server { mux := http.NewServeMux() mux.HandleFunc(path, handler) return httptest.NewServer(mux) } mesos-go-0.0.1/messenger/message.go000066400000000000000000000025611257601144100172110ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 messenger import ( "fmt" "strings" "github.com/gogo/protobuf/proto" "github.com/mesos/mesos-go/upid" ) // Message defines the type that passes in the Messenger. type Message struct { UPID *upid.UPID Name string ProtoMessage proto.Message Bytes []byte } // RequestURI returns the request URI of the message. func (m *Message) RequestURI() string { return fmt.Sprintf("/%s/%s", m.UPID.ID, m.Name) } // NOTE: This should not fail or panic. func extractNameFromRequestURI(requestURI string) string { return strings.Split(requestURI, "/")[2] } mesos-go-0.0.1/messenger/messenger.go000066400000000000000000000264651257601144100175660ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 messenger import ( "flag" "fmt" "net" "reflect" "strconv" "sync" "time" "github.com/gogo/protobuf/proto" log "github.com/golang/glog" mesos "github.com/mesos/mesos-go/mesosproto" "github.com/mesos/mesos-go/mesosutil/process" "github.com/mesos/mesos-go/upid" "golang.org/x/net/context" ) const ( defaultQueueSize = 1024 preparePeriod = time.Second * 1 ) var ( sendRoutines int encodeRoutines int decodeRoutines int ) func init() { flag.IntVar(&sendRoutines, "send-routines", 1, "Number of network sending routines") flag.IntVar(&encodeRoutines, "encode-routines", 1, "Number of encoding routines") flag.IntVar(&decodeRoutines, "decode-routines", 1, "Number of decoding routines") } // MessageHandler is the callback of the message. When the callback // is invoked, the sender's upid and the message is passed to the callback. type MessageHandler func(from *upid.UPID, pbMsg proto.Message) // Messenger defines the interfaces that should be implemented. type Messenger interface { Install(handler MessageHandler, msg proto.Message) error Send(ctx context.Context, upid *upid.UPID, msg proto.Message) error Route(ctx context.Context, from *upid.UPID, msg proto.Message) error Start() error Stop() error UPID() *upid.UPID } // MesosMessenger is an implementation of the Messenger interface. type MesosMessenger struct { upid *upid.UPID encodingQueue chan *Message sendingQueue chan *Message installedMessages map[string]reflect.Type installedHandlers map[string]MessageHandler stop chan struct{} stopOnce sync.Once tr Transporter } // ForHostname creates a new default messenger (HTTP), using UPIDBindingAddress to // determine the binding-address used for both the UPID.Host and Transport binding address. func ForHostname(proc *process.Process, hostname string, bindingAddress net.IP, port uint16, publishedAddress net.IP) (Messenger, error) { upid := &upid.UPID{ ID: proc.Label(), Port: strconv.Itoa(int(port)), } host, err := UPIDBindingAddress(hostname, bindingAddress) if err != nil { return nil, err } var publishedHost string if publishedAddress != nil { publishedHost, err = UPIDBindingAddress(hostname, publishedAddress) if err != nil { return nil, err } } if publishedHost != "" { upid.Host = publishedHost } else { upid.Host = host } return NewHttpWithBindingAddress(upid, bindingAddress), nil } // UPIDBindingAddress determines the value of UPID.Host that will be used to build // a Transport. If a non-nil, non-wildcard bindingAddress is specified then it will be used // for both the UPID and Transport binding address. Otherwise hostname is resolved to an IP // address and the UPID.Host is set to that address and the bindingAddress is passed through // to the Transport. func UPIDBindingAddress(hostname string, bindingAddress net.IP) (string, error) { upidHost := "" if bindingAddress != nil && "0.0.0.0" != bindingAddress.String() { upidHost = bindingAddress.String() } else { if hostname == "" || hostname == "0.0.0.0" { return "", fmt.Errorf("invalid hostname (%q) specified with binding address %v", hostname, bindingAddress) } ip := net.ParseIP(hostname) if ip != nil { ip = ip.To4() } if ip == nil { ips, err := net.LookupIP(hostname) if err != nil { return "", err } // try to find an ipv4 and use that for _, addr := range ips { if ip = addr.To4(); ip != nil { break } } if ip == nil { // no ipv4? best guess, just take the first addr if len(ips) > 0 { ip = ips[0] log.Warningf("failed to find an IPv4 address for '%v', best guess is '%v'", hostname, ip) } else { return "", fmt.Errorf("failed to determine IP address for host '%v'", hostname) } } } upidHost = ip.String() } return upidHost, nil } // NewMesosMessenger creates a new mesos messenger. func NewHttp(upid *upid.UPID) *MesosMessenger { return NewHttpWithBindingAddress(upid, nil) } func NewHttpWithBindingAddress(upid *upid.UPID, address net.IP) *MesosMessenger { return New(upid, NewHTTPTransporter(upid, address)) } func New(upid *upid.UPID, t Transporter) *MesosMessenger { return &MesosMessenger{ upid: upid, encodingQueue: make(chan *Message, defaultQueueSize), sendingQueue: make(chan *Message, defaultQueueSize), installedMessages: make(map[string]reflect.Type), installedHandlers: make(map[string]MessageHandler), tr: t, } } /// Install installs the handler with the given message. func (m *MesosMessenger) Install(handler MessageHandler, msg proto.Message) error { // Check if the message is a pointer. mtype := reflect.TypeOf(msg) if mtype.Kind() != reflect.Ptr { return fmt.Errorf("Message %v is not a Ptr type", msg) } // Check if the message is already installed. name := getMessageName(msg) if _, ok := m.installedMessages[name]; ok { return fmt.Errorf("Message %v is already installed", name) } m.installedMessages[name] = mtype.Elem() m.installedHandlers[name] = handler m.tr.Install(name) return nil } // Send puts a message into the outgoing queue, waiting to be sent. // With buffered channels, this will not block under moderate throughput. // When an error is generated, the error can be communicated by placing // a message on the incoming queue to be handled upstream. func (m *MesosMessenger) Send(ctx context.Context, upid *upid.UPID, msg proto.Message) error { if upid == nil { panic("cannot sent a message to a nil pid") } else if upid.Equal(m.upid) { return fmt.Errorf("Send the message to self") } name := getMessageName(msg) log.V(2).Infof("Sending message %v to %v\n", name, upid) select { case <-ctx.Done(): return ctx.Err() case m.encodingQueue <- &Message{upid, name, msg, nil}: return nil } } // Route puts a message either in the incoming or outgoing queue. // This method is useful for: // 1) routing internal error to callback handlers // 2) testing components without starting remote servers. func (m *MesosMessenger) Route(ctx context.Context, upid *upid.UPID, msg proto.Message) error { // if destination is not self, send to outbound. if !upid.Equal(m.upid) { return m.Send(ctx, upid, msg) } // TODO(jdef) this has an unfortunate performance impact for self-messaging. implement // something more reasonable here. data, err := proto.Marshal(msg) if err != nil { return err } name := getMessageName(msg) return m.tr.Inject(ctx, &Message{upid, name, msg, data}) } // Start starts the messenger. func (m *MesosMessenger) Start() error { m.stop = make(chan struct{}) errChan := m.tr.Start() select { case err := <-errChan: log.Errorf("failed to start messenger: %v", err) return err case <-time.After(preparePeriod): // continue } m.upid = m.tr.UPID() for i := 0; i < sendRoutines; i++ { go m.sendLoop() } for i := 0; i < encodeRoutines; i++ { go m.encodeLoop() } for i := 0; i < decodeRoutines; i++ { go m.decodeLoop() } go func() { select { case err := <-errChan: if err != nil { //TODO(jdef) should the driver abort in this case? probably //since this messenger will never attempt to re-establish the //transport log.Errorln("transport stopped unexpectedly:", err.Error()) } err = m.Stop() if err != nil && err != errTerminal { log.Errorln("failed to stop messenger cleanly: ", err.Error()) } case <-m.stop: } }() return nil } // Stop stops the messenger and clean up all the goroutines. func (m *MesosMessenger) Stop() error { defer m.stopOnce.Do(func() { close(m.stop) }) log.Info("stopping messenger..") //TODO(jdef) don't hardcode the graceful flag here if err := m.tr.Stop(true); err != nil && err != errTerminal { log.Errorf("failed to stop the transporter: %v\n", err) return err } return nil } // UPID returns the upid of the messenger. func (m *MesosMessenger) UPID() *upid.UPID { return m.upid } func (m *MesosMessenger) encodeLoop() { for { select { case <-m.stop: return case msg := <-m.encodingQueue: e := func() error { //TODO(jdef) implement timeout for context ctx, cancel := context.WithCancel(context.TODO()) defer cancel() b, err := proto.Marshal(msg.ProtoMessage) if err != nil { return err } msg.Bytes = b select { case <-ctx.Done(): return ctx.Err() case m.sendingQueue <- msg: return nil } }() if e != nil { m.reportError(fmt.Errorf("Failed to enqueue message %v: %v", msg, e)) } } } } func (m *MesosMessenger) reportError(err error) { log.V(2).Info(err) //TODO(jdef) implement timeout for context ctx, cancel := context.WithCancel(context.TODO()) defer cancel() c := make(chan error, 1) go func() { c <- m.Route(ctx, m.UPID(), &mesos.FrameworkErrorMessage{Message: proto.String(err.Error())}) }() select { case <-ctx.Done(): <-c // wait for Route to return case e := <-c: if e != nil { log.Errorf("failed to report error %v due to: %v", err, e) } } } func (m *MesosMessenger) sendLoop() { for { select { case <-m.stop: return case msg := <-m.sendingQueue: e := func() error { //TODO(jdef) implement timeout for context ctx, cancel := context.WithCancel(context.TODO()) defer cancel() c := make(chan error, 1) go func() { c <- m.tr.Send(ctx, msg) }() select { case <-ctx.Done(): // Transport layer must use the context to detect cancelled requests. <-c // wait for Send to return return ctx.Err() case err := <-c: return err } }() if e != nil { m.reportError(fmt.Errorf("Failed to send message %v: %v", msg.Name, e)) } } } } // Since HTTPTransporter.Recv() is already buffered, so we don't need a 'recvLoop' here. func (m *MesosMessenger) decodeLoop() { for { select { case <-m.stop: return default: } msg, err := m.tr.Recv() if err != nil { if err == discardOnStopError { log.V(1).Info("exiting decodeLoop, transport shutting down") return } else { panic(fmt.Sprintf("unexpected transport error: %v", err)) } } log.V(2).Infof("Receiving message %v from %v\n", msg.Name, msg.UPID) msg.ProtoMessage = reflect.New(m.installedMessages[msg.Name]).Interface().(proto.Message) if err := proto.Unmarshal(msg.Bytes, msg.ProtoMessage); err != nil { log.Errorf("Failed to unmarshal message %v: %v\n", msg, err) continue } // TODO(yifan): Catch panic. m.installedHandlers[msg.Name](msg.UPID, msg.ProtoMessage) } } // getMessageName returns the name of the message in the mesos manner. func getMessageName(msg proto.Message) string { return fmt.Sprintf("%v.%v", "mesos.internal", reflect.TypeOf(msg).Elem().Name()) } mesos-go-0.0.1/messenger/messenger_test.go000066400000000000000000000275651257601144100206270ustar00rootroot00000000000000package messenger import ( "fmt" "math/rand" "net" "net/http" "net/http/httptest" "sync" "testing" "time" "github.com/gogo/protobuf/proto" "github.com/mesos/mesos-go/messenger/testmessage" "github.com/mesos/mesos-go/upid" "github.com/stretchr/testify/assert" "golang.org/x/net/context" ) var ( globalWG = new(sync.WaitGroup) ) func noopHandler(*upid.UPID, proto.Message) { globalWG.Done() } func getNewPort() int { return 0 } func shuffleMessages(queue *[]proto.Message) { for i := range *queue { index := rand.Intn(i + 1) (*queue)[i], (*queue)[index] = (*queue)[index], (*queue)[i] } } func generateSmallMessages(n int) []proto.Message { queue := make([]proto.Message, n) for i := range queue { queue[i] = testmessage.GenerateSmallMessage() } return queue } func generateMediumMessages(n int) []proto.Message { queue := make([]proto.Message, n) for i := range queue { queue[i] = testmessage.GenerateMediumMessage() } return queue } func generateBigMessages(n int) []proto.Message { queue := make([]proto.Message, n) for i := range queue { queue[i] = testmessage.GenerateBigMessage() } return queue } func generateLargeMessages(n int) []proto.Message { queue := make([]proto.Message, n) for i := range queue { queue[i] = testmessage.GenerateLargeMessage() } return queue } func generateMixedMessages(n int) []proto.Message { queue := make([]proto.Message, n*4) for i := 0; i < n*4; i = i + 4 { queue[i] = testmessage.GenerateSmallMessage() queue[i+1] = testmessage.GenerateMediumMessage() queue[i+2] = testmessage.GenerateBigMessage() queue[i+3] = testmessage.GenerateLargeMessage() } shuffleMessages(&queue) return queue } func installMessages(t *testing.T, m Messenger, queue *[]proto.Message, counts *[]int, done chan struct{}) { testCounts := func(counts []int, done chan struct{}) { for i := range counts { if counts[i] != cap(*queue)/4 { return } } close(done) } hander1 := func(from *upid.UPID, pbMsg proto.Message) { (*queue) = append(*queue, pbMsg) (*counts)[0]++ testCounts(*counts, done) } hander2 := func(from *upid.UPID, pbMsg proto.Message) { (*queue) = append(*queue, pbMsg) (*counts)[1]++ testCounts(*counts, done) } hander3 := func(from *upid.UPID, pbMsg proto.Message) { (*queue) = append(*queue, pbMsg) (*counts)[2]++ testCounts(*counts, done) } hander4 := func(from *upid.UPID, pbMsg proto.Message) { (*queue) = append(*queue, pbMsg) (*counts)[3]++ testCounts(*counts, done) } assert.NoError(t, m.Install(hander1, &testmessage.SmallMessage{})) assert.NoError(t, m.Install(hander2, &testmessage.MediumMessage{})) assert.NoError(t, m.Install(hander3, &testmessage.BigMessage{})) assert.NoError(t, m.Install(hander4, &testmessage.LargeMessage{})) } func runTestServer(b *testing.B, wg *sync.WaitGroup) *httptest.Server { mux := http.NewServeMux() mux.HandleFunc("/testserver/mesos.internal.SmallMessage", func(http.ResponseWriter, *http.Request) { wg.Done() }) mux.HandleFunc("/testserver/mesos.internal.MediumMessage", func(http.ResponseWriter, *http.Request) { wg.Done() }) mux.HandleFunc("/testserver/mesos.internal.BigMessage", func(http.ResponseWriter, *http.Request) { wg.Done() }) mux.HandleFunc("/testserver/mesos.internal.LargeMessage", func(http.ResponseWriter, *http.Request) { wg.Done() }) return httptest.NewServer(mux) } func TestMessengerFailToInstall(t *testing.T) { m := NewHttp(&upid.UPID{ID: "mesos"}) handler := func(from *upid.UPID, pbMsg proto.Message) {} assert.NotNil(t, m) assert.NoError(t, m.Install(handler, &testmessage.SmallMessage{})) assert.Error(t, m.Install(handler, &testmessage.SmallMessage{})) } func TestMessengerFailToSend(t *testing.T) { upid, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(t, err) m := NewHttp(upid) assert.NoError(t, m.Start()) assert.Error(t, m.Send(context.TODO(), upid, &testmessage.SmallMessage{})) } func TestMessenger(t *testing.T) { messages := generateMixedMessages(1000) upid1, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(t, err) upid2, err := upid.Parse(fmt.Sprintf("mesos2@localhost:%d", getNewPort())) assert.NoError(t, err) m1 := NewHttp(upid1) m2 := NewHttp(upid2) done := make(chan struct{}) counts := make([]int, 4) msgQueue := make([]proto.Message, 0, len(messages)) installMessages(t, m2, &msgQueue, &counts, done) assert.NoError(t, m1.Start()) assert.NoError(t, m2.Start()) go func() { for _, msg := range messages { assert.NoError(t, m1.Send(context.TODO(), upid2, msg)) } }() select { case <-time.After(time.Second * 10): t.Fatalf("Timeout") case <-done: } for i := range counts { assert.Equal(t, 1000, counts[i]) } assert.Equal(t, messages, msgQueue) } func BenchmarkMessengerSendSmallMessage(b *testing.B) { messages := generateSmallMessages(1000) wg := new(sync.WaitGroup) wg.Add(b.N) srv := runTestServer(b, wg) defer srv.Close() upid1, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(b, err) upid2, err := upid.Parse(fmt.Sprintf("testserver@%s", srv.Listener.Addr().String())) assert.NoError(b, err) m1 := NewHttp(upid1) assert.NoError(b, m1.Start()) b.ResetTimer() for i := 0; i < b.N; i++ { m1.Send(context.TODO(), upid2, messages[i%1000]) } wg.Wait() } func BenchmarkMessengerSendMediumMessage(b *testing.B) { messages := generateMediumMessages(1000) wg := new(sync.WaitGroup) wg.Add(b.N) srv := runTestServer(b, wg) defer srv.Close() upid1, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(b, err) upid2, err := upid.Parse(fmt.Sprintf("testserver@%s", srv.Listener.Addr().String())) assert.NoError(b, err) m1 := NewHttp(upid1) assert.NoError(b, m1.Start()) b.ResetTimer() for i := 0; i < b.N; i++ { m1.Send(context.TODO(), upid2, messages[i%1000]) } wg.Wait() } func BenchmarkMessengerSendBigMessage(b *testing.B) { messages := generateBigMessages(1000) wg := new(sync.WaitGroup) wg.Add(b.N) srv := runTestServer(b, wg) defer srv.Close() upid1, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(b, err) upid2, err := upid.Parse(fmt.Sprintf("testserver@%s", srv.Listener.Addr().String())) assert.NoError(b, err) m1 := NewHttp(upid1) assert.NoError(b, m1.Start()) b.ResetTimer() for i := 0; i < b.N; i++ { m1.Send(context.TODO(), upid2, messages[i%1000]) } wg.Wait() } func BenchmarkMessengerSendLargeMessage(b *testing.B) { messages := generateLargeMessages(1000) wg := new(sync.WaitGroup) wg.Add(b.N) srv := runTestServer(b, wg) defer srv.Close() upid1, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(b, err) upid2, err := upid.Parse(fmt.Sprintf("testserver@%s", srv.Listener.Addr().String())) assert.NoError(b, err) m1 := NewHttp(upid1) assert.NoError(b, m1.Start()) b.ResetTimer() for i := 0; i < b.N; i++ { m1.Send(context.TODO(), upid2, messages[i%1000]) } wg.Wait() } func BenchmarkMessengerSendMixedMessage(b *testing.B) { messages := generateMixedMessages(1000) wg := new(sync.WaitGroup) wg.Add(b.N) srv := runTestServer(b, wg) defer srv.Close() upid1, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(b, err) upid2, err := upid.Parse(fmt.Sprintf("testserver@%s", srv.Listener.Addr().String())) assert.NoError(b, err) m1 := NewHttp(upid1) assert.NoError(b, m1.Start()) b.ResetTimer() for i := 0; i < b.N; i++ { m1.Send(context.TODO(), upid2, messages[i%1000]) } wg.Wait() } func BenchmarkMessengerSendRecvSmallMessage(b *testing.B) { globalWG.Add(b.N) messages := generateSmallMessages(1000) upid1, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(b, err) upid2, err := upid.Parse(fmt.Sprintf("mesos2@localhost:%d", getNewPort())) assert.NoError(b, err) m1 := NewHttp(upid1) m2 := NewHttp(upid2) assert.NoError(b, m1.Start()) assert.NoError(b, m2.Start()) assert.NoError(b, m2.Install(noopHandler, &testmessage.SmallMessage{})) time.Sleep(time.Second) // Avoid race on upid. b.ResetTimer() for i := 0; i < b.N; i++ { m1.Send(context.TODO(), upid2, messages[i%1000]) } globalWG.Wait() } func BenchmarkMessengerSendRecvMediumMessage(b *testing.B) { globalWG.Add(b.N) messages := generateMediumMessages(1000) upid1, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(b, err) upid2, err := upid.Parse(fmt.Sprintf("mesos2@localhost:%d", getNewPort())) assert.NoError(b, err) m1 := NewHttp(upid1) m2 := NewHttp(upid2) assert.NoError(b, m1.Start()) assert.NoError(b, m2.Start()) assert.NoError(b, m2.Install(noopHandler, &testmessage.MediumMessage{})) time.Sleep(time.Second) // Avoid race on upid. b.ResetTimer() for i := 0; i < b.N; i++ { m1.Send(context.TODO(), upid2, messages[i%1000]) } globalWG.Wait() } func BenchmarkMessengerSendRecvBigMessage(b *testing.B) { globalWG.Add(b.N) messages := generateBigMessages(1000) upid1, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(b, err) upid2, err := upid.Parse(fmt.Sprintf("mesos2@localhost:%d", getNewPort())) assert.NoError(b, err) m1 := NewHttp(upid1) m2 := NewHttp(upid2) assert.NoError(b, m1.Start()) assert.NoError(b, m2.Start()) assert.NoError(b, m2.Install(noopHandler, &testmessage.BigMessage{})) time.Sleep(time.Second) // Avoid race on upid. b.ResetTimer() for i := 0; i < b.N; i++ { m1.Send(context.TODO(), upid2, messages[i%1000]) } globalWG.Wait() } func BenchmarkMessengerSendRecvLargeMessage(b *testing.B) { globalWG.Add(b.N) messages := generateLargeMessages(1000) upid1, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(b, err) upid2, err := upid.Parse(fmt.Sprintf("mesos2@localhost:%d", getNewPort())) assert.NoError(b, err) m1 := NewHttp(upid1) m2 := NewHttp(upid2) assert.NoError(b, m1.Start()) assert.NoError(b, m2.Start()) assert.NoError(b, m2.Install(noopHandler, &testmessage.LargeMessage{})) time.Sleep(time.Second) // Avoid race on upid. b.ResetTimer() for i := 0; i < b.N; i++ { m1.Send(context.TODO(), upid2, messages[i%1000]) } globalWG.Wait() } func BenchmarkMessengerSendRecvMixedMessage(b *testing.B) { globalWG.Add(b.N) messages := generateMixedMessages(1000) upid1, err := upid.Parse(fmt.Sprintf("mesos1@localhost:%d", getNewPort())) assert.NoError(b, err) upid2, err := upid.Parse(fmt.Sprintf("mesos2@localhost:%d", getNewPort())) assert.NoError(b, err) m1 := NewHttp(upid1) m2 := NewHttp(upid2) assert.NoError(b, m1.Start()) assert.NoError(b, m2.Start()) assert.NoError(b, m2.Install(noopHandler, &testmessage.SmallMessage{})) assert.NoError(b, m2.Install(noopHandler, &testmessage.MediumMessage{})) assert.NoError(b, m2.Install(noopHandler, &testmessage.BigMessage{})) assert.NoError(b, m2.Install(noopHandler, &testmessage.LargeMessage{})) time.Sleep(time.Second) // Avoid race on upid. b.ResetTimer() for i := 0; i < b.N; i++ { m1.Send(context.TODO(), upid2, messages[i%1000]) } globalWG.Wait() } func TestUPIDBindingAddress(t *testing.T) { tt := []struct { hostname string binding net.IP expected string }{ {"", nil, ""}, {"", net.IPv4(1, 2, 3, 4), "1.2.3.4"}, {"", net.IPv4(0, 0, 0, 0), ""}, {"localhost", nil, "127.0.0.1"}, {"localhost", net.IPv4(5, 6, 7, 8), "5.6.7.8"}, {"localhost", net.IPv4(0, 0, 0, 0), "127.0.0.1"}, {"0.0.0.0", nil, ""}, {"7.8.9.1", nil, "7.8.9.1"}, {"7.8.9.1", net.IPv4(0, 0, 0, 0), "7.8.9.1"}, {"7.8.9.1", net.IPv4(8, 9, 1, 2), "8.9.1.2"}, } for i, tc := range tt { actual, err := UPIDBindingAddress(tc.hostname, tc.binding) if err != nil && tc.expected != "" { t.Fatalf("test case %d failed; expected %q instead of error %v", i+1, tc.expected, err) } if err == nil && actual != tc.expected { t.Fatalf("test case %d failed; expected %q instead of %q", i+1, tc.expected, actual) } if err != nil { t.Logf("test case %d; received expected error %v", i+1, err) } } } mesos-go-0.0.1/messenger/mocked_messenger.go000066400000000000000000000055771257601144100211110ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 messenger import ( "reflect" "github.com/gogo/protobuf/proto" "github.com/mesos/mesos-go/upid" "github.com/stretchr/testify/mock" "golang.org/x/net/context" ) type message struct { from *upid.UPID msg proto.Message } // MockedMessenger is a messenger that returns error on every operation. type MockedMessenger struct { mock.Mock messageQueue chan *message handlers map[string]MessageHandler stop chan struct{} } // NewMockedMessenger returns a mocked messenger used for testing. func NewMockedMessenger() *MockedMessenger { return &MockedMessenger{ messageQueue: make(chan *message, 1), handlers: make(map[string]MessageHandler), stop: make(chan struct{}), } } // Install is a mocked implementation. func (m *MockedMessenger) Install(handler MessageHandler, msg proto.Message) error { m.handlers[reflect.TypeOf(msg).Elem().Name()] = handler return m.Called().Error(0) } // Send is a mocked implementation. func (m *MockedMessenger) Send(ctx context.Context, upid *upid.UPID, msg proto.Message) error { return m.Called().Error(0) } func (m *MockedMessenger) Route(ctx context.Context, upid *upid.UPID, msg proto.Message) error { return m.Called().Error(0) } // Start is a mocked implementation. func (m *MockedMessenger) Start() error { go m.recvLoop() return m.Called().Error(0) } // Stop is a mocked implementation. func (m *MockedMessenger) Stop() error { // don't close an already-closed channel select { case <-m.stop: // noop default: close(m.stop) } return m.Called().Error(0) } // UPID is a mocked implementation. func (m *MockedMessenger) UPID() *upid.UPID { return m.Called().Get(0).(*upid.UPID) } func (m *MockedMessenger) recvLoop() { for { select { case <-m.stop: return case msg := <-m.messageQueue: name := reflect.TypeOf(msg.msg).Elem().Name() m.handlers[name](msg.from, msg.msg) } } } // Recv receives a upid and a message, it will dispatch the message to its handler // with the upid. This is for testing. func (m *MockedMessenger) Recv(from *upid.UPID, msg proto.Message) { m.messageQueue <- &message{from, msg} } mesos-go-0.0.1/messenger/testmessage/000077500000000000000000000000001257601144100175565ustar00rootroot00000000000000mesos-go-0.0.1/messenger/testmessage/Makefile000066400000000000000000000002131257601144100212120ustar00rootroot00000000000000all: testmessage.proto protoc --proto_path=${GOPATH}/src:${GOPATH}/src/github.com/gogo/protobuf/protobuf:. --gogo_out=. testmessage.proto mesos-go-0.0.1/messenger/testmessage/generator.go000066400000000000000000000020361257601144100220740ustar00rootroot00000000000000package testmessage import ( "math/rand" ) func generateRandomString(length int) string { b := make([]byte, length) for i := range b { b[i] = byte(rand.Int()) } return string(b) } // GenerateSmallMessage generates a small size message. func GenerateSmallMessage() *SmallMessage { v := make([]string, 3) for i := range v { v[i] = generateRandomString(5) } return &SmallMessage{Values: v} } // GenerateMediumMessage generates a medium size message. func GenerateMediumMessage() *MediumMessage { v := make([]string, 10) for i := range v { v[i] = generateRandomString(10) } return &MediumMessage{Values: v} } // GenerateBigMessage generates a big size message. func GenerateBigMessage() *BigMessage { v := make([]string, 20) for i := range v { v[i] = generateRandomString(20) } return &BigMessage{Values: v} } // GenerateLargeMessage generates a large size message. func GenerateLargeMessage() *LargeMessage { v := make([]string, 30) for i := range v { v[i] = generateRandomString(30) } return &LargeMessage{Values: v} } mesos-go-0.0.1/messenger/testmessage/testmessage.pb.go000066400000000000000000000613661257601144100230450ustar00rootroot00000000000000// Code generated by protoc-gen-gogo. // source: testmessage.proto // DO NOT EDIT! /* Package testmessage is a generated protocol buffer package. It is generated from these files: testmessage.proto It has these top-level messages: SmallMessage MediumMessage BigMessage LargeMessage */ package testmessage import proto "github.com/gogo/protobuf/proto" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb" import io "io" import fmt "fmt" import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" import fmt1 "fmt" import strings "strings" import reflect "reflect" import fmt2 "fmt" import strings1 "strings" import github_com_gogo_protobuf_proto1 "github.com/gogo/protobuf/proto" import sort "sort" import strconv "strconv" import reflect1 "reflect" import fmt3 "fmt" import bytes "bytes" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = math.Inf type SmallMessage struct { Values []string `protobuf:"bytes,1,rep" json:"Values,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *SmallMessage) Reset() { *m = SmallMessage{} } func (*SmallMessage) ProtoMessage() {} func (m *SmallMessage) GetValues() []string { if m != nil { return m.Values } return nil } type MediumMessage struct { Values []string `protobuf:"bytes,1,rep" json:"Values,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *MediumMessage) Reset() { *m = MediumMessage{} } func (*MediumMessage) ProtoMessage() {} func (m *MediumMessage) GetValues() []string { if m != nil { return m.Values } return nil } type BigMessage struct { Values []string `protobuf:"bytes,1,rep" json:"Values,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *BigMessage) Reset() { *m = BigMessage{} } func (*BigMessage) ProtoMessage() {} func (m *BigMessage) GetValues() []string { if m != nil { return m.Values } return nil } type LargeMessage struct { Values []string `protobuf:"bytes,1,rep" json:"Values,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *LargeMessage) Reset() { *m = LargeMessage{} } func (*LargeMessage) ProtoMessage() {} func (m *LargeMessage) GetValues() []string { if m != nil { return m.Values } return nil } func init() { } func (m *SmallMessage) Unmarshal(data []byte) error { l := len(data) index := 0 for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { if index >= l { return io.ErrUnexpectedEOF } b := data[index] index++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if index >= l { return io.ErrUnexpectedEOF } b := data[index] index++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } postIndex := index + int(stringLen) if postIndex > l { return io.ErrUnexpectedEOF } m.Values = append(m.Values, string(data[index:postIndex])) index = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } index -= sizeOfWire skippy, err := github_com_gogo_protobuf_proto.Skip(data[index:]) if err != nil { return err } if (index + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...) index += skippy } } return nil } func (m *MediumMessage) Unmarshal(data []byte) error { l := len(data) index := 0 for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { if index >= l { return io.ErrUnexpectedEOF } b := data[index] index++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if index >= l { return io.ErrUnexpectedEOF } b := data[index] index++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } postIndex := index + int(stringLen) if postIndex > l { return io.ErrUnexpectedEOF } m.Values = append(m.Values, string(data[index:postIndex])) index = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } index -= sizeOfWire skippy, err := github_com_gogo_protobuf_proto.Skip(data[index:]) if err != nil { return err } if (index + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...) index += skippy } } return nil } func (m *BigMessage) Unmarshal(data []byte) error { l := len(data) index := 0 for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { if index >= l { return io.ErrUnexpectedEOF } b := data[index] index++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if index >= l { return io.ErrUnexpectedEOF } b := data[index] index++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } postIndex := index + int(stringLen) if postIndex > l { return io.ErrUnexpectedEOF } m.Values = append(m.Values, string(data[index:postIndex])) index = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } index -= sizeOfWire skippy, err := github_com_gogo_protobuf_proto.Skip(data[index:]) if err != nil { return err } if (index + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...) index += skippy } } return nil } func (m *LargeMessage) Unmarshal(data []byte) error { l := len(data) index := 0 for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { if index >= l { return io.ErrUnexpectedEOF } b := data[index] index++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if index >= l { return io.ErrUnexpectedEOF } b := data[index] index++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } postIndex := index + int(stringLen) if postIndex > l { return io.ErrUnexpectedEOF } m.Values = append(m.Values, string(data[index:postIndex])) index = postIndex default: var sizeOfWire int for { sizeOfWire++ wire >>= 7 if wire == 0 { break } } index -= sizeOfWire skippy, err := github_com_gogo_protobuf_proto.Skip(data[index:]) if err != nil { return err } if (index + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...) index += skippy } } return nil } func (this *SmallMessage) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&SmallMessage{`, `Values:` + fmt1.Sprintf("%v", this.Values) + `,`, `XXX_unrecognized:` + fmt1.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *MediumMessage) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&MediumMessage{`, `Values:` + fmt1.Sprintf("%v", this.Values) + `,`, `XXX_unrecognized:` + fmt1.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *BigMessage) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&BigMessage{`, `Values:` + fmt1.Sprintf("%v", this.Values) + `,`, `XXX_unrecognized:` + fmt1.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *LargeMessage) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&LargeMessage{`, `Values:` + fmt1.Sprintf("%v", this.Values) + `,`, `XXX_unrecognized:` + fmt1.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func valueToStringTestmessage(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt1.Sprintf("*%v", pv) } func (m *SmallMessage) Size() (n int) { var l int _ = l if len(m.Values) > 0 { for _, s := range m.Values { l = len(s) n += 1 + l + sovTestmessage(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *MediumMessage) Size() (n int) { var l int _ = l if len(m.Values) > 0 { for _, s := range m.Values { l = len(s) n += 1 + l + sovTestmessage(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *BigMessage) Size() (n int) { var l int _ = l if len(m.Values) > 0 { for _, s := range m.Values { l = len(s) n += 1 + l + sovTestmessage(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *LargeMessage) Size() (n int) { var l int _ = l if len(m.Values) > 0 { for _, s := range m.Values { l = len(s) n += 1 + l + sovTestmessage(uint64(l)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func sovTestmessage(x uint64) (n int) { for { n++ x >>= 7 if x == 0 { break } } return n } func sozTestmessage(x uint64) (n int) { return sovTestmessage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func NewPopulatedSmallMessage(r randyTestmessage, easy bool) *SmallMessage { this := &SmallMessage{} if r.Intn(10) != 0 { v1 := r.Intn(10) this.Values = make([]string, v1) for i := 0; i < v1; i++ { this.Values[i] = randStringTestmessage(r) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTestmessage(r, 2) } return this } func NewPopulatedMediumMessage(r randyTestmessage, easy bool) *MediumMessage { this := &MediumMessage{} if r.Intn(10) != 0 { v2 := r.Intn(10) this.Values = make([]string, v2) for i := 0; i < v2; i++ { this.Values[i] = randStringTestmessage(r) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTestmessage(r, 2) } return this } func NewPopulatedBigMessage(r randyTestmessage, easy bool) *BigMessage { this := &BigMessage{} if r.Intn(10) != 0 { v3 := r.Intn(10) this.Values = make([]string, v3) for i := 0; i < v3; i++ { this.Values[i] = randStringTestmessage(r) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTestmessage(r, 2) } return this } func NewPopulatedLargeMessage(r randyTestmessage, easy bool) *LargeMessage { this := &LargeMessage{} if r.Intn(10) != 0 { v4 := r.Intn(10) this.Values = make([]string, v4) for i := 0; i < v4; i++ { this.Values[i] = randStringTestmessage(r) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTestmessage(r, 2) } return this } type randyTestmessage interface { Float32() float32 Float64() float64 Int63() int64 Int31() int32 Uint32() uint32 Intn(n int) int } func randUTF8RuneTestmessage(r randyTestmessage) rune { res := rune(r.Uint32() % 1112064) if 55296 <= res { res += 2047 } return res } func randStringTestmessage(r randyTestmessage) string { v5 := r.Intn(100) tmps := make([]rune, v5) for i := 0; i < v5; i++ { tmps[i] = randUTF8RuneTestmessage(r) } return string(tmps) } func randUnrecognizedTestmessage(r randyTestmessage, maxFieldNumber int) (data []byte) { l := r.Intn(5) for i := 0; i < l; i++ { wire := r.Intn(4) if wire == 3 { wire = 5 } fieldNumber := maxFieldNumber + r.Intn(100) data = randFieldTestmessage(data, r, fieldNumber, wire) } return data } func randFieldTestmessage(data []byte, r randyTestmessage, fieldNumber int, wire int) []byte { key := uint32(fieldNumber)<<3 | uint32(wire) switch wire { case 0: data = encodeVarintPopulateTestmessage(data, uint64(key)) v6 := r.Int63() if r.Intn(2) == 0 { v6 *= -1 } data = encodeVarintPopulateTestmessage(data, uint64(v6)) case 1: data = encodeVarintPopulateTestmessage(data, uint64(key)) data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) case 2: data = encodeVarintPopulateTestmessage(data, uint64(key)) ll := r.Intn(100) data = encodeVarintPopulateTestmessage(data, uint64(ll)) for j := 0; j < ll; j++ { data = append(data, byte(r.Intn(256))) } default: data = encodeVarintPopulateTestmessage(data, uint64(key)) data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) } return data } func encodeVarintPopulateTestmessage(data []byte, v uint64) []byte { for v >= 1<<7 { data = append(data, uint8(uint64(v)&0x7f|0x80)) v >>= 7 } data = append(data, uint8(v)) return data } func (m *SmallMessage) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *SmallMessage) MarshalTo(data []byte) (n int, err error) { var i int _ = i var l int _ = l if len(m.Values) > 0 { for _, s := range m.Values { data[i] = 0xa i++ l = len(s) for l >= 1<<7 { data[i] = uint8(uint64(l)&0x7f | 0x80) l >>= 7 i++ } data[i] = uint8(l) i++ i += copy(data[i:], s) } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *MediumMessage) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *MediumMessage) MarshalTo(data []byte) (n int, err error) { var i int _ = i var l int _ = l if len(m.Values) > 0 { for _, s := range m.Values { data[i] = 0xa i++ l = len(s) for l >= 1<<7 { data[i] = uint8(uint64(l)&0x7f | 0x80) l >>= 7 i++ } data[i] = uint8(l) i++ i += copy(data[i:], s) } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *BigMessage) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *BigMessage) MarshalTo(data []byte) (n int, err error) { var i int _ = i var l int _ = l if len(m.Values) > 0 { for _, s := range m.Values { data[i] = 0xa i++ l = len(s) for l >= 1<<7 { data[i] = uint8(uint64(l)&0x7f | 0x80) l >>= 7 i++ } data[i] = uint8(l) i++ i += copy(data[i:], s) } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func (m *LargeMessage) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *LargeMessage) MarshalTo(data []byte) (n int, err error) { var i int _ = i var l int _ = l if len(m.Values) > 0 { for _, s := range m.Values { data[i] = 0xa i++ l = len(s) for l >= 1<<7 { data[i] = uint8(uint64(l)&0x7f | 0x80) l >>= 7 i++ } data[i] = uint8(l) i++ i += copy(data[i:], s) } } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil } func encodeFixed64Testmessage(data []byte, offset int, v uint64) int { data[offset] = uint8(v) data[offset+1] = uint8(v >> 8) data[offset+2] = uint8(v >> 16) data[offset+3] = uint8(v >> 24) data[offset+4] = uint8(v >> 32) data[offset+5] = uint8(v >> 40) data[offset+6] = uint8(v >> 48) data[offset+7] = uint8(v >> 56) return offset + 8 } func encodeFixed32Testmessage(data []byte, offset int, v uint32) int { data[offset] = uint8(v) data[offset+1] = uint8(v >> 8) data[offset+2] = uint8(v >> 16) data[offset+3] = uint8(v >> 24) return offset + 4 } func encodeVarintTestmessage(data []byte, offset int, v uint64) int { for v >= 1<<7 { data[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } data[offset] = uint8(v) return offset + 1 } func (this *SmallMessage) GoString() string { if this == nil { return "nil" } s := strings1.Join([]string{`&testmessage.SmallMessage{` + `Values:` + fmt2.Sprintf("%#v", this.Values), `XXX_unrecognized:` + fmt2.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ") return s } func (this *MediumMessage) GoString() string { if this == nil { return "nil" } s := strings1.Join([]string{`&testmessage.MediumMessage{` + `Values:` + fmt2.Sprintf("%#v", this.Values), `XXX_unrecognized:` + fmt2.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ") return s } func (this *BigMessage) GoString() string { if this == nil { return "nil" } s := strings1.Join([]string{`&testmessage.BigMessage{` + `Values:` + fmt2.Sprintf("%#v", this.Values), `XXX_unrecognized:` + fmt2.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ") return s } func (this *LargeMessage) GoString() string { if this == nil { return "nil" } s := strings1.Join([]string{`&testmessage.LargeMessage{` + `Values:` + fmt2.Sprintf("%#v", this.Values), `XXX_unrecognized:` + fmt2.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ") return s } func valueToGoStringTestmessage(v interface{}, typ string) string { rv := reflect1.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect1.Indirect(rv).Interface() return fmt2.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) } func extensionToGoStringTestmessage(e map[int32]github_com_gogo_protobuf_proto1.Extension) string { if e == nil { return "nil" } s := "map[int32]proto.Extension{" keys := make([]int, 0, len(e)) for k := range e { keys = append(keys, int(k)) } sort.Ints(keys) ss := []string{} for _, k := range keys { ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) } s += strings1.Join(ss, ",") + "}" return s } func (this *SmallMessage) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt3.Errorf("that == nil && this != nil") } that1, ok := that.(*SmallMessage) if !ok { return fmt3.Errorf("that is not of type *SmallMessage") } if that1 == nil { if this == nil { return nil } return fmt3.Errorf("that is type *SmallMessage but is nil && this != nil") } else if this == nil { return fmt3.Errorf("that is type *SmallMessagebut is not nil && this == nil") } if len(this.Values) != len(that1.Values) { return fmt3.Errorf("Values this(%v) Not Equal that(%v)", len(this.Values), len(that1.Values)) } for i := range this.Values { if this.Values[i] != that1.Values[i] { return fmt3.Errorf("Values this[%v](%v) Not Equal that[%v](%v)", i, this.Values[i], i, that1.Values[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt3.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *SmallMessage) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*SmallMessage) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Values) != len(that1.Values) { return false } for i := range this.Values { if this.Values[i] != that1.Values[i] { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *MediumMessage) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt3.Errorf("that == nil && this != nil") } that1, ok := that.(*MediumMessage) if !ok { return fmt3.Errorf("that is not of type *MediumMessage") } if that1 == nil { if this == nil { return nil } return fmt3.Errorf("that is type *MediumMessage but is nil && this != nil") } else if this == nil { return fmt3.Errorf("that is type *MediumMessagebut is not nil && this == nil") } if len(this.Values) != len(that1.Values) { return fmt3.Errorf("Values this(%v) Not Equal that(%v)", len(this.Values), len(that1.Values)) } for i := range this.Values { if this.Values[i] != that1.Values[i] { return fmt3.Errorf("Values this[%v](%v) Not Equal that[%v](%v)", i, this.Values[i], i, that1.Values[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt3.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *MediumMessage) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*MediumMessage) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Values) != len(that1.Values) { return false } for i := range this.Values { if this.Values[i] != that1.Values[i] { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *BigMessage) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt3.Errorf("that == nil && this != nil") } that1, ok := that.(*BigMessage) if !ok { return fmt3.Errorf("that is not of type *BigMessage") } if that1 == nil { if this == nil { return nil } return fmt3.Errorf("that is type *BigMessage but is nil && this != nil") } else if this == nil { return fmt3.Errorf("that is type *BigMessagebut is not nil && this == nil") } if len(this.Values) != len(that1.Values) { return fmt3.Errorf("Values this(%v) Not Equal that(%v)", len(this.Values), len(that1.Values)) } for i := range this.Values { if this.Values[i] != that1.Values[i] { return fmt3.Errorf("Values this[%v](%v) Not Equal that[%v](%v)", i, this.Values[i], i, that1.Values[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt3.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *BigMessage) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*BigMessage) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Values) != len(that1.Values) { return false } for i := range this.Values { if this.Values[i] != that1.Values[i] { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *LargeMessage) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt3.Errorf("that == nil && this != nil") } that1, ok := that.(*LargeMessage) if !ok { return fmt3.Errorf("that is not of type *LargeMessage") } if that1 == nil { if this == nil { return nil } return fmt3.Errorf("that is type *LargeMessage but is nil && this != nil") } else if this == nil { return fmt3.Errorf("that is type *LargeMessagebut is not nil && this == nil") } if len(this.Values) != len(that1.Values) { return fmt3.Errorf("Values this(%v) Not Equal that(%v)", len(this.Values), len(that1.Values)) } for i := range this.Values { if this.Values[i] != that1.Values[i] { return fmt3.Errorf("Values this[%v](%v) Not Equal that[%v](%v)", i, this.Values[i], i, that1.Values[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt3.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *LargeMessage) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*LargeMessage) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if len(this.Values) != len(that1.Values) { return false } for i := range this.Values { if this.Values[i] != that1.Values[i] { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } mesos-go-0.0.1/messenger/testmessage/testmessage.proto000066400000000000000000000014141257601144100231670ustar00rootroot00000000000000package testmessage; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.gostring_all) = true; option (gogoproto.equal_all) = true; option (gogoproto.verbose_equal_all) = true; option (gogoproto.goproto_stringer_all) = false; option (gogoproto.stringer_all) = true; option (gogoproto.populate_all) = true; option (gogoproto.testgen_all) = false; option (gogoproto.benchgen_all) = false; option (gogoproto.marshaler_all) = true; option (gogoproto.sizer_all) = true; option (gogoproto.unmarshaler_all) = true; message SmallMessage { repeated string Values = 1; } message MediumMessage { repeated string Values = 1; } message BigMessage { repeated string Values = 1; } message LargeMessage { repeated string Values = 1; } mesos-go-0.0.1/messenger/transporter.go000066400000000000000000000035121257601144100201450ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 messenger import ( "github.com/mesos/mesos-go/upid" "golang.org/x/net/context" ) // Transporter defines methods for communicating with remote processes. type Transporter interface { //Send sends message to remote process. Must use context to determine //cancelled requests. Will stop sending when transport is stopped. Send(ctx context.Context, msg *Message) error //Rcvd receives and delegate message handling to installed handlers. //Will stop receiving when transport is stopped. Recv() (*Message, error) //Inject injects a message to the incoming queue. Must use context to //determine cancelled requests. Injection is aborted if the transport //is stopped. Inject(ctx context.Context, msg *Message) error //Install mount an handler based on incoming message name. Install(messageName string) //Start starts the transporter and returns immediately. The error chan //is never nil. Start() <-chan error //Stop kills the transporter. Stop(graceful bool) error //UPID returns the PID for transporter. UPID() *upid.UPID } mesos-go-0.0.1/scheduler/000077500000000000000000000000001257601144100152205ustar00rootroot00000000000000mesos-go-0.0.1/scheduler/doc.go000066400000000000000000000003251257601144100163140ustar00rootroot00000000000000/* Package scheduler includes the interfaces for the mesos scheduler and the mesos executor driver. It also contains as well as an implementation of the driver that you can use in your code. */ package scheduler mesos-go-0.0.1/scheduler/handler.go000066400000000000000000000014021257601144100171610ustar00rootroot00000000000000package scheduler import ( "github.com/mesos/mesos-go/auth/callback" mesos "github.com/mesos/mesos-go/mesosproto" "github.com/mesos/mesos-go/upid" ) type CredentialHandler struct { pid *upid.UPID // the process to authenticate against (master) client *upid.UPID // the process to be authenticated (slave / framework) credential *mesos.Credential } func (h *CredentialHandler) Handle(callbacks ...callback.Interface) error { for _, cb := range callbacks { switch cb := cb.(type) { case *callback.Name: cb.Set(h.credential.GetPrincipal()) case *callback.Password: cb.Set(h.credential.GetSecret()) case *callback.Interprocess: cb.Set(*(h.pid), *(h.client)) default: return &callback.Unsupported{Callback: cb} } } return nil } mesos-go-0.0.1/scheduler/mock_scheduler.go000066400000000000000000000023751257601144100205450ustar00rootroot00000000000000package scheduler import ( log "github.com/golang/glog" mesos "github.com/mesos/mesos-go/mesosproto" "github.com/stretchr/testify/mock" ) type MockScheduler struct { mock.Mock } func NewMockScheduler() *MockScheduler { return &MockScheduler{} } func (sched *MockScheduler) Registered(SchedulerDriver, *mesos.FrameworkID, *mesos.MasterInfo) { sched.Called() } func (sched *MockScheduler) Reregistered(SchedulerDriver, *mesos.MasterInfo) { sched.Called() } func (sched *MockScheduler) Disconnected(SchedulerDriver) { sched.Called() } func (sched *MockScheduler) ResourceOffers(SchedulerDriver, []*mesos.Offer) { sched.Called() } func (sched *MockScheduler) OfferRescinded(SchedulerDriver, *mesos.OfferID) { sched.Called() } func (sched *MockScheduler) StatusUpdate(SchedulerDriver, *mesos.TaskStatus) { sched.Called() } func (sched *MockScheduler) FrameworkMessage(SchedulerDriver, *mesos.ExecutorID, *mesos.SlaveID, string) { sched.Called() } func (sched *MockScheduler) SlaveLost(SchedulerDriver, *mesos.SlaveID) { sched.Called() } func (sched *MockScheduler) ExecutorLost(SchedulerDriver, *mesos.ExecutorID, *mesos.SlaveID, int) { sched.Called() } func (sched *MockScheduler) Error(d SchedulerDriver, msg string) { log.Error(msg) sched.Called() } mesos-go-0.0.1/scheduler/plugins.go000066400000000000000000000002511257601144100172260ustar00rootroot00000000000000package scheduler import ( _ "github.com/mesos/mesos-go/auth/sasl" _ "github.com/mesos/mesos-go/auth/sasl/mech/crammd5" _ "github.com/mesos/mesos-go/detector/zoo" ) mesos-go-0.0.1/scheduler/schedcache.go000066400000000000000000000052041257601144100176220ustar00rootroot00000000000000package scheduler import ( log "github.com/golang/glog" mesos "github.com/mesos/mesos-go/mesosproto" "github.com/mesos/mesos-go/upid" "sync" ) type cachedOffer struct { offer *mesos.Offer slavePid *upid.UPID } func newCachedOffer(offer *mesos.Offer, slavePid *upid.UPID) *cachedOffer { return &cachedOffer{offer: offer, slavePid: slavePid} } // schedCache a managed cache with backing maps to store offeres // and tasked slaves. type schedCache struct { lock sync.RWMutex savedOffers map[string]*cachedOffer // current offers key:OfferID savedSlavePids map[string]*upid.UPID // Current saved slaves, key:slaveId } func newSchedCache() *schedCache { return &schedCache{ savedOffers: make(map[string]*cachedOffer), savedSlavePids: make(map[string]*upid.UPID), } } // putOffer stores an offer and the slavePID associated with offer. func (cache *schedCache) putOffer(offer *mesos.Offer, pid *upid.UPID) { if offer == nil || pid == nil { log.V(3).Infoln("WARN: Offer not cached. The offer or pid cannot be nil") return } log.V(3).Infoln("Caching offer ", offer.Id.GetValue(), " with slavePID ", pid.String()) cache.lock.Lock() cache.savedOffers[offer.Id.GetValue()] = &cachedOffer{offer: offer, slavePid: pid} cache.lock.Unlock() } // getOffer returns cached offer func (cache *schedCache) getOffer(offerId *mesos.OfferID) *cachedOffer { if offerId == nil { log.V(3).Infoln("WARN: OfferId == nil, returning nil") return nil } cache.lock.RLock() defer cache.lock.RUnlock() return cache.savedOffers[offerId.GetValue()] } // containsOff test cache for offer(offerId) func (cache *schedCache) containsOffer(offerId *mesos.OfferID) bool { cache.lock.RLock() defer cache.lock.RUnlock() _, ok := cache.savedOffers[offerId.GetValue()] return ok } func (cache *schedCache) removeOffer(offerId *mesos.OfferID) { cache.lock.Lock() delete(cache.savedOffers, offerId.GetValue()) cache.lock.Unlock() } func (cache *schedCache) putSlavePid(slaveId *mesos.SlaveID, pid *upid.UPID) { cache.lock.Lock() cache.savedSlavePids[slaveId.GetValue()] = pid cache.lock.Unlock() } func (cache *schedCache) getSlavePid(slaveId *mesos.SlaveID) *upid.UPID { if slaveId == nil { log.V(3).Infoln("SlaveId == nil, returning empty UPID") return nil } return cache.savedSlavePids[slaveId.GetValue()] } func (cache *schedCache) containsSlavePid(slaveId *mesos.SlaveID) bool { cache.lock.RLock() defer cache.lock.RUnlock() _, ok := cache.savedSlavePids[slaveId.GetValue()] return ok } func (cache *schedCache) removeSlavePid(slaveId *mesos.SlaveID) { cache.lock.Lock() delete(cache.savedSlavePids, slaveId.GetValue()) cache.lock.Unlock() } mesos-go-0.0.1/scheduler/schedcache_test.go000066400000000000000000000156351257601144100206720ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 scheduler import ( mesos "github.com/mesos/mesos-go/mesosproto" util "github.com/mesos/mesos-go/mesosutil" "github.com/stretchr/testify/assert" "testing" "github.com/mesos/mesos-go/upid" ) func TestSchedCacheNew(t *testing.T) { cache := newSchedCache() assert.NotNil(t, cache) assert.NotNil(t, cache.savedOffers) assert.NotNil(t, cache.savedSlavePids) } func TestSchedCachePutOffer(t *testing.T) { cache := newSchedCache() offer01 := createTestOffer("01") pid01, err := upid.Parse("slave01@127.0.0.1:5050") assert.NoError(t, err) cache.putOffer(offer01, pid01) offer02 := createTestOffer("02") pid02, err := upid.Parse("slave02@127.0.0.1:5050") assert.NoError(t, err) cache.putOffer(offer02, pid02) assert.Equal(t, len(cache.savedOffers), 2) cachedOffer1, ok := cache.savedOffers["test-offer-01"] assert.True(t, ok) cachedOffer2, ok := cache.savedOffers["test-offer-02"] assert.True(t, ok) assert.NotNil(t, cachedOffer1.offer) assert.Equal(t, "test-offer-01", cachedOffer1.offer.Id.GetValue()) assert.NotNil(t, cachedOffer2.offer) assert.Equal(t, "test-offer-02", cachedOffer2.offer.Id.GetValue()) assert.NotNil(t, cachedOffer1.slavePid) assert.Equal(t, "slave01@127.0.0.1:5050", cachedOffer1.slavePid.String()) assert.NotNil(t, cachedOffer2.slavePid) assert.Equal(t, "slave02@127.0.0.1:5050", cachedOffer2.slavePid.String()) } func TestSchedCacheGetOffer(t *testing.T) { cache := newSchedCache() offer01 := createTestOffer("01") pid01, err := upid.Parse("slave01@127.0.0.1:5050") assert.NoError(t, err) offer02 := createTestOffer("02") pid02, err := upid.Parse("slave02@127.0.0.1:5050") assert.NoError(t, err) cache.putOffer(offer01, pid01) cache.putOffer(offer02, pid02) cachedOffer01 := cache.getOffer(util.NewOfferID("test-offer-01")).offer cachedOffer02 := cache.getOffer(util.NewOfferID("test-offer-02")).offer assert.NotEqual(t, offer01, cachedOffer02) assert.Equal(t, offer01, cachedOffer01) assert.Equal(t, offer02, cachedOffer02) } func TestSchedCacheContainsOffer(t *testing.T) { cache := newSchedCache() offer01 := createTestOffer("01") pid01, err := upid.Parse("slave01@127.0.0.1:5050") assert.NoError(t, err) offer02 := createTestOffer("02") pid02, err := upid.Parse("slave02@127.0.0.1:5050") assert.NoError(t, err) cache.putOffer(offer01, pid01) cache.putOffer(offer02, pid02) assert.True(t, cache.containsOffer(util.NewOfferID("test-offer-01"))) assert.True(t, cache.containsOffer(util.NewOfferID("test-offer-02"))) assert.False(t, cache.containsOffer(util.NewOfferID("test-offer-05"))) } func TestSchedCacheRemoveOffer(t *testing.T) { cache := newSchedCache() offer01 := createTestOffer("01") pid01, err := upid.Parse("slave01@127.0.0.1:5050") assert.NoError(t, err) offer02 := createTestOffer("02") pid02, err := upid.Parse("slave02@127.0.0.1:5050") assert.NoError(t, err) cache.putOffer(offer01, pid01) cache.putOffer(offer02, pid02) cache.removeOffer(util.NewOfferID("test-offer-01")) assert.Equal(t, 1, len(cache.savedOffers)) assert.True(t, cache.containsOffer(util.NewOfferID("test-offer-02"))) assert.False(t, cache.containsOffer(util.NewOfferID("test-offer-01"))) } func TestSchedCachePutSlavePid(t *testing.T) { cache := newSchedCache() pid01, err := upid.Parse("slave01@127.0.0.1:5050") assert.NoError(t, err) pid02, err := upid.Parse("slave02@127.0.0.1:5050") assert.NoError(t, err) pid03, err := upid.Parse("slave03@127.0.0.1:5050") assert.NoError(t, err) cache.putSlavePid(util.NewSlaveID("slave01"), pid01) cache.putSlavePid(util.NewSlaveID("slave02"), pid02) cache.putSlavePid(util.NewSlaveID("slave03"), pid03) assert.Equal(t, len(cache.savedSlavePids), 3) cachedSlavePid1, ok := cache.savedSlavePids["slave01"] assert.True(t, ok) cachedSlavePid2, ok := cache.savedSlavePids["slave02"] assert.True(t, ok) cachedSlavePid3, ok := cache.savedSlavePids["slave03"] assert.True(t, ok) assert.True(t, cachedSlavePid1.Equal(pid01)) assert.True(t, cachedSlavePid2.Equal(pid02)) assert.True(t, cachedSlavePid3.Equal(pid03)) } func TestSchedCacheGetSlavePid(t *testing.T) { cache := newSchedCache() pid01, err := upid.Parse("slave01@127.0.0.1:5050") assert.NoError(t, err) pid02, err := upid.Parse("slave02@127.0.0.1:5050") assert.NoError(t, err) cache.putSlavePid(util.NewSlaveID("slave01"), pid01) cache.putSlavePid(util.NewSlaveID("slave02"), pid02) cachedSlavePid1 := cache.getSlavePid(util.NewSlaveID("slave01")) cachedSlavePid2 := cache.getSlavePid(util.NewSlaveID("slave02")) assert.NotNil(t, cachedSlavePid1) assert.NotNil(t, cachedSlavePid2) assert.True(t, pid01.Equal(cachedSlavePid1)) assert.True(t, pid02.Equal(cachedSlavePid2)) assert.False(t, pid01.Equal(cachedSlavePid2)) } func TestSchedCacheContainsSlavePid(t *testing.T) { cache := newSchedCache() pid01, err := upid.Parse("slave01@127.0.0.1:5050") assert.NoError(t, err) pid02, err := upid.Parse("slave02@127.0.0.1:5050") assert.NoError(t, err) cache.putSlavePid(util.NewSlaveID("slave01"), pid01) cache.putSlavePid(util.NewSlaveID("slave02"), pid02) assert.True(t, cache.containsSlavePid(util.NewSlaveID("slave01"))) assert.True(t, cache.containsSlavePid(util.NewSlaveID("slave02"))) assert.False(t, cache.containsSlavePid(util.NewSlaveID("slave05"))) } func TestSchedCacheRemoveSlavePid(t *testing.T) { cache := newSchedCache() pid01, err := upid.Parse("slave01@127.0.0.1:5050") assert.NoError(t, err) pid02, err := upid.Parse("slave02@127.0.0.1:5050") assert.NoError(t, err) cache.putSlavePid(util.NewSlaveID("slave01"), pid01) cache.putSlavePid(util.NewSlaveID("slave02"), pid02) assert.True(t, cache.containsSlavePid(util.NewSlaveID("slave01"))) assert.True(t, cache.containsSlavePid(util.NewSlaveID("slave02"))) assert.False(t, cache.containsSlavePid(util.NewSlaveID("slave05"))) cache.removeSlavePid(util.NewSlaveID("slave01")) assert.Equal(t, 1, len(cache.savedSlavePids)) assert.False(t, cache.containsSlavePid(util.NewSlaveID("slave01"))) } func createTestOffer(idSuffix string) *mesos.Offer { return util.NewOffer( util.NewOfferID("test-offer-"+idSuffix), util.NewFrameworkID("test-framework-"+idSuffix), util.NewSlaveID("test-slave-"+idSuffix), "localhost."+idSuffix, ) } mesos-go-0.0.1/scheduler/schedtype.go000066400000000000000000000224011257601144100175360ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 scheduler import ( mesos "github.com/mesos/mesos-go/mesosproto" ) // Interface for connecting a scheduler to Mesos. This // interface is used both to manage the scheduler's lifecycle (start // it, stop it, or wait for it to finish) and to interact with Mesos // (e.g., launch tasks, kill tasks, etc.). // See the MesosSchedulerDriver type for a concrete // impl of a SchedulerDriver. type SchedulerDriver interface { // Starts the scheduler driver. This needs to be called before any // other driver calls are made. Start() (mesos.Status, error) // Stops the scheduler driver. If the 'failover' flag is set to // false then it is expected that this framework will never // reconnect to Mesos and all of its executors and tasks can be // terminated. Otherwise, all executors and tasks will remain // running (for some framework specific failover timeout) allowing the // scheduler to reconnect (possibly in the same process, or from a // different process, for example, on a different machine). Stop(failover bool) (mesos.Status, error) // Aborts the driver so that no more callbacks can be made to the // scheduler. The semantics of abort and stop have deliberately been // separated so that code can detect an aborted driver (i.e., via // the return status of SchedulerDriver::join, see below), and // instantiate and start another driver if desired (from within the // same process). Note that 'Stop()' is not automatically called // inside 'Abort()'. Abort() (mesos.Status, error) // Waits for the driver to be stopped or aborted, possibly // _blocking_ the current thread indefinitely. The return status of // this function can be used to determine if the driver was aborted // (see mesos.proto for a description of Status). Join() (mesos.Status, error) // Starts and immediately joins (i.e., blocks on) the driver. Run() (mesos.Status, error) // Requests resources from Mesos (see mesos.proto for a description // of Request and how, for example, to request resources // from specific slaves). Any resources available are offered to the // framework via Scheduler.ResourceOffers callback, asynchronously. RequestResources(requests []*mesos.Request) (mesos.Status, error) // Launches the given set of tasks. Any resources remaining (i.e., // not used by the tasks or their executors) will be considered // declined. The specified filters are applied on all unused // resources (see mesos.proto for a description of Filters). // Available resources are aggregated when mutiple offers are // provided. Note that all offers must belong to the same slave. // Invoking this function with an empty collection of tasks declines // offers in their entirety (see Scheduler::declineOffer). LaunchTasks(offerIDs []*mesos.OfferID, tasks []*mesos.TaskInfo, filters *mesos.Filters) (mesos.Status, error) // Kills the specified task. Note that attempting to kill a task is // currently not reliable. If, for example, a scheduler fails over // while it was attempting to kill a task it will need to retry in // the future. Likewise, if unregistered / disconnected, the request // will be dropped (these semantics may be changed in the future). KillTask(taskID *mesos.TaskID) (mesos.Status, error) // Declines an offer in its entirety and applies the specified // filters on the resources (see mesos.proto for a description of // Filters). Note that this can be done at any time, it is not // necessary to do this within the Scheduler::resourceOffers // callback. DeclineOffer(offerID *mesos.OfferID, filters *mesos.Filters) (mesos.Status, error) // Removes all filters previously set by the framework (via // LaunchTasks()). This enables the framework to receive offers from // those filtered slaves. ReviveOffers() (mesos.Status, error) // Sends a message from the framework to one of its executors. These // messages are best effort; do not expect a framework message to be // retransmitted in any reliable fashion. SendFrameworkMessage(executorID *mesos.ExecutorID, slaveID *mesos.SlaveID, data string) (mesos.Status, error) // Allows the framework to query the status for non-terminal tasks. // This causes the master to send back the latest task status for // each task in 'statuses', if possible. Tasks that are no longer // known will result in a TASK_LOST update. If statuses is empty, // then the master will send the latest status for each task // currently known. ReconcileTasks(statuses []*mesos.TaskStatus) (mesos.Status, error) } // Scheduler a type with callback attributes to be provided by frameworks // schedulers. // // Each callback includes a reference to the scheduler driver that was // used to run this scheduler. The pointer will not change for the // duration of a scheduler (i.e., from the point you do // SchedulerDriver.Start() to the point that SchedulerDriver.Stop() // returns). This is intended for convenience so that a scheduler // doesn't need to store a reference to the driver itself. type Scheduler interface { // Invoked when the scheduler successfully registers with a Mesos // master. A unique ID (generated by the master) used for // distinguishing this framework from others and MasterInfo // with the ip and port of the current master are provided as arguments. Registered(SchedulerDriver, *mesos.FrameworkID, *mesos.MasterInfo) // Invoked when the scheduler re-registers with a newly elected Mesos master. // This is only called when the scheduler has previously been registered. // MasterInfo containing the updated information about the elected master // is provided as an argument. Reregistered(SchedulerDriver, *mesos.MasterInfo) // Invoked when the scheduler becomes "disconnected" from the master // (e.g., the master fails and another is taking over). Disconnected(SchedulerDriver) // Invoked when resources have been offered to this framework. A // single offer will only contain resources from a single slave. // Resources associated with an offer will not be re-offered to // _this_ framework until either (a) this framework has rejected // those resources (see SchedulerDriver::launchTasks) or (b) those // resources have been rescinded (see Scheduler::offerRescinded). // Note that resources may be concurrently offered to more than one // framework at a time (depending on the allocator being used). In // that case, the first framework to launch tasks using those // resources will be able to use them while the other frameworks // will have those resources rescinded (or if a framework has // already launched tasks with those resources then those tasks will // fail with a TASK_LOST status and a message saying as much). ResourceOffers(SchedulerDriver, []*mesos.Offer) // Invoked when an offer is no longer valid (e.g., the slave was // lost or another framework used resources in the offer). If for // whatever reason an offer is never rescinded (e.g., dropped // message, failing over framework, etc.), a framwork that attempts // to launch tasks using an invalid offer will receive TASK_LOST // status updates for those tasks (see Scheduler::resourceOffers). OfferRescinded(SchedulerDriver, *mesos.OfferID) // Invoked when the status of a task has changed (e.g., a slave is // lost and so the task is lost, a task finishes and an executor // sends a status update saying so, etc). Note that returning from // this callback _acknowledges_ receipt of this status update! If // for whatever reason the scheduler aborts during this callback (or // the process exits) another status update will be delivered (note, // however, that this is currently not true if the slave sending the // status update is lost/fails during that time). StatusUpdate(SchedulerDriver, *mesos.TaskStatus) // Invoked when an executor sends a message. These messages are best // effort; do not expect a framework message to be retransmitted in // any reliable fashion. FrameworkMessage(SchedulerDriver, *mesos.ExecutorID, *mesos.SlaveID, string) // Invoked when a slave has been determined unreachable (e.g., // machine failure, network partition). Most frameworks will need to // reschedule any tasks launched on this slave on a new slave. SlaveLost(SchedulerDriver, *mesos.SlaveID) // Invoked when an executor has exited/terminated. Note that any // tasks running will have TASK_LOST status updates automagically // generated. ExecutorLost(SchedulerDriver, *mesos.ExecutorID, *mesos.SlaveID, int) // Invoked when there is an unrecoverable error in the scheduler or // scheduler driver. The driver will be aborted BEFORE invoking this // callback. Error(SchedulerDriver, string) } mesos-go-0.0.1/scheduler/scheduler.go000066400000000000000000001226011257601144100175270ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 scheduler import ( "errors" "fmt" "math" "math/rand" "net" "os/user" "sync" "time" "github.com/gogo/protobuf/proto" log "github.com/golang/glog" "github.com/mesos/mesos-go/auth" "github.com/mesos/mesos-go/detector" mesos "github.com/mesos/mesos-go/mesosproto" util "github.com/mesos/mesos-go/mesosutil" "github.com/mesos/mesos-go/mesosutil/process" "github.com/mesos/mesos-go/messenger" "github.com/mesos/mesos-go/upid" "github.com/pborman/uuid" "golang.org/x/net/context" ) const ( authTimeout = 5 * time.Second // timeout interval for an authentication attempt registrationRetryIntervalMax = float64(1 * time.Minute) registrationBackoffFactor = 2 * time.Second ) var ( authenticationCanceledError = errors.New("authentication canceled") ) // helper to track authentication progress and to prevent multiple close() ops // against a signalling chan. it's safe to invoke the func's of this struct // even if the receiver pointer is nil. type authenticationAttempt struct { done chan struct{} doneOnce sync.Once } func (a *authenticationAttempt) cancel() { if a != nil { a.doneOnce.Do(func() { close(a.done) }) } } func (a *authenticationAttempt) inProgress() bool { if a != nil { select { case <-a.done: return false default: return true } } return false } type DriverConfig struct { Scheduler Scheduler Framework *mesos.FrameworkInfo Master string Credential *mesos.Credential // optional WithAuthContext func(context.Context) context.Context // required when Credential != nil HostnameOverride string // optional BindingAddress net.IP // optional BindingPort uint16 // optional PublishedAddress net.IP // optional NewMessenger func() (messenger.Messenger, error) // optional } // Concrete implementation of a SchedulerDriver that connects a // Scheduler with a Mesos master. The MesosSchedulerDriver is // thread-safe. // // Note that scheduler failover is supported in Mesos. After a // scheduler is registered with Mesos it may failover (to a new // process on the same machine or across multiple machines) by // creating a new driver with the ID given to it in // Scheduler.Registered(). // // The driver is responsible for invoking the Scheduler callbacks as // it communicates with the Mesos master. // // Note that blocking on the MesosSchedulerDriver (e.g., via // MesosSchedulerDriver.Join) doesn't affect the scheduler callbacks // in anyway because they are handled by a different thread. // // TODO(yifan): examples. // See src/examples/test_framework.cpp for an example of using the // MesosSchedulerDriver. type MesosSchedulerDriver struct { masterPid *upid.UPID frameworkInfo *mesos.FrameworkInfo self *upid.UPID stopCh chan struct{} status mesos.Status messenger messenger.Messenger masterDetector detector.Master connected bool connection uuid.UUID failoverTimeout float64 failover bool cache *schedCache updates map[string]*mesos.StatusUpdate // Key is a UUID string. tasks map[string]*mesos.TaskInfo // Key is a UUID string. credential *mesos.Credential authenticated bool authenticating *authenticationAttempt reauthenticate bool withAuthContext func(context.Context) context.Context dispatch func(context.Context, *upid.UPID, proto.Message) error // send a message somewhere started chan struct{} // signal chan that closes upon a successful call to Start() eventLock sync.RWMutex // guard for all driver state eventCond *sync.Cond // linked to eventLock, used to detect driver stop withScheduler func(f func(s Scheduler)) // execute some func with respect to the given scheduler } // Create a new mesos scheduler driver with the given // scheduler, framework info, // master address, and credential(optional) func NewMesosSchedulerDriver(config DriverConfig) (initializedDriver *MesosSchedulerDriver, err error) { if config.Scheduler == nil { err = fmt.Errorf("Scheduler callbacks required.") } else if config.Master == "" { err = fmt.Errorf("Missing master location URL.") } else if config.Framework == nil { err = fmt.Errorf("FrameworkInfo must be provided.") } else if config.Credential != nil && config.WithAuthContext == nil { err = fmt.Errorf("WithAuthContext must be provided when Credential != nil") } if err != nil { return } framework := proto.Clone(config.Framework).(*mesos.FrameworkInfo) // set default userid if framework.GetUser() == "" { user, err := user.Current() if err != nil || user == nil { if err != nil { log.Warningf("Failed to obtain username: %v\n", err) } else { log.Warningln("Failed to obtain username.") } framework.User = proto.String("") } else { framework.User = proto.String(user.Username) } } // default hostname hostname := util.GetHostname(config.HostnameOverride) if framework.GetHostname() == "" { framework.Hostname = proto.String(hostname) } driver := &MesosSchedulerDriver{ frameworkInfo: framework, stopCh: make(chan struct{}), status: mesos.Status_DRIVER_NOT_STARTED, cache: newSchedCache(), credential: config.Credential, failover: framework.Id != nil && len(framework.Id.GetValue()) > 0, withAuthContext: config.WithAuthContext, started: make(chan struct{}), } driver.eventCond = sync.NewCond(&driver.eventLock) // mechanism that allows us to asynchronously invoke scheduler callbacks, but in a manner // such that the callback invocations are serialized. useful because this will decouple the // goroutine executing a messenger callback from the goroutine executing a scheduler callback, // while preserving the serialization semantics for each type of callback handling. // we use a chan to maintain the order of callback invocations; this is important for maintaining // the order in which status updates are processed. schedQueue := make(chan func(s Scheduler)) go func() { for { select { case f := <-schedQueue: f(config.Scheduler) case <-driver.stopCh: // check for a tie: abort() may have sent a message that we need to pass up // to the user. select { case f := <-schedQueue: f(config.Scheduler) default: } return } } }() driver.withScheduler = func(f func(s Scheduler)) { select { case schedQueue <- f: case <-driver.stopCh: } } if framework.FailoverTimeout != nil && *framework.FailoverTimeout > 0 { driver.failoverTimeout = *framework.FailoverTimeout * float64(time.Second) log.V(1).Infof("found failover_timeout = %v", time.Duration(driver.failoverTimeout)) } newMessenger := config.NewMessenger if newMessenger == nil { newMessenger = func() (messenger.Messenger, error) { process := process.New("scheduler") return messenger.ForHostname(process, hostname, config.BindingAddress, config.BindingPort, config.PublishedAddress) } } // initialize new detector. if driver.masterDetector, err = detector.New(config.Master); err != nil { return } else if driver.messenger, err = newMessenger(); err != nil { return } else if err = driver.init(); err != nil { return } else { initializedDriver = driver } return } // init initializes the driver. func (driver *MesosSchedulerDriver) init() error { log.Infof("Initializing mesos scheduler driver\n") driver.dispatch = driver.messenger.Send // serialize all callbacks from the messenger guarded := func(h messenger.MessageHandler) messenger.MessageHandler { return messenger.MessageHandler(func(from *upid.UPID, msg proto.Message) { driver.eventLock.Lock() defer driver.eventLock.Unlock() h(from, msg) }) } // Install handlers. driver.messenger.Install(guarded(driver.frameworkRegistered), &mesos.FrameworkRegisteredMessage{}) driver.messenger.Install(guarded(driver.frameworkReregistered), &mesos.FrameworkReregisteredMessage{}) driver.messenger.Install(guarded(driver.resourcesOffered), &mesos.ResourceOffersMessage{}) driver.messenger.Install(guarded(driver.resourceOfferRescinded), &mesos.RescindResourceOfferMessage{}) driver.messenger.Install(guarded(driver.statusUpdated), &mesos.StatusUpdateMessage{}) driver.messenger.Install(guarded(driver.slaveLost), &mesos.LostSlaveMessage{}) driver.messenger.Install(guarded(driver.frameworkMessageRcvd), &mesos.ExecutorToFrameworkMessage{}) driver.messenger.Install(guarded(driver.frameworkErrorRcvd), &mesos.FrameworkErrorMessage{}) driver.messenger.Install(guarded(driver.exitedExecutor), &mesos.ExitedExecutorMessage{}) driver.messenger.Install(guarded(driver.handleMasterChanged), &mesos.InternalMasterChangeDetected{}) driver.messenger.Install(guarded(driver.handleAuthenticationResult), &mesos.InternalAuthenticationResult{}) return nil } // lead master detection callback. func (driver *MesosSchedulerDriver) handleMasterChanged(from *upid.UPID, pbMsg proto.Message) { if driver.status == mesos.Status_DRIVER_ABORTED { log.Info("Ignoring master change because the driver is aborted.") return } else if !from.Equal(driver.self) { log.Errorf("ignoring master changed message received from upid '%v'", from) return } // Reconnect every time a master is detected. if driver.connected { log.V(3).Info("Disconnecting scheduler.") driver.masterPid = nil driver.withScheduler(func(s Scheduler) { s.Disconnected(driver) }) } msg := pbMsg.(*mesos.InternalMasterChangeDetected) master := msg.Master driver.connected = false driver.authenticated = false if master != nil { log.Infof("New master %s detected\n", master.GetPid()) pid, err := upid.Parse(master.GetPid()) if err != nil { panic("Unable to parse Master's PID value.") // this should not happen. } driver.masterPid = pid // save for downstream ops. driver.tryAuthentication() } else { log.Infoln("No master detected.") } } // tryAuthentication expects to be guarded by eventLock func (driver *MesosSchedulerDriver) tryAuthentication() { if driver.authenticated { // programming error panic("already authenticated") } masterPid := driver.masterPid // save for referencing later in goroutine if masterPid == nil { log.Info("skipping authentication attempt because we lost the master") return } if driver.authenticating.inProgress() { // authentication is in progress, try to cancel it (we may too late already) driver.authenticating.cancel() driver.reauthenticate = true return } if driver.credential != nil { // authentication can block and we don't want to hold up the messenger loop authenticating := &authenticationAttempt{done: make(chan struct{})} go func() { defer authenticating.cancel() result := &mesos.InternalAuthenticationResult{ //TODO(jdef): is this really needed? Success: proto.Bool(false), Completed: proto.Bool(false), Pid: proto.String(masterPid.String()), } // don't reference driver.authenticating here since it may have changed if err := driver.authenticate(masterPid, authenticating); err != nil { log.Errorf("Scheduler failed to authenticate: %v\n", err) if err == auth.AuthenticationFailed { result.Completed = proto.Bool(true) } } else { result.Completed = proto.Bool(true) result.Success = proto.Bool(true) } driver.messenger.Route(context.TODO(), driver.messenger.UPID(), result) }() driver.authenticating = authenticating } else { log.Infoln("No credentials were provided. " + "Attempting to register scheduler without authentication.") driver.authenticated = true go driver.doReliableRegistration(float64(registrationBackoffFactor)) } } func (driver *MesosSchedulerDriver) handleAuthenticationResult(from *upid.UPID, pbMsg proto.Message) { if driver.status != mesos.Status_DRIVER_RUNNING { log.V(1).Info("ignoring authenticate because driver is not running") return } if !from.Equal(driver.self) { log.Errorf("ignoring authentication result message received from upid '%v'", from) return } if driver.authenticated { // programming error panic("already authenticated") } if driver.masterPid == nil { log.Infoln("ignoring authentication result because master is lost") driver.authenticating.cancel() // cancel any in-progress background attempt // disable future retries until we get a new master driver.reauthenticate = false return } msg := pbMsg.(*mesos.InternalAuthenticationResult) if driver.reauthenticate || !msg.GetCompleted() || driver.masterPid.String() != msg.GetPid() { log.Infof("failed to authenticate with master %v: master changed", driver.masterPid) driver.authenticating.cancel() // cancel any in-progress background authentication driver.reauthenticate = false driver.tryAuthentication() return } if !msg.GetSuccess() { log.Errorf("master %v refused authentication", driver.masterPid) return } driver.authenticated = true go driver.doReliableRegistration(float64(registrationBackoffFactor)) } // ------------------------- Accessors ----------------------- // // Status returns the current driver status func (driver *MesosSchedulerDriver) Status() mesos.Status { driver.eventLock.RLock() defer driver.eventLock.RUnlock() return driver.status } // Running returns true if the driver is in the DRIVER_RUNNING state func (driver *MesosSchedulerDriver) Running() bool { driver.eventLock.RLock() defer driver.eventLock.RUnlock() return driver.status == mesos.Status_DRIVER_RUNNING } // Connected returns true if the driver has a registered (and authenticated, if enabled) // connection to the leading mesos master func (driver *MesosSchedulerDriver) Connected() bool { driver.eventLock.RLock() defer driver.eventLock.RUnlock() return driver.connected } // stopped returns true if the driver status != DRIVER_RUNNING; expects to be guarded by eventLock func (driver *MesosSchedulerDriver) stopped() bool { return driver.status != mesos.Status_DRIVER_RUNNING } // ---------------------- Handlers for Events from Master --------------- // func (driver *MesosSchedulerDriver) frameworkRegistered(from *upid.UPID, pbMsg proto.Message) { log.V(2).Infoln("Handling scheduler driver framework registered event.") msg := pbMsg.(*mesos.FrameworkRegisteredMessage) masterInfo := msg.GetMasterInfo() masterPid := masterInfo.GetPid() frameworkId := msg.GetFrameworkId() if driver.status == mesos.Status_DRIVER_ABORTED { log.Infof("ignoring FrameworkRegisteredMessage from master %s, driver is aborted", masterPid) return } if driver.connected { log.Infoln("ignoring FrameworkRegisteredMessage from master, driver is already connected", masterPid) return } if driver.stopped() { log.Infof("ignoring FrameworkRegisteredMessage from master %s, driver is stopped", masterPid) return } if !driver.masterPid.Equal(from) { log.Warningf("ignoring framework registered message because it was sent from '%v' instead of leading master '%v'", from, driver.masterPid) return } log.Infof("Framework registered with ID=%s\n", frameworkId.GetValue()) driver.frameworkInfo.Id = frameworkId // generated by master. driver.connected = true driver.failover = false driver.connection = uuid.NewUUID() driver.withScheduler(func(s Scheduler) { s.Registered(driver, frameworkId, masterInfo) }) } func (driver *MesosSchedulerDriver) frameworkReregistered(from *upid.UPID, pbMsg proto.Message) { log.V(1).Infoln("Handling Scheduler re-registered event.") msg := pbMsg.(*mesos.FrameworkReregisteredMessage) if driver.status == mesos.Status_DRIVER_ABORTED { log.Infoln("Ignoring FrameworkReregisteredMessage from master, driver is aborted!") return } if driver.connected { log.Infoln("Ignoring FrameworkReregisteredMessage from master,driver is already connected!") return } if !driver.masterPid.Equal(from) { log.Warningf("ignoring framework re-registered message because it was sent from '%v' instead of leading master '%v'", from, driver.masterPid) return } // TODO(vv) detect if message was from leading-master (sched.cpp) log.Infof("Framework re-registered with ID [%s] ", msg.GetFrameworkId().GetValue()) driver.connected = true driver.failover = false driver.connection = uuid.NewUUID() driver.withScheduler(func(s Scheduler) { s.Reregistered(driver, msg.GetMasterInfo()) }) } func (driver *MesosSchedulerDriver) resourcesOffered(from *upid.UPID, pbMsg proto.Message) { log.V(2).Infoln("Handling resource offers.") msg := pbMsg.(*mesos.ResourceOffersMessage) if driver.status == mesos.Status_DRIVER_ABORTED { log.Infoln("Ignoring ResourceOffersMessage, the driver is aborted!") return } if !driver.connected { log.Infoln("Ignoring ResourceOffersMessage, the driver is not connected!") return } pidStrings := msg.GetPids() if len(pidStrings) != len(msg.Offers) { log.Errorln("Ignoring offers, Offer count does not match Slave PID count.") return } for i, offer := range msg.Offers { if pid, err := upid.Parse(pidStrings[i]); err == nil { driver.cache.putOffer(offer, pid) log.V(2).Infof("Cached offer %s from SlavePID %s", offer.Id.GetValue(), pid) } else { log.Warningf("Failed to parse offer PID '%v': %v", pid, err) } } driver.withScheduler(func(s Scheduler) { s.ResourceOffers(driver, msg.Offers) }) } func (driver *MesosSchedulerDriver) resourceOfferRescinded(from *upid.UPID, pbMsg proto.Message) { log.V(1).Infoln("Handling resource offer rescinded.") msg := pbMsg.(*mesos.RescindResourceOfferMessage) if driver.status == mesos.Status_DRIVER_ABORTED { log.Infoln("Ignoring RescindResourceOfferMessage, the driver is aborted!") return } if !driver.connected { log.Infoln("Ignoring ResourceOffersMessage, the driver is not connected!") return } // TODO(vv) check for leading master (see sched.cpp) log.V(1).Infoln("Rescinding offer ", msg.OfferId.GetValue()) driver.cache.removeOffer(msg.OfferId) driver.withScheduler(func(s Scheduler) { s.OfferRescinded(driver, msg.OfferId) }) } func (driver *MesosSchedulerDriver) send(upid *upid.UPID, msg proto.Message) error { //TODO(jdef) should implement timeout here ctx, cancel := context.WithCancel(context.TODO()) defer cancel() c := make(chan error, 1) go func() { c <- driver.dispatch(ctx, upid, msg) }() select { case <-ctx.Done(): <-c // wait for Send(...) return ctx.Err() case err := <-c: return err } } // statusUpdated expects to be guarded by eventLock func (driver *MesosSchedulerDriver) statusUpdated(from *upid.UPID, pbMsg proto.Message) { msg := pbMsg.(*mesos.StatusUpdateMessage) if driver.status != mesos.Status_DRIVER_RUNNING { log.V(1).Infoln("Ignoring StatusUpdate message, the driver is not running!") return } if !from.Equal(driver.self) { if !driver.connected { log.V(1).Infoln("Ignoring StatusUpdate message, the driver is not connected!") return } if !driver.masterPid.Equal(from) { log.Warningf("ignoring status message because it was sent from '%v' instead of leading master '%v'", from, driver.masterPid) return } } log.V(2).Infof("Received status update from %q status source %q", from.String(), msg.GetPid()) status := msg.Update.GetStatus() // see https://github.com/apache/mesos/blob/master/src/sched/sched.cpp#L887 // If the update does not have a 'uuid', it does not need // acknowledging. However, prior to 0.23.0, the update uuid // was required and always set. We also don't want to ACK updates // that were internally generated. In 0.24.0, we can rely on the // update uuid check here, until then we must still check for // this being sent from the driver (from == UPID()) or from // the master (pid == UPID()). // TODO(vinod): Get rid of this logic in 0.25.0 because master // and slave correctly set task status in 0.24.0. if clearUUID := len(msg.Update.Uuid) == 0 || from.Equal(driver.self) || msg.GetPid() == driver.self.String(); clearUUID { status.Uuid = nil } else { status.Uuid = msg.Update.Uuid } driver.withScheduler(func(s Scheduler) { s.StatusUpdate(driver, status) }) if driver.status == mesos.Status_DRIVER_ABORTED { log.V(1).Infoln("Not sending StatusUpdate ACK, the driver is aborted!") return } // Send StatusUpdate Acknowledgement; see above for the rules. // Only send ACK if udpate was not from this driver and spec'd a UUID; this is compat w/ 0.23+ ackRequired := len(msg.Update.Uuid) > 0 && !from.Equal(driver.self) && msg.GetPid() != driver.self.String() if ackRequired { ackMsg := &mesos.StatusUpdateAcknowledgementMessage{ SlaveId: msg.Update.SlaveId, FrameworkId: driver.frameworkInfo.Id, TaskId: msg.Update.Status.TaskId, Uuid: msg.Update.Uuid, } log.V(2).Infof("Sending ACK for status update %+v to %q", *msg.Update, from.String()) if err := driver.send(driver.masterPid, ackMsg); err != nil { log.Errorf("Failed to send StatusUpdate ACK message: %v", err) return } } else { log.V(2).Infof("Not sending ACK, update is not from slave %q", from.String()) } } func (driver *MesosSchedulerDriver) exitedExecutor(from *upid.UPID, pbMsg proto.Message) { log.V(1).Infoln("Handling ExitedExceutor event.") msg := pbMsg.(*mesos.ExitedExecutorMessage) if driver.status == mesos.Status_DRIVER_ABORTED { log.V(1).Infoln("Ignoring ExitedExecutor message, the driver is aborted!") return } if !driver.connected { log.V(1).Infoln("Ignoring ExitedExecutor message, the driver is not connected!") return } status := msg.GetStatus() log.V(2).Infoln("Lost executor %q from slave %q for framework %q with status %d", msg.GetExecutorId().GetValue(), msg.GetSlaveId().GetValue(), msg.GetFrameworkId().GetValue(), status) driver.withScheduler(func(s Scheduler) { s.ExecutorLost(driver, msg.GetExecutorId(), msg.GetSlaveId(), int(status)) }) } func (driver *MesosSchedulerDriver) slaveLost(from *upid.UPID, pbMsg proto.Message) { log.V(1).Infoln("Handling LostSlave event.") msg := pbMsg.(*mesos.LostSlaveMessage) if driver.status == mesos.Status_DRIVER_ABORTED { log.V(1).Infoln("Ignoring LostSlave message, the driver is aborted!") return } if !driver.connected { log.V(1).Infoln("Ignoring LostSlave message, the driver is not connected!") return } // TODO(VV) - detect leading master (see sched.cpp) log.V(2).Infoln("Lost slave ", msg.SlaveId.GetValue()) driver.cache.removeSlavePid(msg.SlaveId) driver.withScheduler(func(s Scheduler) { s.SlaveLost(driver, msg.SlaveId) }) } func (driver *MesosSchedulerDriver) frameworkMessageRcvd(from *upid.UPID, pbMsg proto.Message) { log.V(1).Infoln("Handling framework message event.") msg := pbMsg.(*mesos.ExecutorToFrameworkMessage) if driver.status == mesos.Status_DRIVER_ABORTED { log.V(1).Infoln("Ignoring framwork message, the driver is aborted!") return } log.V(1).Infoln("Received Framwork Message ", msg.String()) driver.withScheduler(func(s Scheduler) { s.FrameworkMessage(driver, msg.ExecutorId, msg.SlaveId, string(msg.Data)) }) } func (driver *MesosSchedulerDriver) frameworkErrorRcvd(from *upid.UPID, pbMsg proto.Message) { log.V(1).Infoln("Handling framework error event.") msg := pbMsg.(*mesos.FrameworkErrorMessage) driver.error(msg.GetMessage()) } // ---------------------- Interface Methods ---------------------- // // Starts the scheduler driver. // Returns immediately if an error occurs within start sequence. func (driver *MesosSchedulerDriver) Start() (mesos.Status, error) { driver.eventLock.Lock() defer driver.eventLock.Unlock() return driver.start() } // start expected to be guarded by eventLock func (driver *MesosSchedulerDriver) start() (mesos.Status, error) { select { case <-driver.started: return driver.status, errors.New("Unable to Start: driver has already been started once.") default: // proceed } log.Infoln("Starting the scheduler driver...") if driver.status != mesos.Status_DRIVER_NOT_STARTED { return driver.status, fmt.Errorf("Unable to Start, expecting driver status %s, but is %s:", mesos.Status_DRIVER_NOT_STARTED, driver.status) } // Start the messenger. if err := driver.messenger.Start(); err != nil { log.Errorf("Scheduler failed to start the messenger: %v\n", err) return driver.status, err } driver.self = driver.messenger.UPID() driver.status = mesos.Status_DRIVER_RUNNING close(driver.started) // TODO(jdef) hacky but we don't want to miss it if the scheduler shuts down go func() { t := time.NewTicker(2 * time.Second) defer t.Stop() for { <-t.C driver.eventCond.Broadcast() select { case <-driver.stopCh: return default: } } }() log.Infof("Mesos scheduler driver started with PID=%v", driver.self) listener := detector.OnMasterChanged(func(m *mesos.MasterInfo) { driver.messenger.Route(context.TODO(), driver.self, &mesos.InternalMasterChangeDetected{ Master: m, }) }) // register with Detect() AFTER we have a self pid from the messenger, otherwise things get ugly // because our internal messaging depends on it. detector callbacks are routed over the messenger // bus, maintaining serial (concurrency-safe) callback execution. log.V(1).Infof("starting master detector %T: %+v", driver.masterDetector, driver.masterDetector) driver.masterDetector.Detect(listener) log.V(2).Infoln("master detector started") return driver.status, nil } // authenticate against the spec'd master pid using the configured authenticationProvider. // the authentication process is canceled upon either cancelation of authenticating, or // else because it timed out (authTimeout). // // TODO(jdef) perhaps at some point in the future this will get pushed down into // the messenger layer (e.g. to use HTTP-based authentication). We'd probably still // specify the callback.Handler here, along with the user-selected authentication // provider. Perhaps in the form of some messenger.AuthenticationConfig. // func (driver *MesosSchedulerDriver) authenticate(pid *upid.UPID, authenticating *authenticationAttempt) error { log.Infof("authenticating with master %v", pid) ctx, cancel := context.WithTimeout(context.Background(), authTimeout) handler := &CredentialHandler{ pid: pid, client: driver.self, credential: driver.credential, } ctx = driver.withAuthContext(ctx) ctx = auth.WithParentUPID(ctx, *driver.self) ch := make(chan error, 1) go func() { ch <- auth.Login(ctx, handler) }() select { case <-ctx.Done(): <-ch return ctx.Err() case <-authenticating.done: cancel() <-ch return authenticationCanceledError case e := <-ch: cancel() return e } } func (driver *MesosSchedulerDriver) doReliableRegistration(maxBackoff float64) { for { if !driver.registerOnce() { return } maxBackoff = math.Min(maxBackoff, registrationRetryIntervalMax) // If failover timeout is present, bound the maximum backoff // by 1/10th of the failover timeout. if driver.failoverTimeout > 0 { maxBackoff = math.Min(maxBackoff, driver.failoverTimeout/10.0) } // Determine the delay for next attempt by picking a random // duration between 0 and 'maxBackoff' (jitter). delay := time.Duration(maxBackoff * rand.Float64()) log.V(1).Infof("will retry registration in %v if necessary", delay) select { case <-driver.stopCh: return case <-time.After(delay): maxBackoff *= 2 } } } // registerOnce returns true if we should attempt another registration later; it is *not* // guarded by eventLock: all access to mutable members of MesosSchedulerDriver should be // explicitly synchronized. func (driver *MesosSchedulerDriver) registerOnce() bool { var ( failover bool pid *upid.UPID info *mesos.FrameworkInfo ) if func() bool { driver.eventLock.RLock() defer driver.eventLock.RUnlock() if driver.stopped() || driver.connected || driver.masterPid == nil || (driver.credential != nil && !driver.authenticated) { log.V(1).Infof("skipping registration request: stopped=%v, connected=%v, authenticated=%v", driver.stopped(), driver.connected, driver.authenticated) return false } failover = driver.failover pid = driver.masterPid info = proto.Clone(driver.frameworkInfo).(*mesos.FrameworkInfo) return true }() { // register framework var message proto.Message if len(info.GetId().GetValue()) > 0 { // not the first time, or failing over log.V(1).Infof("Reregistering with master: %v", pid) message = &mesos.ReregisterFrameworkMessage{ Framework: info, Failover: proto.Bool(failover), } } else { log.V(1).Infof("Registering with master: %v", pid) message = &mesos.RegisterFrameworkMessage{ Framework: info, } } if err := driver.send(pid, message); err != nil { log.Errorf("failed to send RegisterFramework message: %v", err) if _, err = driver.Stop(failover); err != nil { log.Errorf("failed to stop scheduler driver: %v", err) } } return true } return false } //Join blocks until the driver is stopped. //Should follow a call to Start() func (driver *MesosSchedulerDriver) Join() (mesos.Status, error) { driver.eventLock.Lock() defer driver.eventLock.Unlock() return driver.join() } // join expects to be guarded by eventLock func (driver *MesosSchedulerDriver) join() (mesos.Status, error) { if stat := driver.status; stat != mesos.Status_DRIVER_RUNNING { return stat, fmt.Errorf("Unable to Join, expecting driver status %s, but is %s", mesos.Status_DRIVER_RUNNING, stat) } for { select { case <-driver.stopCh: // wait for stop signal return driver.status, nil default: driver.eventCond.Wait() } } } //Run starts and joins driver process and waits to be stopped or aborted. func (driver *MesosSchedulerDriver) Run() (mesos.Status, error) { driver.eventLock.Lock() defer driver.eventLock.Unlock() return driver.run() } // run expected to be guarded by eventLock func (driver *MesosSchedulerDriver) run() (mesos.Status, error) { stat, err := driver.start() if err != nil { return driver.stop(false) } if stat != mesos.Status_DRIVER_RUNNING { return stat, fmt.Errorf("Unable to Run, expecting driver status %s, but is %s:", mesos.Status_DRIVER_RUNNING, driver.status) } log.Infoln("Scheduler driver running. Waiting to be stopped.") return driver.join() } //Stop stops the driver. func (driver *MesosSchedulerDriver) Stop(failover bool) (mesos.Status, error) { driver.eventLock.Lock() defer driver.eventLock.Unlock() return driver.stop(failover) } // stop expects to be guarded by eventLock func (driver *MesosSchedulerDriver) stop(failover bool) (mesos.Status, error) { log.Infoln("Stopping the scheduler driver") if stat := driver.status; stat != mesos.Status_DRIVER_RUNNING { return stat, fmt.Errorf("Unable to Stop, expected driver status %s, but is %s", mesos.Status_DRIVER_RUNNING, stat) } if driver.connected && !failover { // unregister the framework log.Infoln("Unregistering the scheduler driver") message := &mesos.UnregisterFrameworkMessage{ FrameworkId: driver.frameworkInfo.Id, } //TODO(jdef) this is actually a little racy: we send an 'unregister' message but then // immediately afterward the messenger is stopped in driver._stop(). so the unregister message // may not actually end up being sent out. if err := driver.send(driver.masterPid, message); err != nil { log.Errorf("Failed to send UnregisterFramework message while stopping driver: %v\n", err) return driver._stop(mesos.Status_DRIVER_ABORTED) } time.Sleep(2 * time.Second) } // stop messenger return driver._stop(mesos.Status_DRIVER_STOPPED) } // stop expects to be guarded by eventLock func (driver *MesosSchedulerDriver) _stop(stopStatus mesos.Status) (mesos.Status, error) { // stop messenger defer func() { select { case <-driver.stopCh: // already closed default: close(driver.stopCh) } driver.eventCond.Broadcast() }() driver.status = stopStatus driver.connected = false err := driver.messenger.Stop() return stopStatus, err } func (driver *MesosSchedulerDriver) Abort() (stat mesos.Status, err error) { driver.eventLock.Lock() defer driver.eventLock.Unlock() return driver.abort("") } // abort expects to be guarded by eventLock func (driver *MesosSchedulerDriver) abort(errMessage string) (stat mesos.Status, err error) { defer driver.masterDetector.Cancel() log.Infof("Aborting framework [%+v]", driver.frameworkInfo.Id) if errMessage != "" { log.V(3).Infof("Sending error '%v'", errMessage) driver.withScheduler(func(s Scheduler) { s.Error(driver, errMessage) }) } if driver.connected { _, err = driver.stop(true) } else { driver.messenger.Stop() } stat = mesos.Status_DRIVER_ABORTED driver.status = stat return } func (driver *MesosSchedulerDriver) LaunchTasks(offerIds []*mesos.OfferID, tasks []*mesos.TaskInfo, filters *mesos.Filters) (mesos.Status, error) { driver.eventLock.Lock() defer driver.eventLock.Unlock() if stat := driver.status; stat != mesos.Status_DRIVER_RUNNING { return stat, fmt.Errorf("Unable to LaunchTasks, expected driver status %s, but got %s", mesos.Status_DRIVER_RUNNING, stat) } // Launch tasks if !driver.connected { log.Infoln("Ignoring LaunchTasks message, disconnected from master.") // Send statusUpdate with status=TASK_LOST for each task. // See sched.cpp L#823 for _, task := range tasks { driver.pushLostTask(task, "Master is disconnected") } return driver.status, fmt.Errorf("Not connected to master. Tasks marked as lost.") } okTasks := make([]*mesos.TaskInfo, 0, len(tasks)) // Set TaskInfo.executor.framework_id, if it's missing. for _, task := range tasks { if task.Executor != nil && task.Executor.FrameworkId == nil { task.Executor.FrameworkId = driver.frameworkInfo.Id } okTasks = append(okTasks, task) } for _, offerId := range offerIds { for _, task := range okTasks { // Keep only the slave PIDs where we run tasks so we can send // framework messages directly. if driver.cache.containsOffer(offerId) { if driver.cache.getOffer(offerId).offer.SlaveId.Equal(task.SlaveId) { // cache the tasked slave, for future communication pid := driver.cache.getOffer(offerId).slavePid driver.cache.putSlavePid(task.SlaveId, pid) } else { log.Warningf("Attempting to launch task %s with the wrong slaveId offer %s\n", task.TaskId.GetValue(), task.SlaveId.GetValue()) } } else { log.Warningf("Attempting to launch task %s with unknown offer %s\n", task.TaskId.GetValue(), offerId.GetValue()) } } driver.cache.removeOffer(offerId) // if offer } // launch tasks message := &mesos.LaunchTasksMessage{ FrameworkId: driver.frameworkInfo.Id, OfferIds: offerIds, Tasks: okTasks, Filters: filters, } if err := driver.send(driver.masterPid, message); err != nil { for _, task := range tasks { driver.pushLostTask(task, "Unable to launch tasks: "+err.Error()) } log.Errorf("Failed to send LaunchTask message: %v\n", err) return driver.status, err } return driver.status, nil } // pushLostTask expects to be guarded by eventLock func (driver *MesosSchedulerDriver) pushLostTask(taskInfo *mesos.TaskInfo, why string) { msg := &mesos.StatusUpdateMessage{ Update: &mesos.StatusUpdate{ FrameworkId: driver.frameworkInfo.Id, Status: &mesos.TaskStatus{ TaskId: taskInfo.TaskId, State: mesos.TaskState_TASK_LOST.Enum(), Source: mesos.TaskStatus_SOURCE_MASTER.Enum(), Message: proto.String(why), Reason: mesos.TaskStatus_REASON_MASTER_DISCONNECTED.Enum(), }, SlaveId: taskInfo.SlaveId, ExecutorId: taskInfo.Executor.ExecutorId, Timestamp: proto.Float64(float64(time.Now().Unix())), }, Pid: proto.String(driver.self.String()), } // put it on internal chanel // will cause handler to push to attached Scheduler driver.statusUpdated(driver.self, msg) } func (driver *MesosSchedulerDriver) KillTask(taskId *mesos.TaskID) (mesos.Status, error) { driver.eventLock.Lock() defer driver.eventLock.Unlock() if stat := driver.status; stat != mesos.Status_DRIVER_RUNNING { return stat, fmt.Errorf("Unable to KillTask, expecting driver status %s, but got %s", mesos.Status_DRIVER_RUNNING, stat) } if !driver.connected { log.Infoln("Ignoring kill task message, disconnected from master.") return driver.status, fmt.Errorf("Not connected to master") } message := &mesos.KillTaskMessage{ FrameworkId: driver.frameworkInfo.Id, TaskId: taskId, } if err := driver.send(driver.masterPid, message); err != nil { log.Errorf("Failed to send KillTask message: %v\n", err) return driver.status, err } return driver.status, nil } func (driver *MesosSchedulerDriver) RequestResources(requests []*mesos.Request) (mesos.Status, error) { driver.eventLock.Lock() defer driver.eventLock.Unlock() if stat := driver.status; stat != mesos.Status_DRIVER_RUNNING { return stat, fmt.Errorf("Unable to RequestResources, expecting driver status %s, but got %s", mesos.Status_DRIVER_RUNNING, stat) } if !driver.connected { log.Infoln("Ignoring request resource message, disconnected from master.") return driver.status, fmt.Errorf("Not connected to master") } message := &mesos.ResourceRequestMessage{ FrameworkId: driver.frameworkInfo.Id, Requests: requests, } if err := driver.send(driver.masterPid, message); err != nil { log.Errorf("Failed to send ResourceRequest message: %v\n", err) return driver.status, err } return driver.status, nil } func (driver *MesosSchedulerDriver) DeclineOffer(offerId *mesos.OfferID, filters *mesos.Filters) (mesos.Status, error) { // NOTE: don't lock eventLock here because we're delegating to LaunchTasks() and that does it for us // launching an empty task list will decline the offer return driver.LaunchTasks([]*mesos.OfferID{offerId}, []*mesos.TaskInfo{}, filters) } func (driver *MesosSchedulerDriver) ReviveOffers() (mesos.Status, error) { driver.eventLock.Lock() defer driver.eventLock.Unlock() if stat := driver.status; stat != mesos.Status_DRIVER_RUNNING { return stat, fmt.Errorf("Unable to ReviveOffers, expecting driver status %s, but got %s", mesos.Status_DRIVER_RUNNING, stat) } if !driver.connected { log.Infoln("Ignoring revive offers message, disconnected from master.") return driver.status, fmt.Errorf("Not connected to master.") } message := &mesos.ReviveOffersMessage{ FrameworkId: driver.frameworkInfo.Id, } if err := driver.send(driver.masterPid, message); err != nil { log.Errorf("Failed to send ReviveOffers message: %v\n", err) return driver.status, err } return driver.status, nil } func (driver *MesosSchedulerDriver) SendFrameworkMessage(executorId *mesos.ExecutorID, slaveId *mesos.SlaveID, data string) (mesos.Status, error) { driver.eventLock.Lock() defer driver.eventLock.Unlock() if stat := driver.status; stat != mesos.Status_DRIVER_RUNNING { return stat, fmt.Errorf("Unable to SendFrameworkMessage, expecting driver status %s, but got %s", mesos.Status_DRIVER_RUNNING, stat) } if !driver.connected { log.Infoln("Ignoring send framework message, disconnected from master.") return driver.status, fmt.Errorf("Not connected to master") } message := &mesos.FrameworkToExecutorMessage{ SlaveId: slaveId, FrameworkId: driver.frameworkInfo.Id, ExecutorId: executorId, Data: []byte(data), } // Use list of cached slaveIds from previous offers. // Send frameworkMessage directly to cached slave, otherwise to master. if driver.cache.containsSlavePid(slaveId) { slavePid := driver.cache.getSlavePid(slaveId) if slavePid.Equal(driver.self) { return driver.status, nil } if err := driver.send(slavePid, message); err != nil { log.Errorf("Failed to send framework to executor message: %v\n", err) return driver.status, err } } else { // slavePid not cached, send to master. if err := driver.send(driver.masterPid, message); err != nil { log.Errorf("Failed to send framework to executor message: %v\n", err) return driver.status, err } } return driver.status, nil } func (driver *MesosSchedulerDriver) ReconcileTasks(statuses []*mesos.TaskStatus) (mesos.Status, error) { driver.eventLock.Lock() defer driver.eventLock.Unlock() if stat := driver.status; stat != mesos.Status_DRIVER_RUNNING { return stat, fmt.Errorf("Unable to ReconcileTasks, expecting driver status %s, but got %s", mesos.Status_DRIVER_RUNNING, stat) } if !driver.connected { log.Infoln("Ignoring send Reconcile Tasks message, disconnected from master.") return driver.status, fmt.Errorf("Not connected to master.") } message := &mesos.ReconcileTasksMessage{ FrameworkId: driver.frameworkInfo.Id, Statuses: statuses, } if err := driver.send(driver.masterPid, message); err != nil { log.Errorf("Failed to send reconcile tasks message: %v\n", err) return driver.status, err } return driver.status, nil } // error expects to be guarded by eventLock func (driver *MesosSchedulerDriver) error(err string) { if driver.status == mesos.Status_DRIVER_ABORTED { log.V(3).Infoln("Ignoring error message, the driver is aborted!") return } log.Infoln("Aborting driver, got error '", err, "'") driver.abort(err) } mesos-go-0.0.1/scheduler/scheduler_intgr_test.go000066400000000000000000000347121257601144100217760ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 scheduler import ( "io/ioutil" "net/http" "reflect" "sync" "testing" "time" "github.com/gogo/protobuf/proto" log "github.com/golang/glog" mesos "github.com/mesos/mesos-go/mesosproto" util "github.com/mesos/mesos-go/mesosutil" "github.com/mesos/mesos-go/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) // testScuduler is used for testing Schduler callbacks. type testScheduler struct { ch chan bool wg *sync.WaitGroup s *SchedulerIntegrationTestSuite } // convenience func (sched *testScheduler) T() *testing.T { return sched.s.T() } func (sched *testScheduler) Registered(dr SchedulerDriver, fw *mesos.FrameworkID, mi *mesos.MasterInfo) { log.Infoln("Sched.Registered() called.") sched.s.Equal(fw.GetValue(), sched.s.registeredFrameworkId.GetValue(), "driver did not register the expected framework ID") sched.s.Equal(mi.GetIp(), uint32(123456)) sched.ch <- true } func (sched *testScheduler) Reregistered(dr SchedulerDriver, mi *mesos.MasterInfo) { log.Infoln("Sched.Reregistered() called") sched.s.Equal(mi.GetIp(), uint32(123456)) sched.ch <- true } func (sched *testScheduler) Disconnected(dr SchedulerDriver) { log.Infoln("Shed.Disconnected() called") } func (sched *testScheduler) ResourceOffers(dr SchedulerDriver, offers []*mesos.Offer) { log.Infoln("Sched.ResourceOffers called.") sched.s.NotNil(offers) sched.s.Equal(len(offers), 1) sched.ch <- true } func (sched *testScheduler) OfferRescinded(dr SchedulerDriver, oid *mesos.OfferID) { log.Infoln("Sched.OfferRescinded() called.") sched.s.NotNil(oid) sched.s.Equal("test-offer-001", oid.GetValue()) sched.ch <- true } func (sched *testScheduler) StatusUpdate(dr SchedulerDriver, stat *mesos.TaskStatus) { log.Infoln("Sched.StatusUpdate() called.") sched.s.NotNil(stat) sched.s.Equal("test-task-001", stat.GetTaskId().GetValue()) sched.wg.Done() log.Infof("Status update done with waitGroup") } func (sched *testScheduler) SlaveLost(dr SchedulerDriver, slaveId *mesos.SlaveID) { log.Infoln("Sched.SlaveLost() called.") sched.s.NotNil(slaveId) sched.s.Equal(slaveId.GetValue(), "test-slave-001") sched.ch <- true } func (sched *testScheduler) FrameworkMessage(dr SchedulerDriver, execId *mesos.ExecutorID, slaveId *mesos.SlaveID, data string) { log.Infoln("Sched.FrameworkMessage() called.") sched.s.NotNil(slaveId) sched.s.Equal(slaveId.GetValue(), "test-slave-001") sched.s.NotNil(execId) sched.s.NotNil(data) sched.s.Equal("test-data-999", string(data)) sched.ch <- true } func (sched *testScheduler) ExecutorLost(SchedulerDriver, *mesos.ExecutorID, *mesos.SlaveID, int) { log.Infoln("Sched.ExecutorLost called") } func (sched *testScheduler) Error(dr SchedulerDriver, err string) { log.Infoln("Sched.Error() called.") sched.s.Equal("test-error-999", err) sched.ch <- true } func (sched *testScheduler) waitForCallback(timeout time.Duration) bool { if timeout == 0 { timeout = 2 * time.Second } select { case <-sched.ch: //callback complete return true case <-time.After(timeout): sched.T().Fatalf("timed out after waiting %v for callback", timeout) } return false } func newTestScheduler(s *SchedulerIntegrationTestSuite) *testScheduler { return &testScheduler{ch: make(chan bool), s: s} } type mockServerConfigurator func(frameworkId *mesos.FrameworkID, suite *SchedulerIntegrationTestSuite) type SchedulerIntegrationTestSuiteCore struct { SchedulerTestSuiteCore server *testutil.MockMesosHttpServer driver *MesosSchedulerDriver sched *testScheduler config mockServerConfigurator validator http.HandlerFunc registeredFrameworkId *mesos.FrameworkID } type SchedulerIntegrationTestSuite struct { suite.Suite SchedulerIntegrationTestSuiteCore } // sets up a mock Mesos HTTP master listener, scheduler, and scheduler driver for testing. // attempts to wait for a registered or re-registered callback on the suite.sched. func (suite *SchedulerIntegrationTestSuite) configure(frameworkId *mesos.FrameworkID) bool { t := suite.T() // start mock master server to handle connection suite.server = testutil.NewMockMasterHttpServer(t, func(rsp http.ResponseWriter, req *http.Request) { log.Infoln("MockMaster - rcvd ", req.RequestURI) if suite.validator != nil { suite.validator(rsp, req) } else { ioutil.ReadAll(req.Body) defer req.Body.Close() rsp.WriteHeader(http.StatusAccepted) } }) t.Logf("test HTTP server listening on %v", suite.server.Addr) suite.sched = newTestScheduler(suite) suite.sched.ch = make(chan bool, 10) // big enough that it doesn't block callback processing suite.driver = newTestSchedulerDriver(suite.T(), driverConfig(suite.sched, suite.framework, suite.server.Addr, nil)).MesosSchedulerDriver suite.config(frameworkId, suite) stat, err := suite.driver.Start() suite.NoError(err) suite.Equal(mesos.Status_DRIVER_RUNNING, stat) ok := waitForConnected(t, suite.driver, 2*time.Second) if ok { ok = suite.sched.waitForCallback(0) // registered or re-registered callback } return ok } func (suite *SchedulerIntegrationTestSuite) configureServerWithRegisteredFramework() bool { // suite.framework is used to initialize the FrameworkInfo of // the driver, so if we clear the Id then we'll expect a registration message id := suite.framework.Id suite.framework.Id = nil suite.registeredFrameworkId = id return suite.configure(id) } var defaultMockServerConfigurator = mockServerConfigurator(func(frameworkId *mesos.FrameworkID, suite *SchedulerIntegrationTestSuite) { t := suite.T() masterInfo := util.NewMasterInfo("master", 123456, 1234) suite.server.On("/master/mesos.internal.RegisterFrameworkMessage").Do(func(rsp http.ResponseWriter, req *http.Request) { if suite.validator != nil { t.Logf("validating registration request") suite.validator(rsp, req) } else { ioutil.ReadAll(req.Body) defer req.Body.Close() rsp.WriteHeader(http.StatusAccepted) } // this is what the mocked scheduler is expecting to receive suite.driver.eventLock.Lock() defer suite.driver.eventLock.Unlock() suite.driver.frameworkRegistered(suite.driver.masterPid, &mesos.FrameworkRegisteredMessage{ FrameworkId: frameworkId, MasterInfo: masterInfo, }) }) suite.server.On("/master/mesos.internal.ReregisterFrameworkMessage").Do(func(rsp http.ResponseWriter, req *http.Request) { if suite.validator != nil { suite.validator(rsp, req) } else { ioutil.ReadAll(req.Body) defer req.Body.Close() rsp.WriteHeader(http.StatusAccepted) } // this is what the mocked scheduler is expecting to receive suite.driver.eventLock.Lock() defer suite.driver.eventLock.Unlock() suite.driver.frameworkReregistered(suite.driver.masterPid, &mesos.FrameworkReregisteredMessage{ FrameworkId: frameworkId, MasterInfo: masterInfo, }) }) }) func (s *SchedulerIntegrationTestSuite) newMockClient() *testutil.MockMesosClient { return testutil.NewMockMesosClient(s.T(), s.server.PID) } func (s *SchedulerIntegrationTestSuite) SetupTest() { s.SchedulerTestSuiteCore.SetupTest() s.config = defaultMockServerConfigurator } func (s *SchedulerIntegrationTestSuite) TearDownTest() { if s.server != nil { s.server.Close() } if s.driver != nil && s.driver.Status() == mesos.Status_DRIVER_RUNNING { s.driver.Abort() } } // ---------------------------------- Tests ---------------------------------- // func TestSchedulerIntegrationSuite(t *testing.T) { suite.Run(t, new(SchedulerIntegrationTestSuite)) } func (suite *SchedulerIntegrationTestSuite) TestSchedulerDriverRegisterFrameworkMessage() { t := suite.T() id := suite.framework.Id suite.framework.Id = nil validated := make(chan struct{}) var closeOnce sync.Once suite.validator = http.HandlerFunc(func(rsp http.ResponseWriter, req *http.Request) { t.Logf("RCVD request %s", req.URL) data, err := ioutil.ReadAll(req.Body) if err != nil { t.Fatalf("Missing message data from request") } defer req.Body.Close() if "/master/mesos.internal.RegisterFrameworkMessage" != req.RequestURI { rsp.WriteHeader(http.StatusAccepted) return } defer closeOnce.Do(func() { close(validated) }) message := new(mesos.RegisterFrameworkMessage) err = proto.Unmarshal(data, message) if err != nil { t.Fatal("Problem unmarshaling expected RegisterFrameworkMessage") } suite.NotNil(message) info := message.GetFramework() suite.NotNil(info) suite.Equal(suite.framework.GetName(), info.GetName()) suite.True(reflect.DeepEqual(suite.framework.GetId(), info.GetId())) rsp.WriteHeader(http.StatusOK) }) ok := suite.configure(id) suite.True(ok, "failed to establish running test server and driver") select { case <-time.After(1 * time.Second): t.Fatalf("failed to complete validation of framework registration message") case <-validated: // noop } } func (suite *SchedulerIntegrationTestSuite) TestSchedulerDriverFrameworkRegisteredEvent() { ok := suite.configureServerWithRegisteredFramework() suite.True(ok, "failed to establish running test server and driver") } func (suite *SchedulerIntegrationTestSuite) TestSchedulerDriverFrameworkReregisteredEvent() { ok := suite.configure(suite.framework.Id) suite.True(ok, "failed to establish running test server and driver") } func (suite *SchedulerIntegrationTestSuite) TestSchedulerDriverResourceOffersEvent() { ok := suite.configureServerWithRegisteredFramework() suite.True(ok, "failed to establish running test server and driver") // Send a event to this SchedulerDriver (via http) to test handlers. offer := util.NewOffer( util.NewOfferID("test-offer-001"), suite.registeredFrameworkId, util.NewSlaveID("test-slave-001"), "test-localhost", ) pbMsg := &mesos.ResourceOffersMessage{ Offers: []*mesos.Offer{offer}, Pids: []string{"test-offer-001@test-slave-001:5051"}, } c := suite.newMockClient() c.SendMessage(suite.driver.self, pbMsg) suite.sched.waitForCallback(0) } func (suite *SchedulerIntegrationTestSuite) TestSchedulerDriverRescindOfferEvent() { ok := suite.configureServerWithRegisteredFramework() suite.True(ok, "failed to establish running test server and driver") // Send a event to this SchedulerDriver (via http) to test handlers. pbMsg := &mesos.RescindResourceOfferMessage{ OfferId: util.NewOfferID("test-offer-001"), } c := suite.newMockClient() c.SendMessage(suite.driver.self, pbMsg) suite.sched.waitForCallback(0) } func (suite *SchedulerIntegrationTestSuite) TestSchedulerDriverStatusUpdatedEvent() { t := suite.T() var wg sync.WaitGroup wg.Add(2) suite.config = mockServerConfigurator(func(frameworkId *mesos.FrameworkID, suite *SchedulerIntegrationTestSuite) { defaultMockServerConfigurator(frameworkId, suite) suite.server.On("/master/mesos.internal.StatusUpdateAcknowledgementMessage").Do(func(rsp http.ResponseWriter, req *http.Request) { log.Infoln("Master cvd ACK") data, _ := ioutil.ReadAll(req.Body) defer req.Body.Close() assert.NotNil(t, data) wg.Done() log.Infof("MockMaster - Done with wait group") }) suite.sched.wg = &wg }) ok := suite.configureServerWithRegisteredFramework() suite.True(ok, "failed to establish running test server and driver") // Send a event to this SchedulerDriver (via http) to test handlers. pbMsg := &mesos.StatusUpdateMessage{ Update: util.NewStatusUpdate( suite.registeredFrameworkId, util.NewTaskStatus(util.NewTaskID("test-task-001"), mesos.TaskState_TASK_STARTING), float64(time.Now().Unix()), []byte("test-abcd-ef-3455-454-001"), ), // note: cannot use driver's pid here if we want an ACK Pid: proto.String("test-slave-001(1)@foo.bar:1234"), } pbMsg.Update.SlaveId = &mesos.SlaveID{Value: proto.String("test-slave-001")} c := suite.newMockClient() c.SendMessage(suite.driver.self, pbMsg) wg.Wait() } func (suite *SchedulerIntegrationTestSuite) TestSchedulerDriverLostSlaveEvent() { ok := suite.configureServerWithRegisteredFramework() suite.True(ok, "failed to establish running test server and driver") // Send a event to this SchedulerDriver (via http) to test handlers. offer := util.NewOffer( pbMsg := &mesos.LostSlaveMessage{ SlaveId: util.NewSlaveID("test-slave-001"), } c := suite.newMockClient() c.SendMessage(suite.driver.self, pbMsg) suite.sched.waitForCallback(0) } func (suite *SchedulerIntegrationTestSuite) TestSchedulerDriverFrameworkMessageEvent() { ok := suite.configureServerWithRegisteredFramework() suite.True(ok, "failed to establish running test server and driver") // Send a event to this SchedulerDriver (via http) to test handlers. offer := util.NewOffer( pbMsg := &mesos.ExecutorToFrameworkMessage{ SlaveId: util.NewSlaveID("test-slave-001"), FrameworkId: suite.registeredFrameworkId, ExecutorId: util.NewExecutorID("test-executor-001"), Data: []byte("test-data-999"), } c := suite.newMockClient() c.SendMessage(suite.driver.self, pbMsg) suite.sched.waitForCallback(0) } func waitForConnected(t *testing.T, driver *MesosSchedulerDriver, timeout time.Duration) bool { connected := make(chan struct{}) go func() { defer close(connected) for !driver.Connected() { time.Sleep(200 * time.Millisecond) } }() select { case <-time.After(timeout): t.Fatalf("driver failed to establish connection within %v", timeout) return false case <-connected: return true } } func (suite *SchedulerIntegrationTestSuite) TestSchedulerDriverFrameworkErrorEvent() { ok := suite.configureServerWithRegisteredFramework() suite.True(ok, "failed to establish running test server and driver") // Send an error event to this SchedulerDriver (via http) to test handlers. pbMsg := &mesos.FrameworkErrorMessage{ Message: proto.String("test-error-999"), } c := suite.newMockClient() c.SendMessage(suite.driver.self, pbMsg) suite.sched.waitForCallback(0) suite.Equal(mesos.Status_DRIVER_ABORTED, suite.driver.Status()) } mesos-go-0.0.1/scheduler/scheduler_unit_test.go000066400000000000000000000432721257601144100216330ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 scheduler import ( "fmt" "os/user" "sync" "testing" "time" "github.com/gogo/protobuf/proto" log "github.com/golang/glog" "github.com/mesos/mesos-go/detector" _ "github.com/mesos/mesos-go/detector/zoo" mesos "github.com/mesos/mesos-go/mesosproto" util "github.com/mesos/mesos-go/mesosutil" "github.com/mesos/mesos-go/messenger" "github.com/mesos/mesos-go/upid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" "golang.org/x/net/context" ) var ( registerMockDetectorOnce sync.Once ) func ensureMockDetectorRegistered() { registerMockDetectorOnce.Do(func() { var s *SchedulerTestSuite err := s.registerMockDetector("testing://") if err != nil { log.Error(err) } }) } type MockDetector struct { mock.Mock address string } func (m *MockDetector) Detect(listener detector.MasterChanged) error { if listener != nil { if pid, err := upid.Parse("master(2)@" + m.address); err != nil { return err } else { go listener.OnMasterChanged(detector.CreateMasterInfo(pid)) } } return nil } func (m *MockDetector) Done() <-chan struct{} { return nil } func (m *MockDetector) Cancel() {} type SchedulerTestSuiteCore struct { master string masterUpid string masterId string frameworkID string framework *mesos.FrameworkInfo } type SchedulerTestSuite struct { suite.Suite SchedulerTestSuiteCore } func (s *SchedulerTestSuite) registerMockDetector(prefix string) error { address := "" if s != nil { address = s.master } else { address = "127.0.0.1:8080" } return detector.Register(prefix, detector.PluginFactory(func(spec string) (detector.Master, error) { return &MockDetector{address: address}, nil })) } func (s *SchedulerTestSuiteCore) SetupTest() { s.master = "127.0.0.1:8080" s.masterUpid = "master(2)@" + s.master s.masterId = "some-master-id-uuid" s.frameworkID = "some-framework-id-uuid" s.framework = util.NewFrameworkInfo( "test-user", "test-name", util.NewFrameworkID(s.frameworkID), ) } func TestSchedulerSuite(t *testing.T) { t.Logf("running scheduler test suite..") suite.Run(t, new(SchedulerTestSuite)) } func driverConfig(sched Scheduler, framework *mesos.FrameworkInfo, master string, cred *mesos.Credential) DriverConfig { return driverConfigMessenger(sched, framework, master, cred, nil) } func driverConfigMessenger(sched Scheduler, framework *mesos.FrameworkInfo, master string, cred *mesos.Credential, m messenger.Messenger) DriverConfig { d := DriverConfig{ Scheduler: sched, Framework: framework, Master: master, Credential: cred, } if m != nil { d.NewMessenger = func() (messenger.Messenger, error) { return m, nil } } return d } func mockedMessenger() *messenger.MockedMessenger { m := messenger.NewMockedMessenger() m.On("Start").Return(nil) m.On("UPID").Return(&upid.UPID{}) m.On("Send").Return(nil) m.On("Stop").Return(nil) m.On("Route").Return(nil) m.On("Install").Return(nil) return m } type testSchedulerDriver struct { *MesosSchedulerDriver } func (t *testSchedulerDriver) setConnected(b bool) { t.eventLock.Lock() defer t.eventLock.Unlock() t.connected = b } func newTestSchedulerDriver(t *testing.T, cfg DriverConfig) *testSchedulerDriver { driver, err := NewMesosSchedulerDriver(cfg) if err != nil { t.Fatal(err) } return &testSchedulerDriver{driver} } func TestSchedulerDriverNew(t *testing.T) { masterAddr := "localhost:5050" driver := newTestSchedulerDriver(t, driverConfig(NewMockScheduler(), &mesos.FrameworkInfo{}, masterAddr, nil)) user, _ := user.Current() assert.Equal(t, user.Username, driver.frameworkInfo.GetUser()) host := util.GetHostname("") assert.Equal(t, host, driver.frameworkInfo.GetHostname()) } func TestSchedulerDriverNew_WithPid(t *testing.T) { masterAddr := "master@127.0.0.1:5050" mUpid, err := upid.Parse(masterAddr) assert.NoError(t, err) driver := newTestSchedulerDriver(t, driverConfig(NewMockScheduler(), &mesos.FrameworkInfo{}, masterAddr, nil)) driver.handleMasterChanged(driver.self, &mesos.InternalMasterChangeDetected{Master: &mesos.MasterInfo{Pid: proto.String(mUpid.String())}}) assert.True(t, driver.masterPid.Equal(mUpid), fmt.Sprintf("expected upid %+v instead of %+v", mUpid, driver.masterPid)) assert.NoError(t, err) } func (suite *SchedulerTestSuite) TestSchedulerDriverNew_WithFrameworkInfo_Override() { suite.framework.Hostname = proto.String("local-host") driver := newTestSchedulerDriver(suite.T(), driverConfig(NewMockScheduler(), suite.framework, "127.0.0.1:5050", nil)) suite.Equal(driver.frameworkInfo.GetUser(), "test-user") suite.Equal("local-host", driver.frameworkInfo.GetHostname()) } func (suite *SchedulerTestSuite) TestSchedulerDriverStartOK() { sched := NewMockScheduler() driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(sched, suite.framework, suite.master, nil, mockedMessenger())) suite.False(driver.Running()) stat, err := driver.Start() suite.NoError(err) suite.Equal(mesos.Status_DRIVER_RUNNING, stat) suite.True(driver.Running()) driver.Stop(true) } func (suite *SchedulerTestSuite) TestSchedulerDriverStartWithMessengerFailure() { sched := NewMockScheduler() sched.On("Error").Return() messenger := messenger.NewMockedMessenger() messenger.On("Start").Return(fmt.Errorf("Failed to start messenger")) messenger.On("Stop").Return(nil) messenger.On("Install").Return(nil) driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(sched, suite.framework, suite.master, nil, messenger)) suite.False(driver.Running()) stat, err := driver.Start() suite.Error(err) suite.False(driver.Running()) suite.False(driver.Connected()) suite.Equal(mesos.Status_DRIVER_NOT_STARTED, driver.Status()) suite.Equal(mesos.Status_DRIVER_NOT_STARTED, stat) } func (suite *SchedulerTestSuite) TestSchedulerDriverStartWithRegistrationFailure() { sched := NewMockScheduler() sched.On("Error").Return() // Set expections and return values. messenger := messenger.NewMockedMessenger() messenger.On("Start").Return(nil) messenger.On("UPID").Return(&upid.UPID{}) messenger.On("Stop").Return(nil) messenger.On("Install").Return(nil) driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(sched, suite.framework, suite.master, nil, messenger)) // reliable registration loops until the driver is stopped, connected, etc.. stat, err := driver.Start() suite.NoError(err) suite.Equal(mesos.Status_DRIVER_RUNNING, stat) time.Sleep(5 * time.Second) // wait a bit, registration should be looping... suite.True(driver.Running()) suite.Equal(mesos.Status_DRIVER_RUNNING, driver.Status()) // stop the driver, should not panic! driver.Stop(false) // intentionally not failing over suite.False(driver.Running()) suite.Equal(mesos.Status_DRIVER_STOPPED, driver.Status()) messenger.AssertExpectations(suite.T()) } func (suite *SchedulerTestSuite) TestSchedulerDriverJoinUnstarted() { driver := newTestSchedulerDriver(suite.T(), driverConfig(NewMockScheduler(), suite.framework, suite.master, nil)) suite.False(driver.Running()) stat, err := driver.Join() suite.Error(err) suite.Equal(mesos.Status_DRIVER_NOT_STARTED, stat) suite.False(driver.Running()) } func (suite *SchedulerTestSuite) TestSchedulerDriverJoinOK() { // Set expections and return values. driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(NewMockScheduler(), suite.framework, suite.master, nil, mockedMessenger())) suite.False(driver.Running()) stat, err := driver.Start() suite.NoError(err) suite.Equal(mesos.Status_DRIVER_RUNNING, stat) suite.True(driver.Running()) testCh := make(chan mesos.Status) go func() { stat, _ := driver.Join() testCh <- stat }() driver.Stop(true) } func (suite *SchedulerTestSuite) TestSchedulerDriverRun() { // Set expections and return values. driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(NewMockScheduler(), suite.framework, suite.master, nil, mockedMessenger())) suite.False(driver.Running()) ch := make(chan struct{}) go func() { defer close(ch) stat, err := driver.Run() suite.NoError(err) suite.Equal(mesos.Status_DRIVER_STOPPED, stat) }() <-driver.started suite.True(driver.Running()) suite.Equal(mesos.Status_DRIVER_RUNNING, driver.Status()) // close it all. driver.Stop(true) <-ch } func (suite *SchedulerTestSuite) TestSchedulerDriverStopUnstarted() { driver := newTestSchedulerDriver(suite.T(), driverConfig(NewMockScheduler(), suite.framework, suite.master, nil)) suite.False(driver.Running()) stat, err := driver.Stop(true) suite.NotNil(err) suite.False(driver.Running()) suite.Equal(mesos.Status_DRIVER_NOT_STARTED, stat) } type msgTracker struct { *messenger.MockedMessenger lastMessage proto.Message } func (m *msgTracker) Send(ctx context.Context, upid *upid.UPID, msg proto.Message) error { m.lastMessage = msg return m.MockedMessenger.Send(ctx, upid, msg) } func (suite *SchedulerTestSuite) TestSchdulerDriverStop_WithoutFailover() { // Set expections and return values. messenger := &msgTracker{MockedMessenger: mockedMessenger()} driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(NewMockScheduler(), suite.framework, suite.master, nil, messenger)) suite.False(driver.Running()) ch := make(chan struct{}) go func() { defer close(ch) stat, err := driver.Run() suite.NoError(err) suite.Equal(mesos.Status_DRIVER_STOPPED, stat) }() <-driver.started suite.True(driver.Running()) suite.Equal(mesos.Status_DRIVER_RUNNING, driver.Status()) driver.connected = true // pretend that we're already registered driver.Stop(false) msg := messenger.lastMessage suite.NotNil(msg) _, isUnregMsg := msg.(proto.Message) suite.True(isUnregMsg, "expected UnregisterFrameworkMessage instead of %+v", msg) suite.False(driver.Running()) suite.Equal(mesos.Status_DRIVER_STOPPED, driver.Status()) <-ch } func (suite *SchedulerTestSuite) TestSchdulerDriverStop_WithFailover() { // Set expections and return values. messenger := &msgTracker{MockedMessenger: mockedMessenger()} driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(NewMockScheduler(), suite.framework, suite.master, nil, messenger)) suite.False(driver.Running()) stat, err := driver.Start() suite.NoError(err) suite.Equal(mesos.Status_DRIVER_RUNNING, stat) suite.True(driver.Running()) driver.connected = true // pretend that we're already registered ch := make(chan struct{}) go func() { defer close(ch) // Run() blocks until the driver is stopped or aborted stat, err := driver.Join() suite.NoError(err) suite.Equal(mesos.Status_DRIVER_STOPPED, stat) }() // wait for Join() to begin blocking (so that it has already validated the driver state) time.Sleep(200 * time.Millisecond) driver.Stop(true) // true = scheduler failover msg := messenger.lastMessage // we're expecting that lastMessage is nil because when failing over there's no // 'unregister' message sent by the scheduler. suite.Nil(msg) suite.False(driver.Running()) suite.Equal(mesos.Status_DRIVER_STOPPED, driver.Status()) <-ch } func (suite *SchedulerTestSuite) TestSchdulerDriverAbort() { driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(NewMockScheduler(), suite.framework, suite.master, nil, mockedMessenger())) suite.False(driver.Running()) ch := make(chan struct{}) go func() { defer close(ch) stat, err := driver.Run() suite.NoError(err) suite.Equal(mesos.Status_DRIVER_ABORTED, stat) }() <-driver.started driver.setConnected(true) // simulated suite.True(driver.Running()) suite.Equal(mesos.Status_DRIVER_RUNNING, driver.Status()) stat, err := driver.Abort() suite.NoError(err) <-driver.stopCh suite.False(driver.Running()) suite.Equal(mesos.Status_DRIVER_ABORTED, stat) suite.Equal(mesos.Status_DRIVER_ABORTED, driver.Status()) <-ch } func (suite *SchedulerTestSuite) TestSchdulerDriverLunchTasksUnstarted() { sched := NewMockScheduler() sched.On("Error").Return() // Set expections and return values. messenger := messenger.NewMockedMessenger() messenger.On("Route").Return(nil) messenger.On("Install").Return(nil) driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(sched, suite.framework, suite.master, nil, messenger)) stat, err := driver.LaunchTasks( []*mesos.OfferID{{}}, []*mesos.TaskInfo{}, &mesos.Filters{}, ) suite.Error(err) suite.Equal(mesos.Status_DRIVER_NOT_STARTED, stat) } func (suite *SchedulerTestSuite) TestSchdulerDriverLaunchTasksWithError() { sched := NewMockScheduler() sched.On("StatusUpdate").Return(nil) sched.On("Error").Return() msgr := mockedMessenger() driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(sched, suite.framework, suite.master, nil, msgr)) driver.dispatch = func(_ context.Context, _ *upid.UPID, _ proto.Message) error { return fmt.Errorf("Unable to send message") } go func() { driver.Run() }() <-driver.started driver.setConnected(true) // simulated suite.True(driver.Running()) // setup an offer offer := util.NewOffer( util.NewOfferID("test-offer-001"), suite.framework.Id, util.NewSlaveID("test-slave-001"), "test-slave(1)@localhost:5050", ) pid, err := upid.Parse("test-slave(1)@localhost:5050") suite.NoError(err) driver.cache.putOffer(offer, pid) // launch task task := util.NewTaskInfo( "simple-task", util.NewTaskID("simpe-task-1"), util.NewSlaveID("test-slave-001"), []*mesos.Resource{util.NewScalarResource("mem", 400)}, ) task.Command = util.NewCommandInfo("pwd") task.Executor = util.NewExecutorInfo(util.NewExecutorID("test-exec"), task.Command) tasks := []*mesos.TaskInfo{task} stat, err := driver.LaunchTasks( []*mesos.OfferID{offer.Id}, tasks, &mesos.Filters{}, ) suite.Equal(mesos.Status_DRIVER_RUNNING, stat) suite.Error(err) } func (suite *SchedulerTestSuite) TestSchdulerDriverLaunchTasks() { driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(NewMockScheduler(), suite.framework, suite.master, nil, mockedMessenger())) go func() { driver.Run() }() <-driver.started driver.setConnected(true) // simulated suite.True(driver.Running()) task := util.NewTaskInfo( "simple-task", util.NewTaskID("simpe-task-1"), util.NewSlaveID("slave-1"), []*mesos.Resource{util.NewScalarResource("mem", 400)}, ) task.Command = util.NewCommandInfo("pwd") tasks := []*mesos.TaskInfo{task} stat, err := driver.LaunchTasks( []*mesos.OfferID{{}}, tasks, &mesos.Filters{}, ) suite.NoError(err) suite.Equal(mesos.Status_DRIVER_RUNNING, stat) } func (suite *SchedulerTestSuite) TestSchdulerDriverKillTask() { driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(NewMockScheduler(), suite.framework, suite.master, nil, mockedMessenger())) go func() { driver.Run() }() <-driver.started driver.setConnected(true) // simulated suite.True(driver.Running()) stat, err := driver.KillTask(util.NewTaskID("test-task-1")) suite.NoError(err) suite.Equal(mesos.Status_DRIVER_RUNNING, stat) } func (suite *SchedulerTestSuite) TestSchdulerDriverRequestResources() { driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(NewMockScheduler(), suite.framework, suite.master, nil, mockedMessenger())) driver.Start() driver.setConnected(true) // simulated suite.Equal(mesos.Status_DRIVER_RUNNING, driver.Status()) stat, err := driver.RequestResources( []*mesos.Request{ { SlaveId: util.NewSlaveID("test-slave-001"), Resources: []*mesos.Resource{ util.NewScalarResource("test-res-001", 33.00), }, }, }, ) suite.NoError(err) suite.Equal(mesos.Status_DRIVER_RUNNING, stat) } func (suite *SchedulerTestSuite) TestSchdulerDriverDeclineOffers() { // see LaunchTasks test } func (suite *SchedulerTestSuite) TestSchdulerDriverReviveOffers() { driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(NewMockScheduler(), suite.framework, suite.master, nil, mockedMessenger())) driver.Start() driver.setConnected(true) // simulated suite.Equal(mesos.Status_DRIVER_RUNNING, driver.Status()) stat, err := driver.ReviveOffers() suite.NoError(err) suite.Equal(mesos.Status_DRIVER_RUNNING, stat) } func (suite *SchedulerTestSuite) TestSchdulerDriverSendFrameworkMessage() { driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(NewMockScheduler(), suite.framework, suite.master, nil, mockedMessenger())) driver.Start() driver.setConnected(true) // simulated suite.Equal(mesos.Status_DRIVER_RUNNING, driver.Status()) stat, err := driver.SendFrameworkMessage( util.NewExecutorID("test-exec-001"), util.NewSlaveID("test-slave-001"), "Hello!", ) suite.NoError(err) suite.Equal(mesos.Status_DRIVER_RUNNING, stat) } func (suite *SchedulerTestSuite) TestSchdulerDriverReconcileTasks() { driver := newTestSchedulerDriver(suite.T(), driverConfigMessenger(NewMockScheduler(), suite.framework, suite.master, nil, mockedMessenger())) driver.Start() driver.setConnected(true) // simulated suite.Equal(mesos.Status_DRIVER_RUNNING, driver.Status()) stat, err := driver.ReconcileTasks( []*mesos.TaskStatus{ util.NewTaskStatus(util.NewTaskID("test-task-001"), mesos.TaskState_TASK_FINISHED), }, ) suite.NoError(err) suite.Equal(mesos.Status_DRIVER_RUNNING, stat) } mesos-go-0.0.1/testutil/000077500000000000000000000000001257601144100151175ustar00rootroot00000000000000mesos-go-0.0.1/testutil/testingutil.go000066400000000000000000000115301257601144100200210ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ //Collection of resources for teting mesos artifacts. package testutil import ( "bytes" "fmt" "github.com/gogo/protobuf/proto" log "github.com/golang/glog" "github.com/mesos/mesos-go/upid" "github.com/stretchr/testify/assert" "io" "net" "net/http" "net/http/httptest" "os" "reflect" "sync" "testing" ) //MockMesosHttpProcess represents a remote http process: master or slave. type MockMesosHttpServer struct { PID *upid.UPID Addr string server *httptest.Server t *testing.T when map[string]http.HandlerFunc lock *sync.Mutex } type When interface { Do(http.HandlerFunc) } type WhenFunc func(http.HandlerFunc) func (w WhenFunc) Do(f http.HandlerFunc) { w(f) } func (m *MockMesosHttpServer) On(uri string) When { log.V(2).Infof("when %v do something special", uri) return WhenFunc(func(f http.HandlerFunc) { log.V(2).Infof("registered callback for %v", uri) m.when[uri] = f }) } func NewMockMasterHttpServer(t *testing.T, handler func(rsp http.ResponseWriter, req *http.Request)) *MockMesosHttpServer { var server *httptest.Server when := make(map[string]http.HandlerFunc) stateHandler := func(rsp http.ResponseWriter, req *http.Request) { if "/state.json" == req.RequestURI { state := fmt.Sprintf(`{ "leader": "master@%v" }`, server.Listener.Addr()) log.V(1).Infof("returning JSON %v", state) io.WriteString(rsp, state) } else if f, found := when[req.RequestURI]; found { f(rsp, req) } else { handler(rsp, req) } } h, lock := guardedHandler(http.HandlerFunc(stateHandler)) server = httptest.NewServer(h) assert.NotNil(t, server) addr := server.Listener.Addr().String() pid, err := upid.Parse("master@" + addr) assert.NoError(t, err) assert.NotNil(t, pid) log.Infoln("Created test Master http server with PID", pid.String()) return &MockMesosHttpServer{PID: pid, Addr: addr, server: server, t: t, when: when, lock: lock} } func NewMockSlaveHttpServer(t *testing.T, handler func(rsp http.ResponseWriter, req *http.Request)) *MockMesosHttpServer { h, lock := guardedHandler(http.HandlerFunc(handler)) server := httptest.NewServer(h) assert.NotNil(t, server) addr := server.Listener.Addr().String() pid, err := upid.Parse("slave(1)@" + addr) assert.NoError(t, err) assert.NotNil(t, pid) assert.NoError(t, os.Setenv("MESOS_SLAVE_PID", pid.String())) assert.NoError(t, os.Setenv("MESOS_SLAVE_ID", "test-slave-001")) log.Infoln("Created test Slave http server with PID", pid.String()) return &MockMesosHttpServer{PID: pid, Addr: addr, server: server, t: t, lock: lock} } // guardedHandler wraps http.Handler invocations with a mutex func guardedHandler(h http.Handler) (http.Handler, *sync.Mutex) { var lock sync.Mutex return http.HandlerFunc(func(rsp http.ResponseWriter, req *http.Request) { lock.Lock() defer lock.Unlock() h.ServeHTTP(rsp, req) }), &lock } func (s *MockMesosHttpServer) Close() { s.lock.Lock() defer s.lock.Unlock() s.server.Close() } //MockMesosClient Http client to communicate with mesos processes (master,sched,exec) type MockMesosClient struct { pid *upid.UPID t *testing.T } func NewMockMesosClient(t *testing.T, pid *upid.UPID) *MockMesosClient { return &MockMesosClient{t: t, pid: pid} } // sendMessage Mocks sending event messages to a processes such as master, sched or exec. func (c *MockMesosClient) SendMessage(targetPid *upid.UPID, message proto.Message) { if c.t == nil { panic("MockMesosClient needs a testing context.") } messageName := reflect.TypeOf(message).Elem().Name() data, err := proto.Marshal(message) assert.NoError(c.t, err) hostport := net.JoinHostPort(targetPid.Host, targetPid.Port) targetURL := fmt.Sprintf("http://%s/%s/mesos.internal.%s", hostport, targetPid.ID, messageName) log.Infoln("MockMesosClient Sending message to", targetURL) req, err := http.NewRequest("POST", targetURL, bytes.NewReader(data)) assert.NoError(c.t, err) req.Header.Add("Libprocess-From", c.pid.String()) req.Header.Add("Content-Type", "application/x-protobuf") resp, err := http.DefaultClient.Do(req) assert.NoError(c.t, err) assert.Equal(c.t, http.StatusAccepted, resp.StatusCode) } mesos-go-0.0.1/upid/000077500000000000000000000000001257601144100142035ustar00rootroot00000000000000mesos-go-0.0.1/upid/doc.go000066400000000000000000000001261257601144100152760ustar00rootroot00000000000000/* Package upid defines the UPID type and some utilities of the UPID. */ package upid mesos-go-0.0.1/upid/upid.go000066400000000000000000000033531257601144100154770ustar00rootroot00000000000000/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 upid import ( "fmt" "net" "strings" ) // UPID is a equivalent of the UPID in libprocess. type UPID struct { ID string Host string Port string } // Parse parses the UPID from the input string. func Parse(input string) (*UPID, error) { upid := new(UPID) splits := strings.Split(input, "@") if len(splits) != 2 { return nil, fmt.Errorf("Expect one `@' in the input") } upid.ID = splits[0] if _, err := net.ResolveTCPAddr("tcp4", splits[1]); err != nil { return nil, err } upid.Host, upid.Port, _ = net.SplitHostPort(splits[1]) return upid, nil } // String returns the string representation. func (u *UPID) String() string { if u == nil { return "" } return fmt.Sprintf("%s@%s:%s", u.ID, u.Host, u.Port) } // Equal returns true if two upid is equal func (u *UPID) Equal(upid *UPID) bool { if u == nil { return upid == nil } else { return upid != nil && u.ID == upid.ID && u.Host == upid.Host && u.Port == upid.Port } } mesos-go-0.0.1/upid/upid_test.go000066400000000000000000000022451257601144100165350ustar00rootroot00000000000000package upid import ( "testing" "testing/quick" "github.com/stretchr/testify/assert" ) func TestUPIDParse(t *testing.T) { u, err := Parse("mesos@foo:bar") assert.Nil(t, u) assert.Error(t, err) u, err = Parse("mesoslocalhost5050") assert.Nil(t, u) assert.Error(t, err) u, err = Parse("mesos@localhost") assert.Nil(t, u) assert.Error(t, err) assert.Nil(t, quick.Check(func(s string) bool { u, err := Parse(s) return u == nil && err != nil }, &quick.Config{MaxCount: 100000})) } func TestUPIDString(t *testing.T) { u, err := Parse("mesos@localhost:5050") assert.NotNil(t, u) assert.NoError(t, err) assert.Equal(t, "mesos@localhost:5050", u.String()) } func TestUPIDEqual(t *testing.T) { u1, err := Parse("mesos@localhost:5050") u2, err := Parse("mesos@localhost:5050") u3, err := Parse("mesos1@localhost:5050") u4, err := Parse("mesos@mesos.com:5050") u5, err := Parse("mesos@localhost:5051") assert.NoError(t, err) assert.True(t, u1.Equal(u2)) assert.False(t, u1.Equal(u3)) assert.False(t, u1.Equal(u4)) assert.False(t, u1.Equal(u5)) assert.False(t, u1.Equal(nil)) assert.False(t, (*UPID)(nil).Equal(u5)) assert.True(t, (*UPID)(nil).Equal(nil)) }