A builder for an MVStore.
| Methods |
| static MVStore.Builder |
fromString(String s)
Read the configuration from a string.
|
| static MVStore.Builder |
fromString(String s)
Read the configuration from a string.
Parameters:
s - the string representation
Returns:
the builder
|
|
Builder()
Creates new instance of MVStore.Builder.
|
|
Builder()
Creates new instance of MVStore.Builder.
|
| MVStore.Builder |
autoCommitBufferSize(int kb)
Set the size of the write buffer, in KB disk space (for file-based
stores).
|
| MVStore.Builder |
autoCommitBufferSize(int kb)
Set the size of the write buffer, in KB disk space (for file-based
stores). Unless auto-commit is disabled, changes are automatically
saved if there are more than this amount of changes.
The default is 1024 KB.
When the value is set to 0 or lower, data is not automatically
stored.
Parameters:
kb - the write buffer size, in kilobytes
Returns:
this
|
| MVStore.Builder |
autoCommitDisabled()
Disable auto-commit, by setting the auto-commit delay and auto-commit
buffer size to 0.
|
| MVStore.Builder |
autoCommitDisabled()
Disable auto-commit, by setting the auto-commit delay and auto-commit
buffer size to 0.
Returns:
this
|
| MVStore.Builder |
autoCompactFillRate(int percent)
Set the auto-compact target fill rate.
|
| MVStore.Builder |
autoCompactFillRate(int percent)
Set the auto-compact target fill rate. If the average fill rate (the
percentage of the storage space that contains active data) of the
chunks is lower, then the chunks with a low fill rate are re-written.
Also, if the percentage of empty space between chunks is higher than
this value, then chunks at the end of the file are moved. Compaction
stops if the target fill rate is reached.
The default value is 40 (40%). The value 0 disables auto-compacting.
Parameters:
percent - the target fill rate
Returns:
this
|
| MVStore.Builder |
backgroundExceptionHandler(Thread.UncaughtExceptionHandler exceptionHandler)
Set the listener to be used for exceptions that occur when writing in
the background thread.
|
| MVStore.Builder |
backgroundExceptionHandler(Thread.UncaughtExceptionHandler exceptionHandler)
Set the listener to be used for exceptions that occur when writing in
the background thread.
Parameters:
exceptionHandler - the handler
Returns:
this
|
| MVStore.Builder |
cacheConcurrency(int concurrency)
Set the read cache concurrency.
|
| MVStore.Builder |
cacheConcurrency(int concurrency)
Set the read cache concurrency. The default is 16, meaning 16
segments are used.
Parameters:
concurrency - the cache concurrency
Returns:
this
|
| MVStore.Builder |
cacheSize(int mb)
Set the read cache size in MB.
|
| MVStore.Builder |
cacheSize(int mb)
Set the read cache size in MB. The default is 16 MB.
Parameters:
mb - the cache size in megabytes
Returns:
this
|
| MVStore.Builder |
compress()
Compress data before writing using the LZF algorithm.
|
| MVStore.Builder |
compress()
Compress data before writing using the LZF algorithm. This will save
about 50% of the disk space, but will slow down read and write
operations slightly.
This setting only affects writes; it is not necessary to enable
compression when reading, even if compression was enabled when
writing.
Returns:
this
|
| MVStore.Builder |
compressHigh()
Compress data before writing using the Deflate algorithm.
|
| MVStore.Builder |
compressHigh()
Compress data before writing using the Deflate algorithm. This will
save more disk space, but will slow down read and write operations
quite a bit.
This setting only affects writes; it is not necessary to enable
compression when reading, even if compression was enabled when
writing.
Returns:
this
|
| MVStore.Builder |
encryptionKey(char[] password)
Encrypt / decrypt the file using the given password.
|
| MVStore.Builder |
encryptionKey(char[] password)
Encrypt / decrypt the file using the given password. This method has
no effect for in-memory stores. The password is passed as a
char array so that it can be cleared as soon as possible. Please note
there is still a small risk that password stays in memory (due to
Java garbage collection). Also, the hashed encryption key is kept in
memory as long as the file is open.
Parameters:
password - the password
Returns:
this
|
| MVStore.Builder |
fileName(String fileName)
Use the following file name.
|
| MVStore.Builder |
fileName(String fileName)
Use the following file name. If the file does not exist, it is
automatically created. The parent directory already must exist.
Parameters:
fileName - the file name
Returns:
this
|
| MVStore.Builder |
fileStore(FileStore store)
Use the provided file store instead of the default one.
|
| MVStore.Builder |
fileStore(FileStore store)
Use the provided file store instead of the default one.
File stores passed in this way need to be open. They are not closed
when closing the store.
Please note that any kind of store (including an off-heap store) is
considered a "persistence", while an "in-memory store" means objects
are not persisted and fully kept in the JVM heap.
Parameters:
store - the file store
Returns:
this
|
| MVStore |
open()
Open the store.
|
| MVStore |
open()
Open the store.
Returns:
the opened store
|
| MVStore.Builder |
pageSplitSize(int pageSplitSize)
Set the amount of memory a page should contain at most, in bytes,
before it is split.
|
| MVStore.Builder |
pageSplitSize(int pageSplitSize)
Set the amount of memory a page should contain at most, in bytes,
before it is split. The default is 16 KB for persistent stores and 4
KB for in-memory stores. This is not a limit in the page size, as
pages with one entry can get larger. It is just the point where pages
that contain more than one entry are split.
Parameters:
pageSplitSize - the page size
Returns:
this
|
| MVStore.Builder |
readOnly()
Open the file in read-only mode.
|
| MVStore.Builder |
readOnly()
Open the file in read-only mode. In this case, a shared lock will be
acquired to ensure the file is not concurrently opened in write mode.
If this option is not used, the file is locked exclusively.
Please note a store may only be opened once in every JVM (no matter
whether it is opened in read-only or read-write mode), because each
file may be locked only once in a process.
Returns:
this
|
| String |
toString()
|
| String |
toString()
|