Sirikata
|
PersistedObjectSet tracks the set of objects which want to be restored if the object host fails and is restored. More...
#include <PersistedObjectSet.hpp>
Public Types | |
typedef std::tr1::function < void(bool success)> | RequestCallback |
RequestCallbacks are invoked when a request to change a persisted objects properties (or remove it from persistence) completes. | |
Public Member Functions | |
virtual | ~PersistedObjectSet () |
virtual void | start () |
virtual void | stop () |
virtual void | requestPersistedObject (const UUID &internal_id, const String &script_type, const String &script_args, const String &script_contents, RequestCallback cb, const String ×tamp="current")=0 |
Request that an object be marked for persistence / restoration. |
PersistedObjectSet tracks the set of objects which want to be restored if the object host fails and is restored.
It is the counterpart to an ObjectFactory which restores objects from object storage. It has a very simple interface because it assumes the object scripts (manually or via the ObjectScript implementation) tracks almost all data itself: each object can register to be restored and only the unique internal identifier (allowing access to storage), script type, and script (allowing the object to reconstruct itself) are stored.
typedef std::tr1::function<void(bool success)> Sirikata::OH::PersistedObjectSet::RequestCallback |
RequestCallbacks are invoked when a request to change a persisted objects properties (or remove it from persistence) completes.
Reimplemented in Sirikata::OH::CassandraPersistedObjectSet, and Sirikata::OH::SQLitePersistedObjectSet.
virtual Sirikata::OH::PersistedObjectSet::~PersistedObjectSet | ( | ) | [inline, virtual] |
virtual void Sirikata::OH::PersistedObjectSet::requestPersistedObject | ( | const UUID & | internal_id, |
const String & | script_type, | ||
const String & | script_args, | ||
const String & | script_contents, | ||
RequestCallback | cb, | ||
const String & | timestamp = "current" |
||
) | [pure virtual] |
Request that an object be marked for persistence / restoration.
If script_type and script_args are left blank, the restoration of the object will be disabled (e.g. if the object is being destroyed).
internal_id | the internal identifier used by the HostedObject. This should always be read from the HostedObject as it will be used to restore access to the appropriate stored data. |
script_type | the type of script the object is running, e.g. 'js' or 'python' |
script_args | arguments to the script to ensure it is in the same state as it was originally loaded in |
script_contents | the actual script text to be executed, usually bootstrapping code which then loads data from storage |
cb | callback to invoke when the operation completes |
Implemented in Sirikata::OH::CassandraPersistedObjectSet, and Sirikata::OH::SQLitePersistedObjectSet.
Referenced by Sirikata::JS::JSObjectScript::eSetRestoreScript().
virtual void Sirikata::OH::PersistedObjectSet::start | ( | ) | [inline, virtual] |
Implements Sirikata::Service.
Reimplemented in Sirikata::OH::CassandraPersistedObjectSet, and Sirikata::OH::SQLitePersistedObjectSet.
virtual void Sirikata::OH::PersistedObjectSet::stop | ( | ) | [inline, virtual] |
Implements Sirikata::Service.
Reimplemented in Sirikata::OH::CassandraPersistedObjectSet, and Sirikata::OH::SQLitePersistedObjectSet.