java.lang.Object
convex.dlfs.DLFSNode
Static utility class for working with DLFS Node structures
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateDirectory(CVMLong timestamp) createEmptyFile(CVMLong timestamp) createTombstone(CVMLong timestamp) static ABlobGets the data from a DLFS file node, or nil if not a regular FilegetDirectoryEntries(AVector<ACell> dirNode) Gets the directory entries for a nodegetDirectoryEntry(AVector<ACell> node, AString name) static BlobgetMetaData(AVector<ACell> node) Gets the metadata from a DLFS nodestatic CVMLongGets the metadata from a DLFS nodestatic booleanisDirectory(AVector<ACell> node) static booleanisRegularFile(AVector<ACell> node) static booleanisTombstone(AVector<ACell> node) Returns true iff the node is a DLFS tombstoneMerges two DLFS nodes recursively.Navigate down a path relative to a DLFS Node.Update a node at a path relative to a root node
-
Field Details
-
NODE_LENGTH
public static final long NODE_LENGTH- See Also:
-
POS_DIR
public static final int POS_DIR- See Also:
-
POS_DATA
public static final int POS_DATA- See Also:
-
POS_METADATA
public static final int POS_METADATA- See Also:
-
POS_UTIME
public static final int POS_UTIME- See Also:
-
-
Constructor Details
-
DLFSNode
public DLFSNode()
-
-
Method Details
-
isDirectory
-
isRegularFile
-
getDirectoryEntries
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 systempath- Path relative to rootnewNode- New node, or null to delete a nodeutime- Timestamp to set on any directories changed- Returns:
- Updated root node, or null if update failed (parent(s) not a directory)
-
getData
Gets the data from a DLFS file node, or nil if not a regular File -
getMetaData
Gets the metadata from a DLFS node -
getUTime
Gets the metadata from a DLFS node -
getDirectoryEntry
- Parameters:
node- Node to check for directoryname- Directory entry name- Returns:
- Directory entry, return null if not found or node is not a directory
-
isTombstone
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
-
createDirectory
-
createEmptyFile
-
merge
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
-