HashFS

This is a simple implementation of content-addressable storage (CAS for short). Files are stored in a write-once-read-many fashion with a hash of the file’s content serving as the key for future references. The system is simple, but very effective for storing data that does not change that much (which are almost all BLOBs).

Features

  • Hash addressing is compatible with Git storage

Installation

  1. Add HashFS as a dependency:

    def deps do
      [{:hashfs, "~> 0.3.0"}]
    end
  2. Add the following code snippet somewhere in your source code:

    defmodule MyApp.CAS do
      use HashFS.Agent,
        otp_app: :myapp
    end
  3. Configure the agent:

    config :myapp, MyApp.CAS,
      path: "/var/data/hashfs/myapp"
  4. Make sure the agent is started:

    defmodule MyApp.App do
      use Application
      # ...
      children = [
        # ...
        worker(MyApp.CAS, [])
      ]
      # ...
    end