Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Blob API Doc is confusing #233

Merged
merged 5 commits into from Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -52,12 +52,26 @@
import java.util.concurrent.TimeUnit;

/**
* A Google cloud storage object.
* A Google cloud storage object. A {@code Blob} object includes the {@code BlobId} instance, the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be very careful with the word "object". This is very easy to confuse wit an instance of the Storage class. I suggest using the phrase "an object in Google Cloud Storage" when you mean the bytes on the server rather than "storage object" which sounds like an instance of a class.

The overloading of the word "object" is really annoying. GCS should never have called these things "objects" but that ship, I am afraid, has sailed and we can't fix it here. :-(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

* set of properties inherited from the {@link BlobInfo} class and the {@code Storage} instance. The
* class provides methods to perform operations on the object. Reading a property value does not
* issue any RPC calls. The object content is not stored within the {@code Blob} instance.
* Operations that access the content issue one or multiple RPC calls, depending on the content
* size.
*
* <p>Objects of this class are immutable. Operations that modify the blob like {@link #update} and
* {@link #copyTo} return a new object. To get a {@code Blob} object with the most recent
* information use {@link #reload}. {@code Blob} adds a layer of service-related functionality over
* {@link BlobInfo}.
* {@link #copyTo} return a new object. Any changes to a Storage object made after creation of the
dmitry-fa marked this conversation as resolved.
Show resolved Hide resolved
* {@code Blob} are not visible in the {@code Blob}. To get a {@code Blob} object with the most
* recent information use {@link #reload}.
*
* <p>Example of getting the content of a Storage object:
dmitry-fa marked this conversation as resolved.
Show resolved Hide resolved
*
* <pre>{@code
* BlobId blobId = BlobId.of(bucketName, blobName);
* Blob blob = storage.get(blobId);
* long size = blob.getSize(); // no RPC call is required
* byte[] content = blob.getContent(); // one or multiple RPC calls will be issued
* }</pre>
*/
public class Blob extends BlobInfo {

Expand Down
Expand Up @@ -44,7 +44,21 @@
import java.util.Set;

/**
* Google Storage object metadata.
* Google Storage object information. A {@code BlobInfo} object includes the {@code BlobId} instance
dmitry-fa marked this conversation as resolved.
Show resolved Hide resolved
* and the set of properties, such as the blob's access control configuration, user provided
* metadata, the CRC32C checksum, etc. Instances of this class are used to create a new Storage
dmitry-fa marked this conversation as resolved.
Show resolved Hide resolved
* object or update the properties of an existing object. To deal with existing Storage objects the
* API includes the {@link Blob} class which extends {@code BlobInfo} and declares methods to
* perform operations on the object. Neither {@code BlobInfo} nor {@code Blob} instances keep the
* object content, just the object properties.
*
* <p>Example of usage {@code BlobInfo} to crate a Storage object:
*
* <pre>{@code
* BlobId blobId = BlobId.of(bucketName, blobName);
* BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType("text/plain").build();
* Blob blob = storage.create(blobInfo, "Hello, world".getBytes(StandardCharsets.UTF_8));
* }</pre>
*
* @see <a href="https://cloud.google.com/storage/docs/concepts-techniques#concepts">Concepts and
* Terminology</a>
Expand Down