Provides management of streaming transactions

package ArangoDBClient
since 3.5
inherited_from \ArangoDBClient\Handler

 Methods

Construct a new streaming transaction handler

__construct(\ArangoDBClient\Connection $connection) 
inherited_from \ArangoDBClient\Handler::__construct()

Parameters

$connection

\ArangoDBClient\Connection
  • connection to be used

Construct a new handler

__construct(\ArangoDBClient\Connection $connection) 
Inherited

Parameters

$connection

\ArangoDBClient\Connection
  • connection to be used

Aborts a transaction

abort(mixed $trx) : boolean

Parameters

$trx

mixed
  • streaming transaction object or transaction id as string

Exceptions

\ArangoDBClient\ServerException

Returns

boolean- true if abort succeeds, throws an exception otherwise

Closes all pending transactions created by the handler

closePendingTransactions() 

Commits a transaction

commit(mixed $trx) : boolean

Parameters

$trx

mixed
  • streaming transaction object or transaction id as string

Exceptions

\ArangoDBClient\ServerException

Returns

boolean- true if commit succeeds, throws an exception otherwise

Creates a streaming transaction from scratch (no collections) or from an existing transaction object (necessary when collections need to be passed into the transaction or when an existing transaction is resumed)

create(\ArangoDBClient\StreamingTransaction $trx = null

Parameters

$trx

\ArangoDBClient\StreamingTransaction
  • existing transaction

Exceptions

\ArangoDBClient\ServerException

Return all currently running transactions

getRunning() : array

Exceptions

\ArangoDBClient\ServerException

Returns

array- array of currently running transactions, each transaction is an array with attributes 'id' and 'status'

Retrieves the status of a transaction

getStatus(mixed $trx) : array

Parameters

$trx

mixed
  • streaming transaction object or transaction id as string

Exceptions

\ArangoDBClient\ServerException

Returns

array- returns an array with attributes 'id' and 'status'

Sets the document class to use

setDocumentClass(string $class) : \ArangoDBClient\DocumentClassable
Inherited

Parameters

$class

string

Document class to use

Returns

\ArangoDBClient\DocumentClassable

Sets the edge class to use

setEdgeClass(string $class) : \ArangoDBClient\DocumentClassable
Inherited

Parameters

$class

string

Edge class to use

Returns

\ArangoDBClient\DocumentClassable

Steal the transaction from the handler, so that it is not responsible anymore for auto-aborting it on shutdown

stealTransaction(string $id) 

Parameters

$id

string
  • transaction id

Add a transaction header to the array of headers in case this is a transactional operation

addTransactionHeader(array $headers, mixed $collection) 
Inherited

Parameters

$headers

array
  • already existing headers

$collection

mixed
  • any type of collection (can be StreamingTransactionCollection or other)

Return the connection object

getConnection() : \ArangoDBClient\Connection
Inherited

Returns

\ArangoDBClient\Connection- the connection object

Return a connection option This is a convenience function that calls json_encode_wrapper on the connection

getConnectionOption($optionName) : mixed
Inherited

Parameters

$optionName

  • The option to return a value for

Exceptions

\ArangoDBClient\ClientException

Returns

mixed- the option's value

Helper function that runs through the options given and includes them into the parameters array given.

includeOptionsInBody(array $options, array $body, array $includeArray = array()) : array
Inherited

Only options that are set in $includeArray will be included. This is only for options that are to be sent to the ArangoDB server in a json body(like 'limit', 'skip', etc...) .

Parameters

$options

array
  • The options array that holds the options to include in the parameters

$body

array
  • The array into which the options will be included.

$includeArray

array
  • The array that defines which options are allowed to be included, and what their default value is. for example: 'waitForSync'=>true

Returns

array$params - array of parameters for use in a url

Return a json encoded string for the array passed.

json_encode_wrapper(array $body) : string
Inherited

This is a convenience function that calls json_encode_wrapper on the connection

Parameters

$body

array
  • The body to encode into json

Exceptions

\ArangoDBClient\ClientException

Returns

string- json string of the body that was passed

Turn a value into a collection name

makeCollection(mixed $value) : string
Inherited

Parameters

$value

mixed
  • document, collection or string

Exceptions

\ArangoDBClient\ClientException

Returns

string- collection name

 Properties

 

Document class to use

$_documentClass : string

Default

'\ArangoDBClient\Document'
 

Edge class to use

$_edgeClass : string

Default

'\ArangoDBClient\Edge'
 

Connection object

$_connection 

Default

param
 

$_pendingTransactions

$_pendingTransactions 

Default

array()