Interface StoreSystem

  • All Known Implementing Classes:
    V1FileStoreSystem, V1HeapStoreSystem

    interface StoreSystem
    An object that creates and manages the Store objects that the database engine uses to represent itself on an external medium such as a disk, and that constitute the low level persistent data format.

    This interface is an abstraction of the database persistence layer. For example, an implementation could represent itself as 1 file per store on a disk, or as a number of stores in a single file, or as an entirely in-memory database.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean closeStore​(Store store)
      Closes a store that has been either created or opened with the 'createStore' or 'openStore' methods.
      Store createStore​(java.lang.String name)
      Creates and returns a new persistent Store object given the unique name of the store.
      boolean deleteStore​(Store store)
      Permanently deletes a store from the system - use with care! Returns true if the store was successfully deleted and the resources associated with it were freed.
      void lock​(java.lang.String lock_name)
      Attempts to lock this store system exclusively so that no other process may access or change the persistent data in the store.
      Store openStore​(java.lang.String name)
      Opens an existing persistent Store object in the system and returns the Store object that contains its data.
      void setCheckPoint()
      Sets a new check point at the current state of this store system.
      boolean storeExists​(java.lang.String name)
      Returns true if the store with the given name exists within the system, or false otherwise.
      void unlock​(java.lang.String lock_name)
      Unlocks the exclusive access to the persistent store objects.
    • Method Detail

      • storeExists

        boolean storeExists​(java.lang.String name)
        Returns true if the store with the given name exists within the system, or false otherwise.
      • createStore

        Store createStore​(java.lang.String name)
        Creates and returns a new persistent Store object given the unique name of the store. If the system is read-only or the table otherwise can not be created then an exception is thrown.

        At the most, you should assume that this will return an implementation of AbstractStore but you should not be assured of this fact.

        Parameters:
        name - a unique identifier string representing the name of the store.
      • openStore

        Store openStore​(java.lang.String name)
        Opens an existing persistent Store object in the system and returns the Store object that contains its data. An exception is thrown if the store can not be opened.

        At the most, you should assume that this will return an implementation of AbstractStore but you should not be assured of this fact.

        Parameters:
        name - a unique identifier string representing the name of the store.
      • closeStore

        boolean closeStore​(Store store)
        Closes a store that has been either created or opened with the 'createStore' or 'openStore' methods. Returns true if the store was successfully closed.
      • deleteStore

        boolean deleteStore​(Store store)
        Permanently deletes a store from the system - use with care! Returns true if the store was successfully deleted and the resources associated with it were freed. Returns false if the store could not be deleted. Note that it is quite likely that a store may fail to delete in which case the delete operation should be re-tried after a short timeout.
      • setCheckPoint

        void setCheckPoint()
        Sets a new check point at the current state of this store system. This is intended to help journalling check point and recovery systems. A check point is set whenever data is committed to the database. Some systems can be designed to be able to roll forward or backward to different check points. Each check point represents a stable state in the database life cycle.

        A checkpoint based system greatly improves stability because if a crash occurs in an intermediate state the changes can simply be rolled back to the last stable state.

        An implementation may choose not to implement check points in which case this would be a no-op.

      • lock

        void lock​(java.lang.String lock_name)
           throws java.io.IOException
        Attempts to lock this store system exclusively so that no other process may access or change the persistent data in the store. If this fails to lock, an IOException is generated, otherwise the lock is obtained and the method returns.
        Throws:
        java.io.IOException
      • unlock

        void unlock​(java.lang.String lock_name)
             throws java.io.IOException
        Unlocks the exclusive access to the persistent store objects. After this method completes, access to the store system by other processes is allowed.
        Throws:
        java.io.IOException