common.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2020, 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_COMMON_HPP
21 #define PSYNC_COMMON_HPP
22 
23 #include "PSync/detail/config.hpp"
24 
25 #include <ndn-cxx/name.hpp>
26 
27 #include <cstddef>
28 #include <cstdint>
29 #include <functional>
30 #include <stdexcept>
31 #include <vector>
32 
33 namespace psync {
34 
35 enum class CompressionScheme {
36  NONE,
37  ZLIB,
38  GZIP,
39  BZIP2,
40  LZMA,
41  ZSTD,
42 #ifdef PSYNC_HAVE_ZLIB
43  DEFAULT = ZLIB
44 #else
45  DEFAULT = NONE
46 #endif
47 };
48 
49 class CompressionError : public std::runtime_error
50 {
51 public:
52  using std::runtime_error::runtime_error;
53 };
54 
56 {
57  ndn::Name prefix;
58  uint64_t lowSeq;
59  uint64_t highSeq;
60 };
61 
62 using UpdateCallback = std::function<void(const std::vector<MissingDataInfo>&)>;
63 
64 } // namespace psync
65 
66 #endif // PSYNC_COMMON_HPP
Definition: common.hpp:33
std::function< void(const std::vector< MissingDataInfo > &)> UpdateCallback
Definition: common.hpp:62
CompressionScheme
Definition: common.hpp:35