region != null) { blobStore = ((RegionScopedBlobStoreContext) context) .getBlobStore(region);
protected void checkRegionId(String regionId) { checkArgument(getConfiguredRegions().contains(checkNotNull(regionId, "regionId was null")), "region %s not in %s", regionId, getConfiguredRegions()); }
@Override public BlobRequestSigner getSigner() { return getSigner(implicitRegionId.get()); }
IOException { RegionScopedBlobStoreContext ctx = RegionScopedBlobStoreContext.class.cast(view); for (String regionId : ctx.getConfiguredRegions()) { BlobStore region = ctx.getBlobStore(regionId); PageSet<? extends StorageMetadata> containers = region.list(); if (containers.isEmpty()) { final HttpClient client = ctx.utils().http(); .contentMD5(input.hash(Hashing.md5()).asBytes()) .contentType(MediaType.OCTET_STREAM.toString()).build(); BlobRequestSigner signer = ctx.getSigner(regionId); HttpResponse response; try {
protected BlobStore getBlobStore() { RegionScopedBlobStoreContext ctx = RegionScopedBlobStoreContext.class.cast(view); return ctx.getBlobStore(ctx.getConfiguredRegions().iterator().next()); }
@Override public String toString() { return delegate().toString(); }
/** * @param regionId * valid region id from {@link #getConfiguredRegions()} * @throws IllegalArgumentException * if {@code regionId} was invalid. */ public BlobStore getBlobStore(String regionId) { checkRegionId(regionId); return blobStore.apply(regionId); }
@Test public void testListBlobs() throws InterruptedException, ExecutionException { RegionScopedBlobStoreContext ctx = RegionScopedBlobStoreContext.class.cast(view); for (String regionId : ctx.getConfiguredRegions()) { ctx.getBlobStore(regionId).list(); } }
@Override public String toString() { return delegate().toString(); }
/** * @param regionId * valid region id from {@link #getConfiguredRegions()} * @throws IllegalArgumentException * if {@code regionId} was invalid. */ public BlobRequestSigner getSigner(String regionId) { checkRegionId(regionId); return blobRequestSigner.apply(regionId); }
@Override public BlobStore getBlobStore() { return getBlobStore(implicitRegionId.get()); }
@Test public void testLocationsMatch() { RegionScopedBlobStoreContext ctx = RegionScopedBlobStoreContext.class.cast(view); for (String regionId : ctx.getConfiguredRegions()) { Set<? extends Location> locations = ctx.getBlobStore(regionId).listAssignableLocations(); assertEquals(locations.size(), 1, "expected one region " + regionId + " " + locations); Location location = locations.iterator().next(); assertEquals(location.getId(), regionId, "region id " + regionId + " didn't match getId(): " + location); } }
@Override public String toString() { return delegate().toString(); }
protected void checkRegionId(String regionId) { checkArgument(getConfiguredRegions().contains(checkNotNull(regionId, "regionId was null")), "region %s not in %s", regionId, getConfiguredRegions()); }
@Override public BlobRequestSigner getSigner() { return getSigner(implicitRegionId.get()); }
/** * @param regionId * valid region id from {@link #getConfiguredRegions()} * @throws IllegalArgumentException * if {@code regionId} was invalid. */ public BlobStore getBlobStore(String regionId) { checkRegionId(regionId); return blobStore.apply(regionId); }
@Override public BlobStore getBlobStore() { return getBlobStore(implicitRegionId.get()); }
@Override public boolean equals(Object obj) { return delegate().equals(obj); }
protected void checkRegionId(String regionId) { checkArgument(getConfiguredRegions().contains(checkNotNull(regionId, "regionId was null")), "region %s not in %s", regionId, getConfiguredRegions()); }
@Override public BlobRequestSigner getSigner() { return getSigner(implicitRegionId.get()); }