libxnvme_kvs.h#

Enums#

xnvme_retrieve_opts#

enum xnvme_retrieve_opts#

Options of the KV Retrieve command, the bits of the ‘opt’ of xnvme_kvs_retrieve().

Values:

enumerator XNVME_KVS_RETRIEVE_OPT_RETRIEVE_RAW#

Retrieve the value as stored, raw.

xnvme_store_opts#

enum xnvme_store_opts#

Options of the KV Store command, the bits of the ‘opt’ of xnvme_kvs_store().

Values:

enumerator XNVME_KVS_STORE_OPT_DONT_STORE_IF_KEY_NOT_EXISTS#

Store only if key exists.

enumerator XNVME_KVS_STORE_OPT_DONT_STORE_IF_KEY_EXISTS#

Store only if key is new.

enumerator XNVME_KVS_STORE_OPT_COMPRESS#

Compress the value.

Functions#

xnvme_kvs_delete#

int xnvme_kvs_delete(struct xnvme_cmd_ctx *ctx, uint32_t nsid, const void *key, uint8_t key_len)#

Submit, and optionally wait for completion of, a KV Delete.

Parameters:
  • ctx – Pointer to command context (xnvme_cmd_ctx)

  • nsid – Namespace Identifier

  • key – pointer to a KV Key buffer

  • key_len – KV Key size in bytes

Returns:

On success, 0 is returned. On error, negative errno is returned.

xnvme_kvs_exist#

int xnvme_kvs_exist(struct xnvme_cmd_ctx *ctx, uint32_t nsid, const void *key, uint8_t key_len)#

Submit, and optionally wait for completion of, a KV Exist.

Parameters:
  • ctx – Pointer to command context (xnvme_cmd_ctx)

  • nsid – Namespace Identifier

  • key – pointer to a KV Key buffer

  • key_len – KV Key size in bytes

Returns:

On success, 0 is returned. On error, negative errno is returned.

xnvme_kvs_list#

int xnvme_kvs_list(struct xnvme_cmd_ctx *ctx, uint32_t nsid, const void *key, uint8_t key_len, const void *vbuf, uint32_t vbuf_nbytes)#

Submit, and optionally wait for completion of, a KV List.

Parameters:
  • ctx – Pointer to command context (xnvme_cmd_ctx)

  • nsid – Namespace Identifier

  • key – pointer to a KV Key buffer

  • key_len – KV Key size in bytes

  • vbuf – pointer to Host Buffer

  • vbuf_nbytes – Host Buffer size in bytes

Returns:

On success, 0 is returned. On error, negative errno is returned.

xnvme_kvs_retrieve#

int xnvme_kvs_retrieve(struct xnvme_cmd_ctx *ctx, uint32_t nsid, const void *key, uint8_t key_len, const void *vbuf, uint32_t vbuf_nbytes, uint8_t opt)#

Submit, and optionally wait for completion of, a KV Retrieve.

Parameters:
  • ctx – Pointer to command context (xnvme_cmd_ctx)

  • nsid – Namespace Identifier

  • key – pointer to a KV Key buffer

  • key_len – KV Key size in bytes

  • vbuf – pointer to Host Buffer

  • vbuf_nbytes – Host Buffer size in bytes

  • opt – Retrieve options, see xnvme_retrieve_opts

Returns:

On success, 0 is returned. On error, negative errno is returned.

xnvme_kvs_store#

int xnvme_kvs_store(struct xnvme_cmd_ctx *ctx, uint32_t nsid, const void *key, uint8_t key_len, const void *vbuf, uint32_t vbuf_nbytes, uint8_t opt)#

Submit, and optionally wait for completion of, a KV Store.

Parameters:
  • ctx – Pointer to command context (xnvme_cmd_ctx)

  • nsid – Namespace Identifier

  • key – pointer to a KV Key buffer

  • key_len – KV Key size in bytes

  • vbuf – pointer to data payload

  • vbuf_nbytes – data payload size in bytes

  • opt – Store-options, see xnvme_store_opts

Returns:

On success, 0 is returned. On error, negative errno is returned.

Header#

/**
 * SPDX-FileCopyrightText: Samsung Electronics Co., Ltd
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 * @file libxnvme_kvs.h
 */

/**
 * Options of the KV Retrieve command, the bits of the 'opt' of xnvme_kvs_retrieve()
 *
 * @enum xnvme_retrieve_opts
 */
enum xnvme_retrieve_opts {
	XNVME_KVS_RETRIEVE_OPT_RETRIEVE_RAW = 1 << 0, ///< Retrieve the value as stored, raw
};

/**
 * Options of the KV Store command, the bits of the 'opt' of xnvme_kvs_store()
 *
 * @enum xnvme_store_opts
 */
enum xnvme_store_opts {
	XNVME_KVS_STORE_OPT_DONT_STORE_IF_KEY_NOT_EXISTS = 1 << 0, ///< Store only if key exists
	XNVME_KVS_STORE_OPT_DONT_STORE_IF_KEY_EXISTS     = 1 << 1, ///< Store only if key is new
	XNVME_KVS_STORE_OPT_COMPRESS                     = 1 << 2, ///< Compress the value
};

/**
 * Submit, and optionally wait for completion of, a KV Retrieve
 *
 * @param ctx Pointer to command context (::xnvme_cmd_ctx)
 * @param nsid Namespace Identifier
 * @param key pointer to a KV Key buffer
 * @param key_len KV Key size in bytes
 * @param vbuf pointer to Host Buffer
 * @param vbuf_nbytes Host Buffer size in bytes
 * @param opt Retrieve options, see ::xnvme_retrieve_opts
 *
 * @return On success, 0 is returned. On error, negative `errno` is returned.
 */
int
xnvme_kvs_retrieve(struct xnvme_cmd_ctx *ctx, uint32_t nsid, const void *key, uint8_t key_len,
		   const void *vbuf, uint32_t vbuf_nbytes, uint8_t opt);

/**
 * Submit, and optionally wait for completion of, a KV Store
 *
 * @param ctx Pointer to command context (::xnvme_cmd_ctx)
 * @param nsid Namespace Identifier
 * @param key pointer to a KV Key buffer
 * @param key_len KV Key size in bytes
 * @param vbuf pointer to data payload
 * @param vbuf_nbytes data payload size in bytes
 * @param opt Store-options, see ::xnvme_store_opts
 *
 * @return On success, 0 is returned. On error, negative `errno` is returned.
 */
int
xnvme_kvs_store(struct xnvme_cmd_ctx *ctx, uint32_t nsid, const void *key, uint8_t key_len,
		const void *vbuf, uint32_t vbuf_nbytes, uint8_t opt);

/**
 * Submit, and optionally wait for completion of, a KV Delete
 *
 * @param ctx Pointer to command context (::xnvme_cmd_ctx)
 * @param nsid Namespace Identifier
 * @param key pointer to a KV Key buffer
 * @param key_len KV Key size in bytes
 *
 * @return On success, 0 is returned. On error, negative `errno` is returned.
 */
int
xnvme_kvs_delete(struct xnvme_cmd_ctx *ctx, uint32_t nsid, const void *key, uint8_t key_len);

/**
 * Submit, and optionally wait for completion of, a KV Exist
 *
 * @param ctx Pointer to command context (::xnvme_cmd_ctx)
 * @param nsid Namespace Identifier
 * @param key pointer to a KV Key buffer
 * @param key_len KV Key size in bytes
 *
 * @return On success, 0 is returned. On error, negative `errno` is returned.
 */
int
xnvme_kvs_exist(struct xnvme_cmd_ctx *ctx, uint32_t nsid, const void *key, uint8_t key_len);

/**
 * Submit, and optionally wait for completion of, a KV List
 *
 * @param ctx Pointer to command context (::xnvme_cmd_ctx)
 * @param nsid Namespace Identifier
 * @param key pointer to a KV Key buffer
 * @param key_len KV Key size in bytes
 * @param vbuf pointer to Host Buffer
 * @param vbuf_nbytes Host Buffer size in bytes
 *
 * @return On success, 0 is returned. On error, negative `errno` is returned.
 */
int
xnvme_kvs_list(struct xnvme_cmd_ctx *ctx, uint32_t nsid, const void *key, uint8_t key_len,
	       const void *vbuf, uint32_t vbuf_nbytes);