Java Code Examples for org.apache.cassandra.utils.ByteBufferUtil#writeWithLength()
The following examples show how to use
org.apache.cassandra.utils.ByteBufferUtil#writeWithLength() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheService.java From stratio-cassandra with Apache License 2.0 | 5 votes |
public void serialize(KeyCacheKey key, DataOutputPlus out) throws IOException { RowIndexEntry entry = CacheService.instance.keyCache.get(key); if (entry == null) return; CFMetaData cfm = Schema.instance.getCFMetaData(key.cfId); if (cfm == null) return; // the table no longer exists. ByteBufferUtil.writeWithLength(key.key, out); out.writeInt(key.desc.generation); out.writeBoolean(true); cfm.comparator.rowIndexEntrySerializer().serialize(entry, out); }
Example 2
Source File: SSTableReader.java From stratio-cassandra with Apache License 2.0 | 5 votes |
private void saveSummary(SegmentedFile.Builder ibuilder, SegmentedFile.Builder dbuilder, IndexSummary summary) { File summariesFile = new File(descriptor.filenameFor(Component.SUMMARY)); if (summariesFile.exists()) FileUtils.deleteWithConfirm(summariesFile); DataOutputStreamAndChannel oStream = null; try { oStream = new DataOutputStreamAndChannel(new FileOutputStream(summariesFile)); IndexSummary.serializer.serialize(summary, oStream, descriptor.version.hasSamplingLevel); ByteBufferUtil.writeWithLength(first.getKey(), oStream); ByteBufferUtil.writeWithLength(last.getKey(), oStream); ibuilder.serializeBounds(oStream); dbuilder.serializeBounds(oStream); } catch (IOException e) { logger.debug("Cannot save SSTable Summary: ", e); // corrupted hence delete it and let it load it now. if (summariesFile.exists()) FileUtils.deleteWithConfirm(summariesFile); } finally { FileUtils.closeQuietly(oStream); } }
Example 3
Source File: CompactionMetadata.java From stratio-cassandra with Apache License 2.0 | 5 votes |
public void serialize(CompactionMetadata component, DataOutputPlus out) throws IOException { out.writeInt(component.ancestors.size()); for (int g : component.ancestors) out.writeInt(g); ByteBufferUtil.writeWithLength(component.cardinalityEstimator.getBytes(), out); }
Example 4
Source File: Token.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public void serialize(Token token, DataOutputPlus out) throws IOException { IPartitioner p = StorageService.getPartitioner(); ByteBuffer b = p.getTokenFactory().toByteArray(token); ByteBufferUtil.writeWithLength(b, out); }
Example 5
Source File: CacheService.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public void serialize(CounterCacheKey key, DataOutputPlus out) throws IOException { ByteBufferUtil.writeWithLength(key.partitionKey, out); ByteBufferUtil.writeWithLength(key.cellName, out); }
Example 6
Source File: CacheService.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public void serialize(RowCacheKey key, DataOutputPlus out) throws IOException { ByteBufferUtil.writeWithLength(key.key, out); }