Another pass at Nebula

Last year (around November), I started writing a content-addressable storage file server in Haskell, called "Nebula". It was more an experiment in writing an HTTP interface and interacting with the filesystem, and it didn't really go anywhere. Files were referenced only via their SHA-256 hash, and you had to know what that was in order to read a file. I never got around to doing the HTTP part of it, though.

I've been doing some thinking, particularly with how to represent a file system in a non-POSIX manner, and I think Nebula is a good candidate for implementing some of these ideas.

In Nebula, files will be represented in one of two ways: an entry, which is the same kind of reference I was thinking about before, and a file, which is a named entry. I'll have to handle the case where two users have the same file, but shouldn't necessarily grant each other access to that file.

I started hacking the idea last night, and I have this much progress:


Store.lhs

module Nebula.Store (
    File, fileID, filePath, fileOwner
  , Identifier
  , Owner
)
where

The file store contains the file store objects. A StoreContext contains information about a store, such as what paths to store things.

data StoreContext = StoreContext {
  storeFiles   :: FilePath -- path to file entries directory
, storeMeta    :: FilePath -- path to metadata directory
, storeEntries :: FilePath -- path to entry storage
}

An Identifier is a string that contains a unique identifier for an entry.

type Identifier = String

An Owner is a unique identifier indicating ownership of a file or entry.

type Owner = String

A file represents a named revision of a content blob.

data File = File { fileID :: Identifier
                 , filePath :: FilePath
                 , fileOwner :: Identifier
}

A file should be either read, in which the entry it references should be looked up and retrieved, or written in which

  • if the file exists, read the identifier in the file and add a new entry to the store with that entry as the parent
  • if the file doesn't exist, create it with a link to the entry it's given

As mentioned in the previous post, the first stage is just to get a model working without access control.


Tags: , ,