diff --git a/include/opendht/dht.h b/include/opendht/dht.h index 6e8132f4f31d087903658200aadc03dde5ba01d8..7722ebfb172b23c029c5cefea4258fde62952e6e 100644 --- a/include/opendht/dht.h +++ b/include/opendht/dht.h @@ -302,6 +302,9 @@ public: void setStorageLimit(size_t limit = DEFAULT_STORAGE_LIMIT) override { max_store_size = limit; } + size_t getStorageLimit() const override { + return max_store_size; + } /** * Returns the total memory usage of stored values and the number diff --git a/include/opendht/dht_interface.h b/include/opendht/dht_interface.h index cfca964d9bf11c16613e7371fecee963bfa0ca9c..bb0362f071859d79113c9e45a1caeec1b7230c7b 100644 --- a/include/opendht/dht_interface.h +++ b/include/opendht/dht_interface.h @@ -221,6 +221,7 @@ public: * Set the in-memory storage limit in bytes */ virtual void setStorageLimit(size_t limit = DEFAULT_STORAGE_LIMIT) = 0; + virtual size_t getStorageLimit() const = 0; /** * Returns the total memory usage of stored values and the number diff --git a/include/opendht/dht_proxy_client.h b/include/opendht/dht_proxy_client.h index 9dd6db24f8da4ec370363cb3715e38b8adafafc3..3c011b43d84a8f7b0720b7859804b4fc5c400615 100644 --- a/include/opendht/dht_proxy_client.h +++ b/include/opendht/dht_proxy_client.h @@ -263,6 +263,7 @@ public: void dumpTables() const override {} std::vector<unsigned> getNodeMessageStats(bool) override { return {}; } void setStorageLimit(size_t) override {} + virtual size_t getStorageLimit() const { return 0; } void connectivityChanged(sa_family_t) override { getProxyInfos(); } diff --git a/include/opendht/dhtrunner.h b/include/opendht/dhtrunner.h index 5acf67943fe4a2d7e60caf2da837f430791a20e5..11e3810e7b61f6497004b749ae58a86a078768e4 100644 --- a/include/opendht/dhtrunner.h +++ b/include/opendht/dhtrunner.h @@ -335,6 +335,7 @@ public: std::pair<size_t, size_t> getStoreSize() const; + void getStorageLimit() const; void setStorageLimit(size_t limit = DEFAULT_STORAGE_LIMIT); std::vector<NodeExport> exportNodes() const; diff --git a/include/opendht/securedht.h b/include/opendht/securedht.h index 73f03abbe0511bcae70ab2acb09973183f43a364..f73e5a1d13766df55e5826a892ec177654fcdea5 100644 --- a/include/opendht/securedht.h +++ b/include/opendht/securedht.h @@ -173,6 +173,10 @@ public: void setStorageLimit(size_t limit = DEFAULT_STORAGE_LIMIT) override { dht_->setStorageLimit(limit); } + size_t getStorageLimit() const override { + return dht_->getStorageLimit(); + } + std::vector<NodeExport> exportNodes() const override { return dht_->exportNodes(); }