/** \fn BsonDocument GetDetail() * \brief Get the detail information of current group * \return The detail information in BsonDocument object * \exception SequoiaDB.BaseException * \exception System.Exception */ public BsonDocument GetDetail() { BsonDocument matcher = new BsonDocument(); BsonDocument dummyobj = new BsonDocument(); matcher.Add(SequoiadbConstants.FIELD_GROUPNAME, groupName); matcher.Add(SequoiadbConstants.FIELD_GROUPID, groupID); DBCursor cursor = sdb.GetList(SDBConst.SDB_LIST_GROUPS, matcher, dummyobj, dummyobj); if (cursor != null) { BsonDocument detail = cursor.Next(); if (detail != null) { return(detail); } else { throw new BaseException("SDB_CLS_GRP_NOT_EXIST"); } } else { throw new BaseException("SDB_SYS"); } }
private DBCursor ListCSCL(int type) { // append argument BsonDocument matcher = new BsonDocument(); BsonDocument selector = new BsonDocument(); matcher.Add(SequoiadbConstants.FIELD_DOMAIN, this.name); selector.Add(SequoiadbConstants.FIELD_NAME, null); // get cs or cl in current domain DBCursor cursor = this.sdb.GetList(type, matcher, selector, null); return(cursor); }
/** \fn DBCursor ListBackup(BsonDocument options, BsonDocument matcher, * BsonDocument selector, BsonDocument orderBy) * \brief List the backups. * \param 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"} * <ul> * <li>GroupName : Assign the backups of specifed replica groups to be list * <li>Path : Assign the backups in specifed path to be list, if not assign, use the backup path asigned in the configuration file * <li>Name : Assign the backups with specifed name to be list * </ul> * \param matcher The matching rule, return all the documents if null * \param selector The selective rule, return the whole document if null * \param orderBy The ordered rule, never sort if null * \return the DBCursor of the backup or null while having no backup infonation * \exception SequoiaDB.BaseException * \exception System.Exception */ public DBCursor ListBackup(BsonDocument options, BsonDocument matcher, BsonDocument selector, BsonDocument orderBy) { // check argument if (options != null) { foreach (string key in options.Names) { if (key.Equals(SequoiadbConstants.FIELD_GROUPNAME) || key.Equals(SequoiadbConstants.FIELD_NAME) || key.Equals(SequoiadbConstants.FIELD_PATH)) continue; else throw new BaseException("INVALIDARG"); } } // build command string commandString = SequoiadbConstants.ADMIN_PROMPT + SequoiadbConstants.LIST_BACKUP_CMD; // run command SDBMessage rtn = AdminCommand(commandString, matcher, selector, orderBy, options); // check return flag and retrun cursor DBCursor cursor = null; int flags = rtn.Flags; if (flags != 0) { if (flags == SequoiadbConstants.SDB_DMS_EOC) return null; else throw new BaseException(flags); } cursor = new DBCursor(rtn, this); return cursor; }
// constructors /// <summary> /// Initializes a new instance of the MongoCursorEnumerator class. /// </summary> /// <param name="cursor">The cursor to be enumerated.</param> public DBCursorEnumerator(DBCursor <TDocument> cursor) { _cursor = cursor; }
/** \fn DBCursor ListTasks(BsonDocument matcher, BsonDocument selector, BsonDocument orderBy, BsonDocument hint) * \brief List the tasks. * \param matcher The matching rule, return all the documents if null * \param selector The selective rule, return the whole document if null * \param orderBy The ordered rule, never sort if null * \param hint The hint, automatically match the optimal hint if null * \exception SequoiaDB.BaseException * \exception System.Exception */ public DBCursor ListTasks(BsonDocument matcher, BsonDocument selector, BsonDocument orderBy, BsonDocument hint) { // build command string commandString = SequoiadbConstants.ADMIN_PROMPT + SequoiadbConstants.LIST_TASK_CMD; // run command SDBMessage rtn = AdminCommand(commandString, matcher, selector, orderBy, hint); int flags = rtn.Flags; if (flags != 0) { throw new BaseException(flags); } // return the result by cursor DBCursor cursor = null; cursor = new DBCursor(rtn, this); return cursor; }