'key_value_persistence', * * //registered actions * InstantActionQueue::OPTION_ACTIONS => [ * SomeAction::class => [ * //limit of active actions. 0 means that queue is disabled for this action * InstantActionQueue::ACTION_PARAM_LIMIT => 10, * //time to live * InstantActionQueue::ACTION_PARAM_TTL => 30, * ] * ] * ]); * ``` * * @author Aleh Hutnikau, * @package oat\tao\model\actionQueue */ interface ActionQueue { const SERVICE_ID = 'tao/ActionQueue'; /** * List of registered actions to be performed using action queue */ const OPTION_ACTIONS = 'actions'; /** * Persistence identifier */ const OPTION_PERSISTENCE = 'persistence'; /** * Limit of actions in progress. * If number of active actions will be more that this value then action will be put into queue */ const ACTION_PARAM_LIMIT = 'limit'; /** * Time to live for place in the queue (seconds). Configures per actions. */ const ACTION_PARAM_TTL = 'ttl'; /** * @param QueuedAction $action * @param User $user user which tries to perform action * @return boolean */ public function perform(QueuedAction $action, User $user = null); /** * @param QueuedAction $action * @param User $user * @return integer */ public function getPosition(QueuedAction $action, User $user = null); /** * @param QueuedAction $action * @return integer Number of removed positions */ public function clearAbandonedPositions(QueuedAction $action); /** * @param QueuedAction $action * @return bool */ public function isActionEnabled(QueuedAction $action): bool; }