Apache Geode Native C++ Reference  1.14.0
apache::geode::client::PersistenceManager Class Referenceabstract

PersistenceManager API for persistence and overflow. More...

Public Member Functions

virtual void close ()=0
 Closes the persistence manager instance. More...
 
virtual void destroy (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< void > &PersistenceInfo)=0
 destroys the entry specified by the key in the argument. More...
 
virtual void init (const std::shared_ptr< Region > &region, const std::shared_ptr< Properties > &diskProperties)=0
 This method gets called after an implementation object is created. More...
 
virtual std::shared_ptr< Cacheableread (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< void > &PersistenceInfo)=0
 Reads the value for the key from the disk. More...
 
virtual bool readAll ()=0
 Reads all the values from the region. More...
 
virtual void write (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Cacheable > &value, std::shared_ptr< void > &persistenceInfo)=0
 Writes a key, value pair of region to the disk. More...
 
virtual bool writeAll ()=0
 Writes all the entries for a region. More...
 

Static Public Member Functions

static std::shared_ptr< PersistenceManagergetPersistenceManager ()
 Returns the current persistence manager. More...
 

Protected Attributes

std::shared_ptr< Regionm_regionPtr
 Region for this persistence manager. More...
 

Detailed Description

PersistenceManager API for persistence and overflow.

This class abstracts the disk-related operations in case of persistence or overflow to disk. A specific disk storage implementation will implement all the methods described here.

Member Function Documentation

◆ close()

virtual void apache::geode::client::PersistenceManager::close ( )
pure virtual

Closes the persistence manager instance.

Exceptions
ShutdownFailedExceptionif close is not successful.

◆ destroy()

virtual void apache::geode::client::PersistenceManager::destroy ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< void > &  PersistenceInfo 
)
pure virtual

destroys the entry specified by the key in the argument.

Parameters
keyis the key of the entry which is being destroyed.
PersistenceInforelated persistence information.
Exceptions
RegionDestroyedExceptionis the region is already destroyed.
EntryNotFoundExceptionif the entry is not found on the disk.

◆ getPersistenceManager()

static std::shared_ptr<PersistenceManager> apache::geode::client::PersistenceManager::getPersistenceManager ( )
static

Returns the current persistence manager.

Returns
persistence manager

◆ init()

virtual void apache::geode::client::PersistenceManager::init ( const std::shared_ptr< Region > &  region,
const std::shared_ptr< Properties > &  diskProperties 
)
pure virtual

This method gets called after an implementation object is created.

Initializes all the implementation specific environments needed.

Exceptions
InitfailedExceptionif the persistence manager cannot be initialized.

◆ read()

virtual std::shared_ptr<Cacheable> apache::geode::client::PersistenceManager::read ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< void > &  PersistenceInfo 
)
pure virtual

Reads the value for the key from the disk.

Parameters
keyis the key for which the value has to be read.
PersistenceInforelated persistence information.
Returns
value of type std::shared_ptr<Cacheable>.
Exceptions
DiskCorruptExceptionif the data to be read is corrupt.

◆ readAll()

virtual bool apache::geode::client::PersistenceManager::readAll ( )
pure virtual

Reads all the values from the region.

Returns
true

◆ write()

virtual void apache::geode::client::PersistenceManager::write ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Cacheable > &  value,
std::shared_ptr< void > &  persistenceInfo 
)
pure virtual

Writes a key, value pair of region to the disk.

The actual file or database related write operations should be implemented in this method by the class implementing this method.

Parameters
keythe key to write.
valuethe value to write
persistenceInforelated persistence information.
Exceptions
RegionDestroyedExceptionis the region is already destroyed.
OutofMemoryExceptionif the disk is full
DiskFailureExceptionif the write fails due to disk fail.

◆ writeAll()

virtual bool apache::geode::client::PersistenceManager::writeAll ( )
pure virtual

Writes all the entries for a region.

Refer persistance requirement doc for the use case.

Exceptions
DiskFailureExceptionif the write fails due to disk fail.

Field Documentation

◆ m_regionPtr

std::shared_ptr<Region> apache::geode::client::PersistenceManager::m_regionPtr
protected

Region for this persistence manager.


Apache Geode C++ Cache API Documentation