client-cpp  0.7.0
ILogStorage.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2015 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 ILOGSTORAGE_HPP_
18 #define ILOGSTORAGE_HPP_
19 
20 #include <list>
21 #include <memory>
22 #include <cstdint>
23 #include <utility>
24 
25 namespace kaa {
26 
27 /*
28  * Forward declarations.
29  */
30 class LogRecord;
31 class ILogStorageStatus;
32 
36 typedef std::shared_ptr<LogRecord> LogRecordPtr;
37 
43 class ILogStorage {
44 public:
51  typedef std::int32_t RecordBlockId;
52 
56  typedef std::list<LogRecordPtr> RecordBlock;
57 
61  typedef std::pair<RecordBlockId, RecordBlock> RecordPack;
62 
66  virtual void addLogRecord(LogRecordPtr record) = 0;
67 
73  virtual ILogStorageStatus& getStatus() = 0;
74 
82  virtual RecordPack getRecordBlock(std::size_t blockSize) = 0;
83 
89  virtual void removeRecordBlock(RecordBlockId id) = 0;
90 
96  virtual void notifyUploadFailed(RecordBlockId id) = 0;
97 
98  virtual ~ILogStorage() {}
99 };
100 
104 typedef std::shared_ptr<ILogStorage> ILogStoragePtr;
105 
106 } // namespace kaa
107 
108 #endif /* ILOGSTORAGE_HPP_ */
std::list< LogRecordPtr > RecordBlock
The alias for the log block container.
Definition: ILogStorage.hpp:56
virtual void notifyUploadFailed(RecordBlockId id)=0
Notifies of the delivery of the log block marked by the specified id has been failed.
virtual ILogStorageStatus & getStatus()=0
Returns the current log storage status.
std::pair< RecordBlockId, RecordBlock > RecordPack
The alias for the log block marked by the unique identifier.
Definition: ILogStorage.hpp:61
virtual void addLogRecord(LogRecordPtr record)=0
Adds the log record to the storage.
virtual RecordPack getRecordBlock(std::size_t blockSize)=0
Returns the block of log records which total size is less or equal to the specified block size...
virtual ~ILogStorage()
Definition: ILogStorage.hpp:98
std::shared_ptr< ILogStorage > ILogStoragePtr
std::int32_t RecordBlockId
The alias for the unique identifier of the requested log block.
Definition: ILogStorage.hpp:51
virtual void removeRecordBlock(RecordBlockId id)=0
Removes the log block marked by the specified id.
std::shared_ptr< LogRecord > LogRecordPtr
Definition: ILogStorage.hpp:36
The public interface to access to the log storage.
Definition: ILogStorage.hpp:43
The public interface to represent the current log storage state.