Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Remove replication updates API.

kishorencdd290884e5d7
diff --git a/include/core_api.h b/include/core_api.h
index 12bf75cc..cfe950d7 100644
--- a/include/core_api.h
+++ b/include/core_api.h
@@ -28,8 +28,6 @@ bool get_fetch_document(http_req & req, http_res & res);
bool del_remove_document(http_req & req, http_res & res);
-bool get_replication_updates(http_req &req, http_res &res);
-
bool collection_export_handler(http_req* req, http_res* res, void* data);
bool async_write_request(void *data);
diff --git a/src/core_api.cpp b/src/core_api.cpp
index f7173c22..fd703902 100644
--- a/src/core_api.cpp
+++ b/src/core_api.cpp
@@ -568,46 +568,6 @@ bool del_remove_document(http_req & req, http_res & res) {
return true;
}
-bool get_replication_updates(http_req & req, http_res & res) {
- // Could be heavy - spawn a new thread so we don't block the main thread
- std::thread response_thread([&]() {
- if(!StringUtils::is_uint64_t(req.params["seq_number"])) {
- res.send_400("The value of the parameter `seq_number` must be an unsigned integer.");
- return false;
- }
-
- const uint64_t MAX_UPDATES_TO_SEND = 10000;
- uint64_t seq_number = std::stoull(req.params["seq_number"]);
-
- CollectionManager & collectionManager = CollectionManager::get_instance();
- Store* store = collectionManager.get_store();
- Option<std::vector<std::string>*> updates_op = store->get_updates_since(seq_number, MAX_UPDATES_TO_SEND);
- if(!updates_op.ok()) {
- res.send(updates_op.code(), updates_op.error());
- server->send_message(SEND_RESPONSE_MSG, new request_response{&req, &res});
- return false;
- }
-
- nlohmann::json json_response;
- json_response["updates"] = nlohmann::json::array();
-
- std::vector<std::string> *updates = updates_op.get();
- for(const std::string & update: *updates) {
- json_response["updates"].push_back(StringUtils::base64_encode(update));
- }
-
- uint64_t latest_seq_num = store->get_latest_seq_number();
- json_response["latest_seq_num"] = latest_seq_num;
-
- res.send_200(json_response.dump());
- server->send_message(SEND_RESPONSE_MSG, new request_response{&req, &res});
- delete updates;
- });
-
- response_thread.detach();
- return true;
-}
-
bool async_write_request(void *data) {
//LOG(INFO) << "async_write_request called";
AsyncIndexArg* index_arg = static_cast<AsyncIndexArg*>(data);
diff --git a/src/main/typesense_server.cpp b/src/main/typesense_server.cpp
index 800d27b3..f4f0e110 100644
--- a/src/main/typesense_server.cpp
+++ b/src/main/typesense_server.cpp
@@ -22,9 +22,6 @@ void master_server_routes() {
// meta
server->get("/debug", get_debug);
server->get("/health", get_health);
-
- // replication
- server->get("/replication/updates", get_replication_updates, true);
}
void replica_server_routes() {
@@ -40,9 +37,6 @@ void replica_server_routes() {
// meta
server->get("/debug", get_debug);
server->get("/health", get_health);
-
- // replication
- server->get("/replication/updates", get_replication_updates, true);
}
int main(int argc, char **argv) {