Page MenuHomePhorge
Diviner Tech Docs PhabricatorRepositoryWorkingCopyVersion

final class PhabricatorRepositoryWorkingCopyVersion
Phorge Technical Documentation (Repositories)

This class is not documented.

Tasks

Managing Connections

  • protected function getConnectionNamespace() — Return a namespace for this object's connections in the connection cache. Generally, the database name is appropriate. Two connections are considered equivalent if they have the same connection namespace and mode.
  • protected function getEstablishedConnection($mode) — Get an existing, cached connection for this object.
  • protected function setEstablishedConnection($mode, $connection, $force_unique) — Store a connection in the connection cache.
  • public function setForcedConnection($connection) — Force an object to use a specific connection.

Configuring Storage

Loading Objects

  • public function load($id) — Load an object by ID. You need to invoke this as an instance method, not a class method, because PHP doesn't have late static binding (until PHP 5.3.0). For example:
  • public function loadAll() — Loads all of the objects, unconditionally.
  • public function loadAllWhere($pattern, ...) — Load all objects which match a WHERE clause. You provide everything after the 'WHERE'; Lisk handles everything up to it. For example:
  • public function loadOneWhere($pattern, ...) — Load a single object identified by a 'WHERE' clause. You provide everything after the 'WHERE', and Lisk builds the first half of the query. See loadAllWhere(). This method is similar, but returns a single result instead of a list.
  • public function reload() — Reload an object from the database, discarding any changes to persistent properties. This is primarily useful after entering a transaction but before applying changes to an object.
  • public function loadFromArray($row) — Initialize this object's properties from a dictionary. Generally, you load single objects with loadOneWhere(), but sometimes it may be more convenient to pull data from elsewhere directly (e.g., a complicated join via @{method:queryData}) and then load from an array representation.
  • public function loadAllFromArray($rows) — Initialize a list of objects from a list of dictionaries. Usually you load lists of objects with @{method:loadAllWhere}, but sometimes that isn't flexible enough. One case is if you need to do joins to select the right objects:

Examining Objects

  • public function getID() — Retrieve the unique ID identifying this object. This value will be null if the object hasn't been persisted and you didn't set it manually.
  • public function hasProperty($property) — Test if a property exists.
  • protected function getAllLiskProperties() — Retrieve a list of all object properties. This list only includes properties that are declared as protected, and it is expected that all properties returned by this function should be persisted to the database. Properties that should not be persisted must be declared as private.
  • protected function checkProperty($property) — Check if a property exists on this object.
  • public function establishConnection($mode, $force_new) — Get or build the database connection for this object.
  • protected function getAllLiskPropertyValues() — Convert this object into a property dictionary. This dictionary can be restored into an object by using @{method:loadFromArray} (unless you're using legacy features with CONFIG_CONVERT_CAMELCASE, but in that case you should just go ahead and die in a fire).

Writing Objects

  • public function setID($id) — Set unique ID identifying this object. You normally don't need to call this method unless with `IDS_MANUAL`.
  • public function save() — Persist this object to the database. In most cases, this is the only method you need to call to do writes. If the object has not yet been inserted this will do an insert; if it has, it will do an update.
  • public function replace() — Save this object, forcing the query to use REPLACE regardless of object state.
  • public function insert() — Save this object, forcing the query to use INSERT regardless of object state.
  • public function update() — Save this object, forcing the query to use UPDATE regardless of object state.
  • public function delete() — Delete this object, permanently.
  • protected function insertRecordIntoDatabase($mode) — Internal implementation of INSERT and REPLACE.

Hooks and Callbacks

  • public function getIDKey() — Retrieve the primary key column, "id" by default. If you can not reasonably name your ID column "id", override this method.
  • public function generatePHID() — Generate a new PHID, used by CONFIG_AUX_PHID.
  • protected function willWriteData(&$data)
  • protected function didWriteData() — Hook to perform actions after data has been written to the database.
  • protected function willSaveObject() — Hook to make internal object state changes prior to INSERT, REPLACE or UPDATE.
  • protected function willReadData(&$data)
  • protected function didReadData() — Hook to perform an action on data after it is read from the database.
  • protected function willDelete() — Hook to perform an action before the deletion of an object.
  • protected function didDelete() — Hook to perform an action after the deletion of an object.
  • protected function readField($field) — Reads the value from a field. Override this method for custom behavior of @{method:getField} instead of overriding getField directly.
  • protected function writeField($field, $value) — Writes a value to a field. Override this method for custom behavior of setField($value) instead of overriding setField directly.

Utilities

  • public function __set($name, $value) — Warns against writing to undeclared property.
  • protected function applyLiskDataSerialization(&$data, $deserialize) — Applies configured serialization to a dictionary of values.
  • public function __call($method, $args) — Black magic. Builds implied get*() and set*() for all properties.
  • public static function loadNextCounterValue($conn_w, $counter_name) — Increments a named counter and returns the next value.
  • public static function loadCurrentCounterValue($conn_r, $counter_name) — Returns the current value of a named counter.
  • public static function overwriteCounterValue($conn_w, $counter_name, $counter_value) — Overwrite a named counter, forcing it to a specific value.

Managing Transactions

  • public function beginReadLocking() — Begins read-locking selected rows with SELECT ... FOR UPDATE, so that other connections can not read them (this is an enormous oversimplification of FOR UPDATE semantics; consult the MySQL documentation for details). To end read locking, call @{method:endReadLocking}. For example:
  • public function endReadLocking() — Ends read-locking that began at an earlier @{method:beginReadLocking} call.
  • public function beginWriteLocking() — Begins write-locking selected rows with SELECT ... LOCK IN SHARE MODE, so that other connections can not update or delete them (this is an oversimplification of LOCK IN SHARE MODE semantics; consult the MySQL documentation for details). To end write locking, call @{method:endWriteLocking}.
  • public function endWriteLocking() — Ends write-locking that began at an earlier @{method:beginWriteLocking} call.

Isolation for Unit Testing

Other Methods

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

LiskDAO

Warns against writing to undeclared property.

Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

public function __construct()
Inherited

LiskDAO

Build an empty object.

Return
this//Implicit.//

protected function establishLiveConnection($mode)
Inherited

LiskDAO

Establish a live connection to a database service. This method should return a new connection. Lisk handles connection caching and management; do not perform caching deeper in the stack.

Parameters
string$modeMode, either 'r' (reading) or 'w' (reading and writing).
Return
AphrontDatabaseConnectionNew database connection.

protected function getConnectionNamespace()
Inherited

LiskDAO

Return a namespace for this object's connections in the connection cache. Generally, the database name is appropriate. Two connections are considered equivalent if they have the same connection namespace and mode.

Return
stringConnection namespace for cache

protected function getDatabaseName()
Inherited

This method is not documented.
Return
wild

protected function getEstablishedConnection($mode)
Inherited

LiskDAO

Get an existing, cached connection for this object.

Parameters
mode$modeConnection mode.
Return
AphrontDatabaseConnection|nullConnection, if it exists in cache.

protected function setEstablishedConnection($mode, $connection, $force_unique)
Inherited

LiskDAO

Store a connection in the connection cache.

Parameters
mode$modeConnection mode.
AphrontDatabaseConnection$connectionConnection to cache.
$force_unique
Return
this

public function setForcedConnection($connection)
Inherited

LiskDAO

Force an object to use a specific connection.

This overrides all connection management and forces the object to use a specific connection when interacting with the database.

Parameters
AphrontDatabaseConnection$connectionConnection to force this object to use.
Return
wild

protected function getConfiguration()

LiskDAO

Change Lisk behaviors, like ID configuration and timestamps. If you want to change these behaviors, you should override this method in your child class and change the options you're interested in. For example:

protected function getConfiguration() {
  return array(
    Lisk_DataAccessObject::CONFIG_EXAMPLE => true,
  ) + parent::getConfiguration();
}

The available options are:

CONFIG_IDS Lisk objects need to have a unique identifying ID. The three mechanisms available for generating this ID are IDS_AUTOINCREMENT (default, assumes the ID column is an autoincrement primary key), IDS_MANUAL (you are taking full responsibility for ID management), or IDS_COUNTER (see below).

InnoDB does not persist the value of auto_increment across restarts, and instead initializes it to MAX(id) + 1 during startup. This means it may reissue the same autoincrement ID more than once, if the row is deleted and then the database is restarted. To avoid this, you can set an object to use a counter table with IDS_COUNTER. This will generally behave like IDS_AUTOINCREMENT, except that the counter value will persist across restarts and inserts will be slightly slower. If a database stores any DAOs which use this mechanism, you must create a table there with this schema:

CREATE TABLE lisk_counter (
  counterName VARCHAR(64) COLLATE utf8_bin PRIMARY KEY,
  counterValue BIGINT UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CONFIG_TIMESTAMPS Lisk can automatically handle keeping track of a `dateCreated' and `dateModified' column, which it will update when it creates or modifies an object. If you don't want to do this, you may disable this option. By default, this option is ON.

CONFIG_AUX_PHID This option can be enabled by being set to some truthy value. The meaning of this value is defined by your PHID generation mechanism. If this option is enabled, a `phid' property will be populated with a unique PHID when an object is created (or if it is saved and does not currently have one). You need to override generatePHID() and hook it into your PHID generation mechanism for this to work. By default, this option is OFF.

CONFIG_SERIALIZATION You can optionally provide a column serialization map that will be applied to values when they are written to the database. For example:

self::CONFIG_SERIALIZATION => array(
  'complex' => self::SERIALIZATION_JSON,
)

This will cause Lisk to JSON-serialize the 'complex' field before it is written, and unserialize it when it is read.

CONFIG_BINARY You can optionally provide a map of columns to a flag indicating that they store binary data. These columns will not raise an error when handling binary writes.

CONFIG_COLUMN_SCHEMA Provide a map of columns to schema column types.

CONFIG_KEY_SCHEMA Provide a map of key names to key specifications.

CONFIG_NO_TABLE Allows you to specify that this object does not actually have a table in the database.

CONFIG_NO_MUTATE Provide a map of columns which should not be included in UPDATE statements. If you have some columns which are always written to explicitly and should never be overwritten by a save(), you can specify them here. This is an advanced, specialized feature and there are usually better approaches for most locking/contention problems.

PhabricatorRepositoryWorkingCopyVersion
This method is not documented.
Return
dictionaryMap of configuration options to values.

public function getConfigOption($option_name)
Inherited

LiskDAO

Determine the setting of a configuration option for this class of objects.

Parameters
const$option_nameOption name, one of the CONFIG_* constants.
Return
mixedOption value, if configured (null if unavailable).

public function load($id)
Inherited

LiskDAO

Load an object by ID. You need to invoke this as an instance method, not a class method, because PHP doesn't have late static binding (until PHP 5.3.0). For example:

$dog = id(new Dog())->load($dog_id);
Parameters
int$idNumeric ID identifying the object to load.
Return
obj|nullIdentified object, or null if it does not exist.

public function loadAll()
Inherited

LiskDAO

Loads all of the objects, unconditionally.

Return
dictDictionary of all persisted objects of this type, keyed on object ID.

public function loadAllWhere($pattern, ...)
Inherited

LiskDAO

Load all objects which match a WHERE clause. You provide everything after the 'WHERE'; Lisk handles everything up to it. For example:

$old_dogs = id(new Dog())->loadAllWhere('age > %d', 7);

The pattern and arguments are as per queryfx().

Parameters
string$patternqueryfx()-style SQL WHERE clause.
...Zero or more conversions.
Return
dictDictionary of matching objects, keyed on ID.

public function loadOneWhere($pattern, ...)
Inherited

LiskDAO

Load a single object identified by a 'WHERE' clause. You provide everything after the 'WHERE', and Lisk builds the first half of the query. See loadAllWhere(). This method is similar, but returns a single result instead of a list.

Parameters
string$patternqueryfx()-style SQL WHERE clause.
...Zero or more conversions.
Return
obj|nullMatching object, or null if no object matches.

protected function loadRawDataWhere($pattern)
Inherited

This method is not documented.
Parameters
$pattern
Return
wild

public function reload()
Inherited

LiskDAO

Reload an object from the database, discarding any changes to persistent properties. This is primarily useful after entering a transaction but before applying changes to an object.

Return
this

public function loadFromArray($row)
Inherited

LiskDAO

Initialize this object's properties from a dictionary. Generally, you load single objects with loadOneWhere(), but sometimes it may be more convenient to pull data from elsewhere directly (e.g., a complicated join via queryData()) and then load from an array representation.

Parameters
dict$rowDictionary of properties, which should be equivalent to selecting a row from the table or calling @{method:getProperties}.
Return
this

public function loadAllFromArray($rows)
Inherited

LiskDAO

Initialize a list of objects from a list of dictionaries. Usually you load lists of objects with loadAllWhere(), but sometimes that isn't flexible enough. One case is if you need to do joins to select the right objects:

function loadAllWithOwner($owner) {
  $data = $this->queryData(
    'SELECT d.*
      FROM owner o
        JOIN owner_has_dog od ON o.id = od.ownerID
        JOIN dog d ON od.dogID = d.id
      WHERE o.id = %d',
    $owner);
  return $this->loadAllFromArray($data);
}

This is a lot messier than loadAllWhere(), but more flexible.

Parameters
list$rowsList of property dictionaries.
Return
dictList of constructed objects, keyed on ID.

public function setID($id)
Inherited

LiskDAO

Set unique ID identifying this object. You normally don't need to call this method unless with IDS_MANUAL.

Parameters
mixed$idUnique ID.
Return
this

public function getID()
Inherited

LiskDAO

Retrieve the unique ID identifying this object. This value will be null if the object hasn't been persisted and you didn't set it manually.

Return
mixedUnique ID.

public function getPHID()
Inherited

This method is not documented.
Return
wild

public function hasProperty($property)
Inherited

LiskDAO

Test if a property exists.

Parameters
string$propertyProperty name.
Return
boolTrue if the property exists.

protected function getAllLiskProperties()
Inherited

LiskDAO

Retrieve a list of all object properties. This list only includes properties that are declared as protected, and it is expected that all properties returned by this function should be persisted to the database. Properties that should not be persisted must be declared as private.

Return
dictDictionary of normalized (lowercase) to canonical (original case) property names.

protected function checkProperty($property)
Inherited

LiskDAO

Check if a property exists on this object.

Parameters
$property
Return
string|nullCanonical property name, or null if the property does not exist.

public function establishConnection($mode, $force_new)
Inherited

LiskDAO

Get or build the database connection for this object.

Parameters
string$mode'r' for read, 'w' for read/write.
bool$force_newTrue to force a new connection. The connection will not be retrieved from or saved into the connection cache.
Return
AphrontDatabaseConnectionLisk connection object.

protected function getAllLiskPropertyValues()
Inherited

LiskDAO

Convert this object into a property dictionary. This dictionary can be restored into an object by using loadFromArray() (unless you're using legacy features with CONFIG_CONVERT_CAMELCASE, but in that case you should just go ahead and die in a fire).

Return
dictDictionary of object properties.

public function makeEphemeral()
Inherited

LiskDAO

Make an object read-only.

Making an object ephemeral indicates that you will be changing state in such a way that you would never ever want it to be written back to the storage.

Return
wild

private function isEphemeralCheck()
Inherited

This method is not documented.
Return
wild

public function save()
Inherited

LiskDAO

Persist this object to the database. In most cases, this is the only method you need to call to do writes. If the object has not yet been inserted this will do an insert; if it has, it will do an update.

Return
this

public function replace()
Inherited

LiskDAO

Save this object, forcing the query to use REPLACE regardless of object state.

Return
this

public function insert()
Inherited

LiskDAO

Save this object, forcing the query to use INSERT regardless of object state.

Return
this

public function update()
Inherited

LiskDAO

Save this object, forcing the query to use UPDATE regardless of object state.

Return
this

public function delete()
Inherited

LiskDAO

Delete this object, permanently.

Return
this

protected function insertRecordIntoDatabase($mode)
Inherited

LiskDAO

Internal implementation of INSERT and REPLACE.

Parameters
const$modeEither "INSERT" or "REPLACE", to force the desired mode.
Return
this

protected function shouldInsertWhenSaved()
Inherited

LiskDAO

Method used to determine whether to insert or update when saving.

Return
booltrue if the record should be inserted

public function getTableName()
Inherited

LiskDAO

Retrieve the database table name. By default, this is the class name.

Return
stringTable name for object storage.

public function getIDKey()
Inherited

LiskDAO

Retrieve the primary key column, "id" by default. If you can not reasonably name your ID column "id", override this method.

Return
stringName of the ID column.

public function generatePHID()
Inherited

LiskDAO

Generate a new PHID, used by CONFIG_AUX_PHID.

Return
phidUnique, newly allocated PHID.

public function getPHIDType()
Inherited

This method is not documented.
Return
wild

protected function willWriteData(&$data)
Inherited

LiskDAO

Hook to apply serialization or validation to data before it is written to the database. See also willReadData().

Parameters
array&$data
Return
wild

protected function didWriteData()
Inherited

LiskDAO

Hook to perform actions after data has been written to the database.

Return
wild

protected function willSaveObject()
Inherited

LiskDAO

Hook to make internal object state changes prior to INSERT, REPLACE or UPDATE.

Return
wild

protected function willReadData(&$data)
Inherited

LiskDAO

Hook to apply serialization or validation to data as it is read from the database. See also willWriteData().

Parameters
array&$data
Return
wild

protected function didReadData()
Inherited

LiskDAO

Hook to perform an action on data after it is read from the database.

Return
wild

protected function willDelete()
Inherited

LiskDAO

Hook to perform an action before the deletion of an object.

Return
wild

protected function didDelete()
Inherited

LiskDAO

Hook to perform an action after the deletion of an object.

Return
wild

protected function readField($field)
Inherited

LiskDAO

Reads the value from a field. Override this method for custom behavior of getField() instead of overriding getField directly.

Parameters
string$fieldCanonical field name
Return
mixedValue of the field

protected function writeField($field, $value)
Inherited

LiskDAO

Writes a value to a field. Override this method for custom behavior of setField($value) instead of overriding setField directly.

Parameters
string$fieldCanonical field name
mixed$valueValue to write
Return
wild

public function openTransaction()
Inherited

LiskDAO

Increase transaction stack depth.

Return
this

public function saveTransaction()
Inherited

LiskDAO

Decrease transaction stack depth, saving work.

Return
this

public function killTransaction()
Inherited

LiskDAO

Decrease transaction stack depth, discarding work.

Return
this

public function beginReadLocking()
Inherited

LiskDAO

Begins read-locking selected rows with SELECT ... FOR UPDATE, so that other connections can not read them (this is an enormous oversimplification of FOR UPDATE semantics; consult the MySQL documentation for details). To end read locking, call endReadLocking(). For example:

$beach->openTransaction();
  $beach->beginReadLocking();

    $beach->reload();
    $beach->setGrainsOfSand($beach->getGrainsOfSand() + 1);
    $beach->save();

  $beach->endReadLocking();
$beach->saveTransaction();
Return
this

public function endReadLocking()
Inherited

LiskDAO

Ends read-locking that began at an earlier beginReadLocking() call.

Return
this

public function beginWriteLocking()
Inherited

LiskDAO

Begins write-locking selected rows with SELECT ... LOCK IN SHARE MODE, so that other connections can not update or delete them (this is an oversimplification of LOCK IN SHARE MODE semantics; consult the MySQL documentation for details). To end write locking, call endWriteLocking().

Return
this

public function endWriteLocking()
Inherited

LiskDAO

Ends write-locking that began at an earlier beginWriteLocking() call.

Return
this

public static function beginIsolateAllLiskEffectsToCurrentProcess()
Inherited

This method is not documented.
Return
wild

public static function endIsolateAllLiskEffectsToCurrentProcess()
Inherited

This method is not documented.
Return
wild

public static function shouldIsolateAllLiskEffectsToCurrentProcess()
Inherited

This method is not documented.
Return
wild

private function establishIsolatedConnection($mode)
Inherited

This method is not documented.
Parameters
$mode
Return
wild

public static function beginIsolateAllLiskEffectsToTransactions()
Inherited

This method is not documented.
Return
wild

public static function endIsolateAllLiskEffectsToTransactions()
Inherited

This method is not documented.
Return
wild

public static function shouldIsolateAllLiskEffectsToTransactions()
Inherited

This method is not documented.
Return
wild

public static function closeInactiveConnections($idle_window)
Inherited

LiskDAO

Close any connections with no recent activity.

Long-running processes can use this method to clean up connections which have not been used recently.

Parameters
int$idle_windowClose connections with no activity for this many seconds.
Return
void

public static function closeAllConnections()
Inherited

This method is not documented.
Return
wild

public static function closeIdleConnections()
Inherited

This method is not documented.
Return
wild

private static function closeConnection($key)
Inherited

This method is not documented.
Parameters
$key
Return
wild

protected function applyLiskDataSerialization(&$data, $deserialize)
Inherited

LiskDAO

Applies configured serialization to a dictionary of values.

Parameters
array&$data
$deserialize
Return
wild

public function __call($method, $args)
Inherited

LiskDAO

Black magic. Builds implied get*() and set*() for all properties.

Parameters
string$methodMethod name.
list$argsArgument vector.
Return
mixedget*() methods return the property value. set*() methods return $this.

public static function loadNextCounterValue($conn_w, $counter_name)
Inherited

LiskDAO

Increments a named counter and returns the next value.

Parameters
AphrontDatabaseConnection$conn_wDatabase where the counter resides.
string$counter_nameCounter name to create or increment.
Return
intNext counter value.

public static function loadCurrentCounterValue($conn_r, $counter_name)
Inherited

LiskDAO

Returns the current value of a named counter.

Parameters
AphrontDatabaseConnection$conn_rDatabase where the counter resides.
string$counter_nameCounter name to read.
Return
int|nullCurrent value, or `null` if the counter does not exist.

public static function overwriteCounterValue($conn_w, $counter_name, $counter_value)
Inherited

LiskDAO

Overwrite a named counter, forcing it to a specific value.

If the counter does not exist, it is created.

Parameters
AphrontDatabaseConnection$conn_wDatabase where the counter resides.
string$counter_nameCounter name to create or overwrite.
$counter_value
Return
void

private function getBinaryColumns()
Inherited

This method is not documented.
Return
wild

public function getSchemaColumns()
Inherited

This method is not documented.
Return
wild

public function getSchemaKeys()
Inherited

This method is not documented.
Return
wild

public function getColumnMaximumByteLength($column)
Inherited

This method is not documented.
Parameters
$column
Return
wild

public function getSchemaPersistence()
Inherited

This method is not documented.
Return
wild

public function getAphrontRefDatabaseName()
Inherited

This method is not documented.
Return
wild

public function getAphrontRefTableName()
Inherited

This method is not documented.
Return
wild

private function getLiskMetadata($key, $default)
Inherited

This method is not documented.
Parameters
$key
$default
Return
wild

private function setLiskMetadata($key, $value)
Inherited

This method is not documented.
Parameters
$key
$value
Return
wild

public static function pushStorageNamespace($namespace)
Inherited

This method is not documented.
Parameters
$namespace
Return
wild

public static function popStorageNamespace()
Inherited

This method is not documented.
Return
wild

public static function getDefaultStorageNamespace()
Inherited

This method is not documented.
Return
wild

public static function getStorageNamespace()
Inherited

This method is not documented.
Return
wild

public function setForcedStorageNamespace($namespace)
Inherited

This method is not documented.
Parameters
$namespace
Return
wild

private function newClusterConnection($application, $database, $mode)
Inherited

This method is not documented.
Parameters
$application
$database
$mode
Return
wild

private function raiseImproperWrite($database)
Inherited

This method is not documented.
Parameters
$database
Return
wild

private function raiseImpossibleWrite($database)
Inherited

This method is not documented.
Parameters
$database
Return
wild

private function raiseUnconfigured($database)
Inherited

This method is not documented.
Parameters
$database
Return
wild

private function raiseUnreachable($database, $proxy)
Inherited

This method is not documented.
Parameters
$database
Exception$proxy
Return
wild

public function getApplicationName()
Inherited

This method is not documented.
Return
wild

public static function chunkSQL($fragments, $limit)
Inherited

PhabricatorLiskDAO

Break a list of escaped SQL statement fragments (e.g., VALUES lists for INSERT, previously built with qsprintf()) into chunks which will fit under the MySQL 'max_allowed_packet' limit.

If a statement is too large to fit within the limit, it is broken into its own chunk (but might fail when the query executes).

Parameters
array$fragments
$limit
Return
wild

protected function assertAttached($property)
Inherited

This method is not documented.
Parameters
$property
Return
wild

protected function assertAttachedKey($value, $key)
Inherited

This method is not documented.
Parameters
$value
$key
Return
wild

protected function detectEncodingForStorage($string)
Inherited

This method is not documented.
Parameters
$string
Return
wild

protected function getUTF8StringFromStorage($string, $encoding)
Inherited

This method is not documented.
Parameters
$string
$encoding
Return
wild

public function getWriteProperty($key, $default)

This method is not documented.
Parameters
$key
$default
Return
wild

public static function loadVersions($repository_phid)

This method is not documented.
Parameters
$repository_phid
Return
wild

public static function loadWriter($repository_phid)

This method is not documented.
Parameters
$repository_phid
Return
wild

public static function getReadLock($repository_phid, $device_phid)

This method is not documented.
Parameters
$repository_phid
$device_phid
Return
wild

public static function getWriteLock($repository_phid)

This method is not documented.
Parameters
$repository_phid
Return
wild

public static function willWrite($locked_connection, $repository_phid, $device_phid, $write_properties, $lock_owner)

Before a write, set the "isWriting" flag.

This allows us to detect when we lose a node partway through a write and may have committed and acknowledged a write on a node that lost the lock partway through the write and is no longer reachable.

In particular, if a node loses its connection to the database the global lock is released by default. This is a durable lock which stays locked by default.

Parameters
AphrontDatabaseConnection$locked_connection
$repository_phid
$device_phid
array$write_properties
$lock_owner
Return
wild

public static function didWrite($repository_phid, $device_phid, $old_version, $new_version, $lock_owner)

After a write, update the version and release the "isWriting" lock.

Parameters
$repository_phid
$device_phid
$old_version
$new_version
$lock_owner
Return
wild

public static function updateVersion($repository_phid, $device_phid, $new_version)

After a fetch, set the local version to the fetched version.

Parameters
$repository_phid
$device_phid
$new_version
Return
wild

public static function demoteDevice($repository_phid, $device_phid)

Explicitly demote a device.

Parameters
$repository_phid
$device_phid
Return
wild