Class BlobWriteSessionConfigs
BlobWriteSessionConfig
s.
There are several strategies which can be used to upload a Blob
to Google Cloud
Storage. This class provides factories which allow you to select the appropriate strategy for
your workload.
Strategy | Factory Method(s) | Description | Retry Support | Transports Supported | Cloud Storage API used | Considerations |
---|---|---|---|---|---|---|
Default (Chunk based upload) | getDefault() |
Buffer up to a configurable amount of bytes in memory, write to Cloud Storage when
full or close. Buffer size is configurable via
DefaultBlobWriteSessionConfig.withChunkSize(int)
|
Each chunk is retried up to the limitations specified in
ServiceOptions.getRetrySettings()
|
gRPC | Resumable Upload | The network will only be used for the following operations:
|
Buffer to disk then upload |
Buffer bytes to a temporary file on disk. On close()
upload the entire files contents to Cloud Storage. Delete the temporary file.
|
Upload the file in the fewest number of RPC possible retrying within the limitations
specified in ServiceOptions.getRetrySettings()
|
gRPC | Resumable Upload |
|
|
Journal to disk while uploading | journaling(Collection<Path>) |
Create a Resumable Upload Session, before transmitting bytes to Cloud Storage write to a recovery file on disk. If the stream to Cloud Storage is interrupted with a retryable error query the offset of the Resumable Upload Session, then open the recovery file from the offset and transmit the bytes to Cloud Storage. | gRPC | Resumable Upload |
|
- Since:
- 2.26.0 This new api is in preview and is subject to breaking changes.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic BufferToDiskThenUpload
bufferToDiskThenUpload
(Path path) Create a newBlobWriteSessionConfig
which will first buffer the content of the object to a temporary file under the specifiedpath
.static BufferToDiskThenUpload
bufferToDiskThenUpload
(Collection<Path> paths) Create a newBlobWriteSessionConfig
which will first buffer the content of the object to a temporary file under one of the specifiedpaths
.static BlobWriteSessionConfig
Create a newBlobWriteSessionConfig
which will first buffer the content of the object to a temporary file underjava.io.tmpdir
.Factory to produce the default configuration for uploading an object to Cloud Storage.journaling
(Collection<Path> paths) Create a newBlobWriteSessionConfig
which will journal writes to a temporary file under one of the specifiedpaths
before transmitting the bytes to Cloud Storage.
-
Method Details
-
getDefault
Factory to produce the default configuration for uploading an object to Cloud Storage.Configuration of the chunk size can be performed via
DefaultBlobWriteSessionConfig.withChunkSize(int)
.- Since:
- 2.26.0 This new api is in preview and is subject to breaking changes.
- See Also:
-
bufferToTempDirThenUpload
Create a newBlobWriteSessionConfig
which will first buffer the content of the object to a temporary file underjava.io.tmpdir
.Once the file on disk is closed, the entire file will then be uploaded to Cloud Storage.
- Throws:
IOException
- Since:
- 2.26.0 This new api is in preview and is subject to breaking changes.
- See Also:
-
bufferToDiskThenUpload
Create a newBlobWriteSessionConfig
which will first buffer the content of the object to a temporary file under the specifiedpath
.Once the file on disk is closed, the entire file will then be uploaded to Cloud Storage.
- Throws:
IOException
- Since:
- 2.26.0 This new api is in preview and is subject to breaking changes.
- See Also:
-
bufferToDiskThenUpload
@BetaApi public static BufferToDiskThenUpload bufferToDiskThenUpload(Collection<Path> paths) throws IOException Create a newBlobWriteSessionConfig
which will first buffer the content of the object to a temporary file under one of the specifiedpaths
.Once the file on disk is closed, the entire file will then be uploaded to Cloud Storage.
The specifics of how the work is spread across multiple paths is undefined and subject to change.
- Throws:
IOException
- Since:
- 2.26.0 This new api is in preview and is subject to breaking changes.
- See Also:
-
journaling
Create a newBlobWriteSessionConfig
which will journal writes to a temporary file under one of the specifiedpaths
before transmitting the bytes to Cloud Storage.The specifics of how the work is spread across multiple paths is undefined and subject to change.
- Since:
- 2.27.0 This new api is in preview and is subject to breaking changes.
- See Also:
-