Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
Davide Pesavento | 07684bc | 2021-02-07 20:09:28 -0500 | [diff] [blame] | 3 | * Copyright (c) 2012-2021 University of California, Los Angeles |
Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 4 | * |
| 5 | * This file is part of ChronoSync, synchronization library for distributed realtime |
| 6 | * applications for NDN. |
| 7 | * |
| 8 | * ChronoSync is free software: you can redistribute it and/or modify it under the terms |
| 9 | * of the GNU General Public License as published by the Free Software Foundation, either |
| 10 | * version 3 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * ChronoSync 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 General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along with |
| 17 | * ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * @author Zhenkai Zhu <http://irl.cs.ucla.edu/~zhenkai/> |
| 20 | * @author Chaoyi Bian <bcy@pku.edu.cn> |
| 21 | * @author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html> |
| 22 | * @author Yingdi Yu <yingdi@cs.ucla.edu> |
| 23 | */ |
| 24 | |
| 25 | #ifndef CHRONOSYNC_INTEREST_CONTAINER_HPP |
| 26 | #define CHRONOSYNC_INTEREST_CONTAINER_HPP |
| 27 | |
Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 28 | #include "diff-state-container.hpp" |
| 29 | |
Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 30 | #include <boost/multi_index_container.hpp> |
Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 31 | #include <boost/multi_index/hashed_index.hpp> |
Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 32 | #include <boost/multi_index/member.hpp> |
Davide Pesavento | 07684bc | 2021-02-07 20:09:28 -0500 | [diff] [blame] | 33 | #include <boost/multi_index/tag.hpp> |
Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 34 | |
| 35 | namespace chronosync { |
| 36 | |
| 37 | namespace mi = boost::multi_index; |
| 38 | |
| 39 | /// @brief Entry to record unsatisfied Sync Interest |
| 40 | class UnsatisfiedInterest : noncopyable |
| 41 | { |
| 42 | public: |
Ashlesh Gawande | 08784d4 | 2017-09-06 23:40:21 -0500 | [diff] [blame] | 43 | UnsatisfiedInterest(const Interest& interest, |
| 44 | ConstBufferPtr digest, |
Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 45 | bool isUnknown = false); |
| 46 | |
| 47 | public: |
Ashlesh Gawande | 08784d4 | 2017-09-06 23:40:21 -0500 | [diff] [blame] | 48 | const Interest interest; |
| 49 | ConstBufferPtr digest; |
Davide Pesavento | 0d837e3 | 2019-03-16 22:31:14 -0400 | [diff] [blame] | 50 | bool isUnknown; |
| 51 | ndn::scheduler::EventId expirationEvent; |
Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
Ashlesh Gawande | 08784d4 | 2017-09-06 23:40:21 -0500 | [diff] [blame] | 54 | using UnsatisfiedInterestPtr = shared_ptr<UnsatisfiedInterest>; |
| 55 | using ConstUnsatisfiedInterestPtr = shared_ptr<const UnsatisfiedInterest>; |
Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 56 | |
| 57 | /** |
| 58 | * @brief Container for unsatisfied Sync Interests |
| 59 | */ |
| 60 | struct InterestContainer : public mi::multi_index_container< |
| 61 | UnsatisfiedInterestPtr, |
| 62 | mi::indexed_by< |
| 63 | mi::hashed_unique< |
| 64 | mi::tag<hashed>, |
Ashlesh Gawande | 08784d4 | 2017-09-06 23:40:21 -0500 | [diff] [blame] | 65 | mi::member<UnsatisfiedInterest, ConstBufferPtr, &UnsatisfiedInterest::digest>, |
Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 66 | DigestPtrHash, |
| 67 | DigestPtrEqual |
| 68 | > |
| 69 | > |
| 70 | > |
| 71 | { |
| 72 | }; |
| 73 | |
| 74 | } // namespace chronosync |
| 75 | |
| 76 | #endif // CHRONOSYNC_INTEREST_CONTAINER_HPP |