VMware Tanzu GemFire Native C++ Reference  10.1.5
RegionAttributesFactory.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_ATTRIBUTESFACTORY_H_
21 #define GEODE_ATTRIBUTESFACTORY_H_
22 
23 #include <chrono>
24 #include <string>
25 
26 #include "CacheListener.hpp"
27 #include "CacheLoader.hpp"
28 #include "CacheWriter.hpp"
29 #include "DiskPolicyType.hpp"
30 #include "ExceptionTypes.hpp"
31 #include "ExpirationAction.hpp"
32 #include "PartitionResolver.hpp"
33 #include "Pool.hpp"
34 #include "RegionAttributes.hpp"
35 #include "internal/chrono/duration.hpp"
36 #include "internal/geode_globals.hpp"
37 
42 namespace apache {
43 namespace geode {
44 namespace client {
45 
156 class APACHE_GEODE_EXPORT RegionAttributesFactory {
160  public:
170 
178  explicit RegionAttributesFactory(const RegionAttributes regionAttributes);
179 
181 
186 
187  // CALLBACKS
188 
195  const std::shared_ptr<CacheLoader>& cacheLoader);
196 
203  const std::shared_ptr<CacheWriter>& cacheWriter);
204 
211  const std::shared_ptr<CacheListener>& aListener);
212 
220  const std::shared_ptr<PartitionResolver>& aResolver);
221 
227  RegionAttributesFactory& setCacheLoader(const std::string& libpath,
228  const std::string& factoryFuncName);
229 
236  RegionAttributesFactory& setCacheWriter(const std::string& libpath,
237  const std::string& factoryFuncName);
238 
244  RegionAttributesFactory& setCacheListener(const std::string& libpath,
245  const std::string& factoryFuncName);
246 
253  const std::string& libpath, const std::string& factoryFuncName);
254 
255  // EXPIRATION ATTRIBUTES
256 
268  ExpirationAction action, std::chrono::seconds idleTimeout);
269 
281  std::chrono::seconds timeToLive);
282 
294  ExpirationAction action, std::chrono::seconds idleTimeout);
295 
307  std::chrono::seconds timeToLive);
308 
309  // PERSISTENCE
319  const std::string& libpath, const std::string& factoryFuncName,
320  const std::shared_ptr<Properties>& config = nullptr);
321 
329  const std::shared_ptr<PersistenceManager>& persistenceManager,
330  const std::shared_ptr<Properties>& config = nullptr);
331 
332  // MAP ATTRIBUTES
341  RegionAttributesFactory& setInitialCapacity(int32_t initialCapacity);
342 
352 
360  RegionAttributesFactory& setConcurrencyLevel(uint8_t concurrencyLevel);
361 
369  RegionAttributesFactory& setLruEntriesLimit(const uint32_t entriesLimit);
370 
379 
391 
410  RegionAttributesFactory& setPoolName(const std::string& name);
411 
419 
428  bool concurrencyChecksEnabled);
429 
430  // FACTORY METHOD
431 
440 
441  private:
442  RegionAttributesFactory& operator=(const RegionAttributesFactory& other) =
443  default;
444  RegionAttributes m_regionAttributes;
445  static void validateAttributes(RegionAttributes& attrs);
446 }; // namespace client
447 
448 } // namespace client
449 } // namespace geode
450 } // namespace apache
451 
452 #endif // GEODE_ATTRIBUTESFACTORY_H_
apache::geode::client::RegionAttributesFactory::setPersistenceManager
RegionAttributesFactory & 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::RegionAttributesFactory::setEntryTimeToLive
RegionAttributesFactory & setEntryTimeToLive(ExpirationAction action, std::chrono::seconds timeToLive)
Sets the timeToLive expiration attributes for region entries for the next RegionAttributes created.
ExpirationAction
Enumerated type for expiration actions.
apache::geode::client::RegionAttributesFactory::RegionAttributesFactory
RegionAttributesFactory(const RegionAttributes regionAttributes)
Creates a new instance of RegionAttributesFactory ready to create a RegionAttributes with the same se...
apache::geode::client::RegionAttributesFactory::setPersistenceManager
RegionAttributesFactory & 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::RegionAttributesFactory::setLruEntriesLimit
RegionAttributesFactory & setLruEntriesLimit(const uint32_t entriesLimit)
Sets a limit on the number of entries that will be held in the cache.
apache::geode::client::RegionAttributesFactory::setCacheListener
RegionAttributesFactory & 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::RegionAttributesFactory::setPartitionResolver
RegionAttributesFactory & 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.
apache::geode::client::RegionAttributesFactory::setCacheListener
RegionAttributesFactory & setCacheListener(const std::shared_ptr< CacheListener > &aListener)
Sets the CacheListener for the next RegionAttributes created.
apache::geode::client::RegionAttributesFactory::setPoolName
RegionAttributesFactory & setPoolName(const std::string &name)
Sets the pool name attribute.
apache::geode::client::RegionAttributesFactory::~RegionAttributesFactory
virtual ~RegionAttributesFactory()
destructor
apache::geode::client::RegionAttributesFactory::setEntryIdleTimeout
RegionAttributesFactory & setEntryIdleTimeout(ExpirationAction action, std::chrono::seconds idleTimeout)
Sets the idleTimeout expiration attributes for region entries for the next RegionAttributes created.
apache::geode::client::RegionAttributesFactory::create
RegionAttributes create()
Creates a RegionAttributes with the current settings.
apache::geode::client::RegionAttributesFactory::setCachingEnabled
RegionAttributesFactory & setCachingEnabled(bool cachingEnabled)
Set caching enabled flag for this region.
ExpirationAction.hpp
apache::geode::client::RegionAttributesFactory::setLoadFactor
RegionAttributesFactory & setLoadFactor(float loadFactor)
Sets the entry load factor for the next RegionAttributes created.
apache::geode::client::RegionAttributesFactory::setDiskPolicy
RegionAttributesFactory & setDiskPolicy(const DiskPolicyType diskPolicy)
Sets the Disk policy type for the next RegionAttributes created.
apache::geode::client::RegionAttributesFactory::setPartitionResolver
RegionAttributesFactory & setPartitionResolver(const std::shared_ptr< PartitionResolver > &aResolver)
Sets the PartitionResolver for the next RegionAttributes created.
CacheLoader.hpp
apache::geode::client::RegionAttributesFactory::setRegionIdleTimeout
RegionAttributesFactory & setRegionIdleTimeout(ExpirationAction action, std::chrono::seconds idleTimeout)
Sets the idleTimeout expiration attributes for the region itself for the next RegionAttributes create...
apache::geode::client::RegionAttributesFactory::setCacheWriter
RegionAttributesFactory & 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.
apache::geode::client::RegionAttributesFactory::setCacheLoader
RegionAttributesFactory & setCacheLoader(const std::shared_ptr< CacheLoader > &cacheLoader)
Sets the cache loader for the next RegionAttributes created.
RegionAttributes.hpp
DiskPolicyType.hpp
apache::geode::client::RegionAttributes
Defines attributes for configuring a region.
Definition: RegionAttributes.hpp:77
apache::geode::client::RegionAttributesFactory::setConcurrencyChecksEnabled
RegionAttributesFactory & setConcurrencyChecksEnabled(bool concurrencyChecksEnabled)
Enables or disables concurrent modification checks.
apache::geode::client::RegionAttributesFactory::setConcurrencyLevel
RegionAttributesFactory & setConcurrencyLevel(uint8_t concurrencyLevel)
Sets the concurrency level tof the next RegionAttributes created.
DiskPolicyType
Enumerated type for disk policy.
apache::geode::client::RegionAttributesFactory::RegionAttributesFactory
RegionAttributesFactory()
public methods
Pool.hpp
apache::geode::client::RegionAttributesFactory
Creates instances of RegionAttributes.
Definition: RegionAttributesFactory.hpp:156
CacheListener.hpp
apache::geode::client::RegionAttributesFactory::setRegionTimeToLive
RegionAttributesFactory & setRegionTimeToLive(ExpirationAction action, std::chrono::seconds timeToLive)
Sets the timeToLive expiration attributes for the region itself for the next RegionAttributes created...
apache::geode::client::RegionAttributesFactory::setCacheWriter
RegionAttributesFactory & setCacheWriter(const std::shared_ptr< CacheWriter > &cacheWriter)
Sets the cache writer for the next RegionAttributes created.
apache::geode::client::RegionAttributesFactory::setCacheLoader
RegionAttributesFactory & 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::RegionAttributesFactory::setInitialCapacity
RegionAttributesFactory & setInitialCapacity(int32_t initialCapacity)
Sets the entry initial capacity for the next RegionAttributes created.
apache::geode::client::RegionAttributesFactory::setCloningEnabled
RegionAttributesFactory & setCloningEnabled(bool isClonable)
Sets cloning on region.

Apache Geode C++ Cache API Documentation