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.

DfsObjectRepresentation.java 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (C) 2011, 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.internal.storage.dfs;
  11. import org.eclipse.jgit.internal.storage.pack.StoredObjectRepresentation;
  12. import org.eclipse.jgit.lib.ObjectId;
  13. class DfsObjectRepresentation extends StoredObjectRepresentation {
  14. final DfsPackFile pack;
  15. int format;
  16. long offset;
  17. long length;
  18. ObjectId baseId;
  19. DfsObjectRepresentation(DfsPackFile pack) {
  20. this.pack = pack;
  21. }
  22. /** {@inheritDoc} */
  23. @Override
  24. public int getFormat() {
  25. return format;
  26. }
  27. /** {@inheritDoc} */
  28. @Override
  29. public int getWeight() {
  30. return (int) Math.min(length, Integer.MAX_VALUE);
  31. }
  32. /** {@inheritDoc} */
  33. @Override
  34. public ObjectId getDeltaBase() {
  35. return baseId;
  36. }
  37. /** {@inheritDoc} */
  38. @Override
  39. public boolean wasDeltaAttempted() {
  40. switch (pack.getPackDescription().getPackSource()) {
  41. case GC:
  42. case GC_REST:
  43. return true;
  44. default:
  45. return false;
  46. }
  47. }
  48. }