Interface NitriteStore<Config extends StoreConfig>

Type Parameters:
Config - the type parameter
All Superinterfaces:
AutoCloseable, NitritePlugin
All Known Implementing Classes:
AbstractNitriteStore

public interface NitriteStore<Config extends StoreConfig> extends NitritePlugin
Represents a storage interface for Nitrite database.
Since:
1.0
Author:
Anindya Chatterjee
  • Method Details

    • openOrCreate

      void openOrCreate()
      Opens the store if it exists, or creates a new one if it doesn't.
    • isClosed

      boolean isClosed()
      Checks whether this store is closed.
      Returns:
      true if closed; false otherwise.
    • getCollectionNames

      Set<String> getCollectionNames()
      Returns a set of all collection names in the store.
      Returns:
      a set of all collection names in the store
    • getRepositoryRegistry

      Set<String> getRepositoryRegistry()
      Returns a set of all the repository names registered in the Nitrite store.
      Returns:
      a set of all the repository names registered in the Nitrite store
    • getKeyedRepositoryRegistry

      Map<String,Set<String>> getKeyedRepositoryRegistry()
      Returns a set of all the keyed-repository names registered in the Nitrite store.
      Returns:
      a set of all the keyed-repository names registered in the Nitrite store
    • hasUnsavedChanges

      boolean hasUnsavedChanges()
      Checks if the store has any unsaved changes.
      Returns:
      true if the store has unsaved changes; false otherwise.
    • isReadOnly

      boolean isReadOnly()
      Checks if the store is opened in read-only mode.
      Returns:
      true if the store is read-only; false otherwise.
    • commit

      void commit()
      Commits the changes. For persistent stores, it also writes changes to disk. It does nothing if there are no unsaved changes.
    • beforeClose

      void beforeClose()
      This method is called before closing the store. Any cleanup or finalization tasks should be performed in this method.
    • hasMap

      boolean hasMap(String mapName)
      Checks if a NitriteMap with the given name exists in the store.
      Parameters:
      mapName - the name of the map to check
      Returns:
      true if the map exists, false otherwise
    • openMap

      <Key, Value> NitriteMap<Key,Value> openMap(String mapName, Class<?> keyType, Class<?> valueType)
      Opens a NitriteMap. The map is automatically created if it does not yet exist. If a map with this name is already opened, this map is returned.
      Type Parameters:
      Key - the key type
      Value - the value type
      Parameters:
      mapName - the map name
      keyType - the key type
      valueType - the value type
      Returns:
      the map.
    • closeMap

      void closeMap(String mapName)
      Closes a NitriteMap with the specified name in the store.
      Parameters:
      mapName - the map name
    • removeMap

      void removeMap(String mapName)
      Removes a NitriteMap with the specified name from the store.
      Parameters:
      mapName - the map name to remove.
    • openRTree

      <Key extends BoundingBox, Value> NitriteRTree<Key,Value> openRTree(String rTreeName, Class<?> keyType, Class<?> valueType)
      Opens a NitriteRTree with the given key and value types. The key type must extend the BoundingBox class. Returns a NitriteRTree instance that can be used to perform R-Tree operations on the data.

      RTree is automatically created if it does not yet exist. If a RTree with this name is already open, this RTree is returned.

      Type Parameters:
      Key - the key type
      Value - the value type
      Parameters:
      rTreeName - the RTree name
      keyType - the key type
      valueType - the value type
      Returns:
      the map.
    • closeRTree

      void closeRTree(String rTreeName)
      Closes a NitriteRTree with the specified name in the store.
      Parameters:
      rTreeName - the RTree name
    • removeRTree

      void removeRTree(String rTreeName)
      Removes a NitriteRTree with the specified name from the store.
      Parameters:
      rTreeName - the RTree name to remove.
    • subscribe

      String subscribe(StoreEventListener listener)
      Subscribes a StoreEventListener to this store. The listener will be notified of any changes made to the store.
      Parameters:
      listener - the listener to subscribe
    • unsubscribe

      void unsubscribe(String subscription)
      Unsubscribes a StoreEventListener from this store.
      Parameters:
      subscription - the subscription to unsubscribe
    • getStoreVersion

      String getStoreVersion()
      Gets the underlying storage engine version.
      Returns:
      the store version
    • getStoreConfig

      Config getStoreConfig()
      Gets the store configuration.
      Returns:
      the store config
    • getCatalog

      StoreCatalog getCatalog()
      Gets the store catalog.
      Returns:
      the catalog