Package com._1c.g5.v8.bm.store
Interface IBmPersistentStringStore
- All Superinterfaces:
AutoCloseable
,Closeable
String to byte array persistent key-value store.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the store.long
Gets the size of the store, in bytes.keys()
Gets all the keys in the store asIterable
.<T> T
read
(String key, IBmPersistentStoreReaderCallback<T> callback) Reads data associated with the specified key.boolean
Removes data assoicated with the specified key.boolean
Checks if the store requires compacting.void
start()
Starts the store.void
Writes the specified data to store and associates with the specified key.void
Writes the specified piece of binary data and associates it with the specified ID.
-
Method Details
-
start
Starts the store.- Throws:
IOException
- if any I/O error occurs.
-
close
Closes the store. Once store closed, it cannot be started again.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
- if any I/O error occurs.
-
read
Reads data associated with the specified key. If the data exist the callback is invoked.- Parameters:
key
- The key. May not benull
.callback
- The callback. May not benull
.- Returns:
- the result returned by callback or
null
if there are no data associated with the specified key. - Throws:
IOException
- if any I/O error occurs.
-
write
Writes the specified data to store and associates with the specified key.- Parameters:
key
- The key. May not benull
.data
- The byte array containing the data. May not benull
.- Throws:
IOException
- if any I/O error occurs.
-
write
Writes the specified piece of binary data and associates it with the specified ID.- Parameters:
key
- The key. May not benull
.data
- The byte array containing the data. May not benull
.offset
- The offset of the data within the array.length
- The length of the data.- Throws:
IOException
- if any I/O error occurs.
-
remove
Removes data assoicated with the specified key.- Parameters:
key
- The key. May not benull
.- Returns:
true
if there were data associated with the specified key,false
otherwise.- Throws:
IOException
- if any I/O error occurs.
-
keys
Gets all the keys in the store asIterable
.- Returns:
- an instance of
Iterable
, nevernull
.
-
getStoreSize
Gets the size of the store, in bytes.- Returns:
- The size of the store, in bytes. Cannot be negative.
- Throws:
IOException
- if any I/O error occurs.
-
requiresCompacting
Checks if the store requires compacting.- Returns:
true
if the store requires compacting,false
otherwise.- Throws:
IOException
- if any I/O error occurs.
-