mirror of https://github.com/apache/cassandra
r/m unused (and dangerous) RowReadCommand.
patch by jbellis; reviewed by Jun Rao for CASSANDRA-287 git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@793050 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f49f3e7ea9
commit
f5a787af72
|
|
@ -92,7 +92,6 @@ class ReadCommandSerializer implements ICompactSerializer<ReadCommand>
|
|||
private static final Map<Byte, ReadCommandSerializer> CMD_SERIALIZER_MAP = new HashMap<Byte, ReadCommandSerializer>();
|
||||
static
|
||||
{
|
||||
CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_ROW, new RowReadCommandSerializer());
|
||||
CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_COLUMN, new ColumnReadCommandSerializer());
|
||||
CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_SLICE_BY_NAMES, new SliceByNamesReadCommandSerializer());
|
||||
CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_COLUMNS_SINCE, new ColumnsSinceReadCommandSerializer());
|
||||
|
|
|
|||
|
|
@ -1,84 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class RowReadCommand extends ReadCommand
|
||||
{
|
||||
public RowReadCommand(String table, String key)
|
||||
{
|
||||
super(table, key, CMD_TYPE_GET_ROW);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnFamilyName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReadCommand copy()
|
||||
{
|
||||
ReadCommand readCommand= new RowReadCommand(table, key);
|
||||
readCommand.setDigestQuery(isDigestQuery());
|
||||
return readCommand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Row getRow(Table table) throws IOException
|
||||
{
|
||||
return table.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "RowReadCommand(" +
|
||||
"table='" + table + '\'' +
|
||||
", key='" + key + '\'' +
|
||||
')';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class RowReadCommandSerializer extends ReadCommandSerializer
|
||||
{
|
||||
@Override
|
||||
public void serialize(ReadCommand rm, DataOutputStream dos) throws IOException
|
||||
{
|
||||
RowReadCommand realRM = (RowReadCommand)rm;
|
||||
dos.writeBoolean(realRM.isDigestQuery());
|
||||
dos.writeUTF(realRM.table);
|
||||
dos.writeUTF(realRM.key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReadCommand deserialize(DataInputStream dis) throws IOException
|
||||
{
|
||||
boolean isDigest = dis.readBoolean();
|
||||
String table = dis.readUTF();
|
||||
String key = dis.readUTF();
|
||||
RowReadCommand rm = new RowReadCommand(table, key);
|
||||
rm.setDigestQuery(isDigest);
|
||||
return rm;
|
||||
}
|
||||
}
|
||||
|
|
@ -49,10 +49,6 @@ public class ReadMessageTest
|
|||
rm2 = serializeAndDeserializeReadMessage(rm);
|
||||
assert rm2.toString().equals(rm.toString());
|
||||
|
||||
rm = new RowReadCommand("Table1", "row1");
|
||||
rm2 = serializeAndDeserializeReadMessage(rm);
|
||||
assert rm2.toString().equals(rm.toString());
|
||||
|
||||
rm = new ColumnsSinceReadCommand("Table1", "row1", "foo", 1);
|
||||
rm2 = serializeAndDeserializeReadMessage(rm);
|
||||
assert rm2.toString().equals(rm.toString());
|
||||
|
|
|
|||
Loading…
Reference in New Issue