Why a new POSIX-like filesystem is needed

Let's talk about how the Hyperdrive FS works and those who have already started using it.





Photo - moren hsu - Unsplash



A few words about Hyperdrive



It is a POSIX- like file system for distributed architecture applications. Its hierarchy is represented by a single tree, and all objects have two names: absolute (from the root) and relative (from the current working directory). Hyperdrive is developed by the authors of the open P2P browser Beaker - it allows you to host sites "right in the browser" - just create a local folder and share the corresponding link.



How the system works



It is implemented in Node.js - its source code is on GitHub . According to the authors, working with Hyperdrive is similar to interacting with the standard Node module - fs . Here's an example :



var hyperdrive = require('hyperdrive')
var archive = hyperdrive('./my-first-hyperdrive') // content will be stored in this folder

archive.writeFile('/hello.txt', 'world', function (err) {
  if (err) throw err
  archive.readdir('/', function (err, list) {
    if (err) throw err
    console.log(list) // prints ['hello.txt']
    archive.readFile('/hello.txt', 'utf-8', function (err, data) {
      if (err) throw err
      console.log(data) // prints 'world'
    })
  })
})


Hyperdrive is based on two special structures called Hypercores. These are append-only logs. The first one stores index metadata and the second one stores file binaries. File and folder names are indexed using a prefixed hash tree to make searching easier. In a sense, it serves as a fast key-value system. Data integrity is verified using a Merkle tree with a BLAKE2b-256 cryptographic hash function .



A special daemon is responsible for handling user requests to the file system . Its CLI allows you to create, share and view Hyperdrive directories. The daemon supports FUSEtherefore Hyperdrives can appear as regular folders on Linux and Mac systems.



Where is it used



Hyperdrive is suitable for developing distributed applications that resemble cloud storage in functionality. For example, the ScienceFair open source platform uses it . She helps researchers search for scientific literature, journals, articles and extracts from them, as well as share their own insights.



Of course, the developers of the Beaker browser use their own file system . It stores the data needed to display websites.





Photo - Clint Adair - Unsplash



Hyperdrive is at the heart of the Dat protocol... It is needed for data exchange in distributed networks. During transmission, the files are split into small fragments of different sizes and collected into a single Dat file by the receiving side. The system allows adding new fragments to it, but does not allow modifying or deleting existing ones. This approach allows you to save the history of document changes.



Today, a fairly large community has already formed around Dat , and the Dat Foundation special fund is engaged in its promotion - it is supported by Mozilla and Code for Science & Society. In the long term, these organizations will contribute to the growing popularity of both the Dat protocol and the Hyperdrive file system.






1cloud.ru:



:

:



RAID-







All Articles