#include <aerospike/as_bin.h>
#include <aerospike/as_buffer.h>
#include <aerospike/as_cluster.h>
#include <aerospike/as_key.h>
#include <aerospike/as_operations.h>
#include <aerospike/as_proto.h>
#include <aerospike/as_random.h>
#include <aerospike/as_record.h>
#include <citrusleaf/cf_byte_order.h>
Go to the source code of this file.
Data Structures | |
struct | as_command |
struct | as_command_parse_result_data |
Typedefs | |
typedef as_status(* | as_parse_results_fn) (as_error *err, struct as_command_s *cmd, as_node *node, uint8_t *buf, size_t size) |
typedef size_t(* | as_write_fn) (void *udata, uint8_t *buf) |
Functions | |
static void | as_buffers_destroy (as_queue *buffers) |
static as_status | as_command_bin_name_size (as_error *err, const char *name, size_t *size) |
as_status | as_command_bin_size (const as_bin *bin, as_queue *buffers, size_t *size, as_error *err) |
as_status | as_command_compress (as_error *err, uint8_t *cmd, size_t cmd_sz, uint8_t *compressed_cmd, size_t *compressed_size) |
size_t | as_command_compress_max_size (size_t cmd_sz) |
static size_t | as_command_compress_write_end (uint8_t *begin, uint8_t *end, uint64_t uncompressed_sz) |
as_status | as_command_execute (as_command *cmd, as_error *err) |
static size_t | as_command_field_size (size_t size) |
uint8_t * | as_command_ignore_bins (uint8_t *p, uint32_t n_bins) |
uint8_t * | as_command_ignore_fields (uint8_t *p, uint32_t n_fields) |
size_t | as_command_key_size (as_policy_key policy, const as_key *key, uint16_t *n_fields) |
as_status | as_command_parse_bins (uint8_t **pp, as_error *err, as_record *rec, uint32_t n_bins, bool deserialize) |
as_status | as_command_parse_header (as_error *err, as_command *cmd, as_node *node, uint8_t *buf, size_t size) |
uint8_t * | as_command_parse_key (uint8_t *p, uint32_t n_fields, as_key *key, uint64_t *bval) |
as_status | as_command_parse_result (as_error *err, as_command *cmd, as_node *node, uint8_t *buf, size_t size) |
as_status | as_command_parse_success_failure (as_error *err, as_command *cmd, as_node *node, uint8_t *buf, size_t size) |
as_status | as_command_parse_success_failure_bins (uint8_t **pp, as_error *err, as_msg *msg, as_val **value) |
as_status | as_command_parse_udf_failure (uint8_t *p, as_error *err, as_msg *msg, as_status status) |
as_status | as_command_send (as_command *cmd, as_error *err, uint32_t comp_threshold, as_write_fn write_fn, void *udata) |
static uint32_t | as_command_server_timeout (const as_policy_base *policy) |
static void | as_command_set_attr_compress (bool compress, uint8_t *read_attr) |
static void | as_command_set_attr_read (as_policy_read_mode_ap read_mode_ap, as_policy_read_mode_sc read_mode_sc, bool compress, uint8_t *read_attr, uint8_t *info_attr) |
static void | as_command_set_attr_read_header (as_policy_read_mode_ap read_mode_ap, as_policy_read_mode_sc read_mode_sc, uint8_t *read_attr, uint8_t *info_attr) |
static void | as_command_start_timer (as_command *cmd) |
static size_t | as_command_string_field_size (const char *value) |
static size_t | as_command_string_operation_size (const char *value) |
size_t | as_command_user_key_size (const as_key *key) |
uint8_t * | as_command_write_bin (uint8_t *begin, as_operator operation_type, const as_bin *bin, as_queue *buffers) |
uint8_t * | as_command_write_bin_name (uint8_t *cmd, const char *name) |
static size_t | as_command_write_end (uint8_t *begin, uint8_t *end) |
static uint8_t * | as_command_write_field_buffer (uint8_t *p, uint8_t id, as_buffer *buffer) |
static uint8_t * | as_command_write_field_digest (uint8_t *p, const as_digest *val) |
static uint8_t * | as_command_write_field_header (uint8_t *p, uint8_t id, uint32_t size) |
static uint8_t * | as_command_write_field_string (uint8_t *begin, uint8_t id, const char *val) |
static uint8_t * | as_command_write_field_uint32 (uint8_t *p, uint8_t id, uint32_t val) |
static uint8_t * | as_command_write_field_uint64 (uint8_t *p, uint8_t id, uint64_t val) |
uint8_t * | as_command_write_header_read (uint8_t *cmd, const as_policy_base *policy, as_policy_read_mode_ap read_mode_ap, as_policy_read_mode_sc read_mode_sc, int read_ttl, uint32_t timeout, uint16_t n_fields, uint16_t n_bins, uint8_t read_attr, uint8_t write_attr, uint8_t info_attr) |
uint8_t * | as_command_write_header_read_header (uint8_t *cmd, const as_policy_base *policy, as_policy_read_mode_ap read_mode_ap, as_policy_read_mode_sc read_mode_sc, int read_ttl, uint16_t n_fields, uint16_t n_bins, uint8_t read_attr) |
uint8_t * | as_command_write_header_write (uint8_t *cmd, const as_policy_base *policy, as_policy_commit_level commit_level, as_policy_exists exists, as_policy_gen gen_policy, uint32_t gen, uint32_t ttl, uint16_t n_fields, uint16_t n_bins, bool durable_delete, uint8_t read_attr, uint8_t write_attr, uint8_t info_attr) |
uint8_t * | as_command_write_key (uint8_t *p, as_policy_key policy, const as_key *key) |
static as_policy_replica | as_command_write_replica (as_policy_replica replica) |
uint8_t * | as_command_write_user_key (uint8_t *begin, const as_key *key) |
uint8_t | as_replica_index_any (void) |
static uint8_t | as_replica_index_init_read (as_policy_replica replica) |
static uint64_t | as_task_id_resolve (uint64_t *task_id_ptr) |
static void | local_free (void *memory) |
static void * | local_malloc (size_t size) |
#define as_command_buffer_free | ( | _buf, | |
_sz ) if (_sz > AS_STACK_BUF_SIZE) {local_free(_buf);} |
Free command buffer.
Definition at line 145 of file as_command.h.
#define as_command_buffer_init | ( | _sz | ) | (_sz > AS_STACK_BUF_SIZE) ? (uint8_t*)local_malloc(_sz) : (uint8_t*)alloca(_sz) |
Allocate command buffer on stack or heap depending on given size.
Definition at line 139 of file as_command.h.
#define AS_COMMAND_FLAGS_BATCH 2 |
Definition at line 39 of file as_command.h.
#define AS_COMMAND_FLAGS_LINEARIZE 4 |
Definition at line 40 of file as_command.h.
#define AS_COMMAND_FLAGS_READ 1 |
Definition at line 38 of file as_command.h.
#define AS_COMMAND_FLAGS_SPLIT_RETRY 8 |
Definition at line 41 of file as_command.h.
#define AS_COMPRESS_THRESHOLD 128 |
Definition at line 116 of file as_command.h.
#define AS_FIELD_BATCH_INDEX 41 |
Definition at line 63 of file as_command.h.
#define AS_FIELD_BVAL_ARRAY 15 |
Definition at line 54 of file as_command.h.
#define AS_FIELD_DIGEST 4 |
Definition at line 47 of file as_command.h.
#define AS_FIELD_DIGEST_ARRAY 12 |
Definition at line 52 of file as_command.h.
#define AS_FIELD_FILTER 43 |
Definition at line 64 of file as_command.h.
#define AS_FIELD_HEADER_SIZE 5 |
Definition at line 112 of file as_command.h.
#define AS_FIELD_INDEX_CONTEXT 23 |
Definition at line 56 of file as_command.h.
#define AS_FIELD_INDEX_RANGE 22 |
Definition at line 55 of file as_command.h.
#define AS_FIELD_INDEX_TYPE 26 |
Definition at line 57 of file as_command.h.
#define AS_FIELD_KEY 2 |
Definition at line 46 of file as_command.h.
#define AS_FIELD_MAX_RECORDS 13 |
Definition at line 53 of file as_command.h.
#define AS_FIELD_NAMESPACE 0 |
Definition at line 44 of file as_command.h.
#define AS_FIELD_PID_ARRAY 11 |
Definition at line 51 of file as_command.h.
#define AS_FIELD_QUERY_BINS 40 |
Definition at line 62 of file as_command.h.
#define AS_FIELD_RPS 10 |
Definition at line 50 of file as_command.h.
#define AS_FIELD_SETNAME 1 |
Definition at line 45 of file as_command.h.
#define AS_FIELD_SOCKET_TIMEOUT 9 |
Definition at line 49 of file as_command.h.
#define AS_FIELD_TASK_ID 7 |
Definition at line 48 of file as_command.h.
#define AS_FIELD_UDF_ARGLIST 32 |
Definition at line 60 of file as_command.h.
#define AS_FIELD_UDF_FUNCTION 31 |
Definition at line 59 of file as_command.h.
#define AS_FIELD_UDF_OP 33 |
Definition at line 61 of file as_command.h.
#define AS_FIELD_UDF_PACKAGE_NAME 30 |
Definition at line 58 of file as_command.h.
#define AS_HEADER_SIZE 30 |
Definition at line 111 of file as_command.h.
#define AS_MSG_INFO1_BATCH_INDEX (1 << 3) |
Definition at line 70 of file as_command.h.
#define AS_MSG_INFO1_COMPRESS_RESPONSE (1 << 7) |
Definition at line 74 of file as_command.h.
#define AS_MSG_INFO1_GET_ALL (1 << 1) |
Definition at line 68 of file as_command.h.
#define AS_MSG_INFO1_GET_NOBINDATA (1 << 5) |
Definition at line 72 of file as_command.h.
#define AS_MSG_INFO1_READ (1 << 0) |
Definition at line 67 of file as_command.h.
#define AS_MSG_INFO1_READ_MODE_AP_ALL (1 << 6) |
Definition at line 73 of file as_command.h.
#define AS_MSG_INFO1_SHORT_QUERY (1 << 2) |
Definition at line 69 of file as_command.h.
#define AS_MSG_INFO1_XDR (1 << 4) |
Definition at line 71 of file as_command.h.
#define AS_MSG_INFO2_CREATE_ONLY (1 << 5) |
Definition at line 82 of file as_command.h.
#define AS_MSG_INFO2_DELETE (1 << 1) |
Definition at line 78 of file as_command.h.
#define AS_MSG_INFO2_DURABLE_DELETE (1 << 4) |
Definition at line 81 of file as_command.h.
#define AS_MSG_INFO2_GENERATION (1 << 2) |
Definition at line 79 of file as_command.h.
#define AS_MSG_INFO2_GENERATION_GT (1 << 3) |
Definition at line 80 of file as_command.h.
#define AS_MSG_INFO2_RELAX_AP_LONG_QUERY (1 << 6) |
Definition at line 83 of file as_command.h.
#define AS_MSG_INFO2_RESPOND_ALL_OPS (1 << 7) |
Definition at line 84 of file as_command.h.
#define AS_MSG_INFO2_WRITE (1 << 0) |
Definition at line 77 of file as_command.h.
#define AS_MSG_INFO3_COMMIT_MASTER (1 << 1) |
Definition at line 88 of file as_command.h.
#define AS_MSG_INFO3_CREATE_OR_REPLACE (1 << 4) |
Definition at line 93 of file as_command.h.
#define AS_MSG_INFO3_LAST (1 << 0) |
Definition at line 87 of file as_command.h.
#define AS_MSG_INFO3_PARTITION_DONE (1 << 2) |
Definition at line 91 of file as_command.h.
#define AS_MSG_INFO3_REPLACE_ONLY (1 << 5) |
Definition at line 94 of file as_command.h.
#define AS_MSG_INFO3_SC_READ_RELAX (1 << 7) |
Definition at line 96 of file as_command.h.
#define AS_MSG_INFO3_SC_READ_TYPE (1 << 6) |
Definition at line 95 of file as_command.h.
#define AS_MSG_INFO3_UPDATE_ONLY (1 << 3) |
Definition at line 92 of file as_command.h.
#define AS_OPERATION_HEADER_SIZE 8 |
Definition at line 113 of file as_command.h.
#define AS_STACK_BUF_SIZE (1024 * 16) |
Definition at line 115 of file as_command.h.
|
private |
Parse results callback used in as_command_execute().
Definition at line 163 of file as_command.h.
|
private |
Write buffer callback used in as_command_send().
Definition at line 155 of file as_command.h.
|
inlinestaticprivate |
Destroy buffers when error occurs before bins have been written.
Definition at line 214 of file as_command.h.
References as_queue_destroy(), as_queue_pop(), and as_buffer::data.
|
inlinestaticprivate |
Calculate size of bin name. Return error is bin name greater than AS_BIN_NAME_MAX_LEN characters.
Definition at line 270 of file as_command.h.
References AEROSPIKE_ERR_PARAM, AEROSPIKE_OK, AS_BIN_NAME_MAX_LEN, and AS_OPERATION_HEADER_SIZE.
|
private |
Increment size by bin size.
|
private |
Compress command buffer.
|
private |
Calculate max size the compressed command buffer.
|
inlinestaticprivate |
Finish writing compressed command.
Definition at line 510 of file as_command.h.
References AS_COMPRESSED_MESSAGE_TYPE, AS_PROTO_VERSION, proto, and uncompressed_sz.
|
private |
Send command to the server.
|
inlinestaticprivate |
Calculate size of field structure given field value size.
Definition at line 253 of file as_command.h.
References AS_FIELD_HEADER_SIZE.
|
private |
Skip over bins in returned data.
|
private |
Skip over fields section in returned data.
|
private |
Calculate size of command header plus key fields.
|
private |
Parse bins received from the server.
|
private |
Parse header of server response.
|
private |
Parse key fields received from server. Used for reads.
|
private |
Parse server record. Used for reads.
|
private |
Parse server success or failure result.
|
private |
Parse server success or failure bins.
|
private |
Parse user defined function error.
|
private |
Write buffer and send command to the server.
|
inlinestaticprivate |
Return timeout to be sent to server for single record transactions.
Definition at line 538 of file as_command.h.
References as_policy_base::socket_timeout, and as_policy_base::total_timeout.
|
inlinestaticprivate |
Set compress attributes when compress is true.
Definition at line 329 of file as_command.h.
References AS_MSG_INFO1_COMPRESS_RESPONSE.
|
inlinestaticprivate |
Set read attributes for read commands.
Definition at line 341 of file as_command.h.
References as_command_set_attr_compress(), and as_command_set_attr_read_header().
|
inlinestaticprivate |
Set read attributes for read header commands.
Definition at line 296 of file as_command.h.
References AS_MSG_INFO1_READ_MODE_AP_ALL, AS_MSG_INFO3_SC_READ_RELAX, AS_MSG_INFO3_SC_READ_TYPE, AS_POLICY_READ_MODE_AP_ALL, AS_POLICY_READ_MODE_SC_ALLOW_REPLICA, AS_POLICY_READ_MODE_SC_ALLOW_UNAVAILABLE, AS_POLICY_READ_MODE_SC_LINEARIZE, and AS_POLICY_READ_MODE_SC_SESSION.
|
inlinestaticprivate |
Start command timer.
Definition at line 549 of file as_command.h.
References as_command::deadline_ms, as_command::iteration, as_command::max_retries, as_policy_base::max_retries, as_command::policy, as_command::sent, as_command::socket_timeout, as_policy_base::socket_timeout, as_command::total_timeout, and as_policy_base::total_timeout.
|
inlinestaticprivate |
Calculate size of string field.
Definition at line 243 of file as_command.h.
References AS_FIELD_HEADER_SIZE.
|
inlinestaticprivate |
Calculate size of string operation.
Definition at line 286 of file as_command.h.
References AS_OPERATION_HEADER_SIZE.
|
private |
Calculate size of user key.
|
private |
Write bin.
|
private |
Write bin header and bin name.
|
inlinestaticprivate |
Finish writing command.
Definition at line 497 of file as_command.h.
References AS_MESSAGE_TYPE, AS_PROTO_VERSION, and proto.
|
inlinestaticprivate |
Write as_buffer field.
Definition at line 443 of file as_command.h.
References as_command_write_field_header(), as_buffer::data, and as_buffer::size.
|
inlinestaticprivate |
Write digest field.
Definition at line 455 of file as_command.h.
References as_command_write_field_header(), AS_DIGEST_VALUE_SIZE, AS_FIELD_DIGEST, and as_digest::value.
|
inlinestaticprivate |
Write field header.
Definition at line 389 of file as_command.h.
|
inlinestaticprivate |
Write string field.
Definition at line 402 of file as_command.h.
References as_command_write_field_header(), and AS_FIELD_HEADER_SIZE.
|
inlinestaticprivate |
Write uint32_t field.
Definition at line 419 of file as_command.h.
References as_command_write_field_header().
|
inlinestaticprivate |
Write uint64_t field.
Definition at line 431 of file as_command.h.
References as_command_write_field_header().
|
private |
Write command header for read commands.
|
private |
Write command header for read header commands.
|
private |
Write command header for write commands.
|
private |
Write key structure.
|
inlinestaticprivate |
Convert replica target for write commands.
Definition at line 690 of file as_command.h.
References AS_POLICY_REPLICA_MASTER, and AS_POLICY_REPLICA_SEQUENCE.
|
private |
Write user key.
|
private |
Return command's starting replica index for AS_POLICY_REPLICA_ANY.
|
inlinestaticprivate |
Return starting replica index for read commands.
Definition at line 680 of file as_command.h.
References AS_POLICY_REPLICA_ANY, and as_replica_index_any().
|
inlinestaticprivate |
Return random task id if not specified.
Definition at line 656 of file as_command.h.
References as_random_get_uint64().
|
inlinestatic |
Definition at line 130 of file as_command.h.
|
inlinestaticprivate |
Macros use these stand-ins for cf_malloc() / cf_free(), so that instrumentation properly substitutes them.
Definition at line 124 of file as_command.h.