X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Finclude%2Fcore%2Fstore.h;h=e851dd9f955ee38cb3bec993fe753aa3e4f5a537;hb=182112ccd9852672b39ff958ab0c605c9ef856ad;hp=289bc2f88684ef6a82be2d63935d1b5bcb85d22a;hpb=a873701765e00228463e06795bdde21274e8fa74;p=sysdb.git diff --git a/src/include/core/store.h b/src/include/core/store.h index 289bc2f..e851dd9 100644 --- a/src/include/core/store.h +++ b/src/include/core/store.h @@ -229,6 +229,32 @@ typedef struct { sdb_object_t *user_data); } sdb_store_writer_t; +/* + * A store reader describes the interface to query a store implementation. + */ +typedef struct { + /* + * prepare_query: + * Prepare the query described by 'ast' for execution. + */ + sdb_object_t *(*prepare_query)(sdb_ast_node_t *ast, + sdb_strbuf_t *errbuf, sdb_object_t *user_data); + + /* + * execute_query: + * Execute a previously prepared query. The callback may expect that only + * queries prepared by its respective prepare callback will be passed to + * this function. + * + * TODO: Instead of letting the executor write directly to a string buffer + * (which cannot easily be merged with other results), let it hand + * all objects to a store-writer. + */ + int (*execute_query)(sdb_object_t *q, + sdb_strbuf_t *buf, sdb_strbuf_t *errbuf, + sdb_object_t *user_data); +} sdb_store_reader_t; + /* * sdb_store_init: * Initialize the store sub-system. This function has to be called before