java.lang.Object
org.cryptomator.jfuse.api.Fuse
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ArenaThe memory session associated with the lifecycle of this Fuse instance.protected final FuseOperationsThe file system operations invoked by this FUSE file system.protected final MemorySegmentThe memory segment containing the fuse_operations struct. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFuse(FuseOperations fuseOperations, Function<SegmentAllocator, MemorySegment> structAllocator) Creates a new FUSE session. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidbind(FuseOperations.Operation operation) Registers the callback function for the given operation in thefuse_operationsstruct.static FuseBuilderbuilder()Gets the builder suitable for the current platform.voidclose()Unmounts (if needed) this fuse file system and frees up system resources.voidMounts this fuse file system at the given mount point.protected abstract FuseMountMounts the fuse file system.
-
Field Details
-
fuseArena
The memory session associated with the lifecycle of this Fuse instance. -
fuseOperations
The file system operations invoked by this FUSE file system. -
fuseOperationsStruct
The memory segment containing the fuse_operations struct.
-
-
Constructor Details
-
Fuse
protected Fuse(FuseOperations fuseOperations, Function<SegmentAllocator, MemorySegment> structAllocator) Creates a new FUSE session.- Parameters:
fuseOperations- The file system operations
-
-
Method Details
-
builder
Gets the builder suitable for the current platform.- Returns:
- A FuseBuilder
-
bind
Registers the callback function for the given operation in thefuse_operationsstruct.Implementers need to make sure to:
- create an upcall stub for the given operation and save its address at the appropriate position within the
fuseOperationsStruct - the necessary adaption between native and high-level Java types takes place
- the adapter calls the corresponding function in
fuseOperations
- Parameters:
operation- Which function
- create an upcall stub for the given operation and save its address at the appropriate position within the
-
mount
@Blocking @MustBeInvokedByOverriders public void mount(String progName, Path mountPoint, String... flags) throws FuseMountFailedException, IllegalArgumentException Mounts this fuse file system at the given mount point.This method blocks until either
FuseOperations.init(FuseConnInfo, FuseConfig)completes or an error occurs.- Parameters:
progName- The program name used to construct a usage message and to derive a fallback for-ofsname=...mountPoint- mount pointflags- Additional flags. Use flag-helpto get a list of available flags- Throws:
FuseMountFailedException- If mounting failedIllegalArgumentException- If providing unsupported mount flags
-
mount
@Blocking protected abstract FuseMount mount(List<String> args) throws FuseMountFailedException, IllegalArgumentException Mounts the fuse file system.- Parameters:
args- Mount args- Returns:
- A mount object
- Throws:
FuseMountFailedException- Thrown if mounting failedIllegalArgumentException- Thrown if parsingargsfailed
-
close
Unmounts (if needed) this fuse file system and frees up system resources.This method is idempotent and closing multiple times will be no-op.
Important: Before closing, a graceful unmount via system tools (e.g.
fusermount -u) should be attempted.- Specified by:
closein interfaceAutoCloseable- Throws:
TimeoutException
-