public class DefaultModelStorage extends Object implements ModelStorage
ModelStorage
that can use any ModelStorageProvider
as a backend storage
system.Constructor and Description |
---|
DefaultModelStorage(ModelStorageProvider storageProvider)
Constructs a new instance of Ignite model storage.
|
Modifier and Type | Method and Description |
---|---|
boolean |
exists(String path)
Returns
true if a regular file or directory exist, otherwise false . |
byte[] |
getFile(String path)
Returns file content.
|
FileStat |
getFileStat(String path)
Returns statistics for file.
|
boolean |
isDirectory(String path)
Returns
true if the specified path associated with a directory. |
boolean |
isFile(String path)
Returns
true if the specified path associated with a regular file. |
Set<String> |
listFiles(String path)
Returns list of files in the specified directory.
|
<T> T |
lockPaths(Supplier<T> supplier,
String... paths)
Locks paths in model storage and call passed method.
|
void |
mkdir(String path,
boolean onlyIfNotExist)
Creates directory.
|
void |
mkdirs(String path)
Creates directory and all required parent directories in the path.
|
void |
putFile(String path,
byte[] data,
boolean onlyIfNotExist)
Creates a new or replaces existing file.
|
void |
remove(String path)
Removes specified directory or file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
mkdir, putFile
public DefaultModelStorage(ModelStorageProvider storageProvider)
storageProvider
- Model storage provider.public void putFile(String path, byte[] data, boolean onlyIfNotExist)
putFile
in interface ModelStorage
path
- Path to file.data
- File content.onlyIfNotExist
- If file already exists throw an exception.public byte[] getFile(String path)
getFile
in interface ModelStorage
path
- Path to file.public void mkdir(String path, boolean onlyIfNotExist)
mkdir
in interface ModelStorage
path
- Path to directory.onlyIfNotExist
- If directory already exists throw an exception.public void mkdirs(String path)
mkdirs
in interface ModelStorage
path
- Path to directory.public Set<String> listFiles(String path)
listFiles
in interface ModelStorage
path
- Path to directory.public void remove(String path)
remove
in interface ModelStorage
path
- Path to directory or file.public boolean exists(String path)
true
if a regular file or directory exist, otherwise false
.exists
in interface ModelStorage
path
- Path to directory or file.true
if a regular file or directory exist, otherwise false
.public boolean isDirectory(String path)
true
if the specified path associated with a directory.isDirectory
in interface ModelStorage
path
- Path to directory or file.true
if the specified path associated with a directory.public boolean isFile(String path)
true
if the specified path associated with a regular file.isFile
in interface ModelStorage
path
- Path to directory or file.true
if the specified path associated with a regular file.public FileStat getFileStat(String path)
getFileStat
in interface ModelStorage
path
- Path to directory or file.public <T> T lockPaths(Supplier<T> supplier, String... paths)
lockPaths
in interface ModelStorage
T
- Type of result.supplier
- Supplier.paths
- Paths for lock.callable
.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024