Search in sources :

Example 26 with Row

use of org.apache.ignite.internal.schema.row.Row in project ignite-3 by apache.

the class RecordBinaryViewImpl method getAsync.

/**
 * {@inheritDoc}
 */
@Override
@NotNull
public CompletableFuture<Tuple> getAsync(@Nullable Transaction tx, @NotNull Tuple keyRec) {
    Objects.requireNonNull(keyRec);
    // Convert to portable format to pass TX/storage layer.
    final Row keyRow = marshal(keyRec, true);
    return tbl.get(keyRow, (InternalTransaction) tx).thenApply(this::wrap);
}
Also used : BinaryRow(org.apache.ignite.internal.schema.BinaryRow) Row(org.apache.ignite.internal.schema.row.Row) InternalTransaction(org.apache.ignite.internal.tx.InternalTransaction) NotNull(org.jetbrains.annotations.NotNull)

Example 27 with Row

use of org.apache.ignite.internal.schema.row.Row in project ignite-3 by apache.

the class RecordBinaryViewImpl method insertAsync.

/**
 * {@inheritDoc}
 */
@Override
@NotNull
public CompletableFuture<Boolean> insertAsync(@Nullable Transaction tx, @NotNull Tuple rec) {
    Objects.requireNonNull(rec);
    final Row row = marshal(rec, false);
    return tbl.insert(row, (InternalTransaction) tx);
}
Also used : BinaryRow(org.apache.ignite.internal.schema.BinaryRow) Row(org.apache.ignite.internal.schema.row.Row) NotNull(org.jetbrains.annotations.NotNull)

Example 28 with Row

use of org.apache.ignite.internal.schema.row.Row in project ignite-3 by apache.

the class KeyValueBinaryViewImpl method getAsync.

/**
 * {@inheritDoc}
 */
@Override
@NotNull
public CompletableFuture<Tuple> getAsync(@Nullable Transaction tx, @NotNull Tuple key) {
    Objects.requireNonNull(key);
    // Convert to portable format to pass TX/storage layer.
    Row keyRow = marshal(key, null);
    return // Load async.
    tbl.get(keyRow, (InternalTransaction) tx).thenApply(// Binary -> schema-aware row
    this::wrap).thenApply(// Narrow to value.
    TableRow::valueTuple);
}
Also used : BinaryRow(org.apache.ignite.internal.schema.BinaryRow) Row(org.apache.ignite.internal.schema.row.Row) NotNull(org.jetbrains.annotations.NotNull)

Example 29 with Row

use of org.apache.ignite.internal.schema.row.Row in project ignite-3 by apache.

the class KeyValueBinaryViewImpl method getAndPutAsync.

/**
 * {@inheritDoc}
 */
@Override
@NotNull
public CompletableFuture<Tuple> getAndPutAsync(@Nullable Transaction tx, @NotNull Tuple key, Tuple val) {
    Objects.requireNonNull(key);
    // Convert to portable format to pass TX/storage layer.
    Row row = marshal(key, val);
    return tbl.getAndUpsert(row, (InternalTransaction) tx).thenApply(// Binary -> schema-aware row
    this::wrap).thenApply(// Narrow to value.
    TableRow::valueTuple);
}
Also used : BinaryRow(org.apache.ignite.internal.schema.BinaryRow) Row(org.apache.ignite.internal.schema.row.Row) NotNull(org.jetbrains.annotations.NotNull)

Example 30 with Row

use of org.apache.ignite.internal.schema.row.Row in project ignite-3 by apache.

the class KeyValueBinaryViewImpl method replaceAsync.

/**
 * {@inheritDoc}
 */
@Override
@NotNull
public CompletableFuture<Boolean> replaceAsync(@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.replace(row, (InternalTransaction) tx);
}
Also used : BinaryRow(org.apache.ignite.internal.schema.BinaryRow) Row(org.apache.ignite.internal.schema.row.Row) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Row (org.apache.ignite.internal.schema.row.Row)83 BinaryRow (org.apache.ignite.internal.schema.BinaryRow)55 Column (org.apache.ignite.internal.schema.Column)34 SchemaDescriptor (org.apache.ignite.internal.schema.SchemaDescriptor)30 NotNull (org.jetbrains.annotations.NotNull)25 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)24 MethodSource (org.junit.jupiter.params.provider.MethodSource)22 Tuple (org.apache.ignite.table.Tuple)21 Test (org.junit.jupiter.api.Test)18 ByteBufferRow (org.apache.ignite.internal.schema.ByteBufferRow)17 TupleMarshaller (org.apache.ignite.internal.schema.marshaller.TupleMarshaller)15 TupleMarshallerImpl (org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl)15 DummySchemaManagerImpl (org.apache.ignite.internal.table.impl.DummySchemaManagerImpl)15 RowAssembler (org.apache.ignite.internal.schema.row.RowAssembler)14 ArrayList (java.util.ArrayList)8 InternalTransaction (org.apache.ignite.internal.tx.InternalTransaction)6 Random (java.util.Random)5 MarshallerException (org.apache.ignite.internal.schema.marshaller.MarshallerException)5 TestObjectWithAllTypes (org.apache.ignite.internal.schema.testobjects.TestObjectWithAllTypes)5 IgniteException (org.apache.ignite.lang.IgniteException)5