public class BmcDataStore extends Object implements AutoCloseable
Path references.
Statistics are updated only on successful operations, and not on attempted operations.
| Constructor and Description |
|---|
BmcDataStore(BmcPropertyAccessor propertyAccessor,
com.oracle.bmc.objectstorage.ObjectStorage objectStorage,
String namespace,
String bucket,
FileSystem.Statistics statistics,
OCIMonitorPluginHandler ociMonitorPluginHandler) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static String |
configureParquetCacheString(BmcPropertyAccessor propertyAccessor) |
void |
createDirectory(Path path)
Creates a pseudo directory at the given path.
|
void |
delete(Path path)
Deletes the object at the given path.
|
Future<?> |
deleteDirAsync(Path dir)
Delete an directory using the common delete threadpool and return a future.
|
void |
deleteDirectory(Path path)
Deletes the directory at the given path.
|
Future<?> |
deleteFileAsync(Path path)
Delete an object using the common delete threadpool and return a future.
|
org.apache.commons.lang3.tuple.Pair<List<FileStatus>,String> |
flatListDirectoryRecursive(Path path,
String nextToken)
A method to list all files/dirs in a given directory in a flat manner.
|
long |
getBlockSizeInBytes()
Gets the configured block size in bytes.
|
ContentSummary |
getContentSummary(Path path) |
FileChecksum |
getFileChecksum(Path path) |
FileStatus |
getFileStatus(Path path)
Returns the
FileStatus for the object at the given path. |
FileStatus |
getFileStatus(Path path,
boolean checkOnlyExists) |
static int |
getReadAheadSizeInBytes(BmcPropertyAccessor propertyAccessor) |
int |
getRecursiveDirListingFetchSize() |
boolean |
isDirectory(Path path,
boolean checkOnlyExists)
Checks if the specified path is a directory.
|
boolean |
isEmptyDirectory(Path path)
Tests to see if the directory at the given path is considered empty or not.
|
List<FileStatus> |
listDirectory(Path path)
Returns the status of each entry in the directory specified.
|
static ExecutorService |
newSwingFixedThreadPool(int nThreads,
ThreadFactory threadFactory,
long threadsTimeoutInSeconds)
Creates a thread pool that will be able to swing open threads between 0 to nThreads
If any additional tasks come , they wait in the queue
|
FSInputStream |
openReadStream(FileStatus status,
Path path,
int bufferSizeInBytes,
FileSystem.Statistics statistics)
Creates a new
FSInputStream that can be used to read the object at the given path. |
OutputStream |
openWriteStream(Path path,
int bufferSizeInBytes,
Progressable progress)
Creates a new
OutputStream that can be written to in order to create a new file. |
void |
renameDirectory(Path sourceDirectoryPath,
Path destinationDirectoryPath)
Renames a directory to have a new location or name.
|
void |
renameFile(Path source,
Path destination)
Renames an object from one name to another.
|
public BmcDataStore(BmcPropertyAccessor propertyAccessor, com.oracle.bmc.objectstorage.ObjectStorage objectStorage, String namespace, String bucket, FileSystem.Statistics statistics, OCIMonitorPluginHandler ociMonitorPluginHandler)
public static int getReadAheadSizeInBytes(BmcPropertyAccessor propertyAccessor)
public static ExecutorService newSwingFixedThreadPool(int nThreads, ThreadFactory threadFactory, long threadsTimeoutInSeconds)
nThreads - the number of threads in the poolthreadFactory - the factory to use when creating new threadsthreadsTimeoutInSeconds - timeout Of threads in secondsNullPointerException - if threadFactory is nullIllegalArgumentException - if nThreads <= 0public static String configureParquetCacheString(BmcPropertyAccessor propertyAccessor)
public void renameFile(Path source, Path destination) throws IOException
source - The source to rename, assumed to exist.destination - The destination, may not exist, will be overwrittenIOException - if the operation cannot be completed.public void renameDirectory(Path sourceDirectoryPath, Path destinationDirectoryPath) throws IOException
Note, source and destination should not be root TODO: destination could be?
sourceDirectoryPath - The source directory to rename, assumed to exist.destinationDirectoryPath - The destination directory.IOException - if the operation cannot be completed.public void close()
close in interface AutoCloseablepublic void delete(Path path) throws IOException
path - Path of object to delete.IOException - if the operation cannot be completed.public Future<?> deleteFileAsync(Path path) throws IOException
path - Path of the object to delete asynchronously.IOExceptionpublic Future<?> deleteDirAsync(Path dir) throws IOException
dir - Path of the directory to delete asynchronously.IOExceptionpublic int getRecursiveDirListingFetchSize()
public void deleteDirectory(Path path) throws IOException
path - Path of object to delete.IOException - if the operation cannot be completed.public void createDirectory(Path path) throws IOException
path - The path to create a directory object at.IOException - if the operation cannot be completed.public boolean isEmptyDirectory(Path path) throws IOException
path - The directory path.IOException - if the operation could not be completed.public List<FileStatus> listDirectory(Path path) throws IOException
path - The directory path.IOException - if the operation could not be completedpublic org.apache.commons.lang3.tuple.Pair<List<FileStatus>,String> flatListDirectoryRecursive(Path path, String nextToken) throws IOException
path - The path to the directory for which the listing needs to be done.nextToken - This is the token string in order to continue with a next page of results. It should be
passed null in the first call to start fresh.IOExceptionpublic ContentSummary getContentSummary(Path path) throws IOException
IOExceptionpublic FileStatus getFileStatus(Path path) throws IOException
FileStatus for the object at the given path.path - The path to query.IOException - if the operation could not be completed.public FileStatus getFileStatus(Path path, boolean checkOnlyExists) throws IOException
IOExceptionpublic boolean isDirectory(Path path, boolean checkOnlyExists) throws IOException
path - IOExceptionpublic FSInputStream openReadStream(FileStatus status, Path path, int bufferSizeInBytes, FileSystem.Statistics statistics)
FSInputStream that can be used to read the object at the given path.status - The file status for this file.path - The path to open.bufferSizeInBytes - The buffer size in bytes (may not be used).statistics - The FileSystem.Statistics instance to publish metrics into.public OutputStream openWriteStream(Path path, int bufferSizeInBytes, Progressable progress)
OutputStream that can be written to in order to create a new file.path - The path for the new file.bufferSizeInBytes - The buffer size in bytes can be configured by setting the config key BmcConstants.MULTIPART_PART_SIZE_IN_MB_KEY.
Default value is 128MiB which comes from OCI Java SDK UploadConfigurationprogress - Progressable instance to report progress updates to.public FileChecksum getFileChecksum(Path path) throws IOException
IOExceptionpublic long getBlockSizeInBytes()
Copyright © 2016–2025. All rights reserved.