org.apache.cassandra.service
Class ReadResponseResolver

java.lang.Object
  extended by org.apache.cassandra.service.ReadResponseResolver
All Implemented Interfaces:
IResponseResolver<Row>

public class ReadResponseResolver
extends java.lang.Object
implements IResponseResolver<Row>

Turns ReadResponse messages into Row objects, resolving to the most recent version and setting up read repairs as necessary.


Constructor Summary
ReadResponseResolver(java.lang.String table, java.nio.ByteBuffer key)
           
 
Method Summary
 Row getData()
          returns the data response without comparing with any digests
 int getMessageCount()
           
 java.lang.Iterable<Message> getMessages()
           
 void injectPreProcessed(ReadResponse result)
          hack so local reads don't force de/serialization of an extra real Message
 boolean isDataPresent()
           
static void maybeScheduleRepairs(ColumnFamily resolved, java.lang.String table, DecoratedKey key, java.util.List<ColumnFamily> versions, java.util.List<java.net.InetAddress> endpoints)
          For each row version, compare with resolved (the superset of all row versions); if it is missing anything, send a mutation to the endpoint it come from.
 void preprocess(Message message)
           
 Row resolve()
          This Method resolves the responses that are passed in .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadResponseResolver

public ReadResponseResolver(java.lang.String table,
                            java.nio.ByteBuffer key)
Method Detail

getData

public Row getData()
            throws java.io.IOException
Description copied from interface: IResponseResolver
returns the data response without comparing with any digests

Specified by:
getData in interface IResponseResolver<Row>
Throws:
java.io.IOException

resolve

public Row resolve()
            throws DigestMismatchException,
                   java.io.IOException
Description copied from interface: IResponseResolver
This Method resolves the responses that are passed in . for example : if its write response then all we get is true or false return values which implies if the writes were successful but for reads its more complicated you need to look at the responses and then based on differences schedule repairs . Hence you need to derive a response resolver based on your needs from this interface.

Specified by:
resolve in interface IResponseResolver<Row>
Throws:
DigestMismatchException
java.io.IOException

maybeScheduleRepairs

public static void maybeScheduleRepairs(ColumnFamily resolved,
                                        java.lang.String table,
                                        DecoratedKey key,
                                        java.util.List<ColumnFamily> versions,
                                        java.util.List<java.net.InetAddress> endpoints)
For each row version, compare with resolved (the superset of all row versions); if it is missing anything, send a mutation to the endpoint it come from.


preprocess

public void preprocess(Message message)
Specified by:
preprocess in interface IResponseResolver<Row>

injectPreProcessed

public void injectPreProcessed(ReadResponse result)
hack so local reads don't force de/serialization of an extra real Message


isDataPresent

public boolean isDataPresent()
Specified by:
isDataPresent in interface IResponseResolver<Row>

getMessages

public java.lang.Iterable<Message> getMessages()
Specified by:
getMessages in interface IResponseResolver<Row>

getMessageCount

public int getMessageCount()
Specified by:
getMessageCount in interface IResponseResolver<Row>


Copyright © 2011 The Apache Software Foundation