Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Rebuilt Cassandra Go bindings from new thrift4go. #2

Merged
merged 1 commit into from

2 participants

@matttproud

Hello Carlos,

I have been working with Aalok Shah (pomack on github) to revamp the
Go code generation for Thrift. I had been motivated by some
anomalies in the generated code for Cassandra when using Gossie.
Now, I would like to start backporting some of the generated fixes.

This snapshot is rebuilt Cassandra 1.0.11 with thrift4go at
matttproud/thrift4go@600e491.

I have also been working with upstream Thrift developers to get these changes rebased/incorporated back into
Thrift base. I will have you know that–to the best of my knowledge from verifying code trees–no additional deviations have occurred in upstream Go support for Thrift.

@matttproud matttproud Rebuilt Cassandra Go bindings from new thrift4go.
I have been working with Aalok Shah (pomack on github) to revamp the
Go code generation for Thrift.  I had been motivated by some
anomalies in the generated code for Cassandra when using Gossie.
Now, I would like to start backporting some of the generated fixes.

This snapshot is rebuilt Cassandra 1.0.11 with thrift4go at
matttproud/thrift4go@600e491.
0fcdc12
@carloscm carloscm merged commit 0fcdc12 into from
@carloscm
Owner

Looks good and passes the test, I've merged it.

Good work on thrift4go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 3, 2012
  1. @matttproud

    Rebuilt Cassandra Go bindings from new thrift4go.

    matttproud authored
    I have been working with Aalok Shah (pomack on github) to revamp the
    Go code generation for Thrift.  I had been motivated by some
    anomalies in the generated code for Cassandra when using Gossie.
    Now, I would like to start backporting some of the generated fixes.
    
    This snapshot is rebuilt Cassandra 1.0.11 with thrift4go at
    matttproud/thrift4go@600e491.
This page is out of date. Refresh to see the latest.
Showing with 296 additions and 180 deletions.
  1. +234 −144 src/cassandra/Cassandra.go
  2. +62 −36 src/cassandra/ttypes.go
View
378 src/cassandra/Cassandra.go
@@ -1,4 +1,4 @@
-/* Autogenerated by Thrift Compiler (0.7.0-dev)
+/* Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
@@ -7,8 +7,19 @@ package cassandra
import (
"fmt"
"github.com/pomack/thrift4go/lib/go/src/thrift"
+ "math"
)
+// This is a temporary safety measure to ensure that the `math'
+// import does not trip up any generated output that may not
+// happen to use the math import due to not having emited enums.
+//
+// Future clean-ups will deprecate the need for this.
+func init() {
+ var temporaryAndUnused int32 = math.MinInt32
+ temporaryAndUnused++
+}
+
type ICassandra interface {
/**
* Parameters:
@@ -4735,6 +4746,10 @@ func NewGetArgs() *GetArgs {
return output
}
+func (p *GetArgs) IsSetConsistencyLevel() bool {
+ return int64(p.ConsistencyLevel) != math.MinInt32-1
+}
+
func (p *GetArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -4937,17 +4952,19 @@ func (p *GetArgs) WriteFieldColumnPath(oprot thrift.TProtocol) thrift.TProtocolE
}
func (p *GetArgs) WriteField3(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 3)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(3, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.ConsistencyLevel))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(3, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(3, "consistency_level", p.ThriftName(), err)
+ if p.IsSetConsistencyLevel() {
+ err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 3)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(3, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.ConsistencyLevel))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(3, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(3, "consistency_level", p.ThriftName(), err)
+ }
}
return err
}
@@ -5457,6 +5474,10 @@ func NewGetSliceArgs() *GetSliceArgs {
return output
}
+func (p *GetSliceArgs) IsSetConsistencyLevel() bool {
+ return int64(p.ConsistencyLevel) != math.MinInt32-1
+}
+
func (p *GetSliceArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -5715,17 +5736,19 @@ func (p *GetSliceArgs) WriteFieldPredicate(oprot thrift.TProtocol) thrift.TProto
}
func (p *GetSliceArgs) WriteField4(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.ConsistencyLevel))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ if p.IsSetConsistencyLevel() {
+ err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.ConsistencyLevel))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
}
return err
}
@@ -6199,6 +6222,10 @@ func NewGetCountArgs() *GetCountArgs {
return output
}
+func (p *GetCountArgs) IsSetConsistencyLevel() bool {
+ return int64(p.ConsistencyLevel) != math.MinInt32-1
+}
+
func (p *GetCountArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -6457,17 +6484,19 @@ func (p *GetCountArgs) WriteFieldPredicate(oprot thrift.TProtocol) thrift.TProto
}
func (p *GetCountArgs) WriteField4(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.ConsistencyLevel))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ if p.IsSetConsistencyLevel() {
+ err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.ConsistencyLevel))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
}
return err
}
@@ -6916,6 +6945,10 @@ func NewMultigetSliceArgs() *MultigetSliceArgs {
return output
}
+func (p *MultigetSliceArgs) IsSetConsistencyLevel() bool {
+ return int64(p.ConsistencyLevel) != math.MinInt32-1
+}
+
func (p *MultigetSliceArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -7197,17 +7230,19 @@ func (p *MultigetSliceArgs) WriteFieldPredicate(oprot thrift.TProtocol) thrift.T
}
func (p *MultigetSliceArgs) WriteField4(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.ConsistencyLevel))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ if p.IsSetConsistencyLevel() {
+ err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.ConsistencyLevel))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
}
return err
}
@@ -7713,6 +7748,10 @@ func NewMultigetCountArgs() *MultigetCountArgs {
return output
}
+func (p *MultigetCountArgs) IsSetConsistencyLevel() bool {
+ return int64(p.ConsistencyLevel) != math.MinInt32-1
+}
+
func (p *MultigetCountArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -7994,17 +8033,19 @@ func (p *MultigetCountArgs) WriteFieldPredicate(oprot thrift.TProtocol) thrift.T
}
func (p *MultigetCountArgs) WriteField4(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.ConsistencyLevel))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ if p.IsSetConsistencyLevel() {
+ err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.ConsistencyLevel))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
}
return err
}
@@ -8487,6 +8528,10 @@ func NewGetRangeSlicesArgs() *GetRangeSlicesArgs {
return output
}
+func (p *GetRangeSlicesArgs) IsSetConsistencyLevel() bool {
+ return int64(p.ConsistencyLevel) != math.MinInt32-1
+}
+
func (p *GetRangeSlicesArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -8745,17 +8790,19 @@ func (p *GetRangeSlicesArgs) WriteFieldRange(oprot thrift.TProtocol) thrift.TPro
}
func (p *GetRangeSlicesArgs) WriteField4(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.ConsistencyLevel))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ if p.IsSetConsistencyLevel() {
+ err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.ConsistencyLevel))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
}
return err
}
@@ -9229,6 +9276,10 @@ func NewGetIndexedSlicesArgs() *GetIndexedSlicesArgs {
return output
}
+func (p *GetIndexedSlicesArgs) IsSetConsistencyLevel() bool {
+ return int64(p.ConsistencyLevel) != math.MinInt32-1
+}
+
func (p *GetIndexedSlicesArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -9487,17 +9538,19 @@ func (p *GetIndexedSlicesArgs) WriteFieldColumnPredicate(oprot thrift.TProtocol)
}
func (p *GetIndexedSlicesArgs) WriteField4(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.ConsistencyLevel))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ if p.IsSetConsistencyLevel() {
+ err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.ConsistencyLevel))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
}
return err
}
@@ -9971,6 +10024,10 @@ func NewInsertArgs() *InsertArgs {
return output
}
+func (p *InsertArgs) IsSetConsistencyLevel() bool {
+ return int64(p.ConsistencyLevel) != math.MinInt32-1
+}
+
func (p *InsertArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -10229,17 +10286,19 @@ func (p *InsertArgs) WriteFieldColumn(oprot thrift.TProtocol) thrift.TProtocolEx
}
func (p *InsertArgs) WriteField4(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.ConsistencyLevel))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ if p.IsSetConsistencyLevel() {
+ err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.ConsistencyLevel))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
}
return err
}
@@ -10628,6 +10687,10 @@ func NewAddArgs() *AddArgs {
return output
}
+func (p *AddArgs) IsSetConsistencyLevel() bool {
+ return int64(p.ConsistencyLevel) != math.MinInt32-1
+}
+
func (p *AddArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -10886,17 +10949,19 @@ func (p *AddArgs) WriteFieldColumn(oprot thrift.TProtocol) thrift.TProtocolExcep
}
func (p *AddArgs) WriteField4(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.ConsistencyLevel))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ if p.IsSetConsistencyLevel() {
+ err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.ConsistencyLevel))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
}
return err
}
@@ -11285,6 +11350,10 @@ func NewRemoveArgs() *RemoveArgs {
return output
}
+func (p *RemoveArgs) IsSetConsistencyLevel() bool {
+ return int64(p.ConsistencyLevel) != math.MinInt32-1
+}
+
func (p *RemoveArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -11541,17 +11610,19 @@ func (p *RemoveArgs) WriteFieldTimestamp(oprot thrift.TProtocol) thrift.TProtoco
}
func (p *RemoveArgs) WriteField4(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.ConsistencyLevel))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ if p.IsSetConsistencyLevel() {
+ err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 4)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.ConsistencyLevel))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(4, "consistency_level", p.ThriftName(), err)
+ }
}
return err
}
@@ -11937,6 +12008,10 @@ func NewRemoveCounterArgs() *RemoveCounterArgs {
return output
}
+func (p *RemoveCounterArgs) IsSetConsistencyLevel() bool {
+ return int64(p.ConsistencyLevel) != math.MinInt32-1
+}
+
func (p *RemoveCounterArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -12139,17 +12214,19 @@ func (p *RemoveCounterArgs) WriteFieldPath(oprot thrift.TProtocol) thrift.TProto
}
func (p *RemoveCounterArgs) WriteField3(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 3)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(3, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.ConsistencyLevel))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(3, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(3, "consistency_level", p.ThriftName(), err)
+ if p.IsSetConsistencyLevel() {
+ err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 3)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(3, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.ConsistencyLevel))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(3, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(3, "consistency_level", p.ThriftName(), err)
+ }
}
return err
}
@@ -12529,6 +12606,10 @@ func NewBatchMutateArgs() *BatchMutateArgs {
return output
}
+func (p *BatchMutateArgs) IsSetConsistencyLevel() bool {
+ return int64(p.ConsistencyLevel) != math.MinInt32-1
+}
+
func (p *BatchMutateArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -12762,17 +12843,19 @@ func (p *BatchMutateArgs) WriteFieldMutationMap(oprot thrift.TProtocol) thrift.T
}
func (p *BatchMutateArgs) WriteField2(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 2)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(2, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.ConsistencyLevel))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(2, "consistency_level", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(2, "consistency_level", p.ThriftName(), err)
+ if p.IsSetConsistencyLevel() {
+ err = oprot.WriteFieldBegin("consistency_level", thrift.I32, 2)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(2, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.ConsistencyLevel))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(2, "consistency_level", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(2, "consistency_level", p.ThriftName(), err)
+ }
}
return err
}
@@ -19748,10 +19831,15 @@ func NewExecuteCqlQueryArgs() *ExecuteCqlQueryArgs {
}),
}
{
+ output.Compression = math.MinInt32 - 1
}
return output
}
+func (p *ExecuteCqlQueryArgs) IsSetCompression() bool {
+ return int64(p.Compression) != math.MinInt32-1
+}
+
func (p *ExecuteCqlQueryArgs) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -19898,17 +19986,19 @@ func (p *ExecuteCqlQueryArgs) WriteFieldQuery(oprot thrift.TProtocol) thrift.TPr
}
func (p *ExecuteCqlQueryArgs) WriteField2(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("compression", thrift.I32, 2)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(2, "compression", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.Compression))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(2, "compression", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(2, "compression", p.ThriftName(), err)
+ if p.IsSetCompression() {
+ err = oprot.WriteFieldBegin("compression", thrift.I32, 2)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(2, "compression", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.Compression))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(2, "compression", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(2, "compression", p.ThriftName(), err)
+ }
}
return err
}
View
98 src/cassandra/ttypes.go
@@ -1,4 +1,4 @@
-/* Autogenerated by Thrift Compiler (0.7.0-dev)
+/* Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
@@ -7,8 +7,19 @@ package cassandra
import (
"fmt"
"github.com/pomack/thrift4go/lib/go/src/thrift"
+ "math"
)
+// This is a temporary safety measure to ensure that the `math'
+// import does not trip up any generated output that may not
+// happen to use the math import due to not having emited enums.
+//
+// Future clean-ups will deprecate the need for this.
+func init() {
+ var temporaryAndUnused int32 = math.MinInt32
+ temporaryAndUnused++
+}
+
/**
*The ConsistencyLevel is an enum that controls both read and write
*behavior based on the ReplicationFactor of the keyspace. The
@@ -51,7 +62,7 @@ import (
* EACH_QUORUM Returns the record with the most recent timestamp once a majority of replicas within each datacenter have replied.
* ALL Returns the record with the most recent timestamp once all replicas have replied (implies no replica may be down)..
*/
-type ConsistencyLevel int
+type ConsistencyLevel int64
const (
ONE ConsistencyLevel = 1
@@ -83,7 +94,7 @@ func (p ConsistencyLevel) String() string {
case THREE:
return "THREE"
}
- return ""
+ return "<UNSET>"
}
func FromConsistencyLevelString(s string) ConsistencyLevel {
@@ -116,7 +127,7 @@ func (p ConsistencyLevel) IsEnum() bool {
return true
}
-type IndexOperator int
+type IndexOperator int64
const (
EQ IndexOperator = 0
@@ -139,7 +150,7 @@ func (p IndexOperator) String() string {
case LT:
return "LT"
}
- return ""
+ return "<UNSET>"
}
func FromIndexOperatorString(s string) IndexOperator {
@@ -166,7 +177,7 @@ func (p IndexOperator) IsEnum() bool {
return true
}
-type IndexType int
+type IndexType int64
const (
KEYS IndexType = 0
@@ -180,7 +191,7 @@ func (p IndexType) String() string {
case CUSTOM:
return "CUSTOM"
}
- return ""
+ return "<UNSET>"
}
func FromIndexTypeString(s string) IndexType {
@@ -204,7 +215,7 @@ func (p IndexType) IsEnum() bool {
/**
*CQL query compression
*/
-type Compression int
+type Compression int64
const (
GZIP Compression = 1
@@ -218,7 +229,7 @@ func (p Compression) String() string {
case NONE:
return "NONE"
}
- return ""
+ return "<UNSET>"
}
func FromCompressionString(s string) Compression {
@@ -239,7 +250,7 @@ func (p Compression) IsEnum() bool {
return true
}
-type CqlResultType int
+type CqlResultType int64
const (
ROWS CqlResultType = 1
@@ -256,7 +267,7 @@ func (p CqlResultType) String() string {
case INT:
return "INT"
}
- return ""
+ return "<UNSET>"
}
func FromCqlResultTypeString(s string) CqlResultType {
@@ -279,8 +290,6 @@ func (p CqlResultType) IsEnum() bool {
return true
}
-const VERSION = "19.20.0"
-
/**
* Basic unit of data within a ColumnFamily.
* @param name, the name by which this column is set and retrieved. Maximum 64KB long.
@@ -3998,10 +4007,15 @@ func NewIndexExpression() *IndexExpression {
}),
}
{
+ output.Op = math.MinInt32 - 1
}
return output
}
+func (p *IndexExpression) IsSetOp() bool {
+ return int64(p.Op) != math.MinInt32-1
+}
+
func (p *IndexExpression) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
_, err = iprot.ReadStructBegin()
if err != nil {
@@ -4182,17 +4196,19 @@ func (p *IndexExpression) WriteFieldColumnName(oprot thrift.TProtocol) thrift.TP
}
func (p *IndexExpression) WriteField2(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("op", thrift.I32, 2)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(2, "op", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.Op))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(2, "op", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(2, "op", p.ThriftName(), err)
+ if p.IsSetOp() {
+ err = oprot.WriteFieldBegin("op", thrift.I32, 2)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(2, "op", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.Op))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(2, "op", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(2, "op", p.ThriftName(), err)
+ }
}
return err
}
@@ -7137,12 +7153,13 @@ func NewColumnDef() *ColumnDef {
}),
}
{
+ output.IndexType = math.MinInt32 - 1
}
return output
}
func (p *ColumnDef) IsSetIndexType() bool {
- return int64(p.IndexType) != 0
+ return int64(p.IndexType) != math.MinInt32-1
}
func (p *ColumnDef) IsSetIndexName() bool {
@@ -10814,10 +10831,15 @@ func NewCqlResult() *CqlResult {
}),
}
{
+ output.TypeA1 = math.MinInt32 - 1
}
return output
}
+func (p *CqlResult) IsSetTypeA1() bool {
+ return int64(p.TypeA1) != math.MinInt32-1
+}
+
func (p *CqlResult) IsSetRows() bool {
return p.Rows != nil && p.Rows.Len() > 0
}
@@ -11034,17 +11056,19 @@ func (p *CqlResult) Write(oprot thrift.TProtocol) (err thrift.TProtocolException
}
func (p *CqlResult) WriteField1(oprot thrift.TProtocol) (err thrift.TProtocolException) {
- err = oprot.WriteFieldBegin("type", thrift.I32, 1)
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(1, "type", p.ThriftName(), err)
- }
- err = oprot.WriteI32(int32(p.TypeA1))
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(1, "type", p.ThriftName(), err)
- }
- err = oprot.WriteFieldEnd()
- if err != nil {
- return thrift.NewTProtocolExceptionWriteField(1, "type", p.ThriftName(), err)
+ if p.IsSetTypeA1() {
+ err = oprot.WriteFieldBegin("type", thrift.I32, 1)
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(1, "type", p.ThriftName(), err)
+ }
+ err = oprot.WriteI32(int32(p.TypeA1))
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(1, "type", p.ThriftName(), err)
+ }
+ err = oprot.WriteFieldEnd()
+ if err != nil {
+ return thrift.NewTProtocolExceptionWriteField(1, "type", p.ThriftName(), err)
+ }
}
return err
}
@@ -11185,5 +11209,7 @@ func (p *CqlResult) TStructFields() thrift.TFieldContainer {
})
}
+const VERSION = "19.20.0"
+
func init() {
}
Something went wrong with that request. Please try again.