Search in sources :

Example 6 with DataOutputBufferFixed

use of org.apache.cassandra.io.util.DataOutputBufferFixed in project cassandra by apache.

the class MutationBench method setup.

@Setup
public void setup() throws IOException {
    Schema.instance.load(KeyspaceMetadata.create(keyspace, KeyspaceParams.simple(1)));
    KeyspaceMetadata ksm = Schema.instance.getKeyspaceMetadata(keyspace);
    TableMetadata metadata = CreateTableStatement.parse("CREATE TABLE userpics " + "( userid bigint," + "picid bigint," + "commentid bigint, " + "PRIMARY KEY(userid, picid))", keyspace).build();
    Schema.instance.load(ksm.withSwapped(ksm.tables.with(metadata)));
    mutation = (Mutation) UpdateBuilder.create(metadata, 1L).newRow(1L).add("commentid", 32L).makeMutation();
    messageOut = mutation.createMessage();
    buffer = ByteBuffer.allocate(messageOut.serializedSize(MessagingService.current_version));
    outputBuffer = new DataOutputBufferFixed(buffer);
    inputBuffer = new DataInputBuffer(buffer, false);
    messageOut.serialize(outputBuffer, MessagingService.current_version);
}
Also used : TableMetadata(org.apache.cassandra.schema.TableMetadata) DataInputBuffer(org.apache.cassandra.io.util.DataInputBuffer) KeyspaceMetadata(org.apache.cassandra.schema.KeyspaceMetadata) DataOutputBufferFixed(org.apache.cassandra.io.util.DataOutputBufferFixed)

Aggregations

DataOutputBufferFixed (org.apache.cassandra.io.util.DataOutputBufferFixed)6 ByteBuffer (java.nio.ByteBuffer)4 IOException (java.io.IOException)3 DataOutputBuffer (org.apache.cassandra.io.util.DataOutputBuffer)3 DataInputBuffer (org.apache.cassandra.io.util.DataInputBuffer)2 CRC32 (java.util.zip.CRC32)1 Allocation (org.apache.cassandra.db.commitlog.CommitLogSegment.Allocation)1 FSWriteError (org.apache.cassandra.io.FSWriteError)1 BufferedDataOutputStreamPlus (org.apache.cassandra.io.util.BufferedDataOutputStreamPlus)1 DataInputPlus (org.apache.cassandra.io.util.DataInputPlus)1 DataOutputPlus (org.apache.cassandra.io.util.DataOutputPlus)1 KeyspaceMetadata (org.apache.cassandra.schema.KeyspaceMetadata)1 TableMetadata (org.apache.cassandra.schema.TableMetadata)1