Beispiel #1
0
    def repair(self):
        ''' Attempt to repair a database after setting paranoid checks
        still results in an error.

        :throws DatabaseException: If an error has occurred
        '''
        options = self.get_open_options()

        try:
            error = new_native_string()
            LDB.leveldb_repair_db(options, self.filename, get_reference_to(error))
            self.handle_error(error)
        finally:
            if LDB and options:
                LDB.leveldb_options_destroy(options)
            self.close()
Beispiel #2
0
    def destroy(self):
        ''' Completely blows away the underlying database. This process
        is not reversable.

        :throws DatabaseException: If an error has occurred
        '''
        options = self.get_open_options()

        try:
            error = new_native_string()
            LDB.leveldb_destroy_db(options, self.filename, get_reference_to(error))
            self.handle_error(error)
        finally:
            if LDB and options:
                LDB.leveldb_options_destroy(options)
            self.close()
Beispiel #3
0
    def open(self):
        ''' Creates the neccessary data structures and opens the
        underlying database. To tune the underlying options for the
        database read the following:

        http://docs.basho.com/riak/1.0.0/tutorials/choosing-a-backend/LevelDB/

        :throws DatabaseException: If an error has occurred
        '''
        options = self.get_open_options()

        try:
            error = new_native_string()
            self.database = LDB.leveldb_open(options, self.filename, get_reference_to(error))
            self.handle_error(error)
        finally:
            LDB.leveldb_options_destroy(options)