VMware Tanzu GemFire Native C++ Reference  10.1.5
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 
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_
apache::geode::client::RegionFactory::setCacheWriter
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.
RegionShortcut
Each enum represents a predefined RegionAttributes in a {}.
apache::geode::client::RegionFactory::setInitialCapacity
RegionFactory & setInitialCapacity(int initialCapacity)
Sets the entry initial capacity for the next RegionAttributes created.
apache::geode::client::RegionFactory::setLoadFactor
RegionFactory & setLoadFactor(float loadFactor)
Sets the entry load factor for the next RegionAttributes created.
apache::geode::client::RegionFactory::setEntryTimeToLive
RegionFactory & setEntryTimeToLive(ExpirationAction action, std::chrono::seconds timeToLive)
Sets the timeToLive expiration attributes for region entries for the next RegionAttributes created.
apache::geode::client::RegionFactory::setRegionIdleTimeout
RegionFactory & setRegionIdleTimeout(ExpirationAction action, std::chrono::seconds idleTimeout)
Sets the idleTimeout expiration attributes for the region itself for the next RegionAttributes create...
apache::geode::client::RegionFactory::setCacheListener
RegionFactory & setCacheListener(const std::shared_ptr< CacheListener > &aListener)
Sets the CacheListener for the next RegionAttributes created.
apache::geode::client::RegionFactory::setPartitionResolver
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.
ExpirationAction
Enumerated type for expiration actions.
apache::geode::client::RegionFactory::setPartitionResolver
RegionFactory & setPartitionResolver(const std::shared_ptr< PartitionResolver > &aResolver)
Sets the PartitionResolver for the next RegionAttributes created.
apache::geode::client::RegionFactory::setEntryIdleTimeout
RegionFactory & setEntryIdleTimeout(ExpirationAction action, std::chrono::seconds idleTimeout)
Sets the idleTimeout expiration attributes for region entries for the next RegionAttributes created.
RegionAttributesFactory.hpp
apache::geode::client::RegionFactory::setPersistenceManager
RegionFactory & setPersistenceManager(const std::shared_ptr< PersistenceManager > &persistenceManager, const std::shared_ptr< Properties > &config=nullptr)
Sets the PersistenceManager for the next RegionAttributes created.
apache::geode::client::RegionFactory::setConcurrencyChecksEnabled
RegionFactory & setConcurrencyChecksEnabled(bool enable)
Enables or disables concurrent modification checks.
apache::geode::client::RegionFactory::setPersistenceManager
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.
apache::geode::client::RegionFactory::setLruEntriesLimit
RegionFactory & setLruEntriesLimit(const uint32_t entriesLimit)
Sets a limit on the number of entries that will be held in the cache.
apache::geode::client::RegionFactory::setRegionTimeToLive
RegionFactory & setRegionTimeToLive(ExpirationAction action, std::chrono::seconds timeToLive)
Sets the timeToLive expiration attributes for the region itself for the next RegionAttributes created...
apache::geode::client::RegionFactory::setDiskPolicy
RegionFactory & setDiskPolicy(const DiskPolicyType diskPolicy)
Sets the Disk policy type for the next RegionAttributes created.
apache::geode::client::RegionFactory
Provides for the configuration and creation of instances of Region.
Definition: RegionFactory.hpp:43
DiskPolicyType
Enumerated type for disk policy.
apache::geode::client::RegionFactory::setCacheWriter
RegionFactory & setCacheWriter(const std::shared_ptr< CacheWriter > &cacheWriter)
Sets the cache writer for the next RegionAttributes created.
apache::geode::client::RegionFactory::setConcurrencyLevel
RegionFactory & setConcurrencyLevel(uint8_t concurrencyLevel)
Sets the concurrency level tof the next RegionAttributes created.
apache::geode::client::RegionFactory::setCacheLoader
RegionFactory & setCacheLoader(const std::shared_ptr< CacheLoader > &cacheLoader)
Sets the cache loader for the next RegionAttributes created.
apache::geode::client::RegionFactory::setCachingEnabled
RegionFactory & setCachingEnabled(bool cachingEnabled)
Set caching enabled flag for this region.
apache::geode::client::RegionFactory::setCacheLoader
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.
apache::geode::client::RegionFactory::setCacheListener
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.
apache::geode::client::RegionFactory::create
std::shared_ptr< Region > create(std::string name)
Create a Region of the given name.

Apache Geode C++ Cache API Documentation