public class RefTreeDatabase extends RefDatabase
RefTree.
 
 The storage for RefTreeDatabase has two parts. The main part is a native Git
 tree object stored under the refs/txn namespace. To avoid cycles,
 references to refs/txn are not stored in that tree object, but
 instead in a "bootstrap" layer, which is a separate
 RefDatabase such as
 RefDirectory using local
 reference files inside of $GIT_DIR/refs.
ALL, MAX_SYMBOLIC_REF_DEPTH, SEARCH_PATH| Constructor and Description | 
|---|
RefTreeDatabase(Repository repo,
               RefDatabase bootstrap)
Create a RefTreeDb for a repository. 
 | 
RefTreeDatabase(Repository repo,
               RefDatabase bootstrap,
               String txnCommitted)
Create a RefTreeDb for a repository. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
close()
Close any resources held by this database. 
 | 
void | 
create()
Initialize a new reference database at this location. 
 | 
Ref | 
exactRef(String name)
Read a single reference. 
 | 
List<Ref> | 
getAdditionalRefs()
Get the additional reference-like entities from the repository. 
 | 
RefDatabase | 
getBootstrap()
Get the bootstrap reference database 
 | 
Ref | 
getRef(String name)
Read a single reference. 
 | 
Map<String,Ref> | 
getRefs(String prefix)
Get a section of the reference namespace. 
 | 
String | 
getTxnCommitted()
Get name of bootstrap reference anchoring committed RefTree. 
 | 
String | 
getTxnNamespace()
Get namespace used by bootstrap layer. 
 | 
boolean | 
isNameConflicting(String name)
Determine if a proposed reference name overlaps with an existing one. 
 | 
BatchRefUpdate | 
newBatchUpdate()
Create a new batch update to attempt on this database. 
 | 
RefRename | 
newRename(String fromName,
         String toName)
Create a new update command to rename a reference. 
 | 
RefUpdate | 
newUpdate(String name,
         boolean detach)
Create a new update command to create, modify or delete a reference. 
 | 
Ref | 
peel(Ref ref)
Peel a possibly unpeeled reference by traversing the annotated tags. 
 | 
boolean | 
performsAtomicTransactions()
Whether the database is capable of performing batch updates as atomic
 transactions. 
 | 
void | 
refresh()
Triggers a refresh of all internal data structures. 
 | 
exactRef, findRef, firstExactRef, getConflictingNames, getRefs, getRefsByPrefix, hasRefspublic RefTreeDatabase(Repository repo, RefDatabase bootstrap)
repo - the repository using references in this database.bootstrap - bootstrap reference database storing the references that
            anchor the
            RefTree.public RefTreeDatabase(Repository repo, RefDatabase bootstrap, String txnCommitted)
repo - the repository using references in this database.bootstrap - bootstrap reference database storing the references that
            anchor the
            RefTree.txnCommitted - name of the bootstrap reference holding the committed RefTree.public RefDatabase getBootstrap()
getTxnCommitted(), getTxnNamespace().public String getTxnCommitted()
@Nullable public String getTxnNamespace()
refs/txn/. Always
         ends in '/'.public void create()
            throws IOException
create in class RefDatabaseIOException - the database could not be created.public boolean performsAtomicTransactions()
 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 RefDatabasepublic void refresh()
In case the RefDatabase implementation has internal caches this method will trigger that all these caches are cleared.
Implementors should overwrite this method if they use any kind of caches.
refresh in class RefDatabasepublic void close()
close in class RefDatabasepublic Ref getRef(String name) throws IOException
 Aside from taking advantage of RefDatabase.SEARCH_PATH, this method may be
 able to more quickly resolve a single reference name than obtaining the
 complete namespace by getRefs(ALL).get(name).
 
 To read a specific reference without using @{link #SEARCH_PATH}, see
 RefDatabase.exactRef(String).
getRef in class RefDatabasename - the name of the reference. May be a short name which must be
            searched for using the standard RefDatabase.SEARCH_PATH.null.IOException - the reference space cannot be accessed.public Ref exactRef(String name) throws IOException
 Unlike RefDatabase.getRef(java.lang.String), this method expects an unshortened reference
 name and does not search using the standard RefDatabase.SEARCH_PATH.
exactRef in class RefDatabasename - the unabbreviated name of the reference.null.IOException - the reference space cannot be accessed.public Map<String,Ref> getRefs(String prefix) throws IOException
getRefs in class RefDatabaseprefix - prefix to search the namespace with; must end with /.
            If the empty string (RefDatabase.ALL), obtain a complete snapshot
            of all references.prefix removed from the start
         of each key. The map can be an unsorted map.IOException - the reference space cannot be accessed.public List<Ref> getAdditionalRefs() throws IOException
 The result list includes non-ref items such as MERGE_HEAD and
 FETCH_RESULT cast to be refs. The names of these refs are not returned by
 getRefs() but are accepted by RefDatabase.getRef(String)
 and RefDatabase.exactRef(String).
getAdditionalRefs in class RefDatabaseIOException - the reference space cannot be accessed.public Ref peel(Ref ref) throws IOException
 If the reference cannot be peeled (as it does not refer to an annotated
 tag) the peeled id stays null, but
 Ref.isPeeled() will be true.
 
 Implementors should check Ref.isPeeled()
 before performing any additional work effort.
peel in class RefDatabaseref - The reference to peelref if ref.isPeeled() is true; otherwise a new
         Ref object representing the same data as Ref, but isPeeled() will
         be true and getPeeledObjectId() will contain the peeled object
         (or null).IOException - the reference space or object space cannot be accessed.public boolean isNameConflicting(String name) throws IOException
Reference names use '/' as a component separator, and may be stored in a hierarchical storage such as a directory on the local filesystem.
If the reference "refs/heads/foo" exists then "refs/heads/foo/bar" must not exist, as a reference cannot have a value and also be a container for other references at the same time.
If the reference "refs/heads/foo/bar" exists than the reference "refs/heads/foo" cannot exist, for the same reason.
isNameConflicting in class RefDatabasename - proposed name.IOException - the database could not be read to check for conflicts.RefDatabase.getConflictingNames(String)public BatchRefUpdate newBatchUpdate()
The default implementation performs a sequential update of each command.
newBatchUpdate in class RefDatabasepublic RefUpdate newUpdate(String name, boolean detach) throws IOException
newUpdate in class RefDatabasename - the name of the reference.detach - if true and name is currently a
            SymbolicRef, the update will
            replace it with an ObjectIdRef.
            Otherwise, the update will recursively traverse
            SymbolicRefs and operate on the
            leaf ObjectIdRef.IOException - the reference space cannot be accessed.public RefRename newRename(String fromName, String toName) throws IOException
newRename in class RefDatabasefromName - name of reference to rename fromtoName - name of reference to rename toIOException - the reference space cannot be accessed.Copyright © 2020 Eclipse JGit Project. All rights reserved.