Class DatabaseImpl

  • All Implemented Interfaces:
    Database

    public class DatabaseImpl
    extends Object
    implements Database
    Database impletemtation: store&manage list of indexes
    • Constructor Detail

      • DatabaseImpl

        @Deprecated
        public DatabaseImpl()
        Deprecated.
      • DatabaseImpl

        public DatabaseImpl​(Engine engine,
                            ITreeCache cache,
                            boolean lazySync,
                            boolean openTest)
    • Method Detail

      • getIndex

        public KeyValueStorage getIndex​(String name)
        Description copied from interface: Database
        Get registered index by name
        Specified by:
        getIndex in interface Database
        Parameters:
        name - index name
        Returns:
        index or null (if it doesn't registered)
      • addIndex

        public void addIndex​(KeyValueStorage kvs,
                             String name)
        Insert kvs into descriptors
        Specified by:
        addIndex in interface Database
        Parameters:
        kvs - index to insert
        name - new index name
      • dropIndex

        public void dropIndex​(String name)
        Remove index from descriptors
        Specified by:
        dropIndex in interface Database
        Parameters:
        name - name of removing index
      • getEngine

        public Engine getEngine()
        Description copied from interface: Database
        Get database internal engine
        Specified by:
        getEngine in interface Database
        Returns:
        database engine
      • setEngine

        public void setEngine​(Engine engine)
      • getCache

        public ITreeCache getCache()
        Description copied from interface: Database
        Get database internal cache
        Specified by:
        getCache in interface Database
        Returns:
        database cache
      • setLastDescriptor

        public void setLastDescriptor​(IndexDescriptor lastDescriptor)
      • sync

        public void sync()
        Description copied from interface: Database
        Sync complete database to file(s)
        Specified by:
        sync in interface Database
      • close

        public void close()
        Description copied from interface: Database
        Close database (with sync and correct close resources)
        Specified by:
        close in interface Database
      • detachStorage

        public void detachStorage()
        Description copied from interface: Database
        Close file descriptors, used by databse
        Specified by:
        detachStorage in interface Database
      • attachStorage

        public void attachStorage()
        Description copied from interface: Database
        Reopen file descriptors, used by database
        Specified by:
        attachStorage in interface Database
      • getNextSegmentId

        public int getNextSegmentId()
        Description copied from interface: Database
        Get first free (in these database) segment id. Method mark segment as used
        Specified by:
        getNextSegmentId in interface Database
        Returns:
        free segment id
      • getIndexCount

        public int getIndexCount()
        Description copied from interface: Database
        Get total number of registered index
        Specified by:
        getIndexCount in interface Database
        Returns:
      • drop

        public void drop()
        Description copied from interface: Database
        Drop database (drop caches, detach and delete files)
        Specified by:
        drop in interface Database
      • getOpenState

        public int getOpenState()
        Description copied from interface: Database
        Get database open status
        Specified by:
        getOpenState in interface Database
        Returns:
        database OPEN_STATE