You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ObjectReachabilityChecker.java 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2020, Google LLC and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.revwalk;
  11. import java.io.IOException;
  12. import java.util.Collection;
  13. import java.util.Optional;
  14. import java.util.stream.Stream;
  15. /**
  16. * Checks if all objects are reachable from certain starting points.
  17. *
  18. * This is an expensive check that browses commits, trees, blobs and tags. For
  19. * reachability just between commits see {@link ReachabilityChecker}
  20. * implementations.
  21. *
  22. * @since 5.8
  23. */
  24. public interface ObjectReachabilityChecker {
  25. /**
  26. * Checks that all targets are reachable from the starters.
  27. *
  28. * @implSpec Missing or invalid objects are reported as illegal state.
  29. * Caller should have found them while translating ObjectIds into
  30. * RevObjects. They can only happen here if the caller is mixing
  31. * revwalks.
  32. *
  33. * @param targets
  34. * objects to check for reachability from the starters
  35. * @param starters
  36. * objects known to be reachable to the caller
  37. * @return Optional a single unreachable target if there are any (there
  38. * could be more). Empty optional means all targets are reachable.
  39. * @throws IOException
  40. * Cannot access underlying storage
  41. */
  42. Optional<RevObject> areAllReachable(Collection<RevObject> targets,
  43. Stream<RevObject> starters) throws IOException;
  44. }