VOS::Persistance Class Reference
[libvos]
#include <vos/vos/persistance.hh>
Inheritance diagram for VOS::Persistance:

Detailed Description
An abstract interface for saving and loading blocks of data keyed by Vobject and a key string.Generally added as a site extension, if you need to persist some data in your code do something like:
if(Persistance* persist = site->queryExtension<Persistance>()) { // To save some data persist->saveBlock(myVobject, "my:key", myData); // To get it back persist->getBlock(myVobject, "my:key", myData); }
Definition at line 26 of file persistance.hh.
Public Member Functions
- virtual ~Persistance ()
- virtual void beginTransaction ()
- Indicate that you want the blocks saved between this call and endTransaction() to be be atomically committed or not at all.
- Indicate that you want the blocks saved between this call and endTransaction() to be be atomically committed or not at all.
- virtual void endTransaction ()
- Commit any blocks saved since the last call to beginTransaction().
- Commit any blocks saved since the last call to beginTransaction().
- virtual bool saveBlock (Vobject *from, const std::string &key, const std::string &data)
- virtual bool getBlock (Vobject *from, const std::string &key, std::string &data)=0
- virtual bool blockExists (Vobject *from, const std::string &key)=0
- virtual bool removeBlock (Vobject *from, const std::string &key)=0
- virtual bool isLoadingDB ()=0
Protected Member Functions
- virtual bool pre_saveBlockNotifies (Vobject *from, const std::string &key, const std::string &data)
- virtual void post_saveBlockNotifies (Vobject *from, const std::string &key, const std::string &data)
- virtual bool storeBlock (Vobject *from, const std::string &key, const std::string &data)=0
Constructor & Destructor Documentation
| virtual VOS::Persistance::~Persistance | ( | ) | [inline, virtual] |
Definition at line 33 of file persistance.hh.
Member Function Documentation
| virtual void VOS::Persistance::beginTransaction | ( | ) | [inline, virtual] |
Indicate that you want the blocks saved between this call and endTransaction() to be be atomically committed or not at all.
Not actually implemented with all persistance extensions!
Reimplemented in VOS::FileSystemPersistance, and VOS::SQLPersistance.
Definition at line 39 of file persistance.hh.
| virtual bool VOS::Persistance::blockExists | ( | Vobject * | from, | |
| const std::string & | key | |||
| ) | [pure virtual] |
Test for the existance of a block.
- Parameters:
-
from the Vobject associated with this data key a key used to retrieve this data
- Returns:
- true if key was found, false if not
Implemented in VOS::FileSystemPersistance, and VOS::SQLPersistance.
| virtual void VOS::Persistance::endTransaction | ( | ) | [inline, virtual] |
Commit any blocks saved since the last call to beginTransaction().
Not actually implementsed with all persistance extensions!
Reimplemented in VOS::FileSystemPersistance, and VOS::SQLPersistance.
Definition at line 44 of file persistance.hh.
| virtual bool VOS::Persistance::getBlock | ( | Vobject * | from, | |
| const std::string & | key, | |||
| std::string & | data | |||
| ) | [pure virtual] |
Retrieve a block to the persistance layer.
- Parameters:
-
from the Vobject associated with this data key a key used to retrieve this data data the data will be stored in this string
- Returns:
- true if key was found and data retrieved, false if not
Implemented in VOS::FileSystemPersistance, VOS::RevisionControlPersistance, and VOS::SQLPersistance.
| virtual bool VOS::Persistance::isLoadingDB | ( | ) | [pure virtual] |
- Returns:
- True if the persistance database is currently being loaded; generally during application startup. Code which saves blocks to the database in response to changes should check this flag to ensure that it does not try and save a blocks that was just read in from the database!
Implemented in VOS::FileSystemPersistance, and VOS::SQLPersistance.
| virtual void VOS::Persistance::post_saveBlockNotifies | ( | Vobject * | from, | |
| const std::string & | key, | |||
| const std::string & | data | |||
| ) | [protected, virtual] |
| virtual bool VOS::Persistance::pre_saveBlockNotifies | ( | Vobject * | from, | |
| const std::string & | key, | |||
| const std::string & | data | |||
| ) | [protected, virtual] |
| virtual bool VOS::Persistance::removeBlock | ( | Vobject * | from, | |
| const std::string & | key | |||
| ) | [pure virtual] |
Delete a block from the persistance layer.
- Parameters:
-
from the Vobject associated with this data key a key used to retrieve this data
- Returns:
- true if key was found and deleted, false if not
Implemented in VOS::FileSystemPersistance, and VOS::SQLPersistance.
| virtual bool VOS::Persistance::saveBlock | ( | Vobject * | from, | |
| const std::string & | key, | |||
| const std::string & | data | |||
| ) | [virtual] |
Save a block to the persistance layer.
- Parameters:
-
from the Vobject associated with this data key a key used to retrieve this data data the data to be saved
- Returns:
- true if the save was successful, false if something went wrong
| virtual bool VOS::Persistance::storeBlock | ( | Vobject * | from, | |
| const std::string & | key, | |||
| const std::string & | data | |||
| ) | [protected, pure virtual] |
Implemented in VOS::FileSystemPersistance, VOS::RevisionControlPersistance, and VOS::SQLPersistance.
The documentation for this class was generated from the following file:
- /home/tetron/hack/vos/libs/vos/vos/persistance.hh