All Downloads are FREE. Search and download functionalities are using the official Maven repository.

automately.core.file.VirtualFileStore Maven / Gradle / Ivy

package automately.core.file;

import io.jcluster.core.Cluster;
import io.jsync.buffer.Buffer;

/**
 * The VirtualFileStore interface is a very important interface that is used by
 * the VirtualFileService to store your data in a central location within the cluster.
 * It acts as a central point of storage so all of your data can be persistent instead of
 * inconsistent.
 */
public interface VirtualFileStore {

    /**
     * This is called when the VirtualFileStore is first initialized. This is used so
     * you can access the Cluster object.
     * @param cluster
     */
    void initialize(Cluster cluster);

    void stop();

    /**
     * This is used to retrieve the data for the VirtualFile
     *
     * @return data for the VirtualFile
     */
    Buffer readRawData(VirtualFile file);

    /**
     * This is used to write the data for the VirtualFile
     *
     * @param file the file you wish to write the data to
     * @param data the data you wish to write
     */
    void writeRawData(VirtualFile file, Buffer data);

    /**
     * This is used to retrieve the cached data for the VirtualFile
     *
     * @return the cached data for the VirtualFile
     */
    Buffer readCachedData(VirtualFile file);

    /**
     * This will return true if the file is cached
     * locally or in the cluster.
     * @param file
     * @return
     */
    boolean cachedLocally(VirtualFile file);

    /**
     * validateLocalCache is used to check the validity of the
     * locally cached File.
     * @param file
     * @return
     */
    boolean validateLocalCache(VirtualFile file);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy