.TH "hyle-source/hyle_source.h" 3 "libhyle-source" \" -*- nroff -*- .ad l .nh .SH NAME hyle-source/hyle_source.h \- Persistence layer for hyle datasets\&. .SH SYNOPSIS .br .PP \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include 'store\&.h'\fP .br .SS "Data Structures" .in +1c .ti -1c .RI "struct \fBhyle_source_field_t\fP" .br .RI "Authorization-relevant field metadata of a dataset\&. " .ti -1c .RI "struct \fBhyle_source_list_field_t\fP" .br .RI "One named column of a list view\&. " .ti -1c .RI "struct \fBhyle_source_list_view_t\fP" .br .RI "List-view configuration of a dataset\&. " .ti -1c .RI "struct \fBhyle_source_def_s\fP" .br .RI "Definition of one hyle source dataset\&. " .ti -1c .RI "struct \fBhyle_source_state_field_t\fP" .br .RI "One entry of a state JSON field spec list\&. " .ti -1c .RI "struct \fBhyle_source_state_kv_t\fP" .br .RI "One key/value overlay entry for state JSON\&. " .ti -1c .RI "struct \fBhyle_json_str_map_t\fP" .br .RI "One string-copy mapping used by hyle_json_extract_strings\&. " .ti -1c .RI "struct \fBhyle_ordered_field_sync_t\fP" .br .RI "One sync field of an ordered partition\&. " .in -1c .SS "Macros" .in +1c .ti -1c .RI "#define \fBHYLE_SOURCE_FIELD_KIND_INVERSE\fP HYLE_KIND_INVERSE" .br .RI "Inverse-kind compatibility alias\&. " .ti -1c .RI "#define \fBHYLE_SOURCE_FLAG_VOLATILE\fP 64u" .br .RI "Dataset kept in memory only (not persisted)\&. " .ti -1c .RI "#define \fBHYLE_SOURCE_FLAG_CREATABLE\fP 128u" .br .RI "Dataset allows client record creation\&. " .ti -1c .RI "#define \fBHYLE_SOURCE_ERR_VALIDATION\fP \-2" .br .RI "Validation error return sentinel\&. " .in -1c .SS "Typedefs" .in +1c .ti -1c .RI "typedef hyle_schema_desc_t \fBhyle_source_desc_t\fP" .br .RI "Framework-neutral unified descriptor alias\&. " .ti -1c .RI "typedef struct \fBhyle_source_def_s\fP \fBhyle_source_def_t\fP" .br .RI "Definition of one hyle source dataset\&. " .ti -1c .RI "typedef int(* \fBhyle_source_each_cb_t\fP) (const \fBhyle_source_def_t\fP *, void *)" .br .RI "Callback invoked once per registered dataset\&. " .ti -1c .RI "typedef int(* \fBhyle_field_getter_fn\fP) (const char *name, char *buf, size_t sz, void *user)" .br .RI "Generic single-field getter callback for form parsing\&. " .ti -1c .RI "typedef int(* \fBhyle_multi_field_getter_fn\fP) (const char *name, char *buf, size_t sz, void *user)" .br .RI "Generic multi-field getter callback for form parsing\&. " .ti -1c .RI "typedef void(* \fBhyle_source_ordered_each_fn\fP) (int index, const char *key, unsigned fields_hd, void *user)" .br .RI "Per-row callback of an ordered-partition walk\&. " .ti -1c .RI "typedef void(* \fBhyle_source_ref_cb_t\fP) (const char *source_id, void *user)" .br .RI "Callback receiving one referencing source id\&. " .in -1c .SS "Enumerations" .in +1c .ti -1c .RI "enum \fBhyle_source_access_policy_t\fP { \fBHYLE_SOURCE_ACCESS_PUBLIC\fP = 0, \fBHYLE_SOURCE_ACCESS_LOGIN\fP }" .br .RI "Access policy of a hyle source dataset\&. " .ti -1c .RI "enum \fBhyle_source_access_result_t\fP { \fBHYLE_SOURCE_ACCESS_RESULT_ALLOW\fP = 0, \fBHYLE_SOURCE_ACCESS_RESULT_UNAUTHORIZED\fP, \fBHYLE_SOURCE_ACCESS_RESULT_FORBIDDEN\fP }" .br .RI "Outcome of an access-control decision\&. " .ti -1c .RI "enum \fBhyle_source_state_kind_t\fP { \fBHYLE_SF_RECORD\fP, \fBHYLE_SF_EXCLUDE\fP, \fBHYLE_SF_REF_DISPLAY\fP }" .br .RI "Serialization mode of one state field\&. " .in -1c .SS "Functions" .in +1c .ti -1c .RI "int \fBhyle_source_clear_inverse_refs\fP (int fd, const char *dataset_id, const char *item_id)" .br .RI "Remove all inverse references pointing at an item\&. " .ti -1c .RI "int \fBhyle_source_def_to_corm\fP (const \fBhyle_source_desc_t\fP *defs, int count, void *out)" .br .RI "Convert schema descriptors into a corm-openable record layout\&. " .ti -1c .RI "int \fBhyle_source_def_to_source_fields\fP (const \fBhyle_source_desc_t\fP *defs, int count, void *out)" .br .RI "Convert schema descriptors into source-field metadata\&. " .ti -1c .RI "int \fBhyle_source_def_to_meta_fields\fP (const \fBhyle_source_desc_t\fP *defs, int count, const void *record, void *out)" .br .RI "Derive meta-field descriptors for a record instance\&. " .ti -1c .RI "int \fBhyle_source_build_state_specs\fP (const \fBhyle_source_desc_t\fP *fields, \fBhyle_source_state_field_t\fP *specs, int max_specs)" .br .RI "Build the state-JSON field spec list for a dataset\&. " .ti -1c .RI "\fBhyle_source_def_t\fP * \fBhyle_source_find\fP (const char *dataset_id)" .br .RI "Look up a registered dataset by id\&. " .ti -1c .RI "int \fBhyle_source_is_creatable\fP (const char *dataset_id)" .br .RI "Whether a dataset allows client record creation\&. " .ti -1c .RI "int \fBhyle_source_item_exists\fP (const char *dataset_id, const char *item_id)" .br .RI "Whether an item id exists in a dataset\&. " .ti -1c .RI "int \fBhyle_source_register_def\fP (const \fBhyle_source_def_t\fP *def)" .br .RI "Register a dataset definition\&. " .ti -1c .RI "int \fBhyle_source_refresh_row\fP (int fd, const char *dataset_id, const char *id)" .br .RI "Reload a single row from persistent storage\&. " .ti -1c .RI "int \fBhyle_source_validate_row\fP (const \fBhyle_source_def_t\fP *def, unsigned data_handle, char **json_errors_out)" .br .RI "Validate a record against its field constraints\&. " .ti -1c .RI "int \fBhyle_source_update_item\fP (int fd, const char *dataset_id, const char *id, unsigned data_handle)" .br .RI "Persist an item record (write-through to the store)\&. " .ti -1c .RI "int \fBhyle_source_delete_item\fP (int fd, const \fBhyle_source_def_t\fP *def, const char *item_id)" .br .RI "Delete an item and its references\&. " .ti -1c .RI "int \fBhyle_ref_field_register\fP (const char *dataset_id, const char *field_name)" .br .RI "Register a field as an inverse relation target\&. " .ti -1c .RI "int \fBhyle_source_for_each\fP (\fBhyle_source_each_cb_t\fP cb, void *user)" .br .RI "Iterate over all registered datasets\&. " .ti -1c .RI "unsigned \fBhyle_source_query_dataset\fP (const char *dataset_id, const char *query_str)" .br .RI "Run a search query against a dataset\&. " .ti -1c .RI "int \fBhyle_source_cache_put\fP (const char *dataset_id, const char *query_str, const char *json, size_t len)" .br .RI "Store a query result or table slice in the client-side cache\&. " .ti -1c .RI "int \fBhyle_source_cache_put_ttl\fP (const char *dataset_id, const char *query_str, const char *json, size_t len, uint32_t ttl_ms)" .br .RI "Store a query result with explicit TTL in milliseconds\&. " .ti -1c .RI "int \fBhyle_source_cache_hydrate\fP (const char *dataset_id, const char *query_str, const char *json, size_t len, uint32_t ttl_ms)" .br .RI "Bulk hydrate a query slice into the client-side cache\&. " .ti -1c .RI "const char * \fBhyle_source_cache_get\fP (const char *dataset_id, const char *query_str, size_t *len_out)" .br .RI "Retrieve a cached query result or table slice\&. " .ti -1c .RI "const char * \fBhyle_source_cache_get_status\fP (const char *dataset_id, const char *query_str, size_t *len_out, int *is_stale)" .br .RI "Retrieve a cached query result with stale-while-revalidate indicator\&. " .ti -1c .RI "void \fBhyle_source_cache_invalidate\fP (const char *dataset_id)" .br .RI "Invalidate all cache entries matching a dataset identifier\&. " .ti -1c .RI "void \fBhyle_source_cache_clear\fP (void)" .br .RI "Clear all entries in the client-side cache\&. " .ti -1c .RI "size_t \fBhyle_source_cache_count\fP (const char *dataset_id)" .br .RI "Return the number of active cached entries for a dataset\&. " .ti -1c .RI "int \fBhyle_source_normalize_query\fP (const char *in_query, char *out_buf, size_t out_cap)" .br .RI "Normalize a query string into canonical key-sorted order\&. " .ti -1c .RI "unsigned \fBhyle_source_get_data_hd\fP (const char *dataset_id)" .br .RI "Item-records corm handle of a dataset\&. " .ti -1c .RI "unsigned \fBhyle_source_get_fields_hd\fP (const char *dataset_id)" .br .RI "Per-item fields corm handle of a dataset\&. " .ti -1c .RI "unsigned \fBhyle_source_get_schema_hd\fP (const char *dataset_id)" .br .RI "Schema metadata corm handle of a dataset\&. " .ti -1c .RI "const \fBhyle_source_list_view_t\fP * \fBhyle_source_get_list_view\fP (const char *dataset_id)" .br .RI "List-view configuration of a dataset\&. " .ti -1c .RI "int \fBhyle_source_build_item_json\fP (const \fBhyle_source_def_t\fP *def, const char *item_id, stl_json_t **out)" .br .RI "Build the JSON object of a single item\&. " .ti -1c .RI "int \fBhyle_source_build_state_json\fP (const char *dataset_id, const char *item_id, const \fBhyle_source_state_field_t\fP *specs, stl_json_t **out)" .br .RI "Build the state JSON of a single item\&. " .ti -1c .RI "int \fBhyle_source_state_overlay\fP (stl_json_t *jo, const \fBhyle_source_state_kv_t\fP *kvs)" .br .RI "Apply key/value overlays onto a JSON object\&. " .ti -1c .RI "int \fBhyle_source_overlay_from_desc\fP (stl_json_t *jo, const void *state, const \fBhyle_source_desc_t\fP *fields, int int_kind, int str_kind)" .br .RI "Overlay descriptors from a state struct onto a JSON object\&. " .ti -1c .RI "stl_json_t * \fBhyle_source_overlay_array\fP (const void *items, int count, size_t elem_size, const \fBhyle_source_desc_t\fP *fields, int int_kind, int str_kind)" .br .RI "Build a JSON array of objects from a record array\&. " .ti -1c .RI "int \fBhyle_source_resolve_ref_display_str\fP (const char *dataset_id, const char *item_id, const char *field_name, char *out, size_t out_sz)" .br .RI "Resolve a reference field to its display string\&. " .ti -1c .RI "int \fBhyle_source_resolve_meta_display\fP (const char *dataset_id, const char *item_id, const \fBhyle_source_desc_t\fP *fields, int count, void *state)" .br .RI "Resolve reference and inverse fields into display state\&. " .ti -1c .RI "int \fBhyle_source_meta_read\fP (const char *path, const \fBhyle_source_desc_t\fP *fields, int count, void *record, size_t record_size)" .br .RI "Read a meta file into a record struct\&. " .ti -1c .RI "int \fBhyle_source_meta_write\fP (const char *path, const \fBhyle_source_desc_t\fP *fields, int count, const void *record)" .br .RI "Write a record struct as a meta file\&. " .ti -1c .RI "uint32_t \fBhyle_source_setup\fP (const char *source_id, const char *key_field, size_t record_size, const char *items_path, const \fBhyle_source_desc_t\fP *defs, int field_count, unsigned flags, const \fBhyle_source_list_view_t\fP *list_view)" .br .RI "Set up and register a dataset definition\&. " .ti -1c .RI "size_t \fBhyle_source_inv_keys\fP (const char *dataset_id, const char *field, uint32_t target_pos, const char **keys, size_t max)" .br .RI "Collect inverse keys referencing a target position\&. " .ti -1c .RI "const char * \fBhyle_source_inv_key_at\fP (const char *dataset_id, const char *field, uint32_t target_pos, size_t index)" .br .RI "Inverse key at an index\&. " .ti -1c .RI "const char * \fBhyle_corm_get_field_str\fP (unsigned hd, const char *id, const char *field)" .br .RI "Read a string field of an item from the item-records map\&. " .ti -1c .RI "int \fBhyle_source_dsv_load\fP (const char *source_id, const char *pval, unsigned fhd, void *user)" .br .RI "Load a dataset from a DSV string\&. " .ti -1c .RI "int \fBhyle_source_dsv_save\fP (const char *source_id, const char *pval, unsigned fhd, void *user)" .br .RI "Serialize a dataset to a DSV string\&. " .ti -1c .RI "const \fBhyle_source_desc_t\fP * \fBhyle_source_get_desc\fP (const char *dataset_id, int *count_out)" .br .RI "Field descriptors of a dataset\&. " .ti -1c .RI "size_t \fBhyle_source_get_record_size\fP (const char *dataset_id)" .br .RI "Record struct size of a dataset\&. " .ti -1c .RI "unsigned \fBhyle_source_parse_row_data_custom\fP (const \fBhyle_source_def_t\fP *def, \fBhyle_field_getter_fn\fP get_single, \fBhyle_multi_field_getter_fn\fP get_multi, void *user)" .br .RI "Parse submitted form data into an opened corm handle\&. " .ti -1c .RI "int \fBhyle_source_get_display_field\fP (const char *dataset_id, char *out, size_t sz)" .br .RI "Display field name of a dataset\&. " .ti -1c .RI "const char * \fBhyle_source_get_item_label\fP (const char *dataset_id, const char *row_id, const char *display_field, char *out, size_t sz)" .br .RI "Display label of a row\&. " .ti -1c .RI "int \fBhyle_source_resolve_options\fP (const char *dataset_id, const char *q, int page0, int per_page, \fBhyle_option_t\fP *opts, int max, int *total_out, char(*id_buf)[64], char(*label_buf)[256])" .br .RI "Resolve a searched option page for a picker\&. " .ti -1c .RI "int \fBhyle_source_resolve_tokens\fP (const char *dataset_id, const char *comma_slugs, \fBhyle_option_t\fP *out, int max, char(*id_buf)[64], char(*label_buf)[256])" .br .RI "Resolve comma-separated slugs to their option records\&. " .ti -1c .RI "int \fBhyle_source_normalize_tokens_to_slugs\fP (const char *dataset_id, const char *raw, char *out, size_t out_sz)" .br .RI "Normalize raw token text into comma-separated slug form\&. " .ti -1c .RI "int \fBhyle_source_get_enum_options\fP (const char *dataset_id, \fBhyle_option_t\fP *pool, int pool_avail, char(*id_buf)[64], char(*label_buf)[256])" .br .RI "Enumerate a dataset's enum-valued options\&. " .ti -1c .RI "int \fBhyle_source_is_safe_id\fP (const char *id)" .br .RI "Whether an id is safe for filesystem use\&. " .ti -1c .RI "char * \fBhyle_source_slurp_file\fP (const char *path)" .br .RI "Read an entire file into a malloc'd buffer\&. " .ti -1c .RI "int \fBhyle_source_write_file\fP (const char *path, const char *buf, size_t sz)" .br .RI "Write a buffer to a file (creating parents as needed)\&. " .ti -1c .RI "int \fBhyle_source_remove_path_recursive\fP (const char *path)" .br .RI "Recursively remove a filesystem path\&. " .ti -1c .RI "const char * \fBhyle_source_resolve_doc_root\fP (char *buf, size_t sz)" .br .RI "Resolve the web document root\&. " .ti -1c .RI "int \fBhyle_source_internal_process_multi_ref\fP (const \fBhyle_source_field_t\fP *f, const char *dataset_id, char **data)" .br .RI "Process multiple reference values for one field (internal)\&. " .ti -1c .RI "int \fBhyle_source_ordered_sync_form_custom\fP (const char *source_id, const char *partition_id, const char *amount_param, const char *remove_param_prefix, const \fBhyle_ordered_field_sync_t\fP *fields, size_t n_fields, \fBhyle_field_getter_fn\fP get_field, void *user)" .br .RI "Sync ordered partition fields from submitted form data\&. " .ti -1c .RI "const char * \fBhyle_source_ordered_get_field\fP (const char *source_id, const char *partition_val, int index, const char *field)" .br .RI "Read a field of an ordered-partition row\&. " .ti -1c .RI "int \fBhyle_source_ordered_set_field\fP (const char *source_id, const char *partition_val, int index, const char *field, const char *value)" .br .RI "Set a field of an ordered-partition row and persist\&. " .ti -1c .RI "int \fBhyle_source_ordered_remove_and_save\fP (const char *source_id, const char *partition_val, int index)" .br .RI "Remove an ordered-partition row and persist\&. " .ti -1c .RI "int \fBhyle_source_ordered_append_and_save\fP (const char *source_id, const char *partition_val, const char **names, const char **vals, size_t count)" .br .RI "Append an ordered-partition row and persist\&. " .ti -1c .RI "int \fBhyle_source_ordered_find\fP (const char *source_id, const char *partition_val, const char *field, const char *val)" .br .RI "Index of the first ordered row matching a field value\&. " .ti -1c .RI "int \fBhyle_source_ordered_remove_matching\fP (const char *source_id, const char *partition_val, const char *field, const char *val)" .br .RI "Remove all rows matching a field value and persist\&. " .ti -1c .RI "int \fBhyle_source_ordered_replace_row\fP (const char *source_id, const char *partition_val, int index, const char **names, const char **vals, size_t count)" .br .RI "Replace an ordered-partition row and persist\&. " .ti -1c .RI "int \fBhyle_source_ordered_for_each\fP (const char *source_id, const char *partition_val, \fBhyle_source_ordered_each_fn\fP fn, void *user)" .br .RI "Iterate an ordered partition's rows\&. " .ti -1c .RI "const char * \fBhyle_source_get_field\fP (const char *source_id, const char *item_id, const char *field)" .br .RI "Read a field of an entity item\&. " .ti -1c .RI "int \fBhyle_source_set_field\fP (int fd, const char *source_id, const char *item_id, const char *field, const char *value)" .br .RI "Set a field of an entity item and persist\&. " .ti -1c .RI "int \fBhyle_source_get_field_int\fP (const char *source_id, const char *item_id, const char *field, int def_val)" .br .RI "Read an integer field of an entity item\&. " .ti -1c .RI "int \fBhyle_source_set_field_int\fP (int fd, const char *source_id, const char *item_id, const char *field, int val)" .br .RI "Set an integer field of an entity item and persist\&. " .ti -1c .RI "size_t \fBhyle_source_find_referencing\fP (const char *source_dataset, const char *ref_field, const char *target_id, const char **ids_out, size_t max)" .br .RI "Collect ids referencing a target through a relation field\&. " .ti -1c .RI "size_t \fBhyle_source_for_each_referencing\fP (const char *source_dataset, const char *ref_field, const char *target_id, \fBhyle_source_ref_cb_t\fP cb, void *user)" .br .RI "Visit all source ids referencing a target through a field\&. " .in -1c .SH "Detailed Description" .PP Persistence layer for hyle datasets\&. Owns storage drivers (filesystem, in-memory), dataset definitions, access control, and the CRUD entry points on top of hyle + corm\&. .SH "Typedef Documentation" .PP .SS "typedef int(* hyle_field_getter_fn) (const char *name, char *buf, size_t sz, void *user)" .PP Generic single-field getter callback for form parsing\&. .PP \fBParameters\fP .RS 4 \fIname\fP Field name\&. .br \fIbuf\fP Destination buffer\&. .br \fIsz\fP Capacity of buf\&. .br \fIuser\fP Caller data\&. .RE .PP \fBReturns\fP .RS 4 Copied length, or -1 when not found / unsupported\&. .RE .PP .SS "typedef int(* hyle_multi_field_getter_fn) (const char *name, char *buf, size_t sz, void *user)" .PP Generic multi-field getter callback for form parsing\&. .PP \fBParameters\fP .RS 4 \fIname\fP Field name\&. .br \fIbuf\fP Destination buffer\&. .br \fIsz\fP Capacity of buf\&. .br \fIuser\fP Caller data\&. .RE .PP \fBReturns\fP .RS 4 Copied length, or -1 when not found / unsupported\&. .RE .PP .SS "typedef int(* hyle_source_each_cb_t) (const \fBhyle_source_def_t\fP *, void *)" .PP Callback invoked once per registered dataset\&. .PP \fBParameters\fP .RS 4 \fIdef\fP Dataset definition\&. .br \fIuser\fP Caller data\&. .RE .PP \fBReturns\fP .RS 4 Non-zero to stop iteration\&. .RE .PP .SS "typedef void(* hyle_source_ordered_each_fn) (int index, const char *key, unsigned fields_hd, void *user)" .PP Per-row callback of an ordered-partition walk\&. .PP \fBParameters\fP .RS 4 \fIindex\fP Row index\&. .br \fIkey\fP Row key\&. .br \fIfields_hd\fP Fields corm handle\&. .br \fIuser\fP Caller data\&. .RE .PP .SS "typedef void(* hyle_source_ref_cb_t) (const char *source_id, void *user)" .PP Callback receiving one referencing source id\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Source dataset id\&. .br \fIuser\fP Caller data\&. .RE .PP .SH "Enumeration Type Documentation" .PP .SS "enum \fBhyle_source_access_policy_t\fP" .PP Access policy of a hyle source dataset\&. .PP \fBEnumerator\fP .in +1c .TP \f(BIHYLE_SOURCE_ACCESS_PUBLIC \fP Dataset readable/writable by anonymous visitors\&. .TP \f(BIHYLE_SOURCE_ACCESS_LOGIN \fP Dataset requires a login\&. .SS "enum \fBhyle_source_access_result_t\fP" .PP Outcome of an access-control decision\&. .PP \fBEnumerator\fP .in +1c .TP \f(BIHYLE_SOURCE_ACCESS_RESULT_ALLOW \fP Access granted\&. .TP \f(BIHYLE_SOURCE_ACCESS_RESULT_UNAUTHORIZED \fP Request rejected for missing authentication\&. .TP \f(BIHYLE_SOURCE_ACCESS_RESULT_FORBIDDEN \fP Request rejected for insufficient rights\&. .SS "enum \fBhyle_source_state_kind_t\fP" .PP Serialization mode of one state field\&. .PP \fBEnumerator\fP .in +1c .TP \f(BIHYLE_SF_RECORD \fP Include the field in state JSON\&. .TP \f(BIHYLE_SF_EXCLUDE \fP Exclude the field from state JSON\&. .TP \f(BIHYLE_SF_REF_DISPLAY \fP Resolve the field to its display name\&. .SH "Function Documentation" .PP .SS "const char * hyle_corm_get_field_str (unsigned hd, const char * id, const char * field)" .PP Read a string field of an item from the item-records map\&. .PP \fBParameters\fP .RS 4 \fIhd\fP Item-records corm handle\&. .br \fIid\fP Item id\&. .br \fIfield\fP Field name\&. .RE .PP \fBReturns\fP .RS 4 Field value, or NULL when absent\&. .RE .PP .SS "int hyle_ref_field_register (const char * dataset_id, const char * field_name)" .PP Register a field as an inverse relation target\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIfield_name\fP Inverse field name\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_build_item_json (const \fBhyle_source_def_t\fP * def, const char * item_id, stl_json_t ** out)" .PP Build the JSON object of a single item\&. .PP \fBParameters\fP .RS 4 \fIdef\fP Dataset definition\&. .br \fIitem_id\fP Item id\&. .br \fIout\fP Receives the item JSON object\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_build_state_json (const char * dataset_id, const char * item_id, const \fBhyle_source_state_field_t\fP * specs, stl_json_t ** out)" .PP Build the state JSON of a single item\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIitem_id\fP Item id\&. .br \fIspecs\fP State field specs, or NULL for defaults\&. .br \fIout\fP Receives the state JSON object\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_build_state_specs (const \fBhyle_source_desc_t\fP * fields, \fBhyle_source_state_field_t\fP * specs, int max_specs)" .PP Build the state-JSON field spec list for a dataset\&. .PP \fBParameters\fP .RS 4 \fIfields\fP Field descriptors\&. .br \fIspecs\fP Receives the state field specs\&. .br \fImax_specs\fP Capacity of specs\&. .RE .PP \fBReturns\fP .RS 4 Number of specs written, or negative on overflow\&. .RE .PP .SS "size_t hyle_source_cache_count (const char * dataset_id)" .PP Return the number of active cached entries for a dataset\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset identifier (or NULL for total across all datasets)\&. .RE .PP \fBReturns\fP .RS 4 Number of cached entries\&. .RE .PP .SS "const char * hyle_source_cache_get (const char * dataset_id, const char * query_str, size_t * len_out)" .PP Retrieve a cached query result or table slice\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset identifier\&. .br \fIquery_str\fP Query string or request key\&. .br \fIlen_out\fP Optional pointer to receive length in bytes\&. .RE .PP \fBReturns\fP .RS 4 Pointer to cached JSON string, or NULL if not in cache\&. .RE .PP .SS "void hyle_source_cache_invalidate (const char * dataset_id)" .PP Invalidate all cache entries matching a dataset identifier\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset identifier (or NULL to invalidate all datasets)\&. .RE .PP .SS "int hyle_source_cache_put (const char * dataset_id, const char * query_str, const char * json, size_t len)" .PP Store a query result or table slice in the client-side cache\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset identifier (e\&.g\&. "song" or "song\&.items")\&. .br \fIquery_str\fP Query string or request key (e\&.g\&. "page=1&per_page=10\&.\&.\&.")\&. .br \fIjson\fP JSON state or response string to cache\&. .br \fIlen\fP Length of \fRjson\fP in bytes (or 0 to measure via strlen)\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on error\&. .RE .PP .SS "int hyle_source_clear_inverse_refs (int fd, const char * dataset_id, const char * item_id)" .PP Remove all inverse references pointing at an item\&. .PP \fBParameters\fP .RS 4 \fIfd\fP Corm file descriptor\&. .br \fIdataset_id\fP Source dataset id\&. .br \fIitem_id\fP Target item id\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_def_to_corm (const \fBhyle_source_desc_t\fP * defs, int count, void * out)" .PP Convert schema descriptors into a corm-openable record layout\&. .PP \fBParameters\fP .RS 4 \fIdefs\fP Field descriptors\&. .br \fIcount\fP Descriptor count\&. .br \fIout\fP Receives the corm record type configuration\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_def_to_meta_fields (const \fBhyle_source_desc_t\fP * defs, int count, const void * record, void * out)" .PP Derive meta-field descriptors for a record instance\&. .PP \fBParameters\fP .RS 4 \fIdefs\fP Field descriptors\&. .br \fIcount\fP Descriptor count\&. .br \fIrecord\fP Source record\&. .br \fIout\fP Receives the meta-field table\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_def_to_source_fields (const \fBhyle_source_desc_t\fP * defs, int count, void * out)" .PP Convert schema descriptors into source-field metadata\&. .PP \fBParameters\fP .RS 4 \fIdefs\fP Field descriptors\&. .br \fIcount\fP Descriptor count\&. .br \fIout\fP Receives the source-field table\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_delete_item (int fd, const \fBhyle_source_def_t\fP * def, const char * item_id)" .PP Delete an item and its references\&. .PP \fBParameters\fP .RS 4 \fIfd\fP Corm file descriptor\&. .br \fIdef\fP Dataset definition\&. .br \fIitem_id\fP Item id\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_dsv_load (const char * source_id, const char * pval, unsigned fhd, void * user)" .PP Load a dataset from a DSV string\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIpval\fP DSV payload\&. .br \fIfhd\fP Fields corm handle\&. .br \fIuser\fP Caller data\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_dsv_save (const char * source_id, const char * pval, unsigned fhd, void * user)" .PP Serialize a dataset to a DSV string\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIpval\fP Output payload\&. .br \fIfhd\fP Fields corm handle\&. .br \fIuser\fP Caller data\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "\fBhyle_source_def_t\fP * hyle_source_find (const char * dataset_id)" .PP Look up a registered dataset by id\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .RE .PP \fBReturns\fP .RS 4 Dataset definition, or NULL\&. .RE .PP .SS "size_t hyle_source_find_referencing (const char * source_dataset, const char * ref_field, const char * target_id, const char ** ids_out, size_t max)" .PP Collect ids referencing a target through a relation field\&. .PP \fBParameters\fP .RS 4 \fIsource_dataset\fP Source dataset id\&. .br \fIref_field\fP Relation field name\&. .br \fItarget_id\fP Referenced target id\&. .br \fIids_out\fP Receives matching source ids\&. .br \fImax\fP Capacity of ids_out\&. .RE .PP \fBReturns\fP .RS 4 Number of matches found\&. .RE .PP .SS "int hyle_source_for_each (\fBhyle_source_each_cb_t\fP cb, void * user)" .PP Iterate over all registered datasets\&. .PP \fBParameters\fP .RS 4 \fIcb\fP Per-dataset callback\&. .br \fIuser\fP Caller data\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "size_t hyle_source_for_each_referencing (const char * source_dataset, const char * ref_field, const char * target_id, \fBhyle_source_ref_cb_t\fP cb, void * user)" .PP Visit all source ids referencing a target through a field\&. .PP \fBParameters\fP .RS 4 \fIsource_dataset\fP Source dataset id\&. .br \fIref_field\fP Relation field name\&. .br \fItarget_id\fP Referenced target id\&. .br \fIcb\fP Per-source callback\&. .br \fIuser\fP Caller data\&. .RE .PP \fBReturns\fP .RS 4 Number of referencing sources visited\&. .RE .PP .SS "unsigned hyle_source_get_data_hd (const char * dataset_id)" .PP Item-records corm handle of a dataset\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .RE .PP \fBReturns\fP .RS 4 Corm handle, or 0 when unregistered\&. .RE .PP .SS "const \fBhyle_source_desc_t\fP * hyle_source_get_desc (const char * dataset_id, int * count_out)" .PP Field descriptors of a dataset\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIcount_out\fP Receives the descriptor count\&. .RE .PP \fBReturns\fP .RS 4 Descriptor array, or NULL when unregistered\&. .RE .PP .SS "int hyle_source_get_display_field (const char * dataset_id, char * out, size_t sz)" .PP Display field name of a dataset\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIout\fP Destination buffer\&. .br \fIsz\fP Capacity of out\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_get_enum_options (const char * dataset_id, \fBhyle_option_t\fP * pool, int pool_avail, char(*) id_buf[64], char(*) label_buf[256])" .PP Enumerate a dataset's enum-valued options\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIpool\fP Option pool storage\&. .br \fIpool_avail\fP Capacity of pool\&. .br \fIid_buf\fP Scratch for option ids\&. .br \fIlabel_buf\fP Scratch for option labels\&. .RE .PP \fBReturns\fP .RS 4 Option count on success, negative on failure\&. .RE .PP .SS "const char * hyle_source_get_field (const char * source_id, const char * item_id, const char * field)" .PP Read a field of an entity item\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIitem_id\fP Item id\&. .br \fIfield\fP Field name\&. .RE .PP \fBReturns\fP .RS 4 Field value, or NULL when absent\&. .RE .PP .SS "int hyle_source_get_field_int (const char * source_id, const char * item_id, const char * field, int def_val)" .PP Read an integer field of an entity item\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIitem_id\fP Item id\&. .br \fIfield\fP Field name\&. .br \fIdef_val\fP Default when absent or not an integer\&. .RE .PP \fBReturns\fP .RS 4 Field value\&. .RE .PP .SS "unsigned hyle_source_get_fields_hd (const char * dataset_id)" .PP Per-item fields corm handle of a dataset\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .RE .PP \fBReturns\fP .RS 4 Corm handle, or 0 when unregistered\&. .RE .PP .SS "const char * hyle_source_get_item_label (const char * dataset_id, const char * row_id, const char * display_field, char * out, size_t sz)" .PP Display label of a row\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIrow_id\fP Row id\&. .br \fIdisplay_field\fP Display field name\&. .br \fIout\fP Destination buffer\&. .br \fIsz\fP Capacity of out\&. .RE .PP \fBReturns\fP .RS 4 Label string, or NULL when unresolved\&. .RE .PP .SS "const \fBhyle_source_list_view_t\fP * hyle_source_get_list_view (const char * dataset_id)" .PP List-view configuration of a dataset\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .RE .PP \fBReturns\fP .RS 4 List view, or NULL when unregistered\&. .RE .PP .SS "size_t hyle_source_get_record_size (const char * dataset_id)" .PP Record struct size of a dataset\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .RE .PP \fBReturns\fP .RS 4 Record size, or 0 when unregistered\&. .RE .PP .SS "unsigned hyle_source_get_schema_hd (const char * dataset_id)" .PP Schema metadata corm handle of a dataset\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .RE .PP \fBReturns\fP .RS 4 Corm handle, or 0 when unregistered\&. .RE .PP .SS "int hyle_source_internal_process_multi_ref (const \fBhyle_source_field_t\fP * f, const char * dataset_id, char ** data)" .PP Process multiple reference values for one field (internal)\&. .PP \fBParameters\fP .RS 4 \fIf\fP Field metadata\&. .br \fIdataset_id\fP Dataset id\&. .br \fIdata\fP Value list to process\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "const char * hyle_source_inv_key_at (const char * dataset_id, const char * field, uint32_t target_pos, size_t index)" .PP Inverse key at an index\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIfield\fP Inverse field name\&. .br \fItarget_pos\fP Target record position\&. .br \fIindex\fP Result index\&. .RE .PP \fBReturns\fP .RS 4 Matching key, or NULL when out of range\&. .RE .PP .SS "size_t hyle_source_inv_keys (const char * dataset_id, const char * field, uint32_t target_pos, const char ** keys, size_t max)" .PP Collect inverse keys referencing a target position\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIfield\fP Inverse field name\&. .br \fItarget_pos\fP Target record position\&. .br \fIkeys\fP Receives matching keys\&. .br \fImax\fP Capacity of keys\&. .RE .PP \fBReturns\fP .RS 4 Number of keys found\&. .RE .PP .SS "int hyle_source_is_creatable (const char * dataset_id)" .PP Whether a dataset allows client record creation\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .RE .PP \fBReturns\fP .RS 4 Non-zero when creatable\&. .RE .PP .SS "int hyle_source_is_safe_id (const char * id)" .PP Whether an id is safe for filesystem use\&. .PP \fBParameters\fP .RS 4 \fIid\fP Candidate id\&. .RE .PP \fBReturns\fP .RS 4 Non-zero when the id contains no path separators or metacharacters\&. .RE .PP .SS "int hyle_source_item_exists (const char * dataset_id, const char * item_id)" .PP Whether an item id exists in a dataset\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIitem_id\fP Item id\&. .RE .PP \fBReturns\fP .RS 4 Non-zero when present\&. .RE .PP .SS "int hyle_source_meta_read (const char * path, const \fBhyle_source_desc_t\fP * fields, int count, void * record, size_t record_size)" .PP Read a meta file into a record struct\&. .PP \fBParameters\fP .RS 4 \fIpath\fP Meta file path\&. .br \fIfields\fP Field descriptors\&. .br \fIcount\fP Descriptor count\&. .br \fIrecord\fP Destination record struct\&. .br \fIrecord_size\fP Byte size of record\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_meta_write (const char * path, const \fBhyle_source_desc_t\fP * fields, int count, const void * record)" .PP Write a record struct as a meta file\&. .PP \fBParameters\fP .RS 4 \fIpath\fP Meta file path\&. .br \fIfields\fP Field descriptors\&. .br \fIcount\fP Descriptor count\&. .br \fIrecord\fP Source record struct\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_normalize_tokens_to_slugs (const char * dataset_id, const char * raw, char * out, size_t out_sz)" .PP Normalize raw token text into comma-separated slug form\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIraw\fP Raw token text\&. .br \fIout\fP Destination buffer\&. .br \fIout_sz\fP Capacity of out\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_ordered_append_and_save (const char * source_id, const char * partition_val, const char ** names, const char ** vals, size_t count)" .PP Append an ordered-partition row and persist\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIpartition_val\fP Partition value\&. .br \fInames\fP Field names\&. .br \fIvals\fP Field values\&. .br \fIcount\fP Field count\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_ordered_find (const char * source_id, const char * partition_val, const char * field, const char * val)" .PP Index of the first ordered row matching a field value\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIpartition_val\fP Partition value\&. .br \fIfield\fP Field name\&. .br \fIval\fP Search value\&. .RE .PP \fBReturns\fP .RS 4 Row index, or -1 when absent\&. .RE .PP .SS "int hyle_source_ordered_for_each (const char * source_id, const char * partition_val, \fBhyle_source_ordered_each_fn\fP fn, void * user)" .PP Iterate an ordered partition's rows\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIpartition_val\fP Partition value\&. .br \fIfn\fP Per-row callback\&. .br \fIuser\fP Caller data\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "const char * hyle_source_ordered_get_field (const char * source_id, const char * partition_val, int index, const char * field)" .PP Read a field of an ordered-partition row\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIpartition_val\fP Partition value\&. .br \fIindex\fP Row index\&. .br \fIfield\fP Field name\&. .RE .PP \fBReturns\fP .RS 4 Field value, or NULL when absent\&. .RE .PP .SS "int hyle_source_ordered_remove_and_save (const char * source_id, const char * partition_val, int index)" .PP Remove an ordered-partition row and persist\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIpartition_val\fP Partition value\&. .br \fIindex\fP Row index\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_ordered_remove_matching (const char * source_id, const char * partition_val, const char * field, const char * val)" .PP Remove all rows matching a field value and persist\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIpartition_val\fP Partition value\&. .br \fIfield\fP Field name\&. .br \fIval\fP Match value\&. .RE .PP \fBReturns\fP .RS 4 Removed count, or negative on failure\&. .RE .PP .SS "int hyle_source_ordered_replace_row (const char * source_id, const char * partition_val, int index, const char ** names, const char ** vals, size_t count)" .PP Replace an ordered-partition row and persist\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIpartition_val\fP Partition value\&. .br \fIindex\fP Row index\&. .br \fInames\fP Field names\&. .br \fIvals\fP Field values\&. .br \fIcount\fP Field count\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_ordered_set_field (const char * source_id, const char * partition_val, int index, const char * field, const char * value)" .PP Set a field of an ordered-partition row and persist\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIpartition_val\fP Partition value\&. .br \fIindex\fP Row index\&. .br \fIfield\fP Field name\&. .br \fIvalue\fP New value\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_ordered_sync_form_custom (const char * source_id, const char * partition_id, const char * amount_param, const char * remove_param_prefix, const \fBhyle_ordered_field_sync_t\fP * fields, size_t n_fields, \fBhyle_field_getter_fn\fP get_field, void * user)" .PP Sync ordered partition fields from submitted form data\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIpartition_id\fP Partition value\&. .br \fIamount_param\fP Form value holding the item count\&. .br \fIremove_param_prefix\fP Form param prefix marking removal slots\&. .br \fIfields\fP Field sync table\&. .br \fIn_fields\fP Sync table size\&. .br \fIget_field\fP Form getter\&. .br \fIuser\fP Caller data\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "stl_json_t * hyle_source_overlay_array (const void * items, int count, size_t elem_size, const \fBhyle_source_desc_t\fP * fields, int int_kind, int str_kind)" .PP Build a JSON array of objects from a record array\&. .PP \fBParameters\fP .RS 4 \fIitems\fP Record array\&. .br \fIcount\fP Record count\&. .br \fIelem_size\fP Byte stride of one record\&. .br \fIfields\fP Field descriptors\&. .br \fIint_kind\fP Kind of integer state fields\&. .br \fIstr_kind\fP Kind of string state fields\&. .RE .PP \fBReturns\fP .RS 4 stl_json_t array object, or NULL on failure\&. .RE .PP .SS "int hyle_source_overlay_from_desc (stl_json_t * jo, const void * state, const \fBhyle_source_desc_t\fP * fields, int int_kind, int str_kind)" .PP Overlay descriptors from a state struct onto a JSON object\&. .PP \fBParameters\fP .RS 4 \fIjo\fP Target JSON object\&. .br \fIstate\fP Source state struct\&. .br \fIfields\fP Field descriptors\&. .br \fIint_kind\fP Kind of integer state fields\&. .br \fIstr_kind\fP Kind of string state fields\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "unsigned hyle_source_parse_row_data_custom (const \fBhyle_source_def_t\fP * def, \fBhyle_field_getter_fn\fP get_single, \fBhyle_multi_field_getter_fn\fP get_multi, void * user)" .PP Parse submitted form data into an opened corm handle\&. The handle is populated with (field_name -> value) entries per the dataset's schema definition\&. .PP \fBParameters\fP .RS 4 \fIdef\fP Dataset definition\&. .br \fIget_single\fP Single-value field getter\&. .br \fIget_multi\fP Multi-value field getter\&. .br \fIuser\fP Caller data passed to the getters\&. .RE .PP \fBReturns\fP .RS 4 Opened corm handle, or 0 on failure\&. .RE .PP .SS "unsigned hyle_source_query_dataset (const char * dataset_id, const char * query_str)" .PP Run a search query against a dataset\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIquery_str\fP Search query\&. .RE .PP \fBReturns\fP .RS 4 Corm handle of the result rows, or 0 on failure\&. .RE .PP .SS "int hyle_source_refresh_row (int fd, const char * dataset_id, const char * id)" .PP Reload a single row from persistent storage\&. .PP \fBParameters\fP .RS 4 \fIfd\fP Corm file descriptor\&. .br \fIdataset_id\fP Dataset id\&. .br \fIid\fP Item id\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_register_def (const \fBhyle_source_def_t\fP * def)" .PP Register a dataset definition\&. .PP \fBParameters\fP .RS 4 \fIdef\fP Dataset definition\&. .RE .PP \fBReturns\fP .RS 4 Handle on success, negative on failure\&. .RE .PP .SS "int hyle_source_remove_path_recursive (const char * path)" .PP Recursively remove a filesystem path\&. .PP \fBParameters\fP .RS 4 \fIpath\fP Path to remove\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "const char * hyle_source_resolve_doc_root (char * buf, size_t sz)" .PP Resolve the web document root\&. .PP \fBParameters\fP .RS 4 \fIbuf\fP Destination buffer\&. .br \fIsz\fP Capacity of buf\&. .RE .PP \fBReturns\fP .RS 4 The document root, or NULL when unresolved\&. .RE .PP .SS "int hyle_source_resolve_meta_display (const char * dataset_id, const char * item_id, const \fBhyle_source_desc_t\fP * fields, int count, void * state)" .PP Resolve reference and inverse fields into display state\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIitem_id\fP Item id\&. .br \fIfields\fP Field descriptors\&. .br \fIcount\fP Descriptor count\&. .br \fIstate\fP State struct to fill\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_resolve_options (const char * dataset_id, const char * q, int page0, int per_page, \fBhyle_option_t\fP * opts, int max, int * total_out, char(*) id_buf[64], char(*) label_buf[256])" .PP Resolve a searched option page for a picker\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIq\fP Search term, or NULL for all\&. .br \fIpage0\fP Zero-based page\&. .br \fIper_page\fP Page size\&. .br \fIopts\fP Receives page options\&. .br \fImax\fP Capacity of opts\&. .br \fItotal_out\fP Receives total matching count\&. .br \fIid_buf\fP Scratch for option ids\&. .br \fIlabel_buf\fP Scratch for option labels\&. .RE .PP \fBReturns\fP .RS 4 Option count on success, negative on failure\&. .RE .PP .SS "int hyle_source_resolve_ref_display_str (const char * dataset_id, const char * item_id, const char * field_name, char * out, size_t out_sz)" .PP Resolve a reference field to its display string\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIitem_id\fP Item id\&. .br \fIfield_name\fP Field name\&. .br \fIout\fP Destination buffer\&. .br \fIout_sz\fP Capacity of out\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_resolve_tokens (const char * dataset_id, const char * comma_slugs, \fBhyle_option_t\fP * out, int max, char(*) id_buf[64], char(*) label_buf[256])" .PP Resolve comma-separated slugs to their option records\&. .PP \fBParameters\fP .RS 4 \fIdataset_id\fP Dataset id\&. .br \fIcomma_slugs\fP Comma-separated slug list\&. .br \fIout\fP Receives resolved options\&. .br \fImax\fP Capacity of out\&. .br \fIid_buf\fP Scratch for option ids\&. .br \fIlabel_buf\fP Scratch for option labels\&. .RE .PP \fBReturns\fP .RS 4 Option count on success, negative on failure\&. .RE .PP .SS "int hyle_source_set_field (int fd, const char * source_id, const char * item_id, const char * field, const char * value)" .PP Set a field of an entity item and persist\&. .PP \fBParameters\fP .RS 4 \fIfd\fP Corm file descriptor\&. .br \fIsource_id\fP Dataset id\&. .br \fIitem_id\fP Item id\&. .br \fIfield\fP Field name\&. .br \fIvalue\fP New value\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_set_field_int (int fd, const char * source_id, const char * item_id, const char * field, int val)" .PP Set an integer field of an entity item and persist\&. .PP \fBParameters\fP .RS 4 \fIfd\fP Corm file descriptor\&. .br \fIsource_id\fP Dataset id\&. .br \fIitem_id\fP Item id\&. .br \fIfield\fP Field name\&. .br \fIval\fP New integer value\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "uint32_t hyle_source_setup (const char * source_id, const char * key_field, size_t record_size, const char * items_path, const \fBhyle_source_desc_t\fP * defs, int field_count, unsigned flags, const \fBhyle_source_list_view_t\fP * list_view)" .PP Set up and register a dataset definition\&. .PP \fBParameters\fP .RS 4 \fIsource_id\fP Dataset id\&. .br \fIkey_field\fP Primary key field name\&. .br \fIrecord_size\fP Byte size of one record struct\&. .br \fIitems_path\fP Persistence base path\&. .br \fIdefs\fP Framework-neutral field descriptors\&. .br \fIfield_count\fP Descriptor count\&. .br \fIflags\fP Dataset flags\&. .br \fIlist_view\fP List-view configuration, or NULL\&. .RE .PP \fBReturns\fP .RS 4 Corm record type id on success, 0 on failure\&. .RE .PP .SS "char * hyle_source_slurp_file (const char * path)" .PP Read an entire file into a malloc'd buffer\&. .PP \fBParameters\fP .RS 4 \fIpath\fP File path\&. .RE .PP \fBReturns\fP .RS 4 malloc'd contents, or NULL on failure\&. .RE .PP .SS "int hyle_source_state_overlay (stl_json_t * jo, const \fBhyle_source_state_kv_t\fP * kvs)" .PP Apply key/value overlays onto a JSON object\&. .PP \fBParameters\fP .RS 4 \fIjo\fP Target JSON object\&. .br \fIkvs\fP Overlay table, NULL-key terminated\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_update_item (int fd, const char * dataset_id, const char * id, unsigned data_handle)" .PP Persist an item record (write-through to the store)\&. .PP \fBParameters\fP .RS 4 \fIfd\fP Corm file descriptor\&. .br \fIdataset_id\fP Dataset id\&. .br \fIid\fP Item id\&. .br \fIdata_handle\fP Record handle\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SS "int hyle_source_validate_row (const \fBhyle_source_def_t\fP * def, unsigned data_handle, char ** json_errors_out)" .PP Validate a record against its field constraints\&. .PP \fBParameters\fP .RS 4 \fIdef\fP Dataset definition\&. .br \fIdata_handle\fP Record handle to validate\&. .br \fIjson_errors_out\fP Receives a JSON array of errors (malloc'd)\&. .RE .PP \fBReturns\fP .RS 4 0 when valid, negative when invalid\&. .RE .PP .SS "int hyle_source_write_file (const char * path, const char * buf, size_t sz)" .PP Write a buffer to a file (creating parents as needed)\&. .PP \fBParameters\fP .RS 4 \fIpath\fP File path\&. .br \fIbuf\fP Data to write\&. .br \fIsz\fP Byte count\&. .RE .PP \fBReturns\fP .RS 4 0 on success, negative on failure\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for libhyle-source from the source code\&.