Module convex.core
Package convex.dlfs

Class DLFileSystem

java.lang.Object
java.nio.file.FileSystem
convex.dlfs.DLFileSystem
All Implemented Interfaces:
Closeable, AutoCloseable, Cloneable

public abstract class DLFileSystem extends FileSystem implements Cloneable
Base class for Data Lattice FileSystems. A Data Lattice FileSystem has: - A single root directory - A method of snapshotting any path on the tree - An efficient method of cloning the Drive with an immutable snapshot
  • Field Details

    • provider

      protected final DLFSProvider provider
    • root

      protected final DLPath root
    • emptyPath

      protected final DLPath emptyPath
    • uriPath

      protected final String uriPath
  • Constructor Details

  • Method Details

    • provider

      public DLFSProvider provider()
      Specified by:
      provider in class FileSystem
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in class FileSystem
      Throws:
      IOException
    • getTimestamp

      public final CVMLong getTimestamp()
      Gets the timestamp of this DLFS drive
      Returns:
      Current timestamp as a CVM integer
    • setTimestamp

      public final void setTimestamp(CVMLong newTimestamp)
      Sets the timestamp of this DLFS drive
      Parameters:
      newTimestamp - New timestamp
    • updateTimestamp

      public CVMLong updateTimestamp(long newTimestamp)
      Updates the timestamp of this DLFS drive to the maximum of the given timestamp or it's current time stamp
      Parameters:
      newTimestamp - Potential new timestamp
      Returns:
      The new timestamp value, or the original one if unchanged
    • updateTimestamp

      public CVMLong updateTimestamp()
      Updates the timestamp of the drive to the current system timestamp
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in class FileSystem
    • isReadOnly

      public boolean isReadOnly()
      Specified by:
      isReadOnly in class FileSystem
    • getSeparator

      public String getSeparator()
      Specified by:
      getSeparator in class FileSystem
    • getRootDirectories

      public Iterable<Path> getRootDirectories()
      Specified by:
      getRootDirectories in class FileSystem
    • getFileStores

      public Iterable<FileStore> getFileStores()
      Specified by:
      getFileStores in class FileSystem
    • supportedFileAttributeViews

      public Set<String> supportedFileAttributeViews()
      Specified by:
      supportedFileAttributeViews in class FileSystem
    • getPath

      public DLPath getPath(String first, String... more)
      Specified by:
      getPath in class FileSystem
    • getPathMatcher

      public PathMatcher getPathMatcher(String syntaxAndPattern)
      Specified by:
      getPathMatcher in class FileSystem
    • getUserPrincipalLookupService

      public UserPrincipalLookupService getUserPrincipalLookupService()
      Specified by:
      getUserPrincipalLookupService in class FileSystem
    • newWatchService

      public WatchService newWatchService() throws IOException
      Specified by:
      newWatchService in class FileSystem
      Throws:
      IOException
    • getRoot

      public DLPath getRoot()
      Gets the unique root path for this FileSystem
      Returns:
      Path instance to root
    • getEmptyPath

      public DLPath getEmptyPath()
      Gets an empty path for this FileSystem
      Returns:
      empty path instance
    • newByteChannel

      public abstract SeekableByteChannel newByteChannel(DLPath path, Set<? extends OpenOption> options, FileAttribute<?>[] attrs) throws IOException
      Implementation for delegation by DLFSProvider
      Parameters:
      path - Path for new file
      options - Options for file creation
      attrs - File attributes
      Returns:
      ByteChannel instance
      Throws:
      IOException - In case of IO Error
    • newDirectoryStream

      protected abstract convex.dlfs.impl.DLDirectoryStream newDirectoryStream(DLPath dir, DirectoryStream.Filter<? super Path> filter)
      Implementation for delegation by DLFSProvider
      Returns:
      Directory stream
    • getNode

      public abstract AVector<ACell> getNode(DLPath path)
      Gets DLFS node for the given path
      Parameters:
      path - Path for which to obtain DLFSNode
      Returns:
      DLFS node, or null if does not exist
    • createDirectory

      protected abstract DLPath createDirectory(DLPath dir, FileAttribute<?>[] attrs) throws IOException
      Implementation for delegation by DLFSProvider, create a directory
      Returns:
      Throws:
      IOException
    • checkAccess

      protected abstract void checkAccess(DLPath path) throws IOException
      Implementation for DLFSProvider delegation
      Parameters:
      path -
      Throws:
      IOException
    • delete

      public abstract void delete(DLPath dlp) throws IOException
      Throws:
      IOException
    • getRootHash

      public abstract Hash getRootHash()
    • getNodeHash

      public Hash getNodeHash(DLPath p)
    • createFile

      public abstract AVector<ACell> createFile(DLPath path) throws IOException
      Creates a file, returning the new node
      Parameters:
      path - Path for which to create DLFSNode
      Returns:
      New file node
      Throws:
      IOException - In event of IOError
    • updateNode

      public abstract AVector<ACell> updateNode(DLPath path, AVector<ACell> newNode)
      Updates a node, returning the new node
      Parameters:
      path - Path for which to update DLFSNode
      newNode - NEw node to put in place
      Returns:
      The new node
    • merge

      public abstract void merge(AVector<ACell> other)
      Merges another DLFS drive into this one
      Parameters:
      other - Root node of other DLFS drive
    • replicate

      public void replicate(DLFileSystem other)
    • clone

      public abstract DLFileSystem clone()
      Overrides:
      clone in class Object