• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BatchDeleter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.accumulo.core.client.BatchDeleter的典型用法代码示例。如果您正苦于以下问题:Java BatchDeleter类的具体用法?Java BatchDeleter怎么用?Java BatchDeleter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BatchDeleter类属于org.apache.accumulo.core.client包,在下文中一共展示了BatchDeleter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
    }
  }
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:26,代码来源:BaseIndexValuesTableWrapper.java


示例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();
    }
  }
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:23,代码来源:VertexTableWrapper.java


示例3: createBatchDeleter

import org.apache.accumulo.core.client.BatchDeleter; //导入依赖的package包/类
@Override
public BatchDeleter createBatchDeleter(
		final String tableName,
		final String... additionalAuthorizations )
		throws TableNotFoundException {
	return connector.createBatchDeleter(
			getQualifiedTableName(tableName),
			new Authorizations(
					getAuthorizations(additionalAuthorizations)),
			numThreads,
			new BatchWriterConfig().setMaxWriteThreads(
					numThreads).setMaxMemory(
					byteBufferSize).setTimeout(
					timeoutMillis,
					TimeUnit.MILLISECONDS));
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:17,代码来源:BasicAccumuloOperations.java


示例4: 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");
	}
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:20,代码来源:AccumuloDataStore.java


示例5: 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);
    }
 
开发者ID:calrissian,项目名称:accumulo-recipes,代码行数:17,代码来源:AccumuloTestUtils.java


示例6: 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();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:13,代码来源:AccumuloRyaDAO.java


示例7: createBatchDeleter

import org.apache.accumulo.core.client.BatchDeleter; //导入依赖的package包/类
@Override
@Deprecated
public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, long maxMemory, long maxLatency,
    int maxWriteThreads) throws TableNotFoundException {
  return createBatchDeleter(tableName, authorizations, numQueryThreads, new BatchWriterConfig().setMaxLatency(maxLatency, TimeUnit.MILLISECONDS)
      .setMaxMemory(maxMemory).setMaxWriteThreads(maxWriteThreads));
}
 
开发者ID:JHUAPL,项目名称:accumulo-proxy-instance,代码行数:8,代码来源:ProxyConnector.java


示例8: 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();
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:30,代码来源:AccumuloGraph.java


示例9: 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);
  }
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:15,代码来源:Mutators.java


示例10: getDeleter

import org.apache.accumulo.core.client.BatchDeleter; //导入依赖的package包/类
protected BatchDeleter getDeleter() {
  try {
    return globals.getConfig().getConnector().createBatchDeleter(tableName,
        globals.getConfig().getAuthorizations(), globals.getConfig().getMaxWriteThreads(),
        globals.getConfig().getBatchWriterConfig());
  } catch (Exception e) {
    throw new AccumuloGraphException(e);
  }
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:10,代码来源:BaseTableWrapper.java


示例11: 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();
		}
	}

}
 
开发者ID:locationtech,项目名称:geowave,代码行数:30,代码来源:BasicAccumuloOperations.java


示例12: 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();
		}
	}

}
 
开发者ID:locationtech,项目名称:geowave,代码行数:31,代码来源:AccumuloDataStore.java


示例13: initCloseableIterator

import org.apache.accumulo.core.client.BatchDeleter; //导入依赖的package包/类
@Override
protected CloseableIterator<T> initCloseableIterator(
		ScannerBase scanner,
		Iterator it ) {
	return new CloseableIteratorWrapper(
			new Closeable() {
				boolean closed = false;

				@Override
				public void close()
						throws IOException {
					if (!closed) {
						if (scanner instanceof BatchDeleter) {
							try {
								((BatchDeleter) scanner).delete();
							}
							catch (MutationsRejectedException | TableNotFoundException e) {
								LOGGER.warn(
										"Unable to delete rows by query constraints",
										e);
							}
						}
						scanner.close();
					}
					closed = true;
				}
			},
			it);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:30,代码来源:AccumuloRowPrefixDelete.java


示例14: createScanner

import org.apache.accumulo.core.client.BatchDeleter; //导入依赖的package包/类
@Override
protected ScannerBase createScanner(
		AccumuloOperations accumuloOperations,
		String tableName,
		boolean batchScanner,
		String... authorizations )
		throws TableNotFoundException {
	BatchDeleter deleter = accumuloOperations.createBatchDeleter(
			tableName,
			authorizations);
	deleter.removeScanIterator(BatchDeleter.class.getName() + ".NOVALUE");
	return deleter;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:14,代码来源:AccumuloRowPrefixDelete.java


示例15: initCloseableIterator

import org.apache.accumulo.core.client.BatchDeleter; //导入依赖的package包/类
@Override
protected CloseableIterator<Object> initCloseableIterator(
		ScannerBase scanner,
		Iterator it ) {
	return new CloseableIteratorWrapper(
			new Closeable() {
				boolean closed = false;

				@Override
				public void close()
						throws IOException {
					if (!closed) {
						if (scanner instanceof BatchDeleter) {
							try {
								((BatchDeleter) scanner).delete();
							}
							catch (MutationsRejectedException | TableNotFoundException e) {
								LOGGER.warn(
										"Unable to delete rows by query constraints",
										e);
							}
						}
						scanner.close();
					}
					closed = true;
				}
			},
			it);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:30,代码来源:AccumuloRowIdsDelete.java


示例16: 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();
    }
  }
}
 
开发者ID:joshelser,项目名称:cosmos,代码行数:15,代码来源:PersistedStores.java


示例17: 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();
            }
        }

    }
 
开发者ID:apache,项目名称:incubator-rya,代码行数:46,代码来源:AccumuloRyaDAO.java


示例18: createBatchDeleter

import org.apache.accumulo.core.client.BatchDeleter; //导入依赖的package包/类
private BatchDeleter createBatchDeleter(final String tableName, final Authorizations authorizations) throws TableNotFoundException {
    return connector.createBatchDeleter(tableName, authorizations, NUM_THREADS, MAX_MEMORY, MAX_TIME, NUM_THREADS);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:4,代码来源:AccumuloRyaDAO.java


示例19: 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;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:63,代码来源:BasicAccumuloOperations.java


示例20: ClosableBatchDeleter

import org.apache.accumulo.core.client.BatchDeleter; //导入依赖的package包/类
public ClosableBatchDeleter(
		final BatchDeleter deleter ) {
	this.deleter = deleter;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:5,代码来源:AccumuloDataStore.java



注:本文中的org.apache.accumulo.core.client.BatchDeleter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CredentialRequestResult类代码示例发布时间:2022-05-22
下一篇:
Java IListChangeListener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap