Class RefsUnreadableInMemoryRepository.RefsUnreadableRefDatabase

    • Constructor Detail

      • RefsUnreadableRefDatabase

        private RefsUnreadableRefDatabase()
    • Method Detail

      • exactRef

        public Ref exactRef​(java.lang.String name)
                     throws java.io.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:
        java.io.IOException - the reference space cannot be accessed.
      • getRefs

        public java.util.Map<java.lang.String,​Ref> getRefs​(java.lang.String prefix)
                                                          throws java.io.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:
        java.io.IOException - the reference space cannot be accessed.
      • getRefsByPrefix

        public java.util.List<Ref> getRefsByPrefix​(java.lang.String prefix)
                                            throws java.io.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:
        java.io.IOException - the reference space cannot be accessed.
      • getRefsByPrefixWithExclusions

        public java.util.List<Ref> getRefsByPrefixWithExclusions​(java.lang.String include,
                                                                 java.util.Set<java.lang.String> excludes)
                                                          throws java.io.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:
        java.io.IOException - the reference space cannot be accessed.
      • getTipsWithSha1

        public java.util.Set<Ref> getTipsWithSha1​(ObjectId id)
                                           throws java.io.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:
        java.io.IOException - the reference space cannot be accessed.