Class LooseObjects


  • class LooseObjects
    extends java.lang.Object
    Traditional file system based loose objects handler.

    This is the loose object representation for a Git object database, where objects are stored loose by hashing them into directories by their ObjectId.

    • Field Detail

      • LOG

        private static final org.slf4j.Logger LOG
      • directory

        private final java.io.File directory
    • Constructor Detail

      • LooseObjects

        LooseObjects​(java.io.File dir)
        Initialize a reference to an on-disk object directory.
        Parameters:
        dir - the location of the objects directory.
    • Method Detail

      • getDirectory

        java.io.File getDirectory()
        Getter for the field directory.
        Returns:
        the location of the objects directory.
      • create

        void create()
             throws java.io.IOException
        Throws:
        java.io.IOException
      • close

        void close()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • has

        boolean has​(AnyObjectId objectId)
        Does the requested object exist as a loose object?
        Parameters:
        objectId - identity of the object to test for existence of.
        Returns:
        true if the specified object is stored as a loose object.
      • resolve

        boolean resolve​(java.util.Set<ObjectId> matches,
                        AbbreviatedObjectId id,
                        int matchLimit)
        Find objects matching the prefix abbreviation.
        Parameters:
        matches - set to add any located ObjectIds to. This is an output parameter.
        id - prefix to search for.
        matchLimit - maximum number of results to return. At most this many ObjectIds should be added to matches before returning.
        Returns:
        true if the matches were exhausted before reaching maxLimit.
      • getSize

        long getSize​(WindowCursor curs,
                     AnyObjectId id)
              throws java.io.IOException
        Throws:
        java.io.IOException
      • fileFor

        java.io.File fileFor​(AnyObjectId objectId)
        Compute the location of a loose object file.
        Parameters:
        objectId - identity of the object to get the File location for.
        Returns:
        File location of the specified loose object.