Skip to content

Commit

Permalink
Convert Statement.TaskId to uint64
Browse files Browse the repository at this point in the history
  • Loading branch information
khaf committed Jun 11, 2015
1 parent c156751 commit fe247ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions execute_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
type ExecuteTask struct {
*BaseTask

taskId int64
taskId uint64
scan bool
}

Expand Down Expand Up @@ -64,7 +64,7 @@ func (etsk *ExecuteTask) IsDone() (bool, error) {
node.PutConnection(conn)

response := responseMap[command]
find := "job_id=" + strconv.FormatInt(etsk.taskId, 10) + ":"
find := "job_id=" + strconv.FormatUint(etsk.taskId, 10) + ":"
index := strings.Index(response, find)

if index < 0 {
Expand Down
12 changes: 4 additions & 8 deletions statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@

package aerospike

import (
"math"

xornd "github.com/aerospike/aerospike-client-go/types/rand"
)
import xornd "github.com/aerospike/aerospike-client-go/types/rand"

// Statement encapsulates query statement parameters.
type Statement struct {
Expand Down Expand Up @@ -47,7 +43,7 @@ type Statement struct {
functionArgs []Value

// TaskId determines query task id. (Optional)
TaskId int64
TaskId uint64

// determines if the query should return data
returnData bool
Expand All @@ -60,7 +56,7 @@ func NewStatement(ns string, set string, binNames ...string) *Statement {
SetName: set,
BinNames: binNames,
returnData: true,
TaskId: xornd.Int64(),
TaskId: uint64(xornd.Int64()),
}
}

Expand Down Expand Up @@ -89,6 +85,6 @@ func (stmt *Statement) IsScan() bool {
// Always set the taskId client-side to a non-zero random value
func (stmt *Statement) setTaskId() {
for stmt.TaskId == 0 {
stmt.TaskId = int64(math.Abs(float64(xornd.Int64())))
stmt.TaskId = uint64(xornd.Int64())
}
}

0 comments on commit fe247ea

Please sign in to comment.