Package org.dizitart.no2.mvstore
Class MVStoreModuleBuilder
- java.lang.Object
-
- org.dizitart.no2.mvstore.MVStoreModuleBuilder
-
public class MVStoreModuleBuilder extends Object
The MVStoreModuleBuilder class is responsible for building an instance ofMVStoreModule
. It provides methods to set various configuration options for the MVStore database.- Since:
- 4.0
- Author:
- Anindya Chatterjee
- See Also:
MVStoreModule
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MVStoreModuleBuilder
addStoreEventListener(StoreEventListener listener)
Adds aStoreEventListener
to the module builder.boolean
autoCommit()
Flag to enable/disable auto-commit mode.MVStoreModuleBuilder
autoCommit(boolean autoCommit)
Flag to enable/disable auto-commit mode.int
autoCommitBufferSize()
The size of the buffer used for auto-commit.MVStoreModuleBuilder
autoCommitBufferSize(int autoCommitBufferSize)
The size of the buffer used for auto-commit.MVStoreModule
build()
Builds an instance ofMVStoreModule
with the configured parameters.int
cacheConcurrency()
The read cache concurrency used by MVStore.MVStoreModuleBuilder
cacheConcurrency(int cacheConcurrency)
The read cache concurrency used by MVStore.int
cacheSize()
The size of the read cache in MB used by the MVStore.MVStoreModuleBuilder
cacheSize(int cacheSize)
The size of the read cache in MB used by the MVStore.boolean
compress()
Flag to enable/disable compression of data in MVStore.MVStoreModuleBuilder
compress(boolean compress)
Flag to enable/disable compression of data in MVStore.boolean
compressHigh()
Flag to enable high compression for the MVStore.MVStoreModuleBuilder
compressHigh(boolean compressHigh)
Flag to enable high compression for the MVStore.MVStoreConfig
dbConfig()
The configuration for the MVStore.MVStoreModuleBuilder
dbConfig(MVStoreConfig dbConfig)
The configuration for the MVStore.char[]
encryptionKey()
The encryption key to be used for encrypting the MVStore.MVStoreModuleBuilder
encryptionKey(char[] encryptionKey)
The encryption key to be used for encrypting the MVStore.Set<StoreEventListener>
eventListeners()
Set of event listeners to be registered with the MVStore.String
filePath()
The file path of the MVStore file.MVStoreModuleBuilder
filePath(File file)
Sets the file path for the MVStore.MVStoreModuleBuilder
filePath(String path)
Sets the file path for the MVStore.org.h2.mvstore.FileStore<?>
fileStore()
The file store used by the MVStore.MVStoreModuleBuilder
fileStore(org.h2.mvstore.FileStore<?> fileStore)
The file store used by the MVStore.int
pageSplitSize()
The amount of memory a MVStore page should contain at most, in bytes, before it is split.MVStoreModuleBuilder
pageSplitSize(int pageSplitSize)
The amount of memory a MVStore page should contain at most, in bytes, before it is split.boolean
readOnly()
Indicates whether the MVStore instance should be opened in read-only mode.MVStoreModuleBuilder
readOnly(boolean readOnly)
Indicates whether the MVStore instance should be opened in read-only mode.boolean
recoveryMode()
Indicates whether the MVStore should be opened in recovery mode or not.MVStoreModuleBuilder
recoveryMode(boolean recoveryMode)
Indicates whether the MVStore should be opened in recovery mode or not.
-
-
-
Method Detail
-
filePath
public MVStoreModuleBuilder filePath(File file)
Sets the file path for the MVStore.- Parameters:
file
- the file path for the MVStore.- Returns:
- the MVStoreModuleBuilder instance.
-
filePath
public MVStoreModuleBuilder filePath(String path)
Sets the file path for the MVStore.- Parameters:
path
- the file path for the MVStore.- Returns:
- the MVStoreModuleBuilder instance.
-
addStoreEventListener
public MVStoreModuleBuilder addStoreEventListener(StoreEventListener listener)
Adds aStoreEventListener
to the module builder.- Parameters:
listener
- the listener to be added- Returns:
- the module builder instance
-
build
public MVStoreModule build()
Builds an instance ofMVStoreModule
with the configured parameters.- Returns:
- an instance of
MVStoreModule
.
-
filePath
public String filePath()
The file path of the MVStore file.
-
autoCommitBufferSize
public int autoCommitBufferSize()
The size of the buffer used for auto-commit. When the buffer is full, the changes are automatically committed to the database. The default buffer size is 1024.
-
encryptionKey
public char[] encryptionKey()
The encryption key to be used for encrypting the MVStore.
-
readOnly
public boolean readOnly()
Indicates whether the MVStore instance should be opened in read-only mode.
-
compress
public boolean compress()
Flag to enable/disable compression of data in MVStore.
-
compressHigh
public boolean compressHigh()
Flag to enable high compression for the MVStore. If set to true, the MVStore will use a higher compression level, which may result in slower read and write performance but smaller file size on disk.
-
autoCommit
public boolean autoCommit()
Flag to enable/disable auto-commit mode. If set to true, all changes will be committed immediately. If set to false, changes will be buffered and committed whenNitrite.commit()
is called.
-
recoveryMode
public boolean recoveryMode()
Indicates whether the MVStore should be opened in recovery mode or not.
-
cacheSize
public int cacheSize()
The size of the read cache in MB used by the MVStore. The default value is 16MB.
-
cacheConcurrency
public int cacheConcurrency()
The read cache concurrency used by MVStore. Default is 16 segments.
-
pageSplitSize
public int pageSplitSize()
The amount of memory a MVStore page should contain at most, in bytes, before it is split. The default is 16 KB.
-
fileStore
public org.h2.mvstore.FileStore<?> fileStore()
The file store used by the MVStore.
-
dbConfig
public MVStoreConfig dbConfig()
The configuration for the MVStore.
-
eventListeners
public Set<StoreEventListener> eventListeners()
Set of event listeners to be registered with the MVStore.
-
autoCommitBufferSize
public MVStoreModuleBuilder autoCommitBufferSize(int autoCommitBufferSize)
The size of the buffer used for auto-commit. When the buffer is full, the changes are automatically committed to the database. The default buffer size is 1024.- Returns:
this
.
-
encryptionKey
public MVStoreModuleBuilder encryptionKey(char[] encryptionKey)
The encryption key to be used for encrypting the MVStore.- Returns:
this
.
-
readOnly
public MVStoreModuleBuilder readOnly(boolean readOnly)
Indicates whether the MVStore instance should be opened in read-only mode.- Returns:
this
.
-
compress
public MVStoreModuleBuilder compress(boolean compress)
Flag to enable/disable compression of data in MVStore.- Returns:
this
.
-
compressHigh
public MVStoreModuleBuilder compressHigh(boolean compressHigh)
Flag to enable high compression for the MVStore. If set to true, the MVStore will use a higher compression level, which may result in slower read and write performance but smaller file size on disk.- Returns:
this
.
-
autoCommit
public MVStoreModuleBuilder autoCommit(boolean autoCommit)
Flag to enable/disable auto-commit mode. If set to true, all changes will be committed immediately. If set to false, changes will be buffered and committed whenNitrite.commit()
is called.- Returns:
this
.
-
recoveryMode
public MVStoreModuleBuilder recoveryMode(boolean recoveryMode)
Indicates whether the MVStore should be opened in recovery mode or not.- Returns:
this
.
-
cacheSize
public MVStoreModuleBuilder cacheSize(int cacheSize)
The size of the read cache in MB used by the MVStore. The default value is 16MB.- Returns:
this
.
-
cacheConcurrency
public MVStoreModuleBuilder cacheConcurrency(int cacheConcurrency)
The read cache concurrency used by MVStore. Default is 16 segments.- Returns:
this
.
-
pageSplitSize
public MVStoreModuleBuilder pageSplitSize(int pageSplitSize)
The amount of memory a MVStore page should contain at most, in bytes, before it is split. The default is 16 KB.- Returns:
this
.
-
fileStore
public MVStoreModuleBuilder fileStore(org.h2.mvstore.FileStore<?> fileStore)
The file store used by the MVStore.- Returns:
this
.
-
dbConfig
public MVStoreModuleBuilder dbConfig(MVStoreConfig dbConfig)
The configuration for the MVStore.- Returns:
this
.
-
-