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.

AsyncObjectLoaderQueue.java 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright (C) 2010, Google Inc. 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.lib;
  11. import java.io.IOException;
  12. import org.eclipse.jgit.errors.MissingObjectException;
  13. /**
  14. * Queue to open objects asynchronously.
  15. *
  16. * A queue may perform background decompression of objects and supply them
  17. * (possibly out-of-order) to the application.
  18. *
  19. * @param <T>
  20. * type of identifier supplied to the call that made the queue.
  21. */
  22. public interface AsyncObjectLoaderQueue<T extends ObjectId> extends
  23. AsyncOperation {
  24. /**
  25. * Position this queue onto the next available result.
  26. *
  27. * Even if this method returns true, {@link #open()} may still throw
  28. * {@link org.eclipse.jgit.errors.MissingObjectException} if the underlying
  29. * object database was concurrently modified and the current object is no
  30. * longer available.
  31. *
  32. * @return true if there is a result available; false if the queue has
  33. * finished its input iteration.
  34. * @throws org.eclipse.jgit.errors.MissingObjectException
  35. * the object does not exist. If the implementation is retaining
  36. * the application's objects {@link #getCurrent()} will be the
  37. * current object that is missing. There may be more results
  38. * still available, so the caller should continue invoking next
  39. * to examine another result.
  40. * @throws java.io.IOException
  41. * the object store cannot be accessed.
  42. */
  43. boolean next() throws MissingObjectException, IOException;
  44. /**
  45. * Get the current object, null if the implementation lost track.
  46. *
  47. * @return the current object, null if the implementation lost track.
  48. * Implementations may for performance reasons discard the caller's
  49. * ObjectId and provider their own through {@link #getObjectId()}.
  50. */
  51. T getCurrent();
  52. /**
  53. * Get the ObjectId of the current object. Never null.
  54. *
  55. * @return the ObjectId of the current object. Never null.
  56. */
  57. ObjectId getObjectId();
  58. /**
  59. * Obtain a loader to read the object.
  60. *
  61. * This method can only be invoked once per result
  62. *
  63. * Due to race conditions with a concurrent modification of the underlying
  64. * object database, an object may be unavailable when this method is
  65. * invoked, even though next returned successfully.
  66. *
  67. * @return the ObjectLoader to read this object. Never null.
  68. * @throws MissingObjectException
  69. * the object does not exist. If the implementation is retaining
  70. * the application's objects {@link #getCurrent()} will be the
  71. * current object that is missing. There may be more results
  72. * still available, so the caller should continue invoking next
  73. * to examine another result.
  74. * @throws java.io.IOException
  75. * the object store cannot be accessed.
  76. */
  77. ObjectLoader open() throws IOException;
  78. }