Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

DB Simple

Simple file-based JSON database for persistent GObj attributes.

Source: kernel/c/root-linux/src/dbsimple.h


db_load_persistent_attrs()

Loads writable persistent attributes from the file-based store and updates the gobj’s attributes.

int db_load_persistent_attrs(
    hgobj gobj,
    json_t *keys   // owned
);

Parameters

KeyTypeDescription
gobjhgobjGObject whose attributes are loaded.
keysjson_t *JSON object or array of attribute names to load (owned).

Returns

0 on success.


db_save_persistent_attrs()

Saves writable persistent attributes to the file-based store.

int db_save_persistent_attrs(
    hgobj gobj,
    json_t *keys   // owned
);

Parameters

KeyTypeDescription
gobjhgobjGObject whose attributes are saved.
keysjson_t *JSON object or array of attribute names to save (owned).

Returns

0 on success.


db_remove_persistent_attrs()

Removes persistent attributes from the file-based store.

int db_remove_persistent_attrs(
    hgobj gobj,
    json_t *keys   // owned
);

Parameters

KeyTypeDescription
gobjhgobjGObject whose attributes are removed.
keysjson_t *JSON object or array of attribute names to remove (owned).

Returns

0 on success.


db_list_persistent_attrs()

Lists persistent attributes stored for a gobj.

json_t *db_list_persistent_attrs(
    hgobj gobj,
    json_t *keys   // owned
);

Parameters

KeyTypeDescription
gobjhgobjGObject to query.
keysjson_t *JSON object or array of attribute names to list (owned).

Returns

JSON object containing the requested attributes (owned by caller — must be freed).