/**
  * describe a table, returning the status. 
  * Used to see if it exists.
  * 
  */
 function describeTable()
 {
     $this->response = $this->dynamodb->describe_table(array('TableName' => $this->TableName));
     return $this->response->status;
 }
Exemplo n.º 2
0
 function create_table()
 {
     // Instantiate the class.
     $dynamodb = new AmazonDynamoDB();
     $response = $dynamodb->create_table(array('TableName' => $this->tableName, 'KeySchema' => array('HashKeyElement' => array('AttributeName' => $this->primaryKey, 'AttributeType' => AmazonDynamoDB::TYPE_NUMBER)), 'ProvisionedThroughput' => array('ReadCapacityUnits' => 5, 'WriteCapacityUnits' => 5)));
     // Check for success...
     if ($response->isOK()) {
         // continue
     } else {
         echo '# A ERROR HAS OCCURED<br />';
         print_r($response);
         return false;
     }
     ####################################################################
     # Sleep and poll until the table has been created
     $count = 0;
     do {
         sleep(1);
         $count++;
         $response = $dynamodb->describe_table(array('TableName' => $this->tableName));
     } while ((string) $response->body->Table->TableStatus !== 'ACTIVE');
     return true;
 }