Derecho  0.9
Distributed systems toolkit for RDMA
Public Member Functions | List of all members
persistent::Volatile< ObjectType > Class Template Reference

#include <Persistent.hpp>

Inheritance diagram for persistent::Volatile< ObjectType >:
Inheritance graph
[legend]
Collaboration diagram for persistent::Volatile< ObjectType >:
Collaboration graph
[legend]

Public Member Functions

 Volatile (const std::function< std::unique_ptr< ObjectType >(void)> &object_factory, const char *object_name=nullptr, PersistentRegistry *persistent_registry=nullptr, mutils::DeserializationManager dm={{}}) noexcept(false)
 constructor 1 is for building a persistent<T> locally, load/create a log and register itself to a persistent registry. More...
 
 Volatile (Volatile &&other) noexcept(false)
 constructor 2 is move constructor. More...
 
 Volatile (const std::function< std::unique_ptr< ObjectType >(void)> &object_factory, const char *object_name, std::unique_ptr< ObjectType > &wrapped_obj_ptr, std::unique_ptr< PersistLog > &log_ptr, PersistentRegistry *persistent_registry=nullptr, mutils::DeserializationManager dm={{}}) noexcept(false)
 constructor 3 is for deserialization. More...
 
 Volatile (const Volatile &)=delete
 constructor 4, the default copy constructor, is disabled More...
 
virtual ~Volatile () noexcept(true)
 
- Public Member Functions inherited from persistent::Persistent< ObjectType, ST_MEM >
 Persistent (const std::function< std::unique_ptr< ObjectType >(void)> &object_factory, const char *object_name=nullptr, PersistentRegistry *persistent_registry=nullptr, mutils::DeserializationManager dm={{}}) noexcept(false)
 constructor 1 is for building a persistent<T> locally, load/create a log and register itself to a persistent registry. More...
 
 Persistent (Persistent &&other) noexcept(false)
 constructor 2 is move constructor. More...
 
 Persistent (const char *object_name, std::unique_ptr< ObjectType > &wrapped_obj_ptr, const char *log_tail=nullptr, PersistentRegistry *persistent_registry=nullptr, mutils::DeserializationManager dm={{}}) noexcept(false)
 constructor 3 is for deserialization. More...
 
 Persistent (const Persistent &)=delete
 constructor 4, the default copy constructor, is disabled More...
 
virtual ~Persistent () noexcept(true)
 destructor: release the resources More...
 
ObjectType & operator* ()
 
ObjectType * operator-> ()
 overload the '->' operator to access the wrapped object More...
 
const ObjectType & getConstRef () const
 get a const reference to the wrapped object More...
 
const std::string & getObjectName ()
 get object name More...
 
auto get (const Func &fun, mutils::DeserializationManager *dm=nullptr) noexcept(false)
 get the latest Value of T. More...
 
std::unique_ptr< ObjectType > get (mutils::DeserializationManager *dm=nullptr)
 get the latest Value of T, returns a unique pointer to the object More...
 
auto get (const int64_t &ver, const Func &fun, mutils::DeserializationManager *dm=nullptr) noexcept(false)
 get a version of Value T, specified by version. More...
 
std::unique_ptr< ObjectType > get (const int64_t &ver, mutils::DeserializationManager *dm=nullptr) noexcept(false)
 get a version of value T. More...
 
auto get (const HLC &hlc, const Func &fun, mutils::DeserializationManager *dm=nullptr) noexcept(false)
 get a version of Value T, specified by HLC clock. More...
 
std::unique_ptr< ObjectType > get (const HLC &hlc, mutils::DeserializationManager *dm=nullptr) noexcept(false)
 get a version of value T. More...
 
auto getByIndex (int64_t idx, const Func &fun, mutils::DeserializationManager *dm=nullptr) noexcept(false)
 get a version of Value T. More...
 
std::unique_ptr< ObjectType > getByIndex (int64_t idx, mutils::DeserializationManager *dm=nullptr) noexcept(false)
 get a version of value T. More...
 
void trim (const TKey &k) noexcept(false)
 trim by version or index More...
 
void truncate (const int64_t &ver)
 truncate the log More...
 
std::unique_ptr< ObjectType > operator[] (const int64_t ver) noexcept(false)
 syntax sugar: get a specified version of T without DSM More...
 
std::unique_ptr< ObjectType > operator[] (const HLC &hlc) noexcept(false)
 syntax sugar: get a specified version of T without DSM More...
 
virtual int64_t getNumOfVersions () noexcept(false)
 get the number of versions excluding trimmed ones. More...
 
virtual int64_t getEarliestIndex () noexcept(false)
 get the earliest index excluding trimmed ones. More...
 
virtual int64_t getEarliestVersion () noexcept(false)
 get the earliest version excluding trimmed ones. More...
 
virtual int64_t getLatestIndex () noexcept(false)
 get the latest index excluding truncated ones. More...
 
virtual int64_t getLatestVersion () noexcept(false)
 get the lastest version excluding truncated ones. More...
 
virtual const int64_t getLastPersisted () noexcept(false)
 get the last persisted index. More...
 
virtual void set (ObjectType &v, const version_t &ver, const HLC &mhlc) noexcept(false)
 make a version with a version number and mhlc clock More...
 
virtual void set (ObjectType &v, const version_t &ver) noexcept(false)
 make a version with only a version number More...
 
virtual void version (const version_t &ver) noexcept(false)
 make a version with only a version number, using the current state. More...
 
virtual const int64_t persist () noexcept(false)
 persist till version More...
 
std::size_t to_bytes (char *ret) const
 Write this class's marshalled representation into the array found at v. More...
 
std::size_t bytes_size () const
 the size of the marshalled representation of this object. More...
 
void post_object (const std::function< void(char const *const, std::size_t)> &f) const
 Pass a pointer to a buffer containing this class's marshalled representation into the function f. More...
 
virtual void ensure_registered (mutils::DeserializationManager &)
 
void applyLogTail (mutils::DeserializationManager *dsm, char const *v)
 
virtual void print_performance_stat ()
 
- Public Member Functions inherited from mutils::ByteRepresentable
virtual ~ByteRepresentable ()
 

Additional Inherited Members

- Static Public Member Functions inherited from persistent::Persistent< ObjectType, ST_MEM >
static std::unique_ptr< Persistentfrom_bytes (mutils::DeserializationManager *dsm, char const *v)
 
- Public Attributes inherited from persistent::Persistent< ObjectType, ST_MEM >
std::unique_ptr< ObjectType > m_pWrappedObject
 
uint64_t ns_in_persist
 
uint64_t ns_in_set
 
uint64_t cnt_in_persist
 
uint64_t cnt_in_set
 
- Protected Member Functions inherited from persistent::Persistent< ObjectType, ST_MEM >
void initialize_log (const char *object_name) noexcept(false)
 initialize from local state. More...
 
void initialize_object_from_log (const std::function< std::unique_ptr< ObjectType >(void)> &object_factory, mutils::DeserializationManager *dm)
 initialize the object from log More...
 
void register_callbacks () noexcept(false)
 register the callbacks. More...
 
void unregister_callbacks () noexcept(false)
 unregister the callbacks. More...
 
- Static Protected Member Functions inherited from persistent::Persistent< ObjectType, ST_MEM >
static _NameMaker< ObjectType, storageType > & getNameMaker (const std::string &prefix=std::string(""))
 
- Protected Attributes inherited from persistent::Persistent< ObjectType, ST_MEM >
std::unique_ptr< PersistLogm_pLog
 
PersistentRegistrym_pRegistry
 

Detailed Description

template<typename ObjectType>
class persistent::Volatile< ObjectType >

Definition at line 601 of file Persistent.hpp.

Constructor & Destructor Documentation

◆ Volatile() [1/4]

template<typename ObjectType >
persistent::Volatile< ObjectType >::Volatile ( const std::function< std::unique_ptr< ObjectType >(void)> &  object_factory,
const char *  object_name = nullptr,
PersistentRegistry persistent_registry = nullptr,
mutils::DeserializationManager  dm = {{}} 
)
inlinenoexcept

constructor 1 is for building a persistent<T> locally, load/create a log and register itself to a persistent registry.

Parameters
object_factoryfactory for ObjectType
object_nameThis name is used for persistent data in file.
persistent_registryA normal pointer to the registry.
dmDeserializationManager for deserializing logged object.

Definition at line 610 of file Persistent.hpp.

◆ Volatile() [2/4]

template<typename ObjectType >
persistent::Volatile< ObjectType >::Volatile ( Volatile< ObjectType > &&  other)
inlinenoexcept

constructor 2 is move constructor.

It "steals" the resource from another object.

Parameters
otherThe other object.

Definition at line 621 of file Persistent.hpp.

◆ Volatile() [3/4]

template<typename ObjectType >
persistent::Volatile< ObjectType >::Volatile ( const std::function< std::unique_ptr< ObjectType >(void)> &  object_factory,
const char *  object_name,
std::unique_ptr< ObjectType > &  wrapped_obj_ptr,
std::unique_ptr< PersistLog > &  log_ptr,
PersistentRegistry persistent_registry = nullptr,
mutils::DeserializationManager  dm = {{}} 
)
inlinenoexcept

constructor 3 is for deserialization.

It builds a Persistent<T> from the object name, a unique_ptr to the wrapped object, a unique_ptr to the log.

Parameters
object_factoryfactory for ObjectType
object_nameThe name is used for persistent data in file.
wrapped_obj_ptrA unique pointer to the wrapped object.
log_ptrA unique pointer to the log.
persistent_registryA normal pointer to the registry.
dmDeserializationManager for deserializing logged object.

Definition at line 634 of file Persistent.hpp.

◆ Volatile() [4/4]

template<typename ObjectType >
persistent::Volatile< ObjectType >::Volatile ( const Volatile< ObjectType > &  )
delete

constructor 4, the default copy constructor, is disabled

◆ ~Volatile()

template<typename ObjectType >
virtual persistent::Volatile< ObjectType >::~Volatile ( )
inlinevirtualnoexcept

Definition at line 648 of file Persistent.hpp.


The documentation for this class was generated from the following file: