protected class InMemoryRepository.MemRefDatabase extends DfsRefDatabase
This class is protected (and not private) to facilitate testing using subclasses of InMemoryRepository.
DfsRefDatabase.RefCache
ALL, MAX_SYMBOLIC_REF_DEPTH, SEARCH_PATH
Modifier | Constructor and Description |
---|---|
protected |
MemRefDatabase()
Initialize a new in-memory ref database.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
compareAndPut(Ref oldRef,
Ref newRef)
Compare a reference, and put if it matches.
|
protected boolean |
compareAndRemove(Ref oldRef)
Compare a reference, and delete if it matches.
|
BatchRefUpdate |
newBatchUpdate()
Create a new batch update to attempt on this database.
|
boolean |
performsAtomicTransactions()
Whether the database is capable of performing batch updates as atomic
transactions.
|
protected DfsRefDatabase.RefCache |
scanAllRefs()
Read all known references in the repository.
|
cachePeeledState, close, create, exactRef, getAdditionalRefs, getRef, getRefs, getRepository, isNameConflicting, newRename, newUpdate, peel, refresh
exactRef, findRef, firstExactRef, getConflictingNames
protected MemRefDatabase()
public boolean performsAtomicTransactions()
RefDatabase
If true, by default BatchRefUpdate
instances will perform updates
atomically, meaning either all updates will succeed, or all updates will
fail. It is still possible to turn off this behavior on a per-batch basis
by calling update.setAtomic(false)
.
If false, BatchRefUpdate
instances will never perform updates
atomically, and calling update.setAtomic(true)
will cause the
entire batch to fail with REJECTED_OTHER_REASON
.
This definition of atomicity is stronger than what is provided by
ReceivePack
. ReceivePack
will
attempt to reject all commands if it knows in advance some commands may
fail, even if the storage layer does not support atomic transactions. Here,
atomicity applies even in the case of unforeseeable errors.
performsAtomicTransactions
in class RefDatabase
public BatchRefUpdate newBatchUpdate()
RefDatabase
The default implementation performs a sequential update of each command.
newBatchUpdate
in class RefDatabase
protected DfsRefDatabase.RefCache scanAllRefs() throws IOException
DfsRefDatabase
scanAllRefs
in class DfsRefDatabase
IOException
- references cannot be accessed.protected boolean compareAndPut(Ref oldRef, Ref newRef) throws IOException
DfsRefDatabase
Two reference match if and only if they satisfy the following:
compareAndPut
in class DfsRefDatabase
oldRef
- old value to compare to. If the reference is expected to not
exist the old value has a storage of
Ref.Storage.NEW
and an ObjectId
value of null
.newRef
- new reference to store.IOException
- the reference cannot be put due to a system error.protected boolean compareAndRemove(Ref oldRef) throws IOException
DfsRefDatabase
compareAndRemove
in class DfsRefDatabase
oldRef
- the old reference information that was previously read.IOException
- the reference could not be removed due to a system error.Copyright © 2017 Eclipse JGit Project. All rights reserved.