SequoiaDB
 All Classes Files Functions Variables Pages
Public Member Functions | List of all members
SequoiaDomain Class Reference

Public Member Functions

 alter (array|string $options)
 
 addGroups (array|string $options)
 
 setGroups (array|string $options)
 
 removeGroups (array|string $options)
 
 setAttributes (array|string $options)
 
 listCS (array|string $condition=null, array|string $selector=null, array|string $orderBy=null, array|string $hint=null)
 
 listCL (array|string $condition=null, array|string $selector=null, array|string $orderBy=null, array|string $hint=null)
 
 listGroup (array|string $condition=null, array|string $selector=null, array|string $orderBy=null, array|string $hint=null)
 

Detailed Description

SequoiaDomain Class. To get this Class object must be call SequoiaDB::getDomain.

Member Function Documentation

SequoiaDomain::addGroups ( array|string  $options)

Alter the current domain to add groups.

Parameters
$optionsan array or the string argument. The options user wants to alter.
Groups: The list of replica group names which the domain is going to add.
eg:
array( 'Groups' => array( 'group1', 'group2', 'group3' ) )
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $domainObj -> addGroups( array( 'Groups' => array( 'group1', 'group2', 'group3' ) ) ) ;
if( $err['errno'] != 0 ) {
echo "Failed to call alter, error code: ".$err['errno'] ;
return ;
}
SequoiaDomain::alter ( array|string  $options)

Alter the current domain.

Parameters
$optionsan array or the string argument. The options user wants to alter.
Groups: The list of replica group names which the domain is going to contain.
eg:
array( 'Groups' => array( 'group1', 'group2', 'group3' ) )
it means that domain changes to contain "group1", "group2" or "group3".
We can add or remove groups in current domain. However, if a group has data
in it, remove it out of domain will be failing.
AutoSplit: Alter current domain to have the ability of automatically split or not.
If this option is set to be true, while creating collection(ShardingType is "hash") in this domain,
the data of this collection will be split(hash split) into all the groups in this domain automatically.
However, it will not automatically split data into those groups which were add into this domain later.
eg:
array( 'Groups' => array( 'group1', 'group2', 'group3' ), 'AutoSplit' => true )
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $domainObj -> alter( array( 'Groups' => array( 'group1', 'group2', 'group3' ), 'AutoSplit' => true ) ) ;
if( $err['errno'] != 0 ) {
echo "Failed to call alter, error code: ".$err['errno'] ;
return ;
}
SequoiaDomain::listCL ( array|string  $condition = null,
array|string  $selector = null,
array|string  $orderBy = null,
array|string  $hint = null 
)

List the collections in domain.

Parameters
$conditionan array or the string argument. This parameter is reserved and must be null.
$selectoran array or the string argument. This parameter is reserved and must be null.
$orderByan array or the string argument. This parameter is reserved and must be null.
$hintan array or the string argument. This parameter is reserved and must be null.
Returns
Returns a new SequoiaCursor object.
Return values
SequoiaCursorObject

Example:

$cursor = $domainObj -> listCL() ;
if( empty( $cursor ) ) {
$err = $db -> getLastErrorMsg() ;
echo "Failed to call listCL, error code: ".$err['errno'] ;
return ;
}
while( $record = $cursor -> next() ) {
var_dump( $record ) ;
}
SequoiaDomain::listCS ( array|string  $condition = null,
array|string  $selector = null,
array|string  $orderBy = null,
array|string  $hint = null 
)

List the collection spaces in domain.

Parameters
$conditionan array or the string argument. This parameter is reserved and must be null.
$selectoran array or the string argument. This parameter is reserved and must be null.
$orderByan array or the string argument. This parameter is reserved and must be null.
$hintan array or the string argument. This parameter is reserved and must be null.
Returns
Returns a new SequoiaCursor object.
Return values
SequoiaCursorObject

Example:

$cursor = $domainObj -> listCS() ;
if( empty( $cursor ) ) {
$err = $db -> getLastErrorMsg() ;
echo "Failed to call listCS, error code: ".$err['errno'] ;
return ;
}
while( $record = $cursor -> next() ) {
var_dump( $record ) ;
}
SequoiaDomain::listGroup ( array|string  $condition = null,
array|string  $selector = null,
array|string  $orderBy = null,
array|string  $hint = null 
)

List the groups in domain.

Parameters
$conditionan array or the string argument. This parameter is reserved and must be null.
$selectoran array or the string argument. This parameter is reserved and must be null.
$orderByan array or the string argument. This parameter is reserved and must be null.
$hintan array or the string argument. This parameter is reserved and must be null.
Returns
Returns a new SequoiaCursor object.
Return values
SequoiaCursorObject

Example:

$cursor = $domainObj -> listGroup() ;
if( empty( $cursor ) ) {
$err = $db -> getLastErrorMsg() ;
echo "Failed to call listGroup, error code: ".$err['errno'] ;
return ;
}
while( $record = $cursor -> next() ) {
var_dump( $record ) ;
}
SequoiaDomain::removeGroups ( array|string  $options)

Alter the current domain to remove groups.

Parameters
$optionsan array or the string argument. The options user wants to alter.
Groups: The list of replica group names which the domain is going to remove.
eg:
array( 'Groups' => array( 'group1', 'group2', 'group3' ) )
If a group has data in it, remove it out of domain will be failing.
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $domainObj -> removeGroups( array( 'Groups' => array( 'group1', 'group2', 'group3' ) ) ) ;
if( $err['errno'] != 0 ) {
echo "Failed to call alter, error code: ".$err['errno'] ;
return ;
}
SequoiaDomain::setAttributes ( array|string  $options)

Alter the current domain.

Parameters
$optionsan array or the string argument. The options user wants to alter.
Groups: The list of replica group names which the domain is going to contain.
eg:
array( 'Groups' => array( 'group1', 'group2', 'group3' ) )
it means that domain changes to contain "group1", "group2" or "group3".
We can add or remove groups in current domain. However, if a group has data
in it, remove it out of domain will be failing.
AutoSplit: Alter current domain to have the ability of automatically split or not.
If this option is set to be true, while creating collection(ShardingType is "hash") in this domain,
the data of this collection will be split(hash split) into all the groups in this domain automatically.
However, it will not automatically split data into those groups which were add into this domain later.
eg:
array( 'Groups' => array( 'group1', 'group2', 'group3' ), 'AutoSplit' => true )
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $domainObj -> setAttributes( array( 'Groups' => array( 'group1', 'group2', 'group3' ), 'AutoSplit' => true ) ) ;
if( $err['errno'] != 0 ) {
echo "Failed to call alter, error code: ".$err['errno'] ;
return ;
}
SequoiaDomain::setGroups ( array|string  $options)

Alter the current domain to set groups.

Parameters
$optionsan array or the string argument. The options user wants to alter.
Groups: The list of replica group names which the domain is going to contain.
eg:
array( 'Groups' => array( 'group1', 'group2', 'group3' ) )
We can add or remove groups in current domain. However, if a group has data
in it, remove it out of domain will be failing.
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $domainObj -> setGroups( array( 'Groups' => array( 'group1', 'group2', 'group3' ) ) ) ;
if( $err['errno'] != 0 ) {
echo "Failed to call alter, error code: ".$err['errno'] ;
return ;
}

The documentation for this class was generated from the following file: