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: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146:
<?php
namespace qdb;
/**
* A connection to a *quasardb* cluster.
*
* @example
* <code>
* $cluster = new QdbCluster('qdb://127.0.0.1:2836');
*
* $cluster->blob('key 0')->put('value 0');
* $cluster->deque('key 1')->pushBack('value 1');
* $cluster->integer('key 2')->add(42);
* </code>
*/
class QdbCluster
{
/**
* Connects to a *quasardb* cluster through the specified URI.
*
* The URI contains the addresses of the bootstraping nodes, other nodes are discovered during the first connection.
* Having more than one node in the URI allows to connect to the cluster even if the first node is down.
*
* @param string $uri A quasardb URI, in the form of `qdb://<address1>:<port1>[,<address2:<port2>...]`.
* @throws QdbConnectionRefusedException
* @throws QdbTimeoutException
*
* @example
* <code>
* $cluster = new QdbCluster('qdb://127.0.0.1:2836');
* </code>
*/
function __construct($uri);
/**
* Creates a {@link QdbBlob} associated with the specified alias.
*
* No query is performed at this point.
*
* @example
* <code>
* $cluster->blob('alias')->put('content');
* </code>
*
* @param string $alias The alias of the blob (alias starting with `qdb` are reserved).
* @return QdbBlob
*/
function blob($alias);
/**
* Creates a {@link QdbDeque} associated with the specified alias.
*
* No query is performed at this point.
*
* @example
* <code>
* $cluster->deque('alias')->pushBack('content');
* </code>
*
* @param string $alias The alias of the queue (alias starting with `qdb` are reserved).
* @return QdbDeque
*/
function deque($alias);
/**
* Create a {@link QdbBlob}, a {@link QdbDeque}, a {@link QdbInteger} or a {@link QdbTag}
* depending on the actual type of the entry.
*
* The entry must exist in the database.
*
* @example
* <code>
* $cluster->blob('alias1')->put('content');
* $cluster->deque('alias2')->pushBack('content');
*
* @param string $alias The alias of the entry (alias starting with `qdb` are reserved).
* @return QdbEntry
* @throws QdbAliasNotFoundException
*
* $entry1 = $cluster->entry('alias1'); // $entry1 is a QdbBlob
* $entry2 = $cluster->entry('alias2'); // $entry2 is a QdbDeque
* </code>
*/
function entry($alias);
/**
* Creates a {@link QdbInteger} associated with the specified alias.
*
* No query is performed at this point.
*
* @example
* <code>
* $cluster->integer('alias')->update(42);
* </code>
*
* @param string $alias The alias of the integer (alias starting with `qdb` are reserved).
* @return QdbInteger
*/
function integer($alias);
/**
* Removes all the entries on all the nodes of the quasardb cluster.
*
* This operation is not allowed by default, it must be enabled in the server configuration.
*
* @example
* <code>
* $cluster->purgeAll();
* </code>
*
* @param int $timeout The maximim number of seconds for the command to execute.
* @throws QdbOperationDisabledException
*/
function purgeAll($timeout=300);
/**
* Executes operations of a `QdbBatch`.
*
* @example
* <code>
* $batch = new QdbBatch();
* $batch->put('alias1', 'content1');
* $batch->put('alias2', 'content2');
* $cluster->runBatch($batch);
* </code>
*
* @param QdbBatch $batch The batch to run.
* @return QdbBatchResult
*/
function runBatch($batch);
/**
* Creates a {@link QdbTag} associated with the specified alias.
*
* No query is performed at this point.
*
* @example
* <code>
* $taggedEntries = $cluster->tag('alias')->getEntries();
* </code>
*
* @param string $alias The alias of the tag (alias starting with `qdb` are reserved).
* @return QdbTag
*/
function tag($alias);
}