Class DatabaseInMemory

  • All Implemented Interfaces:
    Database

    public class DatabaseInMemory
    extends Object
    implements Database
    In memory database (no real file operations)
    • Constructor Detail

      • DatabaseInMemory

        public DatabaseInMemory​(ITreeCache cache)
    • Method Detail

      • 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
      • dropIndex

        public void dropIndex​(String name)
        Description copied from interface: Database
        Unregister index from descriptions chain
        Specified by:
        dropIndex in interface Database
      • addIndex

        public void addIndex​(KeyValueStorage kvs,
                             String name)
        Description copied from interface: Database
        Register kvs index (builded on these database) in descriptions chain
        Specified by:
        addIndex in interface Database
        Parameters:
        kvs - index to register
      • 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)
      • getCache

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

        public Engine getEngine()
        Description copied from interface: Database
        Get database internal engine
        Specified by:
        getEngine in interface Database
        Returns:
        database engine
      • 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