aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/protocols/indexing_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/src/hicn/transport/protocols/indexing_manager.h')
-rw-r--r--libtransport/src/hicn/transport/protocols/indexing_manager.h56
1 files changed, 9 insertions, 47 deletions
diff --git a/libtransport/src/hicn/transport/protocols/indexing_manager.h b/libtransport/src/hicn/transport/protocols/indexing_manager.h
index c692695a3..b6b8bb4a6 100644
--- a/libtransport/src/hicn/transport/protocols/indexing_manager.h
+++ b/libtransport/src/hicn/transport/protocols/indexing_manager.h
@@ -40,6 +40,8 @@ class IndexManager {
*/
virtual uint32_t getNextSuffix() = 0;
+ virtual void setFirstSuffix(uint32_t suffix) = 0;
+
/**
* Retrive the next segment to be reassembled.
*/
@@ -72,52 +74,6 @@ class IndexVerificationManager : public IndexManager {
virtual bool onContentObject(const core::ContentObject &content_object) = 0;
};
-class ZeroIndexManager : public IndexVerificationManager {
- public:
- ZeroIndexManager() : reset_(true) {}
-
- TRANSPORT_ALWAYS_INLINE virtual void reset() override { reset_ = true; }
-
- /**
- * Retrieve from the manifest the next suffix to retrieve.
- */
- TRANSPORT_ALWAYS_INLINE virtual uint32_t getNextSuffix() override {
- uint32_t ret = reset_ ? 0 : IndexManager::invalid_index;
- reset_ = false;
- return ret;
- }
-
- /**
- * Retrive the next segment to be reassembled.
- */
- TRANSPORT_ALWAYS_INLINE virtual uint32_t getNextReassemblySegment() override {
- return IndexManager::invalid_index;
- }
-
- TRANSPORT_ALWAYS_INLINE virtual bool isFinalSuffixDiscovered() override {
- return false;
- }
-
- TRANSPORT_ALWAYS_INLINE virtual uint32_t getFinalSuffix() override {
- return IndexManager::invalid_index;
- }
-
- TRANSPORT_ALWAYS_INLINE bool onManifest(
- core::ContentObject::Ptr &&content_object) override {
- throw errors::UnexpectedManifestException();
- }
-
- TRANSPORT_ALWAYS_INLINE bool onContentObject(
- const core::ContentObject &content_object) override {
- throw errors::RuntimeException(
- "Called onContentObject on a ZeroIndexManager, which is not able to "
- "process packets.");
- }
-
- private:
- bool reset_;
-};
-
class IncrementalIndexManager : public IndexVerificationManager {
public:
IncrementalIndexManager(interface::ConsumerSocket *icn_socket)
@@ -135,7 +91,7 @@ class IncrementalIndexManager : public IndexVerificationManager {
TRANSPORT_ALWAYS_INLINE virtual void reset() override {
final_suffix_ = std::numeric_limits<uint32_t>::max();
- next_download_suffix_ = 0;
+ next_download_suffix_ = first_suffix_;
next_reassembly_suffix_ = 0;
}
@@ -147,6 +103,11 @@ class IncrementalIndexManager : public IndexVerificationManager {
: IndexManager::invalid_index;
}
+ TRANSPORT_ALWAYS_INLINE virtual void setFirstSuffix(
+ uint32_t suffix) override {
+ first_suffix_ = suffix;
+ }
+
/**
* Retrive the next segment to be reassembled.
*/
@@ -183,6 +144,7 @@ class IncrementalIndexManager : public IndexVerificationManager {
protected:
interface::ConsumerSocket *socket_;
uint32_t final_suffix_;
+ uint32_t first_suffix_;
uint32_t next_download_suffix_;
uint32_t next_reassembly_suffix_;
std::unique_ptr<VerificationManager> verification_manager_;