#pragma once #include "ipc.h" #include "performance.h" #include "query.h" #include "threaded_queue.h" #include // TODO/FIXME: Merge IpcManager and QueueManager. struct lsBaseOutMessage; struct IpcManager { struct StdoutMessage { IpcId id; std::string content; }; ThreadedQueue for_stdout; ThreadedQueue> for_querydb; static IpcManager* instance(); static void CreateInstance(MultiQueueWaiter* waiter); static void WriteStdout(IpcId id, lsBaseOutMessage& response); private: explicit IpcManager(MultiQueueWaiter* waiter); static IpcManager* instance_; }; struct Index_Request { std::string path; // TODO: make |args| a string that is parsed lazily. std::vector args; bool is_interactive; optional contents; // Preloaded contents. Useful for tests. Index_Request(const std::string& path, const std::vector& args, bool is_interactive, optional contents); }; struct Index_DoIdMap { std::unique_ptr current; std::unique_ptr previous; PerformanceImportFile perf; bool is_interactive = false; bool write_to_disk = false; bool load_previous = false; Index_DoIdMap(std::unique_ptr current, PerformanceImportFile perf, bool is_interactive, bool write_to_disk); }; struct Index_OnIdMapped { struct File { std::unique_ptr file; std::unique_ptr ids; File(std::unique_ptr file, std::unique_ptr ids); }; std::unique_ptr previous; std::unique_ptr current; PerformanceImportFile perf; bool is_interactive; bool write_to_disk; Index_OnIdMapped(PerformanceImportFile perf, bool is_interactive, bool write_to_disk); }; struct Index_OnIndexed { IndexUpdate update; PerformanceImportFile perf; Index_OnIndexed(IndexUpdate& update, PerformanceImportFile perf); }; struct QueueManager { using Index_RequestQueue = ThreadedQueue; using Index_DoIdMapQueue = ThreadedQueue; using Index_OnIdMappedQueue = ThreadedQueue; using Index_OnIndexedQueue = ThreadedQueue; Index_RequestQueue index_request; Index_DoIdMapQueue do_id_map; Index_DoIdMapQueue load_previous_index; Index_OnIdMappedQueue on_id_mapped; Index_OnIndexedQueue on_indexed; QueueManager(MultiQueueWaiter* waiter); bool HasWork(); };