partial-producer.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2019, The University of Memphis
4  *
5  * This file is part of PSync.
6  * See AUTHORS.md for complete list of PSync authors and contributors.
7  *
8  * PSync is free software: you can redistribute it and/or modify it under the terms
9  * of the GNU Lesser General Public License as published by the Free Software Foundation,
10  * either version 3 of the License, or (at your option) any later version.
11  *
12  * PSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  * PURPOSE. See the GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License along with
17  * PSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18  **/
19 
20 #ifndef PSYNC_PARTIAL_PRODUCER_HPP
21 #define PSYNC_PARTIAL_PRODUCER_HPP
22 
24 #include "PSync/producer-base.hpp"
25 
26 #include <map>
27 #include <unordered_set>
28 
29 #include <ndn-cxx/face.hpp>
30 #include <ndn-cxx/security/key-chain.hpp>
31 #include <ndn-cxx/util/scheduler.hpp>
32 #include <ndn-cxx/util/time.hpp>
33 
34 namespace psync {
35 
37 {
40  ndn::util::scheduler::ScopedEventId expirationEvent;
41 };
42 
52 {
53 public:
67  PartialProducer(size_t expectedNumEntries,
68  ndn::Face& face,
69  const ndn::Name& syncPrefix,
70  const ndn::Name& userPrefix,
71  ndn::time::milliseconds helloReplyFreshness = HELLO_REPLY_FRESHNESS,
72  ndn::time::milliseconds syncReplyFreshness = SYNC_REPLY_FRESHNESS);
73 
85  void
86  publishName(const ndn::Name& prefix, ndn::optional<uint64_t> seq = ndn::nullopt);
87 
88 private:
94  void
95  satisfyPendingSyncInterests(const ndn::Name& prefix);
96 
106  void
107  onHelloInterest(const ndn::Name& prefix, const ndn::Interest& interest);
108 
118  void
119  onSyncInterest(const ndn::Name& prefix, const ndn::Interest& interest);
120 
122  std::map<ndn::Name, PendingEntryInfo> m_pendingEntries;
123  ndn::ScopedRegisteredPrefixHandle m_registeredPrefix;
124 };
125 
126 } // namespace psync
127 
128 #endif // PSYNC_PARTIAL_PRODUCER_HPP
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
const ndn::time::milliseconds HELLO_REPLY_FRESHNESS
ndn::util::scheduler::ScopedEventId expirationEvent
const ndn::time::milliseconds SYNC_REPLY_FRESHNESS
Partial sync logic to publish data names.
Invertible Bloom Lookup Table (Invertible Bloom Filter)
Definition: iblt.hpp:80
Base class for PartialProducer and FullProducer.