From fe247ea141fd8adb59c9bc72bee86134ea8b6e57 Mon Sep 17 00:00:00 2001 From: Khosrow Afroozeh Date: Thu, 11 Jun 2015 11:51:57 +0200 Subject: [PATCH] Convert Statement.TaskId to uint64 --- execute_task.go | 4 ++-- statement.go | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/execute_task.go b/execute_task.go index a6619247..5c4570ee 100644 --- a/execute_task.go +++ b/execute_task.go @@ -25,7 +25,7 @@ import ( type ExecuteTask struct { *BaseTask - taskId int64 + taskId uint64 scan bool } @@ -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 { diff --git a/statement.go b/statement.go index a1631a43..bc9b6299 100644 --- a/statement.go +++ b/statement.go @@ -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 { @@ -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 @@ -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()), } } @@ -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()) } }