Class InMemoryRepository.MemObjDatabase

    • Method Detail

      • setReadableChannelBlockSizeForTest

        public void setReadableChannelBlockSizeForTest​(int blockSize)
        Parameters:
        blockSize - force a different block size for testing.
      • listPacks

        protected java.util.List<DfsPackDescription> listPacks()
        Description copied from class: DfsObjDatabase
        List the available pack files.

        The returned list must support random access and must be mutable by the caller. It is sorted in place using the natural sorting of the returned DfsPackDescription objects.

        Specified by:
        listPacks in class DfsObjDatabase
        Returns:
        available packs. May be empty if there are no packs.
      • rollbackPack

        protected void rollbackPack​(java.util.Collection<DfsPackDescription> desc)
        Description copied from class: DfsObjDatabase
        Try to rollback a pack creation.

        JGit DFS always writes the pack first, then the index. If the pack does not yet exist, then neither does the index. A safe DFS implementation would try to remove both files to ensure they are really gone.

        A rollback does not support failures, as it only occurs when there is already a failure in progress. A DFS implementor may wish to log warnings/error messages when a rollback fails, but should not send new exceptions up the Java callstack.

        Specified by:
        rollbackPack in class DfsObjDatabase
        Parameters:
        desc - pack to delete.
      • openFile

        protected ReadableChannel openFile​(DfsPackDescription desc,
                                           PackExt ext)
                                    throws java.io.FileNotFoundException,
                                           java.io.IOException
        Description copied from class: DfsObjDatabase
        Open a pack, pack index, or other related file for reading.
        Specified by:
        openFile in class DfsObjDatabase
        Parameters:
        desc - description of pack related to the data that will be read. This is an instance previously obtained from DfsObjDatabase.listPacks(), but not necessarily from the same DfsObjDatabase instance.
        ext - file extension that will be read i.e "pack" or "idx".
        Returns:
        channel to read the file.
        Throws:
        java.io.FileNotFoundException - the file does not exist.
        java.io.IOException - the file cannot be opened.
      • writeFile

        protected DfsOutputStream writeFile​(DfsPackDescription desc,
                                            PackExt ext)
                                     throws java.io.IOException
        Description copied from class: DfsObjDatabase
        Open a pack, pack index, or other related file for writing.
        Specified by:
        writeFile in class DfsObjDatabase
        Parameters:
        desc - description of pack related to the data that will be written. This is an instance previously obtained from DfsObjDatabase.newPack(PackSource).
        ext - file extension that will be written i.e "pack" or "idx".
        Returns:
        channel to write the file.
        Throws:
        java.io.IOException - the file cannot be opened.