VFS

Ozone uses a central VFS called the Hybrid Storage Filesystem

Ozone file system stores data inside the browser on your device. It does so using low level browser APIs such as OPFS, IndexedDB, File system access API etc. Ozone does not use multiple 'backends' or browser APIs at the same time to store files, instead it uses the most capable backend from what is available. Even though OPFS (the recommended backend) is available in most modern browsers as of base

Meta & content

Ozone filesystem separates file metadata and the content into two discrete sections in the filesystem. This is done in such a way that we do not have to search through the file contents in order to locate a file. While we lose the ability to search through file contents, we gain the ability to search through file metadata and locate the content's references in a spectacular speed. Which is exactly what many modern filesystems do.

Metadata layer

This stores the basic data about a file, like its reference, path, parent or type. This data layer is composed of nodes, which represent either a file or a folder. A folder would be a node containing type as 'folder' while a file's type is 'file'.
A Node contains id, file_name, parent, type, content_id (only for files), and meta. The meta key in a node contains values like created and modified dates.

Content layer

The Ozone filesystem's second layer, the content, has a unique feature: content deduplication. Which computes SHA-1 hashes of each file's content and and stores the actual content addressed to this hash. This is saved as content_id in the file's metadata.

As multiple files may have the same content binaries, the hash is used to identify repeated content. If repeated content is identified, the metadata of all the repeated files would point to a single shared content.

The filesystem uses a per-file reference count to identify how many files refer to a certain content. And the content is removed when that per file count reaches zero - therefore collecting garbage.

Limits

While Ozone VFS is capable and powerful enough for a web runtime, it cannot be used to handle huge filesystems carrying multiple gigabytes of data or thousands of files. Bottlenecks preventing this starts from the index entry search taking up too long if there are thousands of entries, to possibility of collisions with the SHA-1 file hashing.