if(logger.isDebugEnabled()) {
logger.debug("Incoming put request");
}
try {
store.put(requestObject.getKey(), requestObject.getValue(), null);
PutResponseSender responseConstructor = new PutResponseSender(messageEvent);
responseConstructor.sendResponse(performanceStats,
fromLocalZone,
requestObject.getRequestOriginTimeInMs());
} catch(Exception e) {
putErrorHandler.handleExceptions(messageEvent, e);
}
break;
case VoldemortOpCode.DELETE_OP_CODE:
if(logger.isDebugEnabled()) {
logger.debug("Incoming delete request");
}
try {
boolean result = store.delete(requestObject.getKey(),
requestObject.getVersion());
if(!result) {
logger.error("Error when doing delete. Non Existing key/version. Nothing to delete");
RestErrorHandler.writeErrorResponse(messageEvent,
NOT_FOUND,
"Non Existing key/version. Nothing to delete");
break;
}
DeleteResponseSender responseConstructor = new DeleteResponseSender(messageEvent);
responseConstructor.sendResponse(performanceStats,
fromLocalZone,
requestObject.getRequestOriginTimeInMs());
} catch(Exception e) {
deleteErrorHandler.handleExceptions(messageEvent, e);
}
break;
case VoldemortOpCode.GET_VERSION_OP_CODE:
if(logger.isDebugEnabled()) {
logger.debug("Incoming get version request");
}
try {
List<Version> versions = store.getVersions(requestObject.getKey());
// handle non existing key
if(versions.size() > 0) {
GetVersionResponseSender responseConstructor = new GetVersionResponseSender(messageEvent,
requestObject.getKey(),
versions,
storeName);
responseConstructor.sendResponse(performanceStats,
fromLocalZone,
requestObject.getRequestOriginTimeInMs());
} else {
logger.error("Error when doing getversion. Key does not exist or key is null");