public static byte[] thriftSerialize(TBase t) { return Utils.thriftSerialize(t); }
byte serialized[] = Utils.thriftSerialize(m); ByteBuf ret = alloc.ioBuffer(serialized.length + 4);
public void writeMetadata(String key, SettableBlobMeta meta) throws AuthorizationException, KeyNotFoundException { BlobStoreFileOutputStream mOut = null; try { BlobStoreFile hdfsFile = hbs.write(META_PREFIX + key, false); hdfsFile.setMetadata(meta); mOut = new BlobStoreFileOutputStream(hdfsFile); mOut.write(Utils.thriftSerialize(meta)); mOut.close(); mOut = null; } catch (IOException exp) { throw new RuntimeException(exp); } finally { if (mOut != null) { try { mOut.cancel(); } catch (IOException e) { //Ignored } } } }
try { mOut = new BlobStoreFileOutputStream(fbs.write(META_PREFIX + key, true)); mOut.write(Utils.thriftSerialize(meta)); mOut.close(); mOut = null;
@Override public void setBlobMeta(String key, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyNotFoundException { validateKey(key); checkForBlobOrDownload(key); _aclHandler.normalizeSettableBlobMeta(key, meta, who, ADMIN); BlobStoreAclHandler.validateSettableACLs(key, meta.get_acl()); SettableBlobMeta orig = getStoredBlobMeta(key); _aclHandler.hasPermissions(orig.get_acl(), ADMIN, who, key); BlobStoreFileOutputStream mOut = null; try { mOut = new BlobStoreFileOutputStream(fbs.write(META_PREFIX + key, false)); mOut.write(Utils.thriftSerialize(meta)); mOut.close(); mOut = null; } catch (IOException e) { throw new RuntimeException(e); } finally { if (mOut != null) { try { mOut.cancel(); } catch (IOException e) { //Ignored } } } }
byte[] serializedState = Utils.gzip(Utils.thriftSerialize(st));
st.set_bolts(new HashMap<>()); st.set_state_spouts(new HashMap<>()); byte[] serializedState = Utils.gzip(Utils.thriftSerialize(st));
byte[] serializedState = Utils.gzip(Utils.thriftSerialize(st));
metaFile.setMetadata(meta); mOut = new BlobStoreFileOutputStream(metaFile); mOut.write(Utils.thriftSerialize(meta)); mOut.close(); mOut = null;
public static byte[] thriftSerialize(TBase t) { return Utils.thriftSerialize(t); }
byte serialized[] = Utils.thriftSerialize(m); ChannelBuffer ret = ChannelBuffers.directBuffer(serialized.length + 4);
public void writeMetadata(String key, SettableBlobMeta meta) throws AuthorizationException, KeyNotFoundException { BlobStoreFileOutputStream mOut = null; try { BlobStoreFile hdfsFile = hbs.write(META_PREFIX + key, false); hdfsFile.setMetadata(meta); mOut = new BlobStoreFileOutputStream(hdfsFile); mOut.write(Utils.thriftSerialize(meta)); mOut.close(); mOut = null; } catch (IOException exp) { throw new RuntimeException(exp); } finally { if (mOut != null) { try { mOut.cancel(); } catch (IOException e) { //Ignored } } } }
@Override public AtomicOutputStream createBlob(String key, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyAlreadyExistsException { LOG.debug("Creating Blob for key {}", key); validateKey(key); _aclHandler.normalizeSettableBlobMeta(key, meta, who, allPermissions); BlobStoreAclHandler.validateSettableACLs(key, meta.get_acl()); _aclHandler.hasPermissions(meta.get_acl(), allPermissions, who, key); if (fbs.exists(DATA_PREFIX+key)) { throw new KeyAlreadyExistsException(key); } BlobStoreFileOutputStream mOut = null; try { mOut = new BlobStoreFileOutputStream(fbs.write(META_PREFIX+key, true)); mOut.write(Utils.thriftSerialize(meta)); mOut.close(); mOut = null; return new BlobStoreFileOutputStream(fbs.write(DATA_PREFIX+key, true)); } catch (IOException e) { throw new RuntimeException(e); } finally { if (mOut != null) { try { mOut.cancel(); } catch (IOException e) { //Ignored } } } }
@Override public void setBlobMeta(String key, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyNotFoundException { validateKey(key); checkForBlobOrDownload(key); _aclHandler.normalizeSettableBlobMeta(key, meta, who, ADMIN); BlobStoreAclHandler.validateSettableACLs(key, meta.get_acl()); SettableBlobMeta orig = getStoredBlobMeta(key); _aclHandler.hasPermissions(orig.get_acl(), ADMIN, who, key); BlobStoreFileOutputStream mOut = null; try { mOut = new BlobStoreFileOutputStream(fbs.write(META_PREFIX+key, false)); mOut.write(Utils.thriftSerialize(meta)); mOut.close(); mOut = null; } catch (IOException e) { throw new RuntimeException(e); } finally { if (mOut != null) { try { mOut.cancel(); } catch (IOException e) { //Ignored } } } }
metaFile.setMetadata(meta); mOut = new BlobStoreFileOutputStream(metaFile); mOut.write(Utils.thriftSerialize(meta)); mOut.close(); mOut = null;