Class InMemoryRepository
- java.lang.Object
-
- org.eclipse.jgit.lib.Repository
-
- org.eclipse.jgit.internal.storage.dfs.DfsRepository
-
- org.eclipse.jgit.internal.storage.dfs.InMemoryRepository
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
RefsUnreadableInMemoryRepository
public class InMemoryRepository extends DfsRepository
Git repository stored entirely in the local process memory.This implementation builds on the DFS repository by storing all reference and object data in the local process. It is not very efficient and exists only for unit testing and small experiments.
The repository is thread-safe. Memory used is released only when this object is garbage collected. Closing the repository has no impact on its memory.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInMemoryRepository.BuilderBuilder for in-memory repositories.private static classInMemoryRepository.ByteArrayReadableChannelstatic classInMemoryRepository.MemObjDatabaseDfsObjDatabase used by InMemoryRepository.private static classInMemoryRepository.MemPackprotected classInMemoryRepository.MemRefDatabaseDfsRefDatabase used by InMemoryRepository.private static classInMemoryRepository.Out
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringgitwebDescriptionprivate InMemoryRepository.MemObjDatabaseobjdb(package private) static java.util.concurrent.atomic.AtomicIntegerpackIdprivate InMemoryRepository.MemRefDatabaserefdb
-
Constructor Summary
Constructors Constructor Description InMemoryRepository(DfsRepositoryDescription repoDesc)Initialize a new in-memory repository.InMemoryRepository(InMemoryRepository.Builder builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetGitwebDescription()Read theGIT_DIR/descriptionfile for gitweb.InMemoryRepository.MemObjDatabasegetObjectDatabase()Get the object database which stores this repository's data.RefDatabasegetRefDatabase()Get the reference database which stores the reference namespace.voidsetGitwebDescription(java.lang.String d)Set theGIT_DIR/descriptionfile for gitweb.voidsetPerformsAtomicTransactions(boolean atomic)Enable (or disable) the atomic reference transaction support.-
Methods inherited from class org.eclipse.jgit.internal.storage.dfs.DfsRepository
create, createAttributesNodeProvider, exists, getConfig, getDescription, getIdentifier, getReflogReader, notifyIndexChanged, scanForRepoChanges
-
Methods inherited from class org.eclipse.jgit.lib.Repository
autoGC, close, create, doClose, exactRef, findRef, fireEvent, getAdditionalHaves, getAllRefs, getAllRefsByPeeledObjectId, getBranch, getDirectory, getFS, getFullBranch, getGlobalListenerList, getIndexFile, getInitialBranch, getListenerList, getRemoteName, getRemoteNames, getRepositoryState, getTags, getWorkTree, hasObject, incrementOpen, isBare, isValidRefName, lockDirCache, newObjectInserter, newObjectReader, normalizeBranchName, open, open, parseCommit, peel, readCherryPickHead, readCommitEditMsg, readDirCache, readMergeCommitMsg, readMergeHeads, readOrigHead, readRebaseTodo, readRevertHead, readSquashCommitMsg, renameRef, resolve, shortenRefName, shortenRemoteBranchName, simplify, stripWorkDir, toString, updateRef, updateRef, writeCherryPickHead, writeCommitEditMsg, writeMergeCommitMsg, writeMergeHeads, writeOrigHead, writeRebaseTodoFile, writeRevertHead, writeSquashCommitMsg
-
-
-
-
Field Detail
-
packId
static final java.util.concurrent.atomic.AtomicInteger packId
-
objdb
private final InMemoryRepository.MemObjDatabase objdb
-
refdb
private final InMemoryRepository.MemRefDatabase refdb
-
gitwebDescription
private java.lang.String gitwebDescription
-
-
Constructor Detail
-
InMemoryRepository
public InMemoryRepository(DfsRepositoryDescription repoDesc)
Initialize a new in-memory repository.- Parameters:
repoDesc- description of the repository.
-
InMemoryRepository
InMemoryRepository(InMemoryRepository.Builder builder)
-
-
Method Detail
-
getObjectDatabase
public InMemoryRepository.MemObjDatabase getObjectDatabase()
Get the object database which stores this repository's data.- Specified by:
getObjectDatabasein classDfsRepository- Returns:
- the object database which stores this repository's data.
-
getRefDatabase
public RefDatabase getRefDatabase()
Get the reference database which stores the reference namespace.- Specified by:
getRefDatabasein classRepository- Returns:
- the reference database which stores the reference namespace.
-
setPerformsAtomicTransactions
public void setPerformsAtomicTransactions(boolean atomic)
Enable (or disable) the atomic reference transaction support.Useful for testing atomic support enabled or disabled.
- Parameters:
atomic- whether to use atomic reference transaction support
-
getGitwebDescription
@Nullable public java.lang.String getGitwebDescription()
Read theGIT_DIR/descriptionfile for gitweb.- Overrides:
getGitwebDescriptionin classRepository- Returns:
- description text; null if no description has been configured.
-
setGitwebDescription
public void setGitwebDescription(@Nullable java.lang.String d)
Set theGIT_DIR/descriptionfile for gitweb.- Overrides:
setGitwebDescriptionin classRepository- Parameters:
d- new description; null to clear the description.
-
-