Pivotal GemFire Native C++ Reference  10.1.3
RegionFactory.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_REGIONFACTORY_H_
21 #define GEODE_REGIONFACTORY_H_
22 
23 #include <chrono>
24 
26 #include "internal/chrono/duration.hpp"
27 #include "internal/geode_globals.hpp"
28 
33 namespace apache {
34 namespace geode {
35 namespace client {
36 class CacheImpl;
37 
43 class APACHE_GEODE_EXPORT RegionFactory {
44  public:
45  RegionFactory() = delete;
46  ~RegionFactory() = default;
47  RegionFactory(const RegionFactory& nocopy) = delete;
48  RegionFactory(RegionFactory&& move) = default;
49 
58  std::shared_ptr<Region> create(std::string name);
59 
64  RegionFactory& setCacheLoader(
65  const std::shared_ptr<CacheLoader>& cacheLoader);
66 
71  RegionFactory& setCacheWriter(
72  const std::shared_ptr<CacheWriter>& cacheWriter);
73 
78  RegionFactory& setCacheListener(
79  const std::shared_ptr<CacheListener>& aListener);
80 
86  RegionFactory& setPartitionResolver(
87  const std::shared_ptr<PartitionResolver>& aResolver);
88 
94  RegionFactory& setCacheLoader(const std::string& libpath,
95  const std::string& factoryFuncName);
96 
102  RegionFactory& setCacheWriter(const std::string& libpath,
103  const std::string& factoryFuncName);
104 
110  RegionFactory& setCacheListener(const std::string& libpath,
111  const std::string& factoryFuncName);
112 
118  RegionFactory& setPartitionResolver(const std::string& libpath,
119  const std::string& factoryFuncName);
120 
121  // EXPIRATION ATTRIBUTES
122 
129  RegionFactory& setEntryIdleTimeout(ExpirationAction action,
130  std::chrono::seconds idleTimeout);
131 
138  RegionFactory& setEntryTimeToLive(ExpirationAction action,
139  std::chrono::seconds timeToLive);
140 
147  RegionFactory& setRegionIdleTimeout(ExpirationAction action,
148  std::chrono::seconds idleTimeout);
149 
156  RegionFactory& setRegionTimeToLive(ExpirationAction action,
157  std::chrono::seconds timeToLive);
158 
159  // PERSISTENCE
168  RegionFactory& setPersistenceManager(
169  const std::string& libpath, const std::string& factoryFuncName,
170  const std::shared_ptr<Properties>& config = nullptr);
171 
178  RegionFactory& setPersistenceManager(
179  const std::shared_ptr<PersistenceManager>& persistenceManager,
180  const std::shared_ptr<Properties>& config = nullptr);
181 
182  // MAP ATTRIBUTES
190  RegionFactory& setInitialCapacity(int initialCapacity);
191 
199  RegionFactory& setLoadFactor(float loadFactor);
200 
207  RegionFactory& setConcurrencyLevel(uint8_t concurrencyLevel);
208 
217  RegionFactory& setLruEntriesLimit(const uint32_t entriesLimit);
218 
225  RegionFactory& setDiskPolicy(const DiskPolicyType diskPolicy);
226 
238  RegionFactory& setCachingEnabled(bool cachingEnabled);
239 
240  /*
241  * Set the PoolName to attach the Region with that Pool.
242  * Use only when Cache ha more than one Pool
243  * @param name
244  * the name of the Pool to which region will be attached.
245  * @return a reference to <code>this</code>
246  */
247  RegionFactory& setPoolName(const std::string& name);
248 
249  /*
250  * Set boolean to enable/disable cloning while applying delta.
251  * @param isClonable whether to enable cloning or not.
252  * @return a reference to <code>this</code>
253  */
254  RegionFactory& setCloningEnabled(bool isClonable);
255 
263  RegionFactory& setConcurrencyChecksEnabled(bool enable);
264 
265  private:
266  RegionFactory(apache::geode::client::RegionShortcut preDefinedRegion,
267  CacheImpl* cacheImpl);
268 
269  void setRegionShortcut();
270 
271  RegionShortcut m_preDefinedRegion;
272 
273  std::shared_ptr<RegionAttributesFactory> m_regionAttributesFactory;
274 
275  CacheImpl* m_cacheImpl;
276 
277  friend class CacheImpl;
278 };
279 
280 } // namespace client
281 } // namespace geode
282 } // namespace apache
283 
284 #endif // GEODE_REGIONFACTORY_H_
RegionShortcut
ExpirationAction
RegionAttributesFactory.hpp
apache::geode::client::RegionFactory
Definition: RegionFactory.hpp:43
DiskPolicyType

Apache Geode C++ Cache API Documentation