public interface RawGcsService
GcsService should be used.
Methods throw IOException for connection errors etc. that are retryable, and other exceptions for bad requests and similar errors that should not be retried.
Implementing classes handle authentication through mechanisms not exposed in this interface.
| Modifier and Type | Interface and Description |
|---|---|
static class |
RawGcsService.ListItemBatch
A batch of list items.
|
static interface |
RawGcsService.RawGcsCreationToken
Immutable token that wraps the information a specific implementation of
RawGcsService needs to write to an object. |
| Modifier and Type | Method and Description |
|---|---|
RawGcsService.RawGcsCreationToken |
beginObjectCreation(GcsFilename filename,
GcsFileOptions options,
long timeoutMillis) |
void |
composeObject(Iterable<String> source,
GcsFilename dest,
long timeoutMillis)
Compose a file from given files.
|
Future<RawGcsService.RawGcsCreationToken> |
continueObjectCreationAsync(RawGcsService.RawGcsCreationToken token,
ByteBuffer chunk,
long timeoutMillis)
Reads all remaining bytes from
chunk and writes them to the object and offset specified
by token asynchronously. |
void |
copyObject(GcsFilename source,
GcsFilename dest,
GcsFileOptions fileOptions,
long timeoutMillis)
Copy source file to dest.
|
boolean |
deleteObject(GcsFilename filename,
long timeoutMillis)
Returns true if deleted, false if not found.
|
void |
finishObjectCreation(RawGcsService.RawGcsCreationToken token,
ByteBuffer chunk,
long timeoutMillis)
Reads all remaining bytes from
chunk and writes them to the object
and offset specified by token, as the final bytes of the object. |
int |
getChunkSizeBytes()
Calls to
continueObjectCreationAsync(RawGcsCreationToken, ByteBuffer, long)
need to pass fixed size chunks. |
int |
getMaxWriteSizeByte()
Returns the max bytes allowed per putObject/finishObject operations.
|
GcsFileMetadata |
getObjectMetadata(GcsFilename filename,
long timeoutMillis)
Returns the meta-data for
filename. |
RawGcsService.ListItemBatch |
list(String bucket,
String prefix,
String delimiter,
String marker,
int maxResults,
long timeoutMillis) |
void |
putObject(GcsFilename filename,
GcsFileOptions options,
ByteBuffer content,
long timeoutMillis)
Create or replace
filename with the given content. |
Future<GcsFileMetadata> |
readObjectAsync(ByteBuffer dst,
GcsFilename filename,
long offset,
long timeoutMillis)
Issues a request to the server to retrieve data to fill the provided buffer.
|
int getChunkSizeBytes()
continueObjectCreationAsync(RawGcsCreationToken, ByteBuffer, long)
need to pass fixed size chunks.
This returns the size expected by the implementation.int getMaxWriteSizeByte()
getChunkSizeBytes().RawGcsService.RawGcsCreationToken beginObjectCreation(GcsFilename filename, GcsFileOptions options, long timeoutMillis) throws IOException
options - null means let Google Cloud Storage use its defaultIOExceptionFuture<RawGcsService.RawGcsCreationToken> continueObjectCreationAsync(RawGcsService.RawGcsCreationToken token, ByteBuffer chunk, long timeoutMillis)
chunk and writes them to the object and offset specified
by token asynchronously.
Returns a future for a new token to be used to continue writing to the object. Does not mutate
token.
The number of bytes remaining in chunk must be a nonzero multiple of
getChunkSizeBytes() and may be subject to an upper limit that is
implementation-dependent.
The calling code is responsible for guaranteeing that the byte sequence written to the object remains identical across retries. (This is because the write may have succeeded on the backend even though an exception was thrown by this method, and writing different data on a retry leaves the object in a bad state.)
void finishObjectCreation(RawGcsService.RawGcsCreationToken token, ByteBuffer chunk, long timeoutMillis) throws IOException
chunk and writes them to the object
and offset specified by token, as the final bytes of the object.
The object will become readable, and further writes will be rejected.
The number of bytes remaining in chunk may be subject to an
upper limit that is implementation-dependent.
On error, does not consume any bytes from chunk. The write may
be retried by making another call with the same token. A whole
sequence of writes may be retried by using a previous token (this is useful
if the calling code crashes and rolls back to an earlier state). In both
cases, the calling code is responsible for guaranteeing that the byte
sequence written to the object remains identical across retries. (This is
because the write may have succeeded on the backend even though an
exception was thrown by this method, and writing different data on a retry
leaves the object in a bad state.)
IOExceptionvoid putObject(GcsFilename filename, GcsFileOptions options, ByteBuffer content, long timeoutMillis) throws IOException
filename with the given content.IOExceptionFuture<GcsFileMetadata> readObjectAsync(ByteBuffer dst, GcsFilename filename, long offset, long timeoutMillis)
offset may not be negative.GcsFileMetadata getObjectMetadata(GcsFilename filename, long timeoutMillis) throws IOException
filename.IOExceptionboolean deleteObject(GcsFilename filename, long timeoutMillis) throws IOException
IOExceptionvoid composeObject(Iterable<String> source, GcsFilename dest, long timeoutMillis) throws IOException
IOExceptionvoid copyObject(GcsFilename source, GcsFilename dest, GcsFileOptions fileOptions, long timeoutMillis) throws IOException
IOExceptionRawGcsService.ListItemBatch list(String bucket, String prefix, String delimiter, String marker, int maxResults, long timeoutMillis) throws IOException
IOExceptionCopyright © 2016 Google. All rights reserved.