Sirikata
Public Types | Public Member Functions
Sirikata::OH::PersistedObjectSet Class Reference

PersistedObjectSet tracks the set of objects which want to be restored if the object host fails and is restored. More...

#include <PersistedObjectSet.hpp>

Inheritance diagram for Sirikata::OH::PersistedObjectSet:
Collaboration diagram for Sirikata::OH::PersistedObjectSet:

List of all members.

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 &timestamp="current")=0
 Request that an object be marked for persistence / restoration.

Detailed Description

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.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

virtual Sirikata::OH::PersistedObjectSet::~PersistedObjectSet ( ) [inline, virtual]

Member Function Documentation

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).

Parameters:
internal_idthe 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_typethe type of script the object is running, e.g. 'js' or 'python'
script_argsarguments to the script to ensure it is in the same state as it was originally loaded in
script_contentsthe actual script text to be executed, usually bootstrapping code which then loads data from storage
cbcallback 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]
virtual void Sirikata::OH::PersistedObjectSet::stop ( ) [inline, virtual]

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