An observer of cache events.
Provides an in memory cache of portions of the file system.
Provides an in memory cache of portions of the file system. Directories are added to the cache using the FileTreeRepository.register method. Once a Path is added the cache, its contents may be retrieved using the FileTreeRepository.list method. The cache stores the path information in FileTreeDataViews.Entry instances.
A default implementation is provided by FileTreeRepositories.get. The user may cache arbitrary information in the cache by customizing the Converter that is passed into the factory FileTreeRepositories.get.
The cache allows the user to register a regular file, directory or symbolic link. After registration, the cache should monitor the path (and in the case of symbolic links, the target of the link) for updates. Whenever an update is detected, the cache updates its internal representation of the file system. When that is complete, it will notify all of the registered com.swoval.files.Observers of the change. In general, the update that is sent in the callback will be visible if the user lists the relevant path. It is however, possible that if the file is being updated rapidly that the internal state of the cache may change in between the callback being invoked and the user listing the path. Once the file system activity settles down, the cache should always end up in a consistent state where it mirrors the state of the file system.
The semantics of the list method are very similar to the linux ls
tool. Listing a directory
returns all of the subdirectories and files contained in the directory and the empty list if the
directory is empty. Listing a file, however, will return the entry for the file if it exists and
the empty list otherwise.
the type of data stored in the FileTreeDataViews.Entry instances for the cache
Represents a value that can take one of two types.
Represents a value that can take one of two types. It is right biased, so that the
get
and getOrElse
correspond to the right value type.
The type of the "left" value
The type of the "right" value
Represents a left projected JSEither, which adds
Represents a left projected JSEither, which adds
An observer of cache events.
An observer of cache events.
Watches directories for file changes.
Watches directories for file changes. The api permits recursive watching of directories unlike the java.nio.file.WatchService. Some of the behavior may vary by platform due to fundamental differences in the underlying file event apis. For example, Linux doesn't support recursive directory monitoring via inotify, so it's possible in rare cases to miss file events for newly created files in newly created directories. On OSX, it is difficult to disambiguate file creation and modify events, so the kind of event is best effort, but should not be relied upon to accurately reflect the state of the file.
Represents a file system path.
Represents a file system path. Provides (possibly) fast accessors for some properties of the file. It is generally unsafe to cache as the properties do not change if the underlying file is modified.
An observer of cache events.