本文整理汇总了Java中org.apache.accumulo.core.client.BatchDeleter.setRanges方法的典型用法代码示例。如果您正苦于以下问题:Java BatchDeleter.setRanges方法的具体用法?Java BatchDeleter.setRanges怎么用?Java BatchDeleter.setRanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.accumulo.core.client.BatchDeleter
的用法示例。
在下文中一共展示了BatchDeleter.setRanges方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeElementFromIndex
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
/**
* Remove the given element's properties from the index.
* @param element
*/
public void removeElementFromIndex(Element element) {
BatchDeleter deleter = null;
try {
deleter = getDeleter();
deleter.setRanges(Collections.singleton(new Range()));
IteratorSetting is = new IteratorSetting(10, "getEdgeFilter", RegExFilter.class);
RegExFilter.setRegexs(is, null, null,
"^"+Pattern.quote(element.getId().toString())+"$", null, false);
deleter.addScanIterator(is);
deleter.delete();
deleter.close();
} catch (Exception e) {
throw new AccumuloGraphException(e);
} finally {
if (deleter != null) {
deleter.close();
}
}
}
示例2: deleteVertex
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
/**
* Remove the given vertex.
* Note: This uses a BatchDeleter rather than {@link Mutator}
* because it is more efficient.
* @param vertex
*/
public void deleteVertex(Vertex vertex) {
BatchDeleter deleter = null;
try {
deleter = getDeleter();
deleter.setRanges(Arrays.asList(Range.exact((String) vertex.getId())));
deleter.delete();
} catch (Exception e) {
throw new AccumuloGraphException(e);
} finally {
if (deleter != null) {
deleter.close();
}
}
}
示例3: addToBatch
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
protected void addToBatch(
final Closeable deleter,
final List<ByteArrayId> ids )
throws Exception {
final List<Range> rowRanges = new ArrayList<Range>();
for (final ByteArrayId id : ids) {
rowRanges.add(Range.exact(new Text(
id.getBytes())));
}
if (deleter instanceof ClosableBatchDeleter) {
final BatchDeleter batchDeleter = ((ClosableBatchDeleter) deleter).getDeleter();
batchDeleter.setRanges(rowRanges);
batchDeleter.delete();
}
else {
LOGGER.error("Deleter incompatible with data store type");
}
}
示例4: clearTable
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
public static void clearTable(Connector connector, String table) throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
Authorizations userAuths = connector.securityOperations().getUserAuthorizations(connector.whoami());
BatchDeleter batchDelete = connector.createBatchDeleter(table, userAuths, 1, new BatchWriterConfig());
batchDelete.setRanges(Collections.singleton(new Range()));
batchDelete.delete();
batchDelete.close();
batchDelete = connector.createBatchDeleter(table, userAuths, 1, new BatchWriterConfig());
batchDelete.setRanges(Collections.singleton(new Range()));
batchDelete.delete();
batchDelete.close();
connector.tableOperations().compact(table, new Text("\u0000"), new Text("\uffff"), true, true);
}
示例5: purge
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
private void purge(final String tableName, final String[] auths) throws TableNotFoundException, MutationsRejectedException {
if (tableExists(tableName)) {
logger.info("Purging accumulo table: " + tableName);
final BatchDeleter batchDeleter = createBatchDeleter(tableName, new Authorizations(auths));
try {
batchDeleter.setRanges(Collections.singleton(new Range()));
batchDeleter.delete();
} finally {
batchDeleter.close();
}
}
}
示例6: dropKeyIndex
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
public <T extends Element> void dropKeyIndex(String key, Class<T> elementClass) {
// TODO Move below to somewhere appropriate.
if (elementClass == null) {
throw ExceptionFactory.classForElementCannotBeNull();
}
globals.getIndexMetadataWrapper().clearKeyMetadataEntry(key, elementClass);
String table = null;
if (elementClass.equals(Vertex.class)) {
table = globals.getConfig().getVertexKeyIndexTableName();
} else {
table = globals.getConfig().getEdgeKeyIndexTableName();
}
BatchDeleter bd = null;
try {
bd = globals.getConfig().getConnector().createBatchDeleter(table, globals.getConfig().getAuthorizations(), globals.getConfig().getMaxWriteThreads(), globals.getConfig().getBatchWriterConfig());
bd.setRanges(Collections.singleton(new Range()));
bd.fetchColumnFamily(new Text(key));
bd.delete();
} catch (Exception e) {
throw new AccumuloGraphException(e);
} finally {
if (bd != null)
bd.close();
}
globals.checkedFlush();
}
示例7: deleteElementRanges
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
public static void deleteElementRanges(BatchDeleter deleter, Element... elements) {
List<Range> ranges = new LinkedList<Range>();
for (Element element : elements) {
ranges.add(new Range(element.getId().toString()));
}
deleter.setRanges(ranges);
try {
deleter.delete();
} catch (Exception e) {
throw new AccumuloGraphException(e);
}
}
示例8: deleteAll
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
public boolean deleteAll(
final String tableName,
final String columnFamily,
final String... additionalAuthorizations ) {
BatchDeleter deleter = null;
try {
deleter = createBatchDeleter(
tableName,
additionalAuthorizations);
deleter.setRanges(Arrays.asList(new Range()));
deleter.fetchColumnFamily(new Text(
columnFamily));
deleter.delete();
return true;
}
catch (final TableNotFoundException | MutationsRejectedException e) {
LOGGER.warn(
"Unable to delete row from table [" + tableName + "].",
e);
return false;
}
finally {
if (deleter != null) {
deleter.close();
}
}
}
示例9: deleteAll
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
protected boolean deleteAll(
final String tableName,
final String columnFamily,
final String... additionalAuthorizations ) {
BatchDeleter deleter = null;
try {
deleter = accumuloOperations.createBatchDeleter(
tableName,
additionalAuthorizations);
deleter.setRanges(Arrays.asList(new Range()));
deleter.fetchColumnFamily(new Text(
columnFamily));
deleter.delete();
return true;
}
catch (final TableNotFoundException | MutationsRejectedException e) {
LOGGER.warn(
"Unable to delete row from table [" + tableName + "].",
e);
return false;
}
finally {
if (deleter != null) {
deleter.close();
}
}
}
示例10: remove
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
public static void remove(Store id) throws TableNotFoundException, MutationsRejectedException {
checkNotNull(id);
BatchDeleter bd = null;
try {
bd = id.connector().createBatchDeleter(id.metadataTable(), id.auths(), id.readThreads(), id.writerConfig());
bd.setRanges(Collections.singleton(Range.exact(id.uuid())));
bd.delete();
} finally {
if (null != bd) {
bd.close();
}
}
}
示例11: dropGraph
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
public void dropGraph(final AccumuloRdfConfiguration conf, final RyaURI... graphs) throws RyaDAOException {
BatchDeleter bd_spo = null;
BatchDeleter bd_po = null;
BatchDeleter bd_osp = null;
try {
bd_spo = createBatchDeleter(tableLayoutStrategy.getSpo(), conf.getAuthorizations());
bd_po = createBatchDeleter(tableLayoutStrategy.getPo(), conf.getAuthorizations());
bd_osp = createBatchDeleter(tableLayoutStrategy.getOsp(), conf.getAuthorizations());
bd_spo.setRanges(Collections.singleton(new Range()));
bd_po.setRanges(Collections.singleton(new Range()));
bd_osp.setRanges(Collections.singleton(new Range()));
for (final RyaURI graph : graphs){
bd_spo.fetchColumnFamily(new Text(graph.getData()));
bd_po.fetchColumnFamily(new Text(graph.getData()));
bd_osp.fetchColumnFamily(new Text(graph.getData()));
}
bd_spo.delete();
bd_po.delete();
bd_osp.delete();
//TODO indexers do not support delete-UnsupportedOperation Exception will be thrown
// for (AccumuloIndex index : secondaryIndexers) {
// index.dropGraph(graphs);
// }
} catch (final Exception e) {
throw new RyaDAOException(e);
} finally {
if (bd_spo != null) {
bd_spo.close();
}
if (bd_po != null) {
bd_po.close();
}
if (bd_osp != null) {
bd_osp.close();
}
}
}
示例12: delete
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
public boolean delete(
final String tableName,
final List<ByteArrayId> rowIds,
final String columnFamily,
final String columnQualifier,
final String... authorizations ) {
boolean success = true;
BatchDeleter deleter = null;
try {
deleter = createBatchDeleter(
tableName,
authorizations);
if ((columnFamily != null) && !columnFamily.isEmpty()) {
if ((columnQualifier != null) && !columnQualifier.isEmpty()) {
deleter.fetchColumn(
new Text(
columnFamily),
new Text(
columnQualifier));
}
else {
deleter.fetchColumnFamily(new Text(
columnFamily));
}
}
final Set<ByteArrayId> removeSet = new HashSet<ByteArrayId>();
final List<Range> rowRanges = new ArrayList<Range>();
for (final ByteArrayId rowId : rowIds) {
rowRanges.add(Range.exact(new Text(
rowId.getBytes())));
removeSet.add(new ByteArrayId(
rowId.getBytes()));
}
deleter.setRanges(rowRanges);
final Iterator<Map.Entry<Key, Value>> iterator = deleter.iterator();
while (iterator.hasNext()) {
final Entry<Key, Value> entry = iterator.next();
removeSet.remove(new ByteArrayId(
entry.getKey().getRowData().getBackingArray()));
}
if (removeSet.isEmpty()) {
deleter.delete();
}
deleter.close();
}
catch (final TableNotFoundException | MutationsRejectedException e) {
LOGGER.warn(
"Unable to delete row from table [" + tableName + "].",
e);
if (deleter != null) {
deleter.close();
}
success = false;
}
return success;
}
示例13: delete
import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
public void delete(Store id) throws TableNotFoundException, MutationsRejectedException, UnexpectedStateException {
checkNotNull(id);
Stopwatch sw = new Stopwatch().start();
try {
State s = PersistedStores.getState(id);
if (!State.LOADING.equals(s) && !State.LOADED.equals(s)) {
throw unexpectedState(id, new State[] {State.LOADING, State.LOADED}, s);
}
final State desiredState = State.DELETING;
log.debug("Changing state for {} from {} to {}", new Object[] {id, s, desiredState});
PersistedStores.setState(id, desiredState);
// Delete of the Keys
BatchDeleter bd = null;
try {
bd = id.connector().createBatchDeleter(id.dataTable(), id.auths(), id.readThreads(), id.writerConfig());
bd.setRanges(Collections.singleton(Range.prefix(id.uuid())));
bd.delete();
} finally {
if (null != bd) {
bd.close();
}
}
log.debug("Removing state for {}", id);
PersistedStores.remove(id);
} finally {
sw.stop();
id.tracer().addTiming("Cosmos:delete", sw.elapsed(TimeUnit.MILLISECONDS));
// Be nice and when the client deletes these results, automatically flush the traces for them too
id.sendTraces();
}
}