// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. #pragma once #include #include namespace diskann { class Server { public: Server(web::uri &url, std::vector> &multi_searcher, const std::string &typestring); virtual ~Server(); pplx::task open(); pplx::task close(); protected: template void handle_post(web::http::http_request message); template web::json::value toJsonArray(const std::vector &v, std::function valConverter); web::json::value prepareResponse(const int64_t &queryId, const int k); template void parseJson(const utility::string_t &body, unsigned int &k, int64_t &queryId, T *&queryVector, unsigned int &dimensions, unsigned &Ls); web::json::value idsToJsonArray(const diskann::SearchResult &result); web::json::value distancesToJsonArray(const diskann::SearchResult &result); web::json::value tagsToJsonArray(const diskann::SearchResult &result); web::json::value partitionsToJsonArray(const diskann::SearchResult &result); SearchResult aggregate_results(const unsigned K, const std::vector &results); private: bool _isDebug; std::unique_ptr _listener; const bool _multi_search; std::vector> _multi_searcher; }; } // namespace diskann