public interface GcsService
RetryParams
that were passed to GcsServiceFactory
. This is
used for all of the methods provided by this class. So an RetriesExhaustedException
means
that these have failed. Retry logic is handled internally to this class, because while writing to
the GcsOutputChannel
a request can span the boundaries of segments written to
RawGcsService
. As a result a write call could partly succeed, making error recovery at an
application level next to impossible.
Reading, deleting, and gettingMetadata are all idempotent operations. However for symmetry and
convenience the RetryParams
are applied to these calls as well.Modifier and Type | Method and Description |
---|---|
GcsOutputChannel |
createOrReplace(GcsFilename filename,
GcsFileOptions options)
Creates a new object.
|
void |
createOrReplace(GcsFilename filename,
GcsFileOptions options,
ByteBuffer src)
Creates, writes and closes a new object with a given content.
|
boolean |
delete(GcsFilename filename)
Returns true if deleted, false if not found.
|
GcsFileMetadata |
getMetadata(GcsFilename filename) |
GcsInputChannel |
openPrefetchingReadChannel(GcsFilename filename,
long startPosition,
int blockSizeBytes)
Same as openReadChannel but buffers data in memory and prefetches it before it is required to
attempt to avoid blocking on every read call.
|
GcsInputChannel |
openReadChannel(GcsFilename filename,
long startPosition)
Note that the implementation may check if the file exists during the call to
openReadChannel , or only check it when the first byte is requested. |
GcsOutputChannel createOrReplace(GcsFilename filename, GcsFileOptions options) throws IOException
IOException
void createOrReplace(GcsFilename filename, GcsFileOptions options, ByteBuffer src) throws IOException
createOrReplace(GcsFilename, GcsFileOptions)
and then GcsOutputChannel.write(ByteBuffer)
and GcsOutputChannel.close()
but will try to minimize the underlying RPC calls.IOException
GcsInputChannel openReadChannel(GcsFilename filename, long startPosition) throws IOException
openReadChannel
, or only check it when the first byte is requested.
If buffering is desired openPrefetchingReadChannel should be called instead.IOException
GcsInputChannel openPrefetchingReadChannel(GcsFilename filename, long startPosition, int blockSizeBytes)
GcsFileMetadata getMetadata(GcsFilename filename) throws IOException
filename
- The name of the file that you wish to read the metadata of.IOException
- If for any reason the file can't be read.boolean delete(GcsFilename filename) throws IOException
IOException
Copyright © 2014 Google. All Rights Reserved.