blob: 885e8232ae1083bf0675dbb83233f05b0e7061ab [file] [log] [blame]
Rolf Badorekef2bf512019-08-20 11:17:15 +03001/*
2 Copyright (c) 2018-2019 Nokia.
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 SHAREDDATALAYER_ASYNCDUMMYSTORAGE_HPP_
18#define SHAREDDATALAYER_ASYNCDUMMYSTORAGE_HPP_
19
20#include <sdl/asyncstorage.hpp>
21
22namespace shareddatalayer
23{
24 class Engine;
25
26 class AsyncDummyStorage: public AsyncStorage
27 {
28 public:
29 explicit AsyncDummyStorage(std::shared_ptr<Engine> engine);
30
31 AsyncDummyStorage(const AsyncDummyStorage&) = delete;
32
33 AsyncDummyStorage& operator = (const AsyncDummyStorage&) = delete;
34
35 AsyncDummyStorage(AsyncDummyStorage&&) = delete;
36
37 AsyncDummyStorage& operator = (AsyncDummyStorage&&) = delete;
38
39 int fd() const override;
40
41 void handleEvents() override;
42
43 void waitReadyAsync(const Namespace& ns, const ReadyAck& readyAck) override;
44
45 void setAsync(const Namespace& ns, const DataMap& dataMap, const ModifyAck& modifyAck) override;
46
47 void setIfAsync(const Namespace& ns, const Key& key, const Data& oldData, const Data& newData, const ModifyIfAck& modifyIfAck) override;
48
49 void setIfNotExistsAsync(const Namespace& ns, const Key& key, const Data& data, const ModifyIfAck& modifyIfAck) override;
50
51 void getAsync(const Namespace& ns, const Keys& keys, const GetAck& getAck) override;
52
53 void removeAsync(const Namespace& ns, const Keys& keys, const ModifyAck& modifyAck) override;
54
55 void removeIfAsync(const Namespace& ns, const Key& key, const Data& data, const ModifyIfAck& modifyIfAck) override;
56
57 void findKeysAsync(const Namespace& ns, const std::string& keyPrefix, const FindKeysAck& findKeysAck) override;
58
59 void removeAllAsync(const Namespace& ns, const ModifyAck& modifyAck) override;
60
61 private:
62 using Callback = std::function<void()>;
63
64 std::shared_ptr<Engine> engine;
65
66 void postCallback(const Callback& callback);
67 };
68}
69
70#endif