Jazz 1.25.+
Loading...
Searching...
No Matches
Public Member Functions
jazz_models::ModelsAPI Class Reference

ModelsAPI: The model API. More...

#include <models_api.h>

Inheritance diagram for jazz_models::ModelsAPI:
jazz_bebop::BaseAPI jazz_elements::Container jazz_elements::Service

Public Member Functions

 ModelsAPI (pLogger a_logger, pConfigFile a_config, pChannels a_channels, pVolatile a_volatile, pPersisted a_persisted, pCore a_core)
 
virtual pChar const id ()
 
StatusCode start ()
 
StatusCode shut_down ()
 
void base_names (BaseNames &base_names)
 
virtual StatusCode get (pTransaction &p_txn, ApiQueryState &what)
 
- Public Member Functions inherited from jazz_bebop::BaseAPI
 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 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 ()
 
- Public Member Functions inherited from jazz_elements::Container
 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 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 locate (Locator &location, pChar p_what)
 
virtual StatusCode header (StaticBlockHeader &hea, pChar p_what)
 
virtual StatusCode header (pTransaction &p_txn, pChar p_what)
 
virtual StatusCode put (pChar p_where, pBlock p_block, int mode=WRITE_AS_BASE_DEFAULT)
 
virtual StatusCode new_entity (pChar p_where)
 
virtual StatusCode remove (pChar p_where)
 
virtual StatusCode copy (pChar p_where, pChar p_what)
 
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)
 
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)
 
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)
 
- Public Member Functions inherited from jazz_elements::Service
 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)
 

Additional Inherited Members

- Data Fields inherited from jazz_bebop::BaseAPI
TenBitPtrLUT base_server
 A LUT to convert TenBitsAtAddress(base) into a pContainer.
 
- Data Fields inherited from jazz_elements::Service
pLogger p_log
 The logger.
 
pConfigFile p_conf
 The configuration file.
 
- Protected Member Functions inherited from jazz_bebop::BaseAPI
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)
 
- Protected Member Functions inherited from jazz_elements::Container
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)
 
- Protected Attributes inherited from jazz_bebop::BaseAPI
pChannels p_channels
 The Channels container.
 
pVolatile p_volatile
 The Volatile container.
 
pPersisted p_persisted
 The Persisted container.
 
- Protected Attributes inherited from jazz_elements::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.
 

Detailed Description

ModelsAPI: The model API.

This class holds an object that can execute via an .exec() method in a similar way as a Core, but using a model as a resolver.

Constructor & Destructor Documentation

◆ ModelsAPI()

jazz_models::ModelsAPI::ModelsAPI ( pLogger  a_logger,
pConfigFile  a_config,
pChannels  a_channels,
pVolatile  a_volatile,
pPersisted  a_persisted,
pCore  a_core 
)

Create the ModelsAPI without starting it.

Parameters
a_loggerA pointer to the logger.
a_configA pointer to the configuration.
a_channelsA pointer to the ChannelsAPI.
a_volatileA pointer to the VolatileAPI.
a_persistedA pointer to the PersistedAPI.
a_coreA pointer to the CoreAPI.

Member Function Documentation

◆ id()

pChar const jazz_models::ModelsAPI::id ( )
virtual

Return object ID.

Returns
A string identifying the object that is especially useful to track uplifts and versions.

Reimplemented from jazz_bebop::BaseAPI.

◆ start()

StatusCode jazz_models::ModelsAPI::start ( )
virtual

Starts the ModelsAPI service

Returns
SERVICE_NO_ERROR if successful, an error code otherwise.

Reimplemented from jazz_bebop::BaseAPI.

◆ shut_down()

StatusCode jazz_models::ModelsAPI::shut_down ( )
virtual

Shuts down the ModelsAPI Service

Returns
SERVICE_NO_ERROR if successful, an error code otherwise.

Reimplemented from jazz_bebop::BaseAPI.

◆ base_names()

void jazz_models::ModelsAPI::base_names ( BaseNames base_names)

Add the base names for this ModelsAPI.

Parameters
base_namesA BaseNames map passed by reference to which the base names of this object are added by this call.

◆ get()

StatusCode jazz_models::ModelsAPI::get ( pTransaction p_txn,
ApiQueryState what 
)
virtual

"API" interface complete Block retrieval. This uses a parse()d what and is the only BasePI + descendants GET method.

Parameters
p_txnA pointer to a Transaction passed by reference. If successful, the Container will return a pointer to a Transaction inside the Container.
whatSome successfully parse()d ApiQueryState that also distinguishes API interface from Container interface.
Returns
SERVICE_NO_ERROR on success (and a valid p_txn), or some negative value (error).

It should support the range from APPLY_NOTHING to APPLY_TEXT. This includes function calls APPLY_FUNCTION and APPLY_FUNCT_CONST, but also APPLY_FILTER and APPLY_FILT_CONST to select from the result of a function call. Also, APPLY_URL is very convenient for passing text as an argument to a function. APPLY_NOTHING can return some metadata about the model including a list of endpoints. APPLY_NAME can define specifics of an endpoint. APPLY_RAW and APPLY_TEXT can be used to select the favorite serialization format of the result. Therefore, the function interface should be considered as the whole range and not just APPLY_FUNCTION.

Reimplemented from jazz_bebop::BaseAPI.


The documentation for this class was generated from the following files: