Pivotal GemFire Native C++ Reference  10.1.3
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 
185  virtual ~RegionAttributesFactory();
186 
187  // CALLBACKS
188 
194  RegionAttributesFactory& setCacheLoader(
195  const std::shared_ptr<CacheLoader>& cacheLoader);
196 
202  RegionAttributesFactory& setCacheWriter(
203  const std::shared_ptr<CacheWriter>& cacheWriter);
204 
210  RegionAttributesFactory& setCacheListener(
211  const std::shared_ptr<CacheListener>& aListener);
212 
219  RegionAttributesFactory& setPartitionResolver(
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 
252  RegionAttributesFactory& setPartitionResolver(
253  const std::string& libpath, const std::string& factoryFuncName);
254 
255  // EXPIRATION ATTRIBUTES
256 
267  RegionAttributesFactory& setEntryIdleTimeout(
268  ExpirationAction action, std::chrono::seconds idleTimeout);
269 
280  RegionAttributesFactory& setEntryTimeToLive(ExpirationAction action,
281  std::chrono::seconds timeToLive);
282 
293  RegionAttributesFactory& setRegionIdleTimeout(
294  ExpirationAction action, std::chrono::seconds idleTimeout);
295 
306  RegionAttributesFactory& setRegionTimeToLive(ExpirationAction action,
307  std::chrono::seconds timeToLive);
308 
309  // PERSISTENCE
318  RegionAttributesFactory& setPersistenceManager(
319  const std::string& libpath, const std::string& factoryFuncName,
320  const std::shared_ptr<Properties>& config = nullptr);
321 
328  RegionAttributesFactory& setPersistenceManager(
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 
351  RegionAttributesFactory& setLoadFactor(float loadFactor);
352 
360  RegionAttributesFactory& setConcurrencyLevel(uint8_t concurrencyLevel);
361 
369  RegionAttributesFactory& setLruEntriesLimit(const uint32_t entriesLimit);
370 
378  RegionAttributesFactory& setDiskPolicy(const DiskPolicyType diskPolicy);
379 
390  RegionAttributesFactory& setCachingEnabled(bool cachingEnabled);
391 
410  RegionAttributesFactory& setPoolName(const std::string& name);
411 
418  RegionAttributesFactory& setCloningEnabled(bool isClonable);
419 
427  RegionAttributesFactory& setConcurrencyChecksEnabled(
428  bool concurrencyChecksEnabled);
429 
430  // FACTORY METHOD
431 
439  RegionAttributes create();
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_
ExpirationAction
ExpirationAction.hpp
CacheLoader.hpp
RegionAttributes.hpp
DiskPolicyType.hpp
apache::geode::client::RegionAttributes
Definition: RegionAttributes.hpp:76
DiskPolicyType
Pool.hpp
apache::geode::client::RegionAttributesFactory
Creates instances of RegionAttributes.
Definition: RegionAttributesFactory.hpp:156
CacheListener.hpp

Apache Geode C++ Cache API Documentation