Package io.permazen.kv.xodus
Class XodusKVDatabase
java.lang.Object
io.permazen.kv.xodus.XodusKVDatabase
- All Implemented Interfaces:
KVDatabase
KVDatabase
view of an Xodus database.
A database directory is the only required configuration property. Instances may be stopped and (re)started multiple times.
Transactions implement XodusKVTransaction.readOnlySnapshot()
.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreate a new transaction.createTransaction
(Map<String, ?> options) Create a new transaction with the specified options.protected void
finalize()
Finalize this instance.Get the filesystem directory containing the database.jetbrains.exodus.env.Environment
Get the underlyingEnvironment
associated with this instance.jetbrains.exodus.env.EnvironmentConfig
Get theEnvironmentConfig
that will be used when creating the associatedEnvironment
.Get the Xodus store name to use.void
setDirectory
(File directory) Configure the filesystem directory containing the database.void
setEnvironmentConfig
(jetbrains.exodus.env.EnvironmentConfig config) Set theEnvironmentConfig
to be used when creating the associatedEnvironment
.void
setStoreName
(String storeName) Set the Xodus store name to use.void
start()
Start this instance.void
stop()
Stop this instance.toString()
-
Field Details
-
DEFAULT_STORE_NAME
Default Xodus store name ("permazen"). -
log
-
-
Constructor Details
-
XodusKVDatabase
public XodusKVDatabase()
-
-
Method Details
-
getDirectory
Get the filesystem directory containing the database.- Returns:
- database directory
-
setDirectory
Configure the filesystem directory containing the database. Required property.- Parameters:
directory
- database directory- Throws:
IllegalStateException
- if this instance is alreadystart()
ed
-
getStoreName
Get the Xodus store name to use.- Returns:
- configured store name
-
setStoreName
Set the Xodus store name to use.Default value is
DEFAULT_STORE_NAME
.- Parameters:
storeName
- store name- Throws:
IllegalStateException
- if this instance is alreadystart()
edIllegalArgumentException
- ifstoreName
is null
-
getEnvironmentConfig
public jetbrains.exodus.env.EnvironmentConfig getEnvironmentConfig()Get theEnvironmentConfig
that will be used when creating the associatedEnvironment
.- Returns:
- environment config
-
setEnvironmentConfig
public void setEnvironmentConfig(jetbrains.exodus.env.EnvironmentConfig config) Set theEnvironmentConfig
to be used when creating the associatedEnvironment
.Default value is
EnvironmentConfig.DEFAULT
.- Parameters:
config
- environment config- Throws:
IllegalStateException
- if this instance is alreadystart()
edIllegalArgumentException
- ifconfig
is null
-
getEnvironment
public jetbrains.exodus.env.Environment getEnvironment()Get the underlyingEnvironment
associated with this instance.- Returns:
- the associated
Environment
- Throws:
IllegalStateException
- if this instance is notstart()
ed
-
start
@PostConstruct public void start()Description copied from interface:KVDatabase
Start this instance. This method must be called prior to creating any transactions.This method is idempotent: if this instance is already started, nothing happens.
Whether an instance that has been started and stopped can be restarted is implementation-dependent.
- Specified by:
start
in interfaceKVDatabase
-
stop
@PreDestroy public void stop()Description copied from interface:KVDatabase
Stop this instance.This method is idempotent: if this instance has not been started, or is already stopped, nothing happens.
- Specified by:
stop
in interfaceKVDatabase
-
createTransaction
Description copied from interface:KVDatabase
Create a new transaction.- Specified by:
createTransaction
in interfaceKVDatabase
- Returns:
- newly created transaction
-
createTransaction
Description copied from interface:KVDatabase
Create a new transaction with the specified options.- Specified by:
createTransaction
in interfaceKVDatabase
- Parameters:
options
- optional transaction options; may be null- Returns:
- newly created transaction
-
finalize
Finalize this instance. Invokesstop()
to close any unclosed iterators. -
toString
-