Class FS.FileStoreAttributes

  • Enclosing class:
    FS

    public static final class FS.FileStoreAttributes
    extends Object
    Attributes of FileStores on this system
    Since:
    5.1.9
    • 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.
    • Constructor Detail

      • FileStoreAttributes

        public FileStoreAttributes​(@NonNull
                                   Duration fsTimestampResolution)
        Construct a FileStoreAttributeCache entry for the given filesystem timestamp resolution
        Parameters:
        fsTimestampResolution -
    • 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 100
        purgeFactor - 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 of maxSize 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