go.uber.org/yarpc@v1.72.1/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/atomic/atomic.go (about)

     1  // Code generated by thriftrw v1.29.2. DO NOT EDIT.
     2  // @generated
     3  
     4  package atomic
     5  
     6  import (
     7  	errors "errors"
     8  	fmt "fmt"
     9  	multierr "go.uber.org/multierr"
    10  	stream "go.uber.org/thriftrw/protocol/stream"
    11  	thriftreflect "go.uber.org/thriftrw/thriftreflect"
    12  	wire "go.uber.org/thriftrw/wire"
    13  	common "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/common"
    14  	zapcore "go.uber.org/zap/zapcore"
    15  	strings "strings"
    16  )
    17  
    18  type CompareAndSwap struct {
    19  	Key          string `json:"key,required"`
    20  	CurrentValue int64  `json:"currentValue,required"`
    21  	NewValue     int64  `json:"newValue,required"`
    22  }
    23  
    24  // ToWire translates a CompareAndSwap struct into a Thrift-level intermediate
    25  // representation. This intermediate representation may be serialized
    26  // into bytes using a ThriftRW protocol implementation.
    27  //
    28  // An error is returned if the struct or any of its fields failed to
    29  // validate.
    30  //
    31  //   x, err := v.ToWire()
    32  //   if err != nil {
    33  //     return err
    34  //   }
    35  //
    36  //   if err := binaryProtocol.Encode(x, writer); err != nil {
    37  //     return err
    38  //   }
    39  func (v *CompareAndSwap) ToWire() (wire.Value, error) {
    40  	var (
    41  		fields [3]wire.Field
    42  		i      int = 0
    43  		w      wire.Value
    44  		err    error
    45  	)
    46  
    47  	w, err = wire.NewValueString(v.Key), error(nil)
    48  	if err != nil {
    49  		return w, err
    50  	}
    51  	fields[i] = wire.Field{ID: 1, Value: w}
    52  	i++
    53  
    54  	w, err = wire.NewValueI64(v.CurrentValue), error(nil)
    55  	if err != nil {
    56  		return w, err
    57  	}
    58  	fields[i] = wire.Field{ID: 2, Value: w}
    59  	i++
    60  
    61  	w, err = wire.NewValueI64(v.NewValue), error(nil)
    62  	if err != nil {
    63  		return w, err
    64  	}
    65  	fields[i] = wire.Field{ID: 3, Value: w}
    66  	i++
    67  
    68  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
    69  }
    70  
    71  // FromWire deserializes a CompareAndSwap struct from its Thrift-level
    72  // representation. The Thrift-level representation may be obtained
    73  // from a ThriftRW protocol implementation.
    74  //
    75  // An error is returned if we were unable to build a CompareAndSwap struct
    76  // from the provided intermediate representation.
    77  //
    78  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
    79  //   if err != nil {
    80  //     return nil, err
    81  //   }
    82  //
    83  //   var v CompareAndSwap
    84  //   if err := v.FromWire(x); err != nil {
    85  //     return nil, err
    86  //   }
    87  //   return &v, nil
    88  func (v *CompareAndSwap) FromWire(w wire.Value) error {
    89  	var err error
    90  
    91  	keyIsSet := false
    92  	currentValueIsSet := false
    93  	newValueIsSet := false
    94  
    95  	for _, field := range w.GetStruct().Fields {
    96  		switch field.ID {
    97  		case 1:
    98  			if field.Value.Type() == wire.TBinary {
    99  				v.Key, err = field.Value.GetString(), error(nil)
   100  				if err != nil {
   101  					return err
   102  				}
   103  				keyIsSet = true
   104  			}
   105  		case 2:
   106  			if field.Value.Type() == wire.TI64 {
   107  				v.CurrentValue, err = field.Value.GetI64(), error(nil)
   108  				if err != nil {
   109  					return err
   110  				}
   111  				currentValueIsSet = true
   112  			}
   113  		case 3:
   114  			if field.Value.Type() == wire.TI64 {
   115  				v.NewValue, err = field.Value.GetI64(), error(nil)
   116  				if err != nil {
   117  					return err
   118  				}
   119  				newValueIsSet = true
   120  			}
   121  		}
   122  	}
   123  
   124  	if !keyIsSet {
   125  		return errors.New("field Key of CompareAndSwap is required")
   126  	}
   127  
   128  	if !currentValueIsSet {
   129  		return errors.New("field CurrentValue of CompareAndSwap is required")
   130  	}
   131  
   132  	if !newValueIsSet {
   133  		return errors.New("field NewValue of CompareAndSwap is required")
   134  	}
   135  
   136  	return nil
   137  }
   138  
   139  // Encode serializes a CompareAndSwap struct directly into bytes, without going
   140  // through an intermediary type.
   141  //
   142  // An error is returned if a CompareAndSwap struct could not be encoded.
   143  func (v *CompareAndSwap) Encode(sw stream.Writer) error {
   144  	if err := sw.WriteStructBegin(); err != nil {
   145  		return err
   146  	}
   147  
   148  	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TBinary}); err != nil {
   149  		return err
   150  	}
   151  	if err := sw.WriteString(v.Key); err != nil {
   152  		return err
   153  	}
   154  	if err := sw.WriteFieldEnd(); err != nil {
   155  		return err
   156  	}
   157  
   158  	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TI64}); err != nil {
   159  		return err
   160  	}
   161  	if err := sw.WriteInt64(v.CurrentValue); err != nil {
   162  		return err
   163  	}
   164  	if err := sw.WriteFieldEnd(); err != nil {
   165  		return err
   166  	}
   167  
   168  	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TI64}); err != nil {
   169  		return err
   170  	}
   171  	if err := sw.WriteInt64(v.NewValue); err != nil {
   172  		return err
   173  	}
   174  	if err := sw.WriteFieldEnd(); err != nil {
   175  		return err
   176  	}
   177  
   178  	return sw.WriteStructEnd()
   179  }
   180  
   181  // Decode deserializes a CompareAndSwap struct directly from its Thrift-level
   182  // representation, without going through an intemediary type.
   183  //
   184  // An error is returned if a CompareAndSwap struct could not be generated from the wire
   185  // representation.
   186  func (v *CompareAndSwap) Decode(sr stream.Reader) error {
   187  
   188  	keyIsSet := false
   189  	currentValueIsSet := false
   190  	newValueIsSet := false
   191  
   192  	if err := sr.ReadStructBegin(); err != nil {
   193  		return err
   194  	}
   195  
   196  	fh, ok, err := sr.ReadFieldBegin()
   197  	if err != nil {
   198  		return err
   199  	}
   200  
   201  	for ok {
   202  		switch {
   203  		case fh.ID == 1 && fh.Type == wire.TBinary:
   204  			v.Key, err = sr.ReadString()
   205  			if err != nil {
   206  				return err
   207  			}
   208  			keyIsSet = true
   209  		case fh.ID == 2 && fh.Type == wire.TI64:
   210  			v.CurrentValue, err = sr.ReadInt64()
   211  			if err != nil {
   212  				return err
   213  			}
   214  			currentValueIsSet = true
   215  		case fh.ID == 3 && fh.Type == wire.TI64:
   216  			v.NewValue, err = sr.ReadInt64()
   217  			if err != nil {
   218  				return err
   219  			}
   220  			newValueIsSet = true
   221  		default:
   222  			if err := sr.Skip(fh.Type); err != nil {
   223  				return err
   224  			}
   225  		}
   226  
   227  		if err := sr.ReadFieldEnd(); err != nil {
   228  			return err
   229  		}
   230  
   231  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
   232  			return err
   233  		}
   234  	}
   235  
   236  	if err := sr.ReadStructEnd(); err != nil {
   237  		return err
   238  	}
   239  
   240  	if !keyIsSet {
   241  		return errors.New("field Key of CompareAndSwap is required")
   242  	}
   243  
   244  	if !currentValueIsSet {
   245  		return errors.New("field CurrentValue of CompareAndSwap is required")
   246  	}
   247  
   248  	if !newValueIsSet {
   249  		return errors.New("field NewValue of CompareAndSwap is required")
   250  	}
   251  
   252  	return nil
   253  }
   254  
   255  // String returns a readable string representation of a CompareAndSwap
   256  // struct.
   257  func (v *CompareAndSwap) String() string {
   258  	if v == nil {
   259  		return "<nil>"
   260  	}
   261  
   262  	var fields [3]string
   263  	i := 0
   264  	fields[i] = fmt.Sprintf("Key: %v", v.Key)
   265  	i++
   266  	fields[i] = fmt.Sprintf("CurrentValue: %v", v.CurrentValue)
   267  	i++
   268  	fields[i] = fmt.Sprintf("NewValue: %v", v.NewValue)
   269  	i++
   270  
   271  	return fmt.Sprintf("CompareAndSwap{%v}", strings.Join(fields[:i], ", "))
   272  }
   273  
   274  // Equals returns true if all the fields of this CompareAndSwap match the
   275  // provided CompareAndSwap.
   276  //
   277  // This function performs a deep comparison.
   278  func (v *CompareAndSwap) Equals(rhs *CompareAndSwap) bool {
   279  	if v == nil {
   280  		return rhs == nil
   281  	} else if rhs == nil {
   282  		return false
   283  	}
   284  	if !(v.Key == rhs.Key) {
   285  		return false
   286  	}
   287  	if !(v.CurrentValue == rhs.CurrentValue) {
   288  		return false
   289  	}
   290  	if !(v.NewValue == rhs.NewValue) {
   291  		return false
   292  	}
   293  
   294  	return true
   295  }
   296  
   297  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
   298  // fast logging of CompareAndSwap.
   299  func (v *CompareAndSwap) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
   300  	if v == nil {
   301  		return nil
   302  	}
   303  	enc.AddString("key", v.Key)
   304  	enc.AddInt64("currentValue", v.CurrentValue)
   305  	enc.AddInt64("newValue", v.NewValue)
   306  	return err
   307  }
   308  
   309  // GetKey returns the value of Key if it is set or its
   310  // zero value if it is unset.
   311  func (v *CompareAndSwap) GetKey() (o string) {
   312  	if v != nil {
   313  		o = v.Key
   314  	}
   315  	return
   316  }
   317  
   318  // GetCurrentValue returns the value of CurrentValue if it is set or its
   319  // zero value if it is unset.
   320  func (v *CompareAndSwap) GetCurrentValue() (o int64) {
   321  	if v != nil {
   322  		o = v.CurrentValue
   323  	}
   324  	return
   325  }
   326  
   327  // GetNewValue returns the value of NewValue if it is set or its
   328  // zero value if it is unset.
   329  func (v *CompareAndSwap) GetNewValue() (o int64) {
   330  	if v != nil {
   331  		o = v.NewValue
   332  	}
   333  	return
   334  }
   335  
   336  type IntegerMismatchError struct {
   337  	ExpectedValue int64 `json:"expectedValue,required"`
   338  	GotValue      int64 `json:"gotValue,required"`
   339  }
   340  
   341  // ToWire translates a IntegerMismatchError struct into a Thrift-level intermediate
   342  // representation. This intermediate representation may be serialized
   343  // into bytes using a ThriftRW protocol implementation.
   344  //
   345  // An error is returned if the struct or any of its fields failed to
   346  // validate.
   347  //
   348  //   x, err := v.ToWire()
   349  //   if err != nil {
   350  //     return err
   351  //   }
   352  //
   353  //   if err := binaryProtocol.Encode(x, writer); err != nil {
   354  //     return err
   355  //   }
   356  func (v *IntegerMismatchError) ToWire() (wire.Value, error) {
   357  	var (
   358  		fields [2]wire.Field
   359  		i      int = 0
   360  		w      wire.Value
   361  		err    error
   362  	)
   363  
   364  	w, err = wire.NewValueI64(v.ExpectedValue), error(nil)
   365  	if err != nil {
   366  		return w, err
   367  	}
   368  	fields[i] = wire.Field{ID: 1, Value: w}
   369  	i++
   370  
   371  	w, err = wire.NewValueI64(v.GotValue), error(nil)
   372  	if err != nil {
   373  		return w, err
   374  	}
   375  	fields[i] = wire.Field{ID: 2, Value: w}
   376  	i++
   377  
   378  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
   379  }
   380  
   381  // FromWire deserializes a IntegerMismatchError struct from its Thrift-level
   382  // representation. The Thrift-level representation may be obtained
   383  // from a ThriftRW protocol implementation.
   384  //
   385  // An error is returned if we were unable to build a IntegerMismatchError struct
   386  // from the provided intermediate representation.
   387  //
   388  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
   389  //   if err != nil {
   390  //     return nil, err
   391  //   }
   392  //
   393  //   var v IntegerMismatchError
   394  //   if err := v.FromWire(x); err != nil {
   395  //     return nil, err
   396  //   }
   397  //   return &v, nil
   398  func (v *IntegerMismatchError) FromWire(w wire.Value) error {
   399  	var err error
   400  
   401  	expectedValueIsSet := false
   402  	gotValueIsSet := false
   403  
   404  	for _, field := range w.GetStruct().Fields {
   405  		switch field.ID {
   406  		case 1:
   407  			if field.Value.Type() == wire.TI64 {
   408  				v.ExpectedValue, err = field.Value.GetI64(), error(nil)
   409  				if err != nil {
   410  					return err
   411  				}
   412  				expectedValueIsSet = true
   413  			}
   414  		case 2:
   415  			if field.Value.Type() == wire.TI64 {
   416  				v.GotValue, err = field.Value.GetI64(), error(nil)
   417  				if err != nil {
   418  					return err
   419  				}
   420  				gotValueIsSet = true
   421  			}
   422  		}
   423  	}
   424  
   425  	if !expectedValueIsSet {
   426  		return errors.New("field ExpectedValue of IntegerMismatchError is required")
   427  	}
   428  
   429  	if !gotValueIsSet {
   430  		return errors.New("field GotValue of IntegerMismatchError is required")
   431  	}
   432  
   433  	return nil
   434  }
   435  
   436  // Encode serializes a IntegerMismatchError struct directly into bytes, without going
   437  // through an intermediary type.
   438  //
   439  // An error is returned if a IntegerMismatchError struct could not be encoded.
   440  func (v *IntegerMismatchError) Encode(sw stream.Writer) error {
   441  	if err := sw.WriteStructBegin(); err != nil {
   442  		return err
   443  	}
   444  
   445  	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TI64}); err != nil {
   446  		return err
   447  	}
   448  	if err := sw.WriteInt64(v.ExpectedValue); err != nil {
   449  		return err
   450  	}
   451  	if err := sw.WriteFieldEnd(); err != nil {
   452  		return err
   453  	}
   454  
   455  	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TI64}); err != nil {
   456  		return err
   457  	}
   458  	if err := sw.WriteInt64(v.GotValue); err != nil {
   459  		return err
   460  	}
   461  	if err := sw.WriteFieldEnd(); err != nil {
   462  		return err
   463  	}
   464  
   465  	return sw.WriteStructEnd()
   466  }
   467  
   468  // Decode deserializes a IntegerMismatchError struct directly from its Thrift-level
   469  // representation, without going through an intemediary type.
   470  //
   471  // An error is returned if a IntegerMismatchError struct could not be generated from the wire
   472  // representation.
   473  func (v *IntegerMismatchError) Decode(sr stream.Reader) error {
   474  
   475  	expectedValueIsSet := false
   476  	gotValueIsSet := false
   477  
   478  	if err := sr.ReadStructBegin(); err != nil {
   479  		return err
   480  	}
   481  
   482  	fh, ok, err := sr.ReadFieldBegin()
   483  	if err != nil {
   484  		return err
   485  	}
   486  
   487  	for ok {
   488  		switch {
   489  		case fh.ID == 1 && fh.Type == wire.TI64:
   490  			v.ExpectedValue, err = sr.ReadInt64()
   491  			if err != nil {
   492  				return err
   493  			}
   494  			expectedValueIsSet = true
   495  		case fh.ID == 2 && fh.Type == wire.TI64:
   496  			v.GotValue, err = sr.ReadInt64()
   497  			if err != nil {
   498  				return err
   499  			}
   500  			gotValueIsSet = true
   501  		default:
   502  			if err := sr.Skip(fh.Type); err != nil {
   503  				return err
   504  			}
   505  		}
   506  
   507  		if err := sr.ReadFieldEnd(); err != nil {
   508  			return err
   509  		}
   510  
   511  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
   512  			return err
   513  		}
   514  	}
   515  
   516  	if err := sr.ReadStructEnd(); err != nil {
   517  		return err
   518  	}
   519  
   520  	if !expectedValueIsSet {
   521  		return errors.New("field ExpectedValue of IntegerMismatchError is required")
   522  	}
   523  
   524  	if !gotValueIsSet {
   525  		return errors.New("field GotValue of IntegerMismatchError is required")
   526  	}
   527  
   528  	return nil
   529  }
   530  
   531  // String returns a readable string representation of a IntegerMismatchError
   532  // struct.
   533  func (v *IntegerMismatchError) String() string {
   534  	if v == nil {
   535  		return "<nil>"
   536  	}
   537  
   538  	var fields [2]string
   539  	i := 0
   540  	fields[i] = fmt.Sprintf("ExpectedValue: %v", v.ExpectedValue)
   541  	i++
   542  	fields[i] = fmt.Sprintf("GotValue: %v", v.GotValue)
   543  	i++
   544  
   545  	return fmt.Sprintf("IntegerMismatchError{%v}", strings.Join(fields[:i], ", "))
   546  }
   547  
   548  // ErrorName is the name of this type as defined in the Thrift
   549  // file.
   550  func (*IntegerMismatchError) ErrorName() string {
   551  	return "IntegerMismatchError"
   552  }
   553  
   554  // Equals returns true if all the fields of this IntegerMismatchError match the
   555  // provided IntegerMismatchError.
   556  //
   557  // This function performs a deep comparison.
   558  func (v *IntegerMismatchError) Equals(rhs *IntegerMismatchError) bool {
   559  	if v == nil {
   560  		return rhs == nil
   561  	} else if rhs == nil {
   562  		return false
   563  	}
   564  	if !(v.ExpectedValue == rhs.ExpectedValue) {
   565  		return false
   566  	}
   567  	if !(v.GotValue == rhs.GotValue) {
   568  		return false
   569  	}
   570  
   571  	return true
   572  }
   573  
   574  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
   575  // fast logging of IntegerMismatchError.
   576  func (v *IntegerMismatchError) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
   577  	if v == nil {
   578  		return nil
   579  	}
   580  	enc.AddInt64("expectedValue", v.ExpectedValue)
   581  	enc.AddInt64("gotValue", v.GotValue)
   582  	return err
   583  }
   584  
   585  // GetExpectedValue returns the value of ExpectedValue if it is set or its
   586  // zero value if it is unset.
   587  func (v *IntegerMismatchError) GetExpectedValue() (o int64) {
   588  	if v != nil {
   589  		o = v.ExpectedValue
   590  	}
   591  	return
   592  }
   593  
   594  // GetGotValue returns the value of GotValue if it is set or its
   595  // zero value if it is unset.
   596  func (v *IntegerMismatchError) GetGotValue() (o int64) {
   597  	if v != nil {
   598  		o = v.GotValue
   599  	}
   600  	return
   601  }
   602  
   603  func (v *IntegerMismatchError) Error() string {
   604  	return v.String()
   605  }
   606  
   607  type KeyDoesNotExist struct {
   608  	Key *string `json:"key,omitempty"`
   609  }
   610  
   611  // ToWire translates a KeyDoesNotExist struct into a Thrift-level intermediate
   612  // representation. This intermediate representation may be serialized
   613  // into bytes using a ThriftRW protocol implementation.
   614  //
   615  // An error is returned if the struct or any of its fields failed to
   616  // validate.
   617  //
   618  //   x, err := v.ToWire()
   619  //   if err != nil {
   620  //     return err
   621  //   }
   622  //
   623  //   if err := binaryProtocol.Encode(x, writer); err != nil {
   624  //     return err
   625  //   }
   626  func (v *KeyDoesNotExist) ToWire() (wire.Value, error) {
   627  	var (
   628  		fields [1]wire.Field
   629  		i      int = 0
   630  		w      wire.Value
   631  		err    error
   632  	)
   633  
   634  	if v.Key != nil {
   635  		w, err = wire.NewValueString(*(v.Key)), error(nil)
   636  		if err != nil {
   637  			return w, err
   638  		}
   639  		fields[i] = wire.Field{ID: 1, Value: w}
   640  		i++
   641  	}
   642  
   643  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
   644  }
   645  
   646  // FromWire deserializes a KeyDoesNotExist struct from its Thrift-level
   647  // representation. The Thrift-level representation may be obtained
   648  // from a ThriftRW protocol implementation.
   649  //
   650  // An error is returned if we were unable to build a KeyDoesNotExist struct
   651  // from the provided intermediate representation.
   652  //
   653  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
   654  //   if err != nil {
   655  //     return nil, err
   656  //   }
   657  //
   658  //   var v KeyDoesNotExist
   659  //   if err := v.FromWire(x); err != nil {
   660  //     return nil, err
   661  //   }
   662  //   return &v, nil
   663  func (v *KeyDoesNotExist) FromWire(w wire.Value) error {
   664  	var err error
   665  
   666  	for _, field := range w.GetStruct().Fields {
   667  		switch field.ID {
   668  		case 1:
   669  			if field.Value.Type() == wire.TBinary {
   670  				var x string
   671  				x, err = field.Value.GetString(), error(nil)
   672  				v.Key = &x
   673  				if err != nil {
   674  					return err
   675  				}
   676  
   677  			}
   678  		}
   679  	}
   680  
   681  	return nil
   682  }
   683  
   684  // Encode serializes a KeyDoesNotExist struct directly into bytes, without going
   685  // through an intermediary type.
   686  //
   687  // An error is returned if a KeyDoesNotExist struct could not be encoded.
   688  func (v *KeyDoesNotExist) Encode(sw stream.Writer) error {
   689  	if err := sw.WriteStructBegin(); err != nil {
   690  		return err
   691  	}
   692  
   693  	if v.Key != nil {
   694  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TBinary}); err != nil {
   695  			return err
   696  		}
   697  		if err := sw.WriteString(*(v.Key)); err != nil {
   698  			return err
   699  		}
   700  		if err := sw.WriteFieldEnd(); err != nil {
   701  			return err
   702  		}
   703  	}
   704  
   705  	return sw.WriteStructEnd()
   706  }
   707  
   708  // Decode deserializes a KeyDoesNotExist struct directly from its Thrift-level
   709  // representation, without going through an intemediary type.
   710  //
   711  // An error is returned if a KeyDoesNotExist struct could not be generated from the wire
   712  // representation.
   713  func (v *KeyDoesNotExist) Decode(sr stream.Reader) error {
   714  
   715  	if err := sr.ReadStructBegin(); err != nil {
   716  		return err
   717  	}
   718  
   719  	fh, ok, err := sr.ReadFieldBegin()
   720  	if err != nil {
   721  		return err
   722  	}
   723  
   724  	for ok {
   725  		switch {
   726  		case fh.ID == 1 && fh.Type == wire.TBinary:
   727  			var x string
   728  			x, err = sr.ReadString()
   729  			v.Key = &x
   730  			if err != nil {
   731  				return err
   732  			}
   733  
   734  		default:
   735  			if err := sr.Skip(fh.Type); err != nil {
   736  				return err
   737  			}
   738  		}
   739  
   740  		if err := sr.ReadFieldEnd(); err != nil {
   741  			return err
   742  		}
   743  
   744  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
   745  			return err
   746  		}
   747  	}
   748  
   749  	if err := sr.ReadStructEnd(); err != nil {
   750  		return err
   751  	}
   752  
   753  	return nil
   754  }
   755  
   756  // String returns a readable string representation of a KeyDoesNotExist
   757  // struct.
   758  func (v *KeyDoesNotExist) String() string {
   759  	if v == nil {
   760  		return "<nil>"
   761  	}
   762  
   763  	var fields [1]string
   764  	i := 0
   765  	if v.Key != nil {
   766  		fields[i] = fmt.Sprintf("Key: %v", *(v.Key))
   767  		i++
   768  	}
   769  
   770  	return fmt.Sprintf("KeyDoesNotExist{%v}", strings.Join(fields[:i], ", "))
   771  }
   772  
   773  // ErrorName is the name of this type as defined in the Thrift
   774  // file.
   775  func (*KeyDoesNotExist) ErrorName() string {
   776  	return "KeyDoesNotExist"
   777  }
   778  
   779  func _String_EqualsPtr(lhs, rhs *string) bool {
   780  	if lhs != nil && rhs != nil {
   781  
   782  		x := *lhs
   783  		y := *rhs
   784  		return (x == y)
   785  	}
   786  	return lhs == nil && rhs == nil
   787  }
   788  
   789  // Equals returns true if all the fields of this KeyDoesNotExist match the
   790  // provided KeyDoesNotExist.
   791  //
   792  // This function performs a deep comparison.
   793  func (v *KeyDoesNotExist) Equals(rhs *KeyDoesNotExist) bool {
   794  	if v == nil {
   795  		return rhs == nil
   796  	} else if rhs == nil {
   797  		return false
   798  	}
   799  	if !_String_EqualsPtr(v.Key, rhs.Key) {
   800  		return false
   801  	}
   802  
   803  	return true
   804  }
   805  
   806  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
   807  // fast logging of KeyDoesNotExist.
   808  func (v *KeyDoesNotExist) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
   809  	if v == nil {
   810  		return nil
   811  	}
   812  	if v.Key != nil {
   813  		enc.AddString("key", *v.Key)
   814  	}
   815  	return err
   816  }
   817  
   818  // GetKey returns the value of Key if it is set or its
   819  // zero value if it is unset.
   820  func (v *KeyDoesNotExist) GetKey() (o string) {
   821  	if v != nil && v.Key != nil {
   822  		return *v.Key
   823  	}
   824  
   825  	return
   826  }
   827  
   828  // IsSetKey returns true if Key is not nil.
   829  func (v *KeyDoesNotExist) IsSetKey() bool {
   830  	return v != nil && v.Key != nil
   831  }
   832  
   833  func (v *KeyDoesNotExist) Error() string {
   834  	return v.String()
   835  }
   836  
   837  type OptionalCompareAndSwap struct {
   838  	Key          *string `json:"key,omitempty"`
   839  	CurrentValue *int64  `json:"currentValue,omitempty"`
   840  	NewValue     *int64  `json:"newValue,omitempty"`
   841  }
   842  
   843  // ToWire translates a OptionalCompareAndSwap struct into a Thrift-level intermediate
   844  // representation. This intermediate representation may be serialized
   845  // into bytes using a ThriftRW protocol implementation.
   846  //
   847  // An error is returned if the struct or any of its fields failed to
   848  // validate.
   849  //
   850  //   x, err := v.ToWire()
   851  //   if err != nil {
   852  //     return err
   853  //   }
   854  //
   855  //   if err := binaryProtocol.Encode(x, writer); err != nil {
   856  //     return err
   857  //   }
   858  func (v *OptionalCompareAndSwap) ToWire() (wire.Value, error) {
   859  	var (
   860  		fields [3]wire.Field
   861  		i      int = 0
   862  		w      wire.Value
   863  		err    error
   864  	)
   865  
   866  	if v.Key != nil {
   867  		w, err = wire.NewValueString(*(v.Key)), error(nil)
   868  		if err != nil {
   869  			return w, err
   870  		}
   871  		fields[i] = wire.Field{ID: 1, Value: w}
   872  		i++
   873  	}
   874  	if v.CurrentValue != nil {
   875  		w, err = wire.NewValueI64(*(v.CurrentValue)), error(nil)
   876  		if err != nil {
   877  			return w, err
   878  		}
   879  		fields[i] = wire.Field{ID: 2, Value: w}
   880  		i++
   881  	}
   882  	if v.NewValue != nil {
   883  		w, err = wire.NewValueI64(*(v.NewValue)), error(nil)
   884  		if err != nil {
   885  			return w, err
   886  		}
   887  		fields[i] = wire.Field{ID: 3, Value: w}
   888  		i++
   889  	}
   890  
   891  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
   892  }
   893  
   894  // FromWire deserializes a OptionalCompareAndSwap struct from its Thrift-level
   895  // representation. The Thrift-level representation may be obtained
   896  // from a ThriftRW protocol implementation.
   897  //
   898  // An error is returned if we were unable to build a OptionalCompareAndSwap struct
   899  // from the provided intermediate representation.
   900  //
   901  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
   902  //   if err != nil {
   903  //     return nil, err
   904  //   }
   905  //
   906  //   var v OptionalCompareAndSwap
   907  //   if err := v.FromWire(x); err != nil {
   908  //     return nil, err
   909  //   }
   910  //   return &v, nil
   911  func (v *OptionalCompareAndSwap) FromWire(w wire.Value) error {
   912  	var err error
   913  
   914  	for _, field := range w.GetStruct().Fields {
   915  		switch field.ID {
   916  		case 1:
   917  			if field.Value.Type() == wire.TBinary {
   918  				var x string
   919  				x, err = field.Value.GetString(), error(nil)
   920  				v.Key = &x
   921  				if err != nil {
   922  					return err
   923  				}
   924  
   925  			}
   926  		case 2:
   927  			if field.Value.Type() == wire.TI64 {
   928  				var x int64
   929  				x, err = field.Value.GetI64(), error(nil)
   930  				v.CurrentValue = &x
   931  				if err != nil {
   932  					return err
   933  				}
   934  
   935  			}
   936  		case 3:
   937  			if field.Value.Type() == wire.TI64 {
   938  				var x int64
   939  				x, err = field.Value.GetI64(), error(nil)
   940  				v.NewValue = &x
   941  				if err != nil {
   942  					return err
   943  				}
   944  
   945  			}
   946  		}
   947  	}
   948  
   949  	return nil
   950  }
   951  
   952  // Encode serializes a OptionalCompareAndSwap struct directly into bytes, without going
   953  // through an intermediary type.
   954  //
   955  // An error is returned if a OptionalCompareAndSwap struct could not be encoded.
   956  func (v *OptionalCompareAndSwap) Encode(sw stream.Writer) error {
   957  	if err := sw.WriteStructBegin(); err != nil {
   958  		return err
   959  	}
   960  
   961  	if v.Key != nil {
   962  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TBinary}); err != nil {
   963  			return err
   964  		}
   965  		if err := sw.WriteString(*(v.Key)); err != nil {
   966  			return err
   967  		}
   968  		if err := sw.WriteFieldEnd(); err != nil {
   969  			return err
   970  		}
   971  	}
   972  
   973  	if v.CurrentValue != nil {
   974  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TI64}); err != nil {
   975  			return err
   976  		}
   977  		if err := sw.WriteInt64(*(v.CurrentValue)); err != nil {
   978  			return err
   979  		}
   980  		if err := sw.WriteFieldEnd(); err != nil {
   981  			return err
   982  		}
   983  	}
   984  
   985  	if v.NewValue != nil {
   986  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TI64}); err != nil {
   987  			return err
   988  		}
   989  		if err := sw.WriteInt64(*(v.NewValue)); err != nil {
   990  			return err
   991  		}
   992  		if err := sw.WriteFieldEnd(); err != nil {
   993  			return err
   994  		}
   995  	}
   996  
   997  	return sw.WriteStructEnd()
   998  }
   999  
  1000  // Decode deserializes a OptionalCompareAndSwap struct directly from its Thrift-level
  1001  // representation, without going through an intemediary type.
  1002  //
  1003  // An error is returned if a OptionalCompareAndSwap struct could not be generated from the wire
  1004  // representation.
  1005  func (v *OptionalCompareAndSwap) Decode(sr stream.Reader) error {
  1006  
  1007  	if err := sr.ReadStructBegin(); err != nil {
  1008  		return err
  1009  	}
  1010  
  1011  	fh, ok, err := sr.ReadFieldBegin()
  1012  	if err != nil {
  1013  		return err
  1014  	}
  1015  
  1016  	for ok {
  1017  		switch {
  1018  		case fh.ID == 1 && fh.Type == wire.TBinary:
  1019  			var x string
  1020  			x, err = sr.ReadString()
  1021  			v.Key = &x
  1022  			if err != nil {
  1023  				return err
  1024  			}
  1025  
  1026  		case fh.ID == 2 && fh.Type == wire.TI64:
  1027  			var x int64
  1028  			x, err = sr.ReadInt64()
  1029  			v.CurrentValue = &x
  1030  			if err != nil {
  1031  				return err
  1032  			}
  1033  
  1034  		case fh.ID == 3 && fh.Type == wire.TI64:
  1035  			var x int64
  1036  			x, err = sr.ReadInt64()
  1037  			v.NewValue = &x
  1038  			if err != nil {
  1039  				return err
  1040  			}
  1041  
  1042  		default:
  1043  			if err := sr.Skip(fh.Type); err != nil {
  1044  				return err
  1045  			}
  1046  		}
  1047  
  1048  		if err := sr.ReadFieldEnd(); err != nil {
  1049  			return err
  1050  		}
  1051  
  1052  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
  1053  			return err
  1054  		}
  1055  	}
  1056  
  1057  	if err := sr.ReadStructEnd(); err != nil {
  1058  		return err
  1059  	}
  1060  
  1061  	return nil
  1062  }
  1063  
  1064  // String returns a readable string representation of a OptionalCompareAndSwap
  1065  // struct.
  1066  func (v *OptionalCompareAndSwap) String() string {
  1067  	if v == nil {
  1068  		return "<nil>"
  1069  	}
  1070  
  1071  	var fields [3]string
  1072  	i := 0
  1073  	if v.Key != nil {
  1074  		fields[i] = fmt.Sprintf("Key: %v", *(v.Key))
  1075  		i++
  1076  	}
  1077  	if v.CurrentValue != nil {
  1078  		fields[i] = fmt.Sprintf("CurrentValue: %v", *(v.CurrentValue))
  1079  		i++
  1080  	}
  1081  	if v.NewValue != nil {
  1082  		fields[i] = fmt.Sprintf("NewValue: %v", *(v.NewValue))
  1083  		i++
  1084  	}
  1085  
  1086  	return fmt.Sprintf("OptionalCompareAndSwap{%v}", strings.Join(fields[:i], ", "))
  1087  }
  1088  
  1089  func _I64_EqualsPtr(lhs, rhs *int64) bool {
  1090  	if lhs != nil && rhs != nil {
  1091  
  1092  		x := *lhs
  1093  		y := *rhs
  1094  		return (x == y)
  1095  	}
  1096  	return lhs == nil && rhs == nil
  1097  }
  1098  
  1099  // Equals returns true if all the fields of this OptionalCompareAndSwap match the
  1100  // provided OptionalCompareAndSwap.
  1101  //
  1102  // This function performs a deep comparison.
  1103  func (v *OptionalCompareAndSwap) Equals(rhs *OptionalCompareAndSwap) bool {
  1104  	if v == nil {
  1105  		return rhs == nil
  1106  	} else if rhs == nil {
  1107  		return false
  1108  	}
  1109  	if !_String_EqualsPtr(v.Key, rhs.Key) {
  1110  		return false
  1111  	}
  1112  	if !_I64_EqualsPtr(v.CurrentValue, rhs.CurrentValue) {
  1113  		return false
  1114  	}
  1115  	if !_I64_EqualsPtr(v.NewValue, rhs.NewValue) {
  1116  		return false
  1117  	}
  1118  
  1119  	return true
  1120  }
  1121  
  1122  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
  1123  // fast logging of OptionalCompareAndSwap.
  1124  func (v *OptionalCompareAndSwap) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
  1125  	if v == nil {
  1126  		return nil
  1127  	}
  1128  	if v.Key != nil {
  1129  		enc.AddString("key", *v.Key)
  1130  	}
  1131  	if v.CurrentValue != nil {
  1132  		enc.AddInt64("currentValue", *v.CurrentValue)
  1133  	}
  1134  	if v.NewValue != nil {
  1135  		enc.AddInt64("newValue", *v.NewValue)
  1136  	}
  1137  	return err
  1138  }
  1139  
  1140  // GetKey returns the value of Key if it is set or its
  1141  // zero value if it is unset.
  1142  func (v *OptionalCompareAndSwap) GetKey() (o string) {
  1143  	if v != nil && v.Key != nil {
  1144  		return *v.Key
  1145  	}
  1146  
  1147  	return
  1148  }
  1149  
  1150  // IsSetKey returns true if Key is not nil.
  1151  func (v *OptionalCompareAndSwap) IsSetKey() bool {
  1152  	return v != nil && v.Key != nil
  1153  }
  1154  
  1155  // GetCurrentValue returns the value of CurrentValue if it is set or its
  1156  // zero value if it is unset.
  1157  func (v *OptionalCompareAndSwap) GetCurrentValue() (o int64) {
  1158  	if v != nil && v.CurrentValue != nil {
  1159  		return *v.CurrentValue
  1160  	}
  1161  
  1162  	return
  1163  }
  1164  
  1165  // IsSetCurrentValue returns true if CurrentValue is not nil.
  1166  func (v *OptionalCompareAndSwap) IsSetCurrentValue() bool {
  1167  	return v != nil && v.CurrentValue != nil
  1168  }
  1169  
  1170  // GetNewValue returns the value of NewValue if it is set or its
  1171  // zero value if it is unset.
  1172  func (v *OptionalCompareAndSwap) GetNewValue() (o int64) {
  1173  	if v != nil && v.NewValue != nil {
  1174  		return *v.NewValue
  1175  	}
  1176  
  1177  	return
  1178  }
  1179  
  1180  // IsSetNewValue returns true if NewValue is not nil.
  1181  func (v *OptionalCompareAndSwap) IsSetNewValue() bool {
  1182  	return v != nil && v.NewValue != nil
  1183  }
  1184  
  1185  type OptionalCompareAndSwapWrapper struct {
  1186  	Cas *OptionalCompareAndSwap `json:"cas,omitempty"`
  1187  }
  1188  
  1189  // ToWire translates a OptionalCompareAndSwapWrapper struct into a Thrift-level intermediate
  1190  // representation. This intermediate representation may be serialized
  1191  // into bytes using a ThriftRW protocol implementation.
  1192  //
  1193  // An error is returned if the struct or any of its fields failed to
  1194  // validate.
  1195  //
  1196  //   x, err := v.ToWire()
  1197  //   if err != nil {
  1198  //     return err
  1199  //   }
  1200  //
  1201  //   if err := binaryProtocol.Encode(x, writer); err != nil {
  1202  //     return err
  1203  //   }
  1204  func (v *OptionalCompareAndSwapWrapper) ToWire() (wire.Value, error) {
  1205  	var (
  1206  		fields [1]wire.Field
  1207  		i      int = 0
  1208  		w      wire.Value
  1209  		err    error
  1210  	)
  1211  
  1212  	if v.Cas != nil {
  1213  		w, err = v.Cas.ToWire()
  1214  		if err != nil {
  1215  			return w, err
  1216  		}
  1217  		fields[i] = wire.Field{ID: 1, Value: w}
  1218  		i++
  1219  	}
  1220  
  1221  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
  1222  }
  1223  
  1224  func _OptionalCompareAndSwap_Read(w wire.Value) (*OptionalCompareAndSwap, error) {
  1225  	var v OptionalCompareAndSwap
  1226  	err := v.FromWire(w)
  1227  	return &v, err
  1228  }
  1229  
  1230  // FromWire deserializes a OptionalCompareAndSwapWrapper struct from its Thrift-level
  1231  // representation. The Thrift-level representation may be obtained
  1232  // from a ThriftRW protocol implementation.
  1233  //
  1234  // An error is returned if we were unable to build a OptionalCompareAndSwapWrapper struct
  1235  // from the provided intermediate representation.
  1236  //
  1237  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
  1238  //   if err != nil {
  1239  //     return nil, err
  1240  //   }
  1241  //
  1242  //   var v OptionalCompareAndSwapWrapper
  1243  //   if err := v.FromWire(x); err != nil {
  1244  //     return nil, err
  1245  //   }
  1246  //   return &v, nil
  1247  func (v *OptionalCompareAndSwapWrapper) FromWire(w wire.Value) error {
  1248  	var err error
  1249  
  1250  	for _, field := range w.GetStruct().Fields {
  1251  		switch field.ID {
  1252  		case 1:
  1253  			if field.Value.Type() == wire.TStruct {
  1254  				v.Cas, err = _OptionalCompareAndSwap_Read(field.Value)
  1255  				if err != nil {
  1256  					return err
  1257  				}
  1258  
  1259  			}
  1260  		}
  1261  	}
  1262  
  1263  	return nil
  1264  }
  1265  
  1266  // Encode serializes a OptionalCompareAndSwapWrapper struct directly into bytes, without going
  1267  // through an intermediary type.
  1268  //
  1269  // An error is returned if a OptionalCompareAndSwapWrapper struct could not be encoded.
  1270  func (v *OptionalCompareAndSwapWrapper) Encode(sw stream.Writer) error {
  1271  	if err := sw.WriteStructBegin(); err != nil {
  1272  		return err
  1273  	}
  1274  
  1275  	if v.Cas != nil {
  1276  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
  1277  			return err
  1278  		}
  1279  		if err := v.Cas.Encode(sw); err != nil {
  1280  			return err
  1281  		}
  1282  		if err := sw.WriteFieldEnd(); err != nil {
  1283  			return err
  1284  		}
  1285  	}
  1286  
  1287  	return sw.WriteStructEnd()
  1288  }
  1289  
  1290  func _OptionalCompareAndSwap_Decode(sr stream.Reader) (*OptionalCompareAndSwap, error) {
  1291  	var v OptionalCompareAndSwap
  1292  	err := v.Decode(sr)
  1293  	return &v, err
  1294  }
  1295  
  1296  // Decode deserializes a OptionalCompareAndSwapWrapper struct directly from its Thrift-level
  1297  // representation, without going through an intemediary type.
  1298  //
  1299  // An error is returned if a OptionalCompareAndSwapWrapper struct could not be generated from the wire
  1300  // representation.
  1301  func (v *OptionalCompareAndSwapWrapper) Decode(sr stream.Reader) error {
  1302  
  1303  	if err := sr.ReadStructBegin(); err != nil {
  1304  		return err
  1305  	}
  1306  
  1307  	fh, ok, err := sr.ReadFieldBegin()
  1308  	if err != nil {
  1309  		return err
  1310  	}
  1311  
  1312  	for ok {
  1313  		switch {
  1314  		case fh.ID == 1 && fh.Type == wire.TStruct:
  1315  			v.Cas, err = _OptionalCompareAndSwap_Decode(sr)
  1316  			if err != nil {
  1317  				return err
  1318  			}
  1319  
  1320  		default:
  1321  			if err := sr.Skip(fh.Type); err != nil {
  1322  				return err
  1323  			}
  1324  		}
  1325  
  1326  		if err := sr.ReadFieldEnd(); err != nil {
  1327  			return err
  1328  		}
  1329  
  1330  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
  1331  			return err
  1332  		}
  1333  	}
  1334  
  1335  	if err := sr.ReadStructEnd(); err != nil {
  1336  		return err
  1337  	}
  1338  
  1339  	return nil
  1340  }
  1341  
  1342  // String returns a readable string representation of a OptionalCompareAndSwapWrapper
  1343  // struct.
  1344  func (v *OptionalCompareAndSwapWrapper) String() string {
  1345  	if v == nil {
  1346  		return "<nil>"
  1347  	}
  1348  
  1349  	var fields [1]string
  1350  	i := 0
  1351  	if v.Cas != nil {
  1352  		fields[i] = fmt.Sprintf("Cas: %v", v.Cas)
  1353  		i++
  1354  	}
  1355  
  1356  	return fmt.Sprintf("OptionalCompareAndSwapWrapper{%v}", strings.Join(fields[:i], ", "))
  1357  }
  1358  
  1359  // Equals returns true if all the fields of this OptionalCompareAndSwapWrapper match the
  1360  // provided OptionalCompareAndSwapWrapper.
  1361  //
  1362  // This function performs a deep comparison.
  1363  func (v *OptionalCompareAndSwapWrapper) Equals(rhs *OptionalCompareAndSwapWrapper) bool {
  1364  	if v == nil {
  1365  		return rhs == nil
  1366  	} else if rhs == nil {
  1367  		return false
  1368  	}
  1369  	if !((v.Cas == nil && rhs.Cas == nil) || (v.Cas != nil && rhs.Cas != nil && v.Cas.Equals(rhs.Cas))) {
  1370  		return false
  1371  	}
  1372  
  1373  	return true
  1374  }
  1375  
  1376  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
  1377  // fast logging of OptionalCompareAndSwapWrapper.
  1378  func (v *OptionalCompareAndSwapWrapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
  1379  	if v == nil {
  1380  		return nil
  1381  	}
  1382  	if v.Cas != nil {
  1383  		err = multierr.Append(err, enc.AddObject("cas", v.Cas))
  1384  	}
  1385  	return err
  1386  }
  1387  
  1388  // GetCas returns the value of Cas if it is set or its
  1389  // zero value if it is unset.
  1390  func (v *OptionalCompareAndSwapWrapper) GetCas() (o *OptionalCompareAndSwap) {
  1391  	if v != nil && v.Cas != nil {
  1392  		return v.Cas
  1393  	}
  1394  
  1395  	return
  1396  }
  1397  
  1398  // IsSetCas returns true if Cas is not nil.
  1399  func (v *OptionalCompareAndSwapWrapper) IsSetCas() bool {
  1400  	return v != nil && v.Cas != nil
  1401  }
  1402  
  1403  // ThriftModule represents the IDL file used to generate this package.
  1404  var ThriftModule = &thriftreflect.ThriftModule{
  1405  	Name:     "atomic",
  1406  	Package:  "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/atomic",
  1407  	FilePath: "atomic.thrift",
  1408  	SHA1:     "86799ad54683404a517c661f6f10d83cf7afa99e",
  1409  	Includes: []*thriftreflect.ThriftModule{
  1410  		common.ThriftModule,
  1411  	},
  1412  	Raw: rawIDL,
  1413  }
  1414  
  1415  const rawIDL = "include \"./common.thrift\"\n\nexception KeyDoesNotExist {\n    1: optional string key\n} (\n    rpc.code = \"INVALID_ARGUMENT\"\n)\n\nexception IntegerMismatchError {\n    1: required i64 expectedValue\n    2: required i64 gotValue\n} (\n    rpc.code = \"INVALID_ARGUMENT\"\n)\n\nstruct CompareAndSwap {\n    1: required string key\n    2: required i64 currentValue\n    3: required i64 newValue\n}\n\nservice ReadOnlyStore extends common.BaseService {\n    i64 integer(1: string key) throws (1: KeyDoesNotExist doesNotExist)\n}\n\nservice Store extends ReadOnlyStore {\n    void increment(1: string key, 2: i64 value)\n\n    void compareAndSwap(1: CompareAndSwap request)\n        throws (1: IntegerMismatchError mismatch)\n\n    oneway void forget(1: string key)\n}\n\n\n// This struct intentionally has the same shape as the `CompareAndSwap` wrapper\n// `Store_CompareAndSwap_Args`, except all fields are optional.\n\n// We use this to generate an invalid payload for testing.\nstruct OptionalCompareAndSwapWrapper {\n    1: optional OptionalCompareAndSwap cas\n}\n\nstruct OptionalCompareAndSwap {\n    1: optional string key\n    2: optional i64 currentValue\n    3: optional i64 newValue\n}\n"
  1416  
  1417  // ReadOnlyStore_Integer_Args represents the arguments for the ReadOnlyStore.integer function.
  1418  //
  1419  // The arguments for integer are sent and received over the wire as this struct.
  1420  type ReadOnlyStore_Integer_Args struct {
  1421  	Key *string `json:"key,omitempty"`
  1422  }
  1423  
  1424  // ToWire translates a ReadOnlyStore_Integer_Args struct into a Thrift-level intermediate
  1425  // representation. This intermediate representation may be serialized
  1426  // into bytes using a ThriftRW protocol implementation.
  1427  //
  1428  // An error is returned if the struct or any of its fields failed to
  1429  // validate.
  1430  //
  1431  //   x, err := v.ToWire()
  1432  //   if err != nil {
  1433  //     return err
  1434  //   }
  1435  //
  1436  //   if err := binaryProtocol.Encode(x, writer); err != nil {
  1437  //     return err
  1438  //   }
  1439  func (v *ReadOnlyStore_Integer_Args) ToWire() (wire.Value, error) {
  1440  	var (
  1441  		fields [1]wire.Field
  1442  		i      int = 0
  1443  		w      wire.Value
  1444  		err    error
  1445  	)
  1446  
  1447  	if v.Key != nil {
  1448  		w, err = wire.NewValueString(*(v.Key)), error(nil)
  1449  		if err != nil {
  1450  			return w, err
  1451  		}
  1452  		fields[i] = wire.Field{ID: 1, Value: w}
  1453  		i++
  1454  	}
  1455  
  1456  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
  1457  }
  1458  
  1459  // FromWire deserializes a ReadOnlyStore_Integer_Args struct from its Thrift-level
  1460  // representation. The Thrift-level representation may be obtained
  1461  // from a ThriftRW protocol implementation.
  1462  //
  1463  // An error is returned if we were unable to build a ReadOnlyStore_Integer_Args struct
  1464  // from the provided intermediate representation.
  1465  //
  1466  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
  1467  //   if err != nil {
  1468  //     return nil, err
  1469  //   }
  1470  //
  1471  //   var v ReadOnlyStore_Integer_Args
  1472  //   if err := v.FromWire(x); err != nil {
  1473  //     return nil, err
  1474  //   }
  1475  //   return &v, nil
  1476  func (v *ReadOnlyStore_Integer_Args) FromWire(w wire.Value) error {
  1477  	var err error
  1478  
  1479  	for _, field := range w.GetStruct().Fields {
  1480  		switch field.ID {
  1481  		case 1:
  1482  			if field.Value.Type() == wire.TBinary {
  1483  				var x string
  1484  				x, err = field.Value.GetString(), error(nil)
  1485  				v.Key = &x
  1486  				if err != nil {
  1487  					return err
  1488  				}
  1489  
  1490  			}
  1491  		}
  1492  	}
  1493  
  1494  	return nil
  1495  }
  1496  
  1497  // Encode serializes a ReadOnlyStore_Integer_Args struct directly into bytes, without going
  1498  // through an intermediary type.
  1499  //
  1500  // An error is returned if a ReadOnlyStore_Integer_Args struct could not be encoded.
  1501  func (v *ReadOnlyStore_Integer_Args) Encode(sw stream.Writer) error {
  1502  	if err := sw.WriteStructBegin(); err != nil {
  1503  		return err
  1504  	}
  1505  
  1506  	if v.Key != nil {
  1507  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TBinary}); err != nil {
  1508  			return err
  1509  		}
  1510  		if err := sw.WriteString(*(v.Key)); err != nil {
  1511  			return err
  1512  		}
  1513  		if err := sw.WriteFieldEnd(); err != nil {
  1514  			return err
  1515  		}
  1516  	}
  1517  
  1518  	return sw.WriteStructEnd()
  1519  }
  1520  
  1521  // Decode deserializes a ReadOnlyStore_Integer_Args struct directly from its Thrift-level
  1522  // representation, without going through an intemediary type.
  1523  //
  1524  // An error is returned if a ReadOnlyStore_Integer_Args struct could not be generated from the wire
  1525  // representation.
  1526  func (v *ReadOnlyStore_Integer_Args) Decode(sr stream.Reader) error {
  1527  
  1528  	if err := sr.ReadStructBegin(); err != nil {
  1529  		return err
  1530  	}
  1531  
  1532  	fh, ok, err := sr.ReadFieldBegin()
  1533  	if err != nil {
  1534  		return err
  1535  	}
  1536  
  1537  	for ok {
  1538  		switch {
  1539  		case fh.ID == 1 && fh.Type == wire.TBinary:
  1540  			var x string
  1541  			x, err = sr.ReadString()
  1542  			v.Key = &x
  1543  			if err != nil {
  1544  				return err
  1545  			}
  1546  
  1547  		default:
  1548  			if err := sr.Skip(fh.Type); err != nil {
  1549  				return err
  1550  			}
  1551  		}
  1552  
  1553  		if err := sr.ReadFieldEnd(); err != nil {
  1554  			return err
  1555  		}
  1556  
  1557  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
  1558  			return err
  1559  		}
  1560  	}
  1561  
  1562  	if err := sr.ReadStructEnd(); err != nil {
  1563  		return err
  1564  	}
  1565  
  1566  	return nil
  1567  }
  1568  
  1569  // String returns a readable string representation of a ReadOnlyStore_Integer_Args
  1570  // struct.
  1571  func (v *ReadOnlyStore_Integer_Args) String() string {
  1572  	if v == nil {
  1573  		return "<nil>"
  1574  	}
  1575  
  1576  	var fields [1]string
  1577  	i := 0
  1578  	if v.Key != nil {
  1579  		fields[i] = fmt.Sprintf("Key: %v", *(v.Key))
  1580  		i++
  1581  	}
  1582  
  1583  	return fmt.Sprintf("ReadOnlyStore_Integer_Args{%v}", strings.Join(fields[:i], ", "))
  1584  }
  1585  
  1586  // Equals returns true if all the fields of this ReadOnlyStore_Integer_Args match the
  1587  // provided ReadOnlyStore_Integer_Args.
  1588  //
  1589  // This function performs a deep comparison.
  1590  func (v *ReadOnlyStore_Integer_Args) Equals(rhs *ReadOnlyStore_Integer_Args) bool {
  1591  	if v == nil {
  1592  		return rhs == nil
  1593  	} else if rhs == nil {
  1594  		return false
  1595  	}
  1596  	if !_String_EqualsPtr(v.Key, rhs.Key) {
  1597  		return false
  1598  	}
  1599  
  1600  	return true
  1601  }
  1602  
  1603  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
  1604  // fast logging of ReadOnlyStore_Integer_Args.
  1605  func (v *ReadOnlyStore_Integer_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
  1606  	if v == nil {
  1607  		return nil
  1608  	}
  1609  	if v.Key != nil {
  1610  		enc.AddString("key", *v.Key)
  1611  	}
  1612  	return err
  1613  }
  1614  
  1615  // GetKey returns the value of Key if it is set or its
  1616  // zero value if it is unset.
  1617  func (v *ReadOnlyStore_Integer_Args) GetKey() (o string) {
  1618  	if v != nil && v.Key != nil {
  1619  		return *v.Key
  1620  	}
  1621  
  1622  	return
  1623  }
  1624  
  1625  // IsSetKey returns true if Key is not nil.
  1626  func (v *ReadOnlyStore_Integer_Args) IsSetKey() bool {
  1627  	return v != nil && v.Key != nil
  1628  }
  1629  
  1630  // MethodName returns the name of the Thrift function as specified in
  1631  // the IDL, for which this struct represent the arguments.
  1632  //
  1633  // This will always be "integer" for this struct.
  1634  func (v *ReadOnlyStore_Integer_Args) MethodName() string {
  1635  	return "integer"
  1636  }
  1637  
  1638  // EnvelopeType returns the kind of value inside this struct.
  1639  //
  1640  // This will always be Call for this struct.
  1641  func (v *ReadOnlyStore_Integer_Args) EnvelopeType() wire.EnvelopeType {
  1642  	return wire.Call
  1643  }
  1644  
  1645  // ReadOnlyStore_Integer_Helper provides functions that aid in handling the
  1646  // parameters and return values of the ReadOnlyStore.integer
  1647  // function.
  1648  var ReadOnlyStore_Integer_Helper = struct {
  1649  	// Args accepts the parameters of integer in-order and returns
  1650  	// the arguments struct for the function.
  1651  	Args func(
  1652  		key *string,
  1653  	) *ReadOnlyStore_Integer_Args
  1654  
  1655  	// IsException returns true if the given error can be thrown
  1656  	// by integer.
  1657  	//
  1658  	// An error can be thrown by integer only if the
  1659  	// corresponding exception type was mentioned in the 'throws'
  1660  	// section for it in the Thrift file.
  1661  	IsException func(error) bool
  1662  
  1663  	// WrapResponse returns the result struct for integer
  1664  	// given its return value and error.
  1665  	//
  1666  	// This allows mapping values and errors returned by
  1667  	// integer into a serializable result struct.
  1668  	// WrapResponse returns a non-nil error if the provided
  1669  	// error cannot be thrown by integer
  1670  	//
  1671  	//   value, err := integer(args)
  1672  	//   result, err := ReadOnlyStore_Integer_Helper.WrapResponse(value, err)
  1673  	//   if err != nil {
  1674  	//     return fmt.Errorf("unexpected error from integer: %v", err)
  1675  	//   }
  1676  	//   serialize(result)
  1677  	WrapResponse func(int64, error) (*ReadOnlyStore_Integer_Result, error)
  1678  
  1679  	// UnwrapResponse takes the result struct for integer
  1680  	// and returns the value or error returned by it.
  1681  	//
  1682  	// The error is non-nil only if integer threw an
  1683  	// exception.
  1684  	//
  1685  	//   result := deserialize(bytes)
  1686  	//   value, err := ReadOnlyStore_Integer_Helper.UnwrapResponse(result)
  1687  	UnwrapResponse func(*ReadOnlyStore_Integer_Result) (int64, error)
  1688  }{}
  1689  
  1690  func init() {
  1691  	ReadOnlyStore_Integer_Helper.Args = func(
  1692  		key *string,
  1693  	) *ReadOnlyStore_Integer_Args {
  1694  		return &ReadOnlyStore_Integer_Args{
  1695  			Key: key,
  1696  		}
  1697  	}
  1698  
  1699  	ReadOnlyStore_Integer_Helper.IsException = func(err error) bool {
  1700  		switch err.(type) {
  1701  		case *KeyDoesNotExist:
  1702  			return true
  1703  		default:
  1704  			return false
  1705  		}
  1706  	}
  1707  
  1708  	ReadOnlyStore_Integer_Helper.WrapResponse = func(success int64, err error) (*ReadOnlyStore_Integer_Result, error) {
  1709  		if err == nil {
  1710  			return &ReadOnlyStore_Integer_Result{Success: &success}, nil
  1711  		}
  1712  
  1713  		switch e := err.(type) {
  1714  		case *KeyDoesNotExist:
  1715  			if e == nil {
  1716  				return nil, errors.New("WrapResponse received non-nil error type with nil value for ReadOnlyStore_Integer_Result.DoesNotExist")
  1717  			}
  1718  			return &ReadOnlyStore_Integer_Result{DoesNotExist: e}, nil
  1719  		}
  1720  
  1721  		return nil, err
  1722  	}
  1723  	ReadOnlyStore_Integer_Helper.UnwrapResponse = func(result *ReadOnlyStore_Integer_Result) (success int64, err error) {
  1724  		if result.DoesNotExist != nil {
  1725  			err = result.DoesNotExist
  1726  			return
  1727  		}
  1728  
  1729  		if result.Success != nil {
  1730  			success = *result.Success
  1731  			return
  1732  		}
  1733  
  1734  		err = errors.New("expected a non-void result")
  1735  		return
  1736  	}
  1737  
  1738  }
  1739  
  1740  // ReadOnlyStore_Integer_Result represents the result of a ReadOnlyStore.integer function call.
  1741  //
  1742  // The result of a integer execution is sent and received over the wire as this struct.
  1743  //
  1744  // Success is set only if the function did not throw an exception.
  1745  type ReadOnlyStore_Integer_Result struct {
  1746  	// Value returned by integer after a successful execution.
  1747  	Success      *int64           `json:"success,omitempty"`
  1748  	DoesNotExist *KeyDoesNotExist `json:"doesNotExist,omitempty"`
  1749  }
  1750  
  1751  // ToWire translates a ReadOnlyStore_Integer_Result struct into a Thrift-level intermediate
  1752  // representation. This intermediate representation may be serialized
  1753  // into bytes using a ThriftRW protocol implementation.
  1754  //
  1755  // An error is returned if the struct or any of its fields failed to
  1756  // validate.
  1757  //
  1758  //   x, err := v.ToWire()
  1759  //   if err != nil {
  1760  //     return err
  1761  //   }
  1762  //
  1763  //   if err := binaryProtocol.Encode(x, writer); err != nil {
  1764  //     return err
  1765  //   }
  1766  func (v *ReadOnlyStore_Integer_Result) ToWire() (wire.Value, error) {
  1767  	var (
  1768  		fields [2]wire.Field
  1769  		i      int = 0
  1770  		w      wire.Value
  1771  		err    error
  1772  	)
  1773  
  1774  	if v.Success != nil {
  1775  		w, err = wire.NewValueI64(*(v.Success)), error(nil)
  1776  		if err != nil {
  1777  			return w, err
  1778  		}
  1779  		fields[i] = wire.Field{ID: 0, Value: w}
  1780  		i++
  1781  	}
  1782  	if v.DoesNotExist != nil {
  1783  		w, err = v.DoesNotExist.ToWire()
  1784  		if err != nil {
  1785  			return w, err
  1786  		}
  1787  		fields[i] = wire.Field{ID: 1, Value: w}
  1788  		i++
  1789  	}
  1790  
  1791  	if i != 1 {
  1792  		return wire.Value{}, fmt.Errorf("ReadOnlyStore_Integer_Result should have exactly one field: got %v fields", i)
  1793  	}
  1794  
  1795  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
  1796  }
  1797  
  1798  func _KeyDoesNotExist_Read(w wire.Value) (*KeyDoesNotExist, error) {
  1799  	var v KeyDoesNotExist
  1800  	err := v.FromWire(w)
  1801  	return &v, err
  1802  }
  1803  
  1804  // FromWire deserializes a ReadOnlyStore_Integer_Result struct from its Thrift-level
  1805  // representation. The Thrift-level representation may be obtained
  1806  // from a ThriftRW protocol implementation.
  1807  //
  1808  // An error is returned if we were unable to build a ReadOnlyStore_Integer_Result struct
  1809  // from the provided intermediate representation.
  1810  //
  1811  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
  1812  //   if err != nil {
  1813  //     return nil, err
  1814  //   }
  1815  //
  1816  //   var v ReadOnlyStore_Integer_Result
  1817  //   if err := v.FromWire(x); err != nil {
  1818  //     return nil, err
  1819  //   }
  1820  //   return &v, nil
  1821  func (v *ReadOnlyStore_Integer_Result) FromWire(w wire.Value) error {
  1822  	var err error
  1823  
  1824  	for _, field := range w.GetStruct().Fields {
  1825  		switch field.ID {
  1826  		case 0:
  1827  			if field.Value.Type() == wire.TI64 {
  1828  				var x int64
  1829  				x, err = field.Value.GetI64(), error(nil)
  1830  				v.Success = &x
  1831  				if err != nil {
  1832  					return err
  1833  				}
  1834  
  1835  			}
  1836  		case 1:
  1837  			if field.Value.Type() == wire.TStruct {
  1838  				v.DoesNotExist, err = _KeyDoesNotExist_Read(field.Value)
  1839  				if err != nil {
  1840  					return err
  1841  				}
  1842  
  1843  			}
  1844  		}
  1845  	}
  1846  
  1847  	count := 0
  1848  	if v.Success != nil {
  1849  		count++
  1850  	}
  1851  	if v.DoesNotExist != nil {
  1852  		count++
  1853  	}
  1854  	if count != 1 {
  1855  		return fmt.Errorf("ReadOnlyStore_Integer_Result should have exactly one field: got %v fields", count)
  1856  	}
  1857  
  1858  	return nil
  1859  }
  1860  
  1861  // Encode serializes a ReadOnlyStore_Integer_Result struct directly into bytes, without going
  1862  // through an intermediary type.
  1863  //
  1864  // An error is returned if a ReadOnlyStore_Integer_Result struct could not be encoded.
  1865  func (v *ReadOnlyStore_Integer_Result) Encode(sw stream.Writer) error {
  1866  	if err := sw.WriteStructBegin(); err != nil {
  1867  		return err
  1868  	}
  1869  
  1870  	if v.Success != nil {
  1871  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TI64}); err != nil {
  1872  			return err
  1873  		}
  1874  		if err := sw.WriteInt64(*(v.Success)); err != nil {
  1875  			return err
  1876  		}
  1877  		if err := sw.WriteFieldEnd(); err != nil {
  1878  			return err
  1879  		}
  1880  	}
  1881  
  1882  	if v.DoesNotExist != nil {
  1883  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
  1884  			return err
  1885  		}
  1886  		if err := v.DoesNotExist.Encode(sw); err != nil {
  1887  			return err
  1888  		}
  1889  		if err := sw.WriteFieldEnd(); err != nil {
  1890  			return err
  1891  		}
  1892  	}
  1893  
  1894  	count := 0
  1895  	if v.Success != nil {
  1896  		count++
  1897  	}
  1898  	if v.DoesNotExist != nil {
  1899  		count++
  1900  	}
  1901  
  1902  	if count != 1 {
  1903  		return fmt.Errorf("ReadOnlyStore_Integer_Result should have exactly one field: got %v fields", count)
  1904  	}
  1905  
  1906  	return sw.WriteStructEnd()
  1907  }
  1908  
  1909  func _KeyDoesNotExist_Decode(sr stream.Reader) (*KeyDoesNotExist, error) {
  1910  	var v KeyDoesNotExist
  1911  	err := v.Decode(sr)
  1912  	return &v, err
  1913  }
  1914  
  1915  // Decode deserializes a ReadOnlyStore_Integer_Result struct directly from its Thrift-level
  1916  // representation, without going through an intemediary type.
  1917  //
  1918  // An error is returned if a ReadOnlyStore_Integer_Result struct could not be generated from the wire
  1919  // representation.
  1920  func (v *ReadOnlyStore_Integer_Result) Decode(sr stream.Reader) error {
  1921  
  1922  	if err := sr.ReadStructBegin(); err != nil {
  1923  		return err
  1924  	}
  1925  
  1926  	fh, ok, err := sr.ReadFieldBegin()
  1927  	if err != nil {
  1928  		return err
  1929  	}
  1930  
  1931  	for ok {
  1932  		switch {
  1933  		case fh.ID == 0 && fh.Type == wire.TI64:
  1934  			var x int64
  1935  			x, err = sr.ReadInt64()
  1936  			v.Success = &x
  1937  			if err != nil {
  1938  				return err
  1939  			}
  1940  
  1941  		case fh.ID == 1 && fh.Type == wire.TStruct:
  1942  			v.DoesNotExist, err = _KeyDoesNotExist_Decode(sr)
  1943  			if err != nil {
  1944  				return err
  1945  			}
  1946  
  1947  		default:
  1948  			if err := sr.Skip(fh.Type); err != nil {
  1949  				return err
  1950  			}
  1951  		}
  1952  
  1953  		if err := sr.ReadFieldEnd(); err != nil {
  1954  			return err
  1955  		}
  1956  
  1957  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
  1958  			return err
  1959  		}
  1960  	}
  1961  
  1962  	if err := sr.ReadStructEnd(); err != nil {
  1963  		return err
  1964  	}
  1965  
  1966  	count := 0
  1967  	if v.Success != nil {
  1968  		count++
  1969  	}
  1970  	if v.DoesNotExist != nil {
  1971  		count++
  1972  	}
  1973  	if count != 1 {
  1974  		return fmt.Errorf("ReadOnlyStore_Integer_Result should have exactly one field: got %v fields", count)
  1975  	}
  1976  
  1977  	return nil
  1978  }
  1979  
  1980  // String returns a readable string representation of a ReadOnlyStore_Integer_Result
  1981  // struct.
  1982  func (v *ReadOnlyStore_Integer_Result) String() string {
  1983  	if v == nil {
  1984  		return "<nil>"
  1985  	}
  1986  
  1987  	var fields [2]string
  1988  	i := 0
  1989  	if v.Success != nil {
  1990  		fields[i] = fmt.Sprintf("Success: %v", *(v.Success))
  1991  		i++
  1992  	}
  1993  	if v.DoesNotExist != nil {
  1994  		fields[i] = fmt.Sprintf("DoesNotExist: %v", v.DoesNotExist)
  1995  		i++
  1996  	}
  1997  
  1998  	return fmt.Sprintf("ReadOnlyStore_Integer_Result{%v}", strings.Join(fields[:i], ", "))
  1999  }
  2000  
  2001  // Equals returns true if all the fields of this ReadOnlyStore_Integer_Result match the
  2002  // provided ReadOnlyStore_Integer_Result.
  2003  //
  2004  // This function performs a deep comparison.
  2005  func (v *ReadOnlyStore_Integer_Result) Equals(rhs *ReadOnlyStore_Integer_Result) bool {
  2006  	if v == nil {
  2007  		return rhs == nil
  2008  	} else if rhs == nil {
  2009  		return false
  2010  	}
  2011  	if !_I64_EqualsPtr(v.Success, rhs.Success) {
  2012  		return false
  2013  	}
  2014  	if !((v.DoesNotExist == nil && rhs.DoesNotExist == nil) || (v.DoesNotExist != nil && rhs.DoesNotExist != nil && v.DoesNotExist.Equals(rhs.DoesNotExist))) {
  2015  		return false
  2016  	}
  2017  
  2018  	return true
  2019  }
  2020  
  2021  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
  2022  // fast logging of ReadOnlyStore_Integer_Result.
  2023  func (v *ReadOnlyStore_Integer_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
  2024  	if v == nil {
  2025  		return nil
  2026  	}
  2027  	if v.Success != nil {
  2028  		enc.AddInt64("success", *v.Success)
  2029  	}
  2030  	if v.DoesNotExist != nil {
  2031  		err = multierr.Append(err, enc.AddObject("doesNotExist", v.DoesNotExist))
  2032  	}
  2033  	return err
  2034  }
  2035  
  2036  // GetSuccess returns the value of Success if it is set or its
  2037  // zero value if it is unset.
  2038  func (v *ReadOnlyStore_Integer_Result) GetSuccess() (o int64) {
  2039  	if v != nil && v.Success != nil {
  2040  		return *v.Success
  2041  	}
  2042  
  2043  	return
  2044  }
  2045  
  2046  // IsSetSuccess returns true if Success is not nil.
  2047  func (v *ReadOnlyStore_Integer_Result) IsSetSuccess() bool {
  2048  	return v != nil && v.Success != nil
  2049  }
  2050  
  2051  // GetDoesNotExist returns the value of DoesNotExist if it is set or its
  2052  // zero value if it is unset.
  2053  func (v *ReadOnlyStore_Integer_Result) GetDoesNotExist() (o *KeyDoesNotExist) {
  2054  	if v != nil && v.DoesNotExist != nil {
  2055  		return v.DoesNotExist
  2056  	}
  2057  
  2058  	return
  2059  }
  2060  
  2061  // IsSetDoesNotExist returns true if DoesNotExist is not nil.
  2062  func (v *ReadOnlyStore_Integer_Result) IsSetDoesNotExist() bool {
  2063  	return v != nil && v.DoesNotExist != nil
  2064  }
  2065  
  2066  // MethodName returns the name of the Thrift function as specified in
  2067  // the IDL, for which this struct represent the result.
  2068  //
  2069  // This will always be "integer" for this struct.
  2070  func (v *ReadOnlyStore_Integer_Result) MethodName() string {
  2071  	return "integer"
  2072  }
  2073  
  2074  // EnvelopeType returns the kind of value inside this struct.
  2075  //
  2076  // This will always be Reply for this struct.
  2077  func (v *ReadOnlyStore_Integer_Result) EnvelopeType() wire.EnvelopeType {
  2078  	return wire.Reply
  2079  }
  2080  
  2081  // Store_CompareAndSwap_Args represents the arguments for the Store.compareAndSwap function.
  2082  //
  2083  // The arguments for compareAndSwap are sent and received over the wire as this struct.
  2084  type Store_CompareAndSwap_Args struct {
  2085  	Request *CompareAndSwap `json:"request,omitempty"`
  2086  }
  2087  
  2088  // ToWire translates a Store_CompareAndSwap_Args struct into a Thrift-level intermediate
  2089  // representation. This intermediate representation may be serialized
  2090  // into bytes using a ThriftRW protocol implementation.
  2091  //
  2092  // An error is returned if the struct or any of its fields failed to
  2093  // validate.
  2094  //
  2095  //   x, err := v.ToWire()
  2096  //   if err != nil {
  2097  //     return err
  2098  //   }
  2099  //
  2100  //   if err := binaryProtocol.Encode(x, writer); err != nil {
  2101  //     return err
  2102  //   }
  2103  func (v *Store_CompareAndSwap_Args) ToWire() (wire.Value, error) {
  2104  	var (
  2105  		fields [1]wire.Field
  2106  		i      int = 0
  2107  		w      wire.Value
  2108  		err    error
  2109  	)
  2110  
  2111  	if v.Request != nil {
  2112  		w, err = v.Request.ToWire()
  2113  		if err != nil {
  2114  			return w, err
  2115  		}
  2116  		fields[i] = wire.Field{ID: 1, Value: w}
  2117  		i++
  2118  	}
  2119  
  2120  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
  2121  }
  2122  
  2123  func _CompareAndSwap_Read(w wire.Value) (*CompareAndSwap, error) {
  2124  	var v CompareAndSwap
  2125  	err := v.FromWire(w)
  2126  	return &v, err
  2127  }
  2128  
  2129  // FromWire deserializes a Store_CompareAndSwap_Args struct from its Thrift-level
  2130  // representation. The Thrift-level representation may be obtained
  2131  // from a ThriftRW protocol implementation.
  2132  //
  2133  // An error is returned if we were unable to build a Store_CompareAndSwap_Args struct
  2134  // from the provided intermediate representation.
  2135  //
  2136  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
  2137  //   if err != nil {
  2138  //     return nil, err
  2139  //   }
  2140  //
  2141  //   var v Store_CompareAndSwap_Args
  2142  //   if err := v.FromWire(x); err != nil {
  2143  //     return nil, err
  2144  //   }
  2145  //   return &v, nil
  2146  func (v *Store_CompareAndSwap_Args) FromWire(w wire.Value) error {
  2147  	var err error
  2148  
  2149  	for _, field := range w.GetStruct().Fields {
  2150  		switch field.ID {
  2151  		case 1:
  2152  			if field.Value.Type() == wire.TStruct {
  2153  				v.Request, err = _CompareAndSwap_Read(field.Value)
  2154  				if err != nil {
  2155  					return err
  2156  				}
  2157  
  2158  			}
  2159  		}
  2160  	}
  2161  
  2162  	return nil
  2163  }
  2164  
  2165  // Encode serializes a Store_CompareAndSwap_Args struct directly into bytes, without going
  2166  // through an intermediary type.
  2167  //
  2168  // An error is returned if a Store_CompareAndSwap_Args struct could not be encoded.
  2169  func (v *Store_CompareAndSwap_Args) Encode(sw stream.Writer) error {
  2170  	if err := sw.WriteStructBegin(); err != nil {
  2171  		return err
  2172  	}
  2173  
  2174  	if v.Request != nil {
  2175  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
  2176  			return err
  2177  		}
  2178  		if err := v.Request.Encode(sw); err != nil {
  2179  			return err
  2180  		}
  2181  		if err := sw.WriteFieldEnd(); err != nil {
  2182  			return err
  2183  		}
  2184  	}
  2185  
  2186  	return sw.WriteStructEnd()
  2187  }
  2188  
  2189  func _CompareAndSwap_Decode(sr stream.Reader) (*CompareAndSwap, error) {
  2190  	var v CompareAndSwap
  2191  	err := v.Decode(sr)
  2192  	return &v, err
  2193  }
  2194  
  2195  // Decode deserializes a Store_CompareAndSwap_Args struct directly from its Thrift-level
  2196  // representation, without going through an intemediary type.
  2197  //
  2198  // An error is returned if a Store_CompareAndSwap_Args struct could not be generated from the wire
  2199  // representation.
  2200  func (v *Store_CompareAndSwap_Args) Decode(sr stream.Reader) error {
  2201  
  2202  	if err := sr.ReadStructBegin(); err != nil {
  2203  		return err
  2204  	}
  2205  
  2206  	fh, ok, err := sr.ReadFieldBegin()
  2207  	if err != nil {
  2208  		return err
  2209  	}
  2210  
  2211  	for ok {
  2212  		switch {
  2213  		case fh.ID == 1 && fh.Type == wire.TStruct:
  2214  			v.Request, err = _CompareAndSwap_Decode(sr)
  2215  			if err != nil {
  2216  				return err
  2217  			}
  2218  
  2219  		default:
  2220  			if err := sr.Skip(fh.Type); err != nil {
  2221  				return err
  2222  			}
  2223  		}
  2224  
  2225  		if err := sr.ReadFieldEnd(); err != nil {
  2226  			return err
  2227  		}
  2228  
  2229  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
  2230  			return err
  2231  		}
  2232  	}
  2233  
  2234  	if err := sr.ReadStructEnd(); err != nil {
  2235  		return err
  2236  	}
  2237  
  2238  	return nil
  2239  }
  2240  
  2241  // String returns a readable string representation of a Store_CompareAndSwap_Args
  2242  // struct.
  2243  func (v *Store_CompareAndSwap_Args) String() string {
  2244  	if v == nil {
  2245  		return "<nil>"
  2246  	}
  2247  
  2248  	var fields [1]string
  2249  	i := 0
  2250  	if v.Request != nil {
  2251  		fields[i] = fmt.Sprintf("Request: %v", v.Request)
  2252  		i++
  2253  	}
  2254  
  2255  	return fmt.Sprintf("Store_CompareAndSwap_Args{%v}", strings.Join(fields[:i], ", "))
  2256  }
  2257  
  2258  // Equals returns true if all the fields of this Store_CompareAndSwap_Args match the
  2259  // provided Store_CompareAndSwap_Args.
  2260  //
  2261  // This function performs a deep comparison.
  2262  func (v *Store_CompareAndSwap_Args) Equals(rhs *Store_CompareAndSwap_Args) bool {
  2263  	if v == nil {
  2264  		return rhs == nil
  2265  	} else if rhs == nil {
  2266  		return false
  2267  	}
  2268  	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
  2269  		return false
  2270  	}
  2271  
  2272  	return true
  2273  }
  2274  
  2275  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
  2276  // fast logging of Store_CompareAndSwap_Args.
  2277  func (v *Store_CompareAndSwap_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
  2278  	if v == nil {
  2279  		return nil
  2280  	}
  2281  	if v.Request != nil {
  2282  		err = multierr.Append(err, enc.AddObject("request", v.Request))
  2283  	}
  2284  	return err
  2285  }
  2286  
  2287  // GetRequest returns the value of Request if it is set or its
  2288  // zero value if it is unset.
  2289  func (v *Store_CompareAndSwap_Args) GetRequest() (o *CompareAndSwap) {
  2290  	if v != nil && v.Request != nil {
  2291  		return v.Request
  2292  	}
  2293  
  2294  	return
  2295  }
  2296  
  2297  // IsSetRequest returns true if Request is not nil.
  2298  func (v *Store_CompareAndSwap_Args) IsSetRequest() bool {
  2299  	return v != nil && v.Request != nil
  2300  }
  2301  
  2302  // MethodName returns the name of the Thrift function as specified in
  2303  // the IDL, for which this struct represent the arguments.
  2304  //
  2305  // This will always be "compareAndSwap" for this struct.
  2306  func (v *Store_CompareAndSwap_Args) MethodName() string {
  2307  	return "compareAndSwap"
  2308  }
  2309  
  2310  // EnvelopeType returns the kind of value inside this struct.
  2311  //
  2312  // This will always be Call for this struct.
  2313  func (v *Store_CompareAndSwap_Args) EnvelopeType() wire.EnvelopeType {
  2314  	return wire.Call
  2315  }
  2316  
  2317  // Store_CompareAndSwap_Helper provides functions that aid in handling the
  2318  // parameters and return values of the Store.compareAndSwap
  2319  // function.
  2320  var Store_CompareAndSwap_Helper = struct {
  2321  	// Args accepts the parameters of compareAndSwap in-order and returns
  2322  	// the arguments struct for the function.
  2323  	Args func(
  2324  		request *CompareAndSwap,
  2325  	) *Store_CompareAndSwap_Args
  2326  
  2327  	// IsException returns true if the given error can be thrown
  2328  	// by compareAndSwap.
  2329  	//
  2330  	// An error can be thrown by compareAndSwap only if the
  2331  	// corresponding exception type was mentioned in the 'throws'
  2332  	// section for it in the Thrift file.
  2333  	IsException func(error) bool
  2334  
  2335  	// WrapResponse returns the result struct for compareAndSwap
  2336  	// given the error returned by it. The provided error may
  2337  	// be nil if compareAndSwap did not fail.
  2338  	//
  2339  	// This allows mapping errors returned by compareAndSwap into a
  2340  	// serializable result struct. WrapResponse returns a
  2341  	// non-nil error if the provided error cannot be thrown by
  2342  	// compareAndSwap
  2343  	//
  2344  	//   err := compareAndSwap(args)
  2345  	//   result, err := Store_CompareAndSwap_Helper.WrapResponse(err)
  2346  	//   if err != nil {
  2347  	//     return fmt.Errorf("unexpected error from compareAndSwap: %v", err)
  2348  	//   }
  2349  	//   serialize(result)
  2350  	WrapResponse func(error) (*Store_CompareAndSwap_Result, error)
  2351  
  2352  	// UnwrapResponse takes the result struct for compareAndSwap
  2353  	// and returns the erorr returned by it (if any).
  2354  	//
  2355  	// The error is non-nil only if compareAndSwap threw an
  2356  	// exception.
  2357  	//
  2358  	//   result := deserialize(bytes)
  2359  	//   err := Store_CompareAndSwap_Helper.UnwrapResponse(result)
  2360  	UnwrapResponse func(*Store_CompareAndSwap_Result) error
  2361  }{}
  2362  
  2363  func init() {
  2364  	Store_CompareAndSwap_Helper.Args = func(
  2365  		request *CompareAndSwap,
  2366  	) *Store_CompareAndSwap_Args {
  2367  		return &Store_CompareAndSwap_Args{
  2368  			Request: request,
  2369  		}
  2370  	}
  2371  
  2372  	Store_CompareAndSwap_Helper.IsException = func(err error) bool {
  2373  		switch err.(type) {
  2374  		case *IntegerMismatchError:
  2375  			return true
  2376  		default:
  2377  			return false
  2378  		}
  2379  	}
  2380  
  2381  	Store_CompareAndSwap_Helper.WrapResponse = func(err error) (*Store_CompareAndSwap_Result, error) {
  2382  		if err == nil {
  2383  			return &Store_CompareAndSwap_Result{}, nil
  2384  		}
  2385  
  2386  		switch e := err.(type) {
  2387  		case *IntegerMismatchError:
  2388  			if e == nil {
  2389  				return nil, errors.New("WrapResponse received non-nil error type with nil value for Store_CompareAndSwap_Result.Mismatch")
  2390  			}
  2391  			return &Store_CompareAndSwap_Result{Mismatch: e}, nil
  2392  		}
  2393  
  2394  		return nil, err
  2395  	}
  2396  	Store_CompareAndSwap_Helper.UnwrapResponse = func(result *Store_CompareAndSwap_Result) (err error) {
  2397  		if result.Mismatch != nil {
  2398  			err = result.Mismatch
  2399  			return
  2400  		}
  2401  		return
  2402  	}
  2403  
  2404  }
  2405  
  2406  // Store_CompareAndSwap_Result represents the result of a Store.compareAndSwap function call.
  2407  //
  2408  // The result of a compareAndSwap execution is sent and received over the wire as this struct.
  2409  type Store_CompareAndSwap_Result struct {
  2410  	Mismatch *IntegerMismatchError `json:"mismatch,omitempty"`
  2411  }
  2412  
  2413  // ToWire translates a Store_CompareAndSwap_Result struct into a Thrift-level intermediate
  2414  // representation. This intermediate representation may be serialized
  2415  // into bytes using a ThriftRW protocol implementation.
  2416  //
  2417  // An error is returned if the struct or any of its fields failed to
  2418  // validate.
  2419  //
  2420  //   x, err := v.ToWire()
  2421  //   if err != nil {
  2422  //     return err
  2423  //   }
  2424  //
  2425  //   if err := binaryProtocol.Encode(x, writer); err != nil {
  2426  //     return err
  2427  //   }
  2428  func (v *Store_CompareAndSwap_Result) ToWire() (wire.Value, error) {
  2429  	var (
  2430  		fields [1]wire.Field
  2431  		i      int = 0
  2432  		w      wire.Value
  2433  		err    error
  2434  	)
  2435  
  2436  	if v.Mismatch != nil {
  2437  		w, err = v.Mismatch.ToWire()
  2438  		if err != nil {
  2439  			return w, err
  2440  		}
  2441  		fields[i] = wire.Field{ID: 1, Value: w}
  2442  		i++
  2443  	}
  2444  
  2445  	if i > 1 {
  2446  		return wire.Value{}, fmt.Errorf("Store_CompareAndSwap_Result should have at most one field: got %v fields", i)
  2447  	}
  2448  
  2449  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
  2450  }
  2451  
  2452  func _IntegerMismatchError_Read(w wire.Value) (*IntegerMismatchError, error) {
  2453  	var v IntegerMismatchError
  2454  	err := v.FromWire(w)
  2455  	return &v, err
  2456  }
  2457  
  2458  // FromWire deserializes a Store_CompareAndSwap_Result struct from its Thrift-level
  2459  // representation. The Thrift-level representation may be obtained
  2460  // from a ThriftRW protocol implementation.
  2461  //
  2462  // An error is returned if we were unable to build a Store_CompareAndSwap_Result struct
  2463  // from the provided intermediate representation.
  2464  //
  2465  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
  2466  //   if err != nil {
  2467  //     return nil, err
  2468  //   }
  2469  //
  2470  //   var v Store_CompareAndSwap_Result
  2471  //   if err := v.FromWire(x); err != nil {
  2472  //     return nil, err
  2473  //   }
  2474  //   return &v, nil
  2475  func (v *Store_CompareAndSwap_Result) FromWire(w wire.Value) error {
  2476  	var err error
  2477  
  2478  	for _, field := range w.GetStruct().Fields {
  2479  		switch field.ID {
  2480  		case 1:
  2481  			if field.Value.Type() == wire.TStruct {
  2482  				v.Mismatch, err = _IntegerMismatchError_Read(field.Value)
  2483  				if err != nil {
  2484  					return err
  2485  				}
  2486  
  2487  			}
  2488  		}
  2489  	}
  2490  
  2491  	count := 0
  2492  	if v.Mismatch != nil {
  2493  		count++
  2494  	}
  2495  	if count > 1 {
  2496  		return fmt.Errorf("Store_CompareAndSwap_Result should have at most one field: got %v fields", count)
  2497  	}
  2498  
  2499  	return nil
  2500  }
  2501  
  2502  // Encode serializes a Store_CompareAndSwap_Result struct directly into bytes, without going
  2503  // through an intermediary type.
  2504  //
  2505  // An error is returned if a Store_CompareAndSwap_Result struct could not be encoded.
  2506  func (v *Store_CompareAndSwap_Result) Encode(sw stream.Writer) error {
  2507  	if err := sw.WriteStructBegin(); err != nil {
  2508  		return err
  2509  	}
  2510  
  2511  	if v.Mismatch != nil {
  2512  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
  2513  			return err
  2514  		}
  2515  		if err := v.Mismatch.Encode(sw); err != nil {
  2516  			return err
  2517  		}
  2518  		if err := sw.WriteFieldEnd(); err != nil {
  2519  			return err
  2520  		}
  2521  	}
  2522  
  2523  	count := 0
  2524  	if v.Mismatch != nil {
  2525  		count++
  2526  	}
  2527  
  2528  	if count > 1 {
  2529  		return fmt.Errorf("Store_CompareAndSwap_Result should have at most one field: got %v fields", count)
  2530  	}
  2531  
  2532  	return sw.WriteStructEnd()
  2533  }
  2534  
  2535  func _IntegerMismatchError_Decode(sr stream.Reader) (*IntegerMismatchError, error) {
  2536  	var v IntegerMismatchError
  2537  	err := v.Decode(sr)
  2538  	return &v, err
  2539  }
  2540  
  2541  // Decode deserializes a Store_CompareAndSwap_Result struct directly from its Thrift-level
  2542  // representation, without going through an intemediary type.
  2543  //
  2544  // An error is returned if a Store_CompareAndSwap_Result struct could not be generated from the wire
  2545  // representation.
  2546  func (v *Store_CompareAndSwap_Result) Decode(sr stream.Reader) error {
  2547  
  2548  	if err := sr.ReadStructBegin(); err != nil {
  2549  		return err
  2550  	}
  2551  
  2552  	fh, ok, err := sr.ReadFieldBegin()
  2553  	if err != nil {
  2554  		return err
  2555  	}
  2556  
  2557  	for ok {
  2558  		switch {
  2559  		case fh.ID == 1 && fh.Type == wire.TStruct:
  2560  			v.Mismatch, err = _IntegerMismatchError_Decode(sr)
  2561  			if err != nil {
  2562  				return err
  2563  			}
  2564  
  2565  		default:
  2566  			if err := sr.Skip(fh.Type); err != nil {
  2567  				return err
  2568  			}
  2569  		}
  2570  
  2571  		if err := sr.ReadFieldEnd(); err != nil {
  2572  			return err
  2573  		}
  2574  
  2575  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
  2576  			return err
  2577  		}
  2578  	}
  2579  
  2580  	if err := sr.ReadStructEnd(); err != nil {
  2581  		return err
  2582  	}
  2583  
  2584  	count := 0
  2585  	if v.Mismatch != nil {
  2586  		count++
  2587  	}
  2588  	if count > 1 {
  2589  		return fmt.Errorf("Store_CompareAndSwap_Result should have at most one field: got %v fields", count)
  2590  	}
  2591  
  2592  	return nil
  2593  }
  2594  
  2595  // String returns a readable string representation of a Store_CompareAndSwap_Result
  2596  // struct.
  2597  func (v *Store_CompareAndSwap_Result) String() string {
  2598  	if v == nil {
  2599  		return "<nil>"
  2600  	}
  2601  
  2602  	var fields [1]string
  2603  	i := 0
  2604  	if v.Mismatch != nil {
  2605  		fields[i] = fmt.Sprintf("Mismatch: %v", v.Mismatch)
  2606  		i++
  2607  	}
  2608  
  2609  	return fmt.Sprintf("Store_CompareAndSwap_Result{%v}", strings.Join(fields[:i], ", "))
  2610  }
  2611  
  2612  // Equals returns true if all the fields of this Store_CompareAndSwap_Result match the
  2613  // provided Store_CompareAndSwap_Result.
  2614  //
  2615  // This function performs a deep comparison.
  2616  func (v *Store_CompareAndSwap_Result) Equals(rhs *Store_CompareAndSwap_Result) bool {
  2617  	if v == nil {
  2618  		return rhs == nil
  2619  	} else if rhs == nil {
  2620  		return false
  2621  	}
  2622  	if !((v.Mismatch == nil && rhs.Mismatch == nil) || (v.Mismatch != nil && rhs.Mismatch != nil && v.Mismatch.Equals(rhs.Mismatch))) {
  2623  		return false
  2624  	}
  2625  
  2626  	return true
  2627  }
  2628  
  2629  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
  2630  // fast logging of Store_CompareAndSwap_Result.
  2631  func (v *Store_CompareAndSwap_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
  2632  	if v == nil {
  2633  		return nil
  2634  	}
  2635  	if v.Mismatch != nil {
  2636  		err = multierr.Append(err, enc.AddObject("mismatch", v.Mismatch))
  2637  	}
  2638  	return err
  2639  }
  2640  
  2641  // GetMismatch returns the value of Mismatch if it is set or its
  2642  // zero value if it is unset.
  2643  func (v *Store_CompareAndSwap_Result) GetMismatch() (o *IntegerMismatchError) {
  2644  	if v != nil && v.Mismatch != nil {
  2645  		return v.Mismatch
  2646  	}
  2647  
  2648  	return
  2649  }
  2650  
  2651  // IsSetMismatch returns true if Mismatch is not nil.
  2652  func (v *Store_CompareAndSwap_Result) IsSetMismatch() bool {
  2653  	return v != nil && v.Mismatch != nil
  2654  }
  2655  
  2656  // MethodName returns the name of the Thrift function as specified in
  2657  // the IDL, for which this struct represent the result.
  2658  //
  2659  // This will always be "compareAndSwap" for this struct.
  2660  func (v *Store_CompareAndSwap_Result) MethodName() string {
  2661  	return "compareAndSwap"
  2662  }
  2663  
  2664  // EnvelopeType returns the kind of value inside this struct.
  2665  //
  2666  // This will always be Reply for this struct.
  2667  func (v *Store_CompareAndSwap_Result) EnvelopeType() wire.EnvelopeType {
  2668  	return wire.Reply
  2669  }
  2670  
  2671  // Store_Forget_Args represents the arguments for the Store.forget function.
  2672  //
  2673  // The arguments for forget are sent and received over the wire as this struct.
  2674  type Store_Forget_Args struct {
  2675  	Key *string `json:"key,omitempty"`
  2676  }
  2677  
  2678  // ToWire translates a Store_Forget_Args struct into a Thrift-level intermediate
  2679  // representation. This intermediate representation may be serialized
  2680  // into bytes using a ThriftRW protocol implementation.
  2681  //
  2682  // An error is returned if the struct or any of its fields failed to
  2683  // validate.
  2684  //
  2685  //   x, err := v.ToWire()
  2686  //   if err != nil {
  2687  //     return err
  2688  //   }
  2689  //
  2690  //   if err := binaryProtocol.Encode(x, writer); err != nil {
  2691  //     return err
  2692  //   }
  2693  func (v *Store_Forget_Args) ToWire() (wire.Value, error) {
  2694  	var (
  2695  		fields [1]wire.Field
  2696  		i      int = 0
  2697  		w      wire.Value
  2698  		err    error
  2699  	)
  2700  
  2701  	if v.Key != nil {
  2702  		w, err = wire.NewValueString(*(v.Key)), error(nil)
  2703  		if err != nil {
  2704  			return w, err
  2705  		}
  2706  		fields[i] = wire.Field{ID: 1, Value: w}
  2707  		i++
  2708  	}
  2709  
  2710  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
  2711  }
  2712  
  2713  // FromWire deserializes a Store_Forget_Args struct from its Thrift-level
  2714  // representation. The Thrift-level representation may be obtained
  2715  // from a ThriftRW protocol implementation.
  2716  //
  2717  // An error is returned if we were unable to build a Store_Forget_Args struct
  2718  // from the provided intermediate representation.
  2719  //
  2720  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
  2721  //   if err != nil {
  2722  //     return nil, err
  2723  //   }
  2724  //
  2725  //   var v Store_Forget_Args
  2726  //   if err := v.FromWire(x); err != nil {
  2727  //     return nil, err
  2728  //   }
  2729  //   return &v, nil
  2730  func (v *Store_Forget_Args) FromWire(w wire.Value) error {
  2731  	var err error
  2732  
  2733  	for _, field := range w.GetStruct().Fields {
  2734  		switch field.ID {
  2735  		case 1:
  2736  			if field.Value.Type() == wire.TBinary {
  2737  				var x string
  2738  				x, err = field.Value.GetString(), error(nil)
  2739  				v.Key = &x
  2740  				if err != nil {
  2741  					return err
  2742  				}
  2743  
  2744  			}
  2745  		}
  2746  	}
  2747  
  2748  	return nil
  2749  }
  2750  
  2751  // Encode serializes a Store_Forget_Args struct directly into bytes, without going
  2752  // through an intermediary type.
  2753  //
  2754  // An error is returned if a Store_Forget_Args struct could not be encoded.
  2755  func (v *Store_Forget_Args) Encode(sw stream.Writer) error {
  2756  	if err := sw.WriteStructBegin(); err != nil {
  2757  		return err
  2758  	}
  2759  
  2760  	if v.Key != nil {
  2761  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TBinary}); err != nil {
  2762  			return err
  2763  		}
  2764  		if err := sw.WriteString(*(v.Key)); err != nil {
  2765  			return err
  2766  		}
  2767  		if err := sw.WriteFieldEnd(); err != nil {
  2768  			return err
  2769  		}
  2770  	}
  2771  
  2772  	return sw.WriteStructEnd()
  2773  }
  2774  
  2775  // Decode deserializes a Store_Forget_Args struct directly from its Thrift-level
  2776  // representation, without going through an intemediary type.
  2777  //
  2778  // An error is returned if a Store_Forget_Args struct could not be generated from the wire
  2779  // representation.
  2780  func (v *Store_Forget_Args) Decode(sr stream.Reader) error {
  2781  
  2782  	if err := sr.ReadStructBegin(); err != nil {
  2783  		return err
  2784  	}
  2785  
  2786  	fh, ok, err := sr.ReadFieldBegin()
  2787  	if err != nil {
  2788  		return err
  2789  	}
  2790  
  2791  	for ok {
  2792  		switch {
  2793  		case fh.ID == 1 && fh.Type == wire.TBinary:
  2794  			var x string
  2795  			x, err = sr.ReadString()
  2796  			v.Key = &x
  2797  			if err != nil {
  2798  				return err
  2799  			}
  2800  
  2801  		default:
  2802  			if err := sr.Skip(fh.Type); err != nil {
  2803  				return err
  2804  			}
  2805  		}
  2806  
  2807  		if err := sr.ReadFieldEnd(); err != nil {
  2808  			return err
  2809  		}
  2810  
  2811  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
  2812  			return err
  2813  		}
  2814  	}
  2815  
  2816  	if err := sr.ReadStructEnd(); err != nil {
  2817  		return err
  2818  	}
  2819  
  2820  	return nil
  2821  }
  2822  
  2823  // String returns a readable string representation of a Store_Forget_Args
  2824  // struct.
  2825  func (v *Store_Forget_Args) String() string {
  2826  	if v == nil {
  2827  		return "<nil>"
  2828  	}
  2829  
  2830  	var fields [1]string
  2831  	i := 0
  2832  	if v.Key != nil {
  2833  		fields[i] = fmt.Sprintf("Key: %v", *(v.Key))
  2834  		i++
  2835  	}
  2836  
  2837  	return fmt.Sprintf("Store_Forget_Args{%v}", strings.Join(fields[:i], ", "))
  2838  }
  2839  
  2840  // Equals returns true if all the fields of this Store_Forget_Args match the
  2841  // provided Store_Forget_Args.
  2842  //
  2843  // This function performs a deep comparison.
  2844  func (v *Store_Forget_Args) Equals(rhs *Store_Forget_Args) bool {
  2845  	if v == nil {
  2846  		return rhs == nil
  2847  	} else if rhs == nil {
  2848  		return false
  2849  	}
  2850  	if !_String_EqualsPtr(v.Key, rhs.Key) {
  2851  		return false
  2852  	}
  2853  
  2854  	return true
  2855  }
  2856  
  2857  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
  2858  // fast logging of Store_Forget_Args.
  2859  func (v *Store_Forget_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
  2860  	if v == nil {
  2861  		return nil
  2862  	}
  2863  	if v.Key != nil {
  2864  		enc.AddString("key", *v.Key)
  2865  	}
  2866  	return err
  2867  }
  2868  
  2869  // GetKey returns the value of Key if it is set or its
  2870  // zero value if it is unset.
  2871  func (v *Store_Forget_Args) GetKey() (o string) {
  2872  	if v != nil && v.Key != nil {
  2873  		return *v.Key
  2874  	}
  2875  
  2876  	return
  2877  }
  2878  
  2879  // IsSetKey returns true if Key is not nil.
  2880  func (v *Store_Forget_Args) IsSetKey() bool {
  2881  	return v != nil && v.Key != nil
  2882  }
  2883  
  2884  // MethodName returns the name of the Thrift function as specified in
  2885  // the IDL, for which this struct represent the arguments.
  2886  //
  2887  // This will always be "forget" for this struct.
  2888  func (v *Store_Forget_Args) MethodName() string {
  2889  	return "forget"
  2890  }
  2891  
  2892  // EnvelopeType returns the kind of value inside this struct.
  2893  //
  2894  // This will always be OneWay for this struct.
  2895  func (v *Store_Forget_Args) EnvelopeType() wire.EnvelopeType {
  2896  	return wire.OneWay
  2897  }
  2898  
  2899  // Store_Forget_Helper provides functions that aid in handling the
  2900  // parameters and return values of the Store.forget
  2901  // function.
  2902  var Store_Forget_Helper = struct {
  2903  	// Args accepts the parameters of forget in-order and returns
  2904  	// the arguments struct for the function.
  2905  	Args func(
  2906  		key *string,
  2907  	) *Store_Forget_Args
  2908  }{}
  2909  
  2910  func init() {
  2911  	Store_Forget_Helper.Args = func(
  2912  		key *string,
  2913  	) *Store_Forget_Args {
  2914  		return &Store_Forget_Args{
  2915  			Key: key,
  2916  		}
  2917  	}
  2918  
  2919  }
  2920  
  2921  // Store_Increment_Args represents the arguments for the Store.increment function.
  2922  //
  2923  // The arguments for increment are sent and received over the wire as this struct.
  2924  type Store_Increment_Args struct {
  2925  	Key   *string `json:"key,omitempty"`
  2926  	Value *int64  `json:"value,omitempty"`
  2927  }
  2928  
  2929  // ToWire translates a Store_Increment_Args struct into a Thrift-level intermediate
  2930  // representation. This intermediate representation may be serialized
  2931  // into bytes using a ThriftRW protocol implementation.
  2932  //
  2933  // An error is returned if the struct or any of its fields failed to
  2934  // validate.
  2935  //
  2936  //   x, err := v.ToWire()
  2937  //   if err != nil {
  2938  //     return err
  2939  //   }
  2940  //
  2941  //   if err := binaryProtocol.Encode(x, writer); err != nil {
  2942  //     return err
  2943  //   }
  2944  func (v *Store_Increment_Args) ToWire() (wire.Value, error) {
  2945  	var (
  2946  		fields [2]wire.Field
  2947  		i      int = 0
  2948  		w      wire.Value
  2949  		err    error
  2950  	)
  2951  
  2952  	if v.Key != nil {
  2953  		w, err = wire.NewValueString(*(v.Key)), error(nil)
  2954  		if err != nil {
  2955  			return w, err
  2956  		}
  2957  		fields[i] = wire.Field{ID: 1, Value: w}
  2958  		i++
  2959  	}
  2960  	if v.Value != nil {
  2961  		w, err = wire.NewValueI64(*(v.Value)), error(nil)
  2962  		if err != nil {
  2963  			return w, err
  2964  		}
  2965  		fields[i] = wire.Field{ID: 2, Value: w}
  2966  		i++
  2967  	}
  2968  
  2969  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
  2970  }
  2971  
  2972  // FromWire deserializes a Store_Increment_Args struct from its Thrift-level
  2973  // representation. The Thrift-level representation may be obtained
  2974  // from a ThriftRW protocol implementation.
  2975  //
  2976  // An error is returned if we were unable to build a Store_Increment_Args struct
  2977  // from the provided intermediate representation.
  2978  //
  2979  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
  2980  //   if err != nil {
  2981  //     return nil, err
  2982  //   }
  2983  //
  2984  //   var v Store_Increment_Args
  2985  //   if err := v.FromWire(x); err != nil {
  2986  //     return nil, err
  2987  //   }
  2988  //   return &v, nil
  2989  func (v *Store_Increment_Args) FromWire(w wire.Value) error {
  2990  	var err error
  2991  
  2992  	for _, field := range w.GetStruct().Fields {
  2993  		switch field.ID {
  2994  		case 1:
  2995  			if field.Value.Type() == wire.TBinary {
  2996  				var x string
  2997  				x, err = field.Value.GetString(), error(nil)
  2998  				v.Key = &x
  2999  				if err != nil {
  3000  					return err
  3001  				}
  3002  
  3003  			}
  3004  		case 2:
  3005  			if field.Value.Type() == wire.TI64 {
  3006  				var x int64
  3007  				x, err = field.Value.GetI64(), error(nil)
  3008  				v.Value = &x
  3009  				if err != nil {
  3010  					return err
  3011  				}
  3012  
  3013  			}
  3014  		}
  3015  	}
  3016  
  3017  	return nil
  3018  }
  3019  
  3020  // Encode serializes a Store_Increment_Args struct directly into bytes, without going
  3021  // through an intermediary type.
  3022  //
  3023  // An error is returned if a Store_Increment_Args struct could not be encoded.
  3024  func (v *Store_Increment_Args) Encode(sw stream.Writer) error {
  3025  	if err := sw.WriteStructBegin(); err != nil {
  3026  		return err
  3027  	}
  3028  
  3029  	if v.Key != nil {
  3030  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TBinary}); err != nil {
  3031  			return err
  3032  		}
  3033  		if err := sw.WriteString(*(v.Key)); err != nil {
  3034  			return err
  3035  		}
  3036  		if err := sw.WriteFieldEnd(); err != nil {
  3037  			return err
  3038  		}
  3039  	}
  3040  
  3041  	if v.Value != nil {
  3042  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TI64}); err != nil {
  3043  			return err
  3044  		}
  3045  		if err := sw.WriteInt64(*(v.Value)); err != nil {
  3046  			return err
  3047  		}
  3048  		if err := sw.WriteFieldEnd(); err != nil {
  3049  			return err
  3050  		}
  3051  	}
  3052  
  3053  	return sw.WriteStructEnd()
  3054  }
  3055  
  3056  // Decode deserializes a Store_Increment_Args struct directly from its Thrift-level
  3057  // representation, without going through an intemediary type.
  3058  //
  3059  // An error is returned if a Store_Increment_Args struct could not be generated from the wire
  3060  // representation.
  3061  func (v *Store_Increment_Args) Decode(sr stream.Reader) error {
  3062  
  3063  	if err := sr.ReadStructBegin(); err != nil {
  3064  		return err
  3065  	}
  3066  
  3067  	fh, ok, err := sr.ReadFieldBegin()
  3068  	if err != nil {
  3069  		return err
  3070  	}
  3071  
  3072  	for ok {
  3073  		switch {
  3074  		case fh.ID == 1 && fh.Type == wire.TBinary:
  3075  			var x string
  3076  			x, err = sr.ReadString()
  3077  			v.Key = &x
  3078  			if err != nil {
  3079  				return err
  3080  			}
  3081  
  3082  		case fh.ID == 2 && fh.Type == wire.TI64:
  3083  			var x int64
  3084  			x, err = sr.ReadInt64()
  3085  			v.Value = &x
  3086  			if err != nil {
  3087  				return err
  3088  			}
  3089  
  3090  		default:
  3091  			if err := sr.Skip(fh.Type); err != nil {
  3092  				return err
  3093  			}
  3094  		}
  3095  
  3096  		if err := sr.ReadFieldEnd(); err != nil {
  3097  			return err
  3098  		}
  3099  
  3100  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
  3101  			return err
  3102  		}
  3103  	}
  3104  
  3105  	if err := sr.ReadStructEnd(); err != nil {
  3106  		return err
  3107  	}
  3108  
  3109  	return nil
  3110  }
  3111  
  3112  // String returns a readable string representation of a Store_Increment_Args
  3113  // struct.
  3114  func (v *Store_Increment_Args) String() string {
  3115  	if v == nil {
  3116  		return "<nil>"
  3117  	}
  3118  
  3119  	var fields [2]string
  3120  	i := 0
  3121  	if v.Key != nil {
  3122  		fields[i] = fmt.Sprintf("Key: %v", *(v.Key))
  3123  		i++
  3124  	}
  3125  	if v.Value != nil {
  3126  		fields[i] = fmt.Sprintf("Value: %v", *(v.Value))
  3127  		i++
  3128  	}
  3129  
  3130  	return fmt.Sprintf("Store_Increment_Args{%v}", strings.Join(fields[:i], ", "))
  3131  }
  3132  
  3133  // Equals returns true if all the fields of this Store_Increment_Args match the
  3134  // provided Store_Increment_Args.
  3135  //
  3136  // This function performs a deep comparison.
  3137  func (v *Store_Increment_Args) Equals(rhs *Store_Increment_Args) bool {
  3138  	if v == nil {
  3139  		return rhs == nil
  3140  	} else if rhs == nil {
  3141  		return false
  3142  	}
  3143  	if !_String_EqualsPtr(v.Key, rhs.Key) {
  3144  		return false
  3145  	}
  3146  	if !_I64_EqualsPtr(v.Value, rhs.Value) {
  3147  		return false
  3148  	}
  3149  
  3150  	return true
  3151  }
  3152  
  3153  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
  3154  // fast logging of Store_Increment_Args.
  3155  func (v *Store_Increment_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
  3156  	if v == nil {
  3157  		return nil
  3158  	}
  3159  	if v.Key != nil {
  3160  		enc.AddString("key", *v.Key)
  3161  	}
  3162  	if v.Value != nil {
  3163  		enc.AddInt64("value", *v.Value)
  3164  	}
  3165  	return err
  3166  }
  3167  
  3168  // GetKey returns the value of Key if it is set or its
  3169  // zero value if it is unset.
  3170  func (v *Store_Increment_Args) GetKey() (o string) {
  3171  	if v != nil && v.Key != nil {
  3172  		return *v.Key
  3173  	}
  3174  
  3175  	return
  3176  }
  3177  
  3178  // IsSetKey returns true if Key is not nil.
  3179  func (v *Store_Increment_Args) IsSetKey() bool {
  3180  	return v != nil && v.Key != nil
  3181  }
  3182  
  3183  // GetValue returns the value of Value if it is set or its
  3184  // zero value if it is unset.
  3185  func (v *Store_Increment_Args) GetValue() (o int64) {
  3186  	if v != nil && v.Value != nil {
  3187  		return *v.Value
  3188  	}
  3189  
  3190  	return
  3191  }
  3192  
  3193  // IsSetValue returns true if Value is not nil.
  3194  func (v *Store_Increment_Args) IsSetValue() bool {
  3195  	return v != nil && v.Value != nil
  3196  }
  3197  
  3198  // MethodName returns the name of the Thrift function as specified in
  3199  // the IDL, for which this struct represent the arguments.
  3200  //
  3201  // This will always be "increment" for this struct.
  3202  func (v *Store_Increment_Args) MethodName() string {
  3203  	return "increment"
  3204  }
  3205  
  3206  // EnvelopeType returns the kind of value inside this struct.
  3207  //
  3208  // This will always be Call for this struct.
  3209  func (v *Store_Increment_Args) EnvelopeType() wire.EnvelopeType {
  3210  	return wire.Call
  3211  }
  3212  
  3213  // Store_Increment_Helper provides functions that aid in handling the
  3214  // parameters and return values of the Store.increment
  3215  // function.
  3216  var Store_Increment_Helper = struct {
  3217  	// Args accepts the parameters of increment in-order and returns
  3218  	// the arguments struct for the function.
  3219  	Args func(
  3220  		key *string,
  3221  		value *int64,
  3222  	) *Store_Increment_Args
  3223  
  3224  	// IsException returns true if the given error can be thrown
  3225  	// by increment.
  3226  	//
  3227  	// An error can be thrown by increment only if the
  3228  	// corresponding exception type was mentioned in the 'throws'
  3229  	// section for it in the Thrift file.
  3230  	IsException func(error) bool
  3231  
  3232  	// WrapResponse returns the result struct for increment
  3233  	// given the error returned by it. The provided error may
  3234  	// be nil if increment did not fail.
  3235  	//
  3236  	// This allows mapping errors returned by increment into a
  3237  	// serializable result struct. WrapResponse returns a
  3238  	// non-nil error if the provided error cannot be thrown by
  3239  	// increment
  3240  	//
  3241  	//   err := increment(args)
  3242  	//   result, err := Store_Increment_Helper.WrapResponse(err)
  3243  	//   if err != nil {
  3244  	//     return fmt.Errorf("unexpected error from increment: %v", err)
  3245  	//   }
  3246  	//   serialize(result)
  3247  	WrapResponse func(error) (*Store_Increment_Result, error)
  3248  
  3249  	// UnwrapResponse takes the result struct for increment
  3250  	// and returns the erorr returned by it (if any).
  3251  	//
  3252  	// The error is non-nil only if increment threw an
  3253  	// exception.
  3254  	//
  3255  	//   result := deserialize(bytes)
  3256  	//   err := Store_Increment_Helper.UnwrapResponse(result)
  3257  	UnwrapResponse func(*Store_Increment_Result) error
  3258  }{}
  3259  
  3260  func init() {
  3261  	Store_Increment_Helper.Args = func(
  3262  		key *string,
  3263  		value *int64,
  3264  	) *Store_Increment_Args {
  3265  		return &Store_Increment_Args{
  3266  			Key:   key,
  3267  			Value: value,
  3268  		}
  3269  	}
  3270  
  3271  	Store_Increment_Helper.IsException = func(err error) bool {
  3272  		switch err.(type) {
  3273  		default:
  3274  			return false
  3275  		}
  3276  	}
  3277  
  3278  	Store_Increment_Helper.WrapResponse = func(err error) (*Store_Increment_Result, error) {
  3279  		if err == nil {
  3280  			return &Store_Increment_Result{}, nil
  3281  		}
  3282  
  3283  		return nil, err
  3284  	}
  3285  	Store_Increment_Helper.UnwrapResponse = func(result *Store_Increment_Result) (err error) {
  3286  		return
  3287  	}
  3288  
  3289  }
  3290  
  3291  // Store_Increment_Result represents the result of a Store.increment function call.
  3292  //
  3293  // The result of a increment execution is sent and received over the wire as this struct.
  3294  type Store_Increment_Result struct {
  3295  }
  3296  
  3297  // ToWire translates a Store_Increment_Result struct into a Thrift-level intermediate
  3298  // representation. This intermediate representation may be serialized
  3299  // into bytes using a ThriftRW protocol implementation.
  3300  //
  3301  // An error is returned if the struct or any of its fields failed to
  3302  // validate.
  3303  //
  3304  //   x, err := v.ToWire()
  3305  //   if err != nil {
  3306  //     return err
  3307  //   }
  3308  //
  3309  //   if err := binaryProtocol.Encode(x, writer); err != nil {
  3310  //     return err
  3311  //   }
  3312  func (v *Store_Increment_Result) ToWire() (wire.Value, error) {
  3313  	var (
  3314  		fields [0]wire.Field
  3315  		i      int = 0
  3316  	)
  3317  
  3318  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
  3319  }
  3320  
  3321  // FromWire deserializes a Store_Increment_Result struct from its Thrift-level
  3322  // representation. The Thrift-level representation may be obtained
  3323  // from a ThriftRW protocol implementation.
  3324  //
  3325  // An error is returned if we were unable to build a Store_Increment_Result struct
  3326  // from the provided intermediate representation.
  3327  //
  3328  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
  3329  //   if err != nil {
  3330  //     return nil, err
  3331  //   }
  3332  //
  3333  //   var v Store_Increment_Result
  3334  //   if err := v.FromWire(x); err != nil {
  3335  //     return nil, err
  3336  //   }
  3337  //   return &v, nil
  3338  func (v *Store_Increment_Result) FromWire(w wire.Value) error {
  3339  
  3340  	for _, field := range w.GetStruct().Fields {
  3341  		switch field.ID {
  3342  		}
  3343  	}
  3344  
  3345  	return nil
  3346  }
  3347  
  3348  // Encode serializes a Store_Increment_Result struct directly into bytes, without going
  3349  // through an intermediary type.
  3350  //
  3351  // An error is returned if a Store_Increment_Result struct could not be encoded.
  3352  func (v *Store_Increment_Result) Encode(sw stream.Writer) error {
  3353  	if err := sw.WriteStructBegin(); err != nil {
  3354  		return err
  3355  	}
  3356  
  3357  	return sw.WriteStructEnd()
  3358  }
  3359  
  3360  // Decode deserializes a Store_Increment_Result struct directly from its Thrift-level
  3361  // representation, without going through an intemediary type.
  3362  //
  3363  // An error is returned if a Store_Increment_Result struct could not be generated from the wire
  3364  // representation.
  3365  func (v *Store_Increment_Result) Decode(sr stream.Reader) error {
  3366  
  3367  	if err := sr.ReadStructBegin(); err != nil {
  3368  		return err
  3369  	}
  3370  
  3371  	fh, ok, err := sr.ReadFieldBegin()
  3372  	if err != nil {
  3373  		return err
  3374  	}
  3375  
  3376  	for ok {
  3377  		switch {
  3378  		default:
  3379  			if err := sr.Skip(fh.Type); err != nil {
  3380  				return err
  3381  			}
  3382  		}
  3383  
  3384  		if err := sr.ReadFieldEnd(); err != nil {
  3385  			return err
  3386  		}
  3387  
  3388  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
  3389  			return err
  3390  		}
  3391  	}
  3392  
  3393  	if err := sr.ReadStructEnd(); err != nil {
  3394  		return err
  3395  	}
  3396  
  3397  	return nil
  3398  }
  3399  
  3400  // String returns a readable string representation of a Store_Increment_Result
  3401  // struct.
  3402  func (v *Store_Increment_Result) String() string {
  3403  	if v == nil {
  3404  		return "<nil>"
  3405  	}
  3406  
  3407  	var fields [0]string
  3408  	i := 0
  3409  
  3410  	return fmt.Sprintf("Store_Increment_Result{%v}", strings.Join(fields[:i], ", "))
  3411  }
  3412  
  3413  // Equals returns true if all the fields of this Store_Increment_Result match the
  3414  // provided Store_Increment_Result.
  3415  //
  3416  // This function performs a deep comparison.
  3417  func (v *Store_Increment_Result) Equals(rhs *Store_Increment_Result) bool {
  3418  	if v == nil {
  3419  		return rhs == nil
  3420  	} else if rhs == nil {
  3421  		return false
  3422  	}
  3423  
  3424  	return true
  3425  }
  3426  
  3427  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
  3428  // fast logging of Store_Increment_Result.
  3429  func (v *Store_Increment_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
  3430  	if v == nil {
  3431  		return nil
  3432  	}
  3433  	return err
  3434  }
  3435  
  3436  // MethodName returns the name of the Thrift function as specified in
  3437  // the IDL, for which this struct represent the result.
  3438  //
  3439  // This will always be "increment" for this struct.
  3440  func (v *Store_Increment_Result) MethodName() string {
  3441  	return "increment"
  3442  }
  3443  
  3444  // EnvelopeType returns the kind of value inside this struct.
  3445  //
  3446  // This will always be Reply for this struct.
  3447  func (v *Store_Increment_Result) EnvelopeType() wire.EnvelopeType {
  3448  	return wire.Reply
  3449  }