@Override public void commit(List<History> historyList, Object rowKey) { if (historyList != null && !historyList.isEmpty()) { ColumnListMutation<UUID> historyMutation = _mutation.withRow(_columnFamily, (ByteBuffer)rowKey); for (History history : historyList) { historyMutation.putColumn(history.getChangeId(), _changeEncoder.encodeHistory(history), Ttls.toSeconds(_historyStore.getHistoryTtl(), 1, null)); } } }
@Override public void commit(List<History> historyList, Object rowKey) { if (historyList != null && !historyList.isEmpty()) { ColumnListMutation<UUID> historyMutation = _mutation.withRow(_columnFamily, (ByteBuffer)rowKey); for (History history : historyList) { historyMutation.putColumn(history.getChangeId(), _changeEncoder.encodeHistory(history), Ttls.toSeconds(_historyStore.getHistoryTtl(), 1, null)); } } }
@Override public Change apply(History input) { return new ChangeBuilder(input.getChangeId()) .with(input).with(input.getDelta()).build(); } }).iterator();
@Override public Change apply(History input) { return new ChangeBuilder(input.getChangeId()) .with(input).with(input.getDelta()).build(); } }).iterator();
@Timed (name = "bv.emodb.sorAstyanaxDataWriterDAO.storeCompactedDeltas", absolute = true) @Override public void storeCompactedDeltas(Table tbl, String key, List<History> histories, WriteConsistency consistency) { checkNotNull(tbl, "table"); checkNotNull(key, "key"); checkNotNull(histories, "histories"); checkNotNull(consistency, "consistency"); AstyanaxTable table = (AstyanaxTable) tbl; for (AstyanaxStorage storage : table.getWriteStorage()) { DeltaPlacement placement = (DeltaPlacement) storage.getPlacement(); CassandraKeyspace keyspace = placement.getKeyspace(); ByteBuffer rowKey = storage.getRowKey(key); MutationBatch mutation = keyspace.prepareMutationBatch(SorConsistencies.toAstyanax(consistency)); ColumnListMutation<UUID> rowMutation = mutation.withRow(placement.getDeltaHistoryColumnFamily(), rowKey); for (History history : histories) { rowMutation.putColumn(history.getChangeId(), _changeEncoder.encodeHistory(history), Ttls.toSeconds(_historyStore.getHistoryTtl(), 1, null)); } execute(mutation, "store %d compacted deltas for placement %s, table %s, key %s", histories.size(), placement.getName(), table.getName(), key); } }
@Timed (name = "bv.emodb.sorAstyanaxDataWriterDAO.storeCompactedDeltas", absolute = true) @Override public void storeCompactedDeltas(Table tbl, String key, List<History> histories, WriteConsistency consistency) { checkNotNull(tbl, "table"); checkNotNull(key, "key"); checkNotNull(histories, "histories"); checkNotNull(consistency, "consistency"); AstyanaxTable table = (AstyanaxTable) tbl; for (AstyanaxStorage storage : table.getWriteStorage()) { DeltaPlacement placement = (DeltaPlacement) storage.getPlacement(); CassandraKeyspace keyspace = placement.getKeyspace(); ByteBuffer rowKey = storage.getRowKey(key); MutationBatch mutation = keyspace.prepareMutationBatch(SorConsistencies.toAstyanax(consistency)); ColumnListMutation<UUID> rowMutation = mutation.withRow(placement.getDeltaHistoryColumnFamily(), rowKey); for (History history : histories) { rowMutation.putColumn(history.getChangeId(), _changeEncoder.encodeHistory(history), Ttls.toSeconds(_historyStore.getHistoryTtl(), 1, null)); } execute(mutation, "store %d compacted deltas for placement %s, table %s, key %s", histories.size(), placement.getName(), table.getName(), key); } }
@Override public void commit(List<History> historyList, Object rowKey) { if (historyList != null && !historyList.isEmpty()) { for (History history : historyList) { _batchStatement.add(QueryBuilder.insertInto(_tableDDL.getTableMetadata()) .value(_tableDDL.getRowKeyColumnName(), rowKey) .value(_tableDDL.getChangeIdColumnName(), history.getChangeId()) .value(_tableDDL.getValueColumnName(), _changeEncoder.encodeHistory(history)) .using(ttl(Ttls.toSeconds(_historyStore.getHistoryTtl(), 1, null))) .setConsistencyLevel(_consistencyLevel)); } } }
@Override public void commit(List<History> historyList, Object rowKey) { if (historyList != null && !historyList.isEmpty()) { for (History history : historyList) { _batchStatement.add(QueryBuilder.insertInto(_tableDDL.getTableMetadata()) .value(_tableDDL.getRowKeyColumnName(), rowKey) .value(_tableDDL.getChangeIdColumnName(), history.getChangeId()) .value(_tableDDL.getValueColumnName(), _changeEncoder.encodeHistory(history)) .using(ttl(Ttls.toSeconds(_historyStore.getHistoryTtl(), 1, null))) .setConsistencyLevel(_consistencyLevel)); } } }