public void remove(TenantId tenantId, Id userId, Id[] ids, long removeAtTimestamp) { modifierStore.multiRemove(tenantId, userId, ids, new ConstantTimestamper(removeAtTimestamp)); }
@Override public void updated(TenantIdAndCentricId tenantIdAndCentricId, ObjectId objectId, String[] fields, long timestamp) { Long[] values = new Long[fields.length]; Arrays.fill(values, timestamp); updatedStore.multiAdd(tenantIdAndCentricId, objectId, fields, values, null, new ConstantTimestamper(timestamp)); }
public void remove(TenantIdAndCentricId tenantIdAndCentricId, ImmutableByteArray rowKey, ImmutableByteArray columnKey, long when) throws IOException { viewValueStore.remove(tenantIdAndCentricId, rowKey, columnKey, new ConstantTimestamper(when)); } }
@Override public void removeObjectId(List<ExistenceUpdate> existenceUpdates) { List<TenantRowColumnTimestampRemove<TenantIdAndCentricId, ObjectId, String>> batch = new ArrayList<>(); for (ExistenceUpdate existenceUpdate : existenceUpdates) { batch.add(new TenantRowColumnTimestampRemove<>(existenceUpdate.tenantId, existenceUpdate.objectId, EXISTS, new ConstantTimestamper(existenceUpdate.timestamp))); if (LOG.isTraceEnabled()) { LOG.trace("Object REMOVED:{} time:{}", new Object[]{existenceUpdate.objectId, existenceUpdate.timestamp}); } } updatedStore.multiRowsMultiRemove(batch); }
@Override public void addObjectId(List<ExistenceUpdate> existenceUpdates) { List<TenantRowColumValueTimestampAdd<TenantIdAndCentricId, ObjectId, String, Long>> batch = new ArrayList<>(); for (ExistenceUpdate existenceUpdate : existenceUpdates) { batch.add(new TenantRowColumValueTimestampAdd<>(existenceUpdate.tenantId, existenceUpdate.objectId, EXISTS, existenceUpdate.timestamp, new ConstantTimestamper(existenceUpdate.timestamp))); if (LOG.isTraceEnabled()) { LOG.trace("Object EXISTS:{} time:{}", new Object[]{existenceUpdate.objectId, existenceUpdate.timestamp}); } } updatedStore.multiRowsMultiAdd(batch); }
public void removeObjectId(TenantIdAndCentricId tenantIdAndCentricId, long removeAtTimestamp, ObjectId objectId, String[] fieldNames) { String[] fields = Arrays.copyOf(fieldNames, fieldNames.length + 1); fields[fields.length - 1] = "deleted"; concurrencyStore.updated(tenantIdAndCentricId, objectId, fields, removeAtTimestamp - 1); if (fieldNames.length > 0) { eventValueStore.multiRemove(tenantIdAndCentricId, objectId, fieldNames, new ConstantTimestamper(removeAtTimestamp + 1)); } concurrencyStore.updated(tenantIdAndCentricId, objectId, fields, removeAtTimestamp); }
public void clear(TenantIdAndCentricId tenantIdAndCentricId, ObjectId viewId, final long timestamp) throws IOException { final List<RowColumnTimestampRemove<ImmutableByteArray, ImmutableByteArray>> removes = new ArrayList<>(); final ConstantTimestamper constantTimestamper = new ConstantTimestamper(timestamp - 1); final ImmutableByteArray rowKey = rowKey(viewId); viewValueStore.getEntrys(tenantIdAndCentricId, rowKey(viewId), null, Long.MAX_VALUE, 1000, false, null, null, new CallbackStream<ColumnValueAndTimestamp<ImmutableByteArray, ViewValue, Long>>() { @Override public ColumnValueAndTimestamp<ImmutableByteArray, ViewValue, Long> callback(ColumnValueAndTimestamp<ImmutableByteArray, ViewValue, Long> v) throws Exception { if (v != null && v.getTimestamp() < timestamp) { removes.add(new RowColumnTimestampRemove<>(rowKey, v.getColumn(), constantTimestamper)); } return v; } }); viewValueStore.multiRowsMultiRemove(tenantIdAndCentricId, removes); }
public void commit(Transaction transaction) { ObjectId objectInstanceId = transaction.objectInstanceId; if (!transaction.addedFieldNames.isEmpty()) { String[] takeAddedFieldNames = transaction.takeAddedFieldNames(); OpaqueFieldValue[] takeAddedValues = transaction.takeAddedValues(); String[] fields = Arrays.copyOf(takeAddedFieldNames, takeAddedFieldNames.length + 1); fields[fields.length - 1] = "deleted"; concurrencyStore.updated(transaction.tenantIdAndCentricId, objectInstanceId, fields, transaction.addAtTimestamp - 1); eventValueStore.multiAdd( transaction.tenantIdAndCentricId, objectInstanceId, takeAddedFieldNames, takeAddedValues, null, new ConstantTimestamper(transaction.addAtTimestamp)); concurrencyStore.updated(transaction.tenantIdAndCentricId, objectInstanceId, fields, transaction.addAtTimestamp); } if (!transaction.removedFieldNames.isEmpty()) { String[] takeRemovedFieldNames = transaction.takeRemovedFieldNames(); String[] fields = Arrays.copyOf(takeRemovedFieldNames, takeRemovedFieldNames.length + 1); fields[fields.length - 1] = "deleted"; concurrencyStore.updated(transaction.tenantIdAndCentricId, objectInstanceId, fields, transaction.removeAtTimestamp - 1); eventValueStore.multiRemove( transaction.tenantIdAndCentricId, objectInstanceId, takeRemovedFieldNames, new ConstantTimestamper(transaction.removeAtTimestamp)); concurrencyStore.updated(transaction.tenantIdAndCentricId, objectInstanceId, fields, transaction.removeAtTimestamp); } }
for (LinkTo link : batchLinks) { ClassAndField_IdKey classAndField_from = new ClassAndField_IdKey(from.getClassName(), link.fieldName, from); ConstantTimestamper constantTimestamper = new ConstantTimestamper(timestamp); for (Reference to : link.tos) { links.add(new TenantRowColumValueTimestampAdd<>(tenantIdAndCentricId, classAndField_from, to.getObjectId(), EMPTY, constantTimestamper));
public void remove(TenantIdAndCentricId tenantIdAndCentricId, List<ViewWriteFieldChange> removes) throws IOException { MultiRemove<ImmutableByteArray, ImmutableByteArray> rawRemoves = new MultiRemove<>(); for (ViewWriteFieldChange change : removes) { rawRemoves.add(rowKey(change.getViewObjectId()), columnKey(change.getModelPathIdHashcode(), change.getModelPathInstanceIds()), new ConstantTimestamper(change.getTimestamp())); LOG.debug("VVS:REMOVED {}", change); } List<RowColumnTimestampRemove<ImmutableByteArray, ImmutableByteArray>> took = rawRemoves.take(); viewValueStore.multiRowsMultiRemove(tenantIdAndCentricId, took); }
public void add(TenantIdAndCentricId tenantIdAndCentricId, List<ViewWriteFieldChange> adds) throws IOException { MultiAdd<ImmutableByteArray, ImmutableByteArray, ViewValue> rawAdds = new MultiAdd<>(); for (ViewWriteFieldChange change : adds) { rawAdds.add(rowKey(change.getViewObjectId()), columnKey(change.getModelPathIdHashcode(), change.getModelPathInstanceIds()), change.getValue(), new ConstantTimestamper(change.getTimestamp())); LOG.debug("VVS:ADD {}", change); } List<RowColumValueTimestampAdd<ImmutableByteArray, ImmutableByteArray, ViewValue>> took = rawAdds.take(); viewValueStore.multiRowsMultiAdd(tenantIdAndCentricId, took); }