Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Inserting
Querying
--------

$users->get('key');
$users->get('key');
$users->multiget(array('key1', 'key2'));

Removing
Expand Down
34 changes: 17 additions & 17 deletions columnfamily.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static public function import($bytes) {

/**
* Generate a v1 UUID (timestamp based)
* @return string a byte[] representation of a UUID
* @return string a byte[] representation of a UUID
* @param string $node what to use for the MAC portion of the UUID. This will be generated
* randomly if left as NULL
* @param int $time timestamp to use for the UUID. This should be a number of microseconds
Expand All @@ -33,7 +33,7 @@ static public function uuid1($node=null, $time=null) {

/**
* Generate a v3 UUID
* @return string a byte[] representation of a UUID
* @return string a byte[] representation of a UUID
*/
static public function uuid3($node=null, $namespace=null) {
$uuid = UUID::mint(3, $node, $namespace);
Expand All @@ -42,7 +42,7 @@ static public function uuid3($node=null, $namespace=null) {

/**
* Generate a v4 UUID
* @return string a byte[] representation of a UUID
* @return string a byte[] representation of a UUID
*/
static public function uuid4() {
$uuid = UUID::mint(4);
Expand All @@ -51,7 +51,7 @@ static public function uuid4() {

/**
* Generate a v5 UUID
* @return string a byte[] representation of a UUID
* @return string a byte[] representation of a UUID
*/
static public function uuid5($node, $namespace=null) {
$uuid = UUID::mint(5, $node, $namespace);
Expand Down Expand Up @@ -149,7 +149,7 @@ class ColumnFamily {
* replaced by an array of the form array(column_value, column_timestamp). */
public $include_timestamp = false;

/**
/**
* @var int When calling `get_range`, the intermediate results need
* to be buffered if we are fetching many rows, otherwise the Cassandra
* server will overallocate memory and fail. This is the size of
Expand All @@ -162,7 +162,7 @@ class ColumnFamily {
*
* @param Connection $connection the connection to use for this ColumnFamily
* @param string $column_family the name of the column family in Cassandra
* @param bool $autopack_names whether or not to automatically convert column names
* @param bool $autopack_names whether or not to automatically convert column names
* to and from their binary representation in Cassandra
* based on their comparator type
* @param bool $autopack_values whether or not to automatically convert column values
Expand Down Expand Up @@ -211,7 +211,7 @@ public function __construct($pool,
$this->key_type = 'BytesType';
$this->col_type_dict = array();

$this->is_super = $this->cfdef->column_type === 'Super';
$this->is_super = $this->cfdef->column_type === 'Super';
$this->set_autopack_names($autopack_names);
$this->set_autopack_values($autopack_values);
$this->set_autopack_keys(true);
Expand Down Expand Up @@ -627,7 +627,7 @@ public function insert($key,
*/
public function add($key, $column, $value=1, $super_column=null,
$write_consistency_level=null) {

$cp = $this->create_column_parent($super_column);
$packed_key = $this->pack_key($key);
$counter = new cassandra_CounterColumn();
Expand Down Expand Up @@ -707,7 +707,7 @@ public function remove($key, $columns=null, $super_column=null, $write_consisten
$mutation = new cassandra_Mutation();
$mutation->deletion = $deletion;

$mut_map = array($packed_key => array($this->column_family => array($mutation)));
$mut_map = array($packed_key => array($this->column_family => array($mutation)));

return $this->pool->call("batch_mutate", $mut_map, $this->wcl($write_consistency_level));
}
Expand Down Expand Up @@ -767,7 +767,7 @@ private static function extract_type_name($type_string) {
$index = strrpos($type_string, '.');
if ($index == false)
return 'BytesType';

$type = substr($type_string, $index + 1);
if (!isset(self::$TYPES[$type]))
return 'BytesType';
Expand Down Expand Up @@ -871,8 +871,8 @@ public function unpack_key($b) {
private function get_data_type_for_col($col_name) {
if (isset($this->col_type_dict[$col_name]))
return $this->col_type_dict[$col_name];
else
return $this->cf_data_type;
else
return $this->cf_data_type;
}

private function pack_value($value, $col_name) {
Expand All @@ -894,8 +894,8 @@ private static function unpack_str($str, $len) {
if($v > 0) { $out_str .= chr($v); }
return $out_str;
}
private static function pack_str($str, $len) {

private static function pack_str($str, $len) {
$out_str = "";
for($i=0; $i<$len; $i++)
$out_str .= pack("c", ord(substr($str, $i, 1)));
Expand Down Expand Up @@ -1013,7 +1013,7 @@ private function pack($value, $data_type) {
else
return $value;
}

private function unpack($value, $data_type) {
if ($data_type == 'LongType')
return self::unpack_long($value);
Expand Down Expand Up @@ -1121,7 +1121,7 @@ private function array_to_mutation($array, $timestamp=null, $ttl=null) {
}
return $ret;
}

private function array_to_supercolumns_or_columns($array, $timestamp=null, $ttl=null) {
if(empty($timestamp)) $timestamp = CassandraUtil::get_time();

Expand Down Expand Up @@ -1275,7 +1275,7 @@ public function next() {
{
# We've reached the end of this page, but there should be more
# in the CF

# Get the next buffer (next_start_key has already been set)
$this->get_buffer();

Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ THRIFT_DETRITUS = \
build

%:
dh $@
dh $@

override_dh_auto_configure:
cd $(THRIFTDIR) && phpize
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ About This Documentation
------------------------
This documentation is generated using the `Sphinx
<http://sphinx.pocoo.org/>`_ documentation generator. The source files
for the documentation are located in the `doc/` directory of
for the documentation are located in the `doc/` directory of
**phpcassa**. To generate the documentation, run the
following command from the `doc` directory:

Expand Down
14 changes: 7 additions & 7 deletions doc/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ should execute without raising an exception:

This tutorial also assumes that a Cassandra instance is running on the
default host and port. Read the `instructions for getting started
with Cassandra <http://wiki.apache.org/cassandra/GettingStarted>`_.
with Cassandra <http://wiki.apache.org/cassandra/GettingStarted>`_.
You can start Cassandra like so:

.. code-block:: bash
Expand All @@ -37,7 +37,7 @@ for this tutorial:

.. code-block:: none

user@~ $ cassandra-cli
user@~ $ cassandra-cli
Welcome to cassandra CLI.

Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to quit.
Expand Down Expand Up @@ -174,7 +174,7 @@ some rows with keys 'row_key1' through 'row_key9', we can do this:
Print_r($columns);
}

It's also possible to specify a set of columns or a slice for
It's also possible to specify a set of columns or a slice for
`ColumnFamily::multiget() <api/phpcassa/columnfamily/ColumnFamily#multiget>`_
and
`ColumnFamily::get_range() <api/phpcassa/columnfamily/ColumnFamily#get_range>`_,
Expand Down Expand Up @@ -368,13 +368,13 @@ will be indexed. In a ``cassandra.yaml`` file, this might look like:
validator_class: LongType
index_type: KEYS

In order to use
In order to use
`ColumnFamily::get_indexed_slices() <api/phpcassa/columnfamily/ColumnFamily#get_indexed_slices>`_
to get data from Indexed1 using the indexed column, we need to create an
to get data from Indexed1 using the indexed column, we need to create an
`IndexClause <http://thobbs.github.com/phpcassa/api/phpcassa/cassandra_IndexClause.html>`_
which contains a list of
`IndexExpression <http://thobbs.github.com/phpcassa/api/phpcassa/cassandra_IndexExpression.html>`_
objects. The functions
objects. The functions
`CassandraUtil::create_index_expression() <api/phpcassa/columnfamily/CassandraUtil#create_index_expression>`_
and
`CassandraUtil::create_index_clause() <api/phpcassa/columnfamily/CassandraUtil#create_index_clause>`_
Expand All @@ -397,7 +397,7 @@ the following:
Print_r($columns)
}

Although at least one
Although at least one
`IndexExpression <http://thobbs.github.com/phpcassa/api/phpcassa/cassandra_IndexExpression.html>`_
in every clause must be on an indexed column, you may also have other expressions
which are on non-indexed columns.
8 changes: 4 additions & 4 deletions sysmanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,13 @@ public function create_index($keyspace, $column_family, $column,
* @param string $column the name of the column to drop the index from
*/
public function drop_index($keyspace, $column_family, $column) {
$matched = false;
$matched = false;
$this->client->set_keyspace($keyspace);
$cfdef = $this->get_cfdef($keyspace, $column_family);
$cfdef = $this->get_cfdef($keyspace, $column_family);
$col_metas = $cfdef->column_metadata;

for ($i = 0; $i < count($col_metas); $i++) {
$col_meta = $col_metas[$i];
$col_meta = $col_metas[$i];
if ($col_meta->name == $column) {
$col_meta->index_type = NULL;
$col_meta->index_name = NULL;
Expand All @@ -474,7 +474,7 @@ public function drop_index($keyspace, $column_family, $column) {
}

/**
* Describes the Cassandra cluster.
* Describes the Cassandra cluster.
*
* @return array the node to token mapping
*/
Expand Down
18 changes: 9 additions & 9 deletions test/test_autopacking.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __construct() {
$cfattrs["comparator_type"] = DataType::UTF8_TYPE;
$this->sys->create_column_family(self::$KS, 'SuperUTF8', $cfattrs);



$cfattrs = array("column_type" => "Super", "comparator_type" => DataType::LONG_TYPE);

Expand Down Expand Up @@ -123,7 +123,7 @@ public function __construct() {
// Quick way to create a TimeUUIDType validator to subcol
$this->sys->create_index(self::$KS, 'DefaultValidator', 'subcol',
DataType::TIME_UUID_TYPE, NULL, NULL);

$this->client = new ConnectionPool(self::$KS);
$this->cf_long = new ColumnFamily($this->client, 'StdLong');
$this->cf_int = new ColumnFamily($this->client, 'StdInteger');
Expand Down Expand Up @@ -308,7 +308,7 @@ public function test_standard_column_family() {
$ascii_cols = array('aaaa', 'bbbb', 'cccc');
$type_groups[] = self::make_group($this->cf_ascii, $ascii_cols);

$utf8_cols = array("a&#1047;", "b&#1048;", "c&#1049;");
$utf8_cols = array("a&#1047;", "b&#1048;", "c&#1049;");
$type_groups[] = self::make_group($this->cf_utf8, $utf8_cols);


Expand Down Expand Up @@ -357,7 +357,7 @@ public function test_standard_column_family() {
### multiget() tests ###

$result = $group['cf']->multiget(self::$KEYS);
foreach(range(0,2) as $i)
foreach(range(0,2) as $i)
self::assertEqual($result[self::$KEYS[0]], $group['dict']);

$result = $group['cf']->multiget(array(self::$KEYS[2]));
Expand Down Expand Up @@ -442,7 +442,7 @@ public function test_super_column_families() {
$ascii_cols = array('aaaa', 'bbbb', 'cccc');
$type_groups[] = self::make_super_group($this->cf_supascii, $ascii_cols);

$utf8_cols = array("a&#1047;", "b&#1048;", "c&#1049;");
$utf8_cols = array("a&#1047;", "b&#1048;", "c&#1049;");
$type_groups[] = self::make_super_group($this->cf_suputf8, $utf8_cols);

foreach($type_groups as $group) {
Expand Down Expand Up @@ -490,7 +490,7 @@ public function test_super_column_families() {
### multiget() tests ###

$result = $group['cf']->multiget(self::$KEYS);
foreach(range(0,2) as $i)
foreach(range(0,2) as $i)
self::assertEqual($result[self::$KEYS[0]], $group['dict']);

$result = $group['cf']->multiget(array(self::$KEYS[2]));
Expand Down Expand Up @@ -577,7 +577,7 @@ public function test_super_column_family_subs() {
$ascii_cols = array('aaaa', 'bbbb', 'cccc');
$type_groups[] = self::make_sub_group($this->cf_suplong_subascii, $ascii_cols);

$utf8_cols = array("a&#1047;", "b&#1048;", "c&#1049;");
$utf8_cols = array("a&#1047;", "b&#1048;", "c&#1049;");
$type_groups[] = self::make_sub_group($this->cf_suplong_subutf8, $utf8_cols);


Expand Down Expand Up @@ -611,7 +611,7 @@ public function test_super_column_family_subs() {
### multiget() tests ###

$result = $group['cf']->multiget(self::$KEYS);
foreach(range(0,2) as $i)
foreach(range(0,2) as $i)
self::assertEqual($result[self::$KEYS[0]], $group['dict']);

$result = $group['cf']->multiget(array(self::$KEYS[2]));
Expand Down Expand Up @@ -726,7 +726,7 @@ public function test_default_validated_columns() {

public function test_uuid1_generation() {
$micros = 1293769171436849;
$uuid = CassandraUtil::import(CassandraUtil::uuid1(null, $micros));
$uuid = CassandraUtil::import(CassandraUtil::uuid1(null, $micros));
$t = (int)($uuid->time * 1000000);
self::assertWithinMargin($micros, $t, 100);
}
Expand Down
16 changes: 8 additions & 8 deletions test/test_columnfamily.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public function test_insert_get_range() {
self::assertEqual($count, 201);



# Row count above total number of rows, buffer_size = total number of rows
$cf = new ColumnFamily($this->pool, 'Standard1', true, true,
$read_consistency_level=$cl, $write_consistency_level=$cl,
Expand All @@ -286,8 +286,8 @@ public function test_insert_get_range() {
$count++;
}
self::assertEqual($count, 201);


# Row count above total number of rows, buffer_size = total number of rows
$cf = new ColumnFamily($this->pool, 'Standard1', true, true,
$read_consistency_level=$cl, $write_consistency_level=$cl,
Expand All @@ -299,7 +299,7 @@ public function test_insert_get_range() {
$count++;
}
self::assertEqual($count, 201);


$cf->truncate();
}
Expand Down Expand Up @@ -420,7 +420,7 @@ public function test_batched_get_indexed_slices() {
self::assertEqual($count, 201);



# Row count above total number of rows, buffer_size = total number of rows
$cf = new ColumnFamily($this->pool, 'Indexed1', true, true,
$read_consistency_level=$cl, $write_consistency_level=$cl,
Expand All @@ -432,8 +432,8 @@ public function test_batched_get_indexed_slices() {
$count++;
}
self::assertEqual($count, 201);


# Row count above total number of rows, buffer_size = total number of rows
$cf = new ColumnFamily($this->pool, 'Indexed1', true, true,
$read_consistency_level=$cl, $write_consistency_level=$cl,
Expand Down Expand Up @@ -476,7 +476,7 @@ public function test_get_indexed_slices() {
# Insert and remove a matching row at the end
$indexed_cf->insert('key4', $columns);
$indexed_cf->remove('key4');
# Remove a matching row from the middle
# Remove a matching row from the middle
$indexed_cf->remove('key2');

$result = $indexed_cf->get_indexed_slices($clause);
Expand Down
2 changes: 1 addition & 1 deletion thrift/transport/TServerSocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function acceptImpl() {

$socket = new TSocket();
$socket->setHandle($handle);

return $socket;
}
}
Loading