@Test public void duplicateBlobIdsTest() throws RouterException { blobIds.add(blobIds.get(0)); try { undeleteManager.submitUndeleteOperation(blobIds, UNDELETE_SERVICE_ID, new FutureResult<>(), null); fail("Should have failed to submit operation because the provided blob id list contains duplicates"); } catch (IllegalArgumentException e) { } }
void submitUndeleteOperation(Collection<String> blobIdStrs, String serviceId, FutureResult<Void> futureResult, Callback<Void> callback) throws RouterException { if (!isOpen()) { throw new IllegalStateException("UndeleteManager is closed"); } List<BlobId> blobIds = new ArrayList<>(); for (String blobIdStr : blobIdStrs) { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdStr, clusterMap); if (blobId.getDatacenterId() != ClusterMap.UNKNOWN_DATACENTER_ID && blobId.getDatacenterId() != clusterMap.getLocalDatacenterId()) { routerMetrics.undeleteBlobNotOriginateLocalOperationRate.mark(); } blobIds.add(blobId); } if (blobIds.size() == 1) { UndeleteOperation undeleteOperation = new UndeleteOperation(clusterMap, routerConfig, routerMetrics, blobIds.get(0), serviceId, time.milliseconds(), callback, time, futureResult); undeleteOperations.add(undeleteOperation); } else { BatchOperationCallbackTracker tracker = new BatchOperationCallbackTracker(blobIds, futureResult, callback); long operationTimeMs = time.milliseconds(); for (BlobId blobId : blobIds) { UndeleteOperation undeleteOperation = new UndeleteOperation(clusterMap, routerConfig, routerMetrics, blobId, serviceId, operationTimeMs, tracker.getCallback(blobId), time, BatchOperationCallbackTracker.DUMMY_FUTURE); undeleteOperations.add(undeleteOperation); } } }
UndeleteManager { void submitUndeleteOperation(Collection<String> blobIdStrs, String serviceId, FutureResult<Void> futureResult, Callback<Void> callback) throws RouterException { if (!isOpen()) { throw new IllegalStateException("UndeleteManager is closed"); } List<BlobId> blobIds = new ArrayList<>(); for (String blobIdStr : blobIdStrs) { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdStr, clusterMap); if (blobId.getDatacenterId() != ClusterMap.UNKNOWN_DATACENTER_ID && blobId.getDatacenterId() != clusterMap.getLocalDatacenterId()) { routerMetrics.undeleteBlobNotOriginateLocalOperationRate.mark(); } blobIds.add(blobId); } if (blobIds.size() == 1) { UndeleteOperation undeleteOperation = new UndeleteOperation(clusterMap, routerConfig, routerMetrics, blobIds.get(0), serviceId, time.milliseconds(), callback, time, futureResult); undeleteOperations.add(undeleteOperation); } else { BatchOperationCallbackTracker tracker = new BatchOperationCallbackTracker(blobIds, futureResult, callback); long operationTimeMs = time.milliseconds(); for (BlobId blobId : blobIds) { UndeleteOperation undeleteOperation = new UndeleteOperation(clusterMap, routerConfig, routerMetrics, blobId, serviceId, operationTimeMs, tracker.getCallback(blobId), time, BatchOperationCallbackTracker.DUMMY_FUTURE); undeleteOperations.add(undeleteOperation); } } } }
UndeleteManager { void submitUndeleteOperation(Collection<String> blobIdStrs, String serviceId, FutureResult<Void> futureResult, Callback<Void> callback) throws RouterException { if (!isOpen()) { throw new IllegalStateException("UndeleteManager is closed"); } List<BlobId> blobIds = new ArrayList<>(); for (String blobIdStr : blobIdStrs) { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdStr, clusterMap); if (blobId.getDatacenterId() != ClusterMap.UNKNOWN_DATACENTER_ID && blobId.getDatacenterId() != clusterMap.getLocalDatacenterId()) { routerMetrics.undeleteBlobNotOriginateLocalOperationRate.mark(); } blobIds.add(blobId); } if (blobIds.size() == 1) { UndeleteOperation undeleteOperation = new UndeleteOperation(clusterMap, routerConfig, routerMetrics, blobIds.get(0), serviceId, time.milliseconds(), callback, time, futureResult); undeleteOperations.add(undeleteOperation); } else { BatchOperationCallbackTracker tracker = new BatchOperationCallbackTracker(blobIds, futureResult, callback); long operationTimeMs = time.milliseconds(); for (BlobId blobId : blobIds) { UndeleteOperation undeleteOperation = new UndeleteOperation(clusterMap, routerConfig, routerMetrics, blobId, serviceId, operationTimeMs, tracker.getCallback(blobId), time, BatchOperationCallbackTracker.DUMMY_FUTURE); undeleteOperations.add(undeleteOperation); } } } UndeleteManager(ClusterMap clusterMap, ResponseHandler responseHandler, NotificationSystem notificationSystem,
      AccountService accountService, RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, Time time); }
UndeleteManager { void submitUndeleteOperation(Collection<String> blobIdStrs, String serviceId, FutureResult<Void> futureResult, Callback<Void> callback) throws RouterException { if (!isOpen()) { throw new IllegalStateException("UndeleteManager is closed"); } List<BlobId> blobIds = new ArrayList<>(); for (String blobIdStr : blobIdStrs) { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdStr, clusterMap); if (blobId.getDatacenterId() != ClusterMap.UNKNOWN_DATACENTER_ID && blobId.getDatacenterId() != clusterMap.getLocalDatacenterId()) { routerMetrics.undeleteBlobNotOriginateLocalOperationRate.mark(); } blobIds.add(blobId); } if (blobIds.size() == 1) { UndeleteOperation undeleteOperation = new UndeleteOperation(clusterMap, routerConfig, routerMetrics, blobIds.get(0), serviceId, time.milliseconds(), callback, time, futureResult); undeleteOperations.add(undeleteOperation); } else { BatchOperationCallbackTracker tracker = new BatchOperationCallbackTracker(blobIds, futureResult, callback); long operationTimeMs = time.milliseconds(); for (BlobId blobId : blobIds) { UndeleteOperation undeleteOperation = new UndeleteOperation(clusterMap, routerConfig, routerMetrics, blobId, serviceId, operationTimeMs, tracker.getCallback(blobId), time, BatchOperationCallbackTracker.DUMMY_FUTURE); undeleteOperations.add(undeleteOperation); } } } UndeleteManager(ClusterMap clusterMap, ResponseHandler responseHandler, NotificationSystem notificationSystem,
      AccountService accountService, RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, Time time);  }
UndeleteManager { void submitUndeleteOperation(Collection<String> blobIdStrs, String serviceId, FutureResult<Void> futureResult, Callback<Void> callback) throws RouterException { if (!isOpen()) { throw new IllegalStateException("UndeleteManager is closed"); } List<BlobId> blobIds = new ArrayList<>(); for (String blobIdStr : blobIdStrs) { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdStr, clusterMap); if (blobId.getDatacenterId() != ClusterMap.UNKNOWN_DATACENTER_ID && blobId.getDatacenterId() != clusterMap.getLocalDatacenterId()) { routerMetrics.undeleteBlobNotOriginateLocalOperationRate.mark(); } blobIds.add(blobId); } if (blobIds.size() == 1) { UndeleteOperation undeleteOperation = new UndeleteOperation(clusterMap, routerConfig, routerMetrics, blobIds.get(0), serviceId, time.milliseconds(), callback, time, futureResult); undeleteOperations.add(undeleteOperation); } else { BatchOperationCallbackTracker tracker = new BatchOperationCallbackTracker(blobIds, futureResult, callback); long operationTimeMs = time.milliseconds(); for (BlobId blobId : blobIds) { UndeleteOperation undeleteOperation = new UndeleteOperation(clusterMap, routerConfig, routerMetrics, blobId, serviceId, operationTimeMs, tracker.getCallback(blobId), time, BatchOperationCallbackTracker.DUMMY_FUTURE); undeleteOperations.add(undeleteOperation); } } } UndeleteManager(ClusterMap clusterMap, ResponseHandler responseHandler, NotificationSystem notificationSystem,
      AccountService accountService, RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, Time time);   }