Package org.eclipse.jgit.util
Class FS.FileStoreAttributes
- java.lang.Object
-
- org.eclipse.jgit.util.FS.FileStoreAttributes
-
-
Field Summary
Fields Modifier and Type Field Description static FS.FileStoreAttributes
FALLBACK_FILESTORE_ATTRIBUTES
Fallback FileStore attributes used when we can't measure the filesystem timestamp resolution.static Duration
FALLBACK_TIMESTAMP_RESOLUTION
Fallback filesystem timestamp resolution.
-
Constructor Summary
Constructors Constructor Description FileStoreAttributes(Duration fsTimestampResolution)
Construct a FileStoreAttributeCache entry for the given filesystem timestamp resolution
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
configureAttributesPathCache(int maxSize, float purgeFactor)
Configures size and purge factor of the path-based cache for file system attributes.static FS.FileStoreAttributes
get(Path path)
Get the FileStoreAttributes for the given FileStoreDuration
getFsTimestampResolution()
Duration
getMinimalRacyInterval()
static void
setBackground(boolean async)
Whether FileStore attributes should be determined asynchronouslyString
toString()
-
-
-
Field Detail
-
FALLBACK_TIMESTAMP_RESOLUTION
public static final Duration FALLBACK_TIMESTAMP_RESOLUTION
Fallback filesystem timestamp resolution. The worst case timestamp resolution on FAT filesystems is 2 seconds.Must be at least 1 second.
-
FALLBACK_FILESTORE_ATTRIBUTES
public static final FS.FileStoreAttributes FALLBACK_FILESTORE_ATTRIBUTES
Fallback FileStore attributes used when we can't measure the filesystem timestamp resolution. The last modified time granularity of FAT filesystems is 2 seconds.
-
-
Method Detail
-
setBackground
public static void setBackground(boolean async)
Whether FileStore attributes should be determined asynchronously- Parameters:
async
- whether FileStore attributes should be determined asynchronously. If false access to cached attributes may block for some seconds for the first call per FileStore- Since:
- 5.6.2
-
configureAttributesPathCache
public static void configureAttributesPathCache(int maxSize, float purgeFactor)
Configures size and purge factor of the path-based cache for file system attributes. Caching of file system attributes avoids recurring lookup of @{code FileStore} of files which may be expensive on some platforms.- Parameters:
maxSize
- maximum size of the cache, default is 100purgeFactor
- when the size of the map reaches maxSize the oldest entries will be purged to free up some space for new entries,purgeFactor
is the fraction ofmaxSize
to purge when this happens- Since:
- 5.1.9
-
get
public static FS.FileStoreAttributes get(Path path)
Get the FileStoreAttributes for the given FileStore- Parameters:
path
- file residing in the FileStore to get attributes for- Returns:
- FileStoreAttributes for the given path.
-
getMinimalRacyInterval
public Duration getMinimalRacyInterval()
- Returns:
- the measured minimal interval after a file has been modified in which we cannot rely on lastModified to detect modifications
-
getFsTimestampResolution
@NonNull public Duration getFsTimestampResolution()
- Returns:
- the measured filesystem timestamp resolution
-
-