Class RefsUnreadableInMemoryRepository.RefsUnreadableRefDatabase

Enclosing class:
RefsUnreadableInMemoryRepository

private class RefsUnreadableInMemoryRepository.RefsUnreadableRefDatabase extends InMemoryRepository.MemRefDatabase
  • Constructor Details

    • RefsUnreadableRefDatabase

      private RefsUnreadableRefDatabase()
  • Method Details

    • exactRef

      public Ref exactRef(String name) throws IOException
      Read a single reference.

      Unlike RefDatabase.findRef(java.lang.String), this method expects an unshortened reference name and does not search using the standard RefDatabase.SEARCH_PATH.

      Overrides:
      exactRef in class DfsReftableDatabase
      Parameters:
      name - the unabbreviated name of the reference.
      Returns:
      the reference (if it exists); else null.
      Throws:
      IOException - the reference space cannot be accessed.
    • getRefs

      public Map<String,Ref> getRefs(String prefix) throws IOException
      Get a section of the reference namespace.
      Overrides:
      getRefs in class DfsReftableDatabase
      Parameters:
      prefix - prefix to search the namespace with; must end with /. If the empty string (RefDatabase.ALL), obtain a complete snapshot of all references.
      Returns:
      modifiable map that is a complete snapshot of the current reference namespace, with prefix removed from the start of each key. The map can be an unsorted map.
      Throws:
      IOException - the reference space cannot be accessed.
    • getRefsByPrefix

      public List<Ref> getRefsByPrefix(String prefix) throws IOException
      Returns refs whose names start with a given prefix.

      The default implementation uses RefDatabase.getRefs(String). Implementors of RefDatabase should override this method directly if a better implementation is possible.

      Overrides:
      getRefsByPrefix in class DfsReftableDatabase
      Parameters:
      prefix - string that names of refs should start with; may be empty (to return all refs).
      Returns:
      immutable list of refs whose names start with prefix.
      Throws:
      IOException - the reference space cannot be accessed.
    • getRefsByPrefixWithExclusions

      public List<Ref> getRefsByPrefixWithExclusions(String include, Set<String> excludes) throws IOException
      Returns refs whose names start with a given prefix excluding all refs that start with one of the given prefixes.

      The default implementation is not efficient. Implementors of RefDatabase should override this method directly if a better implementation is possible.

      Overrides:
      getRefsByPrefixWithExclusions in class DfsReftableDatabase
      Parameters:
      include - string that names of refs should start with; may be empty.
      excludes - strings that names of refs can't start with; may be empty.
      Returns:
      immutable list of refs whose names start with prefix and none of the strings in exclude.
      Throws:
      IOException - the reference space cannot be accessed.
    • getTipsWithSha1

      public Set<Ref> getTipsWithSha1(ObjectId id) throws IOException
      Returns all refs that resolve directly to the given ObjectId. Includes peeled ObjectIds. This is the inverse lookup of RefDatabase.exactRef(String...).

      The default implementation uses a linear scan. Implementors of RefDatabase should override this method directly if a better implementation is possible.

      Overrides:
      getTipsWithSha1 in class DfsReftableDatabase
      Parameters:
      id - ObjectId to resolve
      Returns:
      a Set of Refs whose tips point to the provided id.
      Throws:
      IOException - the reference space cannot be accessed.