Search in sources :

Example 1 with Inline

use of net.nicoulaj.compilecommand.annotations.Inline in project cassandra by apache.

the class UnfilteredSerializer method serializeRowBody.

@Inline
private void serializeRowBody(Row row, int flags, SerializationHeader header, DataOutputPlus out) throws IOException {
    boolean isStatic = row.isStatic();
    Columns headerColumns = header.columns(isStatic);
    LivenessInfo pkLiveness = row.primaryKeyLivenessInfo();
    Row.Deletion deletion = row.deletion();
    if ((flags & HAS_TIMESTAMP) != 0)
        header.writeTimestamp(pkLiveness.timestamp(), out);
    if ((flags & HAS_TTL) != 0) {
        header.writeTTL(pkLiveness.ttl(), out);
        header.writeLocalDeletionTime(pkLiveness.localExpirationTime(), out);
    }
    if ((flags & HAS_DELETION) != 0)
        header.writeDeletionTime(deletion.time(), out);
    if ((flags & HAS_ALL_COLUMNS) == 0)
        Columns.serializer.serializeSubset(Collections2.transform(row, ColumnData::column), headerColumns, out);
    SearchIterator<ColumnMetadata, ColumnMetadata> si = headerColumns.iterator();
    try {
        row.apply(cd -> {
            ColumnMetadata column = si.next(cd.column());
            assert column != null : cd.column.toString();
            try {
                if (cd.column.isSimple())
                    Cell.serializer.serialize((Cell) cd, column, out, pkLiveness, header);
                else
                    writeComplexColumn((ComplexColumnData) cd, column, (flags & HAS_COMPLEX_DELETION) != 0, pkLiveness, header, out);
            } catch (IOException e) {
                throw new WrappedException(e);
            }
        }, false);
    } catch (WrappedException e) {
        if (e.getCause() instanceof IOException)
            throw (IOException) e.getCause();
        throw e;
    }
}
Also used : ColumnMetadata(org.apache.cassandra.schema.ColumnMetadata) WrappedException(org.apache.cassandra.utils.WrappedException) Deletion(org.apache.cassandra.db.rows.Row.Deletion) IOException(java.io.IOException) Inline(net.nicoulaj.compilecommand.annotations.Inline)

Aggregations

IOException (java.io.IOException)1 Inline (net.nicoulaj.compilecommand.annotations.Inline)1 Deletion (org.apache.cassandra.db.rows.Row.Deletion)1 ColumnMetadata (org.apache.cassandra.schema.ColumnMetadata)1 WrappedException (org.apache.cassandra.utils.WrappedException)1