@Override public void put(SnapshotsStreamIdxRow rowName, Iterable<SnapshotsStreamIdxColumnValue> values) { put(ImmutableMultimap.<SnapshotsStreamIdxRow, SnapshotsStreamIdxColumnValue>builder().putAll(rowName, values).build()); }
@Override public void put(SnapshotsStreamIdxRow rowName, SnapshotsStreamIdxColumnValue... values) { put(ImmutableMultimap.<SnapshotsStreamIdxRow, SnapshotsStreamIdxColumnValue>builder().putAll(rowName, values).build()); }
@Override public void touch(Multimap<SnapshotsStreamIdxRow, SnapshotsStreamIdxColumn> values) { Multimap<SnapshotsStreamIdxRow, SnapshotsStreamIdxColumnValue> currentValues = get(values); put(currentValues); Multimap<SnapshotsStreamIdxRow, SnapshotsStreamIdxColumn> toDelete = HashMultimap.create(values); for (Map.Entry<SnapshotsStreamIdxRow, SnapshotsStreamIdxColumnValue> e : currentValues.entries()) { toDelete.remove(e.getKey(), e.getValue().getColumnName()); } delete(toDelete); }
@Override protected void markStreamsAsUsedInternal(Transaction t, final Map<Long, byte[]> streamIdsToReference) { if (streamIdsToReference.isEmpty()) { return; } SnapshotsStreamIdxTable index = tables.getSnapshotsStreamIdxTable(t); Multimap<SnapshotsStreamIdxTable.SnapshotsStreamIdxRow, SnapshotsStreamIdxTable.SnapshotsStreamIdxColumnValue> rowsToValues = HashMultimap.create(); for (Map.Entry<Long, byte[]> entry : streamIdsToReference.entrySet()) { Long streamId = entry.getKey(); byte[] reference = entry.getValue(); SnapshotsStreamIdxTable.SnapshotsStreamIdxColumn col = SnapshotsStreamIdxTable.SnapshotsStreamIdxColumn.of(reference); SnapshotsStreamIdxTable.SnapshotsStreamIdxColumnValue value = SnapshotsStreamIdxTable.SnapshotsStreamIdxColumnValue.of(col, 0L); rowsToValues.put(SnapshotsStreamIdxTable.SnapshotsStreamIdxRow.of(streamId), value); } index.put(rowsToValues); }
@Override public void put(SnapshotsStreamIdxRow rowName, Iterable<SnapshotsStreamIdxColumnValue> values) { put(ImmutableMultimap.<SnapshotsStreamIdxRow, SnapshotsStreamIdxColumnValue>builder().putAll(rowName, values).build()); }
@Override public void put(SnapshotsStreamIdxRow rowName, SnapshotsStreamIdxColumnValue... values) { put(ImmutableMultimap.<SnapshotsStreamIdxRow, SnapshotsStreamIdxColumnValue>builder().putAll(rowName, values).build()); }
@Override public void touch(Multimap<SnapshotsStreamIdxRow, SnapshotsStreamIdxColumn> values) { Multimap<SnapshotsStreamIdxRow, SnapshotsStreamIdxColumnValue> currentValues = get(values); put(currentValues); Multimap<SnapshotsStreamIdxRow, SnapshotsStreamIdxColumn> toDelete = HashMultimap.create(values); for (Map.Entry<SnapshotsStreamIdxRow, SnapshotsStreamIdxColumnValue> e : currentValues.entries()) { toDelete.remove(e.getKey(), e.getValue().getColumnName()); } delete(toDelete); }
@Override protected void markStreamsAsUsedInternal(Transaction t, final Map<Long, byte[]> streamIdsToReference) { if (streamIdsToReference.isEmpty()) { return; } SnapshotsStreamIdxTable index = tables.getSnapshotsStreamIdxTable(t); Multimap<SnapshotsStreamIdxTable.SnapshotsStreamIdxRow, SnapshotsStreamIdxTable.SnapshotsStreamIdxColumnValue> rowsToValues = HashMultimap.create(); for (Map.Entry<Long, byte[]> entry : streamIdsToReference.entrySet()) { Long streamId = entry.getKey(); byte[] reference = entry.getValue(); SnapshotsStreamIdxTable.SnapshotsStreamIdxColumn col = SnapshotsStreamIdxTable.SnapshotsStreamIdxColumn.of(reference); SnapshotsStreamIdxTable.SnapshotsStreamIdxColumnValue value = SnapshotsStreamIdxTable.SnapshotsStreamIdxColumnValue.of(col, 0L); rowsToValues.put(SnapshotsStreamIdxTable.SnapshotsStreamIdxRow.of(streamId), value); } index.put(rowsToValues); }