From 1ca5cdce9d403b4130e35dc1c99c6a1ea15f946f Mon Sep 17 00:00:00 2001 From: dormando Date: Sun, 30 Aug 2020 23:27:34 -0700 Subject: core: restructure IO queue callbacks mc_resp is the proper owner of a pending IO once it's been initialized; release it during resp_finish(). Also adds a completion callback which runs on the submitted stack after returning to the worker thread but before the response is transmitted. allows re-queueing for pending IO if processing a response generates another pending IO. also allows a further refactor to run more extstore code on the worker thread instead of the IO threads. uses proper conn_io_queue state to describe connections waiting for pending IO's. --- storage.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'storage.h') diff --git a/storage.h b/storage.h index 05e420d..ca59102 100644 --- a/storage.h +++ b/storage.h @@ -11,18 +11,26 @@ void storage_delete(void *e, item *it); #define STORAGE_delete(...) #endif +// API. void storage_stats(ADD_STAT add_stats, conn *c); void process_extstore_stats(ADD_STAT add_stats, conn *c); bool storage_validate_item(void *e, item *it); int storage_get_item(conn *c, item *it, mc_resp *resp); -void storage_submit_cb(void *ctx, io_pending_t *pending); -void storage_free_cb(void *ctx, io_pending_t *pending); + +// callbacks for the IO queue subsystem. +void storage_submit_cb(void *ctx, void *stack); +void storage_complete_cb(void *ctx, void *stack); +void storage_finalize_cb(io_pending_t *pending); + +// Thread functions. int start_storage_write_thread(void *arg); void storage_write_pause(void); void storage_write_resume(void); int start_storage_compact_thread(void *arg); void storage_compact_pause(void); void storage_compact_resume(void); + +// Init functions. struct extstore_conf_file *storage_conf_parse(char *arg, unsigned int page_size); void *storage_init_config(struct settings *s); int storage_read_config(void *conf, char **subopt); -- cgit v1.2.1