PMEMKV  1.4.1-git1.g7db5b8f
This is the C++ documentation for PMEMKV.
Namespaces | Classes | Typedefs | Enumerations | Functions
pmem::kv Namespace Reference

Main pmemkv namespace. More...

Namespaces

 internal
 Internal pmemkv classes for C++ API.
 

Classes

class  bad_result_access
 Defines a type of object to be thrown by result::get_value() when result doesn't contain value. More...
 
class  config
 Holds configuration parameters for engines. More...
 
class  db
 Main pmemkv class, it provides functions to operate on data in database. More...
 
class  result
 Stores result of an operation. It always contains status and optionally can contain value. More...
 
class  tx
 Pmemkv transaction handle. More...
 

Typedefs

using string_view = obj::string_view
 Partial string_view implemenetation, defined in pmem::obj namespace in libpmemobj-cpp library (see: https://pmem.io/libpmemobj-cpp ). More...
 
typedef int get_kv_function(string_view key, string_view value)
 The C++ idiomatic function type to use for callback using key-value pair. More...
 
typedef void get_v_function(string_view value)
 The C++ idiomatic function type to use for callback using only the value. More...
 
using get_kv_callback = pmemkv_get_kv_callback
 Key-value pair callback, C-style. More...
 
using get_v_callback = pmemkv_get_v_callback
 Value-only callback, C-style. More...
 

Enumerations

enum  status {
  status::OK = PMEMKV_STATUS_OK, status::UNKNOWN_ERROR = PMEMKV_STATUS_UNKNOWN_ERROR, status::NOT_FOUND = PMEMKV_STATUS_NOT_FOUND, status::NOT_SUPPORTED = PMEMKV_STATUS_NOT_SUPPORTED,
  status::INVALID_ARGUMENT = PMEMKV_STATUS_INVALID_ARGUMENT, status::CONFIG_PARSING_ERROR, status::CONFIG_TYPE_ERROR, status::STOPPED_BY_CB = PMEMKV_STATUS_STOPPED_BY_CB,
  status::OUT_OF_MEMORY, status::WRONG_ENGINE_NAME, status::TRANSACTION_SCOPE_ERROR, status::DEFRAG_ERROR = PMEMKV_STATUS_DEFRAG_ERROR,
  status::COMPARATOR_MISMATCH
}
 Status returned by most of pmemkv functions. More...
 

Functions

std::ostream & operator<< (std::ostream &os, const status &s)
 Provides string representation of a status, along with its number as specified by enum. More...
 
template<typename T >
bool operator== (const result< T > &lhs, const status &rhs)
 
template<typename T >
bool operator== (const status &lhs, const result< T > &rhs)
 
template<typename T >
bool operator!= (const result< T > &lhs, const status &rhs)
 
template<typename T >
bool operator!= (const status &lhs, const result< T > &rhs)
 

Detailed Description

Main pmemkv namespace.

It contains all pmemkv public types, enums, classes with their functions and members. It is located within pmem namespace.

Typedef Documentation

◆ get_kv_callback

using pmem::kv::get_kv_callback = typedef pmemkv_get_kv_callback

Key-value pair callback, C-style.

◆ get_kv_function

typedef int pmem::kv::get_kv_function(string_view key, string_view value)

The C++ idiomatic function type to use for callback using key-value pair.

Parameters
[in]keyreturned by callback item's key
[in]valuereturned by callback item's data

◆ get_v_callback

using pmem::kv::get_v_callback = typedef pmemkv_get_v_callback

Value-only callback, C-style.

◆ get_v_function

typedef void pmem::kv::get_v_function(string_view value)

The C++ idiomatic function type to use for callback using only the value.

It is used only by non-range get() calls.

Parameters
[in]valuereturned by callback item's data

◆ string_view

using pmem::kv::string_view = typedef obj::string_view

Partial string_view implemenetation, defined in pmem::obj namespace in libpmemobj-cpp library (see: https://pmem.io/libpmemobj-cpp ).

Enumeration Type Documentation

◆ status

enum pmem::kv::status
strong

Status returned by most of pmemkv functions.

Most of functions in libpmemkv API return one of the following status codes.

Status returned from a function can change in a future version of a library to a more specific one. For example, if a function returns status::UNKNOWN_ERROR, it is possible that in future versions it will return status::INVALID_ARGUMENT. Recommended way to check for an error is to compare status with status::OK (see pmem::kv::db basic example).

Enumerator
OK 

no error

UNKNOWN_ERROR 

unknown error

NOT_FOUND 

record (or config item) not found

NOT_SUPPORTED 

function is not implemented by current engine

INVALID_ARGUMENT 

argument to function has wrong value

CONFIG_PARSING_ERROR 

parsing data to config failed

CONFIG_TYPE_ERROR 

config item has different type than expected

STOPPED_BY_CB 

iteration was stopped by user's callback

OUT_OF_MEMORY 

operation failed because there is not enough memory (or space on the device)

WRONG_ENGINE_NAME 

engine name does not match any available engine

TRANSACTION_SCOPE_ERROR 

an error with the scope of the libpmemobj transaction

DEFRAG_ERROR 

the defragmentation process failed (possibly in the middle of a run)

COMPARATOR_MISMATCH 

db was created with a different comparator

Function Documentation

◆ operator!=() [1/2]

template<typename T >
bool pmem::kv::operator!= ( const result< T > &  lhs,
const status rhs 
)

◆ operator!=() [2/2]

template<typename T >
bool pmem::kv::operator!= ( const status lhs,
const result< T > &  rhs 
)

◆ operator<<()

std::ostream& pmem::kv::operator<< ( std::ostream &  os,
const status s 
)
inline

Provides string representation of a status, along with its number as specified by enum.

It's useful for debugging, e.g. with pmem::db::errormsg()

std::cout << pmemkv_errormsg() << std::endl;

◆ operator==() [1/2]

template<typename T >
bool pmem::kv::operator== ( const result< T > &  lhs,
const status rhs 
)

◆ operator==() [2/2]

template<typename T >
bool pmem::kv::operator== ( const status lhs,
const result< T > &  rhs 
)