Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2012-2014 University of California, Los Angeles |
| 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 | |
| 28 | #include "common.hpp" |
| 29 | #include "mi-tag.hpp" |
| 30 | #include "diff-state-container.hpp" |
| 31 | |
| 32 | #include <ndn-cxx/util/time.hpp> |
| 33 | #include <ndn-cxx/util/scheduler.hpp> |
| 34 | |
| 35 | #include <boost/multi_index_container.hpp> |
| 36 | #include <boost/multi_index/tag.hpp> |
| 37 | #include <boost/multi_index/hashed_index.hpp> |
| 38 | #include <boost/multi_index/ordered_index.hpp> |
| 39 | #include <boost/multi_index/member.hpp> |
| 40 | |
| 41 | namespace chronosync { |
| 42 | |
| 43 | namespace mi = boost::multi_index; |
| 44 | |
| 45 | /// @brief Entry to record unsatisfied Sync Interest |
| 46 | class UnsatisfiedInterest : noncopyable |
| 47 | { |
| 48 | public: |
| 49 | UnsatisfiedInterest(shared_ptr<const Interest> interest, |
| 50 | ndn::ConstBufferPtr digest, |
| 51 | bool isUnknown = false); |
| 52 | |
| 53 | public: |
| 54 | shared_ptr<const Interest> interest; |
| 55 | ndn::ConstBufferPtr digest; |
| 56 | bool isUnknown; |
| 57 | ndn::EventId expirationEvent; |
| 58 | }; |
| 59 | |
Yingdi Yu | 906c2ea | 2014-10-31 11:24:50 -0700 | [diff] [blame^] | 60 | typedef shared_ptr<UnsatisfiedInterest> UnsatisfiedInterestPtr; |
| 61 | typedef shared_ptr<const UnsatisfiedInterest> ConstUnsatisfiedInterestPtr; |
Yingdi Yu | 1c4ba9a | 2014-08-27 19:05:49 -0700 | [diff] [blame] | 62 | |
| 63 | /** |
| 64 | * @brief Container for unsatisfied Sync Interests |
| 65 | */ |
| 66 | struct InterestContainer : public mi::multi_index_container< |
| 67 | UnsatisfiedInterestPtr, |
| 68 | mi::indexed_by< |
| 69 | mi::hashed_unique< |
| 70 | mi::tag<hashed>, |
| 71 | mi::member<UnsatisfiedInterest, ndn::ConstBufferPtr, &UnsatisfiedInterest::digest>, |
| 72 | DigestPtrHash, |
| 73 | DigestPtrEqual |
| 74 | > |
| 75 | > |
| 76 | > |
| 77 | { |
| 78 | }; |
| 79 | |
| 80 | } // namespace chronosync |
| 81 | |
| 82 | #endif // CHRONOSYNC_INTEREST_CONTAINER_HPP |