@Override public void updateBucketInfo(Map<String, String> md) throws IOException { try { String lbi = "bucketinfo/" + EncyptUtils.encHashArchiveName(Main.DSEID, Main.chunkStoreEncryptionEnabled); CloudBlockBlob blob = container.getBlockBlobReference(lbi); blob.downloadAttributes(); blob.setMetadata((HashMap<String, String>) md); blob.uploadText(Long.toString(System.currentTimeMillis())); blob.uploadMetadata(null, null, opContext); } catch (Exception e) { throw new IOException(e); } }
blob = container.getBlockBlobReference(lbi + "-" + System.currentTimeMillis()); blob.setMetadata(md); blob.uploadMetadata(null, null, opContext); } catch (Exception e) { SDFSLogger.getLog().info("unable to create backup of current volume info", e);
ByteArrayInputStream s3IS = new ByteArrayInputStream(chunk); blob.upload(s3IS, chunk.length); blob.uploadMetadata(); return 0; } catch (Exception e) {
blob.setMetadata(metaData); blob.uploadText(Long.toString(System.currentTimeMillis())); blob.uploadMetadata(); container.setMetadata(md); container.uploadMetadata(null, null, opContext);
blob.uploadMetadata(null, null, opContext); metaData = kblob.getMetadata(); metaData.remove("deleted"); metaData.put("suspect", "true"); kblob.setMetadata(metaData); kblob.uploadMetadata(null, null, opContext); e = null; break;
private void doWriteEntry(AzureSegmentArchiveEntry indexEntry, byte[] data, int offset, int size) throws IOException { long msb = indexEntry.getMsb(); long lsb = indexEntry.getLsb(); ioMonitor.beforeSegmentWrite(pathAsFile(), msb, lsb, size); Stopwatch stopwatch = Stopwatch.createStarted(); try { CloudBlockBlob blob = getBlob(getSegmentFileName(indexEntry)); blob.setMetadata(AzureBlobMetadata.toSegmentMetadata(indexEntry)); blob.uploadFromByteArray(data, offset, size); blob.uploadMetadata(); } catch (StorageException e) { throw new IOException(e); } ioMonitor.afterSegmentWrite(pathAsFile(), msb, lsb, size, stopwatch.elapsed(TimeUnit.NANOSECONDS)); }
private void doWriteEntry(AzureSegmentArchiveEntry indexEntry, byte[] data, int offset, int size) throws IOException { long msb = indexEntry.getMsb(); long lsb = indexEntry.getLsb(); ioMonitor.beforeSegmentWrite(pathAsFile(), msb, lsb, size); Stopwatch stopwatch = Stopwatch.createStarted(); try { CloudBlockBlob blob = getBlob(getSegmentFileName(indexEntry)); blob.setMetadata(AzureBlobMetadata.toSegmentMetadata(indexEntry)); blob.uploadFromByteArray(data, offset, size); blob.uploadMetadata(); } catch (StorageException e) { throw new IOException(e); } ioMonitor.afterSegmentWrite(pathAsFile(), msb, lsb, size, stopwatch.elapsed(TimeUnit.NANOSECONDS)); }
bmd.remove("deleted"); blob.setMetadata(bmd); blob.uploadMetadata(null, null, opContext); }catch(Exception e) { SDFSLogger.getLog().warn("unable to update key " +bnm,e);
md.put("port", Integer.toString(Main.sdfsCliPort)); blob.setMetadata(md); blob.uploadMetadata(null, null, opContext); metaData.put("deletedobjects", Integer.toString(delobj)); blob.setMetadata(metaData); blob.uploadMetadata(null, null, opContext); blob.uploadMetadata();
if (clustered) { cblob.setMetadata(metaData); cblob.uploadMetadata(); } else { kblob.setMetadata(metaData); kblob.uploadMetadata();
@Override protected void doPut(String fullPath, ISObject stuff, Map<String, String> attrs) { try { CloudBlockBlob blob = blobContainer.getBlockBlobReference(fullPath); if (!(stuff instanceof SObject.InputStreamSObject)) { blob.upload(stuff.asInputStream(), stuff.getLength()); } BlobProperties props = blob.getProperties(); // content-type contains "-" which is illegal character in C# identifier // so we have to remove it from meta map String contentType = attrs.remove(ISObject.ATTR_CONTENT_TYPE); if (S.notBlank(contentType)) { props.setContentType(contentType); } blob.uploadProperties(); blob.getMetadata().putAll(attrs); blob.uploadMetadata(); } catch (Exception e) { throw E.unexpected(e); } }
blob.uploadMetadata(condition, options, null);
@Test public void testApiVersion() throws InvalidKeyException, StorageException, URISyntaxException { SharedAccessBlobPolicy sp1 = createSharedAccessPolicy( EnumSet.of(SharedAccessBlobPermissions.READ, SharedAccessBlobPermissions.WRITE, SharedAccessBlobPermissions.LIST, SharedAccessBlobPermissions.DELETE), 3600); String sas = this.blob.generateSharedAccessSignature(sp1, null); // should not be appended before signing assertEquals(-1, sas.indexOf(Constants.QueryConstants.API_VERSION)); OperationContext ctx = new OperationContext(); ctx.getResponseReceivedEventHandler().addListener(new StorageEvent<ResponseReceivedEvent>() { @Override public void eventOccurred(ResponseReceivedEvent eventArg) { // should be appended after signing HttpURLConnection conn = (HttpURLConnection) eventArg.getConnectionObject(); assertTrue(conn.getURL().toString().indexOf(Constants.QueryConstants.API_VERSION) != -1); } }); CloudBlockBlob sasBlob = new CloudBlockBlob(new URI(this.blob.getUri().toString() + "?" + sas)); sasBlob.uploadMetadata(null, null, ctx); }
blob.uploadMetadata(AccessCondition.generateIfMatchCondition(currentETag), null, null); blob.uploadMetadata(AccessCondition.generateIfNoneMatchCondition(newETag), null, null); fail("If none match on conditional test should throw"); blob.uploadMetadata(AccessCondition.generateIfMatchCondition(invalidETag), null, null); fail("Invalid ETag on conditional test should throw"); blob.uploadMetadata(AccessCondition.generateIfNoneMatchCondition(invalidETag), null, null); blob.uploadMetadata(AccessCondition.generateIfModifiedSinceCondition(currentModifiedTime), null, null); fail("IfModifiedSince conditional on current modified time should throw"); cal.set(Calendar.MINUTE, cal.get(Calendar.MINUTE) - 5); Date pastTime = cal.getTime(); blob.uploadMetadata(AccessCondition.generateIfModifiedSinceCondition(pastTime), null, null); cal.set(Calendar.HOUR, cal.get(Calendar.HOUR) - 5); pastTime = cal.getTime(); blob.uploadMetadata(AccessCondition.generateIfModifiedSinceCondition(pastTime), null, null); cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) - 5); pastTime = cal.getTime(); blob.uploadMetadata(AccessCondition.generateIfModifiedSinceCondition(pastTime), null, null); pastTime = cal.getTime(); try { blob.uploadMetadata(AccessCondition.generateIfNotModifiedSinceCondition(pastTime), null, null); fail("IfNotModifiedSince conditional on past time should throw");
source.upload(stream, buffer.length); source.getMetadata().put("Test", "value"); source.uploadMetadata();
source.uploadMetadata(); source.uploadMetadata(); source.getProperties().setContentMD5(null); source.uploadText(newData, Constants.UTF8_CHARSET, null, null, null);
source.upload(stream, buffer.length); source.getMetadata().put("Test", "value"); source.uploadMetadata();