public class CachedBucket extends CacheEntry
DirectoryListCache to supplement "list" operations with buckets known locally, as well as
serving as the container for retrieving CachedObjects from their respective cached buckets.
Other than direct Bucket creation, a CachedBucket may also come into existence when generating
a CachedObject which inherently implies the existence of its parent bucket. Such an entry may
not have associated GoogleCloudStorageItemInfo available. The caller is responsible for fetching
or updating such stale/nonexistent metadata if it is desired; for name-listing operations,
cached bucket/object names may be used directly without lazily populating associated metadata.| Constructor and Description |
|---|
CachedBucket(GoogleCloudStorageItemInfo bucketItemInfo)
Constructs a CachedBucket with the provided GoogleCloudStorageItemInfo for the bucket.
|
CachedBucket(String bucketName)
Constructs a CachedBucket which has no associated GoogleCloudStorageItemInfo for the bucket.
|
| Modifier and Type | Method and Description |
|---|---|
CacheEntry |
get(StorageResourceId resourceId)
Returns the CacheEntry entry corresponding to
resourceId which must be a StorageObject
residing inside this CachedBucket, or null if one doesn't exist. |
String |
getName()
Returns the name of the Bucket associated with this CachedBucket.
|
int |
getNumObjects() |
List<CacheEntry> |
getObjectList() |
CacheEntry |
put(StorageResourceId resourceId)
Adds a CacheEntry entry to this bucket corresponding to the StorageObject for
resourceId. |
void |
remove(StorageResourceId resourceId)
Removes the CacheEntry entry corresponding to
resourceId which must be a StorageObject
residing inside this CachedBucket, if it exists. |
clearItemInfo, getCreationTimeMillis, getItemInfo, getItemInfoUpdateTimeMillis, getResourceId, setClock, setItemInfopublic CachedBucket(String bucketName)
bucketName - Must be non-null and non-empty.public CachedBucket(GoogleCloudStorageItemInfo bucketItemInfo)
bucketItemInfo - Must be non-null and must correspond to a Bucket.public String getName()
public CacheEntry get(StorageResourceId resourceId)
resourceId which must be a StorageObject
residing inside this CachedBucket, or null if one doesn't exist. The CacheEntry is the shared
reference, so that any mutations to the CacheEntry made by the caller will be reflected
for future callers retrieving the same CacheEntry.resourceId - identifies a StorageObject. Bucket must match this CachedBucket's name.public void remove(StorageResourceId resourceId)
resourceId which must be a StorageObject
residing inside this CachedBucket, if it exists.resourceId - identifies a StorageObject. Bucket must match this CachedBucket's name.public CacheEntry put(StorageResourceId resourceId)
resourceId.resourceId - identifies a StorageObject. Bucket must match this CachedBucket's name.public List<CacheEntry> getObjectList()
public int getNumObjects()
Copyright © 2015. All rights reserved.