Package org.dizitart.no2.store
Interface NitriteStore<Config extends StoreConfig>
- Type Parameters:
Config- the type parameter
- All Superinterfaces:
AutoCloseable,NitritePlugin
- All Known Implementing Classes:
AbstractNitriteStore
Represents a storage interface for Nitrite database.
- Since:
- 1.0
- Author:
- Anindya Chatterjee
-
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is called before closing the store.voidCloses aNitriteMapwith the specified name in the store.voidcloseRTree(String rTreeName) Closes aNitriteRTreewith the specified name in the store.voidcommit()Commits the changes.Gets the store catalog.Returns a set of all collection names in the store.Returns a set of all the keyed-repository names registered in the Nitrite store.Returns a set of all the repository names registered in the Nitrite store.Gets the store configuration.Gets the underlying storage engine version.booleanChecks if aNitriteMapwith the given name exists in the store.booleanChecks if the store has any unsaved changes.booleanisClosed()Checks whether this store is closed.booleanChecks if the store is opened in read-only mode.<Key,Value>
NitriteMap<Key,Value> Opens aNitriteMap.voidOpens the store if it exists, or creates a new one if it doesn't.<Key extends BoundingBox,Value>
NitriteRTree<Key,Value> Opens aNitriteRTreewith the given key and value types.voidRemoves aNitriteMapwith the specified name from the store.voidremoveRTree(String rTreeName) Removes aNitriteRTreewith the specified name from the store.subscribe(StoreEventListener listener) Subscribes aStoreEventListenerto this store.voidunsubscribe(String subscription) Unsubscribes aStoreEventListenerfrom this store.Methods inherited from interface org.dizitart.no2.common.module.NitritePlugin
close, initialize
-
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:
trueif closed;falseotherwise.
-
getCollectionNames
Returns a set of all collection names in the store.- Returns:
- a set of all collection names in the store
-
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
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:
trueif the store has unsaved changes;falseotherwise.
-
isReadOnly
boolean isReadOnly()Checks if the store is opened in read-only mode.- Returns:
trueif the store is read-only;falseotherwise.
-
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
Checks if aNitriteMapwith 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
Opens aNitriteMap. 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 typeValue- the value type- Parameters:
mapName- the map namekeyType- the key typevalueType- the value type- Returns:
- the map.
-
closeMap
Closes aNitriteMapwith the specified name in the store.- Parameters:
mapName- the map name
-
removeMap
Removes aNitriteMapwith 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 aNitriteRTreewith the given key and value types. The key type must extend theBoundingBoxclass. Returns aNitriteRTreeinstance 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 typeValue- the value type- Parameters:
rTreeName- the RTree namekeyType- the key typevalueType- the value type- Returns:
- the map.
-
closeRTree
Closes aNitriteRTreewith the specified name in the store.- Parameters:
rTreeName- the RTree name
-
removeRTree
Removes aNitriteRTreewith the specified name from the store.- Parameters:
rTreeName- the RTree name to remove.
-
subscribe
Subscribes aStoreEventListenerto this store. The listener will be notified of any changes made to the store.- Parameters:
listener- the listener to subscribe
-
unsubscribe
Unsubscribes aStoreEventListenerfrom 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
-