StateStoreRecordOperationsStateStoreFileImpl, StateStoreFileSystemImplpublic abstract class StateStoreFileBaseImpl extends StateStoreSerializableImpl
StateStoreDriver implementation based on files. In this approach, we
use temporary files for the writes and renaming "atomically" to the final
value. Instead of writing to the final location, it will go to a temporary
one and then rename to the final destination.COLON_MARK, SLASH_MARK| Constructor | Description |
|---|---|
StateStoreFileBaseImpl() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Close the State Store driver connection.
|
protected abstract boolean |
exists(java.lang.String path) |
Check if a path exists.
|
<T extends BaseRecord> |
get(java.lang.Class<T> clazz) |
Get all records of the requested record class from the data store.
|
protected abstract java.util.List<java.lang.String> |
getChildren(java.lang.String path) |
Get the children for a path.
|
protected abstract int |
getConcurrentFilesAccessNumThreads() |
|
protected abstract <T extends BaseRecord> |
getReader(java.lang.String path) |
Get the reader of a record for the file system.
|
protected abstract java.lang.String |
getRootDir() |
Get root directory.
|
abstract <T extends BaseRecord> |
getWriter(java.lang.String path) |
Get the writer of a record for the file system.
|
boolean |
initDriver() |
Prepare the driver to access data storage.
|
<T extends BaseRecord> |
initRecordStorage(java.lang.String className,
java.lang.Class<T> recordClass) |
Initialize storage for a single record class.
|
boolean |
isDriverReady() |
Check if the driver is currently running and the data store connection is
valid.
|
static boolean |
isOldTempRecord(java.lang.String pathRecord) |
Check if a record is temporary and old.
|
protected abstract boolean |
mkdir(java.lang.String path) |
Make a directory.
|
<T extends BaseRecord> |
putAll(java.util.List<T> records,
boolean allowUpdate,
boolean errorIfExists) |
Creates multiple records.
|
<T extends BaseRecord> |
remove(java.lang.Class<T> clazz,
Query<T> query) |
Remove multiple records of a specific class that match a query.
|
protected abstract boolean |
remove(java.lang.String path) |
Remove a file.
|
<T extends BaseRecord> |
removeAll(java.lang.Class<T> clazz) |
Remove all records of this class from the store.
|
protected abstract boolean |
rename(java.lang.String src,
java.lang.String dst) |
Rename a file.
|
void |
setInitialized(boolean ini) |
Set the driver as initialized.
|
getOriginalPrimaryKey, getPrimaryKey, init, newRecord, serialize, serializeStringget, getMultiple, put, removegetConf, getIdentifier, getMetrics, getTime, verifyDriverReadyprotected abstract <T extends BaseRecord> java.io.BufferedReader getReader(java.lang.String path)
T - Type of the state store record.path - Path of the record to read.@VisibleForTesting public abstract <T extends BaseRecord> java.io.BufferedWriter getWriter(java.lang.String path)
T - Type of the state store record.path - Path of the record to write.protected abstract boolean exists(java.lang.String path)
path - Path to check.protected abstract boolean mkdir(java.lang.String path)
path - Path of the directory to create.protected abstract boolean rename(java.lang.String src,
java.lang.String dst)
src - Source name.dst - Destination name.protected abstract boolean remove(java.lang.String path)
path - Path for the file to removeprotected abstract java.util.List<java.lang.String> getChildren(java.lang.String path)
path - Path to check.protected abstract java.lang.String getRootDir()
protected abstract int getConcurrentFilesAccessNumThreads()
public void setInitialized(boolean ini)
ini - If the driver is initialized.public boolean initDriver()
StateStoreDriverinitDriver in class StateStoreDriverpublic void close()
throws java.lang.Exception
StateStoreDriverclose in class StateStoreDriverjava.lang.Exception - if something goes wrong while closing the state store driver connection.public <T extends BaseRecord> boolean initRecordStorage(java.lang.String className, java.lang.Class<T> recordClass)
StateStoreDriverinitRecordStorage in class StateStoreDriverT - Type of the state store record.className - String reference of the record class to initialize,
used to construct paths and file names for the record.
Determined by configuration settings for the specific driver.recordClass - Record type corresponding to the provided name.public <T extends BaseRecord> QueryResult<T> get(java.lang.Class<T> clazz) throws java.io.IOException
StateStoreRecordOperationsT - Record class of the records.clazz - Class of record to fetch.java.io.IOException - Throws exception if unable to query the data store.@VisibleForTesting public static boolean isOldTempRecord(java.lang.String pathRecord)
pathRecord - Path for the record to check.public boolean isDriverReady()
StateStoreDriverisDriverReady in class StateStoreDriverpublic <T extends BaseRecord> StateStoreOperationResult putAll(java.util.List<T> records, boolean allowUpdate, boolean errorIfExists) throws StateStoreUnavailableException
StateStoreRecordOperationsT - Record class of the records.records - List of data records to update or create. All records must
be of class clazz.allowUpdate - True if update of exiting record is allowed.errorIfExists - True if an error should be returned when inserting
an existing record. Only used if allowUpdate = false.StateStoreUnavailableExceptionpublic <T extends BaseRecord> int remove(java.lang.Class<T> clazz, Query<T> query) throws StateStoreUnavailableException
StateStoreRecordOperationsT - Record class of the records.clazz - The class to match the records with.query - Query to filter what to remove.StateStoreUnavailableExceptionpublic <T extends BaseRecord> boolean removeAll(java.lang.Class<T> clazz) throws StateStoreUnavailableException
StateStoreRecordOperationsT - Record class of the records.clazz - Class of records to remove.StateStoreUnavailableExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.