VMware Tanzu GemFire Native C++ Reference 10.3.0
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
42namespace apache {
43namespace geode {
44namespace client {
45
156class 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
342
352
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_
DiskPolicyType
DiskPolicyType.hpp Enumerated type for disk policy.
Definition: DiskPolicyType.hpp:42
ExpirationAction
ExpirationAction.hpp Enumerated type for expiration actions.
Definition: ExpirationAction.hpp:42
Defines attributes for configuring a region.
Definition: RegionAttributes.hpp:77
Creates instances of RegionAttributes.
Definition: RegionAttributesFactory.hpp:156
RegionAttributes create()
Creates a RegionAttributes with the current settings.
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.
RegionAttributesFactory & setEntryTimeToLive(ExpirationAction action, std::chrono::seconds timeToLive)
Sets the timeToLive expiration attributes for region entries for the next RegionAttributes created.
RegionAttributesFactory & setDiskPolicy(const DiskPolicyType diskPolicy)
Sets the Disk policy type for the next RegionAttributes created.
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.
RegionAttributesFactory & setLoadFactor(float loadFactor)
Sets the entry load factor for the next RegionAttributes created.
RegionAttributesFactory & setCacheWriter(const std::shared_ptr< CacheWriter > &cacheWriter)
Sets the cache writer for the next RegionAttributes created.
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.
RegionAttributesFactory(const RegionAttributes regionAttributes)
Creates a new instance of RegionAttributesFactory ready to create a RegionAttributes with the same se...
RegionAttributesFactory & setInitialCapacity(int32_t initialCapacity)
Sets the entry initial capacity for the next RegionAttributes created.
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.
RegionAttributesFactory & setConcurrencyLevel(uint8_t concurrencyLevel)
Sets the concurrency level tof the next RegionAttributes created.
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.
RegionAttributesFactory & setCloningEnabled(bool isClonable)
Sets cloning on region.
RegionAttributesFactory & setPartitionResolver(const std::shared_ptr< PartitionResolver > &aResolver)
Sets the PartitionResolver for the next RegionAttributes created.
RegionAttributesFactory & setConcurrencyChecksEnabled(bool concurrencyChecksEnabled)
Enables or disables concurrent modification checks.
RegionAttributesFactory & setCacheLoader(const std::shared_ptr< CacheLoader > &cacheLoader)
Sets the cache loader for the next RegionAttributes created.
RegionAttributesFactory & setCacheListener(const std::shared_ptr< CacheListener > &aListener)
Sets the CacheListener for the next RegionAttributes created.
RegionAttributesFactory & setLruEntriesLimit(const uint32_t entriesLimit)
Sets a limit on the number of entries that will be held in the cache.
RegionAttributesFactory & setRegionIdleTimeout(ExpirationAction action, std::chrono::seconds idleTimeout)
Sets the idleTimeout expiration attributes for the region itself for the next RegionAttributes create...
RegionAttributesFactory & setPoolName(const std::string &name)
Sets the pool name attribute.
RegionAttributesFactory & setPersistenceManager(const std::shared_ptr< PersistenceManager > &persistenceManager, const std::shared_ptr< Properties > &config=nullptr)
Sets the PersistenceManager for the next RegionAttributes created.
RegionAttributesFactory & setCachingEnabled(bool cachingEnabled)
Set caching enabled flag for this region.
RegionAttributesFactory & setRegionTimeToLive(ExpirationAction action, std::chrono::seconds timeToLive)
Sets the timeToLive expiration attributes for the region itself for the next RegionAttributes created...
RegionAttributesFactory & setEntryIdleTimeout(ExpirationAction action, std::chrono::seconds idleTimeout)
Sets the idleTimeout expiration attributes for region entries for the next RegionAttributes created.

Apache Geode C++ Cache API Documentation