class eosio::kv::map
Class List > eosio :: kv :: map
Defines an EOSIO Key Value Map. More...
Classes
Type | Name |
---|---|
struct | writable_wrapper |
Public Types
Type | Name |
---|---|
typedef K | key_t |
typedef V | value_t |
typedef map< TableName, K, V > | self_t |
typedef detail::elem< self_t > | elem_t |
typedef detail::iterator< false, self_t > | iterator_t |
typedef detail::iterator< true, self_t > | reverse_iterator_t |
Public Static Attributes
Type | Name |
---|---|
static constexpr static uint8_t | magic |
static constexpr static name | table_name |
Public Attributes
Type | Name |
---|---|
friend | iterator_t |
Protected Static Attributes
Type | Name |
---|---|
static constexpr static name | index_name |
Public Static Functions
Type | Name |
---|---|
static const key_type & | prefix () |
static key_type | full_key (const key_t & k) |
static detail::packed_view | get_tmp_buffer (std::size_t size_needed = 0) |
Public Functions
Type | Name |
---|---|
map (name owner = current_context_contract()) | |
map (std::initializer_list< elem_t > l) | |
map (name owner, std::initializer_list< elem_t > l) | |
writable_wrapper | operator[] (const std::pair< key_t, name > & key_payer) |
writable_wrapper | operator[] (const key_t & k) |
writable_wrapper | at (Key && k, name payer = current_context_contract()) |
iterator_t | begin () const |
iterator_t | end () const |
reverse_iterator_t | rbegin () const |
reverse_iterator_t | rend () const |
bool | empty () const |
iterator_t | find (const key_t & k) const This will take a key_t key and find the value that exactly matches that key. |
void | erase (const key_t & k) |
iterator_t | erase (const iterator_t & it) |
iterator_t | lower_bound (const key_t & k) const This will take a key_t key and find the value that is equal to or greater than that key. |
iterator_t | upper_bound (const key_t & k) const This will take a key_t key and find the value that is strictly greater than that key. |
std::pair< iterator_t, iterator_t > | equal_range (const key_t & k) const |
std::vector< elem_t > | ranged_slice (const key_t & l, const key_t & h) |
bool | contains (const key_t & k) const |
bool | raw_write (const key_t & k, std::string_view bytes, name payer = current_context_contract()) const |
Protected Functions
Type | Name |
---|---|
writable_wrapper | at (const key_type & bytes, name payer = current_context_contract()) |
std::tuple< value_t *, key_type > | get (key_type k, packed_tag) |
std::tuple< value_t *, key_type > | get (const key_t & k) |
bool | set (const key_type & k, const value_t & v, name payer, packed_tag) const |
bool | set (const key_t & k, const value_t & v, name payer) const |
detail::packed_view | pack_value (Value && v) const |
Detailed Description
EOSIO Key Value API provides a C++ interface to the EOSIO Key Value database. The Key Value Map offered by the KV API serves as a storage location which is organized as a sorted associative container that contains key-value pairs with unique keys. Keys are sorted lexicographically. Search, removal, and insertion operations have logarithmic complexity, O(log(n)). 'KV Map' is designed to offer a comparable interface to std::map template class.
Template parameters:
- K - the type of the data stored as the key of the map
- V - the type of the data stored as the value of the map
Public Types Documentation
typedef key_t
using eosio::kv::map< TableName, K, V, IndexName >::key_t = K;
typedef value_t
using eosio::kv::map< TableName, K, V, IndexName >::value_t = V;
typedef self_t
using eosio::kv::map< TableName, K, V, IndexName >::self_t = map<TableName, K, V>;
typedef elem_t
using eosio::kv::map< TableName, K, V, IndexName >::elem_t = detail::elem<self_t>;
typedef iterator_t (1/2)
using eosio::kv::map< TableName, K, V, IndexName >::iterator_t = detail::iterator<false, self_t>;
typedef reverse_iterator_t
using eosio::kv::map< TableName, K, V, IndexName >::reverse_iterator_t = detail::iterator<true, self_t>;
Public Static Attributes Documentation
variable magic
constexpr static uint8_t eosio::kv::map< TableName, K, V, IndexName >::magic;
variable table_name
constexpr static name eosio::kv::map< TableName, K, V, IndexName >::table_name;
Public Attributes Documentation
variable iterator_t (2/2)
friend eosio::kv::map< TableName, K, V, IndexName >::iterator_t;
Protected Static Attributes Documentation
variable index_name
constexpr static name eosio::kv::map< TableName, K, V, IndexName >::index_name;
Public Static Functions Documentation
function prefix
static static const key_type& eosio::kv::map< TableName, K, V, IndexName >::prefix()
function full_key
static static key_type eosio::kv::map< TableName, K, V, IndexName >::full_key(
const key_t & k
)
function get_tmp_buffer
static static detail::packed_view eosio::kv::map< TableName, K, V, IndexName >::get_tmp_buffer(
std::size_t size_needed = 0
)
Public Functions Documentation
function map (1/3)
eosio::kv::map< TableName, K, V, IndexName >::map(
name owner = current_context_contract()
)
function map (2/3)
eosio::kv::map< TableName, K, V, IndexName >::map(
std::initializer_list< elem_t > l
)
Basic constructor of N elements. This will bill the implicit owner of the table by default.
function map (3/3)
eosio::kv::map< TableName, K, V, IndexName >::map(
name owner,
std::initializer_list< elem_t > l
)
Basic constructor of N elements. This will bill the owner explicitly passed in.
function operator
writable_wrapper eosio::kv::map< TableName, K, V, IndexName >::operator[](
const std::pair< key_t, name > & key_payer
)
function operator
writable_wrapper eosio::kv::map< TableName, K, V, IndexName >::operator[](
const key_t & k
)
function at (1/2)
template<typename Key>
writable_wrapper eosio::kv::map< TableName, K, V, IndexName >::at(
Key && k,
name payer = current_context_contract()
)
function begin
iterator_t eosio::kv::map< TableName, K, V, IndexName >::begin() const
function end
iterator_t eosio::kv::map< TableName, K, V, IndexName >::end() const
function rbegin
reverse_iterator_t eosio::kv::map< TableName, K, V, IndexName >::rbegin() const
function rend
reverse_iterator_t eosio::kv::map< TableName, K, V, IndexName >::rend() const
function empty
bool eosio::kv::map< TableName, K, V, IndexName >::empty() const
function find
iterator_t eosio::kv::map< TableName, K, V, IndexName >::find(
const key_t & k
) const
This will take a key_t
key and find the value that exactly matches that key.
If no element is equal to the key the iterator will now hold end
.
Parameters:
- key This is the key which you wish to query with.
function erase (1/2)
void eosio::kv::map< TableName, K, V, IndexName >::erase(
const key_t & k
)
function erase (2/2)
iterator_t eosio::kv::map< TableName, K, V, IndexName >::erase(
const iterator_t & it
)
function lower_bound
iterator_t eosio::kv::map< TableName, K, V, IndexName >::lower_bound(
const key_t & k
) const
This will take a key_t
key and find the value that is equal to or greater than that key.
If no element is greater than or equal to the key the iterator will now hold end
.
Parameters:
- key This is the key which you wish to query with.
function upper_bound
iterator_t eosio::kv::map< TableName, K, V, IndexName >::upper_bound(
const key_t & k
) const
This will take a key_t
key and find the value that is strictly greater than that key.
If no element is strictly greater than the key the iterator will now hold end
.
Parameters:
- key This is the key which you wish to query with.
function equal_range
std::pair<iterator_t, iterator_t> eosio::kv::map< TableName, K, V, IndexName >::equal_range(
const key_t & k
) const
function ranged_slice
std::vector<elem_t> eosio::kv::map< TableName, K, V, IndexName >::ranged_slice(
const key_t & l,
const key_t & h
)
function contains
bool eosio::kv::map< TableName, K, V, IndexName >::contains(
const key_t & k
) const
function raw_write
bool eosio::kv::map< TableName, K, V, IndexName >::raw_write(
const key_t & k,
std::string_view bytes,
name payer = current_context_contract()
) const
Protected Functions Documentation
function at (2/2)
writable_wrapper eosio::kv::map< TableName, K, V, IndexName >::at(
const key_type & bytes,
name payer = current_context_contract()
)
function get (1/2)
std::tuple<value_t*, key_type> eosio::kv::map< TableName, K, V, IndexName >::get(
key_type k,
packed_tag
)
function get (2/2)
std::tuple<value_t*, key_type> eosio::kv::map< TableName, K, V, IndexName >::get(
const key_t & k
)
function set (1/2)
bool eosio::kv::map< TableName, K, V, IndexName >::set(
const key_type & k,
const value_t & v,
name payer,
packed_tag
) const
function set (2/2)
bool eosio::kv::map< TableName, K, V, IndexName >::set(
const key_t & k,
const value_t & v,
name payer
) const
function pack_value
template<typename Value>
detail::packed_view eosio::kv::map< TableName, K, V, IndexName >::pack_value(
Value && v
) const
The documentation for this class was generated from the following file: libraries/eosiolib/contracts/eosio/map.hpp