VMware Tanzu GemFire Native C++ Reference 10.2.7
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
33namespace apache {
34namespace geode {
35namespace client {
36class CacheImpl;
37
43class 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
65 const std::shared_ptr<CacheLoader>& cacheLoader);
66
72 const std::shared_ptr<CacheWriter>& cacheWriter);
73
79 const std::shared_ptr<CacheListener>& aListener);
80
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
130 std::chrono::seconds idleTimeout);
131
139 std::chrono::seconds timeToLive);
140
148 std::chrono::seconds idleTimeout);
149
157 std::chrono::seconds timeToLive);
158
159 // PERSISTENCE
169 const std::string& libpath, const std::string& factoryFuncName,
170 const std::shared_ptr<Properties>& config = nullptr);
171
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
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
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_
DiskPolicyType
DiskPolicyType.hpp Enumerated type for disk policy.
Definition: DiskPolicyType.hpp:42
ExpirationAction
ExpirationAction.hpp Enumerated type for expiration actions.
Definition: ExpirationAction.hpp:42
Provides for the configuration and creation of instances of Region.
Definition: RegionFactory.hpp:43
RegionFactory & setLruEntriesLimit(const uint32_t entriesLimit)
Sets a limit on the number of entries that will be held in the cache.
RegionFactory & setCacheListener(const std::shared_ptr< CacheListener > &aListener)
Sets the CacheListener for the next RegionAttributes created.
RegionFactory & setPersistenceManager(const std::shared_ptr< PersistenceManager > &persistenceManager, const std::shared_ptr< Properties > &config=nullptr)
Sets the PersistenceManager for the next RegionAttributes created.
RegionFactory & setPersistenceManager(const std::string &libpath, const std::string &factoryFuncName, const std::shared_ptr< Properties > &config=nullptr)
Sets the library path for the library that will be invoked for the persistence of the region.
RegionFactory & setCacheListener(const std::string &libpath, const std::string &factoryFuncName)
Sets the library path for the library that will be invoked for the listener of the region.
RegionFactory & setCacheLoader(const std::shared_ptr< CacheLoader > &cacheLoader)
Sets the cache loader for the next RegionAttributes created.
RegionFactory & setConcurrencyLevel(uint8_t concurrencyLevel)
Sets the concurrency level tof the next RegionAttributes created.
RegionFactory & setEntryTimeToLive(ExpirationAction action, std::chrono::seconds timeToLive)
Sets the timeToLive expiration attributes for region entries for the next RegionAttributes created.
RegionFactory & setPartitionResolver(const std::shared_ptr< PartitionResolver > &aResolver)
Sets the PartitionResolver for the next RegionAttributes created.
RegionFactory & setRegionTimeToLive(ExpirationAction action, std::chrono::seconds timeToLive)
Sets the timeToLive expiration attributes for the region itself for the next RegionAttributes created...
RegionFactory & setCacheLoader(const std::string &libpath, const std::string &factoryFuncName)
Sets the library path for the library that will be invoked for the loader of the region.
RegionFactory & setEntryIdleTimeout(ExpirationAction action, std::chrono::seconds idleTimeout)
Sets the idleTimeout expiration attributes for region entries for the next RegionAttributes created.
RegionFactory & setConcurrencyChecksEnabled(bool enable)
Enables or disables concurrent modification checks.
RegionFactory & setPartitionResolver(const std::string &libpath, const std::string &factoryFuncName)
Sets the library path for the library that will be invoked for the partition resolver of the region.
RegionFactory & setLoadFactor(float loadFactor)
Sets the entry load factor for the next RegionAttributes created.
RegionFactory & setCachingEnabled(bool cachingEnabled)
Set caching enabled flag for this region.
RegionFactory & setCacheWriter(const std::shared_ptr< CacheWriter > &cacheWriter)
Sets the cache writer for the next RegionAttributes created.
std::shared_ptr< Region > create(std::string name)
Create a Region of the given name.
RegionFactory & setCacheWriter(const std::string &libpath, const std::string &factoryFuncName)
Sets the library path for the library that will be invoked for the writer of the region.
RegionFactory & setDiskPolicy(const DiskPolicyType diskPolicy)
Sets the Disk policy type for the next RegionAttributes created.
RegionFactory & setInitialCapacity(int initialCapacity)
Sets the entry initial capacity for the next RegionAttributes created.
RegionFactory & setRegionIdleTimeout(ExpirationAction action, std::chrono::seconds idleTimeout)
Sets the idleTimeout expiration attributes for the region itself for the next RegionAttributes create...

Apache Geode C++ Cache API Documentation