InMemoryNoteBucket.java

  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.notes;

  11. /** A note bucket that has been loaded into the process. */
  12. abstract class InMemoryNoteBucket extends NoteBucket {
  13.     /**
  14.      * Number of leading digits that leads to this bucket in the note path.
  15.      *
  16.      * This is counted in terms of hex digits, not raw bytes. Each bucket level
  17.      * is typically 2 higher than its parent, placing about 256 items in each
  18.      * level of the tree.
  19.      */
  20.     final int prefixLen;

  21.     /**
  22.      * Chain of non-note tree entries found at this path in the tree.
  23.      *
  24.      * During parsing of a note tree into the in-memory representation,
  25.      * {@link NoteParser} keeps track of all non-note tree entries and stores
  26.      * them here as a sorted linked list. That list can be merged back with the
  27.      * note data that is held by the subclass, allowing the tree to be
  28.      * recreated.
  29.      */
  30.     NonNoteEntry nonNotes;

  31.     InMemoryNoteBucket(int prefixLen) {
  32.         this.prefixLen = prefixLen;
  33.     }

  34.     abstract InMemoryNoteBucket append(Note note);
  35. }