Module convex.core
Package convex.dlfs

Class DLFSNode

java.lang.Object
convex.dlfs.DLFSNode

public class DLFSNode extends Object
Static utility class for working with DLFS Node structures
  • Field Details

  • Constructor Details

    • DLFSNode

      public DLFSNode()
  • Method Details

    • isDirectory

      public static boolean isDirectory(AVector<ACell> node)
    • isRegularFile

      public static boolean isRegularFile(AVector<ACell> node)
    • getDirectoryEntries

      public static AHashMap<AString,AVector<ACell>> getDirectoryEntries(AVector<ACell> dirNode)
      Gets the directory entries for a node
      Parameters:
      dirNode - Node which is assumed to be a directory
      Returns:
      Map of directory entries, or null if not a directory
    • updateNode

      public static AVector<ACell> updateNode(AVector<ACell> rootNode, DLPath path, AVector<ACell> newNode, CVMLong utime)
      Update a node at a path relative to a root node
      Parameters:
      rootNode - Root node of file system
      path - Path relative to root
      newNode - New node, or null to delete a node
      utime - Timestamp to set on any directories changed
      Returns:
      Updated root node, or null if update failed (parent(s) not a directory)
    • getData

      public static ABlob getData(AVector<ACell> node)
      Gets the data from a DLFS file node, or nil if not a regular File
    • getMetaData

      public static Blob getMetaData(AVector<ACell> node)
      Gets the metadata from a DLFS node
    • getUTime

      public static CVMLong getUTime(AVector<ACell> node)
      Gets the metadata from a DLFS node
    • getDirectoryEntry

      public static MapEntry<AString,AVector<ACell>> getDirectoryEntry(AVector<ACell> node, AString name)
      Parameters:
      node - Node to check for directory
      name - Directory entry name
      Returns:
      Directory entry, return null if not found or node is not a directory
    • isTombstone

      public static boolean isTombstone(AVector<ACell> node)
      Returns true iff the node is a DLFS tombstone
      Parameters:
      node - Node to test
      Returns:
      True if a tombstone, false if anything else (including null)
    • createTombstone

      public static AVector<ACell> createTombstone(CVMLong timestamp)
    • createDirectory

      public static AVector<ACell> createDirectory(CVMLong timestamp)
    • createEmptyFile

      public static AVector<ACell> createEmptyFile(CVMLong timestamp)
    • merge

      public static AVector<ACell> merge(AVector<ACell> a, AVector<ACell> b, CVMLong time)
      Merges two DLFS nodes recursively. Favours newer (utime) entries in case of conflicts.
      Parameters:
      a - First node (non-null). Favoured in result if all else equal.
      b - Second node (non-null)
      time - Update time for merged changes
      Returns:
      Merged node