public class Sequoiadb extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
Sequoiadb.SptEvalResult |
static class |
Sequoiadb.SptReturnType |
| 构造器和说明 |
|---|
Sequoiadb(List<String> connStrings,
String username,
String password,
ConfigOptions options) |
Sequoiadb(String addr,
int port,
String username,
String password) |
Sequoiadb(String addr,
int port,
String username,
String password,
ConfigOptions options) |
Sequoiadb(String username,
String password) |
Sequoiadb(String connString,
String username,
String password) |
Sequoiadb(String connString,
String username,
String password,
ConfigOptions options) |
public static final int SDB_PAGESIZE_4K
public static final int SDB_PAGESIZE_8K
public static final int SDB_PAGESIZE_16K
public static final int SDB_PAGESIZE_32K
public static final int SDB_PAGESIZE_64K
public static final int SDB_PAGESIZE_DEFAULT
public static final int SDB_LIST_CONTEXTS
public static final int SDB_LIST_CONTEXTS_CURRENT
public static final int SDB_LIST_SESSIONS
public static final int SDB_LIST_SESSIONS_CURRENT
public static final int SDB_LIST_COLLECTIONS
public static final int SDB_LIST_COLLECTIONSPACES
public static final int SDB_LIST_STORAGEUNITS
public static final int SDB_LIST_GROUPS
public static final int SDB_LIST_STOREPROCEDURES
public static final int SDB_LIST_DOMAINS
public static final int SDB_LIST_TASKS
public static final int SDB_LIST_CS_IN_DOMAIN
public static final int SDB_LIST_CL_IN_DOMAIN
public static final int SDB_SNAP_CONTEXTS
public static final int SDB_SNAP_CONTEXTS_CURRENT
public static final int SDB_SNAP_SESSIONS
public static final int SDB_SNAP_SESSIONS_CURRENT
public static final int SDB_SNAP_COLLECTIONS
public static final int SDB_SNAP_COLLECTIONSPACES
public static final int SDB_SNAP_DATABASE
public static final int SDB_SNAP_SYSTEM
public static final int SDB_SNAP_CATALOG
public static final int FMP_FUNC_TYPE_INVALID
public static final int FMP_FUNC_TYPE_JS
public static final int FMP_FUNC_TYPE_C
public static final int FMP_FUNC_TYPE_JAVA
public Sequoiadb(String username, String password) throws BaseException
username - the user's name of the accountpassword - the password of the accountBaseException - "SDB_NETWORK" means network error,
"SDB_INVALIDARG" means wrong address or the address don't map to the hosts tablepublic Sequoiadb(String connString, String username, String password) throws BaseException
connString - remote server address "IP : Port" or "IP"(port is 50000)username - the user's name of the accountpassword - the password of the accountBaseException - "SDB_NETWORK" means network error,
"SDB_INVALIDARG" means wrong address or the address don't map to the hosts tablepublic Sequoiadb(String connString, String username, String password, ConfigOptions options) throws BaseException
connString - remote server address "IP : Port" or "IP"(port is 11810)username - the user's name of the accountpassword - the password of the accountoptions - the options for connectionBaseException - "SDB_NETWORK" means network error,
"SDB_INVALIDARG" means wrong address or the address don't map to the hosts tablepublic Sequoiadb(List<String> connStrings, String username, String password, ConfigOptions options) throws BaseException
connStrings - The array of the coord's addressusername - the user's name of the accountpassword - the password of the accountoptions - the options for connectionBaseException - "SDB_NETWORK" means network error,
"SDB_INVALIDARG" means wrong address or the address don't map to the hosts table in local computerpublic Sequoiadb(String addr, int port, String username, String password) throws BaseException
addr - the address of coordport - the port of coordusername - the user's name of the accountpassword - the password of the accountBaseException - "SDB_NETWORK" means network error,
"SDB_INVALIDARG" means wrong address or the address don't map to the hosts tablepublic Sequoiadb(String addr, int port, String username, String password, ConfigOptions options) throws BaseException
addr - the address of coordport - the port of coordusername - the user's name of the accountpassword - the password of the accountBaseException - "SDB_NETWORK" means network error,
"SDB_INVALIDARG" means wrong address or the address don't map to the hosts tablepublic IConnection getConnection()
public ServerAddress getServerAddress()
public void setServerAddress(ServerAddress serverAddress)
serverAddress - the serverAddress object of remote serverpublic boolean isEndianConvert()
public void createUser(String username, String password) throws BaseException
username - The connection user namepassword - The connection passwordBaseExceptionpublic void removeUser(String username, String password) throws BaseException
username - The connection user namepassword - The connection passwordBaseExceptionpublic void disconnect()
throws BaseException
BaseExceptionpublic boolean isValid()
throws BaseException
BaseExceptionpublic void changeConnectionOptions(ConfigOptions opts) throws BaseException
opts - The connection optionsBaseExceptionpublic CollectionSpace createCollectionSpace(String csName) throws BaseException
csName - The collection space nameBaseExceptionpublic CollectionSpace createCollectionSpace(String csName, int pageSize) throws BaseException
csName - The name of collection spacepageSize - The Page Size as below:
BaseExceptionpublic CollectionSpace createCollectionSpace(String csName, BSONObject options) throws BaseException
csName - The name of collection spaceoptions - Contains configuration informations for create collection space. The options are as below:
BaseExceptionpublic void dropCollectionSpace(String csName) throws BaseException
csName - The collection space nameBaseExceptionpublic CollectionSpace getCollectionSpace(String csName) throws BaseException
csName - The collection space name.BaseExceptionpublic boolean isCollectionSpaceExist(String csName) throws BaseException
csName - The collecion space nameBaseExceptionpublic DBCursor listCollectionSpaces() throws BaseException
BaseExceptionpublic ArrayList<String> getCollectionSpaceNames() throws BaseException
BaseExceptionpublic DBCursor listCollections() throws BaseException
BaseExceptionpublic ArrayList<String> getCollectionNames() throws BaseException
BaseExceptionpublic ArrayList<String> getStorageUnits() throws BaseException
BaseExceptionpublic void resetSnapshot()
throws BaseException
BaseExceptionpublic DBCursor getList(int listType, BSONObject query, BSONObject selector, BSONObject orderBy) throws BaseException
listType - The list type as below:
query - The matching rule, match all the documents if null.selector - The selective rule, return the whole document if null.orderBy - The ordered rule, never sort if null.BaseExceptionpublic void flushConfigure(BSONObject param) throws BaseException
param - The param of flush, pass {"Global":true} or {"Global":false}
In cluster environment, passing {"Global":true} will flush data's and catalog's configuration file,
while passing {"Global":false} will flush coord's configuration file
In stand-alone environment, both them have the same behaviourBaseExceptionpublic void execUpdate(String sql) throws BaseException
sql - the SQL command.BaseExceptionpublic DBCursor exec(String sql) throws BaseException
sql - the SQL commandBaseExceptionpublic DBCursor getSnapshot(int snapType, String matcher, String selector, String orderBy) throws BaseException
snapType - The snapshot types are as below:
matcher - the matching rule, match all the documents if nullselector - the selective rule, return the whole document if nullorderBy - the ordered rule, never sort if nullBaseExceptionpublic DBCursor getSnapshot(int snapType, BSONObject matcher, BSONObject selector, BSONObject orderBy) throws BaseException
snapType - The snapshot types are as below:
matcher - the matching rule, match all the documents if nullselector - the selective rule, return the whole document if nullorderBy - the ordered rule, never sort if nullBaseExceptionpublic void beginTransaction()
throws BaseException
BaseExceptionpublic void commit()
throws BaseException
BaseExceptionpublic void rollback()
throws BaseException
BaseExceptionpublic void crtJSProcedure(String code) throws BaseException
code - The code of store procedureBaseExceptionpublic void rmProcedure(String name) throws BaseException
name - The name of store procedure to be removedBaseExceptionpublic DBCursor listProcedures(BSONObject condition) throws BaseException
condition - The condition of list eg: {"name":"sum"}BaseExceptionpublic Sequoiadb.SptEvalResult evalJS(String code) throws BaseException
code - The javasript codeBaseExceptionpublic void backupOffline(BSONObject options) throws BaseException
options - Contains a series of backup configuration infomations.
Backup the whole cluster if null. The "options" contains 5 options as below.
All the elements in options are optional.
eg: {"GroupName":["rgName1", "rgName2"], "Path":"/opt/sequoiadb/backup",
"Name":"backupName", "Description":description, "EnsureInc":true, "OverWrite":true}
BaseExceptionpublic DBCursor listBackup(BSONObject options, BSONObject matcher, BSONObject selector, BSONObject orderBy) throws BaseException
options - Contains configuration infomations for remove backups, list all the backups in the default backup path if null.
The "options" contains 3 options as below. All the elements in options are optional.
eg: {"GroupName":["rgName1", "rgName2"], "Path":"/opt/sequoiadb/backup", "Name":"backupName"}
matcher - The matching rule, return all the documents if nullselector - The selective rule, return the whole document if nullorderBy - The ordered rule, never sort if nullBaseExceptionpublic void removeBackup(BSONObject options) throws BaseException
options - Contains configuration infomations for remove backups, remove all the backups in the default backup path if null.
The "options" contains 3 options as below. All the elements in options are optional.
eg: {"GroupName":["rgName1", "rgName2"], "Path":"/opt/sequoiadb/backup", "Name":"backupName"}
BaseExceptionpublic DBCursor listTasks(BSONObject matcher, BSONObject selector, BSONObject orderBy, BSONObject hint) throws BaseException
matcher - The matching rule, return all the documents if nullselector - The selective rule, return the whole document if nullorderBy - The ordered rule, never sort if nullhint - The hint, automatically match the optimal hint if nullBaseExceptionpublic void waitTasks(long[] taskIDs)
throws BaseException
taskIDs - The array of task idBaseExceptionpublic void cancelTask(long taskID,
boolean isAsync)
throws BaseException
taskID - The task idisAsync - The operation "cancel task" is async or not,
"true" for async, "false" for sync. Default sync.BaseExceptionpublic void setSessionAttr(BSONObject options) throws BaseException
options - The configuration options for the current session.The options are as below:
BaseExceptionpublic void closeAllCursors()
throws BaseException
BaseExceptionpublic DBCursor listReplicaGroups() throws BaseException
BaseExceptionpublic boolean isDomainExist(String domainName) throws BaseException
domainName - the name of domainBaseExceptionpublic Domain createDomain(String domainName, BSONObject options) throws BaseException
domainName - The name of the creating domainoptions - The options for the domain. The options are as below:
BaseExceptionpublic void dropDomain(String domainName) throws BaseException
domainName - the name of the domainBaseExceptionpublic Domain getDomain(String domainName) throws BaseException
domainName - the name of the domainBaseException - If the domain not exit, throw BaseException with the error type "SDB_CAT_DOMAIN_NOT_EXIST"public DBCursor listDomains(BSONObject matcher, BSONObject selector, BSONObject orderBy, BSONObject hint) throws BaseException
matcher - the matching rule, return all the documents if nullselector - the selective rule, return the whole document if nullorderBy - the ordered rule, never sort if nullhint - the hint, automatically match the optimal hint if nullBaseExceptionpublic ArrayList<String> getReplicaGroupNames() throws BaseException
BaseExceptionpublic ArrayList<String> getReplicaGroupsInfo() throws BaseException
BaseExceptionpublic ReplicaGroup getReplicaGroup(String rgName) throws BaseException
rgName - replica group's nameBaseExceptionpublic ReplicaGroup getReplicaGroup(int rgId) throws BaseException
rgId - replica group idBaseExceptionpublic ReplicaGroup createReplicaGroup(String rgName) throws BaseException
rgName - replica group's nameBaseExceptionpublic void removeReplicaGroup(String rgName) throws BaseException
rgName - replica group's nameBaseExceptionpublic void activateReplicaGroup(String rgName) throws BaseException
rgName - replica group nameBaseExceptionCopyright © 2015. All Rights Reserved.