Loading...
Searching...
No Matches
nvme_kv.h File Reference

NVMe driver public API extension for Key-Value Command Set. More...

Macros

#define SPDK_NVME_KV_KEY_MIN_LEN   1
 Minimum length of a key in bytes.
 
#define SPDK_NVME_KV_KEY_MAX_LEN   16
 Maximum length of a key in bytes (per the NVMe Key-Value Command Set Specification).
 

Functions

const struct spdk_nvme_kv_ns_dataspdk_nvme_kv_ns_get_data (const struct spdk_nvme_ns *ns)
 Get the Key-Value Command Set Specific Identify Namespace data as defined by the NVMe Key-Value Command Set Specification.
 
const struct spdk_nvme_kv_ctrlr_dataspdk_nvme_kv_ctrlr_get_data (const struct spdk_nvme_ctrlr *ctrlr)
 Get the Key-Value Command Set Specific Identify Controller data as defined by the NVMe Key-Value Command Set Specification.
 
int spdk_nvme_kv_store (struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *qpair, const void *key, uint8_t key_len, const void *value, uint32_t value_len, spdk_nvme_cmd_cb cb_fn, void *cb_arg, uint8_t options)
 Submit a KV Store command to the specified NVMe namespace.
 
int spdk_nvme_kv_retrieve (struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *qpair, const void *key, uint8_t key_len, void *value, uint32_t value_len, spdk_nvme_cmd_cb cb_fn, void *cb_arg, uint8_t options)
 Submit a KV Retrieve command to the specified NVMe namespace.
 
int spdk_nvme_kv_delete (struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *qpair, const void *key, uint8_t key_len, spdk_nvme_cmd_cb cb_fn, void *cb_arg)
 Submit a KV Delete command to the specified NVMe namespace.
 
int spdk_nvme_kv_exist (struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *qpair, const void *key, uint8_t key_len, spdk_nvme_cmd_cb cb_fn, void *cb_arg)
 Submit a KV Exist command to the specified NVMe namespace.
 
int spdk_nvme_kv_list (struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *qpair, const void *start_key, uint8_t start_key_len, void *buffer, uint32_t buffer_len, spdk_nvme_cmd_cb cb_fn, void *cb_arg)
 Submit a KV List command to the specified NVMe namespace.
 

Detailed Description

NVMe driver public API extension for Key-Value Command Set.

Function Documentation

◆ spdk_nvme_kv_ctrlr_get_data()

const struct spdk_nvme_kv_ctrlr_data * spdk_nvme_kv_ctrlr_get_data ( const struct spdk_nvme_ctrlr * ctrlr)

Get the Key-Value Command Set Specific Identify Controller data as defined by the NVMe Key-Value Command Set Specification.

This function is thread safe and can be called at any point while the controller is attached to the SPDK NVMe driver.

Parameters
ctrlrOpaque handle to NVMe controller.
Returns
pointer to the controller data, or NULL if the controller does not support the Key-Value Command Set.

◆ spdk_nvme_kv_delete()

int spdk_nvme_kv_delete ( struct spdk_nvme_ns * ns,
struct spdk_nvme_qpair * qpair,
const void * key,
uint8_t key_len,
spdk_nvme_cmd_cb cb_fn,
void * cb_arg )

Submit a KV Delete command to the specified NVMe namespace.

The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair(). The user must ensure that only one thread submits I/O on a given qpair at any given time.

Parameters
nsNVMe namespace to submit the KV Delete command.
qpairI/O queue pair to submit the request.
keyPointer to the key buffer.
key_lenLength of the key in bytes (SPDK_NVME_KV_KEY_MIN_LEN to SPDK_NVME_KV_KEY_MAX_LEN).
cb_fnCallback function to invoke when the I/O is completed.
cb_argArgument to pass to the callback function.
Returns
0 if successfully submitted, negated errnos on the following error conditions: -EINVAL: The request is malformed. -ENOMEM: The request cannot be allocated. -ENXIO: The qpair is failed at the transport level.

◆ spdk_nvme_kv_exist()

int spdk_nvme_kv_exist ( struct spdk_nvme_ns * ns,
struct spdk_nvme_qpair * qpair,
const void * key,
uint8_t key_len,
spdk_nvme_cmd_cb cb_fn,
void * cb_arg )

Submit a KV Exist command to the specified NVMe namespace.

The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair(). The user must ensure that only one thread submits I/O on a given qpair at any given time.

Parameters
nsNVMe namespace to submit the KV Exist command.
qpairI/O queue pair to submit the request.
keyPointer to the key buffer.
key_lenLength of the key in bytes (SPDK_NVME_KV_KEY_MIN_LEN to SPDK_NVME_KV_KEY_MAX_LEN).
cb_fnCallback function to invoke when the I/O is completed.
cb_argArgument to pass to the callback function.
Returns
0 if successfully submitted, negated errnos on the following error conditions: -EINVAL: The request is malformed. -ENOMEM: The request cannot be allocated. -ENXIO: The qpair is failed at the transport level.

◆ spdk_nvme_kv_list()

int spdk_nvme_kv_list ( struct spdk_nvme_ns * ns,
struct spdk_nvme_qpair * qpair,
const void * start_key,
uint8_t start_key_len,
void * buffer,
uint32_t buffer_len,
spdk_nvme_cmd_cb cb_fn,
void * cb_arg )

Submit a KV List command to the specified NVMe namespace.

The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair(). The user must ensure that only one thread submits I/O on a given qpair at any given time.

Parameters
nsNVMe namespace to submit the KV List command.
qpairI/O queue pair to submit the request.
start_keyPointer to the starting key for iteration (may be NULL for all keys).
start_key_lenLength of the starting key in bytes (0-16).
bufferPointer to the buffer to store the list of keys.
buffer_lenLength of the buffer in bytes.
cb_fnCallback function to invoke when the I/O is completed.
cb_argArgument to pass to the callback function.
Returns
0 if successfully submitted, negated errnos on the following error conditions: -EINVAL: The request is malformed. -ENOMEM: The request cannot be allocated. -ENXIO: The qpair is failed at the transport level.

◆ spdk_nvme_kv_ns_get_data()

const struct spdk_nvme_kv_ns_data * spdk_nvme_kv_ns_get_data ( const struct spdk_nvme_ns * ns)

Get the Key-Value Command Set Specific Identify Namespace data as defined by the NVMe Key-Value Command Set Specification.

This function is thread safe and can be called at any point while the controller is attached to the SPDK NVMe driver.

Parameters
nsNamespace.
Returns
a pointer to the namespace data, or NULL if the namespace is not a Key-Value namespace.

◆ spdk_nvme_kv_retrieve()

int spdk_nvme_kv_retrieve ( struct spdk_nvme_ns * ns,
struct spdk_nvme_qpair * qpair,
const void * key,
uint8_t key_len,
void * value,
uint32_t value_len,
spdk_nvme_cmd_cb cb_fn,
void * cb_arg,
uint8_t options )

Submit a KV Retrieve command to the specified NVMe namespace.

The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair(). The user must ensure that only one thread submits I/O on a given qpair at any given time.

Parameters
nsNVMe namespace to submit the KV Retrieve command.
qpairI/O queue pair to submit the request.
keyPointer to the key buffer.
key_lenLength of the key in bytes (SPDK_NVME_KV_KEY_MIN_LEN to SPDK_NVME_KV_KEY_MAX_LEN).
valuePointer to the value buffer to store the retrieved value.
value_lenLength of the value buffer in bytes.
cb_fnCallback function to invoke when the I/O is completed.
cb_argArgument to pass to the callback function.
optionsRetrieve options, see spdk_nvme_kv_retrieve_option in nvme_spec.h.
Returns
0 if successfully submitted, negated errnos on the following error conditions: -EINVAL: The request is malformed. -ENOMEM: The request cannot be allocated. -ENXIO: The qpair is failed at the transport level.

◆ spdk_nvme_kv_store()

int spdk_nvme_kv_store ( struct spdk_nvme_ns * ns,
struct spdk_nvme_qpair * qpair,
const void * key,
uint8_t key_len,
const void * value,
uint32_t value_len,
spdk_nvme_cmd_cb cb_fn,
void * cb_arg,
uint8_t options )

Submit a KV Store command to the specified NVMe namespace.

The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair(). The user must ensure that only one thread submits I/O on a given qpair at any given time.

Parameters
nsNVMe namespace to submit the KV Store command.
qpairI/O queue pair to submit the request.
keyPointer to the key buffer.
key_lenLength of the key in bytes (SPDK_NVME_KV_KEY_MIN_LEN to SPDK_NVME_KV_KEY_MAX_LEN).
valuePointer to the value buffer.
value_lenLength of the value in bytes.
cb_fnCallback function to invoke when the I/O is completed.
cb_argArgument to pass to the callback function.
optionsStore options, see spdk_nvme_kv_store_option in nvme_spec.h.
Returns
0 if successfully submitted, negated errnos on the following error conditions: -EINVAL: The request is malformed. -ENOMEM: The request cannot be allocated. -ENXIO: The qpair is failed at the transport level.