Skip to content

Commit 6268b4d

Browse files
committed
Adding interface methods for setting Idempotency and SpeculativeRetryPolicy on the underlying gocql query
1 parent dc709a2 commit 6268b4d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package gocql
22

33
import (
44
"context"
5+
6+
"github.com/gocql/gocql"
57
)
68

79
// Note: this file defines the minimal interface that is needed by Temporal's cassandra
@@ -34,6 +36,8 @@ type (
3436
WithTimestamp(int64) Query
3537
Consistency(Consistency) Query
3638
Bind(...interface{}) Query
39+
Idempotent(bool) Query
40+
SetSpeculativeExecutionPolicy(SpeculativeExecutionPolicy) Query
3741
}
3842

3943
// Iter is the interface for executing and iterating over all resulting rows.
@@ -52,4 +56,7 @@ type (
5256

5357
// SerialConsistency is the serial consistency level used by a Query
5458
SerialConsistency uint16
59+
60+
// SpeculativeExecutionPolicy is a gocql SpeculativeExecutionPolicy
61+
SpeculativeExecutionPolicy gocql.SpeculativeExecutionPolicy
5562
)

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,11 @@ func (q *query) Bind(v ...interface{}) Query {
100100
q.gocqlQuery.Bind(v...)
101101
return newQuery(q.session, q.gocqlQuery)
102102
}
103+
104+
func (q *query) Idempotent(value bool) Query {
105+
return newQuery(q.session, q.gocqlQuery.Idempotent(value))
106+
}
107+
108+
func (q *query) SetSpeculativeExecutionPolicy(policy SpeculativeExecutionPolicy) Query {
109+
return newQuery(q.session, q.gocqlQuery.SetSpeculativeExecutionPolicy(policy))
110+
}

0 commit comments

Comments
 (0)