public static class InMemoryRepository.MemObjDatabase extends DfsObjDatabase
DfsObjDatabase.PackList, DfsObjDatabase.PackSource
Modifier and Type | Method and Description |
---|---|
protected void |
commitPackImpl(Collection<DfsPackDescription> desc,
Collection<DfsPackDescription> replace)
Implementation of pack commit.
|
protected List<DfsPackDescription> |
listPacks()
List the available pack files.
|
protected DfsPackDescription |
newPack(DfsObjDatabase.PackSource source)
Generate a new unique name for a pack file.
|
protected ReadableChannel |
openFile(DfsPackDescription desc,
PackExt ext)
Open a pack, pack index, or other related file for reading.
|
protected void |
rollbackPack(Collection<DfsPackDescription> desc)
Try to rollback a pack creation.
|
void |
setReadableChannelBlockSizeForTest(int blockSize) |
protected DfsOutputStream |
writeFile(DfsPackDescription desc,
PackExt ext)
Open a pack, pack index, or other related file for writing.
|
clearCache, close, commitPack, getCurrentPackList, getCurrentPacks, getCurrentReftables, getPackList, getPacks, getReaderOptions, getReftables, getRepository, has, newInserter, newPack, newReader, reftableComparator, setPackComparator
create, exists, has, newCachedDatabase, open, open
public void setReadableChannelBlockSizeForTest(int blockSize)
blockSize
- force a different block size for testing.protected List<DfsPackDescription> listPacks()
DfsObjDatabase
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.
listPacks
in class DfsObjDatabase
protected DfsPackDescription newPack(DfsObjDatabase.PackSource source)
DfsObjDatabase
newPack
in class DfsObjDatabase
source
- where the pack stream is created.protected void commitPackImpl(Collection<DfsPackDescription> desc, Collection<DfsPackDescription> replace)
DfsObjDatabase
commitPackImpl
in class DfsObjDatabase
desc
- description of the new packs.replace
- if not null, list of packs to remove.DfsObjDatabase.commitPack(Collection, Collection)
protected void rollbackPack(Collection<DfsPackDescription> desc)
DfsObjDatabase
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.
rollbackPack
in class DfsObjDatabase
desc
- pack to delete.protected ReadableChannel openFile(DfsPackDescription desc, PackExt ext) throws FileNotFoundException, IOException
DfsObjDatabase
openFile
in class DfsObjDatabase
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".FileNotFoundException
- the file does not exist.IOException
- the file cannot be opened.protected DfsOutputStream writeFile(DfsPackDescription desc, PackExt ext) throws IOException
DfsObjDatabase
writeFile
in class DfsObjDatabase
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".IOException
- the file cannot be opened.Copyright © 2019 Eclipse JGit Project. All rights reserved.