The UDF API provides the ability to manage UDFs in the cluster.
Management capabilities include:
|
AS_EXTERN as_status | aerospike_udf_get (aerospike *as, as_error *err, const as_policy_info *policy, const char *filename, as_udf_type type, as_udf_file *file) |
|
AS_EXTERN as_status | aerospike_udf_list (aerospike *as, as_error *err, const as_policy_info *policy, as_udf_files *files) |
|
AS_EXTERN as_status | aerospike_udf_put (aerospike *as, as_error *err, const as_policy_info *policy, const char *filename, as_udf_type type, as_bytes *content) |
|
AS_EXTERN as_status | aerospike_udf_put_wait (aerospike *as, as_error *err, const as_policy_info *policy, const char *filename, uint32_t interval_ms) |
|
AS_EXTERN as_status | aerospike_udf_remove (aerospike *as, as_error *err, const as_policy_info *policy, const char *filename) |
|
AS_EXTERN as_status | aerospike_udf_remove_wait (aerospike *as, as_error *err, const as_policy_info *policy, const char *filename, uint32_t interval_ms) |
|
◆ aerospike_udf_get()
Get specified UDF file from the cluster.
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
if (file.
type == AS_UDF_TYPE_UDF) {
}
}
AS_EXTERN as_udf_file * as_udf_file_init(as_udf_file *file)
AS_EXTERN void as_udf_file_destroy(as_udf_file *file)
AS_EXTERN as_status aerospike_udf_get(aerospike *as, as_error *err, const as_policy_info *policy, const char *filename, as_udf_type type, as_udf_file *file)
char name[AS_UDF_FILE_NAME_SIZE]
uint8_t hash[AS_UDF_FILE_HASH_SIZE+1]
struct as_udf_file::@8 content
- Parameters
-
as | The aerospike instance to use for this operation. |
err | The as_error to be populated if an error occurs. |
policy | The policy to use for this operation. If NULL, then the default policy will be used. |
filename | The name of the UDF file. |
type | The type of UDF file. |
file | The file from the cluster. |
- Returns
- AEROSPIKE_OK if successful. Otherwise an error occurred.
◆ aerospike_udf_list()
List the UDF files in the cluster.
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
printf(
"files[%d]:\n", files.
size);
for(
int i = 0; i < files.
size; i++) {
printf(
" - %s (%d) [%s]\n", file->
name, file->
type, file->
hash);
}
}
AS_EXTERN as_udf_files * as_udf_files_init(as_udf_files *files, uint32_t capacity)
AS_EXTERN void as_udf_files_destroy(as_udf_files *files)
AS_EXTERN as_status aerospike_udf_list(aerospike *as, as_error *err, const as_policy_info *policy, as_udf_files *files)
- Parameters
-
as | The aerospike instance to use for this operation. |
err | The as_error to be populated if an error occurs. |
policy | The policy to use for this operation. If NULL, then the default policy will be used. |
files | The list to populate with the results from the request. |
- Returns
- AEROSPIKE_OK if successful. Otherwise an error occurred.
◆ aerospike_udf_put()
Put a UDF file into the cluster. This function will return before the put is completed on all nodes. Use aerospike_udf_put_wait() when need to wait for completion.
...
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
AS_EXTERN as_bytes * as_bytes_init(as_bytes *bytes, uint32_t capacity)
static void as_bytes_destroy(as_bytes *bytes)
AS_EXTERN as_status aerospike_udf_put(aerospike *as, as_error *err, const as_policy_info *policy, const char *filename, as_udf_type type, as_bytes *content)
- Parameters
-
as | The aerospike instance to use for this operation. |
err | The as_error to be populated if an error occurs. |
policy | The policy to use for this operation. If NULL, then the default policy will be used. |
filename | The name of the UDF file. |
type | The type of UDF file. |
content | The file of the UDF file. |
- Returns
- AEROSPIKE_OK if UDF put was started. Otherwise an error occurred.
◆ aerospike_udf_put_wait()
Wait for asynchronous udf put to complete using given polling interval.
}
AS_EXTERN as_status aerospike_udf_put_wait(aerospike *as, as_error *err, const as_policy_info *policy, const char *filename, uint32_t interval_ms)
- Parameters
-
as | The aerospike instance to use for this operation. |
err | The as_error to be populated if an error occurs. |
policy | The policy to use for this operation. If NULL, then the default policy will be used. |
filename | The name of the UDF file. |
interval_ms | The polling interval in milliseconds. If zero, 1000 ms is used. |
- Returns
- AEROSPIKE_OK if successful. Otherwise an error occurred.
◆ aerospike_udf_remove()
Remove a UDF file from the cluster. This function will return before the remove is completed on all nodes. Use aerospike_udf_remove_wait() when need to wait for completion.
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
AS_EXTERN as_status aerospike_udf_remove(aerospike *as, as_error *err, const as_policy_info *policy, const char *filename)
- Parameters
-
as | The aerospike instance to use for this operation. |
err | The as_error to be populated if an error occurs. |
policy | The policy to use for this operation. If NULL, then the default policy will be used. |
filename | The name of the UDF file. |
- Returns
- AEROSPIKE_OK if remove was started. Otherwise an error occurred.
◆ aerospike_udf_remove_wait()
Wait for asynchronous udf remove to complete using given polling interval.
*
}
AS_EXTERN as_status aerospike_udf_remove_wait(aerospike *as, as_error *err, const as_policy_info *policy, const char *filename, uint32_t interval_ms)
- Parameters
-
as | The aerospike instance to use for this operation. |
err | The as_error to be populated if an error occurs. |
policy | The policy to use for this operation. If NULL, then the default policy will be used. |
filename | The name of the UDF file. |
interval_ms | The polling interval in milliseconds. If zero, 1000 ms is used. |
- Returns
- AEROSPIKE_OK if successful. Otherwise an error occurred.