Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
ENH: Added phpcassa library
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Jomier committed Mar 23, 2011
1 parent cb5973f commit c0ea6ac
Show file tree
Hide file tree
Showing 47 changed files with 14,596 additions and 0 deletions.
34 changes: 34 additions & 0 deletions library/phpcassa/.gitignore
@@ -0,0 +1,34 @@
*.swp
*.swo
*.diff
*.pyc
doc/_build/*
thrift/ext/thrift_protocol/.deps
thrift/ext/thrift_protocol/.libs/
thrift/ext/thrift_protocol/Makefile
thrift/ext/thrift_protocol/Makefile.fragments
thrift/ext/thrift_protocol/Makefile.global
thrift/ext/thrift_protocol/Makefile.objects
thrift/ext/thrift_protocol/acinclude.m4
thrift/ext/thrift_protocol/aclocal.m4
thrift/ext/thrift_protocol/autom4te.cache/
thrift/ext/thrift_protocol/build/
thrift/ext/thrift_protocol/config.guess
thrift/ext/thrift_protocol/config.h
thrift/ext/thrift_protocol/config.h.in
thrift/ext/thrift_protocol/config.log
thrift/ext/thrift_protocol/config.nice
thrift/ext/thrift_protocol/config.status
thrift/ext/thrift_protocol/config.sub
thrift/ext/thrift_protocol/configure
thrift/ext/thrift_protocol/configure.in
thrift/ext/thrift_protocol/install-sh
thrift/ext/thrift_protocol/libtool
thrift/ext/thrift_protocol/ltmain.sh
thrift/ext/thrift_protocol/missing
thrift/ext/thrift_protocol/mkinstalldirs
thrift/ext/thrift_protocol/modules/
thrift/ext/thrift_protocol/php_thrift_protocol.lo
thrift/ext/thrift_protocol/run-tests.php
thrift/ext/thrift_protocol/thrift_protocol.la
thrift/ext/thrift_protocol/tmp-php.ini
10 changes: 10 additions & 0 deletions library/phpcassa/AUTHORS
@@ -0,0 +1,10 @@
Hoan Ton-That (hoan.tonthat@gmail.com)
Benjamin Sussman (ben@fwix.com)
Anthony ROUX (anthony.rx43@gmail.com)
Vadim Derkach
Zach Buller (zachbuller@gmail.com)
Timandes
Todd Zusman
Yancho Georgiev (yancho@inspirestudio.net)
Pieter Maes (maescool@gmail.com)
Tyler Hobbs
42 changes: 42 additions & 0 deletions library/phpcassa/CHANGES
@@ -0,0 +1,42 @@
Changelog
=========

Changes in 0.7.a.3
------------------

Bugfixes
^^^^^^^^
- Typo in throwing IncompatibleAPIException
- remove() on super column families did not pack names correctly
- CassandraUtil::uuid3() param name should be $node not $null

Features
^^^^^^^^
- Use remove() Thrift API call instead of batch_mutate() when possible
- Allow a microsecond timestamp to be passed in for v1 UUID creation
- Log connection errors with error_log()

Deprecated
^^^^^^^^^^
None

Changes in 0.7.a.2
------------------

Bugfixes
^^^^^^^^
- Fix server revival bug
- Remove print statement from Connection on connection failure

Features
^^^^^^^^
- Add an import() method for UUIDs to CassandraUtil to convert binary UUID
representations back into UUID objects

Deprecated
^^^^^^^^^^^^
None

Changes in 0.7.a1
-----------------
Initial release
16 changes: 16 additions & 0 deletions library/phpcassa/INSTALLING
@@ -0,0 +1,16 @@
Using the C Extension
---------------------

The C extension is crucial for phpcassa's performance.

You need to configure and make to be able to use the C extension.

cd thrift/ext/thrift_protocol
phpize
./configure
make
sudo make install

Add the following line to your php.ini file:

extension=thrift_protocol.so
19 changes: 19 additions & 0 deletions library/phpcassa/LICENSE
@@ -0,0 +1,19 @@
http://www.opensource.org/licenses/mit-license.php

Copyright (c) 2010, 2011 Tyler Hobbs

Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
78 changes: 78 additions & 0 deletions library/phpcassa/README.mkd
@@ -0,0 +1,78 @@
phpcassa
========
phpcassa is a PHP client library for [Apache Cassandra](http://cassandra.apache.org).

* Compatible with Cassandra 0.7
* Port of [pycassa](http://github.com/pycassa/pycassa)
* Support for TBinaryProtocolAccelerated (uses a C extension)

Documentation
-------------

While this README includes some useful information, the official and more
thorough documentation can be found here:

[http://thobbs.github.com/phpcassa](http://thobbs.github.com/phpcassa)

Opening Connections
-------------------

$conn = new Connection('Keyspace1');

or

$servers[0]['host'] = '127.0.0.1';
$servers[0]['port'] = '9160';
$conn = new Connection('Keyspace1', $servers);

Create a column family object
-----------------------------

$users = new ColumnFamily($conn, 'Standard1'); // ColumnFamily
$super = new ColumnFamily($conn, 'Super1'); // SuperColumnFamily

Inserting
---------

$users->insert('key', array('column1' => 'value1', 'column2' => 'value2'));

Querying
--------

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

Removing
--------

$users->remove('key1'); // removes whole row
$users->remove('key1', 'column1'); // removes 'column1'

Other
-----

$users->get_count('key1'); // counts the number of columns in row 'key1'
$users->get_range('key1', 'key9'); // gets all rows with keys between '1' and '9'

Using the C Extension
---------------------

The C extension is crucial for phpcassa's performance.

You need to configure and make to be able to use the C extension.

cd thrift/ext/thrift_protocol
phpize
./configure
make
sudo make install

Add the following line to your php.ini file:

extension=thrift_protocol.so

Getting Help
------------

* Mailing list: [phpcassa on google groups](http://groups.google.com/group/phpcassa)
* IRC: Channel #cassandra on irc.freenode.net

0 comments on commit c0ea6ac

Please sign in to comment.