Package com.exasol.bucketfs
Interface Bucket
-
- All Superinterfaces:
ReadOnlyBucket,UnsynchronizedBucket
- All Known Implementing Classes:
SyncAwareBucket
public interface Bucket extends UnsynchronizedBucket
Interface for accessing BucketFS buckets.
-
-
Field Summary
-
Fields inherited from interface com.exasol.bucketfs.UnsynchronizedBucket
SUPPORTED_ARCHIVE_EXTENSIONS
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanisObjectSynchronized(String pathInBucket, BucketFsMonitor.State state)Check if the object with the given path is marked as synchronized after a given point in time.voiduploadFile(Path localPath, String pathInBucket)Upload a file to the bucket.voiduploadInputStream(Supplier<InputStream> inputStreamSupplier, String pathInBucket)Upload the contents of an input stream to the bucket.voiduploadStringContent(String content, String pathInBucket)Upload the contents of a string to the bucket.-
Methods inherited from interface com.exasol.bucketfs.ReadOnlyBucket
downloadFile, downloadFileAsString, getBucketFsName, getBucketName, getFullyQualifiedBucketName, getReadPassword, listContents, listContents, listContentsRecursively, listContentsRecursively
-
Methods inherited from interface com.exasol.bucketfs.UnsynchronizedBucket
deleteFileNonBlocking, getWritePassword, setUploadNecessityCheckStrategy, uploadFileNonBlocking, uploadInputStreamNonBlocking, uploadStringContentNonBlocking
-
-
-
-
Method Detail
-
isObjectSynchronized
boolean isObjectSynchronized(String pathInBucket, BucketFsMonitor.State state) throws BucketAccessException
Check if the object with the given path is marked as synchronized after a given point in time.The timestamp helps telling subsequent synchronizations appart.
- Parameters:
pathInBucket- path to the object inside the bucketstate- state after which the synchronization needs to happen.- Returns:
trueif the object is synchronized- Throws:
BucketAccessException- if the object at the reference does not exist or is inaccessible
-
uploadFile
void uploadFile(Path localPath, String pathInBucket) throws BucketAccessException, TimeoutException, FileNotFoundException
Upload a file to the bucket.Upload a file from a given local path to a URI pointing to a BucketFS bucket. If the bucket URI ends in a slash, that URI is interpreted as a directory inside the bucket and the original filename is appended.
This call blocks until the uploaded file is synchronized in BucketFS or a timeout occurs.
- Parameters:
pathInBucket- path inside the bucketlocalPath- path of the file to be uploaded- Throws:
TimeoutException- if the synchronization check takes too longBucketAccessException- if the file cannot be uploaded to the given URIFileNotFoundException- if the source file is not found
-
uploadStringContent
void uploadStringContent(String content, String pathInBucket) throws InterruptedException, BucketAccessException, TimeoutException
Upload the contents of a string to the bucket.This method is intended for writing small objects in BucketFS dynamically like for example configuration files. For large payload use
uploadFile(Path, String)instead.This call blocks until the uploaded file is synchronized in BucketFS or a timeout occurs.
- Parameters:
content- string to writepathInBucket- path inside the bucket- Throws:
InterruptedException- if the upload is interruptedBucketAccessException- if the file cannot be uploaded to the given URITimeoutException- if synchronization takes too long
-
uploadInputStream
void uploadInputStream(Supplier<InputStream> inputStreamSupplier, String pathInBucket) throws BucketAccessException, TimeoutException
Upload the contents of an input stream to the bucket.- Parameters:
inputStreamSupplier- supplier that provides the input streampathInBucket- path inside the bucket- Throws:
BucketAccessException- if the file cannot be uploaded to the given URITimeoutException- if synchronization takes too long
-
-