Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

Added read/write support for pack bitmap index. A pack bitmap index is an additional index of compressed bitmaps of the object graph. Furthermore, a logical API of the index functionality is included, as it is expected to be used by the PackWriter. Compressed bitmaps are created using the javaewah library, which is a word-aligned compressed variant of the Java bitset class based on run-length encoding. The library only works with positive integer values. Thus, the maximum number of ObjectIds in a pack file that this index can currently support is limited to Integer.MAX_VALUE. Every ObjectId is given an integer mapping. The integer is the position of the ObjectId in the complete ObjectId list, sorted by offset, for the pack file. That integer is what the bitmaps use to reference the ObjectId. Currently, the new index format can only be used with pack files that contain a complete closure of the object graph e.g. the result of a garbage collection. The index file includes four bitmaps for the Git object types i.e. commits, trees, blobs, and tags. In addition, a collection of bitmaps keyed by an ObjectId is also included. The bitmap for each entry in the collection represents the full closure of ObjectIds reachable from the keyed ObjectId (including the keyed ObjectId itself). The bitmaps are further compressed by XORing the current bitmaps against prior bitmaps in the index, and selecting the smallest representation. The XOR'd bitmap and offset from the current entry to the position of the bitmap to XOR against is the actual representation of the entry in the index file. Each entry contains one byte, which is currently used to note whether the bitmap should be blindly reused. Change-Id: Id328724bf6b4c8366a088233098c18643edcf40f
pirms 11 gadiem
Added read/write support for pack bitmap index. A pack bitmap index is an additional index of compressed bitmaps of the object graph. Furthermore, a logical API of the index functionality is included, as it is expected to be used by the PackWriter. Compressed bitmaps are created using the javaewah library, which is a word-aligned compressed variant of the Java bitset class based on run-length encoding. The library only works with positive integer values. Thus, the maximum number of ObjectIds in a pack file that this index can currently support is limited to Integer.MAX_VALUE. Every ObjectId is given an integer mapping. The integer is the position of the ObjectId in the complete ObjectId list, sorted by offset, for the pack file. That integer is what the bitmaps use to reference the ObjectId. Currently, the new index format can only be used with pack files that contain a complete closure of the object graph e.g. the result of a garbage collection. The index file includes four bitmaps for the Git object types i.e. commits, trees, blobs, and tags. In addition, a collection of bitmaps keyed by an ObjectId is also included. The bitmap for each entry in the collection represents the full closure of ObjectIds reachable from the keyed ObjectId (including the keyed ObjectId itself). The bitmaps are further compressed by XORing the current bitmaps against prior bitmaps in the index, and selecting the smallest representation. The XOR'd bitmap and offset from the current entry to the position of the bitmap to XOR against is the actual representation of the entry in the index file. Each entry contains one byte, which is currently used to note whether the bitmap should be blindly reused. Change-Id: Id328724bf6b4c8366a088233098c18643edcf40f
pirms 11 gadiem
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C) 2013, 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.pack;
  11. /**
  12. * A pack file extension.
  13. */
  14. public enum PackExt {
  15. /** A pack file extension. */
  16. PACK("pack"), //$NON-NLS-1$
  17. /** A pack index file extension. */
  18. INDEX("idx"), //$NON-NLS-1$
  19. /** A keep pack file extension. */
  20. KEEP("keep"), //$NON-NLS-1$
  21. /** A pack bitmap index file extension. */
  22. BITMAP_INDEX("bitmap"), //$NON-NLS-1$
  23. /** A reftable file. */
  24. REFTABLE("ref"); //$NON-NLS-1$
  25. private final String ext;
  26. private PackExt(String ext) {
  27. this.ext = ext;
  28. }
  29. /**
  30. * Get the file extension.
  31. *
  32. * @return the file extension.
  33. */
  34. public String getExtension() {
  35. return ext;
  36. }
  37. /**
  38. * Get the position of the extension in the enum declaration.
  39. *
  40. * @return the position of the extension in the enum declaration.
  41. */
  42. public int getPosition() {
  43. return ordinal();
  44. }
  45. /**
  46. * Get the bit mask of the extension e.g {@code 1 << getPosition()}.
  47. *
  48. * @return the bit mask of the extension e.g {@code 1 << getPosition()}.
  49. */
  50. public int getBit() {
  51. return 1 << getPosition();
  52. }
  53. /** {@inheritDoc} */
  54. @Override
  55. public String toString() {
  56. return String.format("PackExt[%s, bit=0x%s]", getExtension(), //$NON-NLS-1$
  57. Integer.toHexString(getBit()));
  58. }
  59. }