package saker.build.file.content
public interface ContentDatabase
A content database is responsible for storing expected contents of file system files.
It is used to synchronize the in-memory file hierarchy to the disk, and keep the content descriptors for the persisted files.
Internally a content database can store other meta-data related to the build executions.
Under normal circumstances, tasks should not directly interact with the content database.
Clients should not implement this interface.
public interface | Represents a handle to the stored contents of a given path. |
public static final class | Container for a ContentHandle and file attributes pair retrieved from a result of a file discovery. |
public interface | Functional interface for executing content updating. |
public interface | Synchronizer functional interface returned by the content database to execute content synchronization in a
deferred manner. |
public void | Creates the directories for the given path. |
public void | deleteChildrenIfNotIn( Deletes the children of the directory specified by the path key if their name is not in the specified set. |
public ContentHandle | discover( Discovers a file at the given path and associates the provided contents with it. |
public NavigableMap< | discoverDirectoryChildrenAttributes( Discovers the attributes of the children of the directory specified by the argument path key. |
public ContentHandleAttributes | Discovers the attributes of the file at the given path key. |
public ContentHandle | discoverWithPosixFilePermissions( Discovers a file at the given path and associates the provided contents and posix file permissions with it. |
public ByteArrayRegion | getBytesWithContentOrSynchronize( Gets the bytes of the specified file, optionally synchronizing first if the contents have changed. |
public ContentDescriptor | Gets the content descriptor tracked by the database for the given path key. |
public ContentHandle | getContentHandle( Gets the content handle to the given path key. |
public ExecutionPathConfiguration | Gets the path configuration this database uses. |
public void | invalidate( Invalidates the stored contents for a given path (and subpaths). |
public ContentDescriptor | Invalidates the stored contents for a given path (and subpaths) and returns the contents after the invalidation
for the path. |
public ByteSource | openInputWithContentOrSynchronize( Opens an input stream to the contents of the specified file, optionally synchronizing first if the contents have
changed. |
public void | synchronize( Executes a synchronization for the given content descriptor using an updater. |
public DeferredSynchronizer | synchronizeDeferred( Creates a deferred synchronizer for the specified path, if the contents have changed. |
public void | syncronizeDirectory( Executes a directory synchronization at the given path. |
public void | writeToStreamWithContentOrSynchronize( Writes the contents of the file specified by the argument path key, optionally synchronizing if the contents have
changed. |
Creates the directories for the given path.
Any parent files are overwritten with directories.
pathkeyThe path key.
IOExceptionIn case of I/O error.
public abstract void deleteChildrenIfNotIn(ProviderHolderPathKey pathkey, @RMIWrap(RMITreeSetStringElementWrapper.class) Set<String> keepchildren ) throws IOException
Deletes the children of the directory specified by the path key if their name is not in the specified set.
pathkeyThe path key to the directory.
keepchildrenThe names of the children to keep.
IOExceptionIn case of I/O error.
public abstract ContentHandle discover(ProviderHolderPathKey pathkey, @RMISerializeContentDescriptor content) throws IOException
Discovers a file at the given path and associates the provided contents with it.
pathkeyThe path key to discover.
contentThe contents to associate the discovered file with.
A content handle to the discovered file.
IOExceptionIn case of I/O error.
@RMIWrap(RMITreeMapWrapper.class)
Discovers the attributes of the children of the directory specified by the argument path key.
directorypathkeyThe directory path key.
A map of child names to their discovered attribute handles.
IOExceptionIn case of I/O error.
public abstract ContentHandleAttributes discoverFileAttributes(ProviderHolderPathKey pathkey) throws IOException
Discovers the attributes of the file at the given path key.
pathkeyThe path key to the file.
A container for the discovered attributes and a content handle.
IOExceptionIn case of I/O error.
public abstract ContentHandle discoverWithPosixFilePermissions(ProviderHolderPathKey pathkey, @RMISerializeContentDescriptor content, @RMIWrap(saker.build.util.rmi.EnumSetRMIWrapper.class) Set<PosixFilePermission> permissions ) throws IOException
Discovers a file at the given path and associates the provided contents and posix file permissions with it.
pathkeyThe path key to discover.
contentThe contents to associate the discovered file with.
permissionsThe posix file permissions to associate with the file. May be
null
.A content handle to the discovered file.
IOExceptionIn case of I/O error.
saker.build 0.8.13
public abstract ByteArrayRegion getBytesWithContentOrSynchronize(ProviderHolderPathKey pathkey, @RMISerializeContentDescriptor content, ContentUpdater updater) throws IOException
Gets the bytes of the specified file, optionally synchronizing first if the contents have changed.
pathkeyThe path key to the file.
contentThe expected content descriptor.
updaterThe synchronization executor.
The byte contents of the file.
IOExceptionIn case of I/O error.
Gets the content descriptor tracked by the database for the given path key.
pathkeyThe path key.
The content descriptor.
Gets the content handle to the given path key.
pathkeyThe path key.
The content handle.
Gets the path configuration this database uses.
This might be different from the path configuration of the current execution.
The path configuration.
Invalidates the stored contents for a given path (and subpaths).
pathkeyThe path key to invalidate.
Invalidates the stored contents for a given path (and subpaths) and returns the contents after the invalidation
for the path.
pathkeyThe path key to invalidate.
The current content descriptor at the given path.
public abstract ByteSource openInputWithContentOrSynchronize(ProviderHolderPathKey pathkey, @RMISerializeContentDescriptor content, ContentUpdater updater) throws IOException
Opens an input stream to the contents of the specified file, optionally synchronizing first if the contents have
changed.
pathkeyThe path key to the file.
contentThe expected content descriptor.
updaterThe synchronization executor.
An opened input stream to the contents of the file.
IOExceptionIn case of I/O error.
public abstract void synchronize(ProviderHolderPathKey pathkey, @RMISerializeContentDescriptor content, ContentUpdater updater) throws IOException
Executes a synchronization for the given content descriptor using an updater.
If the contents at the given path haven't changed, then the synchronization will be skipped.
pathkeyThe target path key to the synchronization.
contentThe content descriptor of the content to be synchronized to the path.
updaterThe updater to execute the synchronization.
IOExceptionIn case of I/O error.
public abstract DeferredSynchronizer synchronizeDeferred(ProviderHolderPathKey pathkey, @RMISerializeContentDescriptor content, ContentUpdater updater)
Creates a deferred synchronizer for the specified path, if the contents have changed.
pathkeyThe path key to the to be synchronized file.
contentThe expected contents at the path.
updaterThe updater to execute the synchronization.
A deferred synchronizer, or
null
if the contents haven't changed.public abstract void syncronizeDirectory(ProviderHolderPathKey pathkey, IORunnable dirsynchronizer) throws IOException
Executes a directory synchronization at the given path.
pathkeyThe path to the directory.
dirsynchronizerThe operation to execute for synchronization.
IOExceptionIn case of I/O error.
public abstract void writeToStreamWithContentOrSynchronize(ProviderHolderPathKey pathkey, @RMISerializeContentDescriptor content, ByteSink os, ContentUpdater updater) throws IOException
Writes the contents of the file specified by the argument path key, optionally synchronizing if the contents have
changed.
pathkeyThe path key to the file.
contentThe expected content descriptor.
osThe output to write the contents to.
updaterThe synchronization executor.
IOExceptionIn case of I/O error-