Top Description Fields Constructors Methods
org.eclipse.jgit.internal.storage.file

pack-priv Class GcLog

extends Object
Class Inheritance
Static Imports
java.nio.charset.StandardCharsets.UTF_8

This class manages the gc.log file for a FileRepository.

Field Summary

Modifier and TypeField and Description
private Instant
private final LockFile
private static final String
private final File
private boolean
private final FileRepository

Constructor Summary

AccessConstructor and Description
pack-priv
GcLog(FileRepository
the repository
repo
)

Construct a GcLog object for a FileRepository

Method Summary

Modifier and TypeMethod and Description
private boolean
pack-priv boolean

Returns:

true if committing (or unlocking/deleting) succeeds.
commit
()

Commit changes to the gc log, if there have been any writes.

private Instant
pack-priv boolean

Returns:

true if we hold the lock
lock
()

Lock the GC log file for updates

pack-priv void
unlock()

Unlock (roll back) the GC log lock

pack-priv void
write(String
The content to write
content
)

Write to the pending gc log.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

gcLogExpireback to summary
private Instant gcLogExpire
lockback to summary
private final LockFile lock
LOG_EXPIRY_DEFAULTback to summary
private static final String LOG_EXPIRY_DEFAULT
logFileback to summary
private final File logFile
nonEmptyback to summary
private boolean nonEmpty
repoback to summary
private final FileRepository repo

Constructor Detail

GcLogback to summary
pack-priv GcLog(FileRepository repo)

Construct a GcLog object for a FileRepository

Parameters
repo:FileRepository

the repository

Method Detail

autoGcBlockedByOldLockFileback to summary
private boolean autoGcBlockedByOldLockFile()
commitback to summary
pack-priv 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:boolean

true if committing (or unlocking/deleting) succeeds.

getLogExpiryback to summary
private Instant getLogExpiry() throws ParseException
lockback to summary
pack-priv boolean lock()

Lock the GC log file for updates

Returns:boolean

true if we hold the lock

unlockback to summary
pack-priv void unlock()

Unlock (roll back) the GC log lock

writeback to summary
pack-priv void write(String content) throws IOException

Write to the pending gc log. Content will be committed upon a call to commit()

Parameters
content:String

The content to write

Exceptions
IOException:
if an IO error occurred