Browse Source

add support for v3 batch

Chris Bannister 10 years ago
parent
commit
0a4bd71b3b
1 changed files with 5 additions and 1 deletions
  1. 5 1
      conn.go

+ 5 - 1
conn.go

@@ -586,7 +586,7 @@ func (c *Conn) executeBatch(batch *Batch) error {
 	if c.version == protoVersion1 {
 	if c.version == protoVersion1 {
 		return ErrUnsupported
 		return ErrUnsupported
 	}
 	}
-	f := make(frame, headerProtoSize[c.version], defaultFrameSize)
+	f := newFrame(c.version)
 	f.setHeader(c.version, 0, 0, opBatch)
 	f.setHeader(c.version, 0, 0, opBatch)
 	f.writeByte(byte(batch.Type))
 	f.writeByte(byte(batch.Type))
 	f.writeShort(uint16(len(batch.Entries)))
 	f.writeShort(uint16(len(batch.Entries)))
@@ -634,6 +634,10 @@ func (c *Conn) executeBatch(batch *Batch) error {
 		}
 		}
 	}
 	}
 	f.writeConsistency(batch.Cons)
 	f.writeConsistency(batch.Cons)
+	if c.version >= protoVersion3 {
+		// TODO: add support for flags here
+		f.writeByte(0)
+	}
 
 
 	resp, err := c.exec(f, nil)
 	resp, err := c.exec(f, nil)
 	if err != nil {
 	if err != nil {