Difference between revisions of "API:EPrints/DataObj/EventQueue"
Line 6: | Line 6: | ||
<!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name --> | <!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name --> | ||
==NAME== | ==NAME== | ||
− | '''EPrints::DataObj::EventQueue''' - | + | '''EPrints::DataObj::EventQueue''' - Scheduler/indexer event queue. |
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=head_description --> | ||
+ | ==DESCRIPTION== | ||
+ | Individual tasks for the EPrints event queue that can then be actioned by the EPrints indexer in the background. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=head_instance_variables --> | ||
+ | ==INSTANCE VARIABLES== | ||
+ | See [[API:EPrints/DataObj#INSTANCE_VARIABLES|EPrints::DataObj#INSTANCE_VARIABLES]]. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 174: | Line 196: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=head_constructor_methods --> |
− | === | + | ===Constructor Methods=== |
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_create_unique --> | ||
+ | ====create_unique==== | ||
+ | |||
+ | $event = EPrints::DataObj::EventQueue->create_unique( $session, $data, [ $dataset ] ) | ||
+ | Returns a unique event queue task using the <tt>$data</tt> provided. Setting the <tt>eventqueueid</tt> to a MD5 hash of the <tt>pluginid</tt>, <tt>action</tt> and (if given) <tt>params</tt>. | ||
+ | |||
+ | Returns <tt>undef</tt> if such an event already exists. | ||
− | + | If <tt>$dataset</tt> is not provided generate from dataset ID of the class. | |
− | |||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 187: | Line 222: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_new_from_hash --> |
− | === | + | ====new_from_hash==== |
+ | |||
+ | $event = EPrints::DataObj::EventQueue->new_from_hash( $session, $data, [ $dataset ] ) | ||
+ | Returns the event that corresponds to the MD5 hash of the <tt>$data</tt> provided, (<tt>pluginid</tt>, <tt>action</tt> and <tt>params</tt>). Returns <tt>undef</tt> if no event queue task exists with a matching MD5 hash. | ||
− | + | If <tt>$dataset</tt> is not provided generate from dataset ID of the class. | |
− | |||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 200: | Line 237: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=head_class_methods --> |
− | === | + | ===Class Methods=== |
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
− | |||
− | |||
− | + | <!-- Pod2Wiki= --> | |
+ | </div> | ||
+ | <!-- Pod2Wiki=item_get_system_field_info --> | ||
+ | ====get_system_field_info==== | ||
− | + | $metadata = EPrints::DataObj::EPrint->get_system_field_info | |
+ | Return an array describing the system metadata of the event queue dataset. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 217: | Line 259: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_get_dataset_id --> |
− | === | + | ====get_dataset_id==== |
+ | |||
+ | $dataset = EPrints::DataObj::EPrint->get_dataset_id | ||
+ | Returns the ID of the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record belongs. | ||
− | + | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | |
− | + | <span style='display:none'>User Comments</span> | |
+ | <!-- Edit below this comment --> | ||
− | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=head_object_methods --> | ||
+ | ===Object Methods=== | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
<span style='display:none'>User Comments</span> | <span style='display:none'>User Comments</span> | ||
Line 233: | Line 282: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_execute --> | <!-- Pod2Wiki=item_execute --> | ||
− | ===execute=== | + | ====execute==== |
$ok = $event->execute() | $ok = $event->execute() | ||
Line 255: | Line 304: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_message --> | <!-- Pod2Wiki=item_message --> | ||
− | ===message=== | + | ====message==== |
$event->message( $type, $message ) | $event->message( $type, $message ) |
Revision as of 23:32, 1 January 2022
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
Contents
NAME
EPrints::DataObj::EventQueue - Scheduler/indexer event queue.
DESCRIPTION
Individual tasks for the EPrints event queue that can then be actioned by the EPrints indexer in the background.
INSTANCE VARIABLES
See EPrints::DataObj#INSTANCE_VARIABLES.
CORE METADATA FIELDS
eventqueueid (uuid)
Either a UUID or a hash of the event (if created with create_unique).
cleanup (boolean)
If set to true removes this event once it has finished. Defaults to true.
priority (int)
The priority for this event.
start_time (time)
The event should not be executed before this time.
end_time (time)
The event was last touched at this time.
status (set)
The status of this event. Can be waiting, inprogress, success or failed. Defaults to failed.
description (longtext)
A human-readable description of this event (or error).
pluginid (id)
The EPrints::Plugin::Event plugin id to call to execute this event.
action (id)
The name of the action to execute on the plugin (i.e. method name).
params (storable)
Parameters to pass to the action (a text serialisation).
REFERENCES AND RELATED OBJECTS
userid (itemref)
The user (if any) that was responsible for creating this event.
METHODS
Constructor Methods
create_unique
$event = EPrints::DataObj::EventQueue->create_unique( $session, $data, [ $dataset ] )
Returns a unique event queue task using the $data provided. Setting the eventqueueid to a MD5 hash of the pluginid, action and (if given) params.
Returns undef if such an event already exists.
If $dataset is not provided generate from dataset ID of the class.
new_from_hash
$event = EPrints::DataObj::EventQueue->new_from_hash( $session, $data, [ $dataset ] )
Returns the event that corresponds to the MD5 hash of the $data provided, (pluginid, action and params). Returns undef if no event queue task exists with a matching MD5 hash.
If $dataset is not provided generate from dataset ID of the class.
Class Methods
get_system_field_info
$metadata = EPrints::DataObj::EPrint->get_system_field_info
Return an array describing the system metadata of the event queue dataset.
get_dataset_id
$dataset = EPrints::DataObj::EPrint->get_dataset_id
Returns the ID of the EPrints::DataSet object to which this record belongs.
Object Methods
execute
$ok = $event->execute()
Execute the action this event queue task describes.
The response from the EPrints::Plugin::Event plugin action is treated as follows:
undef - equivalent to HTTP_OK HTTP_OK - action succeeded, event is removed if cleanup is TRUE HTTP_RESET_CONTENT - action succeeded, event is set 'waiting' HTTP_NOT_FOUND - action failed, event is removed if cleanup is TRUE HTTP_LOCKED - action failed, event is re-scheduled for 10 minutes time HTTP_INTERNAL_SERVER_ERROR - action failed, event is 'failed' and kept
message
$event->message( $type, $message )
Utility method to log the $message for this event.
$type is required by this method but not currently used.
COPYRIGHT
© Copyright 2000-2024 University of Southampton.
EPrints 3.4 is supplied by EPrints Services.
http://www.eprints.org/eprints-3.4/
LICENSE
This file is part of EPrints 3.4 http://www.eprints.org/.
EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.
EPrints 3.4 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with EPrints 3.4. If not, see http://www.gnu.org/licenses/.