EmbeddedGuestVFSImpl

@Requires(property = "elide.gvm.vfs.enabled", notEquals = "false")
@Requires(property = "elide.gvm.vfs.mode", notEquals = "HOST")
class EmbeddedGuestVFSImpl : AbstractDelegateVFS<EmbeddedGuestVFSImpl>

VFS: Embedded.

This VFS implementation uses an in-memory file-system, loaded from a VFS filesystem bundle file. Bundle files can be plain tarballs, compressed tarballs, or they can make use of Elide's optimized production bundle format. In each case the embedded VFS implementation will load the bundle, initialize a Jimfs file-system with the decoded and verified contents, and then satisfy guest I/O requests with the resulting file-system.

Bundle formats

VFS bundle files can be plain tarballs, compressed tarballs, or they can make use of Elide's optimized production bundle format. Plain or compressed tarballs are ideal for quick development cycles, and Elide's production bundle format is optimal for production use.

Plain/compressed tarballs

Plain and compressed tarballs are supported by the embedded VFS implementation. The bundle file is expected to be a regular TAR file, with a .tar extension, unless compression is in use, in which case the file extension is expected to be .tar.gz. The tarball models the root of the file system.

Elide's bundle format

The bundle format used internally by Elide is also based on a plain (un-compressed) tarball, with a .evfs extension and the following structure:

  • metadata.cfb: Compressed Flatbuffer with metadata about the enclosed file-system

  • fsdata.tar.lz4: LZ4-compressed tarball containing the actual file-system data

  • artifacts.json.gz: GZIP-compressed JSON file containing a list of artifacts used to build the bundle

The metadata.cfb file explains the file tree to the runtime, and the fsdata.tar.lz4 file contains the actual data for each file. artifacts.json.gz is not used by the runtime, and is only present for easy debugging. Because a bundle is a valid tarball, it can be extracted with standard tools, or in OS GUIs by renaming to the .tar extension.

Parameters

config

Effective VFS configuration which should be applied to this instance.

backing

Backing file-system implementation which should receive allowable I/O calls.

tree

Tree of resolved file-system metadata.

deferred

Whether to defer reads/copies into the VFS; defaults to true.

Types

Link copied to clipboard
data class Builder(var deferred: Boolean = Settings.DEFAULT_DEFERRED_READS, var readOnly: Boolean = true, var caseSensitive: Boolean = true, var enableSymlinks: Boolean = false, var root: String = ROOT_SYSTEM_DEFAULT, var workingDirectory: String = DEFAULT_CWD, var policy: GuestVFSPolicy = GuestVFSPolicy.DEFAULTS, var registry: MutableMap<String, EmbeddedGuestVFSImpl.VfsObjectInfo> = mutableMapOf(), var bundleMapping: MutableMap<Int, EmbeddedGuestVFSImpl.BundleInfo> = mutableMapOf(), bundle: Pair<FilesystemInfo, FileSystem>? = null, paths: List<URI> = emptyList(), files: List<File> = emptyList(), zip: URI? = null, file: URI? = null) : AbstractBaseVFS.VFSBuilder<EmbeddedGuestVFSImpl>

Builder to configure and spawn new embedded VFS implementations.

Link copied to clipboard

Enumerates supported embedded VFS bundle formats.

Link copied to clipboard
data class BundleInfo(val id: Int, val location: String, val type: EmbeddedGuestVFSImpl.BundleFormat) : Record
Link copied to clipboard

Factory to create new embedded VFS implementations.

Link copied to clipboard
data class VfsDirectory(val path: String, val bundle: Int, val info: Directory) : Record, EmbeddedGuestVFSImpl.VfsObjectInfo
Link copied to clipboard
data class VfsFileInfo(val path: String, val bundle: Int, val info: File) : Record, EmbeddedGuestVFSImpl.VfsObjectInfo
Link copied to clipboard
sealed interface VfsObjectInfo

Properties

Link copied to clipboard
open override val compound: Boolean
Link copied to clipboard
open override val deletable: Boolean
Link copied to clipboard
open override val host: Boolean
Link copied to clipboard
open override val logging: Logger

Subclass API: Logging.

Link copied to clipboard
open override val supportsSymlinks: Boolean
Link copied to clipboard
open override val virtual: Boolean
Link copied to clipboard
open override val writable: Boolean

Functions

Link copied to clipboard
open override fun allowsHostFileAccess(): Boolean
Link copied to clipboard
open override fun allowsHostSocketAccess(): Boolean
Link copied to clipboard
open override fun checkAccess(path: Path, modes: MutableSet<out AccessMode>, vararg linkOptions: LinkOption)
Link copied to clipboard
fun checkPolicy(type: AccessType, domain: AccessDomain, path: Path, scope: AccessScope = AccessScope.UNSPECIFIED): AccessResponse
open override fun checkPolicy(request: AccessRequest): AccessResponse

Subclass API: Policy check.

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun copy(source: Path, target: Path, vararg options: CopyOption?)
Link copied to clipboard
open override fun createDirectory(dir: Path, vararg attrs: FileAttribute<*>)
Link copied to clipboard
open override fun createLink(link: Path, existing: Path)
Link copied to clipboard
open override fun createSymbolicLink(link: Path, target: Path, vararg attrs: FileAttribute<*>?)
Link copied to clipboard
open override fun delete(path: Path)
Link copied to clipboard
open override fun existsAny(path: Path): Boolean
Link copied to clipboard
open override fun getEncoding(path: Path): Charset
Link copied to clipboard
open override fun getMimeType(path: Path): String?
Link copied to clipboard
open override fun getPath(vararg segments: String): Path

Subclass API: Parse a path.

Link copied to clipboard
open override fun getPathSeparator(): String
Link copied to clipboard
open override fun getSeparator(): String
Link copied to clipboard
open override fun getTempDirectory(): Path
Link copied to clipboard
open override fun isSameFile(path1: Path, path2: Path, vararg options: LinkOption): Boolean
Link copied to clipboard
open override fun move(source: Path, target: Path, vararg options: CopyOption?)
Link copied to clipboard
open override fun newByteChannel(path: Path, options: MutableSet<out OpenOption>, vararg attrs: FileAttribute<*>): SeekableByteChannel
Link copied to clipboard
Link copied to clipboard
open override fun parsePath(uri: URI): Path
open override fun parsePath(path: String): Path
Link copied to clipboard
open override fun readAttributes(path: Path, attributes: String, vararg options: LinkOption): MutableMap<String, Any>
Link copied to clipboard
open override fun readStream(path: Path, vararg options: OpenOption): InputStream

Subclass API: Read a file.

Link copied to clipboard
open override fun readSymbolicLink(link: Path): Path
Link copied to clipboard
open override fun setAttribute(path: Path, attribute: String, value: Any, vararg options: LinkOption)
Link copied to clipboard
open override fun setCurrentWorkingDirectory(currentWorkingDirectory: Path)
Link copied to clipboard
open override fun toAbsolutePath(path: Path): Path
Link copied to clipboard
open override fun toRealPath(path: Path, vararg linkOptions: LinkOption): Path
Link copied to clipboard
open override fun writeStream(path: Path, vararg options: OpenOption): OutputStream

Subclass API: Write a file.