Methods
-
info( [policy] [, callback])
Check the progress of a background job running on the database.
-
Parameters:
Name Type Argument Description policy
Client~InfoPolicy <optional>
The Info Policy to use for this operation.
callback
Job~infoCallback <optional>
The function to call with the job info response.
Returns:
If no callback function is passed, the function returns a Promise that resolves to the job info.
- Type
- Promise
Example
const Aerospike = require('aerospike') Aerospike.connect((error, client) => { if (error) throw error var scan = client.scan('test', 'demo') scan.background('myUdfModule', 'myUdfFunction', (error, job) => { if (error) throw error var timer = setInterval(() => { job.info((error, info) => { if (error) throw error console.info('scan status: %d (%d%% complete, %d records scanned)', info.status, info.progressPct, info.recordsRead) if (info.status === Aerospike.jobStatus.COMPLETED) { console.info('scan completed!') clearInterval(timer) client.close() } }) }, 1000) }) })
-
wait( [pollInterval] [, callback])
Wait until the task has been completed.
-
Parameters:
Name Type Argument Default Description pollInterval
number <optional>
1000 Interval in milliseconds to use when polling the cluster nodes.
callback
Job~doneCallback <optional>
The function to call when the task has completed.
Returns:
If no callback function is passed, the function returns a Promise that resolves once the job is completed.
- Type
- Promise
Type Definitions
-
doneCallback(error)
Callback function called when a job has completed.
-
Parameters:
Name Type Argument Description error
AerospikeError <nullable>
The error code and message or
null
if the operation was successful. -
infoCallback(error [, info])
The function called with the job info response.
-
Parameters:
Name Type Argument Description error
AerospikeError <nullable>
The error code and message or
null
if the operation was successful.info
object <optional>
The job info.
Properties
Name Type Argument Description status
number <optional>
Status of the job. See
module:aerospike.jobStatus
.progressPct
number <optional>
Progress estimate for the job, as percentage.
recordsRead
number <optional>
How many records have been processed.