Skip to content

Commit f6cf4db

Browse files
committed
Adding SpeculativeExecutionPolicy and SetIdempotent methods in Batch object
1 parent 6268b4d commit f6cf4db

File tree

1 file changed

+11
-0
lines changed
  • common/persistence/nosql/nosqlplugin/cassandra/gocql

1 file changed

+11
-0
lines changed

common/persistence/nosql/nosqlplugin/cassandra/gocql/batch.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ func (b *Batch) WithTimestamp(timestamp int64) *Batch {
4545
return newBatch(b.session, b.gocqlBatch)
4646
}
4747

48+
func (b *Batch) SpeculativeExecutionPolicy(sp SpeculativeExecutionPolicy) *Batch {
49+
return newBatch(b.session, b.gocqlBatch.SpeculativeExecutionPolicy(sp))
50+
}
51+
52+
func (b *Batch) SetIdempotent() *Batch {
53+
for i := range b.gocqlBatch.Entries {
54+
b.gocqlBatch.Entries[i].Idempotent = true
55+
}
56+
return newBatch(b.session, b.gocqlBatch)
57+
}
58+
4859
func mustConvertBatchType(batchType BatchType) gocql.BatchType {
4960
switch batchType {
5061
case LoggedBatch:

0 commit comments

Comments
 (0)