![]() |
Jazz 1.25.+
|
Volatile: A Service to manage data objects in RAM. More...
#include <volatile.h>
Public Member Functions | |
Volatile (pLogger a_logger, pConfigFile a_config) | |
virtual pChar const | id () |
StatusCode | start () |
Starts the service, checking the configuration and starting the Service. | |
StatusCode | shut_down () |
virtual StatusCode | new_transaction (pTransaction &p_txn) |
virtual void | destroy_transaction (pTransaction &p_txn) |
virtual StatusCode | get (pTransaction &p_txn, Locator &what) |
virtual StatusCode | get (pTransaction &p_txn, Locator &what, pBlock p_row_filter) |
virtual StatusCode | get (pTransaction &p_txn, Locator &what, pChar name) |
virtual StatusCode | locate (Locator &location, Locator &what) |
virtual StatusCode | header (StaticBlockHeader &hea, Locator &what) |
virtual StatusCode | header (pTransaction &p_txn, Locator &what) |
virtual StatusCode | put (Locator &where, pBlock p_block, int mode=WRITE_AS_BASE_DEFAULT) |
virtual StatusCode | new_entity (Locator &where) |
virtual StatusCode | remove (Locator &where) |
virtual StatusCode | copy (Locator &where, Locator &what) |
void | base_names (BaseNames &base_names) |
virtual StatusCode | get (pTransaction &p_txn, pChar p_what) |
virtual StatusCode | get (pTransaction &p_txn, pChar p_what, pBlock p_row_filter) |
virtual StatusCode | get (pTransaction &p_txn, pChar p_what, pChar name) |
virtual StatusCode | get (pTransaction &p_txn, Locator &what) |
virtual StatusCode | get (pTransaction &p_txn, Locator &what, pBlock p_row_filter) |
virtual StatusCode | get (pTransaction &p_txn, Locator &what, pChar name) |
virtual StatusCode | header (StaticBlockHeader &hea, pChar p_what) |
virtual StatusCode | header (pTransaction &p_txn, pChar p_what) |
virtual StatusCode | header (StaticBlockHeader &hea, Locator &what) |
virtual StatusCode | header (pTransaction &p_txn, Locator &what) |
virtual StatusCode | put (pChar p_where, pBlock p_block, int mode=WRITE_AS_BASE_DEFAULT) |
virtual StatusCode | put (Locator &where, pBlock p_block, int mode=WRITE_AS_BASE_DEFAULT) |
virtual StatusCode | locate (Locator &location, pChar p_what) |
virtual StatusCode | locate (Locator &location, Locator &what) |
virtual StatusCode | new_entity (pChar p_where) |
virtual StatusCode | new_entity (Locator &where) |
virtual StatusCode | remove (pChar p_where) |
virtual StatusCode | remove (Locator &where) |
virtual StatusCode | copy (pChar p_where, pChar p_what) |
virtual StatusCode | copy (Locator &where, Locator &what) |
![]() | |
Container (pLogger a_logger, pConfigFile a_config) | |
void | enter_read (pTransaction p_txn) |
void | enter_write (pTransaction p_txn) |
void | leave_read (pTransaction p_txn) |
void | leave_write (pTransaction p_txn) |
StatusCode | new_block (pTransaction &p_txn, int cell_type, int *dim, int fill_tensor=FILL_NEW_DONT_FILL, int stringbuff_size=0, const char *p_text=nullptr, char eol='\n', AttributeMap *att=nullptr) |
StatusCode | new_block (pTransaction &p_txn, int num_items, StaticBlockHeader p_hea[], Name p_names[], pBlock p_block[], AttributeMap *dims=nullptr, AttributeMap *att=nullptr) |
StatusCode | new_block (pTransaction &p_txn, pBlock p_from, pBlock p_row_filter, AttributeMap *att=nullptr) |
StatusCode | new_block (pTransaction &p_txn, pTuple p_from, pChar name, AttributeMap *att=nullptr) |
StatusCode | new_block (pTransaction &p_txn, pBlock p_from_text, int cell_type, pKind p_as_kind=nullptr, AttributeMap *att=nullptr) |
StatusCode | new_block (pTransaction &p_txn, pBlock p_from_raw, pChar p_fmt=nullptr, bool ret_as_string=false, AttributeMap *att=nullptr) |
StatusCode | new_block (pTransaction &p_txn, int cell_type) |
StatusCode | new_block (pTransaction &p_txn, Index &index) |
virtual StatusCode | exec (pTransaction &p_txn, Locator &function, pTuple p_args) |
virtual StatusCode | modify (Locator &function, pTuple p_args) |
virtual StatusCode | as_locator (Locator &result, pChar p_what) |
StatusCode | unwrap_received (pTransaction &p_txn) |
StatusCode | unwrap_received (pTransaction &p_txn, pBlock p_maybe_block, int rec_size) |
void | base_names (BaseNames &base_names) |
![]() | |
Service (pLogger a_logger, pConfigFile a_config) | |
void | log (int loglevel, const char *message) |
void | log_printf (int loglevel, const char *fmt,...) |
bool | get_conf_key (const char *key, int &value) |
bool | get_conf_key (const char *key, double &value) |
bool | get_conf_key (const char *key, std::string &value) |
Private Attributes | |
uint64_t | key_seed |
Seed to create unique key ids. | |
HashNameUseMap | name {} |
Map of names and to do reverse conversion to a hash() (including count of uses) | |
HashQueueEntMap | queue_ent {} |
Map of queues. | |
HashVolXctMap | deque_ent {} |
Map of deques. | |
HashVolXctMap | tree_ent {} |
Map of trees. | |
HashVolXctMap | index_ent {} |
Map of indices. | |
EntKeyVolXctMap | deque_key {} |
Map of deque (entity, key) hashes to pointers to VolatileTransaction. | |
EntKeyVolXctMap | queue_key {} |
Map of queue (entity, key) hashes to pointers to VolatileTransaction. | |
EntKeyVolXctMap | tree_key {} |
Map of tree (entity, key) hashes to pointers to VolatileTransaction. | |
Additional Inherited Members | |
![]() | |
pLogger | p_log |
The logger. | |
pConfigFile | p_conf |
The configuration file. | |
![]() | |
void * | malloc (size_t size) |
pBlock | block_malloc (size_t size) |
void | lock_container () |
void | unlock_container () |
StatusCode | destroy_container () |
int | from_hex (char c) |
![]() | |
int | max_transactions |
The configured ONE_SHOT_MAX_TRANSACTIONS. | |
uint64_t | warn_alloc_bytes |
Taken from ONE_SHOT_WARN_BLOCK_KBYTES. | |
uint64_t | fail_alloc_bytes |
Taken from ONE_SHOT_ERROR_BLOCK_KBYTES. | |
uint64_t | alloc_bytes |
The current allocation in bytes. | |
pTransaction | p_buffer |
The buffer for the transactions. | |
pTransaction | p_free |
The free list of transactions. | |
bool | alloc_warning_issued |
True if a warning was issued for over-allocation. | |
Lock32 | _lock_ |
A lock for the deque of transactions. | |
Volatile: A Service to manage data objects in RAM.
Some bases in Volatile, like deque which is just a key/value store where each entity is a new key space. Keys are keys and values are blocks of any kind. Other bases have a syntax that allows operating with entities or nodes, like pop()-ing the highest priority node in a queue, accessing to nodes in a tree using the tree pointers or keys to node ids, etc.
The reference for this is this docstring. All entities and keys can be removed with remove(), each time keys are returned, they are inside a block of just one string, see the methods of each base for more. Methods have commands that follow a ~ char and are only two letters long, although they can be written in full to improve readability. E.g. ~fi is the same as ~first and, we write it ~fi{rst} below, but, of course, it cannot be written with the brackets.
A deque is a double linked list with a key-value store. It is created empty via new_entity() and you can just get(), header(), put(), remove() or copy() by key. You can also put to both //deque/entity/~fi{rst} and //deque/entity/~la{st} and the nodes will be pushed to either side of the deque with automatically created keys. Keys can be found using locate() and any node relation command. The first and last can be peeked by get()ting //deque/entity/~fi{rst} and //deque/entity/~la{st} or popped with //deque/entity/~pf{irst} and //deque/entity/~pl{ast}. Also the list supports //deque/entity/key~ne{xt} and //deque/entity/key~pr{ev} for get(), header() and locate() or as the what of copy(), but not for put(), remove() or as the where of copy().
Index both exposes and serializes Index type blocks. An entity inside index is one single Index. When get()ting them by key, you get the value stored in the Index. To put a new one, just new_entity() //index/name. To populate one, just put() to //index/name/~pu{t} with a Tuple of the appropriate Kind. To save one, just get() //index/name/~ge{t}. Since Index only stores strings, at the levels at which the interface expects a block, it must be a block containing just one string.
A priority queue is implemented as self balanced binary trees with a maximum number of nodes. The nodes can also be accessed by key. Each time you push a block, you must put() to a key with a priority by putting to //queue/name/key~0.977 (where 0.977 is a double). The queue is created by new_entity() //queue/name/~5000 (where 5000 is a mandatory maximum number of nodes). When the queue fills, lower priority nodes are discarded. You can also get() to //queue/name/~xh{ighest} (extracting it), //queue/name/~hi{ghest} (leaving it), equivalently: //queue/name/~xl{owest}, //queue/name/~lo{west}. And you can get() nodes by key as in a deque (if they haven't been pop()ed or been discarded).
A tree is created empty, new_entity() //tree/name/ Nodes are pushed with their parent key by put()ing to //tree/name/key~parentname (where parentname must exist). The only exception is the empty tree, it can be started by either a push with just a key or a push with a parent name that will be ignored. E.g., //tree/name/key~void. All nodes support get()/header()/locate() by //tree/name/key or by tree/name/key~pa{rent}, //tree/name/key~ne{xt}, //tree/name/key~ch{ild}. The root node can be get()/header()/locate() by tree/name/~first. put() only supports an existing parent. Remove //tree/name/key removes a whole subtree, all the descendants and the node itself. Remove //tree/name removes the whole entity.
jazz_elements::Volatile::Volatile | ( | pLogger | a_logger, |
pConfigFile | a_config | ||
) |
Initialize the Volatile Container without starting it.
a_logger | A pointer to a Logger object. |
a_config | A pointer to a ConfigFile object. |
|
virtual |
Return object ID.
Reimplemented from jazz_elements::Service.
|
virtual |
Starts the service, checking the configuration and starting the Service.
Reimplemented from jazz_elements::Container.
|
virtual |
Shuts down the Persisted Service
Reimplemented from jazz_elements::Container.
|
virtual |
Allocate a Transaction to share a block via the API.
p_txn | A pointer to a valid Transaction passed by reference. On failure, it will assign nullptr to it. |
NOTE: Volatile overrides the original virtual method from Container. This way, the original new_block() methods can be used and the Transaction returned is actually a VolatileTransaction which is good for any of the bases (deque, queue, tree or index).
Reimplemented from jazz_elements::Container.
|
virtual |
Dealloc the Block in the p_tnx->p_block (if not null) and free the Transaction inside a Container.
p_txn | A pointer to a valid Transaction passed by reference. Once finished, p_txn is set to nullptr to avoid reusing. |
NOTE: Volatile overrides the original virtual method from Container. This way, the original new_block() methods can be used and the Transaction returned is actually a VolatileTransaction which is good for any of the bases (deque, queue, tree or index).
Reimplemented from jazz_elements::Container.
|
virtual |
Native (Volatile) interface complete Block retrieval.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
what | Some Locator to the block. (See Node Method Reference in the documentation of the class Volatile.) |
Usage-wise, this is equivalent to a new_block() call. On success, it will return a Transaction that belongs to the Container and must be destroy_transaction()-ed when the caller is done.
Reimplemented from jazz_elements::Container.
|
virtual |
Native (Volatile) interface selection of rows in a Block retrieval.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
what | Some Locator to the block. (See Node Method Reference in the documentation of the class Volatile.) |
p_row_filter | The block we want to use as a filter. This is either a tensor of boolean or integer that can_filter(p_from). |
Usage-wise, this is equivalent to a new_block() call. On success, it will return a Transaction that belongs to the Container and must be destroy_transaction()-ed when the caller is done.
Reimplemented from jazz_elements::Container.
|
virtual |
Native (Volatile) interface selection of a tensor in a Tuple retrieval.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
what | Some Locator to the block. (See Node Method Reference in the documentation of the class Volatile.) |
name | The name of the item to be selected. |
Usage-wise, this is equivalent to a new_block() call. On success, it will return a Transaction that belongs to the Container and must be destroy_transaction()-ed when the caller is done.
Reimplemented from jazz_elements::Container.
|
virtual |
Native (Volatile) interface: Locate a block by some relation that is understandable by the descendant.
location | The solved location of the block. |
what | A valid reference to a block. E.g. //deque/ent/~first, //tree/ent/key~parent, //queue/ent/~highest |
Reimplemented from jazz_elements::Container.
|
virtual |
Native (Volatile) interface metadata of a Block retrieval.
hea | A StaticBlockHeader structure that will receive the metadata. |
what | Some Locator to the block. (See Node Method Reference in the documentation of the class Volatile.) |
This is a faster, not involving RAM allocation version of the other form of header. For a tensor, is will be the only thing you need, but for a Kind or a Tuple, you probably want the types of all its items and need to pass a pTransaction to hold the data.
Reimplemented from jazz_elements::Container.
|
virtual |
Native (Volatile) interface metadata of a Block retrieval.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
what | Some Locator to the block. (See Node Method Reference in the documentation of the class Volatile.) |
Unlike its faster form, this allocates a Block and therefore, it is equivalent to a new_block() call. On success, it will return a Transaction that belongs to the Container and must be destroy_transaction()-ed when the caller is done.
For Tensors it will allocate a block that only has the StaticBlockHeader (What you can more efficiently get from the other form.) For Kinds, the metadata of all the items is exactly the same a .get() call returns. For Tuples, it does what you expect: returning a Block with the metadata of all the items without the data.
Reimplemented from jazz_elements::Container.
|
virtual |
Native (Volatile) interface for Block storing
where | Some destination Locator to the block. (See Node Method Reference in the documentation of the class Volatile.) |
p_block | The Block to be stored in Volatile. The Block hash and dated will be updated by this call!! |
mode | Some writing restriction, either WRITE_ONLY_IF_EXISTS or WRITE_ONLY_IF_NOT_EXISTS. WRITE_TENSOR_DATA returns the error SERVICE_ERROR_WRONG_ARGUMENTS |
NOTE**: This updates the calling block's creation time and hash64.
Reimplemented from jazz_elements::Container.
|
virtual |
Native (Volatile) interface for creating databases
where | Some destination Locator to the block. (See Node Method Reference in the documentation of the class Volatile.) |
Reimplemented from jazz_elements::Container.
|
virtual |
Native (Volatile) interface for deleting databases and blocks:
where | The block or entity to be removed. (See Node Method Reference in the documentation of the class Volatile.) |
Reimplemented from jazz_elements::Container.
|
virtual |
Native (Volatile) interface for Block copying (inside the Volatile).
where | The block or entity to be written. (See Node Method Reference in the documentation of the class Volatile.) |
what | The block or entity to be read. (See Node Method Reference in the documentation of the class Volatile.) |
Reimplemented from jazz_elements::Container.
void jazz_elements::Volatile::base_names | ( | BaseNames & | base_names | ) |
Add the base names for this Container.
base_names | A BaseNames map passed by reference to which the base names of this object are added by this call. |
|
private |
Creates the buffers for new_transaction()/destroy_transaction()
|
private |
Destroys everything: all transactions and the buffer itself
|
inlineprivate |
Creates a new 15 character long key starting with a 'k' followed by 14 lowercase hexadecimal digits.
key | The generated key. |
It starts with a random seed and just increments it by 1 on each call
|
inlineprivate |
Populate an Index with the content of a Tuple of (text, text)
index | Some destination Index |
p_block | The Block to be pushed into the index Volatile. It must be compatible with new_block(8) A Tuple of two string items named "key" and "value" of rank == 1 and the same size. |
NOTE**: This is the inverse of new_block(8), except that it does not create the Index from scratch it appends (overriding existing keys) the content of the Index.
|
inlineprivate |
Inserts or replaces an element in a queue. In case the queue is full, the lowest priority node is removed.
ent_hash | The entity hash (that may not even exist). |
key | The key on the new (or existing) block. |
priority | The priority with which the element will be inserted. Not at all if below the lowest priority of a full queue. |
p_block | The block to be put (a copy of it). |
mode | Some writing restriction, either WRITE_ONLY_IF_EXISTS or WRITE_ONLY_IF_NOT_EXISTS. WRITE_TENSOR_DATA is the only supported option. |
|
inlineprivate |
Inserts an element in a deque that does not match an existing key. This makes the deque grow.
it_ent | The iterator to the found entity. |
ek | Both hash keys. |
key | The key |
p_block | The block to be put (a copy of it). |
first | An optional parameter to allow inserting from the bottom of the queue, rather than the end. |
|
inlineprivate |
Inserts an element in a tree.
it_ent | The iterator to the found entity. |
ek | Both hash keys. |
key | The key |
parent | The parent key the must exist unless the tree entity is empty, in which case it should be ~void |
p_block | The block to be put (a copy of it). |
|
inlineprivate |
Replaces the block used in a VolatileTransaction without altering any other part of the transaction.
p_replace | The VolatileTransaction whose block will be replaced |
p_block | The new block. |
This does not support Index, it is assumed that the pVolatileTransaction was located by key and the key does not change and therefore, ther is no need to do name[] mingling or destroy_transaction()
|
inlineprivate |
Write a string into and Index
index | Some destination Index |
key | The key to be written |
p_block | The Block to be written It must be a string of rank == 1 and size == 1. |
mode | Some writing restriction, either WRITE_ONLY_IF_EXISTS or WRITE_ONLY_IF_NOT_EXISTS. WRITE_TENSOR_DATA is the only supported option. |
|
inlineprivate |
Destroy and item from an entity.
base | A base. |
ent_hash | A hash of the entity containing the item to be destroyed. |
p_item | The item tom be destroyed. |
NOTE: This does not check if the entity and the block already exists, the base is correct, etc. That is done by the caller.
|
inlineprivate |
Define a new name and push it into the HashNameUseMap.
hash | hash(key) (It will almost always be already computed in advance, just use of or compute it. It's inline.) |
key | The name to be added, zero-padded by hash(). |
|
inlineprivate |
Remove a from the HashNameUseMap by decreasing its use count and destroying it if not used anymore.
hash | hash(key) |
|
inlineprivate |
Internal non-copy version of get() form 1.
p_txn | A Transaction inside the Container that will be returned for anything except an index. |
p_str | A pointer to a std::string.c_str() inside the Container for index. |
pop_ent | The hash of the entity from which the returned block is expected to be pop()-ed. |
what | Some Locator to the block, just like what get() expects. |
This is the kernel of get(). The difference is it does not create block to be used by other services, it returns the internal VolatileTransaction without copying neither the transaction nor the block.
|
inlineprivate |
Parses a key to find the command and a new key that can be hashed, possibly a key of a parent.
key_out | The clean key returned without the command. |
command | The command as an integer in COMMAND_CHILD_10BIT..COMMAND_XLOW_10BIT or COMMAND_SIZE + a size |
second | A parent node, when command == COMMAND_SECOND_ARG (In put //tree/ent/aaa~next, "next" is a parent id, not a command.) or a priority in put //queue/ent/key~0.95 |
key_in | The original key to be parsed. |
is_put | We are parsing a put call (if true, the command maybe a parent or priority). |
NOTE: See the reference of the class Volatile for an explanation on commands.
|
inlineprivate |
Fills a name with zero after the string and returns the hash of the complete NAME_SIZE-long array.
name | The name to be filled and hashed. |
|
inlineprivate |
Free all the blocks in the sub-tree calling destroy_transaction() recursively.
ent_hash | The hash of the queue entity being destroyed, required by destroy_item(). |
p_txn | The root of the AA subtree from which we the free all the blocks. |
|
inlineprivate |
Free all the blocks in a tree entity calling destroy_tree() recursively.
ent_hash | The hash of the tree entity being destroyed, required by destroy_item(). |
p_txn | The root of the subtree from which we the free all the blocks. |
|
inlineprivate |
Check the relative position (left or right) between an item and a tree for inserting a deleting.
p_item | The item that will be inserted or deleted. |
p_tree | The AA subtree compared with the item,. |
Note: This should be the only way to break ties when p_item->priority == p_tree->priority.
|
inlineprivate |
Return the highest priority node in the AA subtree without modifying the tree
p_item | The root of the AA subtree from which we want the highest priority node. |
Note: This does not alter the tree and is thread safe with other reading threads, but incompatible with writing threads.
|
inlineprivate |
Return the lowest priority node in the AA subtree without modifying the tree
p_item | The root of the AA subtree from which we want the lowest priority node. |
Note: This does not alter the tree and is thread safe with other reading threads, but incompatible with writing threads.
|
inlineprivate |
Rebalance the tree after aat_remove().
p_tree | The tree resulting of (a recursive step) in aat_remove |
Decrease the level of all nodes in this level if necessary, and then aat_skew and aat_split all nodes in the new level.
|
inlineprivate |
Check if a node belongs to a tree
p_item | The node checked if part of the AA subtree |
p_tree | The the AA subtree that may contain p_item |
|
inlineprivate |
Implements the "deep case" of AA tree removal.
p_kill | The node that we are following towards HPLoT found by recursion |
p_parent | The parent of p_kill (required to aat_rebalance the tree after every recursive step) |
p_tree | The (never changing) root of the subtree (we want to aat_remove it) |
p_deep | A variable to store the HPLoT (found in the deepest level, applied in the shallowest) |
Note: Against what is stated in AA tree literature, it is not always easy to convert an arbitrary node that has to be removed into a leaf. (Many applications only aat_remove high or low priority node and that does not apply then.) When we need to aat_remove a node high in the tree (far away for leaves) skewing the tree to make its predecessor the new root is feasible, but that still does not solve the problem of removing it. The safest option is removing the HPLoT (Highest Priority to the Left of Tree) which at least will have no successor, rebalancing the tree after removal and inserting it back as the root in replacement of the previous root. That is what is function does.
|
inlineprivate |
Remove a node in an AA subtree
p_item | The node to be removed |
p_tree | The tree from which it should be removed |
Note: This is NOT thread safe and should only be used inside public methods providing the safety mechanisms.
|
inlineprivate |
Remove links that skip level in an AA subtree
p_item | A tree for which we want to aat_remove links that skip levels. |
Note: This does alter the tree and requires exclusive access to the AA.
|
inlineprivate |
Try to aat_rebalance an AA subtree on its left (prev) side
p_item | a node representing an AA tree that needs to be rebalanced. |
Note: This does alter the tree and requires exclusive access to the AA.
|
inlineprivate |
Try to aat_rebalance an AA subtree on its right (next) side
p_item | A node representing an AA tree that needs to be rebalanced. |
Note: This does alter the tree and requires exclusive access to the AA.
|
inlineprivate |
Insert a node in its correct place according to priority in an AA subtree
p_new | The node to be inserted |
p_tree | The root of the subtree where p_new will be inserted |
Note: This is NOT thread safe and should only be used inside public methods providing the safety mechanisms.
|
virtual |
"Easy" interface complete Block retrieval. This parses p_what and, on success, calls the native get() equivalent.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
p_what | Some string that as_locator() can parse into a Locator. E.g. //base/entity/key |
Usage-wise, this is equivalent to a new_block() call. On success, it will return a Transaction that belongs to the Container and must be destroy_transaction()-ed when the caller is done.
Reimplemented from jazz_elements::Container.
|
virtual |
"Easy" interface selection of rows in a Block retrieval. This parses p_what and, on success, calls the native get() equivalent.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
p_what | Some string that as_locator() can parse into a Locator. E.g. //base/entity/key |
p_row_filter | The block we want to use as a filter. This is either a tensor of boolean or integer that can_filter(p_from). |
Usage-wise, this is equivalent to a new_block() call. On success, it will return a Transaction that belongs to the Container and must be destroy_transaction()-ed when the caller is done.
Reimplemented from jazz_elements::Container.
|
virtual |
"Easy" interface selection of a tensor in a Tuple retrieval. This parses p_what and, on success, calls the native get() equivalent.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
p_what | Some string that as_locator() can parse into a Locator. E.g. //base/entity/key |
name | The name of the item to be selected. |
Usage-wise, this is equivalent to a new_block() call. On success, it will return a Transaction that belongs to the Container and must be destroy_transaction()-ed when the caller is done.
Reimplemented from jazz_elements::Container.
|
virtual |
The "native" interface: This is what really does the job and must be implemented in the Container descendants.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
what | A valid reference to a block as a locator. E.g. //base/entity/key |
NOTE**: The root Container class does not implement this.
Reimplemented from jazz_elements::Container.
|
virtual |
The "native" interface: This is what really does the job and must be implemented in the Container descendants.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
what | A valid reference to a block as a locator. E.g. //base/entity/key |
p_row_filter | The block we want to use as a filter. This is either a tensor of boolean or integer that can_filter(p_from). |
NOTE**: The root Container class does not implement this.
Reimplemented from jazz_elements::Container.
|
virtual |
The "native" interface: This is what really does the job and must be implemented in the Container descendants.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
what | A valid reference to a block as a locator. E.g. //base/entity/key |
name | The name of the item to be selected. |
NOTE**: The root Container class does not implement this.
Reimplemented from jazz_elements::Container.
|
virtual |
"Easy" interface metadata of a Block retrieval. This parses p_what and, on success, calls the native header() equivalent.
hea | A StaticBlockHeader structure that will receive the metadata. |
p_what | Some string that as_locator() can parse into a Locator. E.g. //base/entity/key |
This is a faster, not involving RAM allocation version of the other form of header. For a tensor, is will be the only thing you need, but for a Kind or a Tuple, you probably want the types of all its items and need to pass a pTransaction to hold the data.
Reimplemented from jazz_elements::Container.
|
virtual |
"Easy" interface metadata of a Block retrieval. This parses p_what and, on success, calls the native header() equivalent.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
p_what | Some string that as_locator() can parse into a Locator. E.g. //base/entity/key |
Unlike its faster form, this allocates a Block and therefore, it is equivalent to a new_block() call. On success, it will return a Transaction that belongs to the Container and must be destroy_transaction()-ed when the caller is done.
For Tensors it will allocate a block that only has the StaticBlockHeader (What you can more efficiently get from the other form.) For Kinds, the metadata of all the items is exactly the same a .get() call returns. For Tuples, it does what you expect: returning a Block with the metadata of all the items without the data.
Reimplemented from jazz_elements::Container.
|
virtual |
The "native" interface: This is what really does the job and must be implemented in the Container descendants.
hea | A StaticBlockHeader structure that will receive the metadata. |
what | Some Locator to the block. (See Node Method Reference in the documentation of the class Volatile.) |
NOTE**: The root Container class does not implement this.
Reimplemented from jazz_elements::Container.
|
virtual |
The "native" interface: This is what really does the job and must be implemented in the Container descendants.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
what | Some Locator to the block. (See Node Method Reference in the documentation of the class Volatile.) |
NOTE**: The root Container class does not implement this.
Reimplemented from jazz_elements::Container.
|
virtual |
"Easy" interface for Block storing: This parses p_where and, on success, calls the native put() equivalent.
p_where | Some string that as_locator() can parse into a Locator. E.g. //base/entity/key |
p_block | A block to be stored. Notice it is a block, not a Transaction. If necessary, the Container will make a copy, write to disc, PUT it via http, etc. The container does not own the pointer in any way. |
mode | Some writing restriction that should return an error if not supported. It controls overriding or writing just the data as when writing to a file. |
Reimplemented from jazz_elements::Container.
|
virtual |
The "native" interface: This is what really does the job and must be implemented in the Container descendants.
where | Some destination Locator to the block. (See Node Method Reference in the documentation of the class Volatile.) |
p_block | The Block to be stored in Volatile. The Block hash and dated will be updated by this call!! |
mode | Some writing restriction, either WRITE_ONLY_IF_EXISTS or WRITE_ONLY_IF_NOT_EXISTS. WRITE_TENSOR_DATA returns the error SERVICE_ERROR_WRONG_ARGUMENTS |
NOTE**: The root Container class does not implement this.
Reimplemented from jazz_elements::Container.
|
virtual |
"Easy" interface : Locate a block by some relation that is understandable by the descendant.
location | The solved location of the block. |
p_what | A valid reference to a block. E.g. //deque/ent/~first, //tree/ent/key~parent, //queue/ent/~highest |
The default behaviour of this is returning the same locator that is given for most Containers. Only containers like Volatile which support block relations defined by commands will return actual //base/ent/key locators that are the result of some computation.
Reimplemented from jazz_elements::Container.
|
virtual |
The "native" interface: The default behavior for most Container descendants that do not support commands is just copying.
location | The solved location of the block. |
what | A valid reference to a block. E.g. //deque/ent/~first, //tree/ent/key~parent, //queue/ent/~highest |
NOTE: This just copies what into location. It will not verify the existence of the block. The function of locate() is to evaluate commands in Containers supporting them (E.g, Volatile). Otherwise, it is a trivial conversion from the easy into the native API.
Reimplemented from jazz_elements::Container.
|
virtual |
"Easy" interface for creating entities: This parses p_where and, on success, calls the native new_entity() equivalent.
p_where | Some string that as_locator() can parse into a Locator. E.g. //base/entity |
What an entity is, is Container and base dependent. It can be an lmdb database, a folder in a filesystem, a Volatile tree, ...
Reimplemented from jazz_elements::Container.
|
virtual |
The "native" interface: This is what really does the job and must be implemented in the Container descendants.
where | Some destination Locator to the block. (See Node Method Reference in the documentation of the class Volatile.) |
NOTE**: The root Container class does not implement this.
Reimplemented from jazz_elements::Container.
|
virtual |
"Easy" interface for deleting entities and blocks: This parses p_where and, on success, calls the native header() equivalent.
p_where | Some string that as_locator() can parse into a Locator. E.g. //base/entity or //base/entity/key |
What an entity is, is Container and base dependent. It can be an lmdb database, a folder in a filesystem, a Volatile tree, ...
Reimplemented from jazz_elements::Container.
|
virtual |
The "native" interface: This is what really does the job and must be implemented in the Container descendants.
where | The block or entity to be removed. (See Node Method Reference in the documentation of the class Volatile.) |
NOTE**: The root Container class does not implement this.
Reimplemented from jazz_elements::Container.
|
virtual |
"Easy" interface for Block copying: This parses p_what and p_where. On success, it calls the native copy() equivalent.
p_where | Some destination that as_locator() can parse into a Locator. E.g. //base/entity/key |
p_what | Some source that as_locator() can parse into a Locator. E.g. //base/entity/key |
NOTE**: This does not copy blocks across Containers. A copy() call is a short way to do "get(tx, what); put(where, tx); destroy_transaction(tx);" without the Container needing to allocate Transactions and, possibly, not even blocks. To copy blocks across containers, you need channels.
Reimplemented from jazz_elements::Container.
|
virtual |
The "native" interface: This is what really does the job and must be implemented in the Container descendants.
where | The block or entity to be written. (See Node Method Reference in the documentation of the class Volatile.) |
what | The block or entity to be read. (See Node Method Reference in the documentation of the class Volatile.) |
NOTE**: The root Container class does not implement this.
Reimplemented from jazz_elements::Container.