build-artifacts/win/product/include/gfcpp/RegionAttributes.hpp

Go to the documentation of this file.
00001 #ifndef __GEMFIRE_REGIONATTRIBUTES_H__
00002 #define __GEMFIRE_REGIONATTRIBUTES_H__
00003 /*=========================================================================
00004  * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
00005  * This product is protected by U.S. and international copyright
00006  * and intellectual property laws. Pivotal products are covered by
00007  * more patents listed at http://www.pivotal.io/patents.
00008  *========================================================================
00009  */
00010 
00015 #include "gfcpp_globals.hpp"
00016 #include "gf_types.hpp"
00017 #include "CacheLoader.hpp"
00018 #include "ScopeType.hpp"
00019 #include "ExpirationAttributes.hpp"
00020 #include "CacheWriter.hpp"
00021 #include "CacheListener.hpp"
00022 #include "PartitionResolver.hpp"
00023 #include "Properties.hpp"
00024 #include "Serializable.hpp"
00025 #include "DiskPolicyType.hpp"
00026 #include "PersistenceManager.hpp"
00027 
00028 
00029 namespace gemfire {
00030 class CacheImpl;
00031 
00052 class AttributesFactory;
00053 class AttributesMutator;
00054 class Cache;
00055 class Region;
00056 
00057 
00058 
00059 class CPPCACHE_EXPORT RegionAttributes: public Serializable  {
00060 
00064  public:
00065 
00071   CacheLoaderPtr getCacheLoader() ;
00072 
00078   CacheWriterPtr getCacheWriter() ;
00079 
00085   CacheListenerPtr getCacheListener() ;
00086 
00092   PartitionResolverPtr getPartitionResolver() ;
00093 
00097   int getRegionTimeToLive() ;
00098   ExpirationAction::Action getRegionTimeToLiveAction() ;
00099 
00104   int getRegionIdleTimeout() ;
00105   ExpirationAction::Action getRegionIdleTimeoutAction() ;
00106 
00110   int getEntryTimeToLive() ;
00111   ExpirationAction::Action getEntryTimeToLiveAction() ;
00112 
00116   int getEntryIdleTimeout() ;
00117   ExpirationAction::Action getEntryIdleTimeoutAction() ;
00118 
00119 
00120 
00125   ScopeType::Scope getScope() const;
00126 
00131   inline bool getCachingEnabled() const
00132   {
00133     return m_caching;
00134   }
00135 
00136   // MAP ATTRIBUTES
00137 
00138 
00142   int getInitialCapacity() const;
00143 
00147   float getLoadFactor() const;
00148 
00153   uint8_t getConcurrencyLevel() const;
00154 
00159   uint32_t getLruEntriesLimit( ) const;
00160 
00165   DiskPolicyType::PolicyType getDiskPolicy() const;
00166 
00170   const ExpirationAction::Action getLruEvictionAction( ) const;
00171 
00175   const char* getPoolName() const;
00176 
00177   /*destructor
00178    *
00179    */
00180   virtual ~RegionAttributes();
00181 
00183   virtual void toData(DataOutput& out) const;
00184 
00186   virtual Serializable* fromData( DataInput& in );
00187 
00189   static Serializable* createDeserializable( );
00190 
00192   virtual int32_t classId( ) const;
00193 
00195   virtual int8_t typeId( ) const;
00196 
00197   //return zero deliberately
00198   virtual uint32_t objectSize() const {
00199     return 0;
00200   }
00201 
00206   const char* getCacheLoaderLibrary();
00207 
00212   const char* getCacheLoaderFactory();
00213 
00218   const char* getCacheListenerLibrary();
00219 
00224   const char* getCacheListenerFactory();
00225 
00230   const char* getCacheWriterLibrary();
00231 
00236   const char* getCacheWriterFactory();
00237 
00242   const char* getPartitionResolverLibrary();
00243 
00248   const char* getPartitionResolverFactory();
00249 
00251   bool operator == ( const RegionAttributes& other ) const;
00252 
00254   bool operator != ( const RegionAttributes& other ) const;
00255 
00260   void validateSerializableAttributes( );
00261 
00265   const char* getEndpoints();
00266 
00270   bool getClientNotificationEnabled() const;
00271 
00276   const char* getPersistenceLibrary();
00277 
00282   const char* getPersistenceFactory();
00283 
00287   PropertiesPtr getPersistenceProperties();
00288 
00294   PersistenceManagerPtr getPersistenceManager() ;
00295 
00301   const char* getPoolName() { return m_poolName; }
00302   bool getCloningEnabled( ) { return m_isClonable; }
00303 
00309   bool getConcurrencyChecksEnabled() { return m_isConcurrencyChecksEnabled; }
00310   private:
00311   //Helper function that safely compares two attribute string
00312   //taking into consideration the fact the one or the other
00313   //might be NULL
00314   static int32_t compareStringAttribute(char* attributeA, char* attributeB);
00315 
00316   //Helper function that safely copies one string attribute to
00317   //another.
00318   static void copyStringAttribute(char*& lhs, const char* rhs);
00319 
00320   void setCacheListener(const char* libpath, const char* factoryFuncName);
00321   void setCacheLoader  (const char* libpath, const char* factoryFuncName);
00322   void setCacheWriter  (const char* libpath, const char* factoryFuncName);
00323   void setPartitionResolver(const char* libpath, const char* factoryFuncName);
00324   void setPersistenceManager(const char* lib, const char* func, const PropertiesPtr& config);
00325   void setEndpoints( const char* endpoints );
00326   void setPoolName( const char* poolName );
00327   void setCloningEnabled( bool isClonable );
00328   void setCachingEnabled( bool enable);
00329   void setLruEntriesLimit(int limit);
00330   void setDiskPolicy(DiskPolicyType::PolicyType diskPolicy);
00331   void setScope(ScopeType::Scope scope);
00332   void setConcurrencyChecksEnabled( bool enable );
00333   inline bool getEntryExpiryEnabled() const
00334   {
00335     return (m_entryTimeToLive != 0 || m_entryIdleTimeout != 0);
00336   }
00337 
00338   inline bool getRegionExpiryEnabled() const
00339   {
00340     return (m_regionTimeToLive != 0 || m_regionIdleTimeout != 0);
00341   }
00342   
00343 
00344   //will be created by the factory
00345    RegionAttributes(const RegionAttributes& rhs);
00346    RegionAttributes();
00347 
00348    ExpirationAction::Action m_regionTimeToLiveExpirationAction;
00349    ExpirationAction::Action m_regionIdleTimeoutExpirationAction;
00350    ExpirationAction::Action m_entryTimeToLiveExpirationAction;
00351    ExpirationAction::Action m_entryIdleTimeoutExpirationAction;
00352    ExpirationAction::Action m_lruEvictionAction;
00353    CacheWriterPtr m_cacheWriter;
00354    CacheLoaderPtr m_cacheLoader;
00355    CacheListenerPtr m_cacheListener;
00356    PartitionResolverPtr m_partitionResolver;
00357    uint32_t m_lruEntriesLimit;
00358    bool m_caching;
00359    uint32_t  m_maxValueDistLimit;
00360    uint32_t m_entryIdleTimeout;
00361    uint32_t m_entryTimeToLive;
00362    uint32_t m_regionIdleTimeout;
00363    uint32_t m_regionTimeToLive;
00364    ScopeType::Scope m_scope;
00365    uint32_t m_initialCapacity;
00366    float m_loadFactor;
00367    uint8_t m_concurrencyLevel;
00368    char* m_cacheLoaderLibrary;
00369    char* m_cacheWriterLibrary;
00370    char* m_cacheListenerLibrary;
00371    char* m_partitionResolverLibrary;
00372    char* m_cacheLoaderFactory;
00373    char* m_cacheWriterFactory;
00374    char* m_cacheListenerFactory;
00375    char* m_partitionResolverFactory;
00376    DiskPolicyType::PolicyType m_diskPolicy;
00377    char* m_endpoints;
00378    bool m_clientNotificationEnabled;
00379    char* m_persistenceLibrary;
00380    char* m_persistenceFactory;
00381    PropertiesPtr m_persistenceProperties;
00382    PersistenceManagerPtr m_persistenceManager;
00383    char *m_poolName;
00384    bool m_isClonable;
00385    bool m_isConcurrencyChecksEnabled;
00386   friend class AttributesFactory;
00387   friend class AttributesMutator;
00388   friend class Cache;
00389   friend class CacheImpl;
00390   friend class Region;
00391   friend class RegionInternal;
00392   friend class RegionXmlCreation;
00393 
00394   private:
00395         const RegionAttributes& operator=( const RegionAttributes& );
00396 
00397 };
00398 
00399 } //namespace gemfire
00400 
00401 #endif //ifndef __GEMFIRE_REGIONATTRIBUTES_H__

GemFire C++ Cache API Documentation