|
| BaseAPI (pLogger a_logger, pConfigFile a_config, pChannels a_channels, pVolatile a_volatile, pPersisted a_persisted) |
| Creates a BaseAPI service without starting it.
|
|
virtual pChar const | id () |
|
StatusCode | start () |
|
StatusCode | shut_down () |
|
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) |
|
StatusCode | start () |
|
StatusCode | shut_down () |
|
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) |
|
| 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) |
|
BaseAPI: The parent of API and Core.
This manages parsing queries and them to the appropriate containers.
"API" interface metadata of a Block retrieval. This uses a parse()d what and is the only BasePI + descendants GET method.
- Parameters
-
hea | A StaticBlockHeader structure that will receive the metadata. |
what | Some successfully parse()d ApiQueryState that also distinguishes API interface from Container interface. |
- Returns
- SERVICE_NO_ERROR on success (and a valid hea), or some negative value (error).
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.
NOTE: It only supports APPLY_NOTHING and APPLY_NAME. It is used by Core to check argument types of Tensors or Tuple items.
"API" interface complete Block retrieval. This uses a parse()d what and is the only BasePI + descendants GET method.
- Parameters
-
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 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).
In the BaseAPI class, this implements all the apply cases from APPLY_NOTHING to APPLY_SET_ATTRIBUTE (APPLY_JAZZ_INFO is http only). What the aseAPI class does is forwarding the request to the right container (if the base is found, returning SERVICE_ERROR_WRONG_BASE if not).
In the descendants (Core and ModelsAPI) 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 in jazz_models::ModelsAPI.
"API" interface for Block storing: This uses a parse()d where
and is the only BasePI + descendants PUT method.
- Parameters
-
where | Some successfully parse()d ApiQueryState that also distinguishes API interface from Container interface. |
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, either WRITE_ONLY_IF_EXISTS or WRITE_ONLY_IF_NOT_EXISTS. WRITE_TENSOR_DATA returns the error SERVICE_ERROR_WRONG_ARGUMENTS. (See NOTE below. |
- Returns
- SERVICE_NO_ERROR on success or some negative value (error).
NOTE: The http API does not use mode, but everything in jazz_elements does. Especially, anything in Channels that uses http as a client makes intensive use of WRITE_AS_STRING, WRITE_AS_CONTENT, ... Also, it is nice that Persisted supports WRITE_ONLY_IF_EXISTS and WRITE_ONLY_IF_NOT_EXISTS to support things like one-time initialization or preventing undesired creation of new variables. Therefore, think twice before completely removing mode even if the http API does not use it. At Bebop level and model level, it can be used.
NOTE: From an API perspective, put() only supports: APPLY_NOTHING, APPLY_RAW, APPLY_TEXT and APPLY_URL (both local and remote).
The "API" interface: This uses a parse()d what
and
- Parameters
-
what | Some successfully parse()d ApiQueryState that also distinguishes API interface from Container interface. |
- Returns
- SERVICE_NO_ERROR on success or some negative value (error).
Internals
It supports any successful HTTP_PUT syntax, that is:
APPLY_NOTHING: With or without node, mandatory base and entity, with of without a key. APPLY_URL: With or without node and just a base.
In all cases, calls with a node (it can only be l_node) what.url
contains exactly what has to be forwarded.