@Override public Integer getPartitionKey() { //if (repo != null) { // return repo.getDistributionStrategy().getDistributionHash(uri); //} return distributor.getDistributionHash(uri); }
private void iterateDocuments(Map<String, Object> documents, Properties props, ResultCursorBase<DocumentAccessor> cln) throws BagriException { for (Map.Entry<String, Object> document: documents.entrySet()) { String uri = document.getKey(); int hash = repo.getDistributionStrategy().getDistributionHash(uri); if (ddSvc.isLocalKey(hash)) { cln.add(storeDocument(document.getKey(), document.getValue(), props)); } } }
/** * {@inheritDoc} */ @Override public DocumentKey newDocumentKey(String documentUri, int revision, int version) { return new DocumentPartKey(repo.getDistributionStrategy().getDistributionHash(documentUri), revision, version); }
private DocumentKey getDocumentKey(String uri) { int hash = repo.getDistributionStrategy().getDistributionHash(uri); return new DocumentPartKey(hash, 0, 1); }
public RecordStore<?> getRecordStore(String uri, String storeName) { int hash = repo.getDistributionStrategy().getDistributionHash(uri); int partId = getPartitionId(hash); return getRecordStore(partId, storeName); }
@ManagedOperation(description="Return Document Location Info") @ManagedOperationParameters({ @ManagedOperationParameter(name = "uri", description = "Document identifier")}) public CompositeData getDocumentLocation(String uri) { try { Properties props = new Properties(); props.setProperty("bdb.document.headers", String.valueOf(DocumentAccessor.HDR_URI)); DocumentAccessor doc = docManager.getDocument(uri, props); CompositeData result = null; if (doc != null) { int hash = schemaManager.getRepository().getDistributionStrategy().getDistributionHash(uri); Partition part = hzClient.getPartitionService().getPartition(hash); Map<String, Object> location = new HashMap<>(2); location.put("partition", part.getPartitionId()); location.put("owner", part.getOwner().toString()); result = JMXUtils.mapToComposite("document", "Document Location", location); } logger.debug("getDocumentLocation; returning: {}", result); return result; } catch (BagriException ex) { logger.error("getDocumentLocation.error: {}", ex.getMessage(), ex); throw new RuntimeException(ex.getMessage()); } }
public DocumentKey getLastRevisionKeyForUri(String uri) { MapService svc = nodeEngine.getService(MapService.SERVICE_NAME); MapServiceContext mapCtx = svc.getMapServiceContext(); Integer hash = repo.getDistributionStrategy().getDistributionHash(uri); Query query = new Query(CN_XDM_DOCUMENT, Predicates.equal("__key#hash", hash), IterationType.ENTRY, null, null); DocumentKey last = null;