Skip to content

Commit

Permalink
More documentation and random cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Giroux committed Jan 14, 2012
1 parent 1ec088d commit 38220be
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 18 deletions.
2 changes: 1 addition & 1 deletion columnfamily_action.php
Expand Up @@ -664,7 +664,7 @@

$vw_vars['current_offset_key'] = $offset_key;

if ($offset_key == '') {
if (empty($offset_key)) {
$_SESSION['browse_data_offset_key'] = array();
$_SESSION['browse_data_offset_key'][] = '';
}
Expand Down
6 changes: 3 additions & 3 deletions counters.php
Expand Up @@ -22,11 +22,11 @@
echo getHTML('header.php');

// Make sure a keyspace name has been specified
if ($keyspace_name == '') {
if (empty($keyspace_name)) {
echo displayErrorMessage('keyspace_name_must_be_specified');
}
else {
if ($columnfamily_name == '') {
if (empty($columnfamily_name)) {
echo displayErrorMessage('columnfamily_name_must_be_specified');
}
else {
Expand All @@ -44,7 +44,7 @@
}

// Error
if (isset($_GET['error']) == 1) {
if (isset($_GET['error'])) {
$vw_vars['error_message'] = displayErrorMessage('something_wrong_happened',array('message' => $_SESSION['message']));
}

Expand Down
4 changes: 2 additions & 2 deletions describe_columnfamily.php
Expand Up @@ -24,11 +24,11 @@
echo getHTML('header.php');

// Make sure a keyspace name has been specified
if ($keyspace_name == '') {
if (empty($keyspace_name)) {
echo displayErrorMessage('keyspace_name_must_be_specified');
}
else {
if ($columnfamily_name == '') {
if (empty($columnfamily_name)) {
echo displayErrorMessage('columnfamily_name_must_be_specified');
}
else {
Expand Down
4 changes: 2 additions & 2 deletions describe_keyspace.php
Expand Up @@ -19,7 +19,7 @@

$vw_vars = array();

if ($keyspace_name == '') {
if (empty($keyspace_name)) {
echo displayErrorMessage('keyspace_name_must_be_specified');
}
else {
Expand All @@ -28,7 +28,7 @@

// CF created successfully
$vw_vars['added_cf'] = '';
if (isset($_GET['create_cf']) == 1) {
if (isset($_GET['create_cf'])) {
$columnfamily_name = $_SESSION['message'];
$query_time = $_SESSION['query_time'];
$vw_vars['added_cf'] = displaySuccessMessage('create_columnfamily',array('columnfamily_name' => $columnfamily_name,'query_time' => $query_time));
Expand Down
11 changes: 11 additions & 0 deletions helper/ClusterHelper.php
Expand Up @@ -11,6 +11,11 @@
class ClusterHelper {
private $cassandra_clusters = array();

/*
Constructor
@param $cassandra_clusters The array of Cassandra nodes to manage
*/
public function __construct($cassandra_clusters) {
$this->cassandra_clusters = $cassandra_clusters;
}
Expand All @@ -28,6 +33,8 @@ public function getClusterIndex() {

/*
Get the name of the cluster at $index
@param $index Index of the cluster name to get
*/
public function getClusterNameForIndex($index) {
try {
Expand All @@ -54,6 +61,8 @@ public function getArrayOfNodesForCurrentCluster() {

/*
Get a random Cassandra node at $index
@param $index Index of the cluster to get a random node from
*/
public function getRandomNodeForIndex($index) {
$all_nodes = $this->cassandra_clusters[$index]['nodes'];
Expand All @@ -71,6 +80,8 @@ public function getRandomNodeForCurrentCluster() {

/*
Get the Cassandra cluster credentials at $index
@param $index Get the specified credentials for the cluster at the specified index
*/
public function getCredentialsForIndex($index) {
$cluster = $this->cassandra_clusters[$index];
Expand Down
16 changes: 16 additions & 0 deletions helper/ColumnFamilyHelper.php
Expand Up @@ -11,6 +11,9 @@
class ColumnFamilyHelper {
/*
Return the column family definition for the specified keyspace name and column family name
@param $keyspace_name The keyspace name that the column family is in
@param $columnfamily_name The column family name to get
*/
public static function getCFInKeyspace($keyspace_name,$columnfamily_name) {
global $sys_manager;
Expand Down Expand Up @@ -66,6 +69,13 @@ public static function getKeyspacesAndColumnFamiliesDetails() {

/*
Display a row out of a column family
@param $row_key The key of the row to display
@param $keyspace_name The keyspace name that row was in
@param $columnfamily_name The column family name that row was in
@param $row The complete row
@param $scf_key The key of the super column family, if it apply
@param $is_counter_column True if the column family is a counter column, false otherwise
*/
public static function displayCFRow($row_key,$keyspace_name,$columnfamily_name,$row,$scf_key = null,$is_counter_column = false) {
$vw_vars['scf_key'] = $scf_key;
Expand All @@ -85,6 +95,12 @@ public static function displayCFRow($row_key,$keyspace_name,$columnfamily_name,$

/*
Display a row out of a super column family
@param $row_key The key of the row to display
@param $keyspace_name The keyspace name that row was in
@param $columnfamily_name The column family name that row was in
@param $row The complete row
@param $is_counter_column True if the column family is a counter column, false otherwise
*/
public static function displaySCFRow($row_key,$keyspace_name,$columnfamily_name,$row,$is_counter_column = false) {
$output = '';
Expand Down

0 comments on commit 38220be

Please sign in to comment.