1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121:
<?php
namespace qdb;
/**
* A queue of blob in the database.
*
* It's a double-ended queue, you can both enqueue and dequeue from the front and the back.
*
* @example
* You get a `QdbDeque` instance by calling {@link \QdbCluster::deque()}.
* Then you can perform atomic operations on the queue:
* <code>
* $queue = $cluster->deque('my queue');
* $queue->pushBack('value 0');
* $queue->pushBack('value 1');
* </code>
*/
class QdbDeque extends QdbEntry
{
/**
* Gets the element at the end of the queue.
*
* @example
* <code>
* $last = $cluster->deque('alias')->back();
* </code>
*
* @return string The last element of the queue.
* @throws QdbAliasNotFoundException
* @throws QdbIncompatibleTypeException
* @throws QdbContainerEmptyException
*/
function back();
/**
* Gets the element at the beginning of the queue.
*
* @example
* <code>
* $first = $cluster->deque('alias')->front();
* </code>
*
* @return string The first element of the queue.
* @throws QdbAliasNotFoundException
* @throws QdbIncompatibleTypeException
* @throws QdbContainerEmptyException
*/
function front();
/**
* Dequeues from the end of the queue and returns the value.
*
* @example
* <code>
* $last = $cluster->deque('alias')->popBack();
* </code>
*
* @return string The last element of the queue.
* @throws QdbAliasNotFoundException
* @throws QdbIncompatibleTypeException
* @throws QdbContainerEmptyException
*/
function popBack();
/**
* Dequeues from the beginning of the queue and returns the value.
*
* @example
* <code>
* $first = $cluster->deque('alias')->popFront();
* </code>
*
* @return string The first element of the queue.
* @throws QdbAliasNotFoundException
* @throws QdbIncompatibleTypeException
* @throws QdbContainerEmptyException
*/
function popFront();
/**
* Enqueues the specified value at the end of the queue. Creates the queue if needed.
*
* @example
* <code>
* $cluster->deque('alias')->pushBack('content');
* </code>
*
* @param string $content The value to enqueue.
* @throws QdbIncompatibleTypeException
*/
function pushBack($content);
/**
* Enqueues the specified value at the beginning of the queue. Creates the queue if needed.
*
* @example
* <code>
* $cluster->deque('alias')->pushFront('content');
* </code>
*
* @param string $content The value to enqueue.
* @throws QdbIncompatibleTypeException
*/
function pushFront($content);
/**
* Gets the length of the queue.
*
* @example
* <code>
* $elementCount = $cluster->deque('alias')->size();
* </code>
*
* @return int The number of elements in the queue.
* @throws QdbAliasNotFoundException
* @throws QdbIncompatibleTypeException
*/
function size();
}
?>