Pivotal GemFire Native Client Cache Reference  9.0.6
RegionAttributes.hpp
Go to the documentation of this file.
1 #ifndef __GEMFIRE_REGIONATTRIBUTES_H__
2 #define __GEMFIRE_REGIONATTRIBUTES_H__
3 /*=========================================================================
4  * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
5  * This product is protected by U.S. and international copyright
6  * and intellectual property laws. Pivotal products are covered by
7  * more patents listed at http://www.pivotal.io/patents.
8  *========================================================================
9  */
10 
15 #include "gfcpp_globals.hpp"
16 #include "gf_types.hpp"
17 #include "CacheLoader.hpp"
18 #include "ScopeType.hpp"
19 #include "ExpirationAttributes.hpp"
20 #include "CacheWriter.hpp"
21 #include "CacheListener.hpp"
22 #include "PartitionResolver.hpp"
23 #include "Properties.hpp"
24 #include "Serializable.hpp"
25 #include "DiskPolicyType.hpp"
26 #include "PersistenceManager.hpp"
27 
28 
29 namespace gemfire {
30 class CacheImpl;
31 
52 class AttributesFactory;
53 class AttributesMutator;
54 class Cache;
55 class Region;
56 
57 
58 
60 
64  public:
65 
71  CacheLoaderPtr getCacheLoader() ;
72 
78  CacheWriterPtr getCacheWriter() ;
79 
85  CacheListenerPtr getCacheListener() ;
86 
92  PartitionResolverPtr getPartitionResolver() ;
93 
97  int getRegionTimeToLive() ;
98  ExpirationAction::Action getRegionTimeToLiveAction() ;
99 
104  int getRegionIdleTimeout() ;
105  ExpirationAction::Action getRegionIdleTimeoutAction() ;
106 
110  int getEntryTimeToLive() ;
111  ExpirationAction::Action getEntryTimeToLiveAction() ;
112 
116  int getEntryIdleTimeout() ;
117  ExpirationAction::Action getEntryIdleTimeoutAction() ;
118 
119 
120 
125  ScopeType::Scope getScope() const;
126 
131  inline bool getCachingEnabled() const
132  {
133  return m_caching;
134  }
135 
136  // MAP ATTRIBUTES
137 
138 
142  int getInitialCapacity() const;
143 
147  float getLoadFactor() const;
148 
153  uint8_t getConcurrencyLevel() const;
154 
159  uint32_t getLruEntriesLimit( ) const;
160 
165  DiskPolicyType::PolicyType getDiskPolicy() const;
166 
170  const ExpirationAction::Action getLruEvictionAction( ) const;
171 
175  const char* getPoolName() const;
176 
177  /*destructor
178  *
179  */
180  virtual ~RegionAttributes();
181 
183  virtual void toData(DataOutput& out) const;
184 
186  virtual Serializable* fromData( DataInput& in );
187 
189  static Serializable* createDeserializable( );
190 
192  virtual int32_t classId( ) const;
193 
195  virtual int8_t typeId( ) const;
196 
197  //return zero deliberately
198  virtual uint32_t objectSize() const {
199  return 0;
200  }
201 
206  const char* getCacheLoaderLibrary();
207 
212  const char* getCacheLoaderFactory();
213 
218  const char* getCacheListenerLibrary();
219 
224  const char* getCacheListenerFactory();
225 
230  const char* getCacheWriterLibrary();
231 
236  const char* getCacheWriterFactory();
237 
242  const char* getPartitionResolverLibrary();
243 
248  const char* getPartitionResolverFactory();
249 
251  bool operator == ( const RegionAttributes& other ) const;
252 
254  bool operator != ( const RegionAttributes& other ) const;
255 
260  void validateSerializableAttributes( );
261 
265  const char* getEndpoints();
266 
270  bool getClientNotificationEnabled() const;
271 
276  const char* getPersistenceLibrary();
277 
282  const char* getPersistenceFactory();
283 
287  PropertiesPtr getPersistenceProperties();
288 
294  PersistenceManagerPtr getPersistenceManager() ;
295 
301  const char* getPoolName() { return m_poolName; }
302  bool getCloningEnabled( ) { return m_isClonable; }
303 
309  bool getConcurrencyChecksEnabled() { return m_isConcurrencyChecksEnabled; }
310  private:
311  //Helper function that safely compares two attribute string
312  //taking into consideration the fact the one or the other
313  //might be NULL
314  static int32_t compareStringAttribute(char* attributeA, char* attributeB);
315 
316  //Helper function that safely copies one string attribute to
317  //another.
318  static void copyStringAttribute(char*& lhs, const char* rhs);
319 
320  void setCacheListener(const char* libpath, const char* factoryFuncName);
321  void setCacheLoader (const char* libpath, const char* factoryFuncName);
322  void setCacheWriter (const char* libpath, const char* factoryFuncName);
323  void setPartitionResolver(const char* libpath, const char* factoryFuncName);
324  void setPersistenceManager(const char* lib, const char* func, const PropertiesPtr& config);
325  void setEndpoints( const char* endpoints );
326  void setPoolName( const char* poolName );
327  void setCloningEnabled( bool isClonable );
328  void setCachingEnabled( bool enable);
329  void setLruEntriesLimit(int limit);
330  void setDiskPolicy(DiskPolicyType::PolicyType diskPolicy);
331  void setScope(ScopeType::Scope scope);
332  void setConcurrencyChecksEnabled( bool enable );
333  inline bool getEntryExpiryEnabled() const
334  {
335  return (m_entryTimeToLive != 0 || m_entryIdleTimeout != 0);
336  }
337 
338  inline bool getRegionExpiryEnabled() const
339  {
340  return (m_regionTimeToLive != 0 || m_regionIdleTimeout != 0);
341  }
342 
343 
344  //will be created by the factory
347 
348  ExpirationAction::Action m_regionTimeToLiveExpirationAction;
349  ExpirationAction::Action m_regionIdleTimeoutExpirationAction;
350  ExpirationAction::Action m_entryTimeToLiveExpirationAction;
351  ExpirationAction::Action m_entryIdleTimeoutExpirationAction;
352  ExpirationAction::Action m_lruEvictionAction;
353  CacheWriterPtr m_cacheWriter;
354  CacheLoaderPtr m_cacheLoader;
355  CacheListenerPtr m_cacheListener;
356  PartitionResolverPtr m_partitionResolver;
357  uint32_t m_lruEntriesLimit;
358  bool m_caching;
359  uint32_t m_maxValueDistLimit;
360  uint32_t m_entryIdleTimeout;
361  uint32_t m_entryTimeToLive;
362  uint32_t m_regionIdleTimeout;
363  uint32_t m_regionTimeToLive;
364  ScopeType::Scope m_scope;
365  uint32_t m_initialCapacity;
366  float m_loadFactor;
367  uint8_t m_concurrencyLevel;
368  char* m_cacheLoaderLibrary;
369  char* m_cacheWriterLibrary;
370  char* m_cacheListenerLibrary;
371  char* m_partitionResolverLibrary;
372  char* m_cacheLoaderFactory;
373  char* m_cacheWriterFactory;
374  char* m_cacheListenerFactory;
375  char* m_partitionResolverFactory;
376  DiskPolicyType::PolicyType m_diskPolicy;
377  char* m_endpoints;
378  bool m_clientNotificationEnabled;
379  char* m_persistenceLibrary;
380  char* m_persistenceFactory;
381  PropertiesPtr m_persistenceProperties;
382  PersistenceManagerPtr m_persistenceManager;
383  char *m_poolName;
384  bool m_isClonable;
385  bool m_isConcurrencyChecksEnabled;
386  friend class AttributesFactory;
387  friend class AttributesMutator;
388  friend class Cache;
389  friend class CacheImpl;
390  friend class Region;
391  friend class RegionInternal;
392  friend class RegionXmlCreation;
393 
394  private:
395  const RegionAttributes& operator=( const RegionAttributes& );
396 
397 };
398 
399 } //namespace gemfire
400 
401 #endif //ifndef __GEMFIRE_REGIONATTRIBUTES_H__
Provide operations for writing primitive data values, byte arrays, strings, Serializable objects to a...
Definition: DataOutput.hpp:62
Action
Definition: ExpirationAction.hpp:29
bool getCachingEnabled() const
If true, this region will store data in the current process.
Definition: RegionAttributes.hpp:131
This class manages subregions and cached data.
Definition: Region.hpp:75
virtual uint32_t objectSize() const
return the size in bytes of the instance being serialized.
Definition: RegionAttributes.hpp:198
Creates instances of RegionAttributes.
Definition: AttributesFactory.hpp:139
This namespace contains all the GemFire C++ API classes, enumerations and globals.
Definition: Assert.hpp:19
Defines attributes for configuring a region.
Definition: RegionAttributes.hpp:59
This abstract base class is the superclass of all user objects in the cache that can be serialized...
Definition: Serializable.hpp:39
Supports modification of certain region attributes after the region has been created.
Definition: AttributesMutator.hpp:39
Provide operations for reading primitive data values, byte arrays, strings, Serializable objects from...
Definition: DataInput.hpp:44
#define CPPCACHE_EXPORT
Defines a GemFire CPPCACHE export.
Definition: gf_base.hpp:51
PolicyType
Values for setting PolicyType.
Definition: DiskPolicyType.hpp:29
Cache are obtained from create method on the CacheFactory#create class.
Definition: Cache.hpp:44
bool getConcurrencyChecksEnabled()
Returns true if concurrent update checks are turned on for this region.
Definition: RegionAttributes.hpp:309
Scope
Values for setting Scope.
Definition: ScopeType.hpp:35
const char * getPoolName()
TODO Returns the name of the Pool that this region will use to communicate with servers, if any.
Definition: RegionAttributes.hpp:301

GemFire C++ Cache API Documentation