gobj_start_up()
#
The gobj_start_up()
function initializes the GObj system and prepares the yuno for operation. It applies global configurations, sets up memory management, and integrates key components like command parsing, statistics handling, and user authentication.
Key Features:
Global Settings: Accepts a JSON object Global Settings that defines configuration attributes for classes and objects in the Yuno. These attributes are applied to each GObj upon creation.
Persistent Attributes: Uses database functions Persistent Attributes to store and retrieve persistent attributes marked in Gobjs.
Custom Parsers:
Command Parser: Parses commands for Gobjs. Defaults to a built-in parser if
NULL
. See Command Parser.Statistics Parser: Handles GObj statistics requests, linked to attributes flagged with
SDF_STATS
. Defaults to a built-in function ifNULL
. See Statistics Parser.
User Management:
Authorization Checker: Validates user permissions for commands, attributes, and events. See Authorization Checker.
Authentication Parser: Authenticates users with a built-in or custom function. See Authentication Parser.
Memory Management: Configures limits for memory block size (
mem_max_block
) and total system memory (mem_max_system_memory
). Exceeding these limits triggers a Yuno exit andre-launch
.
Usage:
gobj_start_up()
must be called before using any GObj functionalities. To terminate properly, use its counterpart, gobj_end()
.
Prototype
PUBLIC int gobj_start_up( /* Initialize the gobj's system */
int argc,
char *argv[],
const json_t *jn_global_settings, /* NOT owned */
const persistent_attrs_t *persistent_attrs,
json_function_fn global_command_parser,
json_function_fn global_statistics_parser,
authorization_checker_fn global_authorization_checker,
authentication_parser_fn global_authentication_parser,
size_t mem_max_block,
size_t mem_max_system_memory,
BOOL use_own_system_memory,
size_t mem_min_block, // used only in internal memory manager
size_t mem_superblock // used only in internal memory manager
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Argument |
|
|
Argument |
|
A JSON object containing global configuration settings. This parameter is not owned by the function. See Global Settings. |
|
|
A structure containing database functions for managing persistent attributes of gobjs. See Persistent Attributes. |
|
|
A function pointer for handling global command parsing. If |
|
|
A function pointer for handling global statistics parsing. If |
|
|
A function pointer for performing global authorization checks. See Authorization Checker. |
|
|
A function pointer for parsing and handling global authentication requests. See Authentication Parser. |
|
|
|
Specifies the maximum size of a single memory block, in bytes. The default value is |
|
|
Specifies the total memory limit for the system, in bytes. The default value is |
|
|
Flag indicating whether to use the internal memory manager.
Default is |
|
|
Minimum size of memory blocks, used only if |
|
|
Size of superblocks, used only if |
Return Value
0
: Success.< 0
: Indicates an error during initialization.
Prototype
TODO
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Xxx xx xxx xxxx. |
Return Value
0
: Success.< 0
: Indicates an error during initialization.
Prototype
TODO
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Xxx xx xxx xxxx. |
Return Value
0
: Success.< 0
: Indicates an error during initialization.
Examples
// TODO
// TODO
# TODO