![]() |
Jazz 1.25.+
|
Core: The execution unit is now a wrapper around onnx-runtime. More...
#include <core.h>
Public Member Functions | |
Core (pLogger a_logger, pConfigFile a_config, pChannels a_channels, pVolatile a_volatile, pPersisted a_persisted) | |
Creates a Core service without starting it. | |
virtual pChar const | id () |
StatusCode | start () |
StatusCode | shut_down () |
void | base_names (BaseNames &base_names) |
virtual StatusCode | new_entity (pChar p_where) |
virtual StatusCode | new_entity (Locator &where) |
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 | remove (pChar p_where) |
virtual StatusCode | remove (Locator &where) |
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 | 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 | exec (pTransaction &p_txn, Locator &function, pTuple p_args) |
virtual StatusCode | modify (Locator &function, pTuple p_args) |
![]() | |
BaseAPI (pLogger a_logger, pConfigFile a_config, pChannels a_channels, pVolatile a_volatile, pPersisted a_persisted) | |
Creates a BaseAPI service without starting it. | |
bool | parse (ApiQueryState &q_state, pChar p_url, int method, bool recurse=false) |
bool | block_from_const (pTransaction &p_txn, pChar p_const, bool make_tuple=false) |
virtual StatusCode | header (StaticBlockHeader &hea, ApiQueryState &what) |
virtual StatusCode | get (pTransaction &p_txn, ApiQueryState &what) |
virtual StatusCode | put (ApiQueryState &where, pBlock p_block, int mode=WRITE_AS_BASE_DEFAULT) |
virtual StatusCode | remove (ApiQueryState &what) |
pChannels | get_channels () |
pVolatile | get_volatile () |
pPersisted | get_persisted () |
![]() | |
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 | new_transaction (pTransaction &p_txn) |
virtual void | destroy_transaction (pTransaction &p_txn) |
virtual StatusCode | locate (Locator &location, pChar p_what) |
virtual StatusCode | copy (pChar p_where, pChar p_what) |
virtual StatusCode | as_locator (Locator &result, pChar p_what) |
virtual StatusCode | locate (Locator &location, Locator &what) |
virtual StatusCode | copy (Locator &where, Locator &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 | |
DataSpaces | data_spaces |
The data spaces. | |
Fields | fields |
The fields. | |
Bop | bop |
The Bop compiler. | |
Additional Inherited Members | |
![]() | |
TenBitPtrLUT | base_server |
A LUT to convert TenBitsAtAddress(base) into a pContainer. | |
![]() | |
pLogger | p_log |
The logger. | |
pConfigFile | p_conf |
The configuration file. | |
![]() | |
bool | parse_locator (Locator &loc, pChar p_url) |
int | move_const (pChar p_buff, int buff_size, pChar p_url, pChar p_base=nullptr) |
StatusCode | get_right_local (pTransaction &p_txn, ApiQueryState &q_state) |
StatusCode | get_right_remote (pTransaction &p_txn, ApiQueryState &q_state) |
StatusCode | get_left_local (pTransaction &p_txn, ApiQueryState &q_state) |
StatusCode | put_left_local (ApiQueryState &q_state, pBlock p_block) |
![]() | |
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) |
![]() | |
pChannels | p_channels |
The Channels container. | |
pVolatile | p_volatile |
The Volatile container. | |
pPersisted | p_persisted |
The Persisted container. | |
![]() | |
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. | |
Core: The execution unit is now a wrapper around onnx-runtime.
This class:
Manages dataspaces. Manages fields. Manages life cycle of Snippets: create from source, from object, update, delete. Compiles or decompiles Snippets. Manages onnx runtime sessions. Runs bop objects.
This is the only interface this class has. Everything, is done using this interface, even when this object is used by a ModelsAPI.
Everything here can be called from the API + destroy_transaction() (You don't override destroy_transaction() since you don't override new_transaction()). Of course, not everything must be supported, but since it could be called by some possibly nonsensical API query, it is better to reject whatever is not supported with a proper error code.
The class must support all forms of: new_entity
, put
, remove
, header
, get
, exec
, modify
.
Unlike in other containers, the override is based on only on types, using the locate() mechanism is optional. Unlike in other containers, copy() is not called from the API. copy() is just an internal function to copy inside a Container in the most efficient way.
jazz_bebop::Core::Core | ( | pLogger | a_logger, |
pConfigFile | a_config, | ||
pChannels | a_channels, | ||
pVolatile | a_volatile, | ||
pPersisted | a_persisted | ||
) |
Creates a Core service without starting it.
a_logger | A pointer to the logger. |
a_config | A pointer to the configuration. |
a_channels | A pointer to an initialized Channels Container. |
a_volatile | A pointer to an initialized Volatile Container. |
a_persisted | A pointer to an initialized Persisted Container. |
|
virtual |
Return object ID.
Reimplemented from jazz_bebop::BaseAPI.
|
virtual |
Starts the Core service
Reimplemented from jazz_bebop::BaseAPI.
|
virtual |
Shuts down the Core Service
Reimplemented from jazz_bebop::BaseAPI.
void jazz_bebop::Core::base_names | ( | BaseNames & | base_names | ) |
Add the base names for this ModelsAPI.
base_names | A BaseNames map passed by reference to which the base names of this object are added by this call. |
|
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 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 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 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 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 |
The function call interface for exec: Execute a function or a model.
p_txn | A pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container. |
function | Some description of a service. In general base/entity/key. In Channels the key must be empty and the entity is the pipeline. In Core, the key is field/snippet, In Model (via ModelAPI), model/(entry point). |
p_args | A Tuple passed as argument to the call that is not modified. |
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 function call interface for modify: In jazz_elements, this is only implemented in Channels.
function | Some description of a service. In general base/entity/key. In Channels the key must be empty and the entity is the pipeline. |
p_args | In Channels: A Tuple with two items, "input" with the data passed to the service and "result" with the data returned. The result will be overridden in-place without any allocation. |
modify() is similar to exec(), but, rather than creating a new block with the result, it modifies the Tuple p_args.
Reimplemented from jazz_elements::Container.