NAME
hyle-source/hyle_source.h - Persistence layer for hyle datasets.
SYNOPSIS
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
#include <ttypt/stl_json.h>
#include <hyle/field.h>
#include <hyle/schema.h>
#include <hyle-source/picker.h>
#include 'store.h'
Data Structures
Authorization-relevant field metadata of a dataset.
One named column of a list view.
List-view configuration of a dataset.
Definition of one hyle source dataset.
One entry of a state JSON field spec list.
One key/value overlay entry for state JSON.
One string-copy mapping used by hyle_json_extract_strings.
One sync field of an ordered partition.
Macros
Inverse-kind compatibility alias.
Dataset kept in memory only (not persisted).
Dataset allows client record creation.
Validation error return sentinel.
Typedefs
Framework-neutral unified descriptor alias.
Definition of one hyle source dataset.
Callback invoked once per registered dataset.
Generic single-field getter callback for form parsing.
Generic multi-field getter callback for form parsing.
Per-row callback of an ordered-partition walk.
Callback receiving one referencing source id.
Enumerations
Access policy of a hyle source dataset.
Outcome of an access-control decision.
Serialization mode of one state field.
Functions
Remove all inverse references pointing at an item.
Convert schema descriptors into a corm-openable record layout.
Convert schema descriptors into source-field metadata.
Derive meta-field descriptors for a record instance.
Build the state-JSON field spec list for a dataset.
Look up a registered dataset by id.
Whether a dataset allows client record creation.
Whether an item id exists in a dataset.
Register a dataset definition.
Reload a single row from persistent storage.
Validate a record against its field constraints.
Persist an item record (write-through to the store).
Delete an item and its references.
Register a field as an inverse relation target.
Iterate over all registered datasets.
Run a search query against a dataset.
Store a query result or table slice in the client-side cache.
Store a query result with explicit TTL in milliseconds.
Bulk hydrate a query slice into the client-side cache.
Retrieve a cached query result or table slice.
Retrieve a cached query result with stale-while-revalidate indicator.
Invalidate all cache entries matching a dataset identifier.
Clear all entries in the client-side cache.
Return the number of active cached entries for a dataset.
Normalize a query string into canonical key-sorted order.
Item-records corm handle of a dataset.
Per-item fields corm handle of a dataset.
Schema metadata corm handle of a dataset.
List-view configuration of a dataset.
Build the JSON object of a single item.
Build the state JSON of a single item.
Apply key/value overlays onto a JSON object.
Overlay descriptors from a state struct onto a JSON object.
Build a JSON array of objects from a record array.
Resolve a reference field to its display string.
Resolve reference and inverse fields into display state.
Read a meta file into a record struct.
Write a record struct as a meta file.
Set up and register a dataset definition.
Collect inverse keys referencing a target position.
Inverse key at an index.
Read a string field of an item from the item-records map.
Load a dataset from a DSV string.
Serialize a dataset to a DSV string.
Field descriptors of a dataset.
Record struct size of a dataset.
Parse submitted form data into an opened corm handle.
Display field name of a dataset.
Display label of a row.
Resolve a searched option page for a picker.
Resolve comma-separated slugs to their option records.
Normalize raw token text into comma-separated slug form.
Enumerate a dataset's enum-valued options.
Whether an id is safe for filesystem use.
Read an entire file into a malloc'd buffer.
Write a buffer to a file (creating parents as needed).
Recursively remove a filesystem path.
Resolve the web document root.
Process multiple reference values for one field (internal).
Sync ordered partition fields from submitted form data.
Read a field of an ordered-partition row.
Set a field of an ordered-partition row and persist.
Remove an ordered-partition row and persist.
Append an ordered-partition row and persist.
Index of the first ordered row matching a field value.
Remove all rows matching a field value and persist.
Replace an ordered-partition row and persist.
Iterate an ordered partition's rows.
Read a field of an entity item.
Set a field of an entity item and persist.
Read an integer field of an entity item.
Set an integer field of an entity item and persist.
Collect ids referencing a target through a relation field.
Visit all source ids referencing a target through a field.
Detailed Description
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.
Typedef Documentation
typedef int(* hyle_field_getter_fn) (const char *name, char *buf, size_t sz, void *user)
Generic single-field getter callback for form parsing.
Parameters
name Field name.
buf Destination buffer.
sz Capacity of buf.
user Caller data.
Returns
Copied length, or -1 when not found / unsupported.
typedef int(* hyle_multi_field_getter_fn) (const char *name, char *buf, size_t sz, void *user)
Generic multi-field getter callback for form parsing.
Parameters
name Field name.
buf Destination buffer.
sz Capacity of buf.
user Caller data.
Returns
Copied length, or -1 when not found / unsupported.
typedef int(* hyle_source_each_cb_t) (const hyle_source_def_t *, void *)
Callback invoked once per registered dataset.
Parameters
def Dataset definition.
user Caller data.
Returns
Non-zero to stop iteration.
typedef void(* hyle_source_ordered_each_fn) (int index, const char *key, unsigned fields_hd, void *user)
Per-row callback of an ordered-partition walk.
Parameters
index Row index.
key Row key.
fields_hd Fields corm handle.
user Caller data.
typedef void(* hyle_source_ref_cb_t) (const char *source_id, void *user)
Callback receiving one referencing source id.
Parameters
source_id Source dataset id.
user Caller data.
Enumeration Type Documentation
enum hyle_source_access_policy_t
Access policy of a hyle source dataset.
Enumerator
- HYLE_SOURCE_ACCESS_PUBLIC
- Dataset readable/writable by anonymous visitors.
- HYLE_SOURCE_ACCESS_LOGIN
- Dataset requires a login.
enum hyle_source_access_result_t
Outcome of an access-control decision.
Enumerator
- HYLE_SOURCE_ACCESS_RESULT_ALLOW
- Access granted.
- HYLE_SOURCE_ACCESS_RESULT_UNAUTHORIZED
- Request rejected for missing authentication.
- HYLE_SOURCE_ACCESS_RESULT_FORBIDDEN
- Request rejected for insufficient rights.
enum hyle_source_state_kind_t
Serialization mode of one state field.
Enumerator
- HYLE_SF_RECORD
- Include the field in state JSON.
- HYLE_SF_EXCLUDE
- Exclude the field from state JSON.
- HYLE_SF_REF_DISPLAY
- Resolve the field to its display name.
Function Documentation
const char * hyle_corm_get_field_str (unsigned hd, const char * id, const char * field)
Read a string field of an item from the item-records map.
Parameters
hd Item-records corm handle.
id Item id.
field Field name.
Returns
Field value, or NULL when absent.
int hyle_ref_field_register (const char * dataset_id, const char * field_name)
Register a field as an inverse relation target.
Parameters
dataset_id Dataset id.
field_name Inverse field name.
Returns
0 on success, negative on failure.
int hyle_source_build_item_json (const hyle_source_def_t * def, const char * item_id, stl_json_t ** out)
Build the JSON object of a single item.
Parameters
def Dataset definition.
item_id Item id.
out Receives the item JSON object.
Returns
0 on success, negative on failure.
int hyle_source_build_state_json (const char * dataset_id, const char * item_id, const hyle_source_state_field_t * specs, stl_json_t ** out)
Build the state JSON of a single item.
Parameters
dataset_id Dataset id.
item_id Item id.
specs State field specs, or NULL for defaults.
out Receives the state JSON object.
Returns
0 on success, negative on failure.
int hyle_source_build_state_specs (const hyle_source_desc_t * fields, hyle_source_state_field_t * specs, int max_specs)
Build the state-JSON field spec list for a dataset.
Parameters
fields Field descriptors.
specs Receives the state field specs.
max_specs Capacity of specs.
Returns
Number of specs written, or negative on overflow.
size_t hyle_source_cache_count (const char * dataset_id)
Return the number of active cached entries for a dataset.
Parameters
dataset_id Dataset identifier (or NULL for total across all datasets).
Returns
Number of cached entries.
const char * hyle_source_cache_get (const char * dataset_id, const char * query_str, size_t * len_out)
Retrieve a cached query result or table slice.
Parameters
dataset_id Dataset identifier.
query_str Query string or request key.
len_out Optional pointer to receive length in bytes.
Returns
Pointer to cached JSON string, or NULL if not in cache.
void hyle_source_cache_invalidate (const char * dataset_id)
Invalidate all cache entries matching a dataset identifier.
Parameters
dataset_id Dataset identifier (or NULL to invalidate all datasets).
int hyle_source_cache_put (const char * dataset_id, const char * query_str, const char * json, size_t len)
Store a query result or table slice in the client-side cache.
Parameters
dataset_id Dataset identifier (e.g. "song" or "song.items").
query_str Query string or request key (e.g. "page=1&per_page=10...").
json JSON state or response string to cache.
len Length of json in bytes (or 0 to measure via strlen).
Returns
0 on success, negative on error.
int hyle_source_clear_inverse_refs (int fd, const char * dataset_id, const char * item_id)
Remove all inverse references pointing at an item.
Parameters
fd Corm file descriptor.
dataset_id Source dataset id.
item_id Target item id.
Returns
0 on success, negative on failure.
int hyle_source_def_to_corm (const hyle_source_desc_t * defs, int count, void * out)
Convert schema descriptors into a corm-openable record layout.
Parameters
defs Field descriptors.
count Descriptor count.
out Receives the corm record type configuration.
Returns
0 on success, negative on failure.
int hyle_source_def_to_meta_fields (const hyle_source_desc_t * defs, int count, const void * record, void * out)
Derive meta-field descriptors for a record instance.
Parameters
defs Field descriptors.
count Descriptor count.
record Source record.
out Receives the meta-field table.
Returns
0 on success, negative on failure.
int hyle_source_def_to_source_fields (const hyle_source_desc_t * defs, int count, void * out)
Convert schema descriptors into source-field metadata.
Parameters
defs Field descriptors.
count Descriptor count.
out Receives the source-field table.
Returns
0 on success, negative on failure.
int hyle_source_delete_item (int fd, const hyle_source_def_t * def, const char * item_id)
Delete an item and its references.
Parameters
fd Corm file descriptor.
def Dataset definition.
item_id Item id.
Returns
0 on success, negative on failure.
int hyle_source_dsv_load (const char * source_id, const char * pval, unsigned fhd, void * user)
Load a dataset from a DSV string.
Parameters
source_id Dataset id.
pval DSV payload.
fhd Fields corm handle.
user Caller data.
Returns
0 on success, negative on failure.
int hyle_source_dsv_save (const char * source_id, const char * pval, unsigned fhd, void * user)
Serialize a dataset to a DSV string.
Parameters
source_id Dataset id.
pval Output payload.
fhd Fields corm handle.
user Caller data.
Returns
0 on success, negative on failure.
hyle_source_def_t * hyle_source_find (const char * dataset_id)
Look up a registered dataset by id.
Parameters
dataset_id Dataset id.
Returns
Dataset definition, or NULL.
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)
Collect ids referencing a target through a relation field.
Parameters
source_dataset Source dataset id.
ref_field Relation field name.
target_id Referenced target id.
ids_out Receives matching source ids.
max Capacity of ids_out.
Returns
Number of matches found.
int hyle_source_for_each (hyle_source_each_cb_t cb, void * user)
Iterate over all registered datasets.
Parameters
cb Per-dataset callback.
user Caller data.
Returns
0 on success, negative on failure.
size_t hyle_source_for_each_referencing (const char * source_dataset, const char * ref_field, const char * target_id, hyle_source_ref_cb_t cb, void * user)
Visit all source ids referencing a target through a field.
Parameters
source_dataset Source dataset id.
ref_field Relation field name.
target_id Referenced target id.
cb Per-source callback.
user Caller data.
Returns
Number of referencing sources visited.
unsigned hyle_source_get_data_hd (const char * dataset_id)
Item-records corm handle of a dataset.
Parameters
dataset_id Dataset id.
Returns
Corm handle, or 0 when unregistered.
const hyle_source_desc_t * hyle_source_get_desc (const char * dataset_id, int * count_out)
Field descriptors of a dataset.
Parameters
dataset_id Dataset id.
count_out Receives the descriptor count.
Returns
Descriptor array, or NULL when unregistered.
int hyle_source_get_display_field (const char * dataset_id, char * out, size_t sz)
Display field name of a dataset.
Parameters
dataset_id Dataset id.
out Destination buffer.
sz Capacity of out.
Returns
0 on success, negative on failure.
int hyle_source_get_enum_options (const char * dataset_id, hyle_option_t * pool, int pool_avail, char(*) id_buf[64], char(*) label_buf[256])
Enumerate a dataset's enum-valued options.
Parameters
dataset_id Dataset id.
pool Option pool storage.
pool_avail Capacity of pool.
id_buf Scratch for option ids.
label_buf Scratch for option labels.
Returns
Option count on success, negative on failure.
const char * hyle_source_get_field (const char * source_id, const char * item_id, const char * field)
Read a field of an entity item.
Parameters
source_id Dataset id.
item_id Item id.
field Field name.
Returns
Field value, or NULL when absent.
int hyle_source_get_field_int (const char * source_id, const char * item_id, const char * field, int def_val)
Read an integer field of an entity item.
Parameters
source_id Dataset id.
item_id Item id.
field Field name.
def_val Default when absent or not an integer.
Returns
Field value.
unsigned hyle_source_get_fields_hd (const char * dataset_id)
Per-item fields corm handle of a dataset.
Parameters
dataset_id Dataset id.
Returns
Corm handle, or 0 when unregistered.
const char * hyle_source_get_item_label (const char * dataset_id, const char * row_id, const char * display_field, char * out, size_t sz)
Display label of a row.
Parameters
dataset_id Dataset id.
row_id Row id.
display_field Display field name.
out Destination buffer.
sz Capacity of out.
Returns
Label string, or NULL when unresolved.
const hyle_source_list_view_t * hyle_source_get_list_view (const char * dataset_id)
List-view configuration of a dataset.
Parameters
dataset_id Dataset id.
Returns
List view, or NULL when unregistered.
size_t hyle_source_get_record_size (const char * dataset_id)
Record struct size of a dataset.
Parameters
dataset_id Dataset id.
Returns
Record size, or 0 when unregistered.
unsigned hyle_source_get_schema_hd (const char * dataset_id)
Schema metadata corm handle of a dataset.
Parameters
dataset_id Dataset id.
Returns
Corm handle, or 0 when unregistered.
int hyle_source_internal_process_multi_ref (const hyle_source_field_t * f, const char * dataset_id, char ** data)
Process multiple reference values for one field (internal).
Parameters
f Field metadata.
dataset_id Dataset id.
data Value list to process.
Returns
0 on success, negative on failure.
const char * hyle_source_inv_key_at (const char * dataset_id, const char * field, uint32_t target_pos, size_t index)
Inverse key at an index.
Parameters
dataset_id Dataset id.
field Inverse field name.
target_pos Target record position.
index Result index.
Returns
Matching key, or NULL when out of range.
size_t hyle_source_inv_keys (const char * dataset_id, const char * field, uint32_t target_pos, const char ** keys, size_t max)
Collect inverse keys referencing a target position.
Parameters
dataset_id Dataset id.
field Inverse field name.
target_pos Target record position.
keys Receives matching keys.
max Capacity of keys.
Returns
Number of keys found.
int hyle_source_is_creatable (const char * dataset_id)
Whether a dataset allows client record creation.
Parameters
dataset_id Dataset id.
Returns
Non-zero when creatable.
int hyle_source_is_safe_id (const char * id)
Whether an id is safe for filesystem use.
Parameters
id Candidate id.
Returns
Non-zero when the id contains no path separators or metacharacters.
int hyle_source_item_exists (const char * dataset_id, const char * item_id)
Whether an item id exists in a dataset.
Parameters
dataset_id Dataset id.
item_id Item id.
Returns
Non-zero when present.
int hyle_source_meta_read (const char * path, const hyle_source_desc_t * fields, int count, void * record, size_t record_size)
Read a meta file into a record struct.
Parameters
path Meta file path.
fields Field descriptors.
count Descriptor count.
record Destination record struct.
record_size Byte size of record.
Returns
0 on success, negative on failure.
int hyle_source_meta_write (const char * path, const hyle_source_desc_t * fields, int count, const void * record)
Write a record struct as a meta file.
Parameters
path Meta file path.
fields Field descriptors.
count Descriptor count.
record Source record struct.
Returns
0 on success, negative on failure.
int hyle_source_normalize_tokens_to_slugs (const char * dataset_id, const char * raw, char * out, size_t out_sz)
Normalize raw token text into comma-separated slug form.
Parameters
dataset_id Dataset id.
raw Raw token text.
out Destination buffer.
out_sz Capacity of out.
Returns
0 on success, negative on failure.
int hyle_source_ordered_append_and_save (const char * source_id, const char * partition_val, const char ** names, const char ** vals, size_t count)
Append an ordered-partition row and persist.
Parameters
source_id Dataset id.
partition_val Partition value.
names Field names.
vals Field values.
count Field count.
Returns
0 on success, negative on failure.
int hyle_source_ordered_find (const char * source_id, const char * partition_val, const char * field, const char * val)
Index of the first ordered row matching a field value.
Parameters
source_id Dataset id.
partition_val Partition value.
field Field name.
val Search value.
Returns
Row index, or -1 when absent.
int hyle_source_ordered_for_each (const char * source_id, const char * partition_val, hyle_source_ordered_each_fn fn, void * user)
Iterate an ordered partition's rows.
Parameters
source_id Dataset id.
partition_val Partition value.
fn Per-row callback.
user Caller data.
Returns
0 on success, negative on failure.
const char * hyle_source_ordered_get_field (const char * source_id, const char * partition_val, int index, const char * field)
Read a field of an ordered-partition row.
Parameters
source_id Dataset id.
partition_val Partition value.
index Row index.
field Field name.
Returns
Field value, or NULL when absent.
int hyle_source_ordered_remove_and_save (const char * source_id, const char * partition_val, int index)
Remove an ordered-partition row and persist.
Parameters
source_id Dataset id.
partition_val Partition value.
index Row index.
Returns
0 on success, negative on failure.
int hyle_source_ordered_remove_matching (const char * source_id, const char * partition_val, const char * field, const char * val)
Remove all rows matching a field value and persist.
Parameters
source_id Dataset id.
partition_val Partition value.
field Field name.
val Match value.
Returns
Removed count, or negative on failure.
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)
Replace an ordered-partition row and persist.
Parameters
source_id Dataset id.
partition_val Partition value.
index Row index.
names Field names.
vals Field values.
count Field count.
Returns
0 on success, negative on failure.
int hyle_source_ordered_set_field (const char * source_id, const char * partition_val, int index, const char * field, const char * value)
Set a field of an ordered-partition row and persist.
Parameters
source_id Dataset id.
partition_val Partition value.
index Row index.
field Field name.
value New value.
Returns
0 on success, negative on failure.
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 hyle_ordered_field_sync_t * fields, size_t n_fields, hyle_field_getter_fn get_field, void * user)
Sync ordered partition fields from submitted form data.
Parameters
source_id Dataset id.
partition_id Partition value.
amount_param Form value holding the item count.
remove_param_prefix Form param prefix marking removal slots.
fields Field sync table.
n_fields Sync table size.
get_field Form getter.
user Caller data.
Returns
0 on success, negative on failure.
stl_json_t * hyle_source_overlay_array (const void * items, int count, size_t elem_size, const hyle_source_desc_t * fields, int int_kind, int str_kind)
Build a JSON array of objects from a record array.
Parameters
items Record array.
count Record count.
elem_size Byte stride of one record.
fields Field descriptors.
int_kind Kind of integer state fields.
str_kind Kind of string state fields.
Returns
stl_json_t array object, or NULL on failure.
int hyle_source_overlay_from_desc (stl_json_t * jo, const void * state, const hyle_source_desc_t * fields, int int_kind, int str_kind)
Overlay descriptors from a state struct onto a JSON object.
Parameters
jo Target JSON object.
state Source state struct.
fields Field descriptors.
int_kind Kind of integer state fields.
str_kind Kind of string state fields.
Returns
0 on success, negative on failure.
unsigned hyle_source_parse_row_data_custom (const hyle_source_def_t * def, hyle_field_getter_fn get_single, hyle_multi_field_getter_fn get_multi, void * user)
Parse submitted form data into an opened corm handle. The handle is populated with (field_name -> value) entries per the dataset's schema definition.
Parameters
def Dataset definition.
get_single Single-value field getter.
get_multi Multi-value field getter.
user Caller data passed to the getters.
Returns
Opened corm handle, or 0 on failure.
unsigned hyle_source_query_dataset (const char * dataset_id, const char * query_str)
Run a search query against a dataset.
Parameters
dataset_id Dataset id.
query_str Search query.
Returns
Corm handle of the result rows, or 0 on failure.
int hyle_source_refresh_row (int fd, const char * dataset_id, const char * id)
Reload a single row from persistent storage.
Parameters
fd Corm file descriptor.
dataset_id Dataset id.
id Item id.
Returns
0 on success, negative on failure.
int hyle_source_register_def (const hyle_source_def_t * def)
Register a dataset definition.
Parameters
def Dataset definition.
Returns
Handle on success, negative on failure.
int hyle_source_remove_path_recursive (const char * path)
Recursively remove a filesystem path.
Parameters
path Path to remove.
Returns
0 on success, negative on failure.
const char * hyle_source_resolve_doc_root (char * buf, size_t sz)
Resolve the web document root.
Parameters
buf Destination buffer.
sz Capacity of buf.
Returns
The document root, or NULL when unresolved.
int hyle_source_resolve_meta_display (const char * dataset_id, const char * item_id, const hyle_source_desc_t * fields, int count, void * state)
Resolve reference and inverse fields into display state.
Parameters
dataset_id Dataset id.
item_id Item id.
fields Field descriptors.
count Descriptor count.
state State struct to fill.
Returns
0 on success, negative on failure.
int hyle_source_resolve_options (const char * dataset_id, const char * q, int page0, int per_page, hyle_option_t * opts, int max, int * total_out, char(*) id_buf[64], char(*) label_buf[256])
Resolve a searched option page for a picker.
Parameters
dataset_id Dataset id.
q Search term, or NULL for all.
page0 Zero-based page.
per_page Page size.
opts Receives page options.
max Capacity of opts.
total_out Receives total matching count.
id_buf Scratch for option ids.
label_buf Scratch for option labels.
Returns
Option count on success, negative on failure.
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)
Resolve a reference field to its display string.
Parameters
dataset_id Dataset id.
item_id Item id.
field_name Field name.
out Destination buffer.
out_sz Capacity of out.
Returns
0 on success, negative on failure.
int hyle_source_resolve_tokens (const char * dataset_id, const char * comma_slugs, hyle_option_t * out, int max, char(*) id_buf[64], char(*) label_buf[256])
Resolve comma-separated slugs to their option records.
Parameters
dataset_id Dataset id.
comma_slugs Comma-separated slug list.
out Receives resolved options.
max Capacity of out.
id_buf Scratch for option ids.
label_buf Scratch for option labels.
Returns
Option count on success, negative on failure.
int hyle_source_set_field (int fd, const char * source_id, const char * item_id, const char * field, const char * value)
Set a field of an entity item and persist.
Parameters
fd Corm file descriptor.
source_id Dataset id.
item_id Item id.
field Field name.
value New value.
Returns
0 on success, negative on failure.
int hyle_source_set_field_int (int fd, const char * source_id, const char * item_id, const char * field, int val)
Set an integer field of an entity item and persist.
Parameters
fd Corm file descriptor.
source_id Dataset id.
item_id Item id.
field Field name.
val New integer value.
Returns
0 on success, negative on failure.
uint32_t hyle_source_setup (const char * source_id, const char * key_field, size_t record_size, const char * items_path, const hyle_source_desc_t * defs, int field_count, unsigned flags, const hyle_source_list_view_t * list_view)
Set up and register a dataset definition.
Parameters
source_id Dataset id.
key_field Primary key field name.
record_size Byte size of one record struct.
items_path Persistence base path.
defs Framework-neutral field descriptors.
field_count Descriptor count.
flags Dataset flags.
list_view List-view configuration, or NULL.
Returns
Corm record type id on success, 0 on failure.
char * hyle_source_slurp_file (const char * path)
Read an entire file into a malloc'd buffer.
Parameters
path File path.
Returns
malloc'd contents, or NULL on failure.
int hyle_source_state_overlay (stl_json_t * jo, const hyle_source_state_kv_t * kvs)
Apply key/value overlays onto a JSON object.
Parameters
jo Target JSON object.
kvs Overlay table, NULL-key terminated.
Returns
0 on success, negative on failure.
int hyle_source_update_item (int fd, const char * dataset_id, const char * id, unsigned data_handle)
Persist an item record (write-through to the store).
Parameters
fd Corm file descriptor.
dataset_id Dataset id.
id Item id.
data_handle Record handle.
Returns
0 on success, negative on failure.
int hyle_source_validate_row (const hyle_source_def_t * def, unsigned data_handle, char ** json_errors_out)
Validate a record against its field constraints.
Parameters
def Dataset definition.
data_handle Record handle to validate.
json_errors_out Receives a JSON array of errors (malloc'd).
Returns
0 when valid, negative when invalid.
int hyle_source_write_file (const char * path, const char * buf, size_t sz)
Write a buffer to a file (creating parents as needed).
Parameters
path File path.
buf Data to write.
sz Byte count.
Returns
0 on success, negative on failure.
Author
Generated automatically by Doxygen for libhyle-source from the source code.