Class GcLog
java.lang.Object
org.eclipse.jgit.internal.storage.file.GcLog
This class manages the gc.log file for a
FileRepository
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Instant
private final LockFile
private static final String
private final File
private boolean
private final FileRepository
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
(package private) boolean
commit()
Commit changes to the gc log, if there have been any writes.private Instant
(package private) boolean
lock()
Lock the GC log file for updates(package private) void
unlock()
Unlock (roll back) the GC log lock(package private) void
Write to the pending gc log.
-
Field Details
-
repo
-
logFile
-
lock
-
gcLogExpire
-
LOG_EXPIRY_DEFAULT
- See Also:
-
nonEmpty
private boolean nonEmpty
-
-
Constructor Details
-
GcLog
GcLog(FileRepository repo) Construct a GcLog object for aFileRepository
- Parameters:
repo
- the repository
-
-
Method Details
-
getLogExpiry
- Throws:
ParseException
-
autoGcBlockedByOldLockFile
private boolean autoGcBlockedByOldLockFile() -
lock
boolean lock()Lock the GC log file for updates- Returns:
true
if we hold the lock
-
unlock
void unlock()Unlock (roll back) the GC log lock -
commit
boolean commit()Commit changes to the gc log, if there have been any writes. Otherwise, just unlock and delete the existing file (if any)- Returns:
- true if committing (or unlocking/deleting) succeeds.
-
write
Write to the pending gc log. Content will be committed upon a call to commit()- Parameters:
content
- The content to write- Throws:
IOException
-