示例#1
0
    def __init__(self):
        """create a new collection.

      Exceptions:
         pysequoiadb.error.SDBBaseError
      """
        try:
            self._cl = sdb.create_cl()
        except SystemError:
            raise SDBSystemError("Failed to alloc collection", const.SDB_OOM)
示例#2
0
    def __init__(self):
        """invoked when a new object is producted.

        Exceptions:
           pysequoiadb.error.SDBBaseError
        """
        # 'cs' is short for collection space
        try:
            self._cs = sdb.create_cs()
        except SystemError:
            raise SDBSystemError(SDB_OOM, "Failed to alloc collection space")
示例#3
0
    def __init__(self):
        """constructor of cursor

        Exceptions:
           pysequoiadb.error.SDBBaseError
        """
        self._cursor = None
        try:
            self._cursor = sdb.create_cursor()
        except SystemError:
            raise SDBSystemError(SDB_OOM, "Failed to alloc cursor")
示例#4
0
    def __init__(self, client):
        """constructor of replica node

        Exceptions:
           pysequoiadb.error.SDBBaseError
        """
        self._client = client
        try:
            self._node = sdb.create_node()
        except SystemError:
            raise SDBSystemError(SDB_OOM, "Failed to alloc node")
示例#5
0
    def __init__(self, domain_name):
        """constructor of domain

        Exceptions:
           pysequoiadb.error.SDBBaseError
        """
        self._domain_name = domain_name
        self._domain = None
        try:
            self._domain = sdb.create_domain()
        except SystemError:
            raise SDBSystemError(SDB_OOM, "Failed to alloc cursor")
示例#6
0
def _raise_if_error(msg, rc):
    """Check return value, raise a SDBBaseError if error occurred.
   """
    if const.SDB_OK != rc:
        try:
            _ = get_info(rc)
        except KeyError:
            raise SDBUnknownError(msg)

        if rc in io_error:
            raise SDBIOError(msg, rc)
        elif rc in net_error:
            raise SDBNetworkError(msg, rc)
        elif rc in invalid_error:
            raise InvalidParameter(msg, rc)
        elif rc in system_error:
            raise SDBSystemError(msg, rc)
        else:
            raise SDBError(msg, rc)
示例#7
0
 def __init__(self) :
    try:
       self._handle = sdb.create_lob()
    except SystemError:
       raise SDBSystemError("Failed to create lob", const.SDB_OOM)