client-cpp  0.6.3
DefaultLogUploadConfiguration.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef DEFAULTLOGUPLOADCONFIGURATION_HPP_
18 #define DEFAULTLOGUPLOADCONFIGURATION_HPP_
19 
20 #include "kaa/KaaDefaults.hpp"
21 
22 #ifdef KAA_USE_LOGGING
23 
24 #include <cstdint>
26 
27 namespace kaa {
28 
29 class DefaultLogUploadConfiguration : public ILogUploadConfiguration {
30 public:
31  DefaultLogUploadConfiguration()
32  : blockSize_(DEFAULT_BLOCK_SIZE)
33  , maxStorageVolume_(DEFAULT_MAX_STORAGE_VOLUME)
34  , volumeThreshold_(DEFAULT_VOLUME_THRESHOLD) {}
35 
36  DefaultLogUploadConfiguration(size_t blockSize, size_t maxStorageVolume, size_t volumeThreshold)
37  : blockSize_(blockSize)
38  , maxStorageVolume_(maxStorageVolume)
39  , volumeThreshold_(volumeThreshold) {}
40 
41  std::size_t getBlockSize() const { return blockSize_; }
42  std::size_t getMaxStorageVolume() const { return maxStorageVolume_; }
43  std::size_t getVolumeThreshold() const { return volumeThreshold_; }
44 
45 private:
46  std::size_t blockSize_;
47  std::size_t maxStorageVolume_;
48  std::size_t volumeThreshold_;
49 
50  static const std::size_t DEFAULT_BLOCK_SIZE = 8192; //8 Kb
51  static const std::size_t DEFAULT_MAX_STORAGE_VOLUME = 1024*1024; //1 Mb
52  static const std::size_t DEFAULT_VOLUME_THRESHOLD = DEFAULT_BLOCK_SIZE * 4; // 32 Kb
53 };
54 
55 } // namespace kaa
56 
57 #endif
58 
59 #endif /* DEFAULTLOGUPLOADCONFIGURATION_HPP_ */