Merge pull request #598 from andrewgaul/transient-unused-methods

Remove unused transient blobstore methods
This commit is contained in:
Adrian Cole 2012-05-01 23:43:36 -07:00
commit 6a61c3cad7
2 changed files with 4 additions and 38 deletions

View File

@ -98,7 +98,7 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient {
}
public ListenableFuture<Boolean> containerExists(final String container) {
return immediateFuture(blobStore.getContainerToBlobs().containsKey(container));
return blobStore.containerExists(container);
}
public ListenableFuture<Boolean> createContainer(String container) {
@ -106,7 +106,7 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient {
}
public ListenableFuture<Boolean> deleteContainerIfEmpty(String container) {
return blobStore.deleteContainerImpl(container);
return blobStore.deleteContainerIfEmpty(container);
}
public ListenableFuture<Boolean> disableCDN(String container) {

View File

@ -282,13 +282,6 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore {
return immediateFuture(null);
}
public ListenableFuture<Blob> removeBlobAndReturnOld(String container, String key) {
if (getContainerToBlobs().containsKey(container)) {
return immediateFuture(getContainerToBlobs().get(container).remove(key));
}
return immediateFuture(null);
}
/**
* {@inheritDoc}
*/
@ -309,7 +302,7 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore {
return immediateFuture(null);
}
public ListenableFuture<Boolean> deleteContainerImpl(final String container) {
public ListenableFuture<Boolean> deleteContainerIfEmpty(final String container) {
Boolean returnVal = true;
if (getContainerToBlobs().containsKey(container)) {
if (getContainerToBlobs().get(container).size() == 0)
@ -362,20 +355,6 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore {
return immediateFuture(Boolean.TRUE);
}
/**
* throws IllegalStateException if the container already exists
*/
public ListenableFuture<Void> createContainerInLocationIfAbsent(final Location location, final String name) {
ConcurrentMap<String, Blob> container = getContainerToBlobs().putIfAbsent(name,
new ConcurrentHashMap<String, Blob>());
if (container == null) {
getContainerToLocation().put(name, location != null ? location : defaultLocation.get());
return immediateFuture((Void) null);
} else {
return Futures.immediateFailedFuture(new IllegalStateException("container " + name + " already exists"));
}
}
public String getFirstQueryOrNull(String string, @Nullable HttpRequestOptions options) {
if (options == null)
return null;
@ -499,19 +478,6 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore {
return immediateFuture(Iterables.getOnlyElement(blob.getAllHeaders().get(HttpHeaders.ETAG)));
}
public ListenableFuture<Blob> putBlobAndReturnOld(String containerName, Blob in) {
ConcurrentMap<String, Blob> container = getContainerToBlobs().get(containerName);
if (container == null) {
return Futures.immediateFailedFuture(new IllegalStateException("containerName not found: " + containerName));
}
Blob blob = createUpdatedCopyOfBlobInContainer(containerName, in);
Blob old = container.put(blob.getMetadata().getName(), blob);
return immediateFuture(old);
}
protected Blob createUpdatedCopyOfBlobInContainer(String containerName, Blob in) {
checkNotNull(in, "blob");
checkNotNull(in.getPayload(), "blob.payload");
@ -674,7 +640,7 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore {
return getContainerToBlobs().containsKey(container);
}
public ConcurrentMap<String, Location> getContainerToLocation() {
private ConcurrentMap<String, Location> getContainerToLocation() {
return containerToLocation;
}