@Override public Object get(int i) { return composite.get(i); } @Override
@SuppressWarnings("unchecked") @Override public <T> T read(Serializer<T> serializer) { Object obj = this.composite.get(position, serializer); position++; return (T) obj; }
public static UpdateRef fromByteBuffer(ByteBuffer buf) { Composite composite = newComposite(); composite.deserialize(buf); String table = (String) composite.get(0); String key = (String) composite.get(1); UUID changeId = (UUID) composite.get(2); Set<String> tags = ImmutableSet.of(); if (composite.size() == 4) { tags = _setSerializer.fromByteBuffer((ByteBuffer) composite.get(3)); } return new UpdateRef(table, key, changeId, tags); }
public static UpdateRef fromByteBuffer(ByteBuffer buf) { Composite composite = newComposite(); composite.deserialize(buf); String table = (String) composite.get(0); String key = (String) composite.get(1); UUID changeId = (UUID) composite.get(2); Set<String> tags = ImmutableSet.of(); if (composite.size() == 4) { tags = _setSerializer.fromByteBuffer((ByteBuffer) composite.get(3)); } return new UpdateRef(table, key, changeId, tags); }
/** * The Astyanax Composite behavior is broken in that a deserialized Composite is not .equal() to a normally * created Composite because the serializers aren't used correctly. This function works around the problem. */ private boolean matches(Composite column, ColumnGroup group, int index) { return column.size() == 2 && column.get(0, AsciiSerializer.get()).equals(group.name()) && column.get(1, IntegerSerializer.get()).equals(index); }
List<Object> dimensions = new ArrayList<Object>(); for (int i = 0; i < rowKey.size(); i++) { dimensions.add(rowKey.get(i, StringSerializer.get()));
ss1Result = (String) c2.get(0);
private void deleteOldColumns(AstyanaxTable table, String blobId, ColumnList<Composite> columns, long timestamp) { for (AstyanaxStorage storage : table.getWriteStorage()) { BlobPlacement placement = (BlobPlacement) storage.getPlacement(); // Any columns with a timestamp older than the one we expect must be from an old version // of the blob. This should be rare, but if it happens clean up and delete the old data. MutationBatch mutation = placement.getKeyspace().prepareMutationBatch(ConsistencyLevel.CL_ANY); ColumnListMutation<Composite> row = mutation.withRow( placement.getBlobColumnFamily(), storage.getRowKey(blobId)); boolean found = false; for (Column<Composite> column : columns) { if (column.getTimestamp() < timestamp) { if (ColumnGroup.B.name().equals(column.getName().get(0, AsciiSerializer.get()))) { int chunkId = column.getName().get(1, IntegerSerializer.get()); row.deleteColumn(getColumn(ColumnGroup.B, chunkId)) .deleteColumn(getColumn(ColumnGroup.Z, chunkId)); found = true; } } } if (found) { execute(mutation); } } }