use of org.apache.ignite.internal.schema.row.Row in project ignite-3 by apache.
the class KeyValueBinaryViewImpl method removeAsync.
/**
* {@inheritDoc}
*/
@Override
@NotNull
public CompletableFuture<Boolean> removeAsync(@Nullable Transaction tx, @NotNull Tuple key, @NotNull Tuple val) {
Objects.requireNonNull(key);
Objects.requireNonNull(val);
// Convert to portable format to pass TX/storage layer.
Row row = marshal(key, val);
return tbl.deleteExact(row, (InternalTransaction) tx);
}
use of org.apache.ignite.internal.schema.row.Row in project ignite-3 by apache.
the class KeyValueBinaryViewImpl method removeAllAsync.
/**
* {@inheritDoc}
*/
@Override
@NotNull
public CompletableFuture<Collection<Tuple>> removeAllAsync(@Nullable Transaction tx, @NotNull Collection<Tuple> keys) {
Objects.requireNonNull(keys);
List<BinaryRow> keyRows = new ArrayList<>(keys.size());
for (Tuple keyRec : keys) {
final Row keyRow = marshal(keyRec, null);
keyRows.add(keyRow);
}
return tbl.deleteAll(keyRows, (InternalTransaction) tx).thenApply(t -> t.stream().filter(Objects::nonNull).map(this::wrap).map(TableRow::valueTuple).collect(Collectors.toList()));
}
use of org.apache.ignite.internal.schema.row.Row in project ignite-3 by apache.
the class KeyValueViewImpl method unmarshalPairs.
/**
* Marshal key-value pairs.
*
* @param rows Binary rows.
* @return Key-value pairs.
*/
@NotNull
public Map<K, V> unmarshalPairs(Collection<BinaryRow> rows) {
if (rows.isEmpty()) {
return Collections.emptyMap();
}
final KvMarshaller<K, V> marsh = marshaller(schemaReg.lastSchemaVersion());
Map<K, V> pairs = new HashMap<>(rows.size());
try {
for (Row row : schemaReg.resolve(rows)) {
if (row != null) {
pairs.put(marsh.unmarshalKey(row), marsh.unmarshalValue(row));
}
}
return pairs;
} catch (MarshallerException e) {
throw new IgniteException(e);
}
}
use of org.apache.ignite.internal.schema.row.Row in project ignite-3 by apache.
the class RecordBinaryViewImpl method deleteAsync.
/**
* {@inheritDoc}
*/
@Override
@NotNull
public CompletableFuture<Boolean> deleteAsync(@Nullable Transaction tx, @NotNull Tuple keyRec) {
Objects.requireNonNull(keyRec);
final Row keyRow = marshal(keyRec, true);
return tbl.delete(keyRow, (InternalTransaction) tx);
}
use of org.apache.ignite.internal.schema.row.Row in project ignite-3 by apache.
the class RecordBinaryViewImpl method upsertAsync.
/**
* {@inheritDoc}
*/
@Override
@NotNull
public CompletableFuture<Void> upsertAsync(@Nullable Transaction tx, @NotNull Tuple rec) {
Objects.requireNonNull(rec);
final Row row = marshal(rec, false);
return tbl.upsert(row, (InternalTransaction) tx);
}
Aggregations