Skip to content
This repository has been archived by the owner on Nov 21, 2017. It is now read-only.

Cassandra utilities and client libraries for php

Notifications You must be signed in to change notification settings

somia/cassandrautilities-abandoned

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Cassandra helper class that encapsulates all thrift api calls and adds good failover, exception handling, backpressure handling and node failure logic to make the api as fault tolerant as possible. It also provides easy and extendable way to log data cassandra operations. This includes both performance tracking and error logging.

Beside the wrapped api calls which enchange exception handling and fail safe, the class has some static helper methods to ease some of the thrift structure creation. Here's an example how to execute a mutation into a super column family.

// Get microsecond timestamp as a 64 bit integer 
$timestamp = Cassandra::get_microtimestamp();
 
$mutation = array();
$mutation[$this->uid]['BlogEntries'][] =
  Cassandra::mutation(
    Cassandra::column_or_super_column(
      Cassandra::super_column(Cassandra::pack_longtype($this->id), // Column names are LongType
        Cassandra::column('content', $utf8_content, $timestamp),
        Cassandra::column('topic', $topic, $timestamp),
        Cassandra::column('uid', $this->uid, $timestamp),
        Cassandra::column('status', $this->status, $timestamp),
        Cassandra::column('stamp', $this->stamp, $timestamp)
      )
    )
  );

// Execute the operation. In case the first node fails with the command
// the operation is automaticly executed into another server 
Cassandra::get_instance()->batch_mutate($mutation);

About

Cassandra utilities and client libraries for php

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published