Pivotal GemFire Native C++ Reference  10.1.3
PersistenceManager.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #pragma once
19 
20 #ifndef GEODE_PERSISTENCEMANAGER_H_
21 #define GEODE_PERSISTENCEMANAGER_H_
22 
23 #include <memory>
24 
25 #include "Serializable.hpp"
26 #include "internal/geode_globals.hpp"
27 
32 namespace apache {
33 namespace geode {
34 namespace client {
35 
36 class CacheableKey;
37 class Properties;
38 class PersistenceManager;
39 class Region;
40 
41 typedef std::shared_ptr<PersistenceManager> (*getPersistenceManagerInstance)(
42  const std::shared_ptr<Region>&);
43 
52 class APACHE_GEODE_EXPORT PersistenceManager {
53  public:
58  static std::shared_ptr<PersistenceManager> getPersistenceManager();
59 
71  virtual void write(const std::shared_ptr<CacheableKey>& key,
72  const std::shared_ptr<Cacheable>& value,
73  std::shared_ptr<void>& persistenceInfo) = 0;
74 
80  virtual bool writeAll() = 0;
81 
89  virtual void init(const std::shared_ptr<Region>& region,
90  const std::shared_ptr<Properties>& diskProperties) = 0;
91 
99  virtual std::shared_ptr<Cacheable> read(
100  const std::shared_ptr<CacheableKey>& key,
101  const std::shared_ptr<void>& PersistenceInfo) = 0;
102 
107  virtual bool readAll() = 0;
108 
116  virtual void destroy(const std::shared_ptr<CacheableKey>& key,
117  const std::shared_ptr<void>& PersistenceInfo) = 0;
118 
123  virtual void close() = 0;
124 
125  explicit PersistenceManager(const std::shared_ptr<Region>& regionPtr)
126  : m_regionPtr(regionPtr) {}
127 
128  PersistenceManager() = default;
129 
130  virtual ~PersistenceManager() = default;
131 
132  protected:
135  std::shared_ptr<Region> m_regionPtr;
136 };
137 } // namespace client
138 } // namespace geode
139 } // namespace apache
140 
141 #endif // GEODE_PERSISTENCEMANAGER_H_
apache::geode::client::PersistenceManager::m_regionPtr
std::shared_ptr< Region > m_regionPtr
Region for this persistence manager.
Definition: PersistenceManager.hpp:135
apache::geode::client::PersistenceManager
Definition: PersistenceManager.hpp:52

Apache Geode C++ Cache API Documentation