From a42be561fd3ad1b46bc63abcfa2ad1b6d6cbc55a Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Thu, 29 Aug 2013 21:15:47 +0200 Subject: [PATCH] added includeSystem URL parameter --- .../RestHandler/RestReplicationHandler.cpp | 21 +++++++++++++++++-- arangosh/V8Client/arangodump.cpp | 6 +++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/arangod/RestHandler/RestReplicationHandler.cpp b/arangod/RestHandler/RestReplicationHandler.cpp index e9e7f9e6fb..c8954249f4 100644 --- a/arangod/RestHandler/RestReplicationHandler.cpp +++ b/arangod/RestHandler/RestReplicationHandler.cpp @@ -1080,6 +1080,11 @@ void RestReplicationHandler::handleCommandLoggerFollow () { /// /// @RESTHEADER{GET /_api/replication/inventory,returns an inventory of collections and indexes} /// +/// @RESTQUERYPARAMETERS +/// +/// @RESTQUERYPARAM{includeSystem,boolean,optional} +/// Include system collections in the result. The default value is `false`. +/// /// @RESTDESCRIPTION /// Returns the list of collections and indexes available on the server. This /// list can be used by replication clients to initiate an initial sync with the @@ -1195,8 +1200,20 @@ void RestReplicationHandler::handleCommandInventory () { TRI_voc_tick_t tick = TRI_CurrentTickVocBase(); - // collections - TRI_json_t* collections = TRI_InventoryCollectionsVocBase(_vocbase, tick, &filterCollection, NULL); + // include system collections? + bool includeSystem = false; + bool found; + const char* value = _request->value("includeSystem", found); + + if (found) { + includeSystem = StringUtils::boolean(value); + } + + // register filter function + bool (*filter)(TRI_vocbase_col_t*, void*) = includeSystem ? 0 : &filterCollection; + + // collections and indexes + TRI_json_t* collections = TRI_InventoryCollectionsVocBase(_vocbase, tick, filter, NULL); if (collections == 0) { generateError(HttpResponse::SERVER_ERROR, TRI_ERROR_OUT_OF_MEMORY); diff --git a/arangosh/V8Client/arangodump.cpp b/arangosh/V8Client/arangodump.cpp index 5051e1927a..8b3c0fe8e5 100644 --- a/arangosh/V8Client/arangodump.cpp +++ b/arangosh/V8Client/arangodump.cpp @@ -421,8 +421,11 @@ static int DumpCollection (ofstream& outFile, static int GetInventory (string& errorMsg) { map headers; + const string url = "/_api/replication/inventory?includeSystem=" + + string(IncludeSystemCollections ? "true" : "false"); + SimpleHttpResult* response = Client->request(HttpRequest::HTTP_REQUEST_GET, - "/_api/replication/inventory", + url, 0, 0, headers); @@ -448,6 +451,7 @@ static int GetInventory (string& errorMsg) { const string& data = response->getBody().str(); + TRI_json_t* json = TRI_JsonString(TRI_UNKNOWN_MEM_ZONE, data.c_str()); delete response;