client-cpp  0.9.0
ILogStorage.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 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 <memory>
21 #include <cstdint>
22 
23 #include "kaa/log/BucketInfo.hpp"
24 #include "kaa/log/LogBucket.hpp"
25 
26 namespace kaa {
27 
28 class LogRecord;
29 class ILogStorageStatus;
30 
40 class ILogStorage {
41 public:
50  virtual BucketInfo addLogRecord(LogRecord&& record) = 0;
51 
58  virtual ILogStorageStatus& getStatus() = 0;
59 
66  virtual LogBucket getNextBucket() = 0;
67 
75  virtual void removeBucket(std::int32_t bucketId) = 0;
76 
85  virtual void rollbackBucket(std::int32_t bucketId) = 0;
86 
87  virtual ~ILogStorage() {}
88 };
89 
93 typedef std::shared_ptr<ILogStorage> ILogStoragePtr;
94 
95 } // namespace kaa
96 
97 #endif /* ILOGSTORAGE_HPP_ */
virtual ILogStorageStatus & getStatus()=0
Returns a log storage status.
The helper class which is used to transfer logs from LogStorage to LogCollector.
Definition: LogBucket.hpp:33
virtual BucketInfo addLogRecord(LogRecord &&record)=0
Persists a log record.
virtual ~ILogStorage()
Definition: ILogStorage.hpp:87
virtual void rollbackBucket(std::int32_t bucketId)=0
Tells a log storage to consider a log bucket as unused, i.e. a log bucket will be accessible again vi...
std::shared_ptr< ILogStorage > ILogStoragePtr
Definition: ILogStorage.hpp:93
virtual void removeBucket(std::int32_t bucketId)=0
Tells a log storage to remove a log bucket.
Describes a unique log bucket.
Definition: BucketInfo.hpp:31
Interface of a log storage.
Definition: ILogStorage.hpp:40
virtual LogBucket getNextBucket()=0
Returns a new log bucket.
The public interface to represent the current log storage state.