Move remote property from index functionality to IndexTableWrapper

This commit is contained in:
Michael Lieberman
2015-01-20 15:31:42 -05:00
parent ad6ef0c2f1
commit f0a23e3848
3 changed files with 14 additions and 24 deletions

View File

@@ -118,7 +118,7 @@ public abstract class AccumuloElement implements Element {
globals.getElementWrapper(type).clearProperty(this, key);
globals.checkedFlush();
}
globals.getGraph().removePropertyFromIndex(type, this, key, value);
globals.getIndexWrapper(type).removePropertyFromIndex(this, key, value);
// MDL 31 Dec 2014: AccumuloGraph.removeProperty
// calls getProperty which populates the cache.
// So the order here is important (for now).

View File

@@ -694,29 +694,6 @@ public class AccumuloGraph implements Graph, KeyIndexableGraph, IndexableGraph {
return getVertexIndexWriter();
}
/**
* @deprecated Move to appropriate place
* @param type
* @param element
* @param key
* @return
*/
@Deprecated
void removePropertyFromIndex(Class<? extends Element> type, Element element,
String key, Object obj) {
try {
if (obj != null) {
byte[] val = AccumuloByteSerializer.serialize(obj);
Mutation m = new Mutation(val);
m.putDelete(key, element.getId().toString());
getIndexBatchWriter(type).addMutation(m);
globals.checkedFlush();
}
} catch (MutationsRejectedException e) {
e.printStackTrace();
}
}
/*
private void nullCheckProperty(String key, Object val) {
if (key == null) {

View File

@@ -61,4 +61,17 @@ public abstract class IndexTableWrapper extends BaseTableWrapper {
globals.checkedFlush();
}
}
/**
* Remove property from the index.
* @param element
* @param key
* @param value
*/
public void removePropertyFromIndex(Element element, String key, Object value) {
if (value != null) {
Mutators.apply(getWriter(), new IndexValueMutator.Delete(element, key, value));
globals.checkedFlush();
}
}
}