VMware Tanzu GemFire Native C++ Reference 10.2.7
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
32namespace apache {
33namespace geode {
34namespace client {
35
36class CacheableKey;
37class Properties;
38class PersistenceManager;
39class Region;
40
41typedef std::shared_ptr<PersistenceManager> (*getPersistenceManagerInstance)(
42 const std::shared_ptr<Region>&);
43
52class 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_
PersistenceManager API for persistence and overflow.
Definition: PersistenceManager.hpp:52
virtual bool readAll()=0
Reads all the values from the region.
static std::shared_ptr< PersistenceManager > getPersistenceManager()
Returns the current persistence manager.
std::shared_ptr< Region > m_regionPtr
Region for this persistence manager.
Definition: PersistenceManager.hpp:135
virtual void init(const std::shared_ptr< Region > &region, const std::shared_ptr< Properties > &diskProperties)=0
This method gets called after an implementation object is created.
virtual void write(const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Cacheable > &value, std::shared_ptr< void > &persistenceInfo)=0
Writes a key, value pair of region to the disk.
virtual void close()=0
Closes the persistence manager instance.
virtual void destroy(const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< void > &PersistenceInfo)=0
destroys the entry specified by the key in the argument.
virtual std::shared_ptr< Cacheable > read(const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< void > &PersistenceInfo)=0
Reads the value for the key from the disk.
virtual bool writeAll()=0
Writes all the entries for a region.

Apache Geode C++ Cache API Documentation